Ejemplo n.º 1
0
    def reloadConf(self):
        confids = set(self._dao.activitiesConf.iterkeys())
        objids = set(self._activities.iterkeys())
        reloadids = confids & objids
        for actid in reloadids:  # 已有的对象
            config = self._dao.getActivityConfig(actid)
            if not config:
                continue
            actobj = self.getActivityObj(actid)
            actobj.reload(config)

        for actid in (objids - reloadids):  # 废弃对象
            actobj = self.getActivityObj(actid)
            actobj.finalize()

        for actid in (confids - reloadids):  # 新增的对象
            config = self._dao.getActivityConfig(actid)
            if not config:
                continue
            activityClass = TYActivityRegister.findClass(config["typeid"])
            if not activityClass:
                continue
            serverConf = config.pop("server_config")
            clientConf = config
            actobj = activityClass(self._dao, clientConf, serverConf)
            self._activities[actid] = actobj
Ejemplo n.º 2
0
    def reloadConf(self):
        confids = set(self._dao.activitiesConf.iterkeys())
        objids = set(self._activities.iterkeys())
        reloadids = confids & objids
        for actid in reloadids:  # 已有的对象
            config = self._dao.getActivityConfig(actid)
            if not config:
                continue
            actobj = self.getActivityObj(actid)
            actobj.reload(config)

        for actid in (objids - reloadids):  # 废弃对象
            actobj = self.getActivityObj(actid)
            actobj.finalize()

        for actid in (confids - reloadids):  # 新增的对象
            config = self._dao.getActivityConfig(actid)
            if not config:
                continue
            activityClass = TYActivityRegister.findClass(config["typeid"])
            if not activityClass:
                continue
            serverConf = config.pop("server_config")
            clientConf = config
            actobj = activityClass(self._dao, clientConf, serverConf)
            self._activities[actid] = actobj
Ejemplo n.º 3
0
def _onConfChangedReloadActivity(actconf):
    ftlog.debug('_onConfChangedReloadActivity', actconf["typeid"], actconf)
    activityClass = TYActivityRegister.findClass(actconf["typeid"])
    ftlog.debug('_onConfChangedReloadActivity', actconf["typeid"],
                activityClass)
    if not activityClass:
        return
    serverConf = actconf.pop("server_config")
    clientConf = actconf
    activityClass(activitySystem._dao, clientConf, serverConf)
Ejemplo n.º 4
0
 def _findActObj(cls, gameId, userId, clientId):
     actConf = activity.activitySystem.getClientActivityConfig(
         clientId, cls.activityId)
     ftlog.debug('MonthCheckinGiftNum._findActObj gameId=', gameId,
                 'userId=', userId, 'presentNumActId=', cls.activityId,
                 'clientId=', clientId, 'actConf=', actConf)
     if actConf and TYActivityRegister.findClass(
             actConf.get('typeid')) == TYActivityPlayGamePresentGift:
         return activity.activitySystem.generateOrGetActivityObject(actConf)
     return None
Ejemplo n.º 5
0
 def _findActObj(self, gameId, userId, clientId):
     actConf = activity.activitySystem.getClientActivityConfig(clientId, self._presentNumActId)
     ftlog.debug('ChargeSendPresentNum._findActObj gameId=', gameId,
                'userId=', userId,
                'presentNumActId=', self._presentNumActId,
                'clientId=', clientId,
                'rate=', self._rate,
                'actConf=', actConf)
     if actConf and TYActivityRegister.findClass(actConf.get('typeid')) == TYActivityPlayGamePresentGift:
         return activity.activitySystem.generateOrGetActivityObject(actConf)
     return None