/// <summary> /// Unity event. /// </summary> private void Start() { GameplayState gameplayState = SceneManager.Instance.GameplayState; RoomSelectable = gameplayState.Room.GetComponent <Selectable>(); InvoiceData.ClearData(); Mission mission = null; if (GameplayState.MissionToLoad == ModMission.CUSTOM_MISSION_ID) { mission = GameplayState.CustomMission; } else { mission = MissionManager.Instance.GetMission(GameplayState.MissionToLoad); } InvoiceData.MissionName = mission?.DisplayName; if (string.IsNullOrEmpty(InvoiceData.MissionName)) { InvoiceData.MissionName = "Free Play"; } FactoryGameModePicker.GameMode gameModeEnum; GameMode = FactoryGameModePicker.CreateGameMode(GameplayState.MissionToLoad, gameObject, out gameModeEnum); InvoiceData.GameMode = gameModeEnum; QuickDelay(() => GameMode.Setup(this)); OnLightChange(false); }
/// <summary> /// Unity event. /// </summary> private void Start() { GameplayState gameplayState = SceneManager.Instance.GameplayState; RoomSelectable = gameplayState.Room.GetComponent <Selectable>(); InvoiceData.ClearData(); Mission mission = gameplayState.Mission; InvoiceData.MissionName = mission != null?Localization.GetLocalizedString(mission.DisplayNameTerm != "Freeplay"?mission.DisplayNameTerm : "Missions/freeplay_DisplayName") : null; FactoryGameModePicker.GameMode gameModeEnum; GameMode = FactoryGameModePicker.CreateGameMode(GameplayState.MissionToLoad, gameObject, out gameModeEnum); InvoiceData.GameMode = gameModeEnum; QuickDelay(() => GameMode.Setup(this)); OnLightChange(false); KMModSettings modSettings = GetComponent <KMModSettings>(); ModSettings activeModSettings = JsonConvert.DeserializeObject <ModSettings>(modSettings.Settings); GetComponent <SpoopyScares>().enabled = activeModSettings.halloweenEvent; }
private IEnumerator FixCustomMission() { for (int frameCount = 0; frameCount < 4; ++frameCount) { yield return(null); } string missionID = SceneManager.Instance.GameplayState.Mission.ID; FactoryGameModePicker.GameMode?gameMode = FactoryGameModePicker.GetGameModeForMission(missionID); if (gameMode.HasValue && gameMode.Value.GetGameModeType() == typeof(InfiniteSequenceMode)) { SceneManager.Instance.GameplayState.Mission.name = "__fixedCustomMission"; FactoryGameModePicker.UpdateMission(SceneManager.Instance.GameplayState.Mission, true, true, true); SceneManager.Instance.GameplayState.Mission.name = missionID; } }
private void OnStateChange(KMGameInfo.State state) { switch (state) { case KMGameInfo.State.Setup: Logging.Log("State Change: Setup"); InvoiceData.Enabled = false; InvoiceData.ClearData(); MultipleBombsInterface.RediscoverMultipleBombs(); FactoryGameModePicker.UpdateCompatibleMissions(); _fromSetupRoom = true; _binderConverter.Revert(); break; case KMGameInfo.State.Gameplay: Logging.Log("State Change: Gameplay"); if (GameplayState.MissionToLoad == ModMission.CUSTOM_MISSION_ID && _fromSetupRoom) { FactoryGameModePicker.UpdateMission(GameplayState.CustomMission, true, false, true); StartCoroutine(FixCustomMission()); } _fromSetupRoom = false; _binderConverter.Revert(); break; case KMGameInfo.State.PostGame: Logging.Log("Stage Change: PostGame"); if (InvoiceData.Enabled) { _binderConverter.Convert(); } break; default: break; } }