public void Init(int mapId) { resSvc = ResSvc.instance; audioSvc = AudioSvc.instance; timerSvc = TimerSvc.instance; stateMgr = this.gameObject.AddComponent <StateMgr>(); stateMgr.Init(); skillMgr = this.gameObject.AddComponent <SkillMgr>(); skillMgr.Init(); mapCfg = resSvc.GetMapCfgData(mapId); resSvc.AsyncLoadScene(mapCfg.sceneName, () => { GameObject mapObj = GameObject.FindWithTag("MapRoot"); mapMgr = mapObj.GetComponent <MapMgr>(); mapMgr.Init(); audioSvc.PlayBgMusic(Constants.BGHuangye); mapObj.transform.position = Vector3.zero; mapObj.transform.localScale = Vector3.one; Camera.main.transform.position = mapCfg.mainCamPos; Camera.main.transform.localEulerAngles = mapCfg.mainCamRote; LoadPlayer(mapCfg); SetActiveCurrentBatchMonsters(); }); }
public void Init(int mapId) { resSev = ResSev.Instance; audioSev = AudioSev.Instance; stateMgr = gameObject.AddComponent <StateMgr>(); skillMgr = gameObject.AddComponent <SkillMgr>(); stateMgr.Init(); skillMgr.Init(); mapCfg = resSev.GetMapCfgData(mapId); resSev.AsyncLoadScene(mapCfg.sceneName, () => { GameObject map = GameObject.FindGameObjectWithTag("MapRoot"); mapMgr = map.GetComponent <MapMgr>(); mapMgr.Init(this); map.transform.localPosition = Vector3.zero; map.transform.localScale = Vector3.one; Camera.main.transform.position = mapCfg.mainCamPos; Camera.main.transform.localEulerAngles = mapCfg.mainCamRote; LoadPlayer(mapCfg); audioSev.PlayBGM(Constans.HuangYeBGM); ActiveCurrentBatchMonsters(); }); }
public void Init(int mapID) { resSvc = ResSvc.Instance; audioSvc = AudioSvc.Instance; //初始化各个管理器 stateMgr = gameObject.AddComponent <StateMgr>(); stateMgr.Init(); skillMgr = gameObject.AddComponent <SkillMgr>(); skillMgr.Init(); //加载战场地图 MapCfgs mapData = resSvc.GetMapCfgData(mapID); resSvc.AsyncLoadScene(mapData.sceneName, () => { //初始化地图数据 GameObject map = GameObject.FindGameObjectWithTag("MapRoot"); mapMgr = map.GetComponent <MapMgr>(); mapMgr.Init(); //初始化地图位置和摄像机位置 map.transform.localPosition = Vector3.zero; map.transform.localScale = Vector3.zero; Camera.main.transform.position = mapData.mainCamPos; Camera.main.transform.localEulerAngles = mapData.mainCamRote; LoadPlayer(mapData); audioSvc.PlayBGMusic(Constants.BGHuangYe); entityPlayer.Idle(); }); }
public void Init(int mapid, Action cb = null) { TriggerCheck = true; IsPauseGame = false; //初始化各管理器 m_StateMgr.Init(); m_SkillMgr.Init(); //加载战场地图 m_MapCfg = GameEntry.Res.GetMapCfg(mapid); //初始化地图数据 //GameObject map = GameObject.FindGameObjectWithTag("MapRoot"); m_MapMgr = GameObject.FindObjectOfType <MapMgr>(); m_MapMgr.Init(this); monsterDic.Clear(); Camera.main.transform.position = m_MapCfg.mainCamPos; Camera.main.transform.localEulerAngles = m_MapCfg.mainCamRote; LoadPlayer(); //GameEntry.Sound.PlayUISound(Constants.BGHuangYe); if (cb != null) { cb(); } }
public void Init(int mapID) { resSvc = ResSvc.Instance; audioSvc = AudioSvc.Instance; //初始化各个管理器 stateMgr = gameObject.AddComponent <StateMgr>(); stateMgr.Init(); skillMgr = gameObject.AddComponent <SkillMgr>(); skillMgr.Init(); MapCfg mapData = resSvc.GetMapCfgData(mapID); resSvc.AsyncLoadScene(mapData.sceneName, () => { audioSvc.PlayBGMusic(Constants.BGHuangYe); GameObject map = GameObject.FindGameObjectWithTag("MapRoot"); mapMgr = map.GetComponent <MapMgr>(); mapMgr.Init(); Camera.main.transform.position = mapData.mainCamPos; Camera.main.transform.eulerAngles = mapData.mainCamRote; LoadPlayer(mapData); }); }
public void Init(int mapId) { mResSvc = ResSvc.Instance; mAudioSvc = AudioSvc.Instance; mCfgSvc = CfgSvc.Instance; mSkillMgr = gameObject.AddComponent <SkillMgr>(); mSkillMgr.Init(); mStateMgr = gameObject.AddComponent <StateMgr>(); mStateMgr.Init(); mAudioSvc.PlayBgAudio(Constant.Audio_BgHuangYe); CfgMap cfg = mCfgSvc.GetCfgMap(mapId); if (cfg == null) { Debug.LogError("╪сть╣ьм╪й╖╟э: " + mapId); return; } mResSvc.AsyncLoadScene(cfg.sceneName, () => { GameObject mapGo = GameObject.FindGameObjectWithTag("MapRoot"); mMapMgr = mapGo.AddComponent <MapMgr>(); mMapMgr.Init(); InitScene(cfg); }); }
public void Init(int fbid, Action cb) { resSvc = ResSvc.Instance; audioSvc = AudioSvc.Instance; //初始化各状态管理器 stateMgr = gameObject.AddComponent <StateMgr>(); stateMgr.Init(); skillMgr = gameObject.AddComponent <SkillMgr>(); skillMgr.Init(); //加载战斗的地图 mapCfg = resSvc.GetMapCfg(fbid); resSvc.AsyncLoadScene(mapCfg.sceneName, () => { //地图初始化 GameObject map = GameObject.FindGameObjectWithTag("MapRoot"); mapMgr = map.GetComponent <MapMgr>(); mapMgr.Init(this); audioSvc.PlayBGMusic(Constant.BGOrge, true); map.transform.localPosition = Vector3.zero; map.transform.localScale = Vector3.one; Camera.main.transform.position = mapCfg.mainCamPos; Camera.main.transform.localEulerAngles = mapCfg.mainCamRote; LoadPlayer(mapCfg); BattleSys.Instance.SetPlayerCtrlWindow(true); //激活第一批怪物 ActiveCurrentBatchMonster(); if (cb != null) { cb(); } }); PECommon.Log("BattleMgr Init Done"); }
private void Init() { CustomLoggerService.Instance.Init(); mTimer = TimerServiceForTest.Instance; mTimer.Init(); SaveMgr.Instance.Init(); mMapMgr = MapMgr.Instance; mMapMgr.Init(MapWidth, MapHeight); mAStarMgr = AStarMgr.Instance; mAStarMgr.Init(); mRandomMapCreator = RandomMapCreator.Instance; mRandomMapCreator.Init(); mRecorder = Recorder.Instance; mRecorder.Init(); mTimer.Subscribe(TIMER_KEY_CREATE_MAP); mTimer.Subscribe(TIMER_KEY_ASTAR_PF); InitDataId(); HTLogger.Info("All init done."); }
public void Init(int mapid, Action cb = null) { resSvc = ResSvc.Instance; audioSvc = AudioSvc.Instance; // 初始化各个管理器 stateMgr = gameObject.AddComponent <StateMgr>(); stateMgr.Init(); skillMgr = gameObject.AddComponent <SkillMgr>(); skillMgr.Init(); // 加载战场地图 mapCfg = resSvc.GetMapCfgData(mapid); resSvc.AsyncLoadScene(mapCfg.sceneName, () => { // 初始化地图数据 GameObject map = GameObject.FindGameObjectWithTag("MapRoot"); mapMgr = map.GetComponent <MapMgr>(); mapMgr.Init(this); map.transform.localPosition = Vector3.zero; map.transform.localScale = Vector3.one; Camera.main.transform.position = mapCfg.mainCameraPos; Camera.main.transform.localEulerAngles = mapCfg.mainCameraRot; LoadPlayer(mapCfg); entityPlayer.Idle(); // 激活当前批次的怪物 ActiveCurrentBatchMonsters(); if (cb != null) { cb(); } audioSvc.PlayBGAudio(Constants.BGHuangYe); }); Common.Log("BattleMgr init done"); }
public void Init(int mapId, Action cb = null) { resSvc = ResSvc.Instance; audioSvc = AudioSvc.Instance; // 初始化各管理器 stateMgr = gameObject.AddComponent <StateMgr>(); stateMgr.Init(); skillMgr = gameObject.AddComponent <SkillMgr>(); skillMgr.Init(); // 加载战场地图 mapCfg = resSvc.GetMapCfg(mapId); resSvc.AsyncLoadScene(mapCfg.sceneName, () => { // 初始化地图数据 GameObject map = GameObject.FindGameObjectWithTag("MapRoot"); mapMgr = map.GetComponent <MapMgr>(); mapMgr.Init(this); map.transform.localPosition = Vector3.zero; map.transform.localScale = Vector3.one; Camera.main.transform.localPosition = mapCfg.mainCamPos; Camera.main.transform.localEulerAngles = mapCfg.mainCamRote; LoadPlayer(mapCfg); entitySelfPlayer.Idle(); // 激活第一批次怪物 ActiveCurrentBatchMonsters(); audioSvc.PlayBGMusic(Constants.BGHuangYe); if (cb != null) { cb(); } }); }
public void Init(int characterID, int mapId) { // TODO: 单个实体独立状态管理 stateMgr = gameObject.AddComponent <StateMgr>(); stateMgr.Init(); skillMgr = gameObject.AddComponent <SkillMgr>(); skillMgr.Init(); mapCfg = ConfigSvc.Ins.GetMapCfg(mapId); AsyncLoadScene(mapCfg.SceneName, () => { var go = GameObject.FindGameObjectWithTag("MapRoot"); go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; mapMgr = go.GetComponent <MapMgr>(); mapMgr.Init(this); LoadPlayer(characterID, mapCfg); selfPlayer.Idle(mapCfg.PlayerBornDir); }); }
public override bool Start() { if (m_isRunning) { return(false); } try { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Thread.CurrentThread.Priority = ThreadPriority.Normal; GameProperties.Refresh(); if (!InitComponent(RecompileScripts(), "Recompile Scripts")) { return(false); } if (!InitComponent(StartScriptComponents(), "Script components")) { return(false); } if (!InitComponent((GameProperties.EDITION == Edition), "Edition:" + Edition)) { return(false); } if (!InitComponent(InitSocket(IPAddress.Parse(Configuration.Ip), Configuration.Port), "InitSocket Port:" + Configuration.Port)) { return(false); } if (!InitComponent(AllocatePacketBuffers(), "AllocatePacketBuffers()")) { return(false); } if (!InitComponent(LogMgr.Setup(Configuration.GAME_TYPE, Configuration.ServerID, Configuration.AreaID), "LogMgr Init")) { return(false); } if (!InitComponent(WorldMgr.Init(), "WorldMgr Init")) { return(false); } if (!InitComponent(MapMgr.Init(), "MapMgr Init")) { return(false); } if (!InitComponent(ItemMgr.Init(), "ItemMgr Init")) { return(false); } if (!InitComponent(ItemBoxMgr.Init(), "ItemBox Init")) { return(false); } if (!InitComponent(BallMgr.Init(), "BallMgr Init")) { return(false); } if (!InitComponent(BallConfigMgr.Init(), "BallConfigMgr Init")) { return(false); } if (!InitComponent(FusionMgr.Init(), "FusionMgr Init")) { return(false); } if (!InitComponent(AwardMgr.Init(), "AwardMgr Init")) { return(false); } if (!InitComponent(NPCInfoMgr.Init(), "NPCInfoMgr Init")) { return(false); } if (!InitComponent(MissionInfoMgr.Init(), "MissionInfoMgr Init")) { return(false); } if (!InitComponent(PveInfoMgr.Init(), "PveInfoMgr Init")) { return(false); } if (!InitComponent(DropMgr.Init(), "Drop Init")) { return(false); } if (!InitComponent(FightRateMgr.Init(), "FightRateMgr Init")) { return(false); } if (!InitComponent(ConsortiaLevelMgr.Init(), "ConsortiaLevelMgr Init")) { return(false); } if (!InitComponent(RefineryMgr.Init(), "RefineryMgr Init")) { return(false); } if (!InitComponent(StrengthenMgr.Init(), "StrengthenMgr Init")) { return(false); } if (!InitComponent(PropItemMgr.Init(), "PropItemMgr Init")) { return(false); } if (!InitComponent(ShopMgr.Init(), "ShopMgr Init")) { return(false); } if (!InitComponent(QuestMgr.Init(), "QuestMgr Init")) { return(false); } if (!InitComponent(RoomMgr.Setup(Configuration.MaxRoomCount), "RoomMgr.Setup")) { return(false); } if (!InitComponent(GameMgr.Setup(Configuration.ServerID, GameProperties.BOX_APPEAR_CONDITION), "GameMgr.Start()")) { return(false); } if (!InitComponent(ConsortiaMgr.Init(), "ConsortiaMgr Init")) { return(false); } if (!InitComponent(LanguageMgr.Setup(@""), "LanguageMgr Init")) { return(false); } if (!InitComponent(RateMgr.Init(Configuration), "ExperienceRateMgr Init")) { return(false); } if (!InitComponent(MacroDropMgr.Init(), "MacroDropMgr Init")) { return(false); } if (!InitComponent(BattleMgr.Setup(), "BattleMgr Setup")) { return(false); } if (!InitComponent(InitGlobalTimer(), "Init Global Timers")) { return(false); } if (!InitComponent(MarryRoomMgr.Init(), "MarryRoomMgr Init")) { return(false); } if (!InitComponent(LogMgr.Setup(1, 4, 4), "LogMgr Setup")) { return(false); } GameEventMgr.Notify(ScriptEvent.Loaded); if (!InitComponent(InitLoginServer(), "Login To CenterServer")) { return(false); } RoomMgr.Start(); GameMgr.Start(); BattleMgr.Start(); MacroDropMgr.Start(); if (!InitComponent(base.Start(), "base.Start()")) { return(false); } GameEventMgr.Notify(GameServerEvent.Started, this); GC.Collect(GC.MaxGeneration); if (log.IsInfoEnabled) { log.Info("GameServer is now open for connections!"); } m_isRunning = true; return(true); } catch (Exception e) { if (log.IsErrorEnabled) { log.Error("Failed to start the server", e); } return(false); } }
public override bool Start() { bool result; try { LogProvider.Default = new LogProvider(new LogConfig { FilePath = "./log/fight/", UseConsole = true, UseFile = true }); this.m_running = true; Thread.CurrentThread.Priority = ThreadPriority.Normal; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException); CrossFightServer.log.Warn("正在初始化…………"); if (!Sql_DbObject.TryConnection()) { result = false; CrossFightServer.log.Error("数据库连接失败,请检查!"); return(result); } CrossFightServer.log.Info("数据库连接成功!"); if (!this.InitSocket(IPAddress.Parse(this.m_config.IP), this.m_config.Port)) { result = false; CrossFightServer.log.Error("初始化监听端口失败,请检查!"); return(result); } CrossFightServer.log.Info("初始化监听端口成功!"); if (!MapMgr.Init()) { result = false; CrossFightServer.log.Error("初始化地图失败,请检查!"); return(result); } CrossFightServer.log.Info("初始化地图成功!"); if (!ItemMgr.Init()) { result = false; CrossFightServer.log.Error("初始化物品失败,请检查!"); return(result); } CrossFightServer.log.Info("初始化物品成功!"); if (!PropItemMgr.Init()) { result = false; CrossFightServer.log.Error("初始化道具失败,请检查!"); return(result); } CrossFightServer.log.Info("初始化道具成功!"); if (!BallMgr.Init()) { result = false; CrossFightServer.log.Error("初始化炸弹失败,请检查!"); return(result); } CrossFightServer.log.Info("初始化炸弹成功!"); if (!DropMgr.Init()) { result = false; CrossFightServer.log.Error("初始化掉落失败,请检查!"); return(result); } CrossFightServer.log.Info("初始化掉落成功!"); if (!NPCInfoMgr.Init()) { result = false; CrossFightServer.log.Error("初始化npc失败,请检查!"); return(result); } CrossFightServer.log.Info("初始化npc成功!"); if (!LanguageMgr.Load()) { result = false; CrossFightServer.log.Error("初始化语言包失败,请检查!"); return(result); } CrossFightServer.log.Info("初始化语言包成功!"); if (!base.Start()) { result = false; CrossFightServer.log.Error("基础服务启动失败,请检查!"); return(result); } CrossFightServer.log.Info("基础服务启动成功!"); if (!ProxyRoomMgr.Setup()) { result = false; CrossFightServer.log.Error("启动房间管理服务失败,请检查!"); return(result); } ProxyRoomMgr.Start(); CrossFightServer.log.Info("启动房间管理服务成功!"); if (!GameMgr.Setup(0, 4)) { result = false; CrossFightServer.log.Error("启动游戏管理服务失败,请检查!"); return(result); } GameMgr.Start(); StartScriptComponents(); GameEventMgr.Notify(ScriptEvent.Loaded); CrossFightServer.log.Info("启动游戏管理服务成功!"); GC.Collect(GC.MaxGeneration); CrossFightServer.log.Warn("战斗服务器已启动!"); result = true; } catch (Exception e) { CrossFightServer.log.Error("Failed to start the server", e); result = false; } return(result); }
public override bool Start() { if (m_running) { return(false); } try { m_running = true; Thread.CurrentThread.Priority = ThreadPriority.Normal; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); //初始化监听端口 if (!InitComponent(InitSocket(m_config.Ip, m_config.Port), "InitSocket Port:" + m_config.Port)) { return(false); } //初始化脚本 if (!InitComponent(StartScriptComponents(), "Script components")) { return(false); } if (!InitComponent(ProxyRoomMgr.Setup(), "RoomMgr.Setup")) { return(false); } if (!InitComponent(GameMgr.Setup(0, 4), "GameMgr.Setup")) { return(false); } if (!InitComponent(MapMgr.Init(), "MapMgr Init")) { return(false); } if (!InitComponent(ItemMgr.Init(), "ItemMgr Init")) { return(false); } if (!InitComponent(PropItemMgr.Init(), "ItemMgr Init")) { return(false); } //if (!InitComponent(VaneMgr.ByteAray(), "VaneMgr ByteAray")) // return false; if (!InitComponent(BallMgr.Init(), "BallMgr Init")) { return(false); } if (!InitComponent(BallConfigMgr.Init(), "BallConfigMgr Init")) { return(false); } if (!InitComponent(DropMgr.Init(), "DropMgr Init")) { return(false); } if (!InitComponent(NPCInfoMgr.Init(), "NPCInfoMgr Init")) { return(false); } if (!InitComponent(LanguageMgr.Setup(@""), "LanguageMgr Init")) { return(false); } //发布脚本已加载事件 GameEventMgr.Notify(ScriptEvent.Loaded); if (!InitComponent(base.Start(), "base.Start()")) { return(false); } ProxyRoomMgr.Start(); GameMgr.Start(); //发布服务器开始事件 GameEventMgr.Notify(GameServerEvent.Started, this); GC.Collect(GC.MaxGeneration); log.Info("GameServer is now open for connections!"); return(true); } catch (Exception e) { log.Error("Failed to start the server", e); return(false); } }
public override bool Start() { if (this.m_running) { return(false); } bool result; try { this.m_running = true; Thread.CurrentThread.Priority = ThreadPriority.Normal; AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(this.CurrentDomain_UnhandledException); if (!this.InitComponent(this.InitSocket(this.m_config.Ip, this.m_config.Port), "InitSocket Port:" + this.m_config.Port)) { result = false; } else { if (!this.InitComponent(this.StartScriptComponents(), "Script components")) { result = false; } else { if (!this.InitComponent(ProxyRoomMgr.Setup(), "RoomMgr.Setup")) { result = false; } else { if (!this.InitComponent(GameMgr.Setup(0, 4), "GameMgr.Setup")) { result = false; } else { if (!this.InitComponent(MapMgr.Init(), "MapMgr Init")) { result = false; } else { if (!this.InitComponent(ItemMgr.Init(), "ItemMgr Init")) { result = false; } else { if (!this.InitComponent(PropItemMgr.Init(), "PropItemMgr Init")) { result = false; } else { if (!this.InitComponent(BallMgr.Init(), "BallMgr Init")) { result = false; } else { if (!this.InitComponent(BallConfigMgr.Init(), "BallConfigMgr Init")) { result = false; } else { if (!this.InitComponent(DropMgr.Init(), "DropMgr Init")) { result = false; } else { if (!this.InitComponent(NPCInfoMgr.Init(), "NPCInfoMgr Init")) { result = false; } else { if (!this.InitComponent(WindMgr.Init(), "WindMgr Init")) { result = false; } else { if (!this.InitComponent(GoldEquipMgr.Init(), "GoldEquipMgr Init")) { result = false; } else { if (!this.InitComponent(LanguageMgr.Setup(""), "LanguageMgr Init")) { result = false; } else { GameEventMgr.Notify(ScriptEvent.Loaded); if (!this.InitComponent(base.Start(), "base.Start()")) { result = false; } else { ProxyRoomMgr.Start(); GameMgr.Start(); GameEventMgr.Notify(GameServerEvent.Started, this); GC.Collect(GC.MaxGeneration); FightServer.log.Info("GameServer is now open for connections!"); result = true; } } } } } } } } } } } } } } } } catch (Exception exception) { FightServer.log.Error("Failed to start the server", exception); result = false; } return(result); }
private void Init(Object sender, EventArgs e) { LogProvider.Default = new LogProvider(new LogConfig { UseMessageBox = true, LogView = LogView, UseLogView = true, FilePath = @".\log\", UseFile = true }); var log = LogProvider.Default; this.runmgr = new RunMgr(); Web.Server.WebServer.Runmgr = this.runmgr; new Thread(() => { if (!Sql_DbObject.TryConnection()) { log.Error("Fail to connect to SQL!"); WinForm.Notice("初始化失败,请查看日志。"); return; } else { log.Info("Succeed to to connect to SQL!"); } if (!LanguageMgr.Load()) { log.Error("Fail to load language"); WinForm.Notice("初始化失败,请查看日志。"); return; } else { log.Info("Succeed to load language"); } if (!MapMgr.Init()) { log.Error("Fail to load map"); WinForm.Notice("初始化失败,请查看日志。"); return; } else { log.Info("Succeed to load map"); } if (!ItemMgr.Init()) { log.Error("Fail to load item"); WinForm.Notice("初始化失败,请查看日志。"); return; } else { log.Info("Succeed to load item"); } if (!PropItemMgr.Init()) { log.Error("Fail to load propitem"); WinForm.Notice("初始化失败,请查看日志。"); return; } else { log.Info("Succeed to load propitem"); } if (!BallMgr.Init()) { log.Error("Fail to load ball"); WinForm.Notice("初始化失败,请查看日志。"); return; } else { log.Info("Succeed to load ball"); } if (!DropMgr.Init()) { log.Error("Fail to load drop"); WinForm.Notice("初始化失败,请查看日志。"); return; } else { log.Info("Succeed to load drop"); } if (!NPCInfoMgr.Init()) { log.Error("Fail to load npc"); WinForm.Notice("初始化失败,请查看日志。"); return; } else { log.Info("Succeed to load npc"); } if (!ItemBoxMgr.Init()) { log.Error("Fail to load itembox"); WinForm.Notice("初始化失败,请查看日志。"); return; } else { log.Info("Succeed to load itembox"); } flag = true; }).Start(); Thread thread = new Thread(run); thread.Start(); }