Merge branch 'challenge' of github.com:Vocaluxe/Vocaluxe into challenge

This commit is contained in:
Florian Kuepper committed 2012-12-17 19:01:23 +01:00
commit 22c59479ad
4 files changed
+132 -62

No files matched your search

@@ -58,7 +58,7 @@ namespace Vocaluxe.PartyModes
public sealed class PartyModeChallenge : CPartyMode public sealed class PartyModeChallenge : CPartyMode
{ {
private const int MaxPlayer = 10; private const int MaxPlayer = 12;
private const int MinPlayer = 1; private const int MinPlayer = 1;
private const int MaxTeams = 0; private const int MaxTeams = 0;
private const int MinTeams = 0; private const int MinTeams = 0;
@@ -111,6 +111,7 @@ namespace Vocaluxe.PartyModes
GameData.NumPlayerAtOnce = 2; GameData.NumPlayerAtOnce = 2;
GameData.NumRounds = 2; GameData.NumRounds = 2;
GameData.CurrentRoundNr = 1; GameData.CurrentRoundNr = 1;
GameData.ProfileIDs = new List<int>();
} }
public override bool Init() public override bool Init()
@@ -182,18 +183,35 @@ namespace Vocaluxe.PartyModes
{ {
case EStage.NotStarted: case EStage.NotStarted:
_Screens.TryGetValue("PartyScreenChallengeConfig", out Screen); _Screens.TryGetValue("PartyScreenChallengeConfig", out Screen);
if (_Screens != null)
{
ToScreenConfig.NumPlayer = GameData.NumPlayer;
ToScreenConfig.NumPlayerAtOnce = GameData.NumPlayerAtOnce;
ToScreenConfig.NumRounds = GameData.NumRounds;
Screen.DataToScreen(ToScreenConfig);
}
break; break;
case EStage.Config: case EStage.Config:
_Screens.TryGetValue("PartyScreenChallengeNames", out Screen); _Screens.TryGetValue("PartyScreenChallengeNames", out Screen);
if (_Screens != null)
{
ToScreenNames.NumPlayer = GameData.NumPlayer;
ToScreenNames.ProfileIDs = GameData.ProfileIDs;
Screen.DataToScreen(ToScreenNames);
}
break; break;
case EStage.Names: case EStage.Names:
_Screens.TryGetValue("PartyScreenChallengeMain", out Screen); _Screens.TryGetValue("PartyScreenChallengeMain", out Screen);
if (_Screens != null)
Screen.DataToScreen(ToScreenMain);
break; break;
case EStage.Main: case EStage.Main:
AlternativeScreen = EScreens.ScreenSong; AlternativeScreen = EScreens.ScreenSong;
break; break;
case EStage.Singing: case EStage.Singing:
_Screens.TryGetValue("PartyScreenChallengeMain", out Screen); _Screens.TryGetValue("PartyScreenChallengeMain", out Screen);
if (_Screens != null)
Screen.DataToScreen(ToScreenMain);
break; break;
default: default:
break; break;
@@ -43,10 +43,8 @@ namespace Vocaluxe.PartyModes
private int SelectedPlayerNr = -1; private int SelectedPlayerNr = -1;
//TODO: Get this data from party-mode! //TODO: Get this data from party-mode!
private int NumPlayers = 5; private int NumPlayer = 4;
private List<int> ProfileIDs;
private DataFromScreen Data; private DataFromScreen Data;
private class CPlayerChooseButton private class CPlayerChooseButton
@@ -68,7 +66,7 @@ namespace Vocaluxe.PartyModes
PlayerChooseButtonsVisibleProfiles = new List<int>(); PlayerChooseButtonsVisibleProfiles = new List<int>();
ProfileIDs = new List<int>(); Data.ScreenNames.ProfileIDs = new List<int>();
_ThemeName = "PartyScreenChallengeNames"; _ThemeName = "PartyScreenChallengeNames";
List<string> buttons = new List<string>(); List<string> buttons = new List<string>();
@@ -86,8 +84,26 @@ namespace Vocaluxe.PartyModes
public override void LoadTheme(string XmlPath) public override void LoadTheme(string XmlPath)
{ {
base.LoadTheme(XmlPath); base.LoadTheme(XmlPath);
AddButtonPlayerDestination(); }
AddButtonPlayerChoose();
public override void DataToScreen(object ReceivedData)
{
DataToScreenNames config = new DataToScreenNames();
try
{
config = (DataToScreenNames)ReceivedData;
Data.ScreenNames.ProfileIDs = config.ProfileIDs;
if (Data.ScreenNames.ProfileIDs == null)
Data.ScreenNames.ProfileIDs = new List<int>();
NumPlayer = config.NumPlayer;
}
catch (Exception e)
{
_Base.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
}
} }
public override bool HandleInput(KeyEvent KeyEvent) public override bool HandleInput(KeyEvent KeyEvent)
@@ -184,14 +200,14 @@ namespace Vocaluxe.PartyModes
{ {
int added = -1; int added = -1;
//Add Player-ID to list. //Add Player-ID to list.
if (ProfileIDs.Count < (i + 1)) if (Data.ScreenNames.ProfileIDs.Count < (i + 1))
{ {
ProfileIDs.Add(SelectedPlayerNr); Data.ScreenNames.ProfileIDs.Add(SelectedPlayerNr);
added = ProfileIDs.Count - 1; added = Data.ScreenNames.ProfileIDs.Count - 1;
} }
else if (ProfileIDs.Count >= (i + 1)) else if (Data.ScreenNames.ProfileIDs.Count >= (i + 1))
{ {
ProfileIDs[i] = SelectedPlayerNr; Data.ScreenNames.ProfileIDs[i] = SelectedPlayerNr;
added = i; added = i;
} }
UpdateButtonNext(); UpdateButtonNext();
@@ -236,6 +252,9 @@ namespace Vocaluxe.PartyModes
{ {
base.OnShow(); base.OnShow();
AddButtonPlayerDestination();
AddButtonPlayerChoose();
UpdateButtonPlayerDestination(); UpdateButtonPlayerDestination();
UpdateButtonPlayerChoose(); UpdateButtonPlayerChoose();
@@ -369,10 +388,10 @@ namespace Vocaluxe.PartyModes
{ {
visible = true; visible = true;
} }
for (int p = 0; p < ProfileIDs.Count; p++) for (int p = 0; p < Data.ScreenNames.ProfileIDs.Count; p++)
{ {
//Don't show profile if is selected, but if selected and guest //Don't show profile if is selected, but if selected and guest
if (ProfileIDs[p] == i && _Base.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF) if (Data.ScreenNames.ProfileIDs[p] == i && _Base.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF)
{ {
visible = false; visible = false;
} }
@@ -388,7 +407,7 @@ namespace Vocaluxe.PartyModes
{ {
for (int i = 0; i < PlayerDestinationButtons.Count; i++) for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{ {
if (NumPlayers > i) if (NumPlayer > i)
{ {
PlayerDestinationButtons[i].Visible = true; PlayerDestinationButtons[i].Visible = true;
PlayerDestinationButtons[i].Enabled = true; PlayerDestinationButtons[i].Enabled = true;
@@ -399,17 +418,17 @@ namespace Vocaluxe.PartyModes
PlayerDestinationButtons[i].Enabled = false; PlayerDestinationButtons[i].Enabled = false;
} }
} }
for (int i = 0; i < NumPlayers; i++) for (int i = 0; i < NumPlayer; i++)
{ {
if (i < ProfileIDs.Count) if (i < Data.ScreenNames.ProfileIDs.Count)
{ {
if (ProfileIDs[i] != -1) if (Data.ScreenNames.ProfileIDs[i] != -1)
{ {
PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f); PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1); PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1);
PlayerDestinationButtons[i].Texture = _Base.Profiles.GetProfiles()[ProfileIDs[i]].Avatar.Texture; PlayerDestinationButtons[i].Texture = _Base.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
PlayerDestinationButtons[i].STexture = _Base.Profiles.GetProfiles()[ProfileIDs[i]].Avatar.Texture; PlayerDestinationButtons[i].STexture = _Base.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
PlayerDestinationButtons[i].Text.Text = _Base.Profiles.GetProfiles()[ProfileIDs[i]].PlayerName; PlayerDestinationButtons[i].Text.Text = _Base.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].PlayerName;
PlayerDestinationButtons[i].Enabled = true; PlayerDestinationButtons[i].Enabled = true;
} }
} }
@@ -427,7 +446,7 @@ namespace Vocaluxe.PartyModes
private void UpdateButtonNext() private void UpdateButtonNext()
{ {
if (ProfileIDs.Count == NumPlayers) if (Data.ScreenNames.ProfileIDs.Count == NumPlayer)
Buttons[htButtons(ButtonNext)].Visible = true; Buttons[htButtons(ButtonNext)].Visible = true;
else else
Buttons[htButtons(ButtonNext)].Visible = false; Buttons[htButtons(ButtonNext)].Visible = false;
@@ -439,10 +458,10 @@ namespace Vocaluxe.PartyModes
{ {
if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1) if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1)
{ {
if (ProfileIDs.Count < NumPlayers) if (Data.ScreenNames.ProfileIDs.Count < NumPlayer)
{ {
ProfileIDs.Add(PlayerChooseButtons[i].ProfileID); Data.ScreenNames.ProfileIDs.Add(PlayerChooseButtons[i].ProfileID);
int added = ProfileIDs.Count - 1; int added = Data.ScreenNames.ProfileIDs.Count - 1;
UpdateButtonNext(); UpdateButtonNext();
//Update texture and name //Update texture and name
PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
@@ -458,15 +477,16 @@ namespace Vocaluxe.PartyModes
} }
} }
} }
private void OnRemove() private void OnRemove()
{ {
for (int i = 0; i < PlayerDestinationButtons.Count; i++) for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{ {
if (PlayerDestinationButtons[i].Selected) if (PlayerDestinationButtons[i].Selected)
{ {
if ((i + 1) <= ProfileIDs.Count) if ((i + 1) <= Data.ScreenNames.ProfileIDs.Count)
{ {
ProfileIDs.RemoveAt(i); Data.ScreenNames.ProfileIDs.RemoveAt(i);
UpdateButtonNext(); UpdateButtonNext();
UpdateButtonPlayerDestination(); UpdateButtonPlayerDestination();
UpdateButtonPlayerChoose(); UpdateButtonPlayerChoose();
@@ -485,9 +505,6 @@ namespace Vocaluxe.PartyModes
private void Next() private void Next()
{ {
List<int> list = new List<int>();
list.AddRange(ProfileIDs);
Data.ScreenNames.ProfileIDs = list;
Data.ScreenNames.FadeToConfig = false; Data.ScreenNames.FadeToConfig = false;
Data.ScreenNames.FadeToMain = true; Data.ScreenNames.FadeToMain = true;
_PartyMode.DataFromScreen(_ThemeName, Data); _PartyMode.DataFromScreen(_ThemeName, Data);
+19 -1
View File
@@ -58,7 +58,7 @@ namespace Vocaluxe.PartyModes
public sealed class PartyModeChallenge : CPartyMode public sealed class PartyModeChallenge : CPartyMode
{ {
private const int MaxPlayer = 10; private const int MaxPlayer = 12;
private const int MinPlayer = 1; private const int MinPlayer = 1;
private const int MaxTeams = 0; private const int MaxTeams = 0;
private const int MinTeams = 0; private const int MinTeams = 0;
@@ -111,6 +111,7 @@ namespace Vocaluxe.PartyModes
GameData.NumPlayerAtOnce = 2; GameData.NumPlayerAtOnce = 2;
GameData.NumRounds = 2; GameData.NumRounds = 2;
GameData.CurrentRoundNr = 1; GameData.CurrentRoundNr = 1;
GameData.ProfileIDs = new List<int>();
} }
public override bool Init() public override bool Init()
@@ -182,18 +183,35 @@ namespace Vocaluxe.PartyModes
{ {
case EStage.NotStarted: case EStage.NotStarted:
_Screens.TryGetValue("PartyScreenChallengeConfig", out Screen); _Screens.TryGetValue("PartyScreenChallengeConfig", out Screen);
if (_Screens != null)
{
ToScreenConfig.NumPlayer = GameData.NumPlayer;
ToScreenConfig.NumPlayerAtOnce = GameData.NumPlayerAtOnce;
ToScreenConfig.NumRounds = GameData.NumRounds;
Screen.DataToScreen(ToScreenConfig);
}
break; break;
case EStage.Config: case EStage.Config:
_Screens.TryGetValue("PartyScreenChallengeNames", out Screen); _Screens.TryGetValue("PartyScreenChallengeNames", out Screen);
if (_Screens != null)
{
ToScreenNames.NumPlayer = GameData.NumPlayer;
ToScreenNames.ProfileIDs = GameData.ProfileIDs;
Screen.DataToScreen(ToScreenNames);
}
break; break;
case EStage.Names: case EStage.Names:
_Screens.TryGetValue("PartyScreenChallengeMain", out Screen); _Screens.TryGetValue("PartyScreenChallengeMain", out Screen);
if (_Screens != null)
Screen.DataToScreen(ToScreenMain);
break; break;
case EStage.Main: case EStage.Main:
AlternativeScreen = EScreens.ScreenSong; AlternativeScreen = EScreens.ScreenSong;
break; break;
case EStage.Singing: case EStage.Singing:
_Screens.TryGetValue("PartyScreenChallengeMain", out Screen); _Screens.TryGetValue("PartyScreenChallengeMain", out Screen);
if (_Screens != null)
Screen.DataToScreen(ToScreenMain);
break; break;
default: default:
break; break;
+47 -30
View File
@@ -43,10 +43,8 @@ namespace Vocaluxe.PartyModes
private int SelectedPlayerNr = -1; private int SelectedPlayerNr = -1;
//TODO: Get this data from party-mode! //TODO: Get this data from party-mode!
private int NumPlayers = 5; private int NumPlayer = 4;
private List<int> ProfileIDs;
private DataFromScreen Data; private DataFromScreen Data;
private class CPlayerChooseButton private class CPlayerChooseButton
@@ -68,7 +66,7 @@ namespace Vocaluxe.PartyModes
PlayerChooseButtonsVisibleProfiles = new List<int>(); PlayerChooseButtonsVisibleProfiles = new List<int>();
ProfileIDs = new List<int>(); Data.ScreenNames.ProfileIDs = new List<int>();
_ThemeName = "PartyScreenChallengeNames"; _ThemeName = "PartyScreenChallengeNames";
List<string> buttons = new List<string>(); List<string> buttons = new List<string>();
@@ -86,8 +84,26 @@ namespace Vocaluxe.PartyModes
public override void LoadTheme(string XmlPath) public override void LoadTheme(string XmlPath)
{ {
base.LoadTheme(XmlPath); base.LoadTheme(XmlPath);
AddButtonPlayerDestination(); }
AddButtonPlayerChoose();
public override void DataToScreen(object ReceivedData)
{
DataToScreenNames config = new DataToScreenNames();
try
{
config = (DataToScreenNames)ReceivedData;
Data.ScreenNames.ProfileIDs = config.ProfileIDs;
if (Data.ScreenNames.ProfileIDs == null)
Data.ScreenNames.ProfileIDs = new List<int>();
NumPlayer = config.NumPlayer;
}
catch (Exception e)
{
_Base.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + _ThemeName + ". " + e.Message); ;
}
} }
public override bool HandleInput(KeyEvent KeyEvent) public override bool HandleInput(KeyEvent KeyEvent)
@@ -184,14 +200,14 @@ namespace Vocaluxe.PartyModes
{ {
int added = -1; int added = -1;
//Add Player-ID to list. //Add Player-ID to list.
if (ProfileIDs.Count < (i + 1)) if (Data.ScreenNames.ProfileIDs.Count < (i + 1))
{ {
ProfileIDs.Add(SelectedPlayerNr); Data.ScreenNames.ProfileIDs.Add(SelectedPlayerNr);
added = ProfileIDs.Count - 1; added = Data.ScreenNames.ProfileIDs.Count - 1;
} }
else if (ProfileIDs.Count >= (i + 1)) else if (Data.ScreenNames.ProfileIDs.Count >= (i + 1))
{ {
ProfileIDs[i] = SelectedPlayerNr; Data.ScreenNames.ProfileIDs[i] = SelectedPlayerNr;
added = i; added = i;
} }
UpdateButtonNext(); UpdateButtonNext();
@@ -236,6 +252,9 @@ namespace Vocaluxe.PartyModes
{ {
base.OnShow(); base.OnShow();
AddButtonPlayerDestination();
AddButtonPlayerChoose();
UpdateButtonPlayerDestination(); UpdateButtonPlayerDestination();
UpdateButtonPlayerChoose(); UpdateButtonPlayerChoose();
@@ -369,10 +388,10 @@ namespace Vocaluxe.PartyModes
{ {
visible = true; visible = true;
} }
for (int p = 0; p < ProfileIDs.Count; p++) for (int p = 0; p < Data.ScreenNames.ProfileIDs.Count; p++)
{ {
//Don't show profile if is selected, but if selected and guest //Don't show profile if is selected, but if selected and guest
if (ProfileIDs[p] == i && _Base.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF) if (Data.ScreenNames.ProfileIDs[p] == i && _Base.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF)
{ {
visible = false; visible = false;
} }
@@ -388,7 +407,7 @@ namespace Vocaluxe.PartyModes
{ {
for (int i = 0; i < PlayerDestinationButtons.Count; i++) for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{ {
if (NumPlayers > i) if (NumPlayer > i)
{ {
PlayerDestinationButtons[i].Visible = true; PlayerDestinationButtons[i].Visible = true;
PlayerDestinationButtons[i].Enabled = true; PlayerDestinationButtons[i].Enabled = true;
@@ -399,17 +418,17 @@ namespace Vocaluxe.PartyModes
PlayerDestinationButtons[i].Enabled = false; PlayerDestinationButtons[i].Enabled = false;
} }
} }
for (int i = 0; i < NumPlayers; i++) for (int i = 0; i < NumPlayer; i++)
{ {
if (i < ProfileIDs.Count) if (i < Data.ScreenNames.ProfileIDs.Count)
{ {
if (ProfileIDs[i] != -1) if (Data.ScreenNames.ProfileIDs[i] != -1)
{ {
PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f); PlayerDestinationButtons[i].Color = new SColorF(1, 1, 1, 0.6f);
PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1); PlayerDestinationButtons[i].SColor = new SColorF(1, 1, 1, 1);
PlayerDestinationButtons[i].Texture = _Base.Profiles.GetProfiles()[ProfileIDs[i]].Avatar.Texture; PlayerDestinationButtons[i].Texture = _Base.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
PlayerDestinationButtons[i].STexture = _Base.Profiles.GetProfiles()[ProfileIDs[i]].Avatar.Texture; PlayerDestinationButtons[i].STexture = _Base.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].Avatar.Texture;
PlayerDestinationButtons[i].Text.Text = _Base.Profiles.GetProfiles()[ProfileIDs[i]].PlayerName; PlayerDestinationButtons[i].Text.Text = _Base.Profiles.GetProfiles()[Data.ScreenNames.ProfileIDs[i]].PlayerName;
PlayerDestinationButtons[i].Enabled = true; PlayerDestinationButtons[i].Enabled = true;
} }
} }
@@ -427,7 +446,7 @@ namespace Vocaluxe.PartyModes
private void UpdateButtonNext() private void UpdateButtonNext()
{ {
if (ProfileIDs.Count == NumPlayers) if (Data.ScreenNames.ProfileIDs.Count == NumPlayer)
Buttons[htButtons(ButtonNext)].Visible = true; Buttons[htButtons(ButtonNext)].Visible = true;
else else
Buttons[htButtons(ButtonNext)].Visible = false; Buttons[htButtons(ButtonNext)].Visible = false;
@@ -439,10 +458,10 @@ namespace Vocaluxe.PartyModes
{ {
if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1) if (PlayerChooseButtons[i].Button.Selected && PlayerChooseButtons[i].ProfileID != -1)
{ {
if (ProfileIDs.Count < NumPlayers) if (Data.ScreenNames.ProfileIDs.Count < NumPlayer)
{ {
ProfileIDs.Add(PlayerChooseButtons[i].ProfileID); Data.ScreenNames.ProfileIDs.Add(PlayerChooseButtons[i].ProfileID);
int added = ProfileIDs.Count - 1; int added = Data.ScreenNames.ProfileIDs.Count - 1;
UpdateButtonNext(); UpdateButtonNext();
//Update texture and name //Update texture and name
PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f); PlayerDestinationButtons[added].Color = new SColorF(1, 1, 1, 0.6f);
@@ -458,15 +477,16 @@ namespace Vocaluxe.PartyModes
} }
} }
} }
private void OnRemove() private void OnRemove()
{ {
for (int i = 0; i < PlayerDestinationButtons.Count; i++) for (int i = 0; i < PlayerDestinationButtons.Count; i++)
{ {
if (PlayerDestinationButtons[i].Selected) if (PlayerDestinationButtons[i].Selected)
{ {
if ((i + 1) <= ProfileIDs.Count) if ((i + 1) <= Data.ScreenNames.ProfileIDs.Count)
{ {
ProfileIDs.RemoveAt(i); Data.ScreenNames.ProfileIDs.RemoveAt(i);
UpdateButtonNext(); UpdateButtonNext();
UpdateButtonPlayerDestination(); UpdateButtonPlayerDestination();
UpdateButtonPlayerChoose(); UpdateButtonPlayerChoose();
@@ -485,9 +505,6 @@ namespace Vocaluxe.PartyModes
private void Next() private void Next()
{ {
List<int> list = new List<int>();
list.AddRange(ProfileIDs);
Data.ScreenNames.ProfileIDs = list;
Data.ScreenNames.FadeToConfig = false; Data.ScreenNames.FadeToConfig = false;
Data.ScreenNames.FadeToMain = true; Data.ScreenNames.FadeToMain = true;
_PartyMode.DataFromScreen(_ThemeName, Data); _PartyMode.DataFromScreen(_ThemeName, Data);