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()); }
private void RefreshScreen(string name, string title) { CountersPlusEditViewController.UpdateTitle(title); Type controllerType = Type.GetType($"CountersPlus.UI.ViewControllers.ConfigModelControllers.HUD.{name}"); ConfigModelController.GenerateController(controllerType, CountersPlusEditViewController.Instance.SettingsContainer, $"CountersPlus.UI.BSML.HUD.{name}.bsml"); }
public override void OnCellSelect(TableView view, int row, CountersPlusHorizontalSettingsListViewController settings) { switch (row) { case 0: CountersPlusEditViewController.ShowMainSettings(); break; case 1: CountersPlusEditViewController.ShowDonators(); break; case 2: CountersPlusEditViewController.ShowContributors(); break; } }
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); } }
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(); }
public override void OnCellSelect(TableView view, int row, CountersPlusHorizontalSettingsListViewController settings) { CountersPlusEditViewController.ClearScreen(true); MockCounter.Highlight <ConfigModel>(null); switch (row) { case 0: RefreshScreen("General", "General HUD Settings"); break; case 1: RefreshScreen("Camera", "HUD Camera Settings"); break; case 2: RefreshScreen("Position", "HUD Position Offset"); break; case 3: RefreshScreen("Rotation", "HUD Rotation"); break; } }
public override void OnCellSelect(TableView view, int row, CountersPlusHorizontalSettingsListViewController settings) { CountersPlusEditViewController.UpdateSettings(counterInfos[row].Model); }