Exemplo n.º 1
0
        protected override void OnEnter()
        {
            this.controller = Container.Instance.Instantiate <MainMenuViewController>();
            this.controller.Initialize();

            MusicManager.Instance.Play("event:/Music/MainMenu");
        }
        private void MainMenuNavigated(MainMenuViewController sender, MainMenuViewController.MenuButton subMenuType)
        {
            VRUIViewController parent = parentViewController;

            DismissModalViewController(null, true);
            parent.gameObject.SetActive(false);
        }
Exemplo n.º 3
0
        private void MainMenuViewController_didFinishEvent(MainMenuViewController vc, MainMenuViewController.MenuButton menuButton)
        {
            IsInSoloFreeplay = menuButton == MainMenuViewController.MenuButton.SoloFreePlay;
            //Plugin.Log.Info($"MainMenuViewController Menu Button Pressed ==> {menuButton.ToString()}");

            if (Plugin.cfg.Enabled)
            {
                if (IsInSoloFreeplay)
                {
                    foreach (var gameplayModifierToggle in _gameplayModifierToggles)
                    {
                        //Plugin.Log.Info($"{gameplayModifierToggle.gameplayModifier.modifierNameLocalizationKey} - {gameplayModifierToggle.gameplayModifier.name} - {Localization.Get(gameplayModifierToggle.gameplayModifier.modifierNameLocalizationKey)}");
                        if (gameplayModifierToggle.gameplayModifier.modifierNameLocalizationKey == "MODIFIER_NO_FAIL_ON_0_ENERGY")
                        {
                            // add listeners to modifier toggle
                            gameplayModifierToggle.toggle.onValueChanged.RemoveListener(new UnityAction <bool>(HandleNoFailToggle));
                            gameplayModifierToggle.toggle.onValueChanged.AddListener(new UnityAction <bool>(HandleNoFailToggle));

                            // set initial state
                            NoFailEnabled = gameplayModifierToggle.toggle.isOn;

                            // exit loop, only 1 no fail toggle
                            break;
                        }
                    }
                }

                // setup default button state
                SetButtonState(NoFailEnabled);
            }
        }
Exemplo n.º 4
0
 public static void Init()
 {
     Plugin.ApplyHarmonyPatches();
     if (CharacteristicSelectionViewController == null)
     {
         CharacteristicSelectionViewController = Resources.FindObjectsOfTypeAll <BeatmapCharacteristicSelectionViewController>().FirstOrDefault();
         if (CharacteristicSelectionViewController == null)
         {
             Utilities.Logger.Log("Characteristic View Controller null");
             return;
         }
         CharacteristicSelectionViewController.didSelectBeatmapCharacteristicEvent += CharacteristicSelectionViewController_didSelectBeatmapCharacteristicEvent;
     }
     if (MainMenuViewController == null)
     {
         SoloFreePlayFlowCoordinator  = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault();
         PartyFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault();
         MainMenuViewController       = Resources.FindObjectsOfTypeAll <MainMenuViewController>().FirstOrDefault();
         if (MainMenuViewController == null)
         {
             return;
         }
         MainMenuViewController.didFinishEvent += MainMenuViewController_didFinishEvent;
     }
 }
        private void OnDidFinishEvent(MainMenuViewController mmvc, MainMenuViewController.MenuButton menuButton)
        {
            if (menuButton != MainMenuViewController.MenuButton.SoloFreePlay &&
                menuButton != MainMenuViewController.MenuButton.Party)
            {
                return;
            }
            _clickDateTime = new DateTime(0);
            _latestClick   = ControllerType.None;
            var lcvc = Resources.FindObjectsOfTypeAll <LevelCollectionViewController>().FirstOrDefault();

            if (lcvc == null)
            {
                return;
            }
            var lctv = lcvc.GetPrivateField <LevelCollectionTableView>("_levelCollectionTableView");

            if (lctv == null)
            {
                return;
            }
            _currentTableViewContent = lctv.GetPrivateField <TableView>("_tableView");
            if (_currentTableViewContent == null)
            {
                return;
            }
            Logger.log.Debug("Content table view found!");
            _genericLeftController  = InputDevices.GetDeviceAtXRNode(XRNode.LeftHand);
            _genericRightController = InputDevices.GetDeviceAtXRNode(XRNode.RightHand);
            _isInitialized          = true;
        }
Exemplo n.º 6
0
        void Awake()
        {
            ModMenuPlugin.debugLogger.Log("Mod Menu Awake");

            Instance = this;
            //DontDestroyOnLoad(gameObject);

            foreach (Sprite sprite in Resources.FindObjectsOfTypeAll <Sprite>())
            {
                Icons.Add(sprite);
            }

            try
            {
                // Get necessary button instances and main menu VC
                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();
                _mainMenuRectTransform  = (RectTransform)_buttonInstance.transform.parent;

                ModMenuPlugin.debugLogger.Log("Buttons and main menu found.");
                AddModMenuButton();
                ModMenuPlugin.debugLogger.Log("Mod menu button created");
            }
            catch (Exception ex)
            {
                ModMenuPlugin.debugLogger.Exception(ex.StackTrace + ex.Message);
            }
        }
Exemplo n.º 7
0
        private void Awake()
        {
            _instance = this;
            foreach (Sprite sprite in Resources.FindObjectsOfTypeAll<Sprite>())
            {
                Debug.Log(sprite.name);
                icons.Add(sprite);
            }
            Debug.Log("Trying to find buttons...");
            try
            {
                _buttonInstance = Resources.FindObjectsOfTypeAll<Button>().Where(x => (x.name == "QuitButton")).First();
                _backButtonInstance = Resources.FindObjectsOfTypeAll<Button>().Where(x => (x.name == "BackArrowButton")).First();
                _mainMenuViewController = Resources.FindObjectsOfTypeAll<MainMenuViewController>().First();
                _mainMenuRectTransform = _buttonInstance.transform.parent as RectTransform;
                Debug.Log("Buttons and main menu found!");
                

            }
            catch(Exception e)
            {
                Debug.Log("EXCEPTION ON AWAKE(TRY FIND BUTTONS): "+e);
            }

            try
            {
                CreateBeatSaverButton();

                Debug.Log("BeatSaver button created!");
            }
            catch (Exception e)
            {
                Debug.Log("EXCEPTION ON AWAKE(TRY CREATE BUTTON): " + e);
            }
        }
Exemplo n.º 8
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);
            }
        }
Exemplo n.º 9
0
        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)
            {
            }
        }
        private void Awake()
        {
            _instance = this;

            DontDestroyOnLoad(this);

            Console.ForegroundColor = ConsoleColor.Gray;

            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;
                _loadingIndicatorInstance = Resources.FindObjectsOfTypeAll <GameObject>().Where(x => x.name == "LoadingIndicator").First();

                Console.WriteLine("Buttons and main menu found!");
            }
            catch (Exception e)
            {
                Console.WriteLine("EXCEPTION ON AWAKE(TRY FIND BUTTONS): " + e);
            }

            try
            {
                CreateMultiplayerButton();

                Console.WriteLine("Online button created!");
            }
            catch (Exception e)
            {
                Console.WriteLine("EXCEPTION ON AWAKE(TRY CREATE BUTTON): " + e);
            }
        }
Exemplo n.º 11
0
        protected void CreateUI()
        {
            try
            {
                _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
                _mainMenuRectTransform  = _mainMenuViewController.transform as RectTransform;

                _mockPartyViewController = new MockPartyViewController();

                if (Config.Instance.AutoStartLobby)
                {
                    SteamAPI.CreateLobby(!Config.Instance.IsPublic);
                }

                AvatarController.LoadAvatars();
                SongListUtils.Initialize();
                MultiplayerListing.Init();
                MultiplayerLobby.Init();
                WaitingMenu.Init();
                CreateMainMenuButton();
                CreateSettingsMenu();
            }
            catch (Exception e)
            {
                Logger.Error($"Unable to create UI! Exception: {e}");
            }
        }
Exemplo n.º 12
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;
                _loadingIndicatorInstance = Resources.FindObjectsOfTypeAll <GameObject>().Where(x => x.name == "LoadingIndicator").First();
            }
            catch (Exception e)
            {
                log.Exception("EXCEPTION ON AWAKE(TRY FIND BUTTONS): " + e);
            }

            try
            {
                CreateBeatSaverButton();
            }
            catch (Exception e)
            {
                log.Exception("EXCEPTION ON AWAKE(TRY CREATE BUTTON): " + e);
            }
        }
Exemplo n.º 13
0
        internal void OnLoad()
        {
            initialized = false;

            // remove potential for duplicate event calls
            BSEvents.levelSelected -= BSEvents_levelSelected;

            // attach to level selected event if we are enabled, and double presses are required
            if (Plugin.cfg.Enabled && Plugin.cfg.DoublePress)
            {
                BSEvents.levelSelected += BSEvents_levelSelected;
            }

            MainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().FirstOrDefault();
            MainMenuViewController.didFinishEvent += MainMenuViewController_didFinishEvent;

            // get PromoViewController
            PromoViewController = Resources.FindObjectsOfTypeAll <PromoViewController>().FirstOrDefault();
            PromoViewController.promoButtonWasPressedEvent += PromoViewController_promoButtonWasPressedEvent;

            SoloFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault();
            SoloFreePlayFlowCoordinator.didFinishEvent += SoloFreePlayFlowCoordinator_didFinishEvent;

            StandardLevelDetailView = Resources.FindObjectsOfTypeAll <StandardLevelDetailView>().LastOrDefault(v => v.name.IndexOf("Clone", StringComparison.OrdinalIgnoreCase) == -1);

            // setup settings
            SetupUI();
        }
Exemplo n.º 14
0
        private void SetupUI()
        {
            if (initialized)
            {
                return;
            }

            try
            {
                var _menuMasterViewController = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First();
                prompt = ReflectionUtil.GetPrivateField <SimpleDialogPromptViewController>(_menuMasterViewController, "_simpleDialogPromptViewController");

                _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
                settingsMenu            = Resources.FindObjectsOfTypeAll <SettingsNavigationController>().FirstOrDefault();
                mainSettingsMenu        = Resources.FindObjectsOfTypeAll <MainSettingsMenuViewController>().FirstOrDefault();
                _mainSettingsTableView  = mainSettingsMenu.GetPrivateField <MainSettingsTableView>("_mainSettingsTableView");
                subMenuTableView        = _mainSettingsTableView.GetPrivateField <TableView>("_tableView");
                subMenuTableViewHelper  = subMenuTableView.gameObject.AddComponent <TableViewHelper>();
                othersSubmenu           = settingsMenu.transform.Find("OtherSettings");

                initialized = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine($"[SettingsUI] Crash when trying to setup UI! Exception: {ex.ToString()}");
            }
        }
Exemplo n.º 15
0
        void Awake()
        {
            Instance = this;
            //DontDestroyOnLoad(gameObject);

            foreach (Sprite sprite in Resources.FindObjectsOfTypeAll <Sprite>())
            {
                Icons.Add(sprite);
            }

            try
            {
                // Get necessary button instances and main menu VC
                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;

                AddModMenuButton();
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 16
0
        private void SetupUI()
        {
            if (initialized)
            {
                return;
            }

            try
            {
                var _menuMasterViewController = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First();
                prompt = ReflectionUtil.GetPrivateField <SimpleDialogPromptViewController>(_menuMasterViewController, "_simpleDialogPromptViewController");

                _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
                settingsMenu            = Resources.FindObjectsOfTypeAll <SettingsNavigationController>().FirstOrDefault();
                mainSettingsMenu        = Resources.FindObjectsOfTypeAll <MainSettingsMenuViewController>().FirstOrDefault();
                _mainSettingsTableView  = mainSettingsMenu.GetPrivateField <MainSettingsTableView>("_mainSettingsTableView");
                subMenuTableView        = _mainSettingsTableView.GetComponentInChildren <TableView>();
                subMenuTableViewHelper  = subMenuTableView.gameObject.AddComponent <TableViewHelper>();
                othersSubmenu           = settingsMenu.transform.Find("OtherSettings");

                AddPageButtons();

                if (tableCell == null)
                {
                    tableCell = Resources.FindObjectsOfTypeAll <MainSettingsTableCell>().FirstOrDefault();
                    // Get a refence to the Settings Table cell text in case we want to change font size, etc
                    var text = tableCell.GetPrivateField <TextMeshProUGUI>("_settingsSubMenuText");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"[SettingsUI] Crash when trying to setup UI! Exception: {ex.ToString()}");
            }
        }
Exemplo n.º 17
0
    public void Init()
    {
        MainMenuViewController viewController = _factory.CreateMainMenuViewController();

        viewController.Setup();
        _wireframe.PresentViewController(viewController);
    }
        private void Awake()
        {
            _logger  = NLog.LogManager.GetCurrentClassLogger();
            Instance = this;

            foreach (var 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;
                _loadingIndicatorInstance = Resources.FindObjectsOfTypeAll <GameObject>().First(x => x.name == "LoadingIndicator");
            }
            catch (Exception e)
            {
                _logger.Error(e);
            }

            try
            {
                CreateTwitchModeButton();
                CreateDebugButton();
            }
            catch (Exception e)
            {
                _logger.Error(e);
            }
        }
Exemplo n.º 19
0
        public static void Init()
        {
            Plugin.ApplyHarmonyPatches();

            if (MainMenuViewController == null)
            {
                SoloFreePlayFlowCoordinator  = Resources.FindObjectsOfTypeAll <SoloFreePlayFlowCoordinator>().FirstOrDefault();
                PartyFreePlayFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault();
                MainMenuViewController       = Resources.FindObjectsOfTypeAll <MainMenuViewController>().FirstOrDefault();

                if (MainMenuViewController == null)
                {
                    return;
                }
                MainMenuViewController.didFinishEvent += MainMenuViewController_didFinishEvent;

                /*
                 * if (CharacteristicSelectionViewController == null)
                 * {
                 *  CharacteristicSelectionViewController = Resources.FindObjectsOfTypeAll<BeatmapCharacteristicSegmentedControlController>().FirstOrDefault();
                 *  if (CharacteristicSelectionViewController != null)
                 *      CharacteristicSelectionViewController.didSelectBeatmapCharacteristicEvent += CharacteristicSelectionViewController_didSelectBeatmapCharacteristicEvent;
                 * }
                 */
            }
        }
Exemplo n.º 20
0
    void BackToMenu()
    {
        MainMenuViewController mainMenuViewController = _factory.CreateMainMenuViewController();

        mainMenuViewController.Setup();

        _wireframe.PresentViewController(mainMenuViewController);
    }
Exemplo n.º 21
0
        public void CreateUI()
        {
            try
            {
                _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
                _mainMenuRectTransform  = _mainMenuViewController.transform as RectTransform;

                if (serverHubFlowCoordinator == null)
                {
                    serverHubFlowCoordinator = BeatSaberUI.CreateFlowCoordinator <ServerHubFlowCoordinator>();
                }
                if (roomCreationFlowCoordinator == null)
                {
                    roomCreationFlowCoordinator = BeatSaberUI.CreateFlowCoordinator <RoomCreationFlowCoordinator>();
                }
                if (roomFlowCoordinator == null)
                {
                    roomFlowCoordinator = BeatSaberUI.CreateFlowCoordinator <RoomFlowCoordinator>();
                }
                if (modeSelectionFlowCoordinator == null)
                {
                    modeSelectionFlowCoordinator = BeatSaberUI.CreateFlowCoordinator <ModeSelectionFlowCoordinator>();
                    modeSelectionFlowCoordinator.didFinishEvent += () =>
                    {
                        Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First().InvokeMethod("DismissFlowCoordinator", modeSelectionFlowCoordinator, null, false);

                        Plugin.discordActivity = default;
                        Plugin.discord?.ClearActivity();
                        if (SteamManager.Initialized)
                        {
                            SteamRichPresence.ClearSteamRichPresence();
                        }
                    };
                }

                /*
                 * if (channelSelectionFlowCoordinator == null)
                 * {
                 *  channelSelectionFlowCoordinator = BeatSaberUI.CreateFlowCoordinator<ChannelSelectionFlowCoordinator>();
                 * }
                 * if (radioFlowCoordinator == null)
                 * {
                 *  radioFlowCoordinator = BeatSaberUI.CreateFlowCoordinator<RadioFlowCoordinator>();
                 * }*/

                CreateOnlineButton();

                StartCoroutine(CheckVersion());

                _settings = new GameObject("Multiplayer Settings").AddComponent <Settings>();
                BSMLSettings.instance.AddSettingsMenu("Multiplayer", "BeatSaberMultiplayer.UI.Settings", _settings);
            }
            catch (Exception e)
            {
                Plugin.log.Critical($"Unable to create UI! Exception: {e}");
            }
        }
Exemplo n.º 22
0
 public void SceneManagerOnActiveSceneChanged(Scene arg0, Scene scene)
 {
     if (isMenuScene(scene))
     {
         _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
         var _menuMasterViewController = Resources.FindObjectsOfTypeAll <StandardLevelSelectionFlowCoordinator>().First();
         prompt = ReflectionUtil.GetPrivateField <SimpleDialogPromptViewController>(_menuMasterViewController, "_simpleDialogPromptViewController");
     }
 }
Exemplo n.º 23
0
    void EndGame()
    {
        Game.EndGame();
        MainMenuViewController mainMenuViewController = _factory.CreateMainMenuViewController();

        mainMenuViewController.Setup();

        _wireframe.PresentViewController(mainMenuViewController);
    }
Exemplo n.º 24
0
    private void GameOver()
    {
        StartGame.EndGame();

        MainMenuViewController viewController = _factory.CreateMainMenuViewController();

        viewController.Setup();
        _wireframe.PresentViewController(viewController);
    }
Exemplo n.º 25
0
 public OutroSoundManager(Config config, SiraLog siraLog, [Inject(Id = "audio.sourcer")] AudioSource audioSourcer, FadeInOutController fadeInOutController, CachedMediaAsyncLoader cachedMediaAsyncLoader, MainMenuViewController mainMenuViewController)
 {
     _config                 = config;
     _siraLog                = siraLog;
     _audioSourcer           = audioSourcer;
     _random                 = new System.Random();
     _fadeInOutController    = fadeInOutController;
     _audioClipAsyncLoader   = cachedMediaAsyncLoader;
     _mainMenuViewController = mainMenuViewController;
 }
Exemplo n.º 26
0
 private static void MainMenuViewController_didFinishEvent(MainMenuViewController arg1, MainMenuViewController.MenuButton arg2)
 {
     if (arg2 == MainMenuViewController.MenuButton.Party)
     {
         IsPartyActive = true;
     }
     else
     {
         IsPartyActive = false;
     }
 }
Exemplo n.º 27
0
 private void SceneTransitioned(ScenesTransitionSetupDataSO transitionData, DiContainer container)
 {
     if (CurvedCanvasTemplate == null)
     {
         MainMenuViewController view = container.TryResolve <MainMenuViewController>();
         if (view != null)
         {
             CurvedCanvasTemplate = view.GetComponent <Canvas>();
         }
     }
 }
        private IEnumerator WaitForMainMenu()
        {
            yield return(new WaitUntil(() => Resources.FindObjectsOfTypeAll <MainMenuViewController>().Any()));

            MainMenuViewController mainmenu = Resources.FindObjectsOfTypeAll <MainMenuViewController>().FirstOrDefault();

            if (mainmenu != null)
            {
                mainmenu.didFinishEvent -= MainMenuViewController_didFinishEvent;
                mainmenu.didFinishEvent += MainMenuViewController_didFinishEvent;
            }
        }
        public MockPartyViewController()
        {
            _partyFlowCoordinator = Resources.FindObjectsOfTypeAll <PartyFreePlayFlowCoordinator>().FirstOrDefault();
            LevelListViewController level = ReflectionUtil.GetPrivateField <LevelListViewController>(_partyFlowCoordinator, "_levelListViewController");

            detail = ReflectionUtil.GetPrivateField <StandardLevelDetailViewController>(_partyFlowCoordinator, "_levelDetailViewController");
            BeatmapDifficultyViewController beatmap = ReflectionUtil.GetPrivateField <BeatmapDifficultyViewController>(_partyFlowCoordinator, "_beatmapDifficultyViewController");

            _gameplaySetupViewController = ReflectionUtil.GetPrivateField <GameplaySetupViewController>(_partyFlowCoordinator, "_gameplaySetupViewController");

            level.didActivateEvent += (first, type) => {
                if (Data.Steam.SteamAPI.GetConnectionState() != SteamAPI.ConnectionState.CONNECTED || !_partyFlowCoordinator || !_partyFlowCoordinator.isActivated)
                {
                    return;
                }
                _partyFlowCoordinator.InvokePrivateMethod("SetRightScreenViewController", new object[] { MultiplayerLobby.Instance.rightViewController, true });
            };
            level.didSelectLevelEvent += didSelectLevel;

            beatmap.didSelectDifficultyEvent += didSelectBeatmap;
            mPlay = BeatSaberUI.CreateUIButton(detail.rectTransform, "CreditsButton", new Vector2(0f, -24f), new Vector2(40, 9f));

            mPlay.SetButtonText("Play with Lobby");
            mPlay.SetButtonTextSize(5f);
            mPlay.gameObject.SetActive(false);
            mPlay.ToggleWordWrapping(false);

            mPlay.onClick.AddListener(didSelectPlay);

            _mainMenuController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().FirstOrDefault();
            Button    partyButton = ReflectionUtil.GetPrivateField <Button>(_mainMenuController, "_partyButton");
            HoverHint hint        = Resources.FindObjectsOfTypeAll <HoverHint>().Where(x => x.text == "Play with your friends locally!").First();

            _mainMenuController.didActivateEvent += (first, type) =>
            {
                if (Data.Steam.SteamAPI.GetConnectionState() != SteamAPI.ConnectionState.CONNECTED)
                {
                    partyButton.SetButtonText("Party");
                    if (hint)
                    {
                        hint.text = "Play with your friends locally!";
                    }
                }
                else
                {
                    partyButton.SetButtonText("Online Lobby");
                    if (hint)
                    {
                        hint.text = "Play with your friends in your steam lobby!";
                    }
                }
            };
        }
Exemplo n.º 30
0
        public void Setup()
        {
            DontDestroyOnLoad(this.gameObject);

            _mainMenuViewController = Resources.FindObjectsOfTypeAll <MainMenuViewController>().First();
            _mainMenuRectTransform  = _mainMenuViewController.transform as RectTransform;

            CreateText();
            CreateButton();
            Client.ClientStatusChanged += ClientOnClientStatusChanged;

            StartCoroutine(EnableButtonFirstLaunch());
        }