private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene) { if (scene.buildIndex > 0) { if (FirstFetch) { Console.WriteLine("Launching coroutine to grab original sabers!"); SharedCoroutineStarter.instance.StartCoroutine(PreloadDefaultSabers()); Console.WriteLine("Launched!"); } } if (scene.name == "GameCore") { LoadNewSaber(_currentSaberPath); SaberScript.LoadAssets(); } if (scene.name == "Menu") { if (_currentSaber != null) { _currentSaber.Unload(true); } CustomSaberUI.OnLoad(); } }
void Awake() { Instance = this; foreach (Sprite sprite in Resources.FindObjectsOfTypeAll <Sprite>()) { Icons.Add(sprite); } try { var allButtons = Resources.FindObjectsOfTypeAll <Button>(); _buttonInstance = Resources.FindObjectsOfTypeAll <Button>().First(x => x.name == "QuitButton"); _cogWheelButtonInstance = allButtons.FirstOrDefault(x => x.name == "SettingsButton"); _downArrowBtn = allButtons.First(x => x.name == "PageDownButton"); _upArrowBtn = allButtons.First(x => x.name == "PageUpButton"); _backButtonInstance = allButtons.First(x => x.name == "BackArrowButton"); _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First(); _menuMasterViewController = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First(); _mainMenuRectTransform = (RectTransform)_buttonInstance.transform.parent; AddCustomSaberButton(); } catch (Exception) { } }
protected override void DidActivate(bool firstActivation, ActivationType activationType) { if (firstActivation) { ui = CustomSaberUI._instance; _contentViewController = BeatSaberUI.CreateViewController <TCONT>(); _rightViewController = BeatSaberUI.CreateViewController <TRIGHT>(); title = OnContentCreated(_contentViewController); } if (activationType == FlowCoordinator.ActivationType.AddedToHierarchy) { ProvideInitialViewControllers(_contentViewController, null, _rightViewController); } }
protected override void DidActivate(bool firstActivation, ActivationType activationType) { if (firstActivation) { title = "Saber Select"; ui = CustomSaberUI._instance; _saberListViewController = BeatSaberUI.CreateViewController <SaberListViewController>(); _saberListViewController.backButtonPressed += Dismiss; } if (activationType == FlowCoordinator.ActivationType.AddedToHierarchy) { ProvideInitialViewControllers(_saberListViewController, null, null); } }
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene) { if (scene.name == "NiceEnvironment" || scene.name == "DefaultEnvironment" || scene.name == "BigMirrorEnvironment" || scene.name == "TriangleEnvironment") { LoadNewSaber(_currentSaberPath); SaberScript.LoadAssets(); } if (scene.name == "Menu") { if (_currentSaber != null) { _currentSaber.Unload(true); } CustomSaberUI.OnLoad(); } }
private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene) { if (scene.name == "StandardLevel") { LoadNewSaber(_currentSaberPath); SaberScript.LoadAssets(); } if (scene.name == "Menu") { if (_currentSaber != null) { _currentSaber.Unload(true); } CustomSaberUI.OnLoad(); } }
private void Awake() { _instance = this; try { //_buttonInstance = Resources.FindObjectsOfTypeAll<Button>().First(x => (x.name == "QuitButton")); //_backButtonInstance = Resources.FindObjectsOfTypeAll<Button>().First(x => (x.name == "BackArrowButton")); //_mainMenuViewController = Resources.FindObjectsOfTypeAll<MainMenuViewController>().First(); _mainFlowCoordinator = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First(); //_mainMenuRectTransform = _buttonInstance.transform.parent as RectTransform; } catch (Exception e) { Console.WriteLine("EXCEPTION ON AWAKE(TRY FIND BUTTONS): " + e); } CreateCustomSaberButton(); }
private void Awake() { _instance = this; try { //_buttonInstance = Resources.FindObjectsOfTypeAll<Button>().First(x => (x.name == "QuitButton")); //_backButtonInstance = Resources.FindObjectsOfTypeAll<Button>().First(x => (x.name == "BackArrowButton")); //_mainMenuViewController = Resources.FindObjectsOfTypeAll<MainMenuViewController>().First(); _mainFlowCoordinator = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First(); //_mainMenuRectTransform = _buttonInstance.transform.parent as RectTransform; } catch (Exception ex) { Logger.Log($"{ex.Message}\n{ex.StackTrace}", LogLevel.Error); } CreateCustomSaberButton(); }
public void OnActiveSceneChanged(Scene from, Scene to) { //if (scene.buildIndex > 0) //{ // if (FirstFetch) // { // //Logger.Log("Launching coroutine to grab original sabers!", LogLevel.Debug); // //SharedCoroutineStarter.instance.StartCoroutine(PreloadDefaultSabers()); // //Logger.Log("Launched!", LogLevel.Debug); // } //} if (to.name == "GameCore") { LoadNewSaber(_currentSaberName); SaberScript.LoadAssets(); } if (to.name == "MenuCore") { CustomSaberUI.OnLoad(); } }
protected override void DidActivate(bool firstActivation, ActivationType activationType) { _customSaberUI = CustomSaberUI.Instance; _backButton = _customSaberUI.CreateBackButton(rectTransform); (_backButton.transform as RectTransform).anchorMin = new Vector2(0, 0); (_backButton.transform as RectTransform).anchorMin = new Vector2(0, 0); (_backButton.transform as RectTransform).anchoredPosition = new Vector2(0, 0.5f); _backButton.onClick.AddListener(delegate() { DismissModalViewController(null, false); }); if (customSaberListViewController == null) { customSaberListViewController = _customSaberUI.CreateViewController <CustomSaberListViewController>(); customSaberListViewController.rectTransform.anchorMin = new Vector2(0.3f, 0f); customSaberListViewController.rectTransform.anchorMax = new Vector2(0.7f, 1f); } PushViewController(customSaberListViewController, true); Resources.FindObjectsOfTypeAll <MainMenuViewController>().First().didFinishEvent += MainMenuNavigated; }
protected override void DidActivate(bool firstActivation, ActivationType activationType) { previewparent = Instantiate(new GameObject("preview parent")); previewparent.transform.position = new Vector3(2.5f, 1, 0.3f); previewparent.transform.Rotate(new Vector3(0, -30, 0)); _customSaberUI = CustomSaberUI.Instance; _parentViewController = GetComponentInParent <CustomSaberMasterViewController>(); try { if (_pageDownButton == null) { try { _pageDownButton = _customSaberUI.CreateButton(rectTransform, "PageDownButton"); ((RectTransform)_pageDownButton.transform).anchorMin = new Vector2(0.5f, 0f); ((RectTransform)_pageDownButton.transform).anchorMax = new Vector2(0.5f, 0f); ((RectTransform)_pageDownButton.transform).anchoredPosition = new Vector2(0f, 10f); _pageDownButton.interactable = true; _pageDownButton.onClick.AddListener(delegate() { _sabersTableView.PageScrollDown(); }); } catch (Exception e) { Console.WriteLine(e); throw; } } if (_pageUpButton == null) { try { _pageUpButton = _customSaberUI.CreateButton(rectTransform, "PageUpButton"); ((RectTransform)_pageUpButton.transform).anchorMin = new Vector2(0.5f, 1f); ((RectTransform)_pageUpButton.transform).anchorMax = new Vector2(0.5f, 1f); ((RectTransform)_pageUpButton.transform).anchoredPosition = new Vector2(0f, -14f); _pageUpButton.interactable = true; _pageUpButton.onClick.AddListener(delegate() { _sabersTableView.PageScrollUp(); }); } catch (Exception e) { Console.WriteLine(e); throw; } } if (_sabersTableView == null) { _sabersTableView = new GameObject().AddComponent <TableView>(); _sabersTableView.transform.SetParent(rectTransform, false); var viewportMask = Instantiate(Resources.FindObjectsOfTypeAll <Mask>().First(), _sabersTableView.transform, false); viewportMask.transform.DetachChildren(); _sabersTableView.GetComponentsInChildren <RectTransform>().First(x => x.name == "Content").transform.SetParent(viewportMask.rectTransform, false); ((RectTransform)_sabersTableView.transform).anchorMin = new Vector2(0f, 0.5f); ((RectTransform)_sabersTableView.transform).anchorMax = new Vector2(1f, 0.5f); ((RectTransform)_sabersTableView.transform).sizeDelta = new Vector2(0f, 60f); ((RectTransform)_sabersTableView.transform).anchoredPosition = new Vector2(0f, 0f); _sabersTableView.didSelectRowEvent += _sabersTableView_DidSelectRowEvent; ReflectionUtil.SetPrivateField(_sabersTableView, "_pageUpButton", _pageUpButton); ReflectionUtil.SetPrivateField(_sabersTableView, "_pageDownButton", _pageDownButton); _sabersTableView.dataSource = this; _sabersTableView.ScrollToRow(0, false); } else { _sabersTableView.ReloadData(); _sabersTableView.ScrollToRow(0, false); } } catch (Exception ex) { Console.WriteLine(ex); } _songListTableCellInstance = Resources.FindObjectsOfTypeAll <StandardLevelListTableCell>().First(x => (x.name == "StandardLevelListTableCell")); LoadSabers(); base.DidActivate(true, ActivationType.AddedToHierarchy); }