Example #1
0
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            MainScreen         = GameObject.Find("MainScreen");
            MainScreenPosition = MainScreen.transform.position;
            if (firstActivation && activationType == ActivationType.AddedToHierarchy)
            {
                Instance = this;
                title    = "Counters+";

                navigationController = BeatSaberUI.CreateViewController <BackButton>();
                navigationController.DidFinishEvent += BackButton_DidFinish;

                editSettings = BeatSaberUI.CreateViewController <CountersPlusEditViewController>();
                placeholder  = BeatSaberUI.CreateViewController <CountersPlusFillerForMainViewController>();
                //settingsList = BeatSaberUI.CreateViewController<CountersPlusSettingsListViewController>();
                horizSettingsList = BeatSaberUI.CreateViewController <CountersPlusHorizontalSettingsListViewController>();
                credits           = BeatSaberUI.CreateViewController <CountersPlusCreditsViewController>();
            }
            SetViewControllersToNavigationConctroller(navigationController, new VRUIViewController[] { credits });
            ProvideInitialViewControllers(placeholder, navigationController, editSettings, horizSettingsList);
            MainScreen.transform.position = new Vector3(0, -100, 0); //"If it works it's not stupid"

            CounterWarning.CreateWarning("Due to limitations, some counters may not reflect their true appearance in-game.", 7.5f);
            if (!Plugin.UpToDate)
            {
                CounterWarning.CreateWarning("A new Counters+ update is available to download!", 5);
            }
            StartCoroutine(InitMockCounters());
        }
Example #2
0
        private void BackButton_DidFinish()
        {
            foreach (KeyValuePair <MockCounterGroup, ConfigModel> kvp in MockCounter.loadedMockCounters)
            {
                Destroy(kvp.Key.CounterName);
                Destroy(kvp.Key.CounterData);
            }
            CountersPlusEditViewController.ClearScreen();
            MockCounter.loadedMockCounters.Clear();
            CounterWarning.ClearAllWarnings();
            Destroy(TextHelper.CounterCanvas.gameObject);
            TextHelper.CounterCanvas      = null;
            MainScreen.transform.position = MainScreenPosition;
            MainFlowCoordinator mainFlow = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First();

            mainFlow.InvokeMethod("DismissFlowCoordinator", this, null, false);
            foreach (CounterWarning warning in CounterWarning.existing)
            {
                DestroyImmediate(warning.gameObject);
            }
        }
Example #3
0
        protected override void BackButtonWasPressed(ViewController controller)
        {
            foreach (KeyValuePair <MockCounterGroup, ConfigModel> kvp in MockCounter.loadedMockCounters)
            {
                Destroy(kvp.Key.CounterName);
                Destroy(kvp.Key.CounterData);
            }
            CountersPlusEditViewController.ClearScreen();
            MockCounter.loadedMockCounters.Clear();
            CounterWarning.ClearAllWarnings();
            Destroy(TextHelper.CounterCanvas.gameObject);
            TextHelper.CounterCanvas      = null;
            MainScreen.transform.position = MainScreenPosition;
            MainFlowCoordinator mainFlow = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First();

            mainFlow.InvokePrivateMethod("DismissFlowCoordinator", new object[] { this, null, false });
            ConfigModelController.ClearAllControllers();

            //Reload settings from config
            CountersController.settings = ConfigLoader.LoadSettings();
        }