public virtual void PreLoad() { if (Singleton <BattleLogic> .instance.isRuning) { return; } GameSettings.DecideDynamicParticleLOD(); Singleton <CHeroSelectBaseSystem> .instance.m_fOpenHeroSelectForm = Time.time - Singleton <CHeroSelectBaseSystem> .instance.m_fOpenHeroSelectForm; this.GameReportor.PrepareReport(); Singleton <BattleLogic> .GetInstance().isRuning = true; Singleton <BattleLogic> .GetInstance().isFighting = false; Singleton <BattleLogic> .GetInstance().isGameOver = false; Singleton <BattleLogic> .GetInstance().isWaitMultiStart = false; ActionManager.Instance.frameMode = true; MonoSingleton <ActionManager> .GetInstance().ForceStop(); Singleton <GameObjMgr> .GetInstance().ClearActor(); Singleton <SceneManagement> .GetInstance().Clear(); MonoSingleton <SceneMgr> .GetInstance().ClearAll(); MonoSingleton <GameLoader> .GetInstance().ResetLoader(); List <Player> .Enumerator enumerator = Singleton <GamePlayerCenter> .instance.GetAllPlayers().GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.get_Current() != null) { ReadonlyContext <uint> allHeroIds = enumerator.get_Current().GetAllHeroIds(); for (int i = 0; i < allHeroIds.Count; i++) { ActorMeta actorMeta = default(ActorMeta); ActorMeta actorMeta2 = actorMeta; actorMeta2.ActorCamp = enumerator.get_Current().PlayerCamp; actorMeta2.PlayerId = enumerator.get_Current().PlayerId; actorMeta2.ConfigId = (int)allHeroIds[i]; actorMeta = actorMeta2; MonoSingleton <GameLoader> .instance.AddActor(ref actorMeta); } } } if (!MonoSingleton <GameFramework> .instance.EditorPreviewMode) { if (string.IsNullOrEmpty(Singleton <GameContextEx> .GetInstance().GameContextCommonInfo.MapArtistFileName)) { MonoSingleton <GameLoader> .instance.AddLevel(Singleton <GameContextEx> .GetInstance().GameContextCommonInfo.MapDesignFileName); } else { MonoSingleton <GameLoader> .instance.AddDesignSerializedLevel(Singleton <GameContextEx> .GetInstance().GameContextCommonInfo.MapDesignFileName); MonoSingleton <GameLoader> .instance.AddArtistSerializedLevel(Singleton <GameContextEx> .GetInstance().GameContextCommonInfo.MapArtistFileName); } MonoSingleton <GameLoader> .instance.AddSoundBank("Effect_Common"); MonoSingleton <GameLoader> .instance.AddSoundBank("System_Voice"); } try { DebugHelper.CustomLog("GameBuilder Start Game: ispvplevel={0} ispvpmode={4} levelid={1} leveltype={6} levelname={3} Gametype={2} pick={5}", new object[] { Singleton <GameContextEx> .GetInstance().IsMobaMode(), Singleton <GameContextEx> .GetInstance().GameContextCommonInfo.MapId, Singleton <GameContextEx> .GetInstance().GetGameType(), Singleton <GameContextEx> .GetInstance().GameContextCommonInfo.MapName, Singleton <GameContextEx> .GetInstance().IsMobaMode(), Singleton <GameContextEx> .GetInstance().GetSelectHeroType(), Singleton <GameContextEx> .GetInstance().GameContextSoloInfo.PveLevelType }); Player hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer(); if (hostPlayer != null) { DebugHelper.CustomLog("HostPlayer player id={1} name={2} ", new object[] { hostPlayer.PlayerId, hostPlayer.Name }); } } catch (Exception) { } }
public GameInfoBase StartGame(GameContextBase InGameContext) { DebugHelper.Assert(InGameContext != null); if (InGameContext == null) { return(null); } if (Singleton <BattleLogic> .get_instance().isRuning) { return(null); } SynchrReport.Reset(); GameSettings.DecideDynamicParticleLOD(); Singleton <CHeroSelectBaseSystem> .get_instance().m_fOpenHeroSelectForm = Time.time - Singleton <CHeroSelectBaseSystem> .get_instance().m_fOpenHeroSelectForm; this.m_fLoadingTime = Time.time; this.m_eventsLoadingTime.Clear(); ApolloAccountInfo accountInfo = Singleton <ApolloHelper> .GetInstance().GetAccountInfo(false); DebugHelper.Assert(accountInfo != null, "account info is null"); this.m_iMapId = InGameContext.levelContext.m_mapID; this.m_kGameType = InGameContext.levelContext.GetGameType(); this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("OpenID", (accountInfo == null) ? "0" : accountInfo.get_OpenId())); this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("LevelID", InGameContext.levelContext.m_mapID.ToString())); this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("isPVPLevel", InGameContext.levelContext.IsMobaMode().ToString())); this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("isPVPMode", InGameContext.levelContext.IsMobaMode().ToString())); this.m_eventsLoadingTime.Add(new KeyValuePair <string, string>("bLevelNo", InGameContext.levelContext.m_levelNo.ToString())); Singleton <BattleLogic> .GetInstance().isRuning = true; Singleton <BattleLogic> .GetInstance().isFighting = false; Singleton <BattleLogic> .GetInstance().isGameOver = false; Singleton <BattleLogic> .GetInstance().isWaitMultiStart = false; ActionManager.Instance.frameMode = true; MonoSingleton <ActionManager> .GetInstance().ForceStop(); Singleton <GameObjMgr> .GetInstance().ClearActor(); Singleton <SceneManagement> .GetInstance().Clear(); MonoSingleton <SceneMgr> .GetInstance().ClearAll(); MonoSingleton <GameLoader> .GetInstance().ResetLoader(); InGameContext.PrepareStartup(); if (!MonoSingleton <GameFramework> .get_instance().EditorPreviewMode) { DebugHelper.Assert(InGameContext.levelContext != null); DebugHelper.Assert(!string.IsNullOrEmpty(InGameContext.levelContext.m_levelDesignFileName)); if (string.IsNullOrEmpty(InGameContext.levelContext.m_levelArtistFileName)) { MonoSingleton <GameLoader> .get_instance().AddLevel(InGameContext.levelContext.m_levelDesignFileName); } else { MonoSingleton <GameLoader> .get_instance().AddDesignSerializedLevel(InGameContext.levelContext.m_levelDesignFileName); MonoSingleton <GameLoader> .get_instance().AddArtistSerializedLevel(InGameContext.levelContext.m_levelArtistFileName); } MonoSingleton <GameLoader> .get_instance().AddSoundBank("Effect_Common"); MonoSingleton <GameLoader> .get_instance().AddSoundBank("System_Voice"); } GameInfoBase gameInfoBase = InGameContext.CreateGameInfo(); DebugHelper.Assert(gameInfoBase != null, "can't create game logic object!"); this.gameInfo = gameInfoBase; gameInfoBase.PreBeginPlay(); Singleton <BattleLogic> .get_instance().m_LevelContext = this.gameInfo.gameContext.levelContext; try { DebugHelper.CustomLog("GameBuilder Start Game: ispvplevel={0} ispvpmode={4} levelid={1} leveltype={6} levelname={3} Gametype={2} pick={5}", new object[] { InGameContext.levelContext.IsMobaMode(), InGameContext.levelContext.m_mapID, InGameContext.levelContext.GetGameType(), InGameContext.levelContext.m_levelName, InGameContext.levelContext.IsMobaMode(), InGameContext.levelContext.GetSelectHeroType(), InGameContext.levelContext.m_pveLevelType }); Player hostPlayer = Singleton <GamePlayerCenter> .get_instance().GetHostPlayer(); if (hostPlayer != null) { DebugHelper.CustomLog("HostPlayer player id={1} name={2} ", new object[] { hostPlayer.PlayerId, hostPlayer.Name }); } } catch (Exception) { } if (!MonoSingleton <GameFramework> .get_instance().EditorPreviewMode) { this.m_fLoadProgress = 0f; MonoSingleton <GameLoader> .GetInstance().Load(new GameLoader.LoadProgressDelegate(this.onGameLoadProgress), new GameLoader.LoadCompleteDelegate(this.OnGameLoadComplete)); MonoSingleton <VoiceSys> .GetInstance().HeroSelectTobattle(); Singleton <GameStateCtrl> .GetInstance().GotoState("LoadingState"); } return(gameInfoBase); }