added stats table to challenge main screen. there is a problem with guest profiles.

This commit is contained in:
Alexander Eckart committed 2012-12-18 23:50:05 +01:00
1 parent 74f1158d99
commit abc00ebd4a
8 files changed
+358 -7

No files matched your search

@@ -21,5 +21,12 @@
<TR_SCREENNAMES_TITLE>Challenge Modus: Spielerwahl</TR_SCREENNAMES_TITLE>
<!--ScreenMain-->
<TR_SCREENMAIN_TITLE>Challenge Modus: Übersicht</TR_SCREENMAIN_TITLE>
<TR_SCREENMAIN_TABLE_POS>Pos</TR_SCREENMAIN_TABLE_POS>
<TR_SCREENMAIN_TABLE_PLAYERNAME>Name</TR_SCREENMAIN_TABLE_PLAYERNAME>
<TR_SCREENMAIN_TABLE_WON>S</TR_SCREENMAIN_TABLE_WON>
<TR_SCREENMAIN_TABLE_DRAWN>U</TR_SCREENMAIN_TABLE_DRAWN>
<TR_SCREENMAIN_TABLE_LOST>N</TR_SCREENMAIN_TABLE_LOST>
<TR_SCREENMAIN_TABLE_SINGPOINTS>Sing-Punkte</TR_SCREENMAIN_TABLE_SINGPOINTS>
<TR_SCREENMAIN_TABLE_GAMEPOINTS>Punkte</TR_SCREENMAIN_TABLE_GAMEPOINTS>
</Texts>
</root>
@@ -21,5 +21,12 @@
<TR_SCREENNAMES_TITLE>Challenge Mode: Choose Player</TR_SCREENNAMES_TITLE>
<!--ScreenMain-->
<TR_SCREENMAIN_TITLE>Challenge Mode: Overview</TR_SCREENMAIN_TITLE>
<TR_SCREENMAIN_TABLE_POS>Pos</TR_SCREENMAIN_TABLE_POS>
<TR_SCREENMAIN_TABLE_PLAYERNAME>Name</TR_SCREENMAIN_TABLE_PLAYERNAME>
<TR_SCREENMAIN_TABLE_WON>W</TR_SCREENMAIN_TABLE_WON>
<TR_SCREENMAIN_TABLE_DRAWN>D</TR_SCREENMAIN_TABLE_DRAWN>
<TR_SCREENMAIN_TABLE_LOST>L</TR_SCREENMAIN_TABLE_LOST>
<TR_SCREENMAIN_TABLE_SINGPOINTS>Sing Points</TR_SCREENMAIN_TABLE_SINGPOINTS>
<TR_SCREENMAIN_TABLE_GAMEPOINTS>Score</TR_SCREENMAIN_TABLE_GAMEPOINTS>
</Texts>
</root>
@@ -21,5 +21,12 @@
<TR_SCREENNAMES_TITLE>TODO: Challenge Mode: Choose Player</TR_SCREENNAMES_TITLE>
<!--ScreenMain-->
<TR_SCREENMAIN_TITLE>TODO: Challenge Mode: Overview</TR_SCREENMAIN_TITLE>
<TR_SCREENMAIN_TABLE_POS>TODO: Pos</TR_SCREENMAIN_TABLE_POS>
<TR_SCREENMAIN_TABLE_PLAYERNAME>TODO: Name</TR_SCREENMAIN_TABLE_PLAYERNAME>
<TR_SCREENMAIN_TABLE_WON>TODO: W</TR_SCREENMAIN_TABLE_WON>
<TR_SCREENMAIN_TABLE_DRAWN>TODO: D</TR_SCREENMAIN_TABLE_DRAWN>
<TR_SCREENMAIN_TABLE_LOST>TODO: L</TR_SCREENMAIN_TABLE_LOST>
<TR_SCREENMAIN_TABLE_SINGPOINTS>TODO: Sing Points</TR_SCREENMAIN_TABLE_SINGPOINTS>
<TR_SCREENMAIN_TABLE_GAMEPOINTS>TODO: Score</TR_SCREENMAIN_TABLE_GAMEPOINTS>
</Texts>
</root>
@@ -21,5 +21,11 @@
<TR_SCREENNAMES_TITLE>TODO: Challenge Mode: Choose Player</TR_SCREENNAMES_TITLE>
<!--ScreenMain-->
<TR_SCREENMAIN_TITLE>TODO: Challenge Mode: Overview</TR_SCREENMAIN_TITLE>
<TR_SCREENMAIN_TABLE_PLAYERNAME>TODO: Name</TR_SCREENMAIN_TABLE_PLAYERNAME>
<TR_SCREENMAIN_TABLE_WON>TODO: W</TR_SCREENMAIN_TABLE_WON>
<TR_SCREENMAIN_TABLE_DRAWN>TODO: D</TR_SCREENMAIN_TABLE_DRAWN>
<TR_SCREENMAIN_TABLE_LOST>TODO: L</TR_SCREENMAIN_TABLE_LOST>
<TR_SCREENMAIN_TABLE_SINGPOINTS>TODO: Sing Points</TR_SCREENMAIN_TABLE_SINGPOINTS>
<TR_SCREENMAIN_TABLE_GAMEPOINTS>TODO: Score</TR_SCREENMAIN_TABLE_GAMEPOINTS>
</Texts>
</root>
@@ -58,6 +58,209 @@
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</Text1>
<TextPosition>
<!--<X>, <Y>: Text position-->
<X>100</X>
<Y>100</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>37</H>
<!--<MaxW>: Maximum text width (if exists)-->
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Right</Align>
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_SCREENMAIN_TABLE_POS</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</TextPosition>
<TextPlayerName>
<!--<X>, <Y>: Text position-->
<X>110</X>
<Y>100</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>37</H>
<!--<MaxW>: Maximum text width (if exists)-->
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Left</Align>
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_SCREENMAIN_TABLE_PLAYERNAME</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</TextPlayerName>
<TextWon>
<!--<X>, <Y>: Text position-->
<X>400</X>
<Y>100</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>37</H>
<!--<MaxW>: Maximum text width (if exists)-->
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Right</Align>
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_SCREENMAIN_TABLE_WON</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</TextWon>
<TextDrawn>
<!--<X>, <Y>: Text position-->
<X>475</X>
<Y>100</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>37</H>
<!--<MaxW>: Maximum text width (if exists)-->
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Right</Align>
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_SCREENMAIN_TABLE_DRAWN</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</TextDrawn>
<TextLost>
<!--<X>, <Y>: Text position-->
<X>550</X>
<Y>100</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>37</H>
<!--<MaxW>: Maximum text width (if exists)-->
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Right</Align>
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_SCREENMAIN_TABLE_LOST</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</TextLost>
<TextSingPoints>
<!--<X>, <Y>: Text position-->
<X>750</X>
<Y>100</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>37</H>
<!--<MaxW>: Maximum text width (if exists)-->
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Right</Align>
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_SCREENMAIN_TABLE_SINGPOINTS</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</TextSingPoints>
<TextGamePoints>
<!--<X>, <Y>: Text position-->
<X>850</X>
<Y>100</Y>
<!--<Z>: Text position-->
<Z>0,00</Z>
<!--<H>: Text height-->
<H>37</H>
<!--<MaxW>: Maximum text width (if exists)-->
<!--<Color>: Text color from ColorScheme (high priority)-->
<!--or <R>, <G>, <B>, <A> (lower priority)-->
<Color>StaticColor</Color>
<!--<SColor>: Selected Text color from ColorScheme (high priority)-->
<!--or <SR>, <SG>, <SB>, <SA> (lower priority)-->
<SColor>TextSColor</SColor>
<!--<Align>: Text align horizontal: Left, Center, Right-->
<Align>Right</Align>
<!--<HAlign>: Text align vertical (on downsizing): Top, Center, Bottom-->
<HAlign>Center</HAlign>
<!--<Style>: Text style: Normal, Italic, Bold, BoldItalic-->
<Style>Bold</Style>
<!--<Font>: Text font name-->
<Font>Outline</Font>
<!--<Text>: Nothing or translation tag-->
<Text>TR_SCREENMAIN_TABLE_GAMEPOINTS</Text>
<!--<Reflection> If exists:-->
<!-- <Space>: Reflection Space-->
<!-- <Height>: Reflection Height-->
</TextGamePoints>
<ButtonNextRound>
<!--<Skin>: Texture name-->
<Skin>Button</Skin>
+16
View File
@@ -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;
});
}
+105 -1
View File
@@ -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();
}
}
}
}
}
+7 -6
View File
@@ -302,15 +302,19 @@ namespace Vocaluxe.Base
foreach (string screenfile in pm.ScreenFiles)
{
string XmlPath = Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeScreens);
CMenuParty Screen = GetPartyScreenInstance(
Output,
screenfile,
Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeScreens),
pm.PartyModeID);
Path.Combine(Path.Combine(CSettings.sFolderPartyModes, pm.Folder), CSettings.sFolderPartyModeScreens)
);
if (Screen != null)
{
Screen.Initialize(CMain.Base);
Screen.AssingPartyMode(pm.PartyMode);
Screen.SetPartyModeID(pm.PartyModeID);
Screen.LoadTheme(XmlPath);
pm.PartyMode.AddScreen(Screen, screenfile);
}
else
@@ -361,7 +365,7 @@ namespace Vocaluxe.Base
return CompileResult.CompiledAssembly;
}
private static CMenuParty GetPartyScreenInstance(Assembly Assembly, string ScreenName, string XmlPath, int PartyModeID)
private static CMenuParty GetPartyScreenInstance(Assembly Assembly, string ScreenName, string XmlPath)
{
if (Assembly == null)
return null;
@@ -383,9 +387,6 @@ namespace Vocaluxe.Base
CLog.LogError("Error casting PartyScreen: " + ScreenName + "; " + e.Message);
return null;
}
Screen.Initialize(CMain.Base);
Screen.SetPartyModeID(PartyModeID);
Screen.LoadTheme(XmlPath);
return Screen;
}
#endregion private stuff