public override void Stop() { this.DisposeGlobalTimers(); this.SaveTimerProc(null); this.SaveRecordProc(null); CenterService.Stop(); base.Stop(); }
public override bool Start() { try { Thread.CurrentThread.Priority = ThreadPriority.Normal; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); GameProperties.Refresh(); if (!InitComponent(RecompileScripts(), "Recompile Scripts")) { return(false); } //初始化脚本 if (!InitComponent(StartScriptComponents(), "Script components")) { return(false); } //检查版本是否和数据库一致 if (!InitComponent(GameProperties.EDITION == Edition, "Check Server Edition:" + Edition)) { return(false); } //初始化监听端口 if (!InitComponent(InitSocket(IPAddress.Parse(_config.Ip), _config.Port), "InitSocket Port:" + _config.Port)) { return(false); } //启动服务监听 if (!InitComponent(CenterService.Start(), "Center Service")) { return(false); } //加载服务器列表 if (!InitComponent(ServerMgr.Start(), "Load serverlist")) { return(false); } //加载公会等级信息 if (!InitComponent(ConsortiaLevelMgr.Init(), "Init ConsortiaLevelMgr")) { return(false); } //初始化宏观掉落表 if (!InitComponent(MacroDropMgr.Init(), "Init MacroDropMgr")) { return(false); } //初始化语言包 if (!InitComponent(LanguageMgr.Setup(@""), "LanguageMgr Init")) { return(false); } //初始化全局Timer if (!InitComponent(InitGlobalTimers(), "Init Global Timers")) { return(false); } //发布脚本已加载事件 GameEventMgr.Notify(ScriptEvent.Loaded); //宏观掉落控制开始 MacroDropMgr.Start(); if (!InitComponent(base.Start(), "base.Start()")) { return(false); } //发布服务器开始事件 GameEventMgr.Notify(GameServerEvent.Started, this); GC.Collect(GC.MaxGeneration); log.Info("GameServer is now open for connections!"); GameProperties.Save(); return(true); } catch (Exception e) { log.Error("Failed to start the server", e); return(false); } }
public override bool Start() { bool result; try { Thread.CurrentThread.Priority = ThreadPriority.Normal; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException); GameProperties.Refresh(); if (!this.InitComponent(this.RecompileScripts(), "Recompile Scripts")) { result = false; } else { if (!this.InitComponent(this.StartScriptComponents(), "Script components")) { result = false; } else { if (!this.InitComponent(GameProperties.EDITION == this.Edition, "Check Server Edition:" + this.Edition)) { result = false; } else { if (!this.InitComponent(this.InitSocket(IPAddress.Parse(this._config.Ip), this._config.Port), "InitSocket Port:" + this._config.Port)) { result = false; } else { if (!this.InitComponent(CenterService.Start(), "Center Service")) { result = false; } else { if (!this.InitComponent(ServerMgr.Start(), "Load serverlist")) { result = false; } else { if (!this.InitComponent(ConsortiaLevelMgr.Init(), "Init ConsortiaLevelMgr")) { result = false; } else { if (!this.InitComponent(MacroDropMgr.Init(), "Init MacroDropMgr")) { result = false; } else { if (!this.InitComponent(LanguageMgr.Setup(""), "LanguageMgr Init")) { result = false; } else { if (!this.InitComponent(this.InitGlobalTimers(), "Init Global Timers")) { result = false; } else { GameEventMgr.Notify(ScriptEvent.Loaded); MacroDropMgr.Start(); if (!this.InitComponent(base.Start(), "base.Start()")) { result = false; } else { GameEventMgr.Notify(GameServerEvent.Started, this); GC.Collect(GC.MaxGeneration); CenterServer.log.Info("GameServer is now open for connections!"); GameProperties.Save(); result = true; } } } } } } } } } } } } catch (Exception exception) { CenterServer.log.Error("Failed to start the server", exception); result = false; } return(result); }