Beispiel #1
0
        private void Awake()
        {
            _instance = this;
            foreach (Sprite sprite in Resources.FindObjectsOfTypeAll <Sprite>())
            {
                icons.Add(sprite);
            }
            try
            {
                _buttonInstance         = Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "QuitButton"));
                _backButtonInstance     = Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "BackArrowButton"));
                _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
                _mainMenuRectTransform  = _buttonInstance.transform.parent as RectTransform;
            }
            catch (Exception e)
            {
                Console.WriteLine("EXCEPTION ON AWAKE(TRY FIND BUTTONS): " + e);
            }

            try
            {
                CreatePlatformsButton();
            }
            catch (Exception e)
            {
                Console.WriteLine("EXCEPTION ON AWAKE(TRY CREATE BUTTON): " + e);
            }
        }
Beispiel #2
0
        private void Start()
        {
            envHider   = new EnvironmentHider();
            matSwapper = new MaterialSwapper();
            matSwapper.GetMaterials();

            CreateAllPlatforms();

            // Retrieve saved path from player prefs if it exists
            if (PlayerPrefs.HasKey("CustomPlatformPath"))
            {
                string savedPath = PlayerPrefs.GetString("CustomPlatformPath");
                // Check if this path was loaded and update our platform index
                for (int i = 0; i < bundlePaths.Count; i++)
                {
                    if (savedPath == bundlePaths.ElementAt(i))
                    {
                        platformIndex = i;
                    }
                }
            }

            PlatformUI.OnLoad();
            if (platforms.ElementAt(platformIndex) != null)
            {
                // Find environment parts after scene change
                envHider.FindEnvironment();

                envHider.HideObjectsForPlatform(platforms.ElementAt(platformIndex));
            }
        }
Beispiel #3
0
 public void OnApplicationStart()
 {
     BSEvents.OnLoad();
     BSEvents.lateMenuSceneLoadedFresh += InitAfterLoad;
     Patcher.Patch();
     PlatformUI.SetupMenuButtons();
 }
Beispiel #4
0
        private void Start()
        {
            platforms = new PlatformLoader().CreateAllPlatforms(transform);

            // Retrieve saved path from player prefs if it exists
            if (ModPrefs.HasKey(CustomFloorPlugin.PluginName, "CustomPlatformPath"))
            {
                string savedPath = ModPrefs.GetString(CustomFloorPlugin.PluginName, "CustomPlatformPath");
                // Check if this path was loaded and update our platform index
                for (int i = 0; i < platforms.Length; i++)
                {
                    if (savedPath == platforms[i].platName + platforms[i].platAuthor)
                    {
                        platformIndex = i;
                        break;
                    }
                }
            }

            EnvironmentArranger.arrangement        = (EnvironmentArranger.Arrangement)ModPrefs.GetInt(CustomFloorPlugin.PluginName, "EnvironmentArrangement", 0, true);
            EnvironmentSceneOverrider.overrideMode = (EnvironmentSceneOverrider.EnvOverrideMode)ModPrefs.GetInt(CustomFloorPlugin.PluginName, "EnvironmentOverrideMode", 0, true);
            EnvironmentSceneOverrider.GetSceneInfos();
            EnvironmentSceneOverrider.OverrideEnvironmentScene();

            envHider = new EnvironmentHider();
            envHider.showFeetOverride = ModPrefs.GetBool(CustomFloorPlugin.PluginName, "AlwaysShowFeet", false, true);
            envHider.FindEnvironment();
            envHider.HideObjectsForPlatform(currentPlatform);

            currentPlatform.gameObject.SetActive(true);

            BSSceneManager.activeSceneChanged += SceneManagerOnActiveSceneChanged;

            PlatformUI.OnLoad();
        }
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            ui = PlatformUI._instance;

            if (_platformListViewController == null)
            {
                _platformListViewController = ui.CreateViewController <PlatformListViewController>();
                _platformListViewController.rectTransform.anchorMin = new Vector2(0.3f, 0f);
                _platformListViewController.rectTransform.anchorMax = new Vector2(0.7f, 1f);

                PushViewController(_platformListViewController, true);
            }
            else
            {
                if (_viewControllers.IndexOf(_platformListViewController) < 0)
                {
                    PushViewController(_platformListViewController, true);
                }
            }

            if (_backButton == null)
            {
                _backButton = ui.CreateBackButton(rectTransform);

                _backButton.onClick.AddListener(delegate()
                {
                    DismissModalViewController(null, false);
                });
            }

            base.DidActivate(firstActivation, activationType);
        }
Beispiel #6
0
        private void Awake()
        {
            _instance = this;
            SceneManager.MoveGameObjectToScene(gameObject, SceneManager.CreateScene("PlatformUIDump", new CreateSceneParameters(LocalPhysicsMode.None)));

            Plugin.gsm.MarkSceneAsPersistent("PlatformUIDump");
        }
        private void Start()
        {
            envHider   = new EnvironmentHider();
            matSwapper = new MaterialSwapper();
            matSwapper.GetMaterials();

            CreateAllPlatforms();

            // Retrieve saved path from player prefs if it exists
            if (PlayerPrefs.HasKey("CustomPlatformPath"))
            {
                string savedPath = PlayerPrefs.GetString("CustomPlatformPath");
                // Check if this path was loaded and update our platform index
                for (int i = 0; i < bundlePaths.Count; i++)
                {
                    if (savedPath == bundlePaths.ElementAt(i))
                    {
                        platformIndex = i;
                    }
                }
            }

            PlatformUI.OnLoad();
            if (platforms.ElementAt(platformIndex) != null)
            {
                Log("Loading platforms.");
                //Finds and hides the environment after it loads.
                StartCoroutine(envHider.WaitForAndFindEnvironment(platforms.ElementAt(platformIndex)));
            }
        }
Beispiel #8
0
        private void Awake()
        {
            _instance = this;
            DontDestroyOnLoad(gameObject);

            BSEvents.menuSceneLoadedFresh += HandleMenuSceneLoadedFresh;
            HandleMenuSceneLoadedFresh();
        }
Beispiel #9
0
 private void Awake()
 {
     _instance                 = this;
     _mainFlowCoordinator      = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First();
     SceneManager.sceneLoaded += SceneManager_sceneLoaded;
     DontDestroyOnLoad(gameObject);
     CreatePlatformsButton();
     CreateSettingsUI();
 }
        /// <summary>
        /// Handles active scene change. Hides Objects as required for the current platform
        /// </summary>
        /// <param name="arg0">Previous Active Scene</param>
        /// <param name="arg1">New Active Scene</param>
        private void BSSceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1)
        {
            if (arg1.name == "Menu")
            {
                PlatformUI.OnLoad();
            }

            // The scene was loaded normally, hide environment as usual
            HideEnvironment();
        }
Beispiel #11
0
        private void Start()
        {
            EnvironmentSceneOverrider.GetSceneInfos();
            EnvironmentSceneOverrider.OverrideEnvironmentScene();

            EnvHider       = new EnvironmentHider();
            platformLoader = new PlatformLoader();

            RefreshPlatforms();
            PlatformUI.OnLoad();
        }
Beispiel #12
0
        /// <summary>
        /// Handles active scene change. Hides Objects as required for the current platform
        /// </summary>
        /// <param name="arg0">Previous Active Scene</param>
        /// <param name="arg1">New Active Scene</param>
        private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1)
        {
            if (arg1.name == "Menu")
            {
                PlatformUI.OnLoad();
            }

            if (platforms.ElementAt(platformIndex) != null)
            {
                // Find environment parts after scene change
                envHider.FindEnvironment();

                envHider.HideObjectsForPlatform(platforms.ElementAt(platformIndex));
            }
        }
        /// <summary>
        /// Handles active scene change. Hides Objects as required for the current platform
        /// </summary>
        /// <param name="arg0">Previous Active Scene</param>
        /// <param name="arg1">New Active Scene</param>
        private void SceneManagerOnActiveSceneChanged(Scene arg0, Scene arg1)
        {
            Log("Scene changed.");
            if (arg1.name == "Menu")
            {
                PlatformUI.OnLoad();
            }


            if (platforms.ElementAt(platformIndex) != null)
            {
                Log("Loading Platforms");
                //Finds and hides environment after it loads.
                StartCoroutine(envHider.WaitForAndFindEnvironment(platforms.ElementAt(platformIndex)));
            }
        }
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            if (firstActivation)
            {
                title = "Platform Select";

                ui = PlatformUI._instance;
            }
            if (_platformListViewController == null)
            {
                _platformListViewController = BeatSaberUI.CreateViewController <PlatformListViewController>();
                _platformListViewController.platformListBackWasPressed += Dismiss;
            }
            if (activationType == FlowCoordinator.ActivationType.AddedToHierarchy)
            {
                ProvideInitialViewControllers(_platformListViewController, null, null);
            }
        }
        private void Start()
        {
            EnvironmentArranger.arrangement        = (EnvironmentArranger.Arrangement)Plugin.config.GetInt("Settings", "EnvironmentArrangement", 0, true);
            EnvironmentSceneOverrider.overrideMode = (EnvironmentSceneOverrider.EnvOverrideMode)Plugin.config.GetInt("Settings", "EnvironmentOverrideMode", 0, true);
            EnvironmentSceneOverrider.GetSceneInfos();
            EnvironmentSceneOverrider.OverrideEnvironmentScene();

            menuEnvHider   = new EnvironmentHider();
            gameEnvHider   = new EnvironmentHider();
            platformLoader = new PlatformLoader();

            BSEvents.gameSceneLoaded      += HandleGameSceneLoaded;
            BSEvents.menuSceneLoadedFresh += HandleMenuSceneLoadedFresh;
            BSEvents.menuSceneLoaded      += HandleMenuSceneLoaded;

            RefreshPlatforms();

            HandleMenuSceneLoadedFresh();

            PlatformUI.OnLoad();
        }
        private void Start()
        {
            envHider   = new EnvironmentHider();
            matSwapper = new MaterialSwapper();
            matSwapper.GetMaterials();

            CreateAllPlatforms();

            // Retrieve saved path from player prefs if it exists
            if (ModPrefs.HasKey(CustomFloorPlugin.PluginName, "CustomPlatformPath"))
            {
                string savedPath = ModPrefs.GetString(CustomFloorPlugin.PluginName, "CustomPlatformPath");
                // Check if this path was loaded and update our platform index
                for (int i = 0; i < bundlePaths.Count; i++)
                {
                    if (savedPath == bundlePaths.ElementAt(i))
                    {
                        platformIndex = i;
                    }
                }
            }
            PlatformUI.OnLoad();
            HideEnvironment();
        }
        protected override void DidActivate(bool firstActivation, ActivationType type)
        {
            try
            {
                if (firstActivation)
                {
                    ui = PlatformUI._instance;
                    _songListTableCellInstance = Resources.FindObjectsOfTypeAll <LevelListTableCell>().First(x => (x.name == "LevelListTableCell"));

                    RectTransform container = new GameObject("PlatformsListContainer", typeof(RectTransform)).transform as RectTransform;
                    container.SetParent(rectTransform, false);
                    container.sizeDelta = new Vector2(60f, 0f);

                    _platformsTableView = new GameObject("PlatformsListTableView").AddComponent <TableView>();
                    _platformsTableView.gameObject.AddComponent <RectMask2D>();
                    _platformsTableView.transform.SetParent(container, false);

                    (_platformsTableView.transform as RectTransform).anchorMin        = new Vector2(0f, 0f);
                    (_platformsTableView.transform as RectTransform).anchorMax        = new Vector2(1f, 1f);
                    (_platformsTableView.transform as RectTransform).sizeDelta        = new Vector2(0f, 60f);
                    (_platformsTableView.transform as RectTransform).anchoredPosition = new Vector3(0f, 0f);

                    _platformsTableView.SetPrivateField("_preallocatedCells", new TableView.CellsGroup[0]);
                    _platformsTableView.SetPrivateField("_isInitialized", false);
                    _platformsTableView.dataSource = this;

                    _platformsTableView.didSelectRowEvent += _PlatformTableView_DidSelectRowEvent;

                    _pageUpButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "PageUpButton")), container, false);
                    (_pageUpButton.transform as RectTransform).anchoredPosition = new Vector2(0f, 30f);//-14
                    _pageUpButton.interactable = true;
                    _pageUpButton.onClick.AddListener(delegate()
                    {
                        _platformsTableView.PageScrollUp();
                    });

                    _pageDownButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "PageDownButton")), container, false);
                    (_pageDownButton.transform as RectTransform).anchoredPosition = new Vector2(0f, -30f);//8
                    _pageDownButton.interactable = true;
                    _pageDownButton.onClick.AddListener(delegate()
                    {
                        _platformsTableView.PageScrollDown();
                    });

                    _versionNumber = Instantiate(Resources.FindObjectsOfTypeAll <TextMeshProUGUI>().First(x => (x.name == "Text")), rectTransform, false);

                    (_versionNumber.transform as RectTransform).anchoredPosition = new Vector2(-10f, 10f);
                    (_versionNumber.transform as RectTransform).anchorMax        = new Vector2(1f, 0f);
                    (_versionNumber.transform as RectTransform).anchorMin        = new Vector2(1f, 0f);

                    string versionNumber = (IllusionInjector.PluginManager.Plugins.Where(x => x.Name == "Custom Platforms").First()).Version;
                    _versionNumber.text     = "v" + versionNumber;
                    _versionNumber.fontSize = 5;
                    _versionNumber.color    = Color.white;

                    if (_backButton == null)
                    {
                        _backButton = BeatSaberUI.CreateBackButton(rectTransform as RectTransform);

                        _backButton.onClick.AddListener(delegate()
                        {
                            if (platformListBackWasPressed != null)
                            {
                                platformListBackWasPressed();
                            }
                        });
                    }
                }

                _platformsTableView.SelectRow(PlatformManager.Instance.currentPlatformIndex);
                _platformsTableView.ScrollToRow(PlatformManager.Instance.currentPlatformIndex, true);
            }
            catch (Exception e)
            {
                Console.WriteLine("EXCEPTION IN DidActivate: " + e);
            }
        }
Beispiel #18
0
 /// <summary>
 /// Holds any clutter that's not supposed to be here, but has to.
 /// </summary>
 private void Stuff_That_Doesnt_Belong_Here_But_Has_To_Be_Here_Because_Bsml_Isnt_Half_As_Stable_Yet_As_CustomUI_Was_But_CustomUI_Has_Been_Killed_Already()
 {
     PlatformUI.SetupMenuButtons();
 }
Beispiel #19
0
        protected override void DidActivate(bool firstActivation, ActivationType type)
        {
            ui = PlatformUI._instance;
            _parentMasterViewController = transform.parent.GetComponent <PlatformMasterViewController>();

            try
            {
                _songListTableCellInstance = Resources.FindObjectsOfTypeAll <StandardLevelListTableCell>().First(x => (x.name == "StandardLevelListTableCell"));

                if (_platformsTableView == null)
                {
                    _platformsTableView = new GameObject().AddComponent <TableView>();

                    _platformsTableView.transform.SetParent(rectTransform, false);

                    _platformsTableView.dataSource = this;

                    (_platformsTableView.transform as RectTransform).anchorMin        = new Vector2(0f, 0.5f);
                    (_platformsTableView.transform as RectTransform).anchorMax        = new Vector2(1f, 0.5f);
                    (_platformsTableView.transform as RectTransform).sizeDelta        = new Vector2(0f, 60f);
                    (_platformsTableView.transform as RectTransform).position         = new Vector3(0f, 0f, 2.4f);
                    (_platformsTableView.transform as RectTransform).anchoredPosition = new Vector3(0f, 0f); // -3

                    _platformsTableView.didSelectRowEvent += _PlatformTableView_DidSelectRowEvent;
                }
                else
                {
                    _platformsTableView.ReloadData();
                }

                if (_pageUpButton == null)
                {
                    _pageUpButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "PageUpButton")), rectTransform, false);
                    (_pageUpButton.transform as RectTransform).anchorMin        = new Vector2(0.5f, 1f);
                    (_pageUpButton.transform as RectTransform).anchorMax        = new Vector2(0.5f, 1f);
                    (_pageUpButton.transform as RectTransform).anchoredPosition = new Vector2(0f, -10f);//-14
                    _pageUpButton.interactable = true;
                    _pageUpButton.onClick.AddListener(delegate()
                    {
                        _platformsTableView.PageScrollUp();
                    });
                }

                if (_pageDownButton == null)
                {
                    _pageDownButton = Instantiate(Resources.FindObjectsOfTypeAll <Button>().First(x => (x.name == "PageDownButton")), rectTransform, false);
                    (_pageDownButton.transform as RectTransform).anchorMin        = new Vector2(0.5f, 0f);
                    (_pageDownButton.transform as RectTransform).anchorMax        = new Vector2(0.5f, 0f);
                    (_pageDownButton.transform as RectTransform).anchoredPosition = new Vector2(0f, 10);//8
                    _pageDownButton.interactable = true;
                    _pageDownButton.onClick.AddListener(delegate()
                    {
                        _platformsTableView.PageScrollDown();
                    });
                }

                if (_versionNumber == null)
                {
                    _versionNumber = Instantiate(Resources.FindObjectsOfTypeAll <TextMeshProUGUI>().First(x => (x.name == "BuildInfoText")), rectTransform, false);
                    DestroyImmediate(_versionNumber.GetComponent <BuildInfoText>());

                    (_versionNumber.transform as RectTransform).anchoredPosition = new Vector2(44f, 2f);

                    string versionNumber = (IllusionInjector.PluginManager.Plugins.Where(x => x.Name == "Custom Platforms").First()).Version;
                    _versionNumber.text     = versionNumber;
                    _versionNumber.fontSize = 5;
                }

                _platformsTableView.SelectRow(PlatformLoader.Instance.GetPlatformIndex());
                _platformsTableView.ScrollToRow(PlatformLoader.Instance.GetPlatformIndex(), true);
            }
            catch (Exception e)
            {
                Console.WriteLine("EXCEPTION IN DidActivate: " + e);
            }
        }