Example #1
0
        private void _UpdateList(int offset, bool force = false)
        {
            bool isInCategory = CBase.Songs.IsInCategory();
            int  itemCount    = isInCategory ? CBase.Songs.GetNumSongsVisible() : CBase.Songs.GetNumCategories();

            itemCount += 2 * _LAdj;
            int totalSongNumber = CBase.Songs.GetNumSongs();

            offset = offset.Clamp(0, itemCount - _ListLength, true);

            if (offset == _Offset && !force)
            {
                return;
            }

            for (int i = 0; i < _Covers.Count; i++)
            {
                if (offset + i < _LAdj || offset + i > itemCount - _LAdj - 1)
                {
                    _Covers[i].Visible = false;
                    _Tiles[i].Visible  = false;
                    _Covers[i].Texture = _CoverBGTexture;
                    _Artists[i].Text   = "";
                    _Titles[i].Text    = "";
                }
                else if (i - _LAdj + offset < itemCount - _LAdj)
                {
                    _Covers[i].Color   = new SColorF(1f, 1f, 1f, 1f);
                    _Covers[i].Visible = true;
                    _Tiles[i].Visible  = true;
                    if (isInCategory)
                    {
                        CSong currentSong = CBase.Songs.GetVisibleSong(i - _LAdj + offset);
                        _Covers[i].Texture = currentSong.CoverTextureSmall;
                        _Artists[i].Text   = currentSong.Artist;
                        _Titles[i].Text    = currentSong.Title;
                    }
                    else
                    {
                        CCategory currentCat = CBase.Songs.GetCategory(i - _LAdj + offset);
                        _Covers[i].Texture = currentCat.CoverTextureSmall;
                        int    num         = currentCat.GetNumSongsNotSung();
                        String songOrSongs = (num == 1) ? "TR_SCREENSONG_NUMSONG" : "TR_SCREENSONG_NUMSONGS";
                        _Titles[i].Text  = currentCat.Name;
                        _Artists[i].Text = CBase.Language.Translate(songOrSongs).Replace("%v", num.ToString());
                    }
                }
                else
                {
                    _Covers[i].Visible = false;
                    _Tiles[i].Visible  = false;
                    _Covers[i].Texture = _CoverBGTexture;
                    _Artists[i].Text   = "";
                    _Titles[i].Text    = "";
                }
            }
            _Offset = offset;
        }
Example #2
0
 private void _FillCategorySlide()
 {
     _SelectSlides[_SelectSlideCategory].Clear();
     for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
     {
         CCategory cat   = CBase.Songs.GetCategory(i);
         string    value = cat.Name + " (" + cat.GetNumSongsNotSung() + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
         _SelectSlides[_SelectSlideCategory].AddValue(value);
     }
 }
Example #3
0
        private void _UpdateList(int offset, bool force = false)
        {
            bool isInCategory    = CBase.Songs.IsInCategory();
            int  itemCount       = isInCategory ? CBase.Songs.GetNumSongsVisible() : CBase.Songs.GetNumCategories();
            int  totalSongNumber = CBase.Songs.GetNumSongs();

            offset = offset.Clamp(0, itemCount - _ListLength, true);

            if (offset == _Offset && !force)
            {
                return;
            }

            for (int i = 0; i < _Tiles.Count; i++)
            {
                if (i + offset < itemCount)
                {
                    _Tiles[i].Color = new SColorF(1f, 1f, 1f, 1f);
                    if (isInCategory)
                    {
                        CSong currentSong = CBase.Songs.GetVisibleSong(i + offset);
                        _Tiles[i].Texture = currentSong.CoverTextureSmall;

                        if (CBase.Config.GetSongSorting() == ESongSorting.TR_CONFIG_TITLE_LETTER)
                        {
                            _Texts[i].Text = currentSong.Title + " - " + currentSong.Artist;
                        }
                        else
                        {
                            _Texts[i].Text = currentSong.Artist + " - " + currentSong.Title;
                        }
                    }
                    else
                    {
                        CCategory currentCat = CBase.Songs.GetCategory(i + offset);
                        _Tiles[i].Texture = currentCat.CoverTextureSmall;
                        int    num         = currentCat.GetNumSongsNotSung();
                        String songOrSongs = (num == 1) ? "TR_SCREENSONG_NUMSONG" : "TR_SCREENSONG_NUMSONGS";
                        _Texts[i].Text = currentCat.Name + " " + CBase.Language.Translate(songOrSongs).Replace("%v", num.ToString());
                    }
                }
                else
                {
                    _Tiles[i].Color.A = 0;
                    _Texts[i].Text    = "";
                }
            }
            _Offset = offset;
        }
Example #4
0
        private void _RebuildSlides()
        {
            // build num player slide (min player ... max player);
            _SelectSlides[_SelectSlideNumPlayers].Clear();
            for (int i = _PartyMode.MinPlayers; i <= _PartyMode.MaxPlayers; i++)
            {
                _SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
            }
            _SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.MinPlayers;

            _SelectSlides[_SelectSlideNumSongs].Clear();
            for (int i = _PartyMode.MinSongs; i <= _PartyMode.MaxSongs; i++)
            {
                _SelectSlides[_SelectSlideNumSongs].AddValue(i.ToString());
            }
            _SelectSlides[_SelectSlideNumSongs].Selection = _PartyMode.GameData.NumSongs - _PartyMode.MinSongs;

            _SelectSlides[_SelectSlideSongSource].Clear();
            _SelectSlides[_SelectSlideSongSource].SetValues <ESongSource>((int)_PartyMode.GameData.SongSource);

            List <string> playlists = CBase.Playlist.GetNames();

            _SelectSlides[_SelectSlidePlaylist].Clear();
            for (int i = 0; i < playlists.Count; i++)
            {
                string value = playlists[i] + " (" + CBase.Playlist.GetSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
                _SelectSlides[_SelectSlidePlaylist].AddValue(value);
            }
            _SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID;
            _SelectSlides[_SelectSlidePlaylist].Visible   = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST;

            _SelectSlides[_SelectSlideCategory].Clear();
            for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
            {
                CCategory cat   = CBase.Songs.GetCategory(i);
                string    value = cat.Name + " (" + cat.GetNumSongsNotSung() + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
                _SelectSlides[_SelectSlideCategory].AddValue(value);
            }
            _SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryIndex;
            _SelectSlides[_SelectSlideCategory].Visible   = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY;

            _UpdateMicsAtOnce();
            _SetRoundSteps();
            _UpdateSlideRounds();
        }
Example #5
0
        private void _FillSlides()
        {
            _SelectSlides[_SelectSlideNumFields].Clear();
            _SelectSlides[_SelectSlideNumFields].AddValue(9);
            _SelectSlides[_SelectSlideNumFields].AddValue(16);
            _SelectSlides[_SelectSlideNumFields].AddValue(25);

            _SelectSlides[_SelectSlideNumFields].SelectedTag = _PartyMode.GameData.NumFields;

            _SelectSlides[_SelectSlideSongSource].Clear();
            _SelectSlides[_SelectSlideSongSource].SetValues <ESongSource>((int)_PartyMode.GameData.SongSource);

            List <string> playlists = CBase.Playlist.GetNames();

            _SelectSlides[_SelectSlidePlaylist].Clear();
            for (int i = 0; i < playlists.Count; i++)
            {
                string value = playlists[i] + " (" + CBase.Playlist.GetSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
                _SelectSlides[_SelectSlidePlaylist].AddValue(value);
            }
            _SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID;
            _SelectSlides[_SelectSlidePlaylist].Visible   = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST;

            _SelectSlides[_SelectSlideCategory].Clear();
            for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
            {
                CCategory cat   = CBase.Songs.GetCategory(i);
                string    value = cat.Name + " (" + cat.GetNumSongsNotSung() + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
                _SelectSlides[_SelectSlideCategory].AddValue(value);
            }
            _SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryIndex;
            _SelectSlides[_SelectSlideCategory].Visible   = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY;

            _SelectSlides[_SelectSlideGameMode].Visible = true;
            _SelectSlides[_SelectSlideGameMode].Clear();
            _SelectSlides[_SelectSlideGameMode].AddValues(_PartyMode.AvailableGameModes.Select(gm => gm.ToString()));
            _SelectSlides[_SelectSlideGameMode].Selection = _PartyMode.GameData.GameMode;
        }
Example #6
0
        private void _UpdatePreview()
        {
            //First hide everything so we just have to set what we actually want
            _CoverBig.Texture       = _CoverBigBGTexture;
            _Artist.Text            = String.Empty;
            _Title.Text             = String.Empty;
            _SongLength.Text        = String.Empty;
            _SongYear.Text          = String.Empty;
            _DuetIcon.Visible       = false;
            _VideoIcon.Visible      = false;
            _MedleyCalcIcon.Visible = false;
            _MedleyTagIcon.Visible  = false;
            _Length = -1f;

            //Check if nothing is selected (for preview)
            if (_PreviewNr < 0)
            {
                return;
            }

            if (CBase.Songs.IsInCategory())
            {
                CSong song = CBase.Songs.GetVisibleSong(_PreviewNr);
                //Check if we have a valid song (song still visible, index >=0 etc is checked by framework)
                if (song == null)
                {
                    //Display at least the category
                    CCategory category = CBase.Songs.GetCategory(CBase.Songs.GetCurrentCategoryIndex());
                    //Check if we have a valid category
                    if (category == null)
                    {
                        return;
                    }
                    _CoverBig.Texture = category.CoverTextureBig;
                    _Artist.Text      = category.Name;
                    return;
                }
                _CoverBig.Texture       = song.CoverTextureBig;
                _Artist.Text            = song.Artist;
                _Title.Text             = song.Title;
                _SongYear.Text          = song.Year;
                _DuetIcon.Visible       = song.IsDuet;
                _VideoIcon.Visible      = song.VideoFileName != "";
                _MedleyCalcIcon.Visible = song.Medley.Source == EDataSource.Calculated;
                _MedleyTagIcon.Visible  = song.Medley.Source == EDataSource.Tag;

                _UpdateLength(song);
            }
            else
            {
                CCategory category = CBase.Songs.GetCategory(_PreviewNr);
                //Check if we have a valid category
                if (category == null)
                {
                    return;
                }
                _CoverBig.Texture = category.CoverTextureBig;
                _Artist.Text      = category.Name;

                int    num         = category.GetNumSongsNotSung();
                String songOrSongs = (num == 1) ? "TR_SCREENSONG_NUMSONG" : "TR_SCREENSONG_NUMSONGS";
                _Title.Text = CBase.Language.Translate(songOrSongs).Replace("%v", num.ToString());
            }
        }