Example #1
0
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            if (firstActivation)
            {
                title = "Select Mode";

                AvatarController.LoadAvatars();

                _multiplayerNavController = BeatSaberUI.CreateViewController <MultiplayerNavigationController>();
                _multiplayerNavController.didFinishEvent += () => {
                    MainFlowCoordinator mainFlow = Resources.FindObjectsOfTypeAll <MainFlowCoordinator>().First();
                    mainFlow.InvokeMethod("DismissFlowCoordinator", this, null, false);
                };

                _selectionViewController = BeatSaberUI.CreateViewController <ModeSelectionViewController>();
                _selectionViewController.didSelectRooms += () =>
                {
                    if (!mainScreenViewControllers.Any(x => x.GetPrivateField <bool>("_isInTransition")))
                    {
                        PresentFlowCoordinator(PluginUI.instance.serverHubFlowCoordinator);
                    }
                };
                _selectionViewController.didSelectRadio += () =>
                {
                    if (!mainScreenViewControllers.Any(x => x.GetPrivateField <bool>("_isInTransition")))
                    {
                        PresentFlowCoordinator(PluginUI.instance.channelSelectionFlowCoordinator);
                    }
                };
            }

            SetViewControllerToNavigationConctroller(_multiplayerNavController, _selectionViewController);
            ProvideInitialViewControllers(_multiplayerNavController, null, null);
        }
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            if (firstActivation)
            {
                channelSelectionNavController = BeatSaberUI.CreateViewController <MultiplayerNavigationController>();
                channelSelectionNavController.didFinishEvent += () => { PluginUI.instance.modeSelectionFlowCoordinator.InvokeMethod("DismissFlowCoordinator", this, null, false); };

                channelSelectionViewController = BeatSaberUI.CreateViewController <ChannelSelectionViewController>();
                channelSelectionViewController.nextPressedEvent += () =>
                {
                    currentChannel++;
                    if (currentChannel >= _channelInfos.Count)
                    {
                        currentChannel = 0;
                    }
                    channelSelectionViewController.SetContent(_channelInfos[currentChannel]);
                };
                channelSelectionViewController.prevPressedEvent += () =>
                {
                    currentChannel--;
                    if (currentChannel < 0)
                    {
                        currentChannel = _channelInfos.Count - 1;
                    }
                    channelSelectionViewController.SetContent(_channelInfos[currentChannel]);
                };
                channelSelectionViewController.joinPressedEvent += (channel) =>
                {
                    if (!mainScreenViewControllers.Any(x => x.GetPrivateField <bool>("_isInTransition")))
                    {
                        PresentFlowCoordinator(PluginUI.instance.radioFlowCoordinator, null, false, false);
                        PluginUI.instance.radioFlowCoordinator.JoinChannel(channel.ip, channel.port, channel.channelId);
                        PluginUI.instance.radioFlowCoordinator.didFinishEvent -= DismissRadio;
                        PluginUI.instance.radioFlowCoordinator.didFinishEvent += DismissRadio;
                    }
                };
            }


            SetViewControllerToNavigationConctroller(channelSelectionNavController, channelSelectionViewController);
            ProvideInitialViewControllers(channelSelectionNavController, null, null);

            StartCoroutine(GetChannelsList());
        }
Example #3
0
        protected override void DidActivate(bool firstActivation, ActivationType activationType)
        {
            if (firstActivation && activationType == ActivationType.AddedToHierarchy)
            {
                title = "Online Multiplayer";

                _serverHubNavigationController = BeatSaberUI.CreateViewController <MultiplayerNavigationController>();
                _serverHubNavigationController.didFinishEvent += () => {
                    PluginUI.instance.modeSelectionFlowCoordinator.InvokeMethod("DismissFlowCoordinator", this, null, false);
                };

                _roomListViewController = BeatSaberUI.CreateViewController <RoomListViewController>();

                _roomListViewController.createRoomButtonPressed += CreateRoomPressed;
                _roomListViewController.selectedRoom            += RoomSelected;
                _roomListViewController.refreshPressed          += RefreshPresed;
            }

            SetViewControllerToNavigationConctroller(_serverHubNavigationController, _roomListViewController);
            ProvideInitialViewControllers(_serverHubNavigationController, null, null);

            StartCoroutine(UpdateRoomsListCoroutine());
        }