SProfile => CProfile; SAvatar => CAvatar
This commit is contained in:
1 parent
ed3047314b
commit
ec5bdb7742
16 files changed
+106
-83
No files matched your search
@@ -21,6 +21,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
|
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
@@ -532,7 +533,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
|
|
||||||
private void _SetTeamNames()
|
private void _SetTeamNames()
|
||||||
{
|
{
|
||||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
|
|
||||||
if (profiles == null)
|
if (profiles == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
|
|
||||||
namespace VocaluxeLib.PartyModes.Challenge
|
namespace VocaluxeLib.PartyModes.Challenge
|
||||||
{
|
{
|
||||||
@@ -379,7 +380,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
||||||
{
|
{
|
||||||
_Texts[_TextNextPlayerMessage].Visible = true;
|
_Texts[_TextNextPlayerMessage].Visible = true;
|
||||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||||
{
|
{
|
||||||
int pid = _GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i];
|
int pid = _GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i];
|
||||||
@@ -491,7 +492,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
|
|
||||||
private void _UpdateRoundsTable()
|
private void _UpdateRoundsTable()
|
||||||
{
|
{
|
||||||
SProfile[] profile = CBase.Profiles.GetProfiles();
|
CProfile[] profile = CBase.Profiles.GetProfiles();
|
||||||
for (int i = 0; i < _RoundsTable.Count; i++)
|
for (int i = 0; i < _RoundsTable.Count; i++)
|
||||||
{
|
{
|
||||||
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
||||||
@@ -585,7 +586,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
|
|
||||||
private void _UpdatePlayerTable()
|
private void _UpdatePlayerTable()
|
||||||
{
|
{
|
||||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
|
|
||||||
for (int i = 0; i < _PlayerTable.Count; i++)
|
for (int i = 0; i < _PlayerTable.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -657,7 +658,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
private string _GetPlayerWinString()
|
private string _GetPlayerWinString()
|
||||||
{
|
{
|
||||||
string s = "";
|
string s = "";
|
||||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
|
|
||||||
for (int i = 0; i < _GameState.ResultTable.Count; i++)
|
for (int i = 0; i < _GameState.ResultTable.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ using System.Runtime.InteropServices;
|
|||||||
using VocaluxeLib.Game;
|
using VocaluxeLib.Game;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
using VocaluxeLib.Songs;
|
using VocaluxeLib.Songs;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
|
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
@@ -578,7 +579,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
|
|
||||||
private void _SetTeamNames()
|
private void _SetTeamNames()
|
||||||
{
|
{
|
||||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
|
|
||||||
if (profiles == null)
|
if (profiles == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
|
|
||||||
namespace VocaluxeLib.PartyModes.ChallengeMedley
|
namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||||
{
|
{
|
||||||
@@ -379,7 +380,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
||||||
{
|
{
|
||||||
_Texts[_TextNextPlayerMessage].Visible = true;
|
_Texts[_TextNextPlayerMessage].Visible = true;
|
||||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||||
{
|
{
|
||||||
int pid = _GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i];
|
int pid = _GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i];
|
||||||
@@ -491,7 +492,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
|
|
||||||
private void _UpdateRoundsTable()
|
private void _UpdateRoundsTable()
|
||||||
{
|
{
|
||||||
SProfile[] profile = CBase.Profiles.GetProfiles();
|
CProfile[] profile = CBase.Profiles.GetProfiles();
|
||||||
for (int i = 0; i < _RoundsTable.Count; i++)
|
for (int i = 0; i < _RoundsTable.Count; i++)
|
||||||
{
|
{
|
||||||
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
||||||
@@ -585,7 +586,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
|
|
||||||
private void _UpdatePlayerTable()
|
private void _UpdatePlayerTable()
|
||||||
{
|
{
|
||||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
|
|
||||||
for (int i = 0; i < _PlayerTable.Count; i++)
|
for (int i = 0; i < _PlayerTable.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -657,7 +658,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
private string _GetPlayerWinString()
|
private string _GetPlayerWinString()
|
||||||
{
|
{
|
||||||
string s = "";
|
string s = "";
|
||||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
|
|
||||||
for (int i = 0; i < _GameState.ResultTable.Count; i++)
|
for (int i = 0; i < _GameState.ResultTable.Count; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
|
|
||||||
[assembly: ComVisible(false)]
|
[assembly: ComVisible(false)]
|
||||||
|
|
||||||
@@ -725,7 +726,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
if (players.Length < 2)
|
if (players.Length < 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
CRound r = _GameData.Rounds[roundNr];
|
CRound r = _GameData.Rounds[roundNr];
|
||||||
bool isDuet = CBase.Songs.GetSongByID(r.SongID).IsDuet;
|
bool isDuet = CBase.Songs.GetSongByID(r.SongID).IsDuet;
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ using System.Collections.Generic;
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
using VocaluxeLib.Songs;
|
using VocaluxeLib.Songs;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
|
|
||||||
namespace VocaluxeLib.PartyModes.TicTacToe
|
namespace VocaluxeLib.PartyModes.TicTacToe
|
||||||
{
|
{
|
||||||
@@ -513,7 +514,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
_Texts[_TextNextPlayerT2].Visible = true;
|
_Texts[_TextNextPlayerT2].Visible = true;
|
||||||
_Texts[_TextNextPlayerNameT1].Visible = true;
|
_Texts[_TextNextPlayerNameT1].Visible = true;
|
||||||
_Texts[_TextNextPlayerNameT2].Visible = true;
|
_Texts[_TextNextPlayerNameT2].Visible = true;
|
||||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
_Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName;
|
_Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName;
|
||||||
_Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName;
|
_Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName;
|
||||||
_Statics[_StaticAvatarT1].Visible = true;
|
_Statics[_StaticAvatarT1].Visible = true;
|
||||||
@@ -552,7 +553,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
_Texts[_TextNextPlayerT2].Visible = true;
|
_Texts[_TextNextPlayerT2].Visible = true;
|
||||||
_Texts[_TextNextPlayerNameT1].Visible = true;
|
_Texts[_TextNextPlayerNameT1].Visible = true;
|
||||||
_Texts[_TextNextPlayerNameT2].Visible = true;
|
_Texts[_TextNextPlayerNameT2].Visible = true;
|
||||||
SProfile[] profiles = CBase.Profiles.GetProfiles();
|
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||||
_Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName;
|
_Texts[_TextNextPlayerNameT1].Text = profiles[_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]].PlayerName;
|
||||||
_Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName;
|
_Texts[_TextNextPlayerNameT2].Text = profiles[_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]].PlayerName;
|
||||||
_Statics[_StaticAvatarT1].Visible = true;
|
_Statics[_StaticAvatarT1].Visible = true;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ using VocaluxeLib.Game;
|
|||||||
using VocaluxeLib.Menu;
|
using VocaluxeLib.Menu;
|
||||||
using VocaluxeLib.Menu.SongMenu;
|
using VocaluxeLib.Menu.SongMenu;
|
||||||
using VocaluxeLib.Songs;
|
using VocaluxeLib.Songs;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
|
|
||||||
namespace Vocaluxe.Base
|
namespace Vocaluxe.Base
|
||||||
{
|
{
|
||||||
@@ -541,7 +542,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
class CBprofiles : IProfiles
|
class CBprofiles : IProfiles
|
||||||
{
|
{
|
||||||
public SProfile[] GetProfiles()
|
public CProfile[] GetProfiles()
|
||||||
{
|
{
|
||||||
return CProfiles.Profiles;
|
return CProfiles.Profiles;
|
||||||
}
|
}
|
||||||
|
|||||||
+38
-37
@@ -24,16 +24,17 @@ using System.Text;
|
|||||||
using System.Xml;
|
using System.Xml;
|
||||||
using VocaluxeLib;
|
using VocaluxeLib;
|
||||||
using VocaluxeLib.Game;
|
using VocaluxeLib.Game;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
|
|
||||||
namespace Vocaluxe.Base
|
namespace Vocaluxe.Base
|
||||||
{
|
{
|
||||||
static class CProfiles
|
static class CProfiles
|
||||||
{
|
{
|
||||||
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
private static readonly XmlWriterSettings _Settings = new XmlWriterSettings();
|
||||||
private static List<SProfile> _Profiles;
|
private static List<CProfile> _Profiles;
|
||||||
private static readonly List<SAvatar> _Avatars = new List<SAvatar>();
|
private static readonly List<CAvatar> _Avatars = new List<CAvatar>();
|
||||||
|
|
||||||
public static SProfile[] Profiles
|
public static CProfile[] Profiles
|
||||||
{
|
{
|
||||||
get { return _Profiles.ToArray(); }
|
get { return _Profiles.ToArray(); }
|
||||||
}
|
}
|
||||||
@@ -43,7 +44,7 @@ namespace Vocaluxe.Base
|
|||||||
get { return _Profiles.Count; }
|
get { return _Profiles.Count; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SAvatar[] Avatars
|
public static CAvatar[] Avatars
|
||||||
{
|
{
|
||||||
get { return _Avatars.ToArray(); }
|
get { return _Avatars.ToArray(); }
|
||||||
}
|
}
|
||||||
@@ -65,7 +66,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static string GetPlayerName(int profileID, int playerNum = 0)
|
public static string GetPlayerName(int profileID, int playerNum = 0)
|
||||||
{
|
{
|
||||||
if (IsProfileIDValid(profileID))
|
if (ICProfileIDValid(profileID))
|
||||||
return _Profiles[profileID].PlayerName;
|
return _Profiles[profileID].PlayerName;
|
||||||
string playerName = CLanguage.Translate("TR_SCREENNAMES_PLAYER");
|
string playerName = CLanguage.Translate("TR_SCREENNAMES_PLAYER");
|
||||||
if (playerNum > 0)
|
if (playerNum > 0)
|
||||||
@@ -75,11 +76,11 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static int NewProfile(string fileName = "")
|
public static int NewProfile(string fileName = "")
|
||||||
{
|
{
|
||||||
SProfile profile = new SProfile
|
CProfile profile = new CProfile
|
||||||
{
|
{
|
||||||
PlayerName = String.Empty,
|
PlayerName = String.Empty,
|
||||||
Difficulty = EGameDifficulty.TR_CONFIG_EASY,
|
Difficulty = EGameDifficulty.TR_CONFIG_EASY,
|
||||||
Avatar = new SAvatar(-1),
|
Avatar = new CAvatar(-1),
|
||||||
GuestProfile = EOffOn.TR_CONFIG_OFF,
|
GuestProfile = EOffOn.TR_CONFIG_OFF,
|
||||||
Active = EOffOn.TR_CONFIG_ON,
|
Active = EOffOn.TR_CONFIG_ON,
|
||||||
ProfileFile = fileName != "" ? Path.Combine(CSettings.FolderProfiles, fileName) : String.Empty
|
ProfileFile = fileName != "" ? Path.Combine(CSettings.FolderProfiles, fileName) : String.Empty
|
||||||
@@ -101,7 +102,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void LoadProfiles()
|
public static void LoadProfiles()
|
||||||
{
|
{
|
||||||
_Profiles = new List<SProfile>();
|
_Profiles = new List<CProfile>();
|
||||||
List<string> files = new List<string>();
|
List<string> files = new List<string>();
|
||||||
files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.xml", true, true));
|
files.AddRange(CHelper.ListFiles(CSettings.FolderProfiles, "*.xml", true, true));
|
||||||
|
|
||||||
@@ -132,7 +133,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
if (tex.Index != -1)
|
if (tex.Index != -1)
|
||||||
{
|
{
|
||||||
SAvatar avatar = new SAvatar {Texture = tex, FileName = Path.GetFileName(file)};
|
CAvatar avatar = new CAvatar(-1) {Texture = tex, FileName = Path.GetFileName(file)};
|
||||||
_Avatars.Add(avatar);
|
_Avatars.Add(avatar);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,10 +141,10 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static string AddGetPlayerName(int profileID, char chr)
|
public static string AddGetPlayerName(int profileID, char chr)
|
||||||
{
|
{
|
||||||
if (!IsProfileIDValid(profileID))
|
if (!ICProfileIDValid(profileID))
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
|
|
||||||
SProfile profile = _Profiles[profileID];
|
CProfile profile = _Profiles[profileID];
|
||||||
profile.PlayerName += chr;
|
profile.PlayerName += chr;
|
||||||
_Profiles[profileID] = profile;
|
_Profiles[profileID] = profile;
|
||||||
|
|
||||||
@@ -152,10 +153,10 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static string GetDeleteCharInPlayerName(int profileID)
|
public static string GetDeleteCharInPlayerName(int profileID)
|
||||||
{
|
{
|
||||||
if (!IsProfileIDValid(profileID))
|
if (!ICProfileIDValid(profileID))
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
|
|
||||||
SProfile profile = _Profiles[profileID];
|
CProfile profile = _Profiles[profileID];
|
||||||
if (profile.PlayerName != "")
|
if (profile.PlayerName != "")
|
||||||
profile.PlayerName = profile.PlayerName.Remove(profile.PlayerName.Length - 1);
|
profile.PlayerName = profile.PlayerName.Remove(profile.PlayerName.Length - 1);
|
||||||
_Profiles[profileID] = profile;
|
_Profiles[profileID] = profile;
|
||||||
@@ -163,58 +164,58 @@ namespace Vocaluxe.Base
|
|||||||
return profile.PlayerName;
|
return profile.PlayerName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsProfileIDValid(int profileID)
|
public static bool ICProfileIDValid(int profileID)
|
||||||
{
|
{
|
||||||
return profileID >= 0 && profileID < _Profiles.Count;
|
return profileID >= 0 && profileID < _Profiles.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EGameDifficulty GetDifficulty(int profileID)
|
public static EGameDifficulty GetDifficulty(int profileID)
|
||||||
{
|
{
|
||||||
return IsProfileIDValid(profileID) ? _Profiles[profileID].Difficulty : EGameDifficulty.TR_CONFIG_NORMAL;
|
return ICProfileIDValid(profileID) ? _Profiles[profileID].Difficulty : EGameDifficulty.TR_CONFIG_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetDifficulty(int profileID, EGameDifficulty difficulty)
|
public static void SetDifficulty(int profileID, EGameDifficulty difficulty)
|
||||||
{
|
{
|
||||||
if (!IsProfileIDValid(profileID))
|
if (!ICProfileIDValid(profileID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SProfile profile = _Profiles[profileID];
|
CProfile profile = _Profiles[profileID];
|
||||||
profile.Difficulty = difficulty;
|
profile.Difficulty = difficulty;
|
||||||
_Profiles[profileID] = profile;
|
_Profiles[profileID] = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EOffOn GetGuestProfile(int profileID)
|
public static EOffOn GetGuestProfile(int profileID)
|
||||||
{
|
{
|
||||||
return IsProfileIDValid(profileID) ? _Profiles[profileID].GuestProfile : EOffOn.TR_CONFIG_OFF;
|
return ICProfileIDValid(profileID) ? _Profiles[profileID].GuestProfile : EOffOn.TR_CONFIG_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EOffOn GetActive(int profileID)
|
public static EOffOn GetActive(int profileID)
|
||||||
{
|
{
|
||||||
return IsProfileIDValid(profileID) ? _Profiles[profileID].Active : EOffOn.TR_CONFIG_OFF;
|
return ICProfileIDValid(profileID) ? _Profiles[profileID].Active : EOffOn.TR_CONFIG_OFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetGuestProfile(int profileID, EOffOn option)
|
public static void SetGuestProfile(int profileID, EOffOn option)
|
||||||
{
|
{
|
||||||
if (!IsProfileIDValid(profileID))
|
if (!ICProfileIDValid(profileID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SProfile profile = _Profiles[profileID];
|
CProfile profile = _Profiles[profileID];
|
||||||
profile.GuestProfile = option;
|
profile.GuestProfile = option;
|
||||||
_Profiles[profileID] = profile;
|
_Profiles[profileID] = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetActive(int profileID, EOffOn option)
|
public static void SetActive(int profileID, EOffOn option)
|
||||||
{
|
{
|
||||||
if (!IsProfileIDValid(profileID))
|
if (!ICProfileIDValid(profileID))
|
||||||
return;
|
return;
|
||||||
SProfile profile = _Profiles[profileID];
|
CProfile profile = _Profiles[profileID];
|
||||||
profile.Active = option;
|
profile.Active = option;
|
||||||
_Profiles[profileID] = profile;
|
_Profiles[profileID] = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsGuestProfile(int profileID)
|
public static bool IsGuestProfile(int profileID)
|
||||||
{
|
{
|
||||||
if (!IsProfileIDValid(profileID))
|
if (!ICProfileIDValid(profileID))
|
||||||
return true; // this will prevent from saving dummy profiles to highscore db
|
return true; // this will prevent from saving dummy profiles to highscore db
|
||||||
|
|
||||||
return _Profiles[profileID].GuestProfile == EOffOn.TR_CONFIG_ON;
|
return _Profiles[profileID].GuestProfile == EOffOn.TR_CONFIG_ON;
|
||||||
@@ -222,24 +223,24 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static bool IsActive(int profileID)
|
public static bool IsActive(int profileID)
|
||||||
{
|
{
|
||||||
if (!IsProfileIDValid(profileID))
|
if (!ICProfileIDValid(profileID))
|
||||||
return false;
|
return false;
|
||||||
return _Profiles[profileID].Active == EOffOn.TR_CONFIG_ON;
|
return _Profiles[profileID].Active == EOffOn.TR_CONFIG_ON;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetAvatar(int profileID, int avatarNr)
|
public static void SetAvatar(int profileID, int avatarNr)
|
||||||
{
|
{
|
||||||
if (!IsProfileIDValid(profileID) || avatarNr < 0 || avatarNr >= _Avatars.Count)
|
if (!ICProfileIDValid(profileID) || avatarNr < 0 || avatarNr >= _Avatars.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SProfile profile = _Profiles[profileID];
|
CProfile profile = _Profiles[profileID];
|
||||||
profile.Avatar = _Avatars[avatarNr];
|
profile.Avatar = _Avatars[avatarNr];
|
||||||
_Profiles[profileID] = profile;
|
_Profiles[profileID] = profile;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int GetAvatarNr(int profileID)
|
public static int GetAvatarNr(int profileID)
|
||||||
{
|
{
|
||||||
if (!IsProfileIDValid(profileID))
|
if (!ICProfileIDValid(profileID))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (int i = 0; i < _Avatars.Count; i++)
|
for (int i = 0; i < _Avatars.Count; i++)
|
||||||
@@ -253,7 +254,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
public static void DeleteProfile(int profileID)
|
public static void DeleteProfile(int profileID)
|
||||||
{
|
{
|
||||||
if (!IsProfileIDValid(profileID))
|
if (!ICProfileIDValid(profileID))
|
||||||
return;
|
return;
|
||||||
if (_Profiles[profileID].ProfileFile == "")
|
if (_Profiles[profileID].ProfileFile == "")
|
||||||
return;
|
return;
|
||||||
@@ -290,25 +291,25 @@ namespace Vocaluxe.Base
|
|||||||
_Profiles.Sort(_CompareByPlayerName);
|
_Profiles.Sort(_CompareByPlayerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int _CompareByPlayerName(SProfile a, SProfile b)
|
private static int _CompareByPlayerName(CProfile a, CProfile b)
|
||||||
{
|
{
|
||||||
return String.CompareOrdinal(a.PlayerName, b.PlayerName);
|
return String.CompareOrdinal(a.PlayerName, b.PlayerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region private methods
|
#region private methods
|
||||||
private static SAvatar _GetAvatar(string fileName)
|
private static CAvatar _GetAvatar(string fileName)
|
||||||
{
|
{
|
||||||
foreach (SAvatar avatar in _Avatars)
|
foreach (CAvatar avatar in _Avatars)
|
||||||
{
|
{
|
||||||
if (fileName == avatar.FileName)
|
if (fileName == avatar.FileName)
|
||||||
return avatar;
|
return avatar;
|
||||||
}
|
}
|
||||||
return new SAvatar(-1);
|
return new CAvatar(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void _SaveProfile(int profileID)
|
private static void _SaveProfile(int profileID)
|
||||||
{
|
{
|
||||||
if (!IsProfileIDValid(profileID))
|
if (!ICProfileIDValid(profileID))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_Profiles[profileID].ProfileFile == "")
|
if (_Profiles[profileID].ProfileFile == "")
|
||||||
@@ -331,7 +332,7 @@ namespace Vocaluxe.Base
|
|||||||
filename += i;
|
filename += i;
|
||||||
}
|
}
|
||||||
|
|
||||||
SProfile profile = _Profiles[profileID];
|
CProfile profile = _Profiles[profileID];
|
||||||
profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, filename + ".xml");
|
profile.ProfileFile = Path.Combine(CSettings.FolderProfiles, filename + ".xml");
|
||||||
_Profiles[profileID] = profile;
|
_Profiles[profileID] = profile;
|
||||||
}
|
}
|
||||||
@@ -372,7 +373,7 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
private static void _LoadProfile(string fileName)
|
private static void _LoadProfile(string fileName)
|
||||||
{
|
{
|
||||||
SProfile profile = new SProfile {ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName)};
|
CProfile profile = new CProfile {ProfileFile = Path.Combine(CSettings.FolderProfiles, fileName)};
|
||||||
|
|
||||||
CXMLReader xmlReader = CXMLReader.OpenFile(profile.ProfileFile);
|
CXMLReader xmlReader = CXMLReader.OpenFile(profile.ProfileFile);
|
||||||
if (xmlReader == null)
|
if (xmlReader == null)
|
||||||
@@ -386,7 +387,7 @@ namespace Vocaluxe.Base
|
|||||||
profile.Difficulty = EGameDifficulty.TR_CONFIG_EASY;
|
profile.Difficulty = EGameDifficulty.TR_CONFIG_EASY;
|
||||||
xmlReader.TryGetEnumValue("//root/Info/Difficulty", ref profile.Difficulty);
|
xmlReader.TryGetEnumValue("//root/Info/Difficulty", ref profile.Difficulty);
|
||||||
|
|
||||||
profile.Avatar = new SAvatar(-1);
|
profile.Avatar = new CAvatar(-1);
|
||||||
if (xmlReader.GetValue("//root/Info/Avatar", out value, value))
|
if (xmlReader.GetValue("//root/Info/Avatar", out value, value))
|
||||||
profile.Avatar = _GetAvatar(value);
|
profile.Avatar = _GetAvatar(value);
|
||||||
|
|
||||||
|
|||||||
@@ -623,7 +623,7 @@ namespace Vocaluxe.Screens
|
|||||||
|
|
||||||
for (int i = 0; i < CSettings.MaxNumPlayer; i++)
|
for (int i = 0; i < CSettings.MaxNumPlayer; i++)
|
||||||
{
|
{
|
||||||
_Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID) ?
|
_Statics[_StaticPlayerAvatar[i]].Texture = CProfiles.ICProfileIDValid(CGame.Players[i].ProfileID) ?
|
||||||
CProfiles.Profiles[CGame.Players[i].ProfileID].Avatar.Texture :
|
CProfiles.Profiles[CGame.Players[i].ProfileID].Avatar.Texture :
|
||||||
_OriginalPlayerAvatarTextures[i];
|
_OriginalPlayerAvatarTextures[i];
|
||||||
_Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID, i + 1);
|
_Texts[_TextPlayer[i]].Text = CProfiles.GetPlayerName(CGame.Players[i].ProfileID, i + 1);
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ namespace Vocaluxe.Screens
|
|||||||
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
|
_Statics[_StaticPointsBarBG[p, CGame.NumPlayer - 1]].Rect.Y -
|
||||||
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
|
_Statics[_StaticPointsBar[p, CGame.NumPlayer - 1]].Rect.H;
|
||||||
}
|
}
|
||||||
if (CProfiles.IsProfileIDValid(players[p].ProfileID))
|
if (CProfiles.ICProfileIDValid(players[p].ProfileID))
|
||||||
_Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[players[p].ProfileID].Avatar.Texture;
|
_Statics[_StaticAvatar[p, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[players[p].ProfileID].Avatar.Texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1383,7 +1383,7 @@ namespace Vocaluxe.Screens
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < CGame.NumPlayer; i++)
|
for (int i = 0; i < CGame.NumPlayer; i++)
|
||||||
{
|
{
|
||||||
if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID))
|
if (CProfiles.ICProfileIDValid(CGame.Players[i].ProfileID))
|
||||||
_Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Players[i].ProfileID].Avatar.Texture;
|
_Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Texture = CProfiles.Profiles[CGame.Players[i].ProfileID].Avatar.Texture;
|
||||||
else
|
else
|
||||||
_Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false;
|
_Statics[_StaticAvatars[i, CGame.NumPlayer - 1]].Visible = false;
|
||||||
@@ -1394,7 +1394,7 @@ namespace Vocaluxe.Screens
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < CGame.NumPlayer; i++)
|
for (int i = 0; i < CGame.NumPlayer; i++)
|
||||||
{
|
{
|
||||||
if (CProfiles.IsProfileIDValid(CGame.Players[i].ProfileID))
|
if (CProfiles.ICProfileIDValid(CGame.Players[i].ProfileID))
|
||||||
_Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Players[i].ProfileID].PlayerName;
|
_Texts[_TextNames[i, CGame.NumPlayer - 1]].Text = CProfiles.Profiles[CGame.Players[i].ProfileID].PlayerName;
|
||||||
else
|
else
|
||||||
_Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false;
|
_Texts[_TextNames[i, CGame.NumPlayer - 1]].Visible = false;
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ using VocaluxeLib;
|
|||||||
using VocaluxeLib.Game;
|
using VocaluxeLib.Game;
|
||||||
using VocaluxeLib.Menu.SongMenu;
|
using VocaluxeLib.Menu.SongMenu;
|
||||||
using VocaluxeLib.PartyModes;
|
using VocaluxeLib.PartyModes;
|
||||||
|
using VocaluxeLib.Profile;
|
||||||
using VocaluxeLib.Songs;
|
using VocaluxeLib.Songs;
|
||||||
|
|
||||||
namespace VocaluxeLib.Menu
|
namespace VocaluxeLib.Menu
|
||||||
@@ -236,7 +237,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
public interface IProfiles
|
public interface IProfiles
|
||||||
{
|
{
|
||||||
SProfile[] GetProfiles();
|
CProfile[] GetProfiles();
|
||||||
EGameDifficulty GetDifficulty(int profileID);
|
EGameDifficulty GetDifficulty(int profileID);
|
||||||
string GetPlayerName(int profileID, int playerNum = 0);
|
string GetPlayerName(int profileID, int playerNum = 0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace VocaluxeLib.Profile
|
||||||
|
{
|
||||||
|
public class CAvatar
|
||||||
|
{
|
||||||
|
public string FileName;
|
||||||
|
public STexture Texture;
|
||||||
|
|
||||||
|
// ReSharper disable UnusedParameter.Local
|
||||||
|
public CAvatar(int dummy)
|
||||||
|
// ReSharper restore UnusedParameter.Local
|
||||||
|
{
|
||||||
|
FileName = String.Empty;
|
||||||
|
Texture = new STexture(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
|
||||||
|
namespace VocaluxeLib.Profile
|
||||||
|
{
|
||||||
|
public class CProfile
|
||||||
|
{
|
||||||
|
public string PlayerName;
|
||||||
|
public string ProfileFile;
|
||||||
|
|
||||||
|
public EGameDifficulty Difficulty;
|
||||||
|
public CAvatar Avatar;
|
||||||
|
public EOffOn GuestProfile;
|
||||||
|
public EOffOn Active;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -211,33 +211,6 @@ namespace VocaluxeLib
|
|||||||
}
|
}
|
||||||
#endregion Inputs
|
#endregion Inputs
|
||||||
|
|
||||||
#region Profiles
|
|
||||||
public struct SProfile
|
|
||||||
{
|
|
||||||
public string PlayerName;
|
|
||||||
public string ProfileFile;
|
|
||||||
|
|
||||||
public EGameDifficulty Difficulty;
|
|
||||||
public SAvatar Avatar;
|
|
||||||
public EOffOn GuestProfile;
|
|
||||||
public EOffOn Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
public struct SAvatar
|
|
||||||
{
|
|
||||||
public string FileName;
|
|
||||||
public STexture Texture;
|
|
||||||
|
|
||||||
// ReSharper disable UnusedParameter.Local
|
|
||||||
public SAvatar(int dummy)
|
|
||||||
// ReSharper restore UnusedParameter.Local
|
|
||||||
{
|
|
||||||
FileName = String.Empty;
|
|
||||||
Texture = new STexture(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion Profiles
|
|
||||||
|
|
||||||
#region Game
|
#region Game
|
||||||
public struct SPlayer
|
public struct SPlayer
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -134,6 +134,8 @@
|
|||||||
<Compile Include="Enums.cs" />
|
<Compile Include="Enums.cs" />
|
||||||
<Compile Include="Menu\IMenu.cs" />
|
<Compile Include="Menu\IMenu.cs" />
|
||||||
<Compile Include="Menu\IMenuElement.cs" />
|
<Compile Include="Menu\IMenuElement.cs" />
|
||||||
|
<Compile Include="Profile\CAvatar.cs" />
|
||||||
|
<Compile Include="Profile\CProfile.cs" />
|
||||||
<Compile Include="Songs\CNotes.cs" />
|
<Compile Include="Songs\CNotes.cs" />
|
||||||
<Compile Include="Menu\SingNotes\CSingNotes.cs" />
|
<Compile Include="Menu\SingNotes\CSingNotes.cs" />
|
||||||
<Compile Include="Menu\SingNotes\CSingNotesClassic.cs" />
|
<Compile Include="Menu\SingNotes\CSingNotesClassic.cs" />
|
||||||
|
|||||||
Reference in new issue
Block a user