Example #1
0
 private void _UpdatePlayerNumber()
 {
     CConfig.Config.Game.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
     CGame.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
     for (int i = 1; i <= CSettings.MaxNumPlayer; i++)
     {
         if (i <= CGame.NumPlayers)
         {
             _Statics["StaticPlayer" + i].Visible       = true;
             _Statics["StaticPlayerAvatar" + i].Visible = true;
             _Texts["TextPlayer" + i].Visible           = true;
             if (_Texts["TextPlayer" + i].Text == "")
             {
                 _Texts["TextPlayer" + i].Text = CProfiles.GetPlayerName(-1, i);
             }
             _Equalizers["EqualizerPlayer" + i].Visible = true;
             if (CGame.GetNumSongs() == 1 && CGame.GetSong(0).IsDuet)
             {
                 _SelectSlides["SelectSlideDuetPlayer" + i].Visible = true;
             }
         }
         else
         {
             _Statics["StaticPlayer" + i].Visible               = false;
             _Statics["StaticPlayerAvatar" + i].Visible         = false;
             _Texts["TextPlayer" + i].Visible                   = false;
             _Equalizers["EqualizerPlayer" + i].Visible         = false;
             _SelectSlides["SelectSlideDuetPlayer" + i].Visible = false;
         }
     }
     CConfig.SaveConfig();
     _CheckMics();
     _CheckPlayers();
 }
Example #2
0
        private void _ClosePopup()
        {
            string _NewProfileName = CProfiles.GetPlayerName(_NewProfileID);

            if (_NewProfileName.Length < 1)
            {
                _DeleteProfile();
            }

            CGraphics.HidePopup(EPopupScreens.PopupNewPlayer);
        }
Example #3
0
        private void _SaveProfiles()
        {
            _EditMode = EEditMode.None;
            string _NewProfileName = CProfiles.GetPlayerName(_NewProfileID);

            if (_NewProfileName.Length > 1)
            {
                CProfiles.SaveProfiles();
            }
            _ProfilesChanged = true;
        }
Example #4
0
 private void _LoadPlayerPanels()
 {
     for (int i = 0; i < CGame.NumPlayers; i++)
     {
         _NameSelections[_NameSelection].UseProfile(CGame.Players[i].ProfileID);
         _Statics[_PlayerStaticAvatar[i]].Texture = CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID) ?
                                                    CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID) :
                                                    _OriginalPlayerAvatarTextures[i];
         _Texts[_PlayerText[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID, i + 1);
     }
     _PopulateVoiceSelection();
 }
Example #5
0
        private void _LoadProfiles(bool keep)
        {
            string name = String.Empty;

            if (_EditMode == EEditMode.PlayerName)
            {
                name = CProfiles.GetPlayerName(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag));
            }

            Guid selectedProfileID = _GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag);

            _SelectSlides[_SelectSlideProfiles].Clear();
            _SelectSlideGuids.Clear();

            CProfile[] profiles = CProfiles.GetProfiles();
            int        i        = 0;

            foreach (CProfile profile in profiles)
            {
                _SelectSlides[_SelectSlideProfiles].AddValue(profile.PlayerName, null, i);
                _SelectSlideGuids.Add(i, profile.ID);
                i++;
            }

            if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0)
            {
                if (selectedProfileID != Guid.Empty)
                {
                    _SelectSlides[_SelectSlideProfiles].SelectedTag = _SelectSlideGuids.FirstOrDefault(x => x.Value.Equals(selectedProfileID)).Key;
                }
                else
                {
                    _SelectSlides[_SelectSlideProfiles].Selection = 0;
                    selectedProfileID = _GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag);
                }

                if (!keep)
                {
                    _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID);
                    _SelectSlides[_SelectSlideUserRole].Selection   = (int)CProfiles.GetUserRoleProfile(selectedProfileID);
                    _SelectSlides[_SelectSlideActive].Selection     = (int)CProfiles.GetActive(selectedProfileID);
                    _SelectSlides[_SelectSlideAvatars].SelectedTag  = CProfiles.GetAvatarID(selectedProfileID);
                }

                if (_EditMode == EEditMode.PlayerName)
                {
                    CProfiles.SetPlayerName(_GetIdFromTag(_SelectSlides[_SelectSlideProfiles].SelectedTag), name);
                }
            }
            _ProfilesChanged = false;
        }
Example #6
0
 private void _ResetPlayerSelections()
 {
     for (int i = 0; i < CGame.NumPlayers; i++)
     {
         _NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[i].ProfileID);
         CGame.Players[i].ProfileID = Guid.Empty;
         //Update config for default players.
         CConfig.Config.Game.Players[i] = String.Empty;
         //Update texture and name
         _Statics[_PlayerStaticAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i];
         _Texts[_PlayerText[i]].Text = CProfiles.GetPlayerName(Guid.Empty, i + 1);
     }
     _NameSelections[_NameSelection].UpdateList();
     CConfig.SaveConfig();
 }
Example #7
0
 private void _ResetPlayerSelection(int playerNum)
 {
     _NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[playerNum].ProfileID);
     CGame.Players[playerNum].ProfileID = -1;
     //Update config for default players.
     CConfig.Config.Game.Players[playerNum] = String.Empty;
     CConfig.SaveConfig();
     //Update texture and name
     _Statics[_StaticPlayerAvatar[playerNum]].Texture = _OriginalPlayerAvatarTextures[playerNum];
     _Texts[_TextPlayer[playerNum]].Text = CProfiles.GetPlayerName(-1, playerNum + 1);
     //Update profile-warning
     _CheckPlayers();
     //Update Tiles-List
     _NameSelections[_NameSelection].UpdateList();
 }
Example #8
0
        private void _UpdatePlayerNumber()
        {
            CConfig.Config.Game.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
            CGame.NumPlayers = _SelectSlides[_SelectSlidePlayerNumber].Selection + 1;
            _AssignPlayerElements();
            //_LoadPlayerPanels();
            _ResetPlayerElements();

            for (int i = 0; i < CSettings.MaxNumPlayer; i++)
            {
                if (i < CGame.NumPlayers)
                {
                    _Buttons[_PlayerButton[i]].Visible       = true;
                    _Statics[_PlayerStatic[i]].Visible       = true;
                    _Statics[_PlayerStaticAvatar[i]].Visible = true;
                    _Texts[_PlayerText[i]].Visible           = true;
                    if (CGame.Players[i].ProfileID != Guid.Empty)
                    {
                        _Statics[_PlayerStaticAvatar[i]].Texture = CProfiles.GetAvatarTexture(CProfiles.GetAvatarID(CGame.Players[i].ProfileID));
                        _Texts[_PlayerText[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID, i + 1);
                    }
                    else
                    {
                        _Texts[_PlayerText[i]].Text = CProfiles.GetPlayerName(Guid.Empty, i + 1);
                        _Statics[_PlayerStaticAvatar[i]].Texture = _OriginalPlayerAvatarTextures[i];
                    }
                    _Texts[_PlayerText[i]].Color                = CBase.Themes.GetPlayerColor(i + 1);
                    _Equalizers[_PlayerEqualizer[i]].Color.R    = CBase.Themes.GetPlayerColor(i + 1).R;
                    _Equalizers[_PlayerEqualizer[i]].Color.G    = CBase.Themes.GetPlayerColor(i + 1).G;
                    _Equalizers[_PlayerEqualizer[i]].Color.B    = CBase.Themes.GetPlayerColor(i + 1).B;
                    _Equalizers[_PlayerEqualizer[i]].MaxColor.R = CBase.Themes.GetPlayerColor(i + 1).R;
                    _Equalizers[_PlayerEqualizer[i]].MaxColor.G = CBase.Themes.GetPlayerColor(i + 1).G;
                    _Equalizers[_PlayerEqualizer[i]].MaxColor.B = CBase.Themes.GetPlayerColor(i + 1).B;
                    _Equalizers[_PlayerEqualizer[i]].Visible    = true;
                    if (CGame.GetNumSongs() == 1 && CGame.GetSong(0).IsDuet)
                    {
                        _SelectSlides[_PlayerSelectSlideDuet[i]].Visible = true;
                    }
                }
                else
                {
                    _ResetPlayerSelection(i);
                }
            }
            CConfig.SaveConfig();
            _CheckMics();
            //_CheckPlayers();
        }
Example #9
0
 private void _UpdateSelectedProfile(int playerNum, Guid profileId)
 {
     _NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[playerNum].ProfileID);
     _NameSelections[_NameSelection].UseProfile(profileId);
     //Update Game-infos with new player
     CGame.Players[playerNum].ProfileID = profileId;
     //Update config for default players.
     CConfig.Config.Game.Players[playerNum] = CProfiles.GetProfileFileName(profileId);
     CConfig.SaveConfig();
     //Update texture and name
     _Statics[_PlayerStaticAvatar[playerNum]].Texture = CProfiles.GetAvatarTextureFromProfile(profileId);
     _Texts[_PlayerText[playerNum]].Text = CProfiles.GetPlayerName(profileId);
     //Update profile-warning
     //_CheckPlayers();
     //Update Tiles-List
     _NameSelections[_NameSelection].UpdateList();
 }
Example #10
0
        private void _LoadProfiles(bool keep)
        {
            string name = String.Empty;

            if (_EditMode == EEditMode.PlayerName)
            {
                name = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag);
            }

            int selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag;

            _SelectSlides[_SelectSlideProfiles].Clear();

            CProfile[] profiles = CProfiles.GetProfiles();
            foreach (CProfile profile in profiles)
            {
                _SelectSlides[_SelectSlideProfiles].AddValue(profile.PlayerName, null, profile.ID);
            }

            if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0)
            {
                if (selectedProfileID != -1)
                {
                    _SelectSlides[_SelectSlideProfiles].SelectedTag = selectedProfileID;
                }
                else
                {
                    _SelectSlides[_SelectSlideProfiles].Selection = 0;
                    selectedProfileID = _SelectSlides[_SelectSlideProfiles].SelectedTag;
                }

                if (!keep)
                {
                    _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(selectedProfileID);
                    _SelectSlides[_SelectSlideUserRole].Selection   = (int)CProfiles.GetUserRoleProfile(selectedProfileID);
                    _SelectSlides[_SelectSlideActive].Selection     = (int)CProfiles.GetActive(selectedProfileID);
                    _SelectSlides[_SelectSlideAvatars].SelectedTag  = CProfiles.GetAvatarID(selectedProfileID);
                }

                if (_EditMode == EEditMode.PlayerName)
                {
                    CProfiles.SetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag, name);
                }
            }
            _ProfilesChanged = false;
        }
Example #11
0
        private void LoadProfiles()
        {
            _EditMode = EEditMode.None;
            SelectSlides[htSelectSlides(SelectSlideProfiles)].Clear();

            for (int i = 0; i < CProfiles.NumProfiles; i++)
            {
                SelectSlides[htSelectSlides(SelectSlideProfiles)].AddValue(CProfiles.GetPlayerName(i));
            }

            if (CProfiles.NumProfiles > 0 && CProfiles.NumAvatars > 0)
            {
                SelectSlides[htSelectSlides(SelectSlideDifficulty)].Selection   = (int)CProfiles.GetDifficulty(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
                SelectSlides[htSelectSlides(SelectSlideGuestProfile)].Selection = (int)CProfiles.GetGuestProfile(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
                SelectSlides[htSelectSlides(SelectSlideActive)].Selection       = (int)CProfiles.GetActive(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
                SelectSlides[htSelectSlides(SelectSlideAvatars)].Selection      = CProfiles.GetAvatarNr(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
            }
        }
Example #12
0
        public override bool UpdateGame()
        {
            if (_AvatarsChanged)
            {
                _LoadAvatars(true);
            }

            if (_ProfilesChanged)
            {
                _LoadProfiles(true);
            }

            if (_SelectSlides[_SelectSlideProfiles].Selection > -1)
            {
                _Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_SelectSlides[_SelectSlideProfiles].SelectedTag);
                if (_EditMode == EEditMode.PlayerName)
                {
                    _Buttons[_ButtonPlayerName].Text.Text += "|";
                }

                _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_SelectSlides[_SelectSlideProfiles].SelectedTag);
                _SelectSlides[_SelectSlideUserRole].Selection   = (int)CProfiles.GetUserRoleProfile(_SelectSlides[_SelectSlideProfiles].SelectedTag);
                _SelectSlides[_SelectSlideActive].Selection     = (int)CProfiles.GetActive(_SelectSlides[_SelectSlideProfiles].SelectedTag);

                int avatarID = CProfiles.GetAvatarID(_SelectSlides[_SelectSlideProfiles].SelectedTag);
                _SelectSlides[_SelectSlideAvatars].SelectedTag = avatarID;
                if (_Snapshot == null)
                {
                    if (CWebcam.IsCapturing())
                    {
                        if (CWebcam.GetFrame(ref _WebcamTexture))
                        {
                            _Statics[_StaticAvatar].Texture = _WebcamTexture;
                        }
                    }
                    else
                    {
                        _Statics[_StaticAvatar].Texture = CProfiles.GetAvatarTexture(avatarID);
                    }
                }
            }

            return(true);
        }
Example #13
0
        public int AddScore(SPlayer player)
        {
            using (var connection = new SQLiteConnection())
            {
                connection.ConnectionString = "Data Source=" + _FilePath;

                try
                {
                    connection.Open();
                }
                catch (Exception)
                {
                    return(-1);
                }

                int medley    = 0;
                int duet      = 0;
                int shortSong = 0;
                switch (player.GameMode)
                {
                case EGameMode.TR_GAMEMODE_MEDLEY:
                    medley = 1;
                    break;

                case EGameMode.TR_GAMEMODE_DUET:
                    duet = 1;
                    break;

                case EGameMode.TR_GAMEMODE_SHORTSONG:
                    shortSong = 1;
                    break;
                }

                using (var command = new SQLiteCommand(connection))
                {
                    int dataBaseSongID = CSongs.GetSong(player.SongID).DataBaseSongID;
                    return(_AddScore(CProfiles.GetPlayerName(player.ProfileID), (int)Math.Round(player.Points), player.VoiceNr, player.DateTicks, medley,
                                     duet, shortSong, (int)CProfiles.GetDifficulty(player.ProfileID), dataBaseSongID, command));
                }
            }
        }
Example #14
0
 private void _ResetPlayerSelection(int playerNum)
 {
     _NameSelections[_NameSelection].RemoveUsedProfile(CGame.Players[playerNum].ProfileID);
     CGame.Players[playerNum].ProfileID = Guid.Empty;
     //Update config for default players.
     CConfig.Config.Game.Players[playerNum] = String.Empty;
     CConfig.SaveConfig();
     //Update texture and name
     if (playerNum < _PlayerStaticAvatar.Length)
     {
         _Statics[_PlayerStaticAvatar[playerNum]].Texture = _OriginalPlayerAvatarTextures[playerNum];
     }
     if (playerNum < _PlayerText.Length)
     {
         _Texts[_PlayerText[playerNum]].Text = CProfiles.GetPlayerName(Guid.Empty, playerNum + 1);
     }
     //Update profile-warning
     //_CheckPlayers();
     //Update Tiles-List
     _NameSelections[_NameSelection].UpdateList();
 }
Example #15
0
        public override bool UpdateGame()
        {
            if (SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection > -1)
            {
                Buttons[htButtons(ButtonPlayerName)].Text.Text = CProfiles.GetPlayerName(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
                if (_EditMode == EEditMode.PlayerName)
                {
                    Buttons[htButtons(ButtonPlayerName)].Text.Text += "|";
                }

                SelectSlides[htSelectSlides(SelectSlideDifficulty)].Selection   = (int)CProfiles.GetDifficulty(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
                SelectSlides[htSelectSlides(SelectSlideGuestProfile)].Selection = (int)CProfiles.GetGuestProfile(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
                SelectSlides[htSelectSlides(SelectSlideActive)].Selection       = (int)CProfiles.GetActive(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);

                int avatarNr = CProfiles.GetAvatarNr(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
                SelectSlides[htSelectSlides(SelectSlideAvatars)].Selection = avatarNr;
                Statics[htStatics(StaticAvatar)].Texture = CProfiles.Avatars[avatarNr].Texture;
            }

            return(true);
        }
Example #16
0
        private void _LoadProfiles()
        {
            _NameSelections[_NameSelection].UpdateList();

            _UpdateSlides();
            _UpdatePlayerNumber();
            _CheckMics();
            _CheckPlayers();

            CSong firstSong = CGame.GetSong(0);

            for (int i = 0; i < CSettings.MaxNumPlayer; i++)
            {
                _NameSelections[_NameSelection].UseProfile(CGame.Players[i].ProfileID);
                _Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID) ?
                                                           CProfiles.GetAvatarTextureFromProfile(CGame.Players[i].ProfileID) :
                                                           _OriginalPlayerAvatarTextures[i];
                _Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID, i + 1);
                if (CGame.GetNumSongs() == 1 && firstSong.IsDuet)
                {
                    _SelectSlides[_SelectSlideDuetPlayer[i]].Clear();
                    _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = i + 1 <= CGame.NumPlayers;

                    for (int j = 0; j < firstSong.Notes.VoiceCount; j++)
                    {
                        _SelectSlides[_SelectSlideDuetPlayer[i]].AddValue(firstSong.Notes.VoiceNames[j]);
                    }
                    _SelectSlides[_SelectSlideDuetPlayer[i]].Selection = i % 2;
                }
                else
                {
                    _SelectSlides[_SelectSlideDuetPlayer[i]].Visible = false;
                }
            }
            _NameSelections[_NameSelection].UpdateList();
            _ProfilesChanged = false;
            _AvatarsChanged  = false;
        }
Example #17
0
        public override bool UpdateGame()
        {
            if (SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection > -1)
            {
                Buttons[htButtons(ButtonPlayerName)].Text.Text = CProfiles.GetPlayerName(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
                if (_EditMode == EEditMode.PlayerName)
                {
                    Buttons[htButtons(ButtonPlayerName)].Text.Text += "|";
                }

                SelectSlides[htSelectSlides(SelectSlideDifficulty)].Selection   = (int)CProfiles.GetDifficulty(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
                SelectSlides[htSelectSlides(SelectSlideGuestProfile)].Selection = (int)CProfiles.GetGuestProfile(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
                SelectSlides[htSelectSlides(SelectSlideActive)].Selection       = (int)CProfiles.GetActive(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);

                int avatarNr = CProfiles.GetAvatarNr(SelectSlides[htSelectSlides(SelectSlideProfiles)].Selection);
                SelectSlides[htSelectSlides(SelectSlideAvatars)].Selection = avatarNr;
                if (CWebcam.GetDevices().Length > 0 && _WebcamTexture.index > 0)
                {
                    if (_Snapshot == null)
                    {
                        CWebcam.GetFrame(ref _WebcamTexture);
                    }
                    Statics[htStatics(StaticAvatar)].Texture = _WebcamTexture;

                    RectangleF bounds = new RectangleF(_WebcamTexture.rect.X, _WebcamTexture.rect.Y, _WebcamTexture.rect.W, _WebcamTexture.rect.H);
                    RectangleF rect   = new RectangleF(0f, 0f, _WebcamTexture.rect.W, _WebcamTexture.rect.H);
                    CHelper.SetRect(bounds, ref rect, rect.Width / rect.Height, EAspect.Crop);
                }
                else
                {
                    Statics[htStatics(StaticAvatar)].Texture = CProfiles.Avatars[avatarNr].Texture;
                }
            }

            return(true);
        }
Example #18
0
        private void _UpdateRatings()
        {
            CSong song    = null;
            var   players = new SPlayer[CGame.NumPlayers];

            if (_Round >= 0)
            {
                song = CGame.GetSong(_Round);
                if (song == null)
                {
                    return;
                }

                _Texts[_TextSong].Text = song.Artist + " - " + song.Title;
                if (_Points.NumRounds > 1)
                {
                    _Texts[_TextSong].Text += " (" + (_Round + 1) + "/" + _Points.NumRounds + ")";
                }
                players = _Points.GetPlayer(_Round, CGame.NumPlayers);
            }
            else
            {
                _Texts[_TextSong].Text = "TR_SCREENSCORE_OVERALLSCORE";
                for (int i = 0; i < CGame.NumRounds; i++)
                {
                    SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayers);
                    for (int p = 0; p < players.Length; p++)
                    {
                        if (i < 1)
                        {
                            players[p].ProfileID = points[p].ProfileID;
                        }
                        players[p].Points += points[p].Points;
                    }
                }
                for (int p = 0; p < players.Length; p++)
                {
                    players[p].Points = (int)Math.Round(players[p].Points / CGame.NumRounds);
                }
            }

            for (int p = 0; p < players.Length; p++)
            {
                string name = CProfiles.GetPlayerName(players[p].ProfileID, p);
                if (song != null && song.IsDuet)
                {
                    if (song.Notes.VoiceNames.IsSet(players[p].VoiceNr))
                    {
                        name += " (" + song.Notes.VoiceNames[players[p].VoiceNr] + ")";
                    }
                }
                _Texts[_TextNames[p, CGame.NumPlayers - 1]].Text = name;

                if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortScore].GetValue())
                {
                    _Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS");
                }
                else
                {
                    _Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000");
                }
                if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue())
                {
                    _Texts[_TextDifficulty[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " +
                                                                            CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
                }
                else
                {
                    _Texts[_TextDifficulty[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
                }
                if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue())
                {
                    _Texts[_TextRatings[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " +
                                                                         CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
                }
                else
                {
                    _Texts[_TextRatings[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
                }

                _ProgressBars[_ProgressBarPoints[p, CGame.NumPlayers - 1]].Progress = (float)players[p].Points / CSettings.MaxScore;

                if (CProfiles.IsProfileIDValid(players[p].ProfileID))
                {
                    _Statics[_StaticAvatar[p, CGame.NumPlayers - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID);
                }
            }
        }
Example #19
0
        public override bool UpdateGame()
        {
            if (_Buttons[_ButtonPlayerName].Selected)
            {
                _EditMode = EEditMode.PlayerName;
            }
            //BODGE!
            for (int i = 0; i < 3; i++)
            {
                _Texts["TextSelectSlideDifficulty" + i].Text         = _SelectSlides[_SelectSlideDifficulty].SelectedValue;
                _Statics["StaticSelectSlideDifficultyL" + i].Visible = true;
                _Statics["StaticSelectSlideDifficultyR" + i].Visible = true;
                if (_SelectSlides[_SelectSlideDifficulty].Selection == 0)
                {
                    _Statics["StaticSelectSlideDifficultyL" + i].Visible = false;
                }
                if (_SelectSlides[_SelectSlideDifficulty].Selection == _SelectSlides[_SelectSlideDifficulty].NumValues - 1)
                {
                    _Statics["StaticSelectSlideDifficultyR" + i].Visible = false;
                }

                _Texts["TextSelectSlideAvatars" + i].Text         = _SelectSlides[_SelectSlideAvatars].SelectedValue;
                _Statics["StaticSelectSlideAvatarsL" + i].Visible = true;
                _Statics["StaticSelectSlideAvatarsR" + i].Visible = true;
                if (_SelectSlides[_SelectSlideAvatars].Selection == 0)
                {
                    _Statics["StaticSelectSlideAvatarsL" + i].Visible = false;
                }
                if (_SelectSlides[_SelectSlideAvatars].Selection == _SelectSlides[_SelectSlideAvatars].NumValues - 1)
                {
                    _Statics["StaticSelectSlideAvatarsR" + i].Visible = false;
                }

                _Statics["StaticAvatar" + i].Aspect  = _Statics["StaticAvatar"].Aspect;
                _Statics["StaticAvatar" + i].Texture = _Statics["StaticAvatar"].Texture;
                _Texts["TextPlayerName" + i].Text    = _Buttons[_ButtonPlayerName].Text.Text;
                if (_Buttons[_ButtonPlayerName].Selected)
                {
                    _Statics[_StaticButtonPlayerName[i]].Visible = true;
                    _Statics[_StaticButtonPlayerName[i]].Texture = _Buttons[_ButtonPlayerName].SelTexture;
                    _Statics[_StaticButtonPlayerName[i]].Color   = _Buttons[_ButtonPlayerName].SelColor;
                }
                else
                {
                    _Statics[_StaticButtonPlayerName[i]].Visible = false;
                }
                if (_Buttons[_ButtonCancel].Selected)
                {
                    _Statics["StaticButtonCancel" + i].Color = _Buttons[_ButtonCancel].SelColor;
                    _Texts["TextButtonCancel" + i].Selected  = true;
                }
                else
                {
                    _Statics["StaticButtonCancel" + i].Color = _Buttons[_ButtonCancel].Color;
                    _Texts["TextButtonCancel" + i].Selected  = false;
                }
                if (_Buttons[_ButtonSave].Selected)
                {
                    _Statics["StaticButtonSave" + i].Color = _Buttons[_ButtonSave].SelColor;
                    _Texts["TextButtonSave" + i].Selected  = true;
                }
                else
                {
                    _Statics["StaticButtonSave" + i].Color = _Buttons[_ButtonSave].Color;
                    _Texts["TextButtonSave" + i].Selected  = false;
                }

                if (_SelectSlides[_SelectSlideDifficulty].Selected)
                {
                    _Statics["StaticSelectSlideDifficulty" + i].Visible = true;
                    _Texts["TextSelectSlideDifficulty" + i].Selected    = true;
                }
                else
                {
                    _Statics["StaticSelectSlideDifficulty" + i].Visible = false;
                    _Texts["TextSelectSlideDifficulty" + i].Selected    = false;
                }

                if (_SelectSlides[_SelectSlideAvatars].Selected)
                {
                    _Statics["StaticSelectSlideAvatars" + i].Visible = true;
                    _Texts["TextSelectSlideAvatars" + i].Selected    = true;
                }
                else
                {
                    _Statics["StaticSelectSlideAvatars" + i].Visible = false;
                    _Texts["TextSelectSlideAvatars" + i].Selected    = false;
                }
            }

            if (_AvatarsChanged)
            {
                _LoadAvatars(true);
            }

            if (_ProfilesChanged)
            {
                _LoadProfiles(true);
            }

            //if (_SelectSlides[_SelectSlideProfiles].Selection > -1)
            //{
            _Buttons[_ButtonPlayerName].Text.Text = CProfiles.GetPlayerName(_NewProfileID);
            if (_EditMode == EEditMode.PlayerName && _CursorBlink)
            {
                _Buttons[_ButtonPlayerName].Text.Text = " " + _Buttons[_ButtonPlayerName].Text.Text + "_";
            }
            else
            {
                _Buttons[_ButtonPlayerName].Text.Text = " " + _Buttons[_ButtonPlayerName].Text.Text + " ";
            }

            _SelectSlides[_SelectSlideDifficulty].Selection = (int)CProfiles.GetDifficulty(_NewProfileID);
            //_SelectSlides[_SelectSlideUserRole].Selection = (int)CProfiles.GetUserRoleProfile(_NewProfileID);
            //_SelectSlides[_SelectSlideActive].Selection = (int)CProfiles.GetActive(_NewProfileID);

            int avatarID = CProfiles.GetAvatarID(_NewProfileID);

            _SelectSlides[_SelectSlideAvatars].SelectedTag = avatarID;
            _Statics[_StaticAvatar].Texture = CProfiles.GetAvatarTexture(avatarID);
            //}

            return(true);
        }
Example #20
0
        private void _UpdateRatings()
        {
            CSong song    = null;
            var   players = new SPlayer[CGame.NumPlayers];

            if (_Round >= 0)
            {
                song = CGame.GetSong(_Round);
                if (song == null)
                {
                    return;
                }

                _Texts[_TextSong].Text = song.Artist + " - " + song.Title;
                if (_Points.NumRounds > 1)
                {
                    _Texts[_TextSong].Text += " (" + (_Round + 1) + "/" + _Points.NumRounds + ")";
                }
                players = _Points.GetPlayer(_Round, CGame.NumPlayers);
            }
            else
            {
                _Texts[_TextSong].Text = "TR_SCREENSCORE_OVERALLSCORE";
                for (int i = 0; i < CGame.NumRounds; i++)
                {
                    SPlayer[] points = _Points.GetPlayer(i, CGame.NumPlayers);
                    for (int p = 0; p < players.Length; p++)
                    {
                        if (i < 1)
                        {
                            players[p].ProfileID = points[p].ProfileID;
                        }
                        players[p].Points += points[p].Points;
                    }
                }
                for (int p = 0; p < players.Length; p++)
                {
                    players[p].Points = (int)Math.Round(players[p].Points / CGame.NumRounds);
                }
            }

            var pointAnimDirection = (string)_ScreenSettings[_ScreenSettingAnimationDirection].GetValue();

            for (int p = 0; p < players.Length; p++)
            {
                string name = CProfiles.GetPlayerName(players[p].ProfileID, p);
                if (song != null && song.IsDuet)
                {
                    if (song.Notes.VoiceNames.IsSet(players[p].VoiceNr))
                    {
                        name += " (" + song.Notes.VoiceNames[players[p].VoiceNr] + ")";
                    }
                }
                _Texts[_TextNames[p, CGame.NumPlayers - 1]].Text = name;

                if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortScore].GetValue())
                {
                    _Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000") + " " + CLanguage.Translate("TR_SCREENSCORE_POINTS");
                }
                else
                {
                    _Texts[_TextScores[p, CGame.NumPlayers - 1]].Text = ((int)Math.Round(players[p].Points)).ToString("0000");
                }
                if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortDifficulty].GetValue())
                {
                    _Texts[_TextDifficulty[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_GAMEDIFFICULTY") + ": " +
                                                                            CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
                }
                else
                {
                    _Texts[_TextDifficulty[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate(CProfiles.GetDifficulty(players[p].ProfileID).ToString());
                }
                if (CGame.NumPlayers < (int)_ScreenSettings[_ScreenSettingShortRating].GetValue())
                {
                    _Texts[_TextRatings[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate("TR_SCREENSCORE_RATING") + ": " +
                                                                         CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
                }
                else
                {
                    _Texts[_TextRatings[p, CGame.NumPlayers - 1]].Text = CLanguage.Translate(_GetRating((int)Math.Round(players[p].Points)));
                }

                _StaticPointsBarDrawnPoints[p] = 0.0;
                if (pointAnimDirection.ToLower() == "vertical")
                {
                    _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].W = 0;
                }
                else
                {
                    _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H = 0;
                    _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H +
                                                                            _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].Y -
                                                                            _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H;
                }
                if (CProfiles.IsProfileIDValid(players[p].ProfileID))
                {
                    _Statics[_StaticAvatar[p, CGame.NumPlayers - 1]].Texture = CProfiles.GetAvatarTextureFromProfile(players[p].ProfileID);
                }
            }

            if (CConfig.Config.Game.ScoreAnimationTime < 1)
            {
                for (int p = 0; p < CGame.NumPlayers; p++)
                {
                    if (pointAnimDirection.ToLower() == "vertical")
                    {
                        _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].W = ((float)players[p].Points) *
                                                                                (_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].W / CSettings.MaxScore);
                    }
                    else
                    {
                        _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H = ((float)players[p].Points) *
                                                                                (_Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H / CSettings.MaxScore);
                        _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].Y = _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].H +
                                                                                _Statics[_StaticPointsBarBG[p, CGame.NumPlayers - 1]].Y -
                                                                                _Statics[_StaticPointsBar[p, CGame.NumPlayers - 1]].H;
                    }
                    _StaticPointsBarDrawnPoints[p] = players[p].Points;
                }
            }

            _Timer = new Stopwatch();
            _Timer.Start();
        }