def start_logic(): Game.unsub(MSG_FRAME_START, start_logic) #gateway Game.gateway = GateWayMgr(Game.player_mgr) Game.app.register(Game.gateway) #游戏类 Game.logic_game.start()
def after_start(self): log.info('[subgame]app(%s) start', self.name) import grpc gl = dict(g=Game, ) grpc.shell_locals.update(self.frame.names) grpc.shell_locals.update(gl) #初始化完成,抛出开始消息 Game.safe_pub(MSG_FRAME_START)
def __init__(self): utility.DirtyFlag.__init__(self) self.data = None self.boss = {} #{bossid:obj} self.save_cache = {} # 存储缓存 self._loop_task = None Game.sub(MSG_FRAME_STOP, self._frame_stop)
def start_room(): Game.unsub(MSG_FRAME_START, start_room) Game.timer.start() Game.rpc_room_mgr.start() Game.rpc_dayly_pvp_mgr.start() Game.rpc_txdy_mgr.start() Game.rpc_globalData_mgr.start() Game.rpc_cross_rank_mgr.start() Game.rpc_level_contest_mgr.start() Game.rpc_grouppk_mgr.start()
def init_app_common(): public_init() Game.res_mgr = ResMgr() Game.res_mgr.load() Game.condition_mgr = ConditionMgr() #注册开始消息 Game.sub(MSG_FRAME_START, start_common) #时间管理 from game.mgr.timer import Timer Game.timer = Timer() #初始化rpc功能模块 from game.mgr.player import GPlayerMgr rpc_player_mgr = GPlayerMgr() #服务器信息 from game.mgr.server import ServerInfo rpc_server_info = ServerInfo() #好友管理 from game.mgr.friend import FriendMgr rpc_friend_mgr = FriendMgr() # 邮箱 from game.mgr.mail import MailMgr rpc_mail_mgr = MailMgr() #答题管理 from game.mgr.exam import ExamMgr rpc_exam_mgr = ExamMgr() #全民boss from game.mgr.boss import QmBossMgr rpc_qmboss_mgr = QmBossMgr() #野外boss from game.mgr.boss import YwBossMgr rpc_ywboss_mgr = YwBossMgr() # 生死劫boss from game.mgr.boss import SsjBossMgr rpc_ssjboss_mgr = SsjBossMgr() #服务器公共资源管理 from game.mgr.commonres import CommonresMgr rpc_commonres_mgr = CommonresMgr() #房间管理-本地 from game.mgr.room import RoomMgrCommon rpc_room_mgr_common = RoomMgrCommon() #日常pvp-本地 from game.mgr.daylyPVP import DaylyPVPMgrCommon rpc_dayly_pvp_mgr_common = DaylyPVPMgrCommon() #帮会管理 from game.mgr.guild import GuildMgr rpc_guild_mgr = GuildMgr() return rpc_player_mgr, rpc_server_info, rpc_friend_mgr, rpc_mail_mgr, rpc_exam_mgr, \ rpc_qmboss_mgr, rpc_ywboss_mgr, rpc_ssjboss_mgr, rpc_commonres_mgr, \ rpc_dayly_pvp_mgr_common, rpc_room_mgr_common, rpc_guild_mgr
def __init__(self): utility.DirtyFlag.__init__(self) self.data = None self.opentime = 0 self.mergetime = 0 self.profile_start = 0 self.profile_end = 0 self.save_cache = {} # 存储缓存 Game.sub(MSG_FRAME_STOP, self._frame_stop)
def __init__(self): utility.DirtyFlag.__init__(self) self.data = None self.cycleWeek = CycleWeek(self, keepCyc=2) self.players = {} #玩家缓存数据 self.pid_matchId = {} self.save_cache = {} self._save_loop_task = None Game.sub(MSG_FRAME_STOP, self._frame_stop)
def __init__(self): utility.DirtyFlag.__init__(self) self.data = None self.firstKill = { } #{ssjId:{names:[], round:1, time:0} 全服首杀队伍 首杀者名字 首杀回合数 首杀时间戳 self.minKill = { } #{ssjId:{names:[], round:1, time:0} 最少回合队伍 名字 最少回合数 最少回合击杀时间戳 self.save_cache = {} # 存储缓存 self._loop_task = None Game.sub(MSG_FRAME_STOP, self._frame_stop)
def __init__(self): utility.DirtyFlag.__init__(self) self.data = None self.boss = {} # {bossid:obj} self.save_cache = {} # 存储缓存 self._loop_task = None self.runaway_timer = None #逃跑定时器 self.refresh_timer = None #刷新定时器 Game.sub(MSG_FRAME_STOP, self._frame_stop)
def to_init_data(self): serverInfo = Game.rpc_server_info.GetServerInfo() mergetime = serverInfo.get("mergetime", 0) if mergetime and mergetime != self.mymergetime: print( "===========================================================") print("MergeTime", "%s|%s|%s" % (self.owner.id, mergetime, self.mymergetime)) Game.glog.log2File( "MergeTime", "%s|%s|%s" % (self.owner.id, mergetime, self.mymergetime)) print( "===========================================================") self.mymergetime = mergetime # self.owner.charge.FirstCharge=[] # self.owner.charge.FirstChargeRMB=0 # self.owner.charge.FirstChargeFlag += 1 #不确定要不要 # self.owner.charge.markDirty() self.owner.arena.mergeClean() self.owner.levelContest.mergeClean() self.owner.fuli.mergeClean() init_data = {} init_data["pid"] = self.owner.id init_data["name"] = self.name init_data["renameCount"] = self.renameCount init_data["fa"] = self.fa init_data["lv"] = self.lv init_data["sex"] = self.sex init_data["exp"] = self.exp init_data["CliConfig"] = self.CliConfig init_data["newTime"] = self.owner.data.newTime init_data["curTimeZone"] = Game.get_cur_time_zone() kv = {} retval = [] for v in Game.res_mgr.res_cycle.values(): kv[v.activityID] = True serverInfo = self.GetServerInfo() for v in kv.keys(): res = Game.res_mgr.res_activity.get(v) retval.append({ "activityID": v, "cycleFuncID": res.getCycleFuncID(serverInfo), "endtime": res.getCycleEndTime(serverInfo) }) init_data["cycle"] = retval return init_data
def init_app_logic(): public_init() Game.res_mgr = ResMgr() Game.res_mgr.load() Game.condition_mgr = ConditionMgr() #注册开始消息 Game.sub(MSG_FRAME_START, start_logic) #初始化rpc功能模块 from game.mgr.logicgame import LogicGame Game.logic_game = LogicGame() #玩家管理器 from game.mgr.player import SubPlayerMgr Game.player_mgr = SubPlayerMgr() Game.logic_game.stop_mgrs.append(Game.player_mgr) return Game.logic_game, Game.player_mgr
def start_common(): Game.unsub(MSG_FRAME_START, start_common) #gateway Game.gateway = GateWayMgr(Game.rpc_player_mgr) Game.app.register(Game.gateway) Game.timer.start() Game.rpc_player_mgr.start() Game.rpc_server_info.start() Game.rpc_friend_mgr.start() Game.rpc_mail_mgr.start() Game.rpc_exam_mgr.start() Game.rpc_qmboss_mgr.start() Game.rpc_ywboss_mgr.start() Game.rpc_ssjboss_mgr.start() Game.rpc_commonres_mgr.start() Game.rpc_dayly_pvp_mgr_common.start() Game.rpc_room_mgr_common.start() Game.rpc_guild_mgr.start()
def init_app_room(): public_init() Game.res_mgr = ResMgr() Game.res_mgr.load() #注册开始消息 Game.sub(MSG_FRAME_START, start_room) #初始化rpc功能模块 from game.mgr.timer import Timer Game.timer = Timer() #战斗 Game.fight_mgr = FightMgr() from game.mgr.room import RoomMgr rpc_room_mgr = RoomMgr() from game.mgr.daylyPVP import DaylyPVPMgr rpc_dayly_pvp_mgr = DaylyPVPMgr() from game.mgr.txdy import TxdyMgr rpc_txdy_mgr = TxdyMgr() from game.mgr.globalData import GlobalDataMgr rpc_globalData_mgr = GlobalDataMgr() from game.mgr.crossRank import CrossRankMgr rpc_cross_rank_mgr = CrossRankMgr() from game.mgr.levelContest import LevelContestMgr rpc_level_contest_mgr = LevelContestMgr() from game.mgr.groupPK import GroupPKMgr rpc_grouppk_mgr = GroupPKMgr() return rpc_room_mgr, rpc_dayly_pvp_mgr, rpc_txdy_mgr, rpc_cross_rank_mgr, rpc_level_contest_mgr, rpc_grouppk_mgr, rpc_globalData_mgr
def __init__(self): self.alls = {} # {gid: guild} Game.sub(MSG_FRAME_STOP, self._frame_stop) self._loop_task = None
def before_stop(self): """ 准备关闭 """ log.info('[subgame]app(%s) before_stop', self.name) Game.safe_pub(MSG_FRAME_STOP)