// public class ObserverMessage : MessageBase // { // public Replay.Message Message; // // public override void Serialize(NetworkWriter writer) // { // GeneratedNetworkCode._WriteMessage_Replay(writer, this.Message); // } // // public override void Deserialize(NetworkReader reader) // { // this.Message = GeneratedNetworkCode._ReadMessage_Replay(reader); // } // } public void LaunchGame(bool spawnObjects = true) { MapLoader = new AssetLoader(); MapLoader.LoadAssetBundle("Bundles/scenes/maps.bundle"); MapLoader.LoadAsset( $"archive:/buildplayer-robotfactory_opu_gamemode/buildplayer-{GameConfig.Map.ToLower()}"); MapLoader.ConstructCaches(); AssetsLoader = new AssetLoader(); AssetsLoader.LoadAsset("resources.assets"); AssetsLoader.ConstructCaches(); MiscLoader = new AssetLoader(); MiscLoader.LoadAssetBundle("Bundles/scenes/frontend.bundle"); MiscLoader.LoadAsset("archive:/buildplayer-options_ui/buildplayer-clientenvironmentsingletons"); MiscLoader.ConstructCaches(); if (!spawnObjects) { return; } SpawnObject(MiscLoader, "ApplicationSingletonsNetId", out _); SpawnObject(MiscLoader, "GameSceneSingletons", out var gameSceneSingletons); TheatricsManager = gameSceneSingletons.GetComponent <TheatricsManager>(); AbilityModManager = gameSceneSingletons.GetComponent <AbilityModManager>(); SpawnObject(MiscLoader, "SharedEffectBarrierManager", out SharedEffectBarrierManager); SpawnObject(MiscLoader, "SharedActionBuffer", out SharedActionBuffer); SharedActionBuffer.Networkm_actionPhase = ActionBufferPhase.Done; SpawnScene(MapLoader, 1, out var commonGameLogic); InterfaceManager = commonGameLogic.GetComponent <InterfaceManager>(); GameFlow = commonGameLogic.GetComponent <GameFlow>(); // MatchLogger = commonGameLogic.GetComponent<MatchLogger>(); ServerCombatManager = commonGameLogic.GetComponent <ServerCombatManager>(); ServerEffectManager = commonGameLogic.GetComponent <ServerEffectManager>(); TeamStatusDisplay = commonGameLogic.GetComponent <TeamStatusDisplay>(); ServerActionBuffer = commonGameLogic.GetComponent <ServerActionBuffer>(); TeamSelectData = commonGameLogic.GetComponent <TeamSelectData>(); BarrierManager = commonGameLogic.GetComponent <BarrierManager>(); SpawnObject <Board, Board>(MapLoader, out Board); SpawnScene(MapLoader, 2, out BrushCoordinator); SpawnScene(MapLoader, 3, out var sceneGameLogic); GameFlowData = sceneGameLogic.GetComponent <GameFlowData>(); GameplayData = sceneGameLogic.GetComponent <GameplayData>(); SpoilsManager = sceneGameLogic.GetComponent <SpoilsManager>(); ObjectivePoints = sceneGameLogic.GetComponent <ObjectivePoints>(); SpawnPointManager = sceneGameLogic.GetComponent <SpawnPointManager>(); MatchObjectiveKill = sceneGameLogic.GetComponent <MatchObjectiveKill>(); DumpNetObjects(); }
/// <summary> /// Init this game and loads all the assets needed to receive players /// </summary> public void LaunchGame() { SetGameStatus(GameStatus.Launching); MapLoader = new AssetLoader(); MapLoader.LoadAssetBundle("Bundles/scenes/maps.bundle"); MapLoader.LoadAsset($"archive:/buildplayer-robotfactory_opu_gamemode/buildplayer-{GameConfig.Map.ToLower()}"); MapLoader.ConstructCaches(); AssetsLoader = new AssetLoader(); AssetsLoader.LoadAsset("resources.assets"); AssetsLoader.ConstructCaches(); MiscLoader = new AssetLoader(); MiscLoader.LoadAssetBundle("Bundles/scenes/frontend.bundle"); MiscLoader.LoadAsset("archive:/buildplayer-options_ui/buildplayer-clientenvironmentsingletons"); MiscLoader.ConstructCaches(); SpawnObject(MiscLoader, "ApplicationSingletonsNetId", out _); SpawnObject(MiscLoader, "GameSceneSingletons", out var gameSceneSingletons); TheatricsManager = gameSceneSingletons.GetComponent <TheatricsManager>(); AbilityModManager = gameSceneSingletons.GetComponent <AbilityModManager>(); SpawnObject(MiscLoader, "SharedEffectBarrierManager", out SharedEffectBarrierManager); SpawnObject(MiscLoader, "SharedActionBuffer", out SharedActionBuffer); SharedActionBuffer.Networkm_actionPhase = ActionBufferPhase.Done; SpawnScene(MapLoader, 1, out var commonGameLogic); InterfaceManager = commonGameLogic.GetComponent <InterfaceManager>(); GameFlow = commonGameLogic.GetComponent <GameFlow>(); MatchLogger = commonGameLogic.GetComponent <MatchLogger>(); ServerCombatManager = commonGameLogic.GetComponent <ServerCombatManager>(); ServerEffectManager = commonGameLogic.GetComponent <ServerEffectManager>(); TeamStatusDisplay = commonGameLogic.GetComponent <TeamStatusDisplay>(); ServerActionBuffer = commonGameLogic.GetComponent <ServerActionBuffer>(); TeamSelectData = commonGameLogic.GetComponent <TeamSelectData>(); BarrierManager = commonGameLogic.GetComponent <BarrierManager>(); SpawnObject <Board, Board>(MapLoader, out Board); SpawnScene(MapLoader, 2, out BrushCoordinator); SpawnScene(MapLoader, 3, out var sceneGameLogic); GameFlowData = sceneGameLogic.GetComponent <GameFlowData>(); GameplayData = sceneGameLogic.GetComponent <GameplayData>(); SpoilsManager = sceneGameLogic.GetComponent <SpoilsManager>(); ObjectivePoints = sceneGameLogic.GetComponent <ObjectivePoints>(); SpawnPointManager = sceneGameLogic.GetComponent <SpawnPointManager>(); MatchObjectiveKill = sceneGameLogic.GetComponent <MatchObjectiveKill>(); PrintAllNetworkGameObjects(); foreach (LobbyPlayerInfo playerInfo in TeamInfo.TeamPlayerInfo) { // We use the ReadyState here to indicate wheter a player or bot finished loading the match if (playerInfo.IsNPCBot) { playerInfo.ReadyState = ReadyState.Ready; // Bots are marked as ready as they don't have to load anything } else { playerInfo.ReadyState = ReadyState.Unknown; // Unknown means it is loading } } SetGameStatus(GameStatus.Launched); }