Merge branch 'develop' of git://github.com/flokuep/Vocaluxe into develop

This commit is contained in:
Alexander Eckart committed 2012-12-23 12:37:29 +01:00
commit 3a3a4ba1d4
10 files changed
+520 -11

No files matched your search

+145 -9
View File
@@ -29,14 +29,27 @@ namespace Vocaluxe.PartyModes
const string TextWon = "TextWon";
const string TextSingPoints = "TextSingPoints";
const string TextGamePoints = "TextGamePoints";
const string TextNextPlayer = "TextNextPlayer";
const string TextPopupReallyExit = "TextPopupReallyExit";
const string ButtonNextRound = "ButtonNextRound";
const string ButtonBack = "ButtonBack";
const string ButtonExit = "ButtonExit";
const string ButtonPopupYes = "ButtonPopupYes";
const string ButtonPopupNo = "ButtonPopupNo";
const string StaticPopupBG = "StaticPopupBG";
const string StaticNextPlayer = "StaticNextPlayer";
private bool ExitPopupVisible = false;
private DataFromScreen Data;
private DataToScreenMain GameState;
private List<TableRow> Table;
private List<CText> NextPlayerTexts;
private List<CStatic> NextPlayerStatics;
public PartyScreenChallengeMain()
{
Data = new DataFromScreen();
@@ -48,8 +61,9 @@ namespace Vocaluxe.PartyModes
base.Init();
_ThemeName = "PartyScreenChallengeMain";
_ThemeTexts = new string[] { TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints };
_ThemeButtons = new string[] { "ButtonNextRound" };
_ThemeTexts = new string[] { TextPosition, TextPlayerName, TextNumPlayed, TextWon, TextSingPoints, TextGamePoints, TextNextPlayer, TextPopupReallyExit };
_ThemeButtons = new string[] { ButtonNextRound, ButtonBack, ButtonExit, ButtonPopupYes, ButtonPopupNo };
_ThemeStatics = new string[] { StaticPopupBG, StaticNextPlayer };
_ScreenVersion = ScreenVersion;
}
@@ -59,6 +73,17 @@ namespace Vocaluxe.PartyModes
GameState = new DataToScreenMain();
BuildTable();
NextPlayerTexts = new List<CText>();
NextPlayerStatics = new List<CStatic>();
for (int i = 0; i < _PartyMode.GetMaxPlayer(); i++)
{
NextPlayerTexts.Add(GetNewText(Texts[htTexts(TextNextPlayer)]));
AddText(NextPlayerTexts[NextPlayerTexts.Count - 1]);
NextPlayerStatics.Add(GetNewStatic(Statics[htStatics(StaticNextPlayer)]));
AddStatic(NextPlayerStatics[NextPlayerStatics.Count - 1]);
}
}
public override void DataToScreen(object ReceivedData)
@@ -91,12 +116,32 @@ namespace Vocaluxe.PartyModes
{
case Keys.Back:
case Keys.Escape:
EndParty();
if (!ExitPopupVisible)
if (GameState.CurrentRoundNr == 1)
Back();
else
ShowPopup(true);
else
ShowPopup(false);
break;
case Keys.Enter:
if (Buttons[htButtons(ButtonNextRound)].Selected)
NextRound();
if (!ExitPopupVisible)
{
if (Buttons[htButtons(ButtonNextRound)].Selected)
NextRound();
if (Buttons[htButtons(ButtonBack)].Selected && GameState.CurrentRoundNr == 1)
Back();
if (Buttons[htButtons(ButtonExit)].Selected && GameState.CurrentRoundNr > 1)
ShowPopup(true);
}
else
{
if (Buttons[htButtons(ButtonPopupYes)].Selected)
EndParty();
if (Buttons[htButtons(ButtonPopupNo)].Selected)
ShowPopup(false);
}
break;
}
}
@@ -109,13 +154,33 @@ namespace Vocaluxe.PartyModes
if (MouseEvent.LB && IsMouseOver(MouseEvent))
{
if (Buttons[htButtons(ButtonNextRound)].Selected)
NextRound();
if (!ExitPopupVisible)
{
if (Buttons[htButtons(ButtonNextRound)].Selected)
NextRound();
if (Buttons[htButtons(ButtonBack)].Selected && GameState.CurrentRoundNr == 1)
Back();
if (Buttons[htButtons(ButtonExit)].Selected && GameState.CurrentRoundNr > 1)
ShowPopup(true);
}
else
{
if (Buttons[htButtons(ButtonPopupYes)].Selected)
EndParty();
if (Buttons[htButtons(ButtonPopupNo)].Selected)
ShowPopup(false);
}
}
if (MouseEvent.RB)
{
EndParty();
if (!ExitPopupVisible)
if (GameState.CurrentRoundNr == 1)
Back();
else
ShowPopup(true);
else
ShowPopup(false);
}
return true;
@@ -126,6 +191,21 @@ namespace Vocaluxe.PartyModes
base.OnShow();
Updatetable();
UpdateNextPlayerPositions();
UpdateNextPlayerContents();
if (GameState.CurrentRoundNr == 1)
{
Buttons[htButtons(ButtonBack)].Visible = true;
Buttons[htButtons(ButtonExit)].Visible = false;
}
else
{
Buttons[htButtons(ButtonBack)].Visible = false;
Buttons[htButtons(ButtonExit)].Visible = true;
}
ShowPopup(false);
}
public override bool UpdateGame()
@@ -152,7 +232,63 @@ namespace Vocaluxe.PartyModes
private void EndParty()
{
//TODO
FadeTo(EScreens.ScreenParty);
}
private void ShowPopup(bool Visible)
{
ExitPopupVisible = Visible;
Statics[htStatics(StaticPopupBG)].Visible = ExitPopupVisible;
Texts[htTexts(TextPopupReallyExit)].Visible = ExitPopupVisible;
Buttons[htButtons(ButtonPopupYes)].Visible = ExitPopupVisible;
Buttons[htButtons(ButtonPopupNo)].Visible = ExitPopupVisible;
SetInteractionToButton(Buttons[htButtons(ButtonPopupNo)]);
}
private void Back()
{
Data.ScreenMain.FadeToNameSelection = true;
Data.ScreenMain.FadeToSongSelection = false;
_PartyMode.DataFromScreen(_ThemeName, Data);
}
private void UpdateNextPlayerPositions()
{
float x = _Base.Settings.GetRenderW()/2 - ((GameState.NumPlayerAtOnce * Statics[htStatics(StaticNextPlayer)].Rect.W) + ((GameState.NumPlayerAtOnce-1) * 15))/2;
float static_y = 590;
float text_y = 550;
for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
{
//static
NextPlayerStatics[i].Rect.X = x;
NextPlayerStatics[i].Rect.Y = static_y;
NextPlayerStatics[i].Visible = true;
//text
NextPlayerTexts[i].X = x + Statics[htStatics(StaticNextPlayer)].Rect.W / 2;
NextPlayerTexts[i].Y = text_y;
NextPlayerTexts[i].Visible = true;
x += Statics[htStatics(StaticNextPlayer)].Rect.W + 15;
}
for (int i = GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
{
NextPlayerStatics[i].Visible = false;
NextPlayerTexts[i].Visible = false;
}
}
private void UpdateNextPlayerContents()
{
SProfile[] profiles = _Base.Profiles.GetProfiles();
for (int i = 0; i < GameState.NumPlayerAtOnce; i++)
{
int pid = GameState.Combs[GameState.CurrentRoundNr - 1].Player[i];
NextPlayerStatics[i].Texture = profiles[GameState.ProfileIDs[pid]].Avatar.Texture;
NextPlayerTexts[i].Text = profiles[GameState.ProfileIDs[pid]].PlayerName;
NextPlayerTexts[i].Color = _Base.Theme.GetPlayerColor((i+1));
}
}
private void BuildTable()