Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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;
        }
Exemplo n.º 3
0
        private void OnDisable()
        {
            InvoiceData.Enabled = false;
            InvoiceData.ClearData();

            _gameInfo.OnStateChange -= OnStateChange;
        }
Exemplo n.º 4
0
        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;
            }
        }
Exemplo n.º 5
0
 private void OnDisable()
 {
     InvoiceData.Enabled = false;
     InvoiceData.ClearData();
 }