/// <summary>
        /// Create icon segmented control
        /// </summary>
        /// <param name="p_Parent">Parent game object transform</param>
        /// <param name="p_HideCellBackground">Should hide cell background</param>
        /// <returns>GameObject</returns>
        public static HMUI.IconSegmentedControl Create(RectTransform p_Parent, bool p_HideCellBackground)
        {
            PlatformLeaderboardViewController l_PlatformLeaderboardViewController = Resources.FindObjectsOfTypeAll <PlatformLeaderboardViewController>().First();

            HMUI.IconSegmentedControl l_Prefab  = l_PlatformLeaderboardViewController.GetField <HMUI.IconSegmentedControl, PlatformLeaderboardViewController>("_scopeSegmentedControl");
            HMUI.IconSegmentedControl l_Control = MonoBehaviour.Instantiate(l_Prefab, p_Parent, false);

            l_Control.name = "BSMLVerticalIconSegmentedControl";
            l_Control.SetField("_container", l_Prefab.GetField <DiContainer, HMUI.IconSegmentedControl>("_container"));
            l_Control.SetField("_hideCellBackground", p_HideCellBackground);

            RectTransform l_RectTransform = l_Control.transform as RectTransform;

            l_RectTransform.anchorMin        = Vector2.one * 0.5f;
            l_RectTransform.anchorMax        = Vector2.one * 0.5f;
            l_RectTransform.anchoredPosition = Vector2.zero;
            l_RectTransform.pivot            = Vector2.one * 0.5f;

            foreach (Transform l_Transform in l_Control.transform)
            {
                GameObject.Destroy(l_Transform.gameObject);
            }

            return(l_Control);
        }
        private void songSelection_SongSelected(GameplayParameters parameters)
        {
            _currentParameters = parameters;

            SongUtils.LoadSong(parameters.Beatmap.LevelId, (loadedLevel) =>
            {
                PresentViewController(_songDetail, () =>
                {
                    _songDetail.SetSelectedSong(loadedLevel);
                    _songDetail.SetSelectedDifficulty((int)parameters.Beatmap.Difficulty);
                    _songDetail.SetSelectedCharacteristic(parameters.Beatmap.Characteristic.SerializedName);

                    if (_globalLeaderboard == null)
                    {
                        _globalLeaderboard      = Resources.FindObjectsOfTypeAll <PlatformLeaderboardViewController>().First();
                        _globalLeaderboard.name = "Global Leaderboard";
                    }

                    _globalLeaderboard.SetData(SongUtils.GetClosestDifficultyPreferLower(loadedLevel, (BeatmapDifficulty)(int)parameters.Beatmap.Difficulty, parameters.Beatmap.Characteristic.SerializedName));
                    SetRightScreenViewController(_globalLeaderboard, ViewController.AnimationType.In);

                    _customLeaderboard = BeatSaberUI.CreateViewController <CustomLeaderboard>();
                    PlayerUtils.GetPlatformUserData(RequestLeaderboardWhenResolved);
                    SetLeftScreenViewController(_customLeaderboard, ViewController.AnimationType.In);
                });
            });
        }
        public override GameObject CreateObject(Transform parent)
        {
            if (prefab == null)
            {
                PlatformLeaderboardViewController vc = Resources.FindObjectsOfTypeAll <PlatformLeaderboardViewController>().First();
                prefab = vc.GetField <IconSegmentedControl, PlatformLeaderboardViewController>("_scopeSegmentedControl");
            }

            IconSegmentedControl control = Object.Instantiate(prefab, parent, false);

            control.name = "BSMLVerticalIconSegmentedControl";
            control.SetField("_container", prefab.GetField <DiContainer, IconSegmentedControl>("_container"));

            RectTransform rt = control.transform as RectTransform;

            rt.anchorMin        = new Vector2(0.5f, 0.5f);
            rt.anchorMax        = new Vector2(0.5f, 0.5f);
            rt.anchoredPosition = Vector2.zero;
            rt.pivot            = new Vector2(0.5f, 0.5f);

            foreach (Transform transform in control.transform)
            {
                Object.Destroy(transform.gameObject);
            }

            return(control.gameObject);
        }
Beispiel #4
0
 internal void Construct(PlayerAvatarManager avatarManager, DiContainer container, PlayerOptionsViewController playerOptionsViewController, LevelCollectionViewController levelCollectionViewController, PlatformLeaderboardViewController leaderboardViewController)
 {
     _avatarManager = avatarManager;
     _container     = container;
     _playerOptionsViewController   = playerOptionsViewController;
     _levelCollectionViewController = levelCollectionViewController;
     _leaderboardViewController     = leaderboardViewController;
 }
Beispiel #5
0
 internal void Construct(PlayerAvatarManager avatarManager, PlatformLeaderboardViewController leaderboardViewController, VRPlayerInputInternal playerInput, GeneralSettingsHost generalSettingsHost, AvatarSpecificSettingsHost avatarSpecificSettingsHost, AutomaticFbtCalibrationHost automaticFbtCalibrationHost)
 {
     _avatarManager             = avatarManager;
     _leaderboardViewController = leaderboardViewController;
     _playerInput                 = playerInput;
     _generalSettingsHost         = generalSettingsHost;
     _avatarSpecificSettingsHost  = avatarSpecificSettingsHost;
     _automaticFbtCalibrationHost = automaticFbtCalibrationHost;
 }
Beispiel #6
0
 public DiffdelController(Config config, PlatformLeaderboardViewController platformLeaderboardViewController, StandardLevelDetailViewController standardLevelDetailViewController)
 {
     _config = config;
     _platformLeaderboardViewController = platformLeaderboardViewController;
     _standardLevelDetailView           = Accessors.LevelDetailView(ref standardLevelDetailViewController) !;
     _buttonText = (Accessors.NPSText(ref Accessors.ParamsPanel(ref _standardLevelDetailView)) as ButtonText) !;
     _beatmapCharacteristicSegmentedControlController = (Accessors.CharacteristicSegment(ref _standardLevelDetailView)) !;
     _diffdelDifficultyControlController = (Accessors.DifficultySegment(ref _standardLevelDetailView) as DiffdelDifficultyControlController) !;
 }
Beispiel #7
0
        private void SongListRowSelected(Song song)
        {
            Action <IBeatmapLevel> songLoaded = (level) =>
            {
                song.Beatmap = SongUtils.GetClosestDifficultyPreferLower(level, (BeatmapDifficulty)(int)song.Difficulty, song.Characteristic);

                //Open up the custom/global leaderboard pane when we need to
                if (_communityLeaderboard == null)
                {
                    _communityLeaderboard              = BeatSaberUI.CreateViewController <CustomLeaderboardController>();
                    _communityLeaderboard.PlayPressed += SongPlayPressed;
                }
                SetLeftScreenViewController(_communityLeaderboard);

                if (_globalLeaderboard == null)
                {
                    _globalLeaderboard      = Resources.FindObjectsOfTypeAll <PlatformLeaderboardViewController>().First();
                    _globalLeaderboard.name = "Community Global Leaderboard";
                }

                //Change global leaderboard view
                _globalLeaderboard.SetData(song.Beatmap);

                SetRightScreenViewController(_globalLeaderboard);

                //Change community leaderboard view
                //Use the currently selected team, if it exists
                //TODO: Reimplement?
                //int teamIndex = _communityLeaderboard.selectedTeamIndex;
                //if (teamIndex <= -1) teamIndex = Team.allTeams.FindIndex(x => x.TeamId == Player.Instance.Team);
                _communityLeaderboard.SetSong(song, -1);
            };

            //When the row is selected, load the beatmap
            SongUtils.LoadSong(song.PreviewBeatmap, songLoaded);
        }
        static void Postfix(ref Sprite ____friendsLeaderboardIcon, ref Sprite ____globalLeaderboardIcon, ref Sprite ____aroundPlayerLeaderboardIcon, ref IconSegmentedControl ____scopeSegmentedControl, ref PlatformLeaderboardViewController __instance)
        {//LeaderboardUIManager.Instance.PCIcon;
            ____scopeSegmentedControl.didSelectCellEvent += __instance.HandleScopeSegmentedControlDidSelectCell;

            ____scopeSegmentedControl.SetData(new IconSegmentedControl.DataItem[] {
                new IconSegmentedControl.DataItem(____globalLeaderboardIcon, "Global"),
                new IconSegmentedControl.DataItem(____aroundPlayerLeaderboardIcon, "Around You"),
                new IconSegmentedControl.DataItem(BeatBoardsUIManager.Instance.PCIcon, "Platform: PC")
            });

            var replayButton = __instance.CreateUIButton("OkButton", new Vector2(0f, -37f), new Vector2(9.0f, 5.0f));

            replayButton.ToggleWordWrapping(false);
            replayButton.SetButtonText("Replays");
            replayButton.SetButtonTextSize(3);
            //replayButton.onClick.AddListener(LeaderboardUIManager.Instance.ReplayMenu);

            BeatBoardsUIManager.Instance.replaysButton = replayButton;
        }