Use GUID instead of int for player-ids; ID is now unique and saved to player.xml-file
This commit is contained in:
1 parent
804647f480
commit
e3497641dd
29 files changed
+275
-235
No files matched your search
@@ -27,7 +27,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public class CResultTableRow : IComparable
|
||||
{
|
||||
public int Position;
|
||||
public int PlayerID;
|
||||
public Guid PlayerID;
|
||||
public int NumPlayed;
|
||||
public int NumWon;
|
||||
public int NumSingPoints;
|
||||
@@ -116,7 +116,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public int NumJokers;
|
||||
public bool RefillJokers;
|
||||
public int[] Jokers;
|
||||
public List<int> ProfileIDs;
|
||||
public List<Guid> ProfileIDs;
|
||||
|
||||
public CChallengeRounds Rounds;
|
||||
public List<CResultTableRow> ResultTable;
|
||||
@@ -129,7 +129,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private struct SStats
|
||||
{
|
||||
public int ProfileID;
|
||||
public Guid ProfileID;
|
||||
public int SingPoints;
|
||||
public int GamePoints;
|
||||
public int Won;
|
||||
@@ -150,7 +150,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
|
||||
|
||||
GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, NumJokers = 5, RefillJokers = true, CurrentRoundNr = 1, ProfileIDs = new List<int>(), CatSongIndices = null, Results = null};
|
||||
GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, NumJokers = 5, RefillJokers = true, CurrentRoundNr = 1, ProfileIDs = new List<Guid>(), CatSongIndices = null, Results = null};
|
||||
}
|
||||
|
||||
public override bool Init()
|
||||
@@ -358,7 +358,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
if (c != null)
|
||||
players[i].ProfileID = GameData.ProfileIDs[c.Players[i]];
|
||||
else
|
||||
players[i].ProfileID = -1;
|
||||
players[i].ProfileID = Guid.Empty;
|
||||
}
|
||||
|
||||
CBase.Graphics.FadeTo(EScreen.Sing);
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_Texts[_TextNextPlayerMessage].Visible = true;
|
||||
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Players[i]];
|
||||
Guid id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Players[i]];
|
||||
_NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id);
|
||||
_NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
@@ -46,7 +47,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
while (_PartyMode.GameData.ProfileIDs.Count > _NumPlayer)
|
||||
_PartyMode.GameData.ProfileIDs.RemoveAt(_PartyMode.GameData.ProfileIDs.Count - 1);
|
||||
|
||||
List<int>[] ids = new List<int>[] {_PartyMode.GameData.ProfileIDs};
|
||||
List<Guid>[] ids = new List<Guid>[] {_PartyMode.GameData.ProfileIDs};
|
||||
SetPartyModeProfiles(ids);
|
||||
}
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public class CResultTableRow : IComparable
|
||||
{
|
||||
public int Position;
|
||||
public int PlayerID;
|
||||
public Guid PlayerID;
|
||||
public int NumPlayed;
|
||||
public int NumWon;
|
||||
public int NumSingPoints;
|
||||
@@ -135,7 +135,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public int NumPlayer;
|
||||
public int NumPlayerAtOnce;
|
||||
public int NumRounds;
|
||||
public List<int> ProfileIDs;
|
||||
public List<Guid> ProfileIDs;
|
||||
public int NumSongs;
|
||||
public List<int> Songs;
|
||||
|
||||
@@ -154,7 +154,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private struct SStats
|
||||
{
|
||||
public int ProfileID;
|
||||
public Guid ProfileID;
|
||||
public int SingPoints;
|
||||
public int GamePoints;
|
||||
public int Won;
|
||||
@@ -165,7 +165,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
public CPartyModeChallengeMedley(int id) : base(id)
|
||||
{
|
||||
GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, CurrentRoundNr = 1, ProfileIDs = new List<int>(), NumSongs = 5, Songs = new List<int>(), SongSource = ESongSource.TR_ALLSONGS, CatSongIndices = null, Results = null};
|
||||
GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, CurrentRoundNr = 1, ProfileIDs = new List<Guid>(), NumSongs = 5, Songs = new List<int>(), SongSource = ESongSource.TR_ALLSONGS, CatSongIndices = null, Results = null};
|
||||
}
|
||||
|
||||
public override bool Init()
|
||||
@@ -322,7 +322,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
if (c != null)
|
||||
players[i].ProfileID = GameData.ProfileIDs[c.Players[i]];
|
||||
else
|
||||
players[i].ProfileID = -1;
|
||||
players[i].ProfileID = Guid.Empty;
|
||||
}
|
||||
#endregion PlayerNames
|
||||
|
||||
@@ -373,15 +373,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private void _SetTeamNames()
|
||||
{
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
|
||||
if (profiles == null)
|
||||
{
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce)
|
||||
if (CBase.Profiles.GetNum() == 0 || GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || CBase.Profiles.GetNum() < GameData.NumPlayerAtOnce)
|
||||
{
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
|
||||
return;
|
||||
@@ -394,8 +387,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
if (c != null)
|
||||
{
|
||||
if (GameData.ProfileIDs[c.Players[i]] < profiles.Length)
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = profiles[GameData.ProfileIDs[c.Players[i]]].PlayerName;
|
||||
if (CBase.Profiles.IsProfileIDValid(GameData.ProfileIDs[c.Players[i]]))
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(GameData.ProfileIDs[c.Players[i]]);
|
||||
else
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = "foobar";
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_Texts[_TextNextPlayerMessage].Visible = true;
|
||||
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Players[i]];
|
||||
Guid id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Players[i]];
|
||||
_NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id);
|
||||
_NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
@@ -46,7 +47,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
while (_PartyMode.GameData.ProfileIDs.Count > _NumPlayer)
|
||||
_PartyMode.GameData.ProfileIDs.RemoveAt(_PartyMode.GameData.ProfileIDs.Count - 1);
|
||||
|
||||
List<int>[] ids = new List<int>[] {_PartyMode.GameData.ProfileIDs};
|
||||
List<Guid>[] ids = new List<Guid>[] {_PartyMode.GameData.ProfileIDs};
|
||||
SetPartyModeProfiles(ids);
|
||||
}
|
||||
|
||||
|
||||
@@ -110,8 +110,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public int NumPlayerTeam2;
|
||||
public int NumFields;
|
||||
public int Team;
|
||||
public List<int> ProfileIDsTeam1;
|
||||
public List<int> ProfileIDsTeam2;
|
||||
public List<Guid> ProfileIDsTeam1;
|
||||
public List<Guid> ProfileIDsTeam2;
|
||||
public List<int> PlayerTeam1;
|
||||
public List<int> PlayerTeam2;
|
||||
|
||||
@@ -151,8 +151,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
NumPlayerTeam1 = 2,
|
||||
NumPlayerTeam2 = 2,
|
||||
NumFields = 9,
|
||||
ProfileIDsTeam1 = new List<int>(),
|
||||
ProfileIDsTeam2 = new List<int>(),
|
||||
ProfileIDsTeam1 = new List<Guid>(),
|
||||
ProfileIDsTeam2 = new List<Guid>(),
|
||||
PlayerTeam1 = new List<int>(),
|
||||
PlayerTeam2 = new List<int>(),
|
||||
CurrentRoundNr = 0,
|
||||
@@ -475,7 +475,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
//default values
|
||||
players[i].ProfileID = -1;
|
||||
players[i].ProfileID = Guid.Empty;
|
||||
}
|
||||
|
||||
//try to fill with the right data
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
@@ -49,7 +50,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
SetPartyModeData(2, _PartyMode.GameData.NumPlayerTeam1 + _PartyMode.GameData.NumPlayerTeam2,
|
||||
new int[] {_PartyMode.GameData.NumPlayerTeam1, _PartyMode.GameData.NumPlayerTeam2});
|
||||
List<int>[] ids = new List<int>[] {_PartyMode.GameData.ProfileIDsTeam1, _PartyMode.GameData.ProfileIDsTeam2};
|
||||
List<Guid>[] ids = new List<Guid>[] {_PartyMode.GameData.ProfileIDsTeam1, _PartyMode.GameData.ProfileIDsTeam2};
|
||||
SetPartyModeProfiles(ids);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user