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
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)
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
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
def _registerClasses(): TYActivityRegister.registerClass(TYActivityJumpToWelfare.TYPE_ID, TYActivityJumpToWelfare) TYActivityRegister.registerClass(TYActivityPlayGamePresentGift.TYPE_ID, TYActivityPlayGamePresentGift) TYActivityRegister.registerClass(TYActivityExchangeCode.TYPE_ID, TYActivityExchangeCode) TYActivityRegister.registerClass(TYActivityRaffle.TYPE_ID, TYActivityRaffle) TYActivityRegister.registerClass(TYActivityFirstCharge.TYPE_ID, TYActivityFirstCharge) TYActivityRegister.registerClass(TYActivityNoticeImg.TYPE_ID, TYActivityNoticeImg) TYActivityRegister.registerClass(TYActivityVipMatch.TYPE_ID, TYActivityVipMatch) TYActivityRegister.registerClass(TYActivityDdzMatch.TYPE_ID, TYActivityDdzMatch) TYActivityRegister.registerClass(TYActivityFanfanle.TYPE_ID, TYActivityFanfanle) TYActivityRegister.registerClass(TYActivitySale.TYPE_ID, TYActivitySale) TYActivityRegister.registerClass(TYActivityMatchQuiz.TYPE_ID, TYActivityMatchQuiz) from hall.entity.hallactivity.activity_share_click import TYActShareClick TYActivityRegister.registerClass(TYActShareClick.TYPE_ID, TYActShareClick) from hall.entity.hallactivity.activity_credit_exchange import TYActCreditExchange TYActivityRegister.registerClass(TYActCreditExchange.TYPE_ID, TYActCreditExchange) from hall.entity.hallactivity.activity_newfriend_invite import TYActNewFriendInvite TYActivityRegister.registerClass(TYActNewFriendInvite.TYPE_ID, TYActNewFriendInvite) from hall.entity.hallactivity.activity_item_exchange import TYActItemExchange TYActivityRegister.registerClass(TYActItemExchange.TYPE_ID, TYActItemExchange)
def _initialize(): import freetime.entity.config as ftcon if ftcon.global_config.get('is_h5', 0): _initialize_h5() return eventbus = TGDizhu.getEventBus() SharePlayground.registerEvents(eventbus) FiveStarRate.initialize() TeHuiLiBao.registerEvents() MatchLed.registerEvent(eventbus) Login30.registerEvents() ChouJiang360.registerEvents(eventbus) VipSend.registerEvents() DashiSend.registerEvents() DdzRedEnvelope.registerListener(eventbus) DumplingsUtil.registerListener(eventbus) XingyaoLed.initialize() DdzMatchScore.registerListeners(eventbus) SkillLevelGift.registerListeners(eventbus) ItemSender.registerListeners(eventbus) MonthCheckinGift.initialize() MonthCheckinGiftNum.initialize() BindingPhoneHandler.registerListeners(eventbus) ActivityDdzFund.initialize() # 大厅活动界面显示的活动处理 # 基金活动 TYActivityRegister.registerClass(TYActivityFund.TYPE_ID, TYActivityFund) #20 # 地主红包活动 TYActivityRegister.registerClass(TYActivityDdzRedEnvelope.TYPE_ID, TYActivityDdzRedEnvelope) # 6001 TYActivityRegister.registerClass(TYActivityDdzRedEnvelope.TYPE_ID_PC, TYActivityDdzRedEnvelope) #6002 # 饺子活动 TYActivityRegister.registerClass(TYActivityDumplings.TYPE_ID, TYActivityDumplings) #6003 TYActivityRegister.registerClass(TYActivityDumplings.TYPE_ID_PC, TYActivityDumplings) #6005 # 许愿池活动 TYActivityRegister.registerClass(WishingWell.TYPE_ID, WishingWell) #6011 # 竞猜活动 TYActivityRegister.registerClass(BetGuess.TYPE_ID, BetGuess) #6012 # 牌局分享 TYActivityRegister.registerClass(TableReplayRanking.TYPE_ID, TableReplayRanking) #6013 # 趣味任务活动 TYActivityRegister.registerClass(FunAct.TYPE_ID, FunAct) #6014 # 新版红包 TYActivityRegister.registerClass(LuckyMoneyNew.TYPE_ID, LuckyMoneyNew) # 6015 # 华为大师杯 TYActivityRegister.registerClass(ActivityScoreRankingHandler.TYPE_ID, ActivityScoreRankingHandler) # 比赛晋级列表 TYActivityRegister.registerClass(TYActivityMatchPromotionList.TYPE_ID, TYActivityMatchPromotionList) # 圣诞活动 TYActivityRegister.registerClass(ActivityChristmasHandler.TYPE_ID, ActivityChristmasHandler) # 下注竞猜活动 betguess.initialize() funact.initialize() table_replay_ranking.initialize() luckymoneynew.initialize()