added stats table to challenge main screen. there is a problem with guest profiles.
This commit is contained in:
1 parent
74f1158d99
commit
abc00ebd4a
8 files changed
+358
-7
No files matched your search
@@ -24,6 +24,7 @@ namespace Vocaluxe.PartyModes
|
||||
public struct DataToScreenMain
|
||||
{
|
||||
public int CurrentRoundNr;
|
||||
public int NumPlayerAtOnce;
|
||||
public List<Combination> Combs;
|
||||
public List<ResultTableRow> ResultTable;
|
||||
}
|
||||
@@ -262,8 +263,10 @@ namespace Vocaluxe.PartyModes
|
||||
GameData.Rounds = new ChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce);
|
||||
GameData.CurrentRoundNr = 1;
|
||||
ToScreenMain.CurrentRoundNr = 1;
|
||||
ToScreenMain.NumPlayerAtOnce = GameData.NumPlayerAtOnce;
|
||||
ToScreenMain.Combs = GameData.Rounds.Rounds;
|
||||
UpdateScores();
|
||||
ToScreenMain.ResultTable = GameData.ResultTable;
|
||||
Screen.DataToScreen(ToScreenMain);
|
||||
}
|
||||
break;
|
||||
@@ -533,6 +536,19 @@ namespace Vocaluxe.PartyModes
|
||||
}
|
||||
}
|
||||
|
||||
GameData.ResultTable.Sort(delegate(ResultTableRow s1, ResultTableRow s2)
|
||||
{
|
||||
int res = s1.NumGamePoints.CompareTo(s2.NumGamePoints);
|
||||
if (res == 0)
|
||||
{
|
||||
res = s1.SumSingPoints.CompareTo(s2.NumGamePoints);
|
||||
if (res == 0)
|
||||
{
|
||||
res = s1.NumWon.CompareTo(s2.NumWon);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -7,14 +7,37 @@ using Vocaluxe.Menu;
|
||||
|
||||
namespace Vocaluxe.PartyModes
|
||||
{
|
||||
struct TableRow
|
||||
{
|
||||
public CText Pos;
|
||||
public CText Name;
|
||||
public CText Won;
|
||||
public CText Drawn;
|
||||
public CText Lost;
|
||||
public CText SingPoints;
|
||||
public CText GamePoints;
|
||||
}
|
||||
|
||||
|
||||
public class PartyScreenChallengeMain : CMenuParty
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
const int ScreenVersion = 1;
|
||||
|
||||
const string TextPosition = "TextPosition";
|
||||
const string TextPlayerName = "TextPlayerName";
|
||||
const string TextWon = "TextWon";
|
||||
const string TextDrawn = "TextDrawn";
|
||||
const string TextLost = "TextLost";
|
||||
const string TextSingPoints = "TextSingPoints";
|
||||
const string TextGamePoints = "TextGamePoints";
|
||||
|
||||
const string ButtonNextRound = "ButtonNextRound";
|
||||
|
||||
|
||||
private DataFromScreen Data;
|
||||
private DataToScreenMain GameState;
|
||||
private List<TableRow> Table;
|
||||
|
||||
public PartyScreenChallengeMain()
|
||||
{
|
||||
@@ -27,6 +50,7 @@ namespace Vocaluxe.PartyModes
|
||||
base.Init();
|
||||
|
||||
_ThemeName = "PartyScreenChallengeMain";
|
||||
_ThemeTexts = new string[] { TextPosition, TextPlayerName, TextWon, TextDrawn, TextLost, TextSingPoints, TextGamePoints };
|
||||
_ThemeButtons = new string[] { "ButtonNextRound" };
|
||||
_ScreenVersion = ScreenVersion;
|
||||
}
|
||||
@@ -34,6 +58,9 @@ namespace Vocaluxe.PartyModes
|
||||
public override void LoadTheme(string XmlPath)
|
||||
{
|
||||
base.LoadTheme(XmlPath);
|
||||
|
||||
GameState = new DataToScreenMain();
|
||||
BuildTable();
|
||||
}
|
||||
|
||||
public override void DataToScreen(object ReceivedData)
|
||||
@@ -43,7 +70,7 @@ namespace Vocaluxe.PartyModes
|
||||
try
|
||||
{
|
||||
data = (DataToScreenMain)ReceivedData;
|
||||
|
||||
GameState = data;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -99,6 +126,8 @@ namespace Vocaluxe.PartyModes
|
||||
public override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
|
||||
Updatetable();
|
||||
}
|
||||
|
||||
public override bool UpdateGame()
|
||||
@@ -127,5 +156,80 @@ namespace Vocaluxe.PartyModes
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
private void BuildTable()
|
||||
{
|
||||
Table = new List<TableRow>();
|
||||
float delta = Texts[htTexts(TextPosition)].Height * 1.2f;
|
||||
|
||||
for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
|
||||
{
|
||||
TableRow row = new TableRow();
|
||||
|
||||
row.Pos = GetNewText(Texts[htTexts(TextPosition)]);
|
||||
row.Name = GetNewText(Texts[htTexts(TextPlayerName)]);
|
||||
row.Won = GetNewText(Texts[htTexts(TextWon)]);
|
||||
row.Drawn = GetNewText(Texts[htTexts(TextDrawn)]);
|
||||
row.Lost = GetNewText(Texts[htTexts(TextLost)]);
|
||||
row.SingPoints = GetNewText(Texts[htTexts(TextSingPoints)]);
|
||||
row.GamePoints = GetNewText(Texts[htTexts(TextGamePoints)]);
|
||||
|
||||
row.Pos.Y += delta * (i + 1);
|
||||
row.Name.Y += delta * (i + 1);
|
||||
row.Won.Y += delta * (i + 1);
|
||||
row.Drawn.Y += delta * (i + 1);
|
||||
row.Lost.Y += delta * (i + 1);
|
||||
row.SingPoints.Y += delta * (i + 1);
|
||||
row.GamePoints.Y += delta * (i + 1);
|
||||
|
||||
row.Pos.Text = (i + 1).ToString() + ")";
|
||||
|
||||
row.Pos.Visible = false;
|
||||
row.Name.Visible = false;
|
||||
row.Won.Visible = false;
|
||||
row.Drawn.Visible = false;
|
||||
row.Lost.Visible = false;
|
||||
row.SingPoints.Visible = false;
|
||||
row.GamePoints.Visible = false;
|
||||
|
||||
AddText(row.Pos);
|
||||
AddText(row.Name);
|
||||
AddText(row.Won);
|
||||
AddText(row.Drawn);
|
||||
AddText(row.Lost);
|
||||
AddText(row.SingPoints);
|
||||
AddText(row.GamePoints);
|
||||
|
||||
Table.Add(row);
|
||||
}
|
||||
}
|
||||
|
||||
private void Updatetable()
|
||||
{
|
||||
SProfile[] profiles = _Base.Profiles.GetProfiles();
|
||||
|
||||
for (int i = 0; i < Table.Count; i++)
|
||||
{
|
||||
if (i < GameState.ResultTable.Count)
|
||||
{
|
||||
TableRow row = Table[i];
|
||||
|
||||
row.Pos.Visible = true;
|
||||
row.Name.Visible = true;
|
||||
row.Won.Visible = true;
|
||||
row.Drawn.Visible = true;
|
||||
row.Lost.Visible = true;
|
||||
row.SingPoints.Visible = true;
|
||||
row.GamePoints.Visible = true;
|
||||
|
||||
row.Name.Text = profiles[GameState.ResultTable[i].PlayerID].PlayerName;
|
||||
row.Won.Text = GameState.ResultTable[i].NumWon.ToString();
|
||||
row.Drawn.Text = GameState.ResultTable[i].NumDrawn.ToString();
|
||||
row.Lost.Text = GameState.ResultTable[i].NumLost.ToString();
|
||||
row.SingPoints.Text = GameState.ResultTable[i].SumSingPoints.ToString();
|
||||
row.GamePoints.Text = GameState.ResultTable[i].NumGamePoints.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user