예제 #1
0
        public void SetSelectedSong(SongInfo info)
        {
            SetLoadingState(false);

            _selectedSong = null;

            _selectedSongCell.SetText(info.songName);
            _selectedSongCell.SetSubText("Loading info...");

            _playButton.SetButtonText("PLAY");
            _playBtnGlow.color = new Color(0f, 0.7058824f, 1f, 0.7843137f);

            SongDownloader.Instance.RequestSongByLevelID(info.hash, (song) =>
            {
                _selectedSongCell.SetText($"{song.songName} <size=80%>{song.songSubName}</size>");
                _selectedSongCell.SetSubText(song.songAuthorName + " <size=80%>[" + song.levelAuthorName + "]</size>");
                StartCoroutine(LoadScripts.LoadSpriteCoroutine(song.coverURL, (cover) => { _selectedSongCell.SetIcon(cover); }));
            });

            _timeParamText.transform.parent.gameObject.SetActive(false);
            _bpmParamText.transform.parent.gameObject.SetActive(false);
            _blocksParamText.transform.parent.gameObject.SetActive(false);
            _obstaclesParamText.transform.parent.gameObject.SetActive(false);
            _starsParamText.transform.parent.gameObject.SetActive(false);
            _ratingParamText.transform.parent.gameObject.SetActive(false);

            _rankedText.gameObject.SetActive(false);

            _characteristicControl.SetTexts(new string[] { "None" });
            _characteristicControl.SelectCellWithNumber(0);
            _difficultyControl.SetTexts(new string[] { "None" });
            _difficultyControl.SelectCellWithNumber(0);
        }
        public TableCell CellForIdx(TableView sender, int row)
        {
            LevelListTableCell cell = Instantiate(_serverTableCellInstance);

            cell.reuseIdentifier = "ServerTableCell";

            RoomInfo room = availableRooms[row].roomInfo;

            if (room.usePassword)
            {
                cell.SetIcon(Sprites.lockedRoomIcon.texture);
            }
            else
            {
                cell.GetComponentsInChildren <UnityEngine.UI.RawImage>(true).First(x => x.name == "CoverImage").enabled = false;
            }
            cell.SetText($"({room.players}/{((room.maxPlayers == 0)? "INF":room.maxPlayers.ToString())})" + room.name);
            cell.SetSubText($"{room.roomState.ToString()}");

            cell.SetPrivateField("_beatmapCharacteristicAlphas", new float[0]);
            cell.SetPrivateField("_beatmapCharacteristicImages", new UnityEngine.UI.Image[0]);
            cell.SetPrivateField("_bought", true);
            foreach (var icon in cell.GetComponentsInChildren <UnityEngine.UI.Image>().Where(x => x.name.StartsWith("LevelTypeIcon")))
            {
                Destroy(icon.gameObject);
            }

            return(cell);
        }
        public TableCell CellForIdx(TableView tableView, int row)
        {
            LevelListTableCell cell = Instantiate(_songTableCellInstance);

            IPreviewBeatmapLevel song = availableSongs[row];

            song.GetCoverImageTexture2DAsync(new CancellationToken()).ContinueWith((tex) => {
                if (!tex.IsFaulted)
                {
                    cell.SetIcon(tex.Result);
                }
            }).ConfigureAwait(false);

            cell.SetText($"{song.songName} <size=80%>{song.songSubName}</size>");
            cell.SetSubText(song.songAuthorName + " <size=80%>[" + song.levelAuthorName + "]</size>");

            cell.reuseIdentifier = "SongCell";

            cell.SetPrivateField("_beatmapCharacteristicAlphas", new float[3] {
                song.beatmapCharacteristics.Any(x => x.serializedName == "Standard") ? 1f : 0.1f, song.beatmapCharacteristics.Any(x => x.serializedName == "NoArrows") ? 1f : 0.1f, song.beatmapCharacteristics.Any(x => x.serializedName == "OneSaber") ? 1f : 0.1f
            });
            cell.SetPrivateField("_beatmapCharacteristicImages", cell.GetComponentsInChildren <UnityEngine.UI.Image>().Where(x => x.name.StartsWith("LevelTypeIcon")).ToArray());
            cell.SetPrivateField("_bought", true);

            return(cell);
        }
        public void SetSong(SongInfo info)
        {
            if (_songTableCell == null)
            {
                return;
            }

            _selectedSong = SongLoader.CustomBeatmapLevelPackCollectionSO.beatmapLevelPacks.SelectMany(x => x.beatmapLevelCollection.beatmapLevels).FirstOrDefault(x => x.levelID.StartsWith(info.levelId)) as BeatmapLevelSO;

            if (_selectedSong != null)
            {
                _songTableCell.SetText(_selectedSong.songName + " <size=80%>" + _selectedSong.songSubName + "</size>");
                _songTableCell.SetSubText(_selectedSong.songAuthorName);
                _songTableCell.SetIcon(_selectedSong.coverImage);
            }
            else
            {
                _songTableCell.SetText(info.songName);
                _songTableCell.SetSubText("Loading info...");
                SongDownloader.Instance.RequestSongByLevelID(info.levelId, (song) =>
                {
                    _songTableCell.SetText($"{song.songName} <size=80%>{song.songSubName}</size>");
                    _songTableCell.SetSubText(song.authorName);
                    StartCoroutine(LoadScripts.LoadSpriteCoroutine(song.coverUrl, (cover) => { _songTableCell.SetIcon(cover); }));
                });
            }
        }
예제 #5
0
        public void SetSongInfo(SongInfo songInfo)
        {
            _currentSongInfo = songInfo;

            if (_currentSongCell != null)
            {
                IPreviewBeatmapLevel level = SongCore.Loader.CustomBeatmapLevelPackCollectionSO.beatmapLevelPacks.SelectMany(x => x.beatmapLevelCollection.beatmapLevels).FirstOrDefault(x => x.levelID.StartsWith(songInfo.levelId));
                if (level == null)
                {
                    _currentSongCell.SetText(_currentSongInfo.songName);
                    _currentSongCell.SetSubText("Loading info...");
                    SongDownloader.Instance.RequestSongByLevelID(_currentSongInfo.hash, (song) =>
                    {
                        _currentSongCell.SetText($"{song.songName} <size=80%>{song.songSubName}</size>");
                        _currentSongCell.SetSubText(song.songAuthorName + " <size=80%>[" + song.levelAuthorName + "]</size>");
                        StartCoroutine(LoadScripts.LoadSpriteCoroutine(song.coverURL, (cover) => { _currentSongCell.SetIcon(cover); }));
                    }
                                                                 );
                }
                else
                {
                    _currentSongCell.SetText($"{level.songName} <size=80%>{level.songSubName}</size>");
                    _currentSongCell.SetSubText(level.songAuthorName + " <size=80%>[" + level.levelAuthorName + "]</size>");

                    level.GetCoverImageTexture2DAsync(new CancellationTokenSource().Token).ContinueWith((tex) =>
                    {
                        if (!tex.IsFaulted)
                        {
                            _currentSongCell.SetIcon(tex.Result);
                        }
                    }).ConfigureAwait(false);
                }
            }
        }
예제 #6
0
        public void SetSongInfo(SongInfo songInfo)
        {
            _currentSongInfo = songInfo;

            if (_currentSongCell != null)
            {
                BeatmapLevelSO level = SongLoader.CustomBeatmapLevelPackCollectionSO.beatmapLevelPacks.SelectMany(x => x.beatmapLevelCollection.beatmapLevels).FirstOrDefault(x => x.levelID.StartsWith(songInfo.levelId)) as BeatmapLevelSO;

                if (level == null)
                {
                    _currentSongCell.SetText(_currentSongInfo.songName);
                    _currentSongCell.SetSubText("Loading info...");
                    SongDownloader.Instance.RequestSongByLevelID(_currentSongInfo.levelId, (song) =>
                    {
                        _currentSongCell.SetText($"{song.songName} <size=80%>{song.songSubName}</size>");
                        _currentSongCell.SetSubText(song.authorName);
                        StartCoroutine(LoadScripts.LoadSpriteCoroutine(song.coverUrl, (cover) => { _currentSongCell.SetIcon(cover); }));
                    }
                                                                 );
                }
                else
                {
                    _currentSongCell.SetText($"{level.songName} <size=80%>{level.songSubName}</size>");
                    _currentSongCell.SetSubText(level.songAuthorName);
                    _currentSongCell.SetIcon(level.coverImage);
                }
            }
        }
예제 #7
0
        public void SetSelectedSong(SongInfo info)
        {
            _selectedSong = SongLoader.CustomBeatmapLevelPackCollectionSO.beatmapLevelPacks.SelectMany(x => x.beatmapLevelCollection.beatmapLevels).FirstOrDefault(x => x.levelID.StartsWith(info.levelId)) as BeatmapLevelSO;

            if (_selectedSong != null)
            {
                _selectedSongCell.SetText(_selectedSong.songName + " <size=80%>" + _selectedSong.songSubName + "</size>");
                _selectedSongCell.SetSubText(_selectedSong.songAuthorName);
                _selectedSongCell.SetIcon(_selectedSong.coverImage);

                _characteristicControl.SetTexts(_selectedSong.beatmapCharacteristics.Select(x => x.characteristicName).ToArray());

                int standardCharacteristicIndex = Array.FindIndex(_selectedSong.beatmapCharacteristics, x => x.serializedName == "Standard");

                _characteristicControl.SelectCellWithNumber((standardCharacteristicIndex == -1 ? 0 : standardCharacteristicIndex));
                _characteristicControl_didSelectCellEvent(null, (standardCharacteristicIndex == -1 ? 0 : standardCharacteristicIndex));
            }
            else
            {
                _selectedSongCell.SetText(info.songName);
                _selectedSongCell.SetSubText("Loading info...");
                SongDownloader.Instance.RequestSongByLevelID(info.levelId, (song) =>
                {
                    _selectedSongCell.SetText($"{song.songName} <size=80%>{song.songSubName}</size>");
                    _selectedSongCell.SetSubText(song.authorName);
                    StartCoroutine(LoadScripts.LoadSpriteCoroutine(song.coverUrl, (cover) => { _selectedSongCell.SetIcon(cover); }));
                });
            }
        }
예제 #8
0
        override public TableCell CellForIdx(int idx)
        {
            LevelListTableCell _tableCell = GetTableCell(idx);

            _tableCell.SetText(Data[idx].text);
            _tableCell.SetSubText(Data[idx].subtext);
            _tableCell.SetIcon(Data[idx].icon == null ? UIUtilities.BlankSprite : Data[idx].icon);
            return(_tableCell);
        }
예제 #9
0
        public void SetSong(SongInfo info, Boolean finished)
        {
            if (_songTableCell == null)
            {
                return;
            }

            if (finished)
            {
                var highscore = PluginUI.instance.roomFlowCoordinator.lastHighScore;
                if (highscore == 0)
                {
                    _lastHighscoreText.SetText("No previous highscore");
                }
                else
                {
                    _lastHighscoreText.SetText($"Previous highscore: {highscore}");
                }
                _lastHighscoreText.gameObject.SetActive(true);
            }
            else
            {
                _lastHighscoreText.gameObject.SetActive(false);
            }

            _selectedSong = SongCore.Loader.CustomBeatmapLevelPackCollectionSO.beatmapLevelPacks.SelectMany(x => x.beatmapLevelCollection.beatmapLevels).FirstOrDefault(x => x.levelID.StartsWith(info.levelId));

            if (_selectedSong != null)
            {
                _songTableCell.SetText(_selectedSong.songName + " <size=80%>" + _selectedSong.songSubName + "</size>");
                _songTableCell.SetSubText(_selectedSong.songAuthorName + " <size=80%>[" + _selectedSong.levelAuthorName + "]</size>");

                _selectedSong.GetCoverImageTexture2DAsync(new CancellationTokenSource().Token).ContinueWith((tex) =>
                {
                    if (!tex.IsFaulted)
                    {
                        _songTableCell.SetIcon(tex.Result);
                    }
                }).ConfigureAwait(false);
            }
            else
            {
                _songTableCell.SetText(info.songName);
                _songTableCell.SetSubText("Loading info...");
                SongDownloader.Instance.RequestSongByLevelID(info.hash, (song) =>
                {
                    _songTableCell.SetText($"{song.songName} <size=80%>{song.songSubName}</size>");
                    _songTableCell.SetSubText(song.songAuthorName + " <size=80%>[" + song.levelAuthorName + "]</size>");
                    StartCoroutine(LoadScripts.LoadSpriteCoroutine(song.coverURL, (cover) => { _songTableCell.SetIcon(cover); }));
                });
            }
        }
예제 #10
0
        public TableCell CellForIdx(int row)
        {
            LevelListTableCell cell = Instantiate(_songTableCellInstance);

            BeatmapLevelSO song = availableSongs[row];

            cell.SetIcon(song.coverImage);
            cell.SetText($"{song.songName} <size=80%>{song.songSubName}</size>");
            cell.SetSubText(song.songAuthorName);

            cell.reuseIdentifier = "SongCell";

            cell.SetPrivateField("_beatmapCharacteristicAlphas", new float[3] {
                song.beatmapCharacteristics.Any(x => x.serializedName == "Standard") ? 1f : 0.1f, song.beatmapCharacteristics.Any(x => x.serializedName == "NoArrows") ? 1f : 0.1f, song.beatmapCharacteristics.Any(x => x.serializedName == "OneSaber") ? 1f : 0.1f
            });
            cell.SetPrivateField("_beatmapCharacteristicImages", cell.GetComponentsInChildren <UnityEngine.UI.Image>().Where(x => x.name.StartsWith("LevelTypeIcon")).ToArray());
            cell.SetPrivateField("_bought", true);

            return(cell);
        }