commit
7044d8a084
71 files changed
+1263
-2045
No files matched your search
@@ -161,22 +161,22 @@
|
||||
<Skin/>
|
||||
<Color Name="Invisible" />
|
||||
<Rect>
|
||||
<X>145</X>
|
||||
<Y>663</Y>
|
||||
<W>990</W>
|
||||
<X>300</X>
|
||||
<Y>603</Y>
|
||||
<W>685</W>
|
||||
<H>50</H>
|
||||
<Z>0</Z>
|
||||
<Z>-1</Z>
|
||||
</Rect>
|
||||
</Static>
|
||||
<Static Name="StaticWarningProfiles">
|
||||
<Skin/>
|
||||
<Color Name="Invisible" />
|
||||
<Rect>
|
||||
<X>145</X>
|
||||
<Y>715</Y>
|
||||
<W>990</W>
|
||||
<X>300</X>
|
||||
<Y>654</Y>
|
||||
<W>685</W>
|
||||
<H>50</H>
|
||||
<Z>0</Z>
|
||||
<Z>-1</Z>
|
||||
</Rect>
|
||||
</Static>
|
||||
</Statics>
|
||||
@@ -198,7 +198,7 @@
|
||||
<Text Name="TextWarningMics">
|
||||
<X>640</X>
|
||||
<Y>617</Y>
|
||||
<Z>0</Z>
|
||||
<Z>-1.1</Z>
|
||||
<H>27</H>
|
||||
<MaxW>970</MaxW>
|
||||
<Color Name="TextWarningColor" />
|
||||
@@ -212,7 +212,7 @@
|
||||
<Text Name="TextWarningProfiles">
|
||||
<X>640</X>
|
||||
<Y>652</Y>
|
||||
<Z>0</Z>
|
||||
<Z>-1.1</Z>
|
||||
<H>27</H>
|
||||
<MaxW>970</MaxW>
|
||||
<Color Name="TextWarningColor" />
|
||||
|
||||
@@ -28,6 +28,16 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
public readonly List<CCombination> Rounds;
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return Rounds.Count; }
|
||||
}
|
||||
|
||||
public CCombination this[int index]
|
||||
{
|
||||
get { return Rounds[index]; }
|
||||
}
|
||||
|
||||
public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce)
|
||||
{
|
||||
Rounds = new List<CCombination>();
|
||||
|
||||
@@ -24,33 +24,6 @@ using VocaluxeLib.Menu;
|
||||
|
||||
namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
|
||||
#region Communication
|
||||
|
||||
#region ToScreen
|
||||
public struct SDataToScreenConfig
|
||||
{
|
||||
public int NumPlayer;
|
||||
public int NumPlayerAtOnce;
|
||||
public int NumRounds;
|
||||
}
|
||||
|
||||
public struct SDataToScreenNames
|
||||
{
|
||||
public int NumPlayer;
|
||||
public List<int> ProfileIDs;
|
||||
}
|
||||
|
||||
public struct SDataToScreenMain
|
||||
{
|
||||
public int CurrentRoundNr;
|
||||
public int NumPlayerAtOnce;
|
||||
public List<CCombination> Combs;
|
||||
public int[,] Results;
|
||||
public List<CResultTableRow> ResultTable;
|
||||
public List<int> ProfileIDs;
|
||||
}
|
||||
|
||||
public class CResultTableRow : IComparable
|
||||
{
|
||||
public int Position;
|
||||
@@ -78,39 +51,21 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
throw new ArgumentException("object is not a ResultTableRow");
|
||||
}
|
||||
}
|
||||
#endregion ToScreen
|
||||
|
||||
#region FromScreen
|
||||
public struct SDataFromScreen
|
||||
public abstract class CPartyScreenChallenge : CMenuParty
|
||||
{
|
||||
public SFromScreenConfig ScreenConfig;
|
||||
public SFromScreenNames ScreenNames;
|
||||
public SFromScreenMain ScreenMain;
|
||||
protected new CPartyModeChallenge _PartyMode;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
_PartyMode = (CPartyModeChallenge)base._PartyMode;
|
||||
}
|
||||
}
|
||||
|
||||
public struct SFromScreenConfig
|
||||
{
|
||||
public int NumPlayer;
|
||||
public int NumPlayerAtOnce;
|
||||
public int NumRounds;
|
||||
}
|
||||
|
||||
public struct SFromScreenNames
|
||||
{
|
||||
public bool FadeBack;
|
||||
public List<int> ProfileIDs;
|
||||
}
|
||||
|
||||
public struct SFromScreenMain
|
||||
{
|
||||
public bool FadeToSongSelection;
|
||||
public bool FadeToNameSelection;
|
||||
}
|
||||
#endregion FromScreen
|
||||
|
||||
#endregion Communication
|
||||
|
||||
// ReSharper disable ClassNeverInstantiated.Global
|
||||
public sealed class CPartyModeChallenge : CPartyMode
|
||||
// ReSharper restore ClassNeverInstantiated.Global
|
||||
{
|
||||
private const int _MaxPlayer = 12;
|
||||
private const int _MinPlayer = 1;
|
||||
@@ -120,14 +75,13 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private enum EStage
|
||||
{
|
||||
NotStarted,
|
||||
Config,
|
||||
Names,
|
||||
Main,
|
||||
Singing
|
||||
}
|
||||
|
||||
private struct SData
|
||||
public struct SData
|
||||
{
|
||||
public int NumPlayer;
|
||||
public int NumPlayerAtOnce;
|
||||
@@ -151,11 +105,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public int Won;
|
||||
}
|
||||
|
||||
private SDataToScreenConfig _ToScreenConfig;
|
||||
private SDataToScreenNames _ToScreenNames;
|
||||
private SDataToScreenMain _ToScreenMain;
|
||||
|
||||
private SData _GameData;
|
||||
public SData GameData;
|
||||
private EStage _Stage;
|
||||
|
||||
public CPartyModeChallenge(int id, string folder)
|
||||
@@ -171,18 +121,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
|
||||
|
||||
_Stage = EStage.NotStarted;
|
||||
|
||||
_ToScreenConfig = new SDataToScreenConfig();
|
||||
_ToScreenNames = new SDataToScreenNames();
|
||||
_ToScreenMain = new SDataToScreenMain();
|
||||
|
||||
_GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 2, CurrentRoundNr = 1, ProfileIDs = new List<int>(), CatSongIndices = null, Results = null};
|
||||
GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, CurrentRoundNr = 1, ProfileIDs = new List<int>(), CatSongIndices = null, Results = null};
|
||||
}
|
||||
|
||||
public override bool Init()
|
||||
{
|
||||
_Stage = EStage.NotStarted;
|
||||
_Stage = EStage.Config;
|
||||
|
||||
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
|
||||
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
|
||||
@@ -192,82 +136,11 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE)
|
||||
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
|
||||
|
||||
_ToScreenMain.ResultTable = new List<CResultTableRow>();
|
||||
_GameData.ResultTable = new List<CResultTableRow>();
|
||||
GameData.ResultTable = new List<CResultTableRow>();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void DataFromScreen(string screenName, Object data)
|
||||
{
|
||||
SDataFromScreen dataFrom;
|
||||
switch (screenName)
|
||||
{
|
||||
case "PartyScreenChallengeConfig":
|
||||
|
||||
try
|
||||
{
|
||||
dataFrom = (SDataFromScreen)data;
|
||||
_GameData.NumPlayer = dataFrom.ScreenConfig.NumPlayer;
|
||||
_GameData.NumPlayerAtOnce = dataFrom.ScreenConfig.NumPlayerAtOnce;
|
||||
_GameData.NumRounds = dataFrom.ScreenConfig.NumRounds;
|
||||
|
||||
_Stage = EStage.Config;
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
|
||||
}
|
||||
break;
|
||||
|
||||
case "PartyScreenChallengeNames":
|
||||
try
|
||||
{
|
||||
dataFrom = (SDataFromScreen)data;
|
||||
if (dataFrom.ScreenNames.FadeBack)
|
||||
_Stage = EStage.NotStarted;
|
||||
else
|
||||
{
|
||||
_GameData.ProfileIDs = dataFrom.ScreenNames.ProfileIDs;
|
||||
_Stage = EStage.Names;
|
||||
}
|
||||
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
|
||||
}
|
||||
break;
|
||||
|
||||
case "PartyScreenChallengeMain":
|
||||
try
|
||||
{
|
||||
dataFrom = (SDataFromScreen)data;
|
||||
if (dataFrom.ScreenMain.FadeToSongSelection)
|
||||
_Stage = EStage.Singing;
|
||||
if (dataFrom.ScreenMain.FadeToNameSelection)
|
||||
_Stage = EStage.Config;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
|
||||
}
|
||||
|
||||
|
||||
if (_Stage == EStage.Singing)
|
||||
_StartNextRound();
|
||||
if (_Stage == EStage.Config)
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
break;
|
||||
|
||||
default:
|
||||
CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + screenName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateGame()
|
||||
{
|
||||
/*
|
||||
@@ -277,78 +150,78 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_ScreenSongOptions.Selection.RandomOnly = false;*/
|
||||
}
|
||||
|
||||
public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen)
|
||||
private IMenu _GetNextScreen()
|
||||
{
|
||||
CMenuParty screen = null;
|
||||
alternativeScreen = EScreens.ScreenSong;
|
||||
|
||||
switch (_Stage)
|
||||
{
|
||||
case EStage.NotStarted:
|
||||
_Screens.TryGetValue("CPartyScreenChallengeConfig", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
_ToScreenConfig.NumPlayer = _GameData.NumPlayer;
|
||||
_ToScreenConfig.NumPlayerAtOnce = _GameData.NumPlayerAtOnce;
|
||||
_ToScreenConfig.NumRounds = _GameData.NumRounds;
|
||||
screen.DataToScreen(_ToScreenConfig);
|
||||
}
|
||||
break;
|
||||
case EStage.Config:
|
||||
_Screens.TryGetValue("CPartyScreenChallengeNames", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
_ToScreenNames.NumPlayer = _GameData.NumPlayer;
|
||||
_ToScreenNames.ProfileIDs = _GameData.ProfileIDs;
|
||||
screen.DataToScreen(_ToScreenNames);
|
||||
}
|
||||
return _Screens["CPartyScreenChallengeConfig"];
|
||||
case EStage.Names:
|
||||
return _Screens["CPartyScreenChallengeNames"];
|
||||
case EStage.Main:
|
||||
return _Screens["CPartyScreenChallengeMain"];
|
||||
case EStage.Singing:
|
||||
return CBase.Graphics.GetScreen(EScreen.Song);
|
||||
default:
|
||||
throw new ArgumentException("Invalid stage: " + _Stage);
|
||||
}
|
||||
}
|
||||
|
||||
private void _FadeToScreen()
|
||||
{
|
||||
CBase.Graphics.FadeTo(_GetNextScreen());
|
||||
}
|
||||
|
||||
public void Next()
|
||||
{
|
||||
switch (_Stage)
|
||||
{
|
||||
case EStage.Config:
|
||||
_Stage = EStage.Names;
|
||||
break;
|
||||
case EStage.Names:
|
||||
_Screens.TryGetValue("CPartyScreenChallengeMain", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
CBase.Songs.ResetSongSung();
|
||||
_ToScreenMain.ResultTable = new List<CResultTableRow>();
|
||||
_GameData.ResultTable = new List<CResultTableRow>();
|
||||
_GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce);
|
||||
_GameData.CurrentRoundNr = 1;
|
||||
_ToScreenMain.CurrentRoundNr = 1;
|
||||
_ToScreenMain.NumPlayerAtOnce = _GameData.NumPlayerAtOnce;
|
||||
_ToScreenMain.Combs = _GameData.Rounds.Rounds;
|
||||
_ToScreenMain.ProfileIDs = _GameData.ProfileIDs;
|
||||
_UpdateScores();
|
||||
_ToScreenMain.ResultTable = _GameData.ResultTable;
|
||||
_ToScreenMain.Results = _GameData.Results;
|
||||
screen.DataToScreen(_ToScreenMain);
|
||||
}
|
||||
_Stage = EStage.Main;
|
||||
CBase.Songs.ResetSongSung();
|
||||
GameData.ResultTable = new List<CResultTableRow>();
|
||||
GameData.Rounds = new CChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce);
|
||||
GameData.CurrentRoundNr = 1;
|
||||
break;
|
||||
case EStage.Main:
|
||||
//nothing to do
|
||||
_Stage = EStage.Singing;
|
||||
_StartNextRound();
|
||||
break;
|
||||
case EStage.Singing:
|
||||
_Screens.TryGetValue("CPartyScreenChallengeMain", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
_UpdateScores();
|
||||
_ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr;
|
||||
_ToScreenMain.Combs = _GameData.Rounds.Rounds;
|
||||
_ToScreenMain.Results = _GameData.Results;
|
||||
screen.DataToScreen(_ToScreenMain);
|
||||
}
|
||||
_Stage = EStage.Main;
|
||||
_UpdateScores();
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Invalid stage: " + _Stage);
|
||||
}
|
||||
|
||||
return screen;
|
||||
_FadeToScreen();
|
||||
}
|
||||
|
||||
public override EScreens GetStartScreen()
|
||||
public void Back()
|
||||
{
|
||||
return EScreens.ScreenPartyDummy;
|
||||
switch (_Stage)
|
||||
{
|
||||
case EStage.Config:
|
||||
CBase.Graphics.FadeTo(EScreen.Party);
|
||||
return;
|
||||
case EStage.Names:
|
||||
_Stage = EStage.Config;
|
||||
break;
|
||||
case EStage.Main:
|
||||
_Stage = EStage.Config;
|
||||
break;
|
||||
default: // Rest is not allowed
|
||||
throw new ArgumentException("Invalid stage: " + _Stage);
|
||||
}
|
||||
_FadeToScreen();
|
||||
}
|
||||
|
||||
public override EScreens GetMainScreen()
|
||||
public override IMenu GetStartScreen()
|
||||
{
|
||||
return EScreens.ScreenPartyDummy;
|
||||
return _Screens["CPartyScreenChallengeConfig"];
|
||||
}
|
||||
|
||||
public override SScreenSongOptions GetScreenSongOptions()
|
||||
@@ -371,10 +244,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_ScreenSongOptions.Selection.SelectNextRandomSong = false;
|
||||
_CreateCatSongIndices();
|
||||
|
||||
if (_GameData.CatSongIndices != null)
|
||||
if (GameData.CatSongIndices != null)
|
||||
{
|
||||
if (_GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1)
|
||||
_GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex;
|
||||
if (GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1)
|
||||
GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -385,15 +258,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
|
||||
// ReSharper restore RedundantAssignment
|
||||
{
|
||||
if (_GameData.CatSongIndices != null && categoryIndex != -1)
|
||||
if (GameData.CatSongIndices != null && categoryIndex != -1)
|
||||
{
|
||||
if (_GameData.CatSongIndices[categoryIndex] == -1)
|
||||
if (GameData.CatSongIndices[categoryIndex] == -1)
|
||||
_ScreenSongOptions.Selection.SelectNextRandomSong = true;
|
||||
else
|
||||
_ScreenSongOptions.Selection.SongIndex = _GameData.CatSongIndices[categoryIndex];
|
||||
_ScreenSongOptions.Selection.SongIndex = GameData.CatSongIndices[categoryIndex];
|
||||
}
|
||||
|
||||
if (_GameData.CatSongIndices == null && categoryIndex != -1)
|
||||
if (GameData.CatSongIndices == null && categoryIndex != -1)
|
||||
_ScreenSongOptions.Selection.SelectNextRandomSong = true;
|
||||
|
||||
if (categoryIndex == -1)
|
||||
@@ -456,34 +329,34 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
CBase.Game.Reset();
|
||||
CBase.Game.ClearSongs();
|
||||
CBase.Game.AddSong(songID, gm);
|
||||
CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce);
|
||||
CBase.Game.SetNumPlayer(GameData.NumPlayerAtOnce);
|
||||
|
||||
SPlayer[] players = CBase.Game.GetPlayers();
|
||||
if (players == null)
|
||||
return;
|
||||
|
||||
if (players.Length < _GameData.NumPlayerAtOnce)
|
||||
if (players.Length < GameData.NumPlayerAtOnce)
|
||||
return;
|
||||
|
||||
CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
|
||||
CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
|
||||
|
||||
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
//try to fill with the right data
|
||||
if (c != null)
|
||||
players[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
|
||||
players[i].ProfileID = GameData.ProfileIDs[c.Player[i]];
|
||||
else
|
||||
players[i].ProfileID = -1;
|
||||
}
|
||||
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenSing);
|
||||
CBase.Graphics.FadeTo(EScreen.Sing);
|
||||
}
|
||||
|
||||
public override void LeavingHighscore()
|
||||
{
|
||||
CBase.Songs.AddPartySongSung(CBase.Game.GetSong(0).ID);
|
||||
_GameData.CurrentRoundNr++;
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
GameData.CurrentRoundNr++;
|
||||
Next();
|
||||
}
|
||||
|
||||
private void _StartNextRound()
|
||||
@@ -492,13 +365,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_ScreenSongOptions.Selection.CategoryChangeAllowed = _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON;
|
||||
_SetNumJokers();
|
||||
_SetTeamNames();
|
||||
_GameData.CatSongIndices = null;
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenSong);
|
||||
GameData.CatSongIndices = null;
|
||||
}
|
||||
|
||||
private void _SetNumJokers()
|
||||
{
|
||||
switch (_GameData.NumPlayerAtOnce)
|
||||
switch (GameData.NumPlayerAtOnce)
|
||||
{
|
||||
case 1:
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] {10};
|
||||
@@ -531,19 +403,19 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _SetTeamNames()
|
||||
{
|
||||
if (_GameData.NumPlayerAtOnce < 1 || _GameData.ProfileIDs.Count < _GameData.NumPlayerAtOnce)
|
||||
if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce)
|
||||
{
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
|
||||
return;
|
||||
}
|
||||
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[_GameData.NumPlayerAtOnce];
|
||||
CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
|
||||
CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
|
||||
|
||||
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
if (c != null)
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(_GameData.ProfileIDs[c.Player[i]]);
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = CBase.Profiles.GetPlayerName(GameData.ProfileIDs[c.Player[i]]);
|
||||
else
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = "foobar";
|
||||
}
|
||||
@@ -551,19 +423,19 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _UpdateScores()
|
||||
{
|
||||
if (_GameData.ResultTable.Count == 0)
|
||||
if (GameData.ResultTable.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < _GameData.NumPlayer; i++)
|
||||
for (int i = 0; i < GameData.NumPlayer; i++)
|
||||
{
|
||||
var row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0};
|
||||
_GameData.ResultTable.Add(row);
|
||||
var row = new CResultTableRow {PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0};
|
||||
GameData.ResultTable.Add(row);
|
||||
}
|
||||
|
||||
_GameData.Results = new int[_GameData.NumRounds,_GameData.NumPlayerAtOnce];
|
||||
for (int i = 0; i < _GameData.NumRounds; i++)
|
||||
GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce];
|
||||
for (int i = 0; i < GameData.NumRounds; i++)
|
||||
{
|
||||
for (int j = 0; j < _GameData.NumPlayerAtOnce; j++)
|
||||
_GameData.Results[i, j] = 0;
|
||||
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
|
||||
GameData.Results[i, j] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -572,20 +444,20 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
if (results == null)
|
||||
return;
|
||||
|
||||
if (results.Length < _GameData.NumPlayerAtOnce)
|
||||
if (results.Length < GameData.NumPlayerAtOnce)
|
||||
return;
|
||||
|
||||
for (int j = 0; j < _GameData.NumPlayerAtOnce; j++)
|
||||
_GameData.Results[_GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
|
||||
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
|
||||
GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
|
||||
|
||||
List<SStats> points = _GetPointsForPlayer(results);
|
||||
|
||||
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
int index = -1;
|
||||
for (int j = 0; j < _GameData.ResultTable.Count; j++)
|
||||
for (int j = 0; j < GameData.ResultTable.Count; j++)
|
||||
{
|
||||
if (points[i].ProfileID == _GameData.ResultTable[j].PlayerID)
|
||||
if (points[i].ProfileID == GameData.ResultTable[j].PlayerID)
|
||||
{
|
||||
index = j;
|
||||
break;
|
||||
@@ -594,24 +466,24 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
if (index == -1)
|
||||
continue;
|
||||
CResultTableRow row = _GameData.ResultTable[index];
|
||||
CResultTableRow row = GameData.ResultTable[index];
|
||||
|
||||
row.NumPlayed++;
|
||||
row.NumWon += points[i].Won;
|
||||
row.NumSingPoints += points[i].SingPoints;
|
||||
row.NumGamePoints += points[i].GamePoints;
|
||||
|
||||
_GameData.ResultTable[index] = row;
|
||||
GameData.ResultTable[index] = row;
|
||||
}
|
||||
}
|
||||
|
||||
_GameData.ResultTable.Sort();
|
||||
GameData.ResultTable.Sort();
|
||||
|
||||
//Update position-number
|
||||
int pos = 1;
|
||||
int lastPoints = 0;
|
||||
int lastSingPoints = 0;
|
||||
foreach (CResultTableRow resultRow in _GameData.ResultTable)
|
||||
foreach (CResultTableRow resultRow in GameData.ResultTable)
|
||||
{
|
||||
if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints)
|
||||
pos++;
|
||||
@@ -624,7 +496,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private List<SStats> _GetPointsForPlayer(SPlayer[] results)
|
||||
{
|
||||
var result = new List<SStats>();
|
||||
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
var stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0};
|
||||
result.Add(stat);
|
||||
@@ -672,15 +544,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _CreateCatSongIndices()
|
||||
{
|
||||
if (_GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
|
||||
if (GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
_GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()];
|
||||
for (int i = 0; i < _GameData.CatSongIndices.Length; i++)
|
||||
_GameData.CatSongIndices[i] = -1;
|
||||
GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()];
|
||||
for (int i = 0; i < GameData.CatSongIndices.Length; i++)
|
||||
GameData.CatSongIndices[i] = -1;
|
||||
}
|
||||
|
||||
if (CBase.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
|
||||
_GameData.CatSongIndices = null;
|
||||
GameData.CatSongIndices = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,12 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
// ReSharper disable UnusedMember.Global
|
||||
public class CPartyScreenChallengeConfig : CMenuParty
|
||||
public class CPartyScreenChallengeConfig : CPartyScreenChallenge
|
||||
// ReSharper restore UnusedMember.Global
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
@@ -41,33 +39,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private int _MaxNumRounds = 100;
|
||||
private int _RoundSteps = 1;
|
||||
|
||||
private SDataFromScreen _Data;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeSelectSlides = new string[] {_SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds};
|
||||
_ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
|
||||
|
||||
_Data = new SDataFromScreen();
|
||||
SFromScreenConfig config = new SFromScreenConfig {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12};
|
||||
_Data.ScreenConfig = config;
|
||||
}
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
{
|
||||
try
|
||||
{
|
||||
SDataToScreenConfig config = (SDataToScreenConfig)receivedData;
|
||||
_Data.ScreenConfig.NumPlayer = config.NumPlayer;
|
||||
_Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce;
|
||||
_Data.ScreenConfig.NumRounds = config.NumRounds;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
@@ -81,17 +58,17 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
_UpdateSlides();
|
||||
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
_Next();
|
||||
_PartyMode.Next();
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
@@ -114,14 +91,14 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
_UpdateSlides();
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
_Next();
|
||||
_PartyMode.Next();
|
||||
}
|
||||
|
||||
if (mouseEvent.RB)
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -150,7 +127,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_SelectSlides[_SelectSlideNumPlayers].Clear();
|
||||
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
|
||||
_SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
|
||||
_SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.GetMinPlayer();
|
||||
|
||||
_UpdateMicsAtOnce();
|
||||
_SetRoundSteps();
|
||||
@@ -159,21 +136,21 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _UpdateSlides()
|
||||
{
|
||||
int player = _Data.ScreenConfig.NumPlayer;
|
||||
int mics = _Data.ScreenConfig.NumPlayerAtOnce;
|
||||
_Data.ScreenConfig.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
|
||||
_Data.ScreenConfig.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
|
||||
_Data.ScreenConfig.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
|
||||
int player = _PartyMode.GameData.NumPlayer;
|
||||
int mics = _PartyMode.GameData.NumPlayerAtOnce;
|
||||
_PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
|
||||
_PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
|
||||
_PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
|
||||
|
||||
_UpdateMicsAtOnce();
|
||||
_SetRoundSteps();
|
||||
|
||||
if (player != _Data.ScreenConfig.NumPlayer || mics != _Data.ScreenConfig.NumPlayerAtOnce)
|
||||
if (player != _PartyMode.GameData.NumPlayer || mics != _PartyMode.GameData.NumPlayerAtOnce)
|
||||
{
|
||||
int num = CHelper.CombinationCount(_Data.ScreenConfig.NumPlayer, _Data.ScreenConfig.NumPlayerAtOnce);
|
||||
int num = CHelper.CombinationCount(_PartyMode.GameData.NumPlayer, _PartyMode.GameData.NumPlayerAtOnce);
|
||||
while (num > _MaxNumRounds)
|
||||
num -= _RoundSteps;
|
||||
_Data.ScreenConfig.NumRounds = num;
|
||||
_PartyMode.GameData.NumRounds = num;
|
||||
}
|
||||
|
||||
_UpdateSlideRounds();
|
||||
@@ -181,19 +158,18 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _UpdateMicsAtOnce()
|
||||
{
|
||||
//Data.ScreenConfig.NumPlayerAtOnce
|
||||
int maxNum = _MaxNumMics;
|
||||
if (_Data.ScreenConfig.NumPlayer < _MaxNumMics)
|
||||
maxNum = _Data.ScreenConfig.NumPlayer;
|
||||
if (_PartyMode.GameData.NumPlayer < _MaxNumMics)
|
||||
maxNum = _PartyMode.GameData.NumPlayer;
|
||||
|
||||
if (_Data.ScreenConfig.NumPlayerAtOnce > maxNum)
|
||||
_Data.ScreenConfig.NumPlayerAtOnce = maxNum;
|
||||
if (_PartyMode.GameData.NumPlayerAtOnce > maxNum)
|
||||
_PartyMode.GameData.NumPlayerAtOnce = maxNum;
|
||||
|
||||
// build mics at once slide
|
||||
_SelectSlides[_SelectSlideNumMics].Clear();
|
||||
for (int i = 1; i <= maxNum; i++)
|
||||
_SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
|
||||
_SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
|
||||
}
|
||||
|
||||
private void _UpdateSlideRounds()
|
||||
@@ -202,31 +178,21 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_SelectSlides[_SelectSlideNumRounds].Clear();
|
||||
for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
|
||||
_SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1;
|
||||
_SelectSlides[_SelectSlideNumRounds].Selection = _PartyMode.GameData.NumRounds / _RoundSteps - 1;
|
||||
}
|
||||
|
||||
private void _SetRoundSteps()
|
||||
{
|
||||
if (_Data.ScreenConfig.NumPlayerAtOnce < 1 || _Data.ScreenConfig.NumPlayer < 1 || _Data.ScreenConfig.NumPlayerAtOnce > _Data.ScreenConfig.NumPlayer)
|
||||
if (_PartyMode.GameData.NumPlayerAtOnce < 1 || _PartyMode.GameData.NumPlayer < 1 || _PartyMode.GameData.NumPlayerAtOnce > _PartyMode.GameData.NumPlayer)
|
||||
{
|
||||
_RoundSteps = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce;
|
||||
int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce;
|
||||
int res = _PartyMode.GameData.NumPlayer / _PartyMode.GameData.NumPlayerAtOnce;
|
||||
int mod = _PartyMode.GameData.NumPlayer % _PartyMode.GameData.NumPlayerAtOnce;
|
||||
|
||||
_RoundSteps = mod == 0 ? res : _Data.ScreenConfig.NumPlayer;
|
||||
}
|
||||
|
||||
private void _Back()
|
||||
{
|
||||
_FadeTo(EScreens.ScreenParty);
|
||||
}
|
||||
|
||||
private void _Next()
|
||||
{
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
_RoundSteps = mod == 0 ? res : _PartyMode.GameData.NumPlayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
|
||||
// ReSharper disable UnusedMember.Global
|
||||
public class CPartyScreenChallengeMain : CMenuParty
|
||||
public class CPartyScreenChallengeMain : CPartyScreenChallenge
|
||||
// ReSharper restore UnusedMember.Global
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
@@ -79,8 +79,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private bool _ExitPopupVisible;
|
||||
|
||||
private SDataFromScreen _Data;
|
||||
private SDataToScreenMain _GameState;
|
||||
private List<STableRow> _PlayerTable;
|
||||
private List<CRoundsTableRow> _RoundsTable;
|
||||
|
||||
@@ -94,11 +92,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
private const int _NumPlayerVisible = 10;
|
||||
private int _NumRoundsVisible = 3;
|
||||
|
||||
public CPartyScreenChallengeMain()
|
||||
{
|
||||
_Data = new SDataFromScreen {ScreenMain = new SFromScreenMain()};
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -121,7 +114,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
base.LoadTheme(xmlPath);
|
||||
|
||||
_GameState = new SDataToScreenMain();
|
||||
_BuildPlayerTable();
|
||||
_CreateRoundsTable();
|
||||
_NextPlayerTexts = new List<CText>();
|
||||
@@ -137,19 +129,6 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_Statics[_StaticNextPlayer].Visible = false;
|
||||
}
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = (SDataToScreenMain)receivedData;
|
||||
_GameState = data;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
{
|
||||
base.HandleInput(keyEvent);
|
||||
@@ -163,8 +142,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
case Keys.Escape:
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (_GameState.CurrentRoundNr == 1)
|
||||
_Back();
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1)
|
||||
_PartyMode.Back();
|
||||
else
|
||||
_ShowPopup(true);
|
||||
}
|
||||
@@ -176,10 +155,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (_Buttons[_ButtonNextRound].Selected)
|
||||
_NextRound();
|
||||
if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
|
||||
_Back();
|
||||
if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
|
||||
_PartyMode.Next();
|
||||
if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1)
|
||||
_PartyMode.Back();
|
||||
if (_Buttons[_ButtonExit].Selected && _PartyMode.GameData.CurrentRoundNr > 1)
|
||||
_ShowPopup(true);
|
||||
if (_Buttons[_ButtonPlayerScrollUp].Selected)
|
||||
_ScrollPlayerTable(-1);
|
||||
@@ -212,10 +191,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (_Buttons[_ButtonNextRound].Selected)
|
||||
_NextRound();
|
||||
if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
|
||||
_Back();
|
||||
if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
|
||||
_PartyMode.Next();
|
||||
if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1)
|
||||
_PartyMode.Back();
|
||||
if (_Buttons[_ButtonExit].Selected && _PartyMode.GameData.CurrentRoundNr > 1)
|
||||
_ShowPopup(true);
|
||||
if (_Buttons[_ButtonPlayerScrollUp].Selected)
|
||||
_ScrollPlayerTable(-1);
|
||||
@@ -239,8 +218,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (_GameState.CurrentRoundNr == 1)
|
||||
_Back();
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1)
|
||||
_PartyMode.Back();
|
||||
else
|
||||
_ShowPopup(true);
|
||||
}
|
||||
@@ -269,13 +248,13 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_UpdatePlayerTable();
|
||||
_UpdateNextPlayerPositions();
|
||||
_UpdateNextPlayerContents();
|
||||
if (_GameState.CurrentRoundNr == 1)
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1)
|
||||
_BuildRoundsTable();
|
||||
else
|
||||
_ScrollRoundsTable(_GameState.CurrentRoundNr - 2);
|
||||
_ScrollRoundsTable(_PartyMode.GameData.CurrentRoundNr - 2);
|
||||
_UpdateRoundsTable();
|
||||
|
||||
if (_GameState.CurrentRoundNr == 1)
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1)
|
||||
{
|
||||
_Buttons[_ButtonBack].Visible = true;
|
||||
_Buttons[_ButtonExit].Visible = false;
|
||||
@@ -286,7 +265,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_Buttons[_ButtonExit].Visible = true;
|
||||
}
|
||||
|
||||
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
||||
if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.Rounds.Count)
|
||||
{
|
||||
_Buttons[_ButtonNextRound].Visible = true;
|
||||
_Texts[_TextFinishMessage].Visible = false;
|
||||
@@ -310,16 +289,9 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
return true;
|
||||
}
|
||||
|
||||
private void _NextRound()
|
||||
{
|
||||
_Data.ScreenMain.FadeToNameSelection = false;
|
||||
_Data.ScreenMain.FadeToSongSelection = true;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
}
|
||||
|
||||
private void _EndParty()
|
||||
{
|
||||
_FadeTo(EScreens.ScreenParty);
|
||||
CBase.Graphics.FadeTo(EScreen.Party);
|
||||
}
|
||||
|
||||
private void _ShowPopup(bool visible)
|
||||
@@ -335,19 +307,13 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_SelectElement(_Buttons[_ButtonPopupNo]);
|
||||
}
|
||||
|
||||
private void _Back()
|
||||
{
|
||||
_Data.ScreenMain.FadeToNameSelection = true;
|
||||
_Data.ScreenMain.FadeToSongSelection = false;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
}
|
||||
|
||||
private void _UpdateNextPlayerPositions()
|
||||
{
|
||||
float x = (float)CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2;
|
||||
float x = (float)CBase.Settings.GetRenderW() / 2 -
|
||||
((_PartyMode.GameData.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_PartyMode.GameData.NumPlayerAtOnce - 1) * 15)) / 2;
|
||||
const float staticY = 590;
|
||||
const float textY = 550;
|
||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
//static
|
||||
_NextPlayerStatics[i].X = x;
|
||||
@@ -360,7 +326,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
x += _Statics[_StaticNextPlayer].Rect.W + 15;
|
||||
}
|
||||
for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
|
||||
for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
|
||||
{
|
||||
_NextPlayerStatics[i].Visible = false;
|
||||
_NextPlayerTexts[i].Visible = false;
|
||||
@@ -369,12 +335,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
|
||||
private void _UpdateNextPlayerContents()
|
||||
{
|
||||
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
||||
if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.Rounds.Count)
|
||||
{
|
||||
_Texts[_TextNextPlayerMessage].Visible = true;
|
||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
int id = _GameState.ProfileIDs[_GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i]];
|
||||
int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Player[i]];
|
||||
_NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id);
|
||||
_NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1);
|
||||
@@ -383,7 +349,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
else
|
||||
{
|
||||
_Texts[_TextNextPlayerMessage].Visible = false;
|
||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
_NextPlayerStatics[i].Visible = false;
|
||||
_NextPlayerTexts[i].Visible = false;
|
||||
@@ -429,10 +395,10 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_RoundsTableScrollArea = new SRectF();
|
||||
|
||||
const int numPlayerInOneRow = 3;
|
||||
_NumRoundsVisible = _GameState.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3;
|
||||
_NumRoundsVisible = _PartyMode.GameData.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3;
|
||||
|
||||
if (_NumRoundsVisible > _GameState.Combs.Count)
|
||||
_NumRoundsVisible = _GameState.Combs.Count;
|
||||
if (_NumRoundsVisible > _PartyMode.GameData.Rounds.Count)
|
||||
_NumRoundsVisible = _PartyMode.GameData.Rounds.Count;
|
||||
|
||||
float numberX = _Texts[_TextRoundNumber].X;
|
||||
float numberY = _Texts[_TextRoundNumber].Y;
|
||||
@@ -449,15 +415,15 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
//Round-number
|
||||
roundRow.Number.X = numberX;
|
||||
roundRow.Number.Y = numberY;
|
||||
var numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow));
|
||||
var numInnerRows = (int)Math.Ceiling(_PartyMode.GameData.NumPlayerAtOnce / ((double)numPlayerInOneRow));
|
||||
for (int row = 0; row < numInnerRows; row++)
|
||||
{
|
||||
int num = (row + 1) * numPlayerInOneRow;
|
||||
int numPlayerInThisRow = numPlayerInOneRow;
|
||||
if (num > _GameState.NumPlayerAtOnce)
|
||||
if (num > _PartyMode.GameData.NumPlayerAtOnce)
|
||||
{
|
||||
num = _GameState.NumPlayerAtOnce;
|
||||
numPlayerInThisRow = _GameState.NumPlayerAtOnce - (row * numPlayerInOneRow);
|
||||
num = _PartyMode.GameData.NumPlayerAtOnce;
|
||||
numPlayerInThisRow = _PartyMode.GameData.NumPlayerAtOnce - (row * numPlayerInOneRow);
|
||||
}
|
||||
for (int column = row * numPlayerInOneRow; column < num; column++)
|
||||
{
|
||||
@@ -486,17 +452,18 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
||||
{
|
||||
if (_GameState.Combs.Count > i + _RoundsTableOffset && _GameState.Combs[i + _RoundsTableOffset].Player.Count > p)
|
||||
if (_PartyMode.GameData.Rounds.Count > i + _RoundsTableOffset && _PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player.Count > p)
|
||||
{
|
||||
_RoundsTable[i].Number.Visible = true;
|
||||
_RoundsTable[i].TextPlayer[p].Visible = true;
|
||||
_RoundsTable[i].TextScores[p].Visible = true;
|
||||
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
|
||||
_RoundsTable[i].TextPlayer[p].Text = CBase.Profiles.GetPlayerName(_GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]);
|
||||
_RoundsTable[i].TextPlayer[p].Text =
|
||||
CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player[p]]);
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
|
||||
if ((_PartyMode.GameData.CurrentRoundNr - 1) > i + _RoundsTableOffset)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
_RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString();
|
||||
_RoundsTable[i].TextScores[p].Text = _PartyMode.GameData.Results[i + _RoundsTableOffset, p].ToString();
|
||||
else
|
||||
_RoundsTable[i].TextScores[p].Text = "";
|
||||
}
|
||||
@@ -506,7 +473,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
_RoundsTable[i].TextScores[p].Visible = false;
|
||||
}
|
||||
}
|
||||
if (_GameState.Combs.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible)
|
||||
if (_PartyMode.GameData.Rounds.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible)
|
||||
{
|
||||
_RoundsTable[i].Number.Visible = false;
|
||||
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
||||
@@ -518,7 +485,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
|
||||
_Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0;
|
||||
_Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0;
|
||||
_Buttons[_ButtonRoundsScrollDown].Visible = _PartyMode.GameData.Rounds.Count - _NumRoundsVisible - _RoundsTableOffset > 0;
|
||||
}
|
||||
|
||||
private void _BuildPlayerTable()
|
||||
@@ -578,7 +545,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
STableRow row = _PlayerTable[i];
|
||||
|
||||
if (i + _PlayerTableOffset < _GameState.ResultTable.Count)
|
||||
if (i + _PlayerTableOffset < _PartyMode.GameData.ResultTable.Count)
|
||||
{
|
||||
row.Pos.Visible = true;
|
||||
row.Name.Visible = true;
|
||||
@@ -587,12 +554,12 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
row.SingPoints.Visible = true;
|
||||
row.GamePoints.Visible = true;
|
||||
|
||||
row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + ".";
|
||||
row.Name.Text = CBase.Profiles.GetPlayerName(_GameState.ResultTable[i + _PlayerTableOffset].PlayerID);
|
||||
row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString();
|
||||
row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString();
|
||||
row.SingPoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString();
|
||||
row.GamePoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString();
|
||||
row.Pos.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].Position + ".";
|
||||
row.Name.Text = CBase.Profiles.GetPlayerName(_PartyMode.GameData.ResultTable[i + _PlayerTableOffset].PlayerID);
|
||||
row.Rounds.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString();
|
||||
row.Won.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumWon.ToString();
|
||||
row.SingPoints.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString();
|
||||
row.GamePoints.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -606,37 +573,37 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
}
|
||||
|
||||
_Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0;
|
||||
_Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
|
||||
_Buttons[_ButtonPlayerScrollDown].Visible = _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
|
||||
}
|
||||
|
||||
private void _ScrollPlayerTable(int offset)
|
||||
{
|
||||
if (_GameState.ProfileIDs.Count <= _NumPlayerVisible)
|
||||
if (_PartyMode.GameData.ProfileIDs.Count <= _NumPlayerVisible)
|
||||
_PlayerTableOffset = 0;
|
||||
else if (offset < 0 && _PlayerTableOffset + offset >= 0)
|
||||
_PlayerTableOffset += offset;
|
||||
else if (offset < 0 && _PlayerTableOffset + offset < 0)
|
||||
_PlayerTableOffset = 0;
|
||||
else if (offset > 0 && _PlayerTableOffset + offset <= _GameState.ProfileIDs.Count - _NumPlayerVisible)
|
||||
else if (offset > 0 && _PlayerTableOffset + offset <= _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible)
|
||||
_PlayerTableOffset += offset;
|
||||
else if (offset > 0 && _PlayerTableOffset + offset > _GameState.ProfileIDs.Count - _NumPlayerVisible)
|
||||
_PlayerTableOffset = _GameState.ProfileIDs.Count - _NumPlayerVisible;
|
||||
else if (offset > 0 && _PlayerTableOffset + offset > _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible)
|
||||
_PlayerTableOffset = _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible;
|
||||
|
||||
_UpdatePlayerTable();
|
||||
}
|
||||
|
||||
private void _ScrollRoundsTable(int offset)
|
||||
{
|
||||
if (_GameState.Combs.Count <= _NumRoundsVisible)
|
||||
if (_PartyMode.GameData.Rounds.Count <= _NumRoundsVisible)
|
||||
_RoundsTableOffset = 0;
|
||||
else if (offset < 0 && _RoundsTableOffset + offset >= 0)
|
||||
_RoundsTableOffset += offset;
|
||||
else if (offset < 0 && _RoundsTableOffset + offset < 0)
|
||||
_RoundsTableOffset = 0;
|
||||
else if (offset > 0 && _RoundsTableOffset + offset <= _GameState.Combs.Count - _NumRoundsVisible)
|
||||
else if (offset > 0 && _RoundsTableOffset + offset <= _PartyMode.GameData.Rounds.Count - _NumRoundsVisible)
|
||||
_RoundsTableOffset += offset;
|
||||
else if (offset > 0 && _RoundsTableOffset + offset > _GameState.Combs.Count - _NumRoundsVisible)
|
||||
_RoundsTableOffset = _GameState.Combs.Count - _NumRoundsVisible;
|
||||
else if (offset > 0 && _RoundsTableOffset + offset > _PartyMode.GameData.Rounds.Count - _NumRoundsVisible)
|
||||
_RoundsTableOffset = _PartyMode.GameData.Rounds.Count - _NumRoundsVisible;
|
||||
|
||||
_UpdateRoundsTable();
|
||||
}
|
||||
@@ -645,13 +612,13 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
{
|
||||
string s = "";
|
||||
|
||||
for (int i = 0; i < _GameState.ResultTable.Count; i++)
|
||||
for (int i = 0; i < _PartyMode.GameData.ResultTable.Count; i++)
|
||||
{
|
||||
if (_GameState.ResultTable[i].Position == 1)
|
||||
if (_PartyMode.GameData.ResultTable[i].Position == 1)
|
||||
{
|
||||
if (i > 0)
|
||||
s += ", ";
|
||||
s += CBase.Profiles.GetPlayerName(_GameState.ResultTable[i].PlayerID);
|
||||
s += CBase.Profiles.GetPlayerName(_PartyMode.GameData.ResultTable[i].PlayerID);
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
@@ -31,62 +30,38 @@ namespace VocaluxeLib.PartyModes.Challenge
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
private SDataFromScreen _Data;
|
||||
private new CPartyModeChallenge _PartyMode;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_Data.ScreenNames.ProfileIDs = new List<int>();
|
||||
_Data = new SDataFromScreen();
|
||||
var names = new SFromScreenNames {FadeBack = false, ProfileIDs = new List<int>()};
|
||||
_Data.ScreenNames = names;
|
||||
|
||||
_PartyMode = (CPartyModeChallenge)base._PartyMode;
|
||||
_AllowChangePlayerNum = false;
|
||||
}
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
{
|
||||
try
|
||||
{
|
||||
var config = (SDataToScreenNames)receivedData;
|
||||
_Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List<int>();
|
||||
|
||||
SetPartyModeData(config.NumPlayer);
|
||||
|
||||
while (_Data.ScreenNames.ProfileIDs.Count > _NumPlayer)
|
||||
_Data.ScreenNames.ProfileIDs.RemoveAt(_Data.ScreenNames.ProfileIDs.Count - 1);
|
||||
|
||||
List<int>[] ids = new List<int>[] {_Data.ScreenNames.ProfileIDs};
|
||||
SetPartyModeProfiles(ids);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
SetPartyModeData(_PartyMode.GameData.NumPlayer);
|
||||
while (_PartyMode.GameData.ProfileIDs.Count > _NumPlayer)
|
||||
_PartyMode.GameData.ProfileIDs.RemoveAt(_PartyMode.GameData.ProfileIDs.Count - 1);
|
||||
|
||||
List<int>[] ids = new List<int>[] {_PartyMode.GameData.ProfileIDs};
|
||||
SetPartyModeProfiles(ids);
|
||||
}
|
||||
|
||||
public override void Back()
|
||||
{
|
||||
SPartyNameOptions options = GetData();
|
||||
if (options.TeamList.Length == 1)
|
||||
_Data.ScreenNames.ProfileIDs = options.TeamList[0];
|
||||
_Data.ScreenNames.FadeBack = true;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
if (_TeamList.Length == 1)
|
||||
_PartyMode.GameData.ProfileIDs = _TeamList[0];
|
||||
_PartyMode.Back();
|
||||
}
|
||||
|
||||
public override void Next()
|
||||
{
|
||||
SPartyNameOptions options = GetData();
|
||||
if (options.TeamList.Length == 1)
|
||||
_Data.ScreenNames.ProfileIDs = options.TeamList[0];
|
||||
_Data.ScreenNames.FadeBack = false;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
if (_TeamList.Length == 1)
|
||||
_PartyMode.GameData.ProfileIDs = _TeamList[0];
|
||||
_PartyMode.Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,6 +28,16 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
public readonly List<CCombination> Rounds;
|
||||
|
||||
public int Count
|
||||
{
|
||||
get { return Rounds.Count; }
|
||||
}
|
||||
|
||||
public CCombination this[int index]
|
||||
{
|
||||
get { return Rounds[index]; }
|
||||
}
|
||||
|
||||
public CChallengeRounds(int numRounds, int numPlayer, int numPlayerAtOnce)
|
||||
{
|
||||
Rounds = new List<CCombination>();
|
||||
@@ -59,7 +69,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
Rounds.Add(combinations.GetNextCombination(_GetPlayerDemand(i)));
|
||||
}
|
||||
|
||||
private List<int> _GetPlayerDemand(int roundIndex)
|
||||
private IEnumerable<int> _GetPlayerDemand(int roundIndex)
|
||||
{
|
||||
List<int> numPlayed = new List<int>(_NumPlayer);
|
||||
for (int i = 0; i < _NumPlayer; i++)
|
||||
|
||||
@@ -21,40 +21,13 @@ using System.Collections.ObjectModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using VocaluxeLib.Game;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Songs;
|
||||
using VocaluxeLib.Profile;
|
||||
using VocaluxeLib.Songs;
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
|
||||
#region Communication
|
||||
|
||||
#region ToScreen
|
||||
public struct SDataToScreenConfig
|
||||
{
|
||||
public int NumPlayer;
|
||||
public int NumPlayerAtOnce;
|
||||
public int NumRounds;
|
||||
}
|
||||
|
||||
public struct SDataToScreenNames
|
||||
{
|
||||
public int NumPlayer;
|
||||
public List<int> ProfileIDs;
|
||||
}
|
||||
|
||||
public struct SDataToScreenMain
|
||||
{
|
||||
public int CurrentRoundNr;
|
||||
public int NumPlayerAtOnce;
|
||||
public List<CCombination> Combs;
|
||||
public int[,] Results;
|
||||
public List<CResultTableRow> ResultTable;
|
||||
public List<int> ProfileIDs;
|
||||
}
|
||||
|
||||
public class CResultTableRow : IComparable
|
||||
{
|
||||
public int Position;
|
||||
@@ -66,7 +39,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
public int CompareTo(object obj)
|
||||
{
|
||||
CResultTableRow row = obj as CResultTableRow;
|
||||
var row = obj as CResultTableRow;
|
||||
if (row != null)
|
||||
{
|
||||
int res = row.NumGamePoints.CompareTo(NumGamePoints);
|
||||
@@ -82,39 +55,21 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
throw new ArgumentException("object is not a ResultTableRow");
|
||||
}
|
||||
}
|
||||
#endregion ToScreen
|
||||
|
||||
#region FromScreen
|
||||
public struct SDataFromScreen
|
||||
public abstract class CPartyScreenChallengeMedley : CMenuParty
|
||||
{
|
||||
public SFromScreenConfig ScreenConfig;
|
||||
public SFromScreenNames ScreenNames;
|
||||
public SFromScreenMain ScreenMain;
|
||||
protected new CPartyModeChallengeMedley _PartyMode;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
_PartyMode = (CPartyModeChallengeMedley)base._PartyMode;
|
||||
}
|
||||
}
|
||||
|
||||
public struct SFromScreenConfig
|
||||
{
|
||||
public int NumPlayer;
|
||||
public int NumPlayerAtOnce;
|
||||
public int NumRounds;
|
||||
}
|
||||
|
||||
public struct SFromScreenNames
|
||||
{
|
||||
public bool FadeToConfig;
|
||||
public List<int> ProfileIDs;
|
||||
}
|
||||
|
||||
public struct SFromScreenMain
|
||||
{
|
||||
public bool FadeToSongSelection;
|
||||
public bool FadeToNameSelection;
|
||||
}
|
||||
#endregion FromScreen
|
||||
|
||||
#endregion Communication
|
||||
|
||||
// ReSharper disable ClassNeverInstantiated.Global
|
||||
public sealed class CPartyModeChallengeMedley : CPartyMode
|
||||
// ReSharper restore ClassNeverInstantiated.Global
|
||||
{
|
||||
private const int _MaxPlayer = 12;
|
||||
private const int _MinPlayer = 1;
|
||||
@@ -125,14 +80,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private enum EStage
|
||||
{
|
||||
NotStarted,
|
||||
Config,
|
||||
Names,
|
||||
Main,
|
||||
Singing
|
||||
}
|
||||
|
||||
private struct SData
|
||||
public struct SData
|
||||
{
|
||||
public int NumPlayer;
|
||||
public int NumPlayerAtOnce;
|
||||
@@ -156,11 +110,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public int Won;
|
||||
}
|
||||
|
||||
private SDataToScreenConfig _ToScreenConfig;
|
||||
private SDataToScreenNames _ToScreenNames;
|
||||
private SDataToScreenMain _ToScreenMain;
|
||||
|
||||
private SData _GameData;
|
||||
public SData GameData;
|
||||
private EStage _Stage;
|
||||
|
||||
public CPartyModeChallengeMedley(int id, string folder)
|
||||
@@ -176,103 +126,26 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
|
||||
|
||||
_Stage = EStage.NotStarted;
|
||||
|
||||
_ToScreenConfig = new SDataToScreenConfig();
|
||||
_ToScreenNames = new SDataToScreenNames();
|
||||
_ToScreenMain = new SDataToScreenMain();
|
||||
|
||||
_GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 2, CurrentRoundNr = 1, ProfileIDs = new List<int>(), CatSongIndices = null, Results = null};
|
||||
GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, CurrentRoundNr = 1, ProfileIDs = new List<int>(), CatSongIndices = null, Results = null};
|
||||
}
|
||||
|
||||
public override bool Init()
|
||||
{
|
||||
_Stage = EStage.NotStarted;
|
||||
_Stage = EStage.Config;
|
||||
|
||||
_ScreenSongOptions.Sorting.IgnoreArticles = EOffOn.TR_CONFIG_OFF;
|
||||
_ScreenSongOptions.Sorting.SongSorting = ESongSorting.TR_CONFIG_NONE;
|
||||
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_OFF;
|
||||
_ScreenSongOptions.Selection.SongIndex = -1;
|
||||
|
||||
_ToScreenMain.ResultTable = new List<CResultTableRow>();
|
||||
_GameData.ResultTable = new List<CResultTableRow>();
|
||||
|
||||
CBase.Songs.SortSongs(ESongSorting.TR_CONFIG_NONE, EOffOn.TR_CONFIG_OFF, EOffOn.TR_CONFIG_OFF, String.Empty, EDuetOptions.NoDuets);
|
||||
CBase.Songs.SetCategory(0);
|
||||
|
||||
GameData.ResultTable = new List<CResultTableRow>();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void DataFromScreen(string screenName, Object data)
|
||||
{
|
||||
SDataFromScreen dataFrom;
|
||||
switch (screenName)
|
||||
{
|
||||
case "PartyScreenChallengeMedleyConfig":
|
||||
|
||||
try
|
||||
{
|
||||
dataFrom = (SDataFromScreen)data;
|
||||
_GameData.NumPlayer = dataFrom.ScreenConfig.NumPlayer;
|
||||
_GameData.NumPlayerAtOnce = dataFrom.ScreenConfig.NumPlayerAtOnce;
|
||||
_GameData.NumRounds = dataFrom.ScreenConfig.NumRounds;
|
||||
|
||||
_Stage = EStage.Config;
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
|
||||
}
|
||||
break;
|
||||
|
||||
case "PartyScreenChallengeMedleyNames":
|
||||
try
|
||||
{
|
||||
dataFrom = (SDataFromScreen)data;
|
||||
if (dataFrom.ScreenNames.FadeToConfig)
|
||||
_Stage = EStage.NotStarted;
|
||||
else
|
||||
{
|
||||
_GameData.ProfileIDs = dataFrom.ScreenNames.ProfileIDs;
|
||||
_Stage = EStage.Names;
|
||||
}
|
||||
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
|
||||
}
|
||||
break;
|
||||
|
||||
case "PartyScreenChallengeMedleyMain":
|
||||
try
|
||||
{
|
||||
dataFrom = (SDataFromScreen)data;
|
||||
if (dataFrom.ScreenMain.FadeToSongSelection)
|
||||
_Stage = EStage.Singing;
|
||||
if (dataFrom.ScreenMain.FadeToNameSelection)
|
||||
_Stage = EStage.Config;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode challenge. Can't cast received data from screen " + screenName + ". " + e.Message);
|
||||
}
|
||||
|
||||
|
||||
if (_Stage == EStage.Singing)
|
||||
_StartNextRound();
|
||||
if (_Stage == EStage.Config)
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
break;
|
||||
|
||||
default:
|
||||
CBase.Log.LogError("Error in party mode challenge. Wrong screen is sending: " + screenName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateGame()
|
||||
{
|
||||
/*
|
||||
@@ -282,78 +155,79 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_ScreenSongOptions.Selection.RandomOnly = false;*/
|
||||
}
|
||||
|
||||
public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen)
|
||||
private IMenu _GetNextScreen()
|
||||
{
|
||||
CMenuParty screen = null;
|
||||
alternativeScreen = EScreens.ScreenSong;
|
||||
|
||||
switch (_Stage)
|
||||
{
|
||||
case EStage.NotStarted:
|
||||
_Screens.TryGetValue("CPartyScreenChallengeMedleyConfig", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
_ToScreenConfig.NumPlayer = _GameData.NumPlayer;
|
||||
_ToScreenConfig.NumPlayerAtOnce = _GameData.NumPlayerAtOnce;
|
||||
_ToScreenConfig.NumRounds = _GameData.NumRounds;
|
||||
screen.DataToScreen(_ToScreenConfig);
|
||||
}
|
||||
break;
|
||||
case EStage.Config:
|
||||
_Screens.TryGetValue("CPartyScreenChallengeMedleyNames", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
_ToScreenNames.NumPlayer = _GameData.NumPlayer;
|
||||
_ToScreenNames.ProfileIDs = _GameData.ProfileIDs;
|
||||
screen.DataToScreen(_ToScreenNames);
|
||||
}
|
||||
return _Screens["CPartyScreenChallengeMedleyConfig"];
|
||||
case EStage.Names:
|
||||
return _Screens["CPartyScreenChallengeMedleyNames"];
|
||||
case EStage.Main:
|
||||
return _Screens["CPartyScreenChallengeMedleyMain"];
|
||||
case EStage.Singing:
|
||||
return CBase.Graphics.GetScreen(EScreen.Song);
|
||||
default:
|
||||
throw new ArgumentException("Invalid stage: " + _Stage);
|
||||
}
|
||||
}
|
||||
|
||||
private void _FadeToScreen()
|
||||
{
|
||||
CBase.Graphics.FadeTo(_GetNextScreen());
|
||||
}
|
||||
|
||||
public void Next()
|
||||
{
|
||||
switch (_Stage)
|
||||
{
|
||||
case EStage.Config:
|
||||
_Stage = EStage.Names;
|
||||
break;
|
||||
case EStage.Names:
|
||||
_Screens.TryGetValue("CPartyScreenChallengeMedleyMain", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
CBase.Songs.ResetSongSung();
|
||||
_ToScreenMain.ResultTable = new List<CResultTableRow>();
|
||||
_GameData.ResultTable = new List<CResultTableRow>();
|
||||
_GameData.Rounds = new CChallengeRounds(_GameData.NumRounds, _GameData.NumPlayer, _GameData.NumPlayerAtOnce);
|
||||
_GameData.CurrentRoundNr = 1;
|
||||
_ToScreenMain.CurrentRoundNr = 1;
|
||||
_ToScreenMain.NumPlayerAtOnce = _GameData.NumPlayerAtOnce;
|
||||
_ToScreenMain.Combs = _GameData.Rounds.Rounds;
|
||||
_ToScreenMain.ProfileIDs = _GameData.ProfileIDs;
|
||||
_UpdateScores();
|
||||
_ToScreenMain.ResultTable = _GameData.ResultTable;
|
||||
_ToScreenMain.Results = _GameData.Results;
|
||||
screen.DataToScreen(_ToScreenMain);
|
||||
}
|
||||
_Stage = EStage.Main;
|
||||
CBase.Songs.ResetSongSung();
|
||||
GameData.ResultTable = new List<CResultTableRow>();
|
||||
GameData.Rounds = new CChallengeRounds(GameData.NumRounds, GameData.NumPlayer, GameData.NumPlayerAtOnce);
|
||||
GameData.CurrentRoundNr = 1;
|
||||
break;
|
||||
case EStage.Main:
|
||||
//nothing to do
|
||||
_Stage = EStage.Singing;
|
||||
if (!_StartNextRound())
|
||||
CBase.Graphics.FadeTo(EScreen.Party);
|
||||
break;
|
||||
case EStage.Singing:
|
||||
_Screens.TryGetValue("CPartyScreenChallengeMedleyMain", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
_UpdateScores();
|
||||
_ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr;
|
||||
_ToScreenMain.Combs = _GameData.Rounds.Rounds;
|
||||
_ToScreenMain.Results = _GameData.Results;
|
||||
screen.DataToScreen(_ToScreenMain);
|
||||
}
|
||||
_Stage = EStage.Main;
|
||||
_UpdateScores();
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Invalid stage: " + _Stage);
|
||||
}
|
||||
|
||||
return screen;
|
||||
_FadeToScreen();
|
||||
}
|
||||
|
||||
public override EScreens GetStartScreen()
|
||||
public void Back()
|
||||
{
|
||||
return EScreens.ScreenPartyDummy;
|
||||
switch (_Stage)
|
||||
{
|
||||
case EStage.Config:
|
||||
CBase.Graphics.FadeTo(EScreen.Party);
|
||||
return;
|
||||
case EStage.Names:
|
||||
_Stage = EStage.Config;
|
||||
break;
|
||||
case EStage.Main:
|
||||
_Stage = EStage.Config;
|
||||
break;
|
||||
default: // Rest is not allowed
|
||||
throw new ArgumentException("Invalid stage: " + _Stage);
|
||||
}
|
||||
_FadeToScreen();
|
||||
}
|
||||
|
||||
public override EScreens GetMainScreen()
|
||||
public override IMenu GetStartScreen()
|
||||
{
|
||||
return EScreens.ScreenPartyDummy;
|
||||
return _Screens["CPartyScreenChallengeMedleyConfig"];
|
||||
}
|
||||
|
||||
public override SScreenSongOptions GetScreenSongOptions()
|
||||
@@ -376,10 +250,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_ScreenSongOptions.Selection.SelectNextRandomSong = false;
|
||||
_CreateCatSongIndices();
|
||||
|
||||
if (_GameData.CatSongIndices != null)
|
||||
if (GameData.CatSongIndices != null)
|
||||
{
|
||||
if (_GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1)
|
||||
_GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex;
|
||||
if (GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] == -1)
|
||||
GameData.CatSongIndices[CBase.Songs.GetCurrentCategoryIndex()] = songIndex;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,15 +264,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
public override void OnCategoryChange(int categoryIndex, ref SScreenSongOptions screenSongOptions)
|
||||
// ReSharper restore RedundantAssignment
|
||||
{
|
||||
if (_GameData.CatSongIndices != null && categoryIndex != -1)
|
||||
if (GameData.CatSongIndices != null && categoryIndex != -1)
|
||||
{
|
||||
if (_GameData.CatSongIndices[categoryIndex] == -1)
|
||||
if (GameData.CatSongIndices[categoryIndex] == -1)
|
||||
_ScreenSongOptions.Selection.SelectNextRandomSong = true;
|
||||
else
|
||||
_ScreenSongOptions.Selection.SongIndex = _GameData.CatSongIndices[categoryIndex];
|
||||
_ScreenSongOptions.Selection.SongIndex = GameData.CatSongIndices[categoryIndex];
|
||||
}
|
||||
|
||||
if (_GameData.CatSongIndices == null && categoryIndex != -1)
|
||||
if (GameData.CatSongIndices == null && categoryIndex != -1)
|
||||
_ScreenSongOptions.Selection.SelectNextRandomSong = true;
|
||||
|
||||
if (categoryIndex == -1)
|
||||
@@ -458,22 +332,19 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
public override void LeavingHighscore()
|
||||
{
|
||||
for (int i = 0; i < CBase.Game.GetNumSongs(); i++)
|
||||
CBase.Songs.AddPartySongSung(CBase.Game.GetSong(i).ID);
|
||||
_GameData.CurrentRoundNr++;
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
GameData.CurrentRoundNr++;
|
||||
Next();
|
||||
}
|
||||
|
||||
private void _StartNextRound()
|
||||
private bool _StartNextRound()
|
||||
{
|
||||
_ScreenSongOptions.Selection.RandomOnly = _ScreenSongOptions.Sorting.Tabs != EOffOn.TR_CONFIG_ON;
|
||||
_ScreenSongOptions.Selection.CategoryChangeAllowed = _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON;
|
||||
_SetNumJokers();
|
||||
_SetTeamNames();
|
||||
_GameData.CatSongIndices = null;
|
||||
GameData.CatSongIndices = null;
|
||||
|
||||
if (_RandomizeSongs())
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenSing);
|
||||
return _RandomizeSongs();
|
||||
}
|
||||
|
||||
private bool _RandomizeSongs()
|
||||
@@ -482,27 +353,27 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
CBase.Game.ClearSongs();
|
||||
|
||||
#region PlayerNames
|
||||
CBase.Game.SetNumPlayer(_GameData.NumPlayerAtOnce);
|
||||
CBase.Game.SetNumPlayer(GameData.NumPlayerAtOnce);
|
||||
SPlayer[] players = CBase.Game.GetPlayers();
|
||||
if (players == null)
|
||||
return false;
|
||||
|
||||
if (players.Length < _GameData.NumPlayerAtOnce)
|
||||
if (players.Length < GameData.NumPlayerAtOnce)
|
||||
return false;
|
||||
|
||||
CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
|
||||
CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
|
||||
|
||||
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
//try to fill with the right data
|
||||
if (c != null)
|
||||
players[i].ProfileID = _GameData.ProfileIDs[c.Player[i]];
|
||||
players[i].ProfileID = GameData.ProfileIDs[c.Player[i]];
|
||||
else
|
||||
players[i].ProfileID = -1;
|
||||
}
|
||||
#endregion PlayerNames
|
||||
|
||||
#region SongQueue
|
||||
#region SongQueue
|
||||
if (CBase.Songs.GetNumSongsVisible() < _NumSongs)
|
||||
CBase.Songs.ResetSongSung();
|
||||
|
||||
@@ -512,7 +383,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
if (visibleSongs.Count == 0)
|
||||
{
|
||||
CBase.Log.LogError("CPartyChallengeMedleyMode Error: There are no songs!");
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenParty);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -536,7 +406,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
if (ids.Count == 0)
|
||||
{
|
||||
CBase.Log.LogError("CPartyChallengeMedleyMode Error: There are no medley songs!");
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenParty);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -545,6 +414,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
int songID = ids[CBase.Game.GetRandom(ids.Count)];
|
||||
CBase.Game.AddSong(songID, EGameMode.TR_GAMEMODE_MEDLEY);
|
||||
CBase.Songs.AddPartySongSung(songID);
|
||||
ids.Remove(songID);
|
||||
s++;
|
||||
}
|
||||
@@ -554,7 +424,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private void _SetNumJokers()
|
||||
{
|
||||
switch (_GameData.NumPlayerAtOnce)
|
||||
switch (GameData.NumPlayerAtOnce)
|
||||
{
|
||||
case 1:
|
||||
_ScreenSongOptions.Selection.NumJokers = new int[] {10};
|
||||
@@ -589,21 +459,27 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
CProfile[] profiles = CBase.Profiles.GetProfiles();
|
||||
|
||||
if (_GameData.NumPlayerAtOnce < 1 || _GameData.ProfileIDs.Count < _GameData.NumPlayerAtOnce || profiles.Length < _GameData.NumPlayerAtOnce)
|
||||
if (profiles == null)
|
||||
{
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
|
||||
return;
|
||||
}
|
||||
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[_GameData.NumPlayerAtOnce];
|
||||
CCombination c = _GameData.Rounds.GetRound(_GameData.CurrentRoundNr - 1);
|
||||
if (GameData.NumPlayerAtOnce < 1 || GameData.ProfileIDs.Count < GameData.NumPlayerAtOnce || profiles.Length < GameData.NumPlayerAtOnce)
|
||||
{
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[] {"foo", "bar"};
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
||||
_ScreenSongOptions.Selection.TeamNames = new string[GameData.NumPlayerAtOnce];
|
||||
CCombination c = GameData.Rounds.GetRound(GameData.CurrentRoundNr - 1);
|
||||
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
if (c != null)
|
||||
{
|
||||
if (_GameData.ProfileIDs[c.Player[i]] < profiles.Length)
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = profiles[_GameData.ProfileIDs[c.Player[i]]].PlayerName;
|
||||
if (GameData.ProfileIDs[c.Player[i]] < profiles.Length)
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = profiles[GameData.ProfileIDs[c.Player[i]]].PlayerName;
|
||||
else
|
||||
_ScreenSongOptions.Selection.TeamNames[i] = "foobar";
|
||||
}
|
||||
@@ -614,32 +490,32 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private void _UpdateScores()
|
||||
{
|
||||
if (_GameData.ResultTable.Count == 0)
|
||||
if (GameData.ResultTable.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < _GameData.NumPlayer; i++)
|
||||
for (int i = 0; i < GameData.NumPlayer; i++)
|
||||
{
|
||||
CResultTableRow row = new CResultTableRow {PlayerID = _GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0};
|
||||
_GameData.ResultTable.Add(row);
|
||||
CResultTableRow row = new CResultTableRow {PlayerID = GameData.ProfileIDs[i], NumPlayed = 0, NumWon = 0, NumSingPoints = 0, NumGamePoints = 0};
|
||||
GameData.ResultTable.Add(row);
|
||||
}
|
||||
|
||||
_GameData.Results = new int[_GameData.NumRounds,_GameData.NumPlayerAtOnce];
|
||||
for (int i = 0; i < _GameData.NumRounds; i++)
|
||||
GameData.Results = new int[GameData.NumRounds,GameData.NumPlayerAtOnce];
|
||||
for (int i = 0; i < GameData.NumRounds; i++)
|
||||
{
|
||||
for (int j = 0; j < _GameData.NumPlayerAtOnce; j++)
|
||||
_GameData.Results[i, j] = 0;
|
||||
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
|
||||
GameData.Results[i, j] = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CPoints gamePoints = CBase.Game.GetPoints();
|
||||
if (gamePoints == null || gamePoints.NumPlayer < _GameData.NumPlayerAtOnce)
|
||||
if (gamePoints == null || gamePoints.NumPlayer < GameData.NumPlayerAtOnce)
|
||||
return;
|
||||
|
||||
SPlayer[] results = gamePoints.GetPlayer(0, _GameData.NumPlayerAtOnce);
|
||||
SPlayer[] results = gamePoints.GetPlayer(0, GameData.NumPlayerAtOnce);
|
||||
if (results == null)
|
||||
return;
|
||||
|
||||
if (results.Length < _GameData.NumPlayerAtOnce)
|
||||
if (results.Length < GameData.NumPlayerAtOnce)
|
||||
return;
|
||||
|
||||
if (gamePoints.NumRounds == 0)
|
||||
@@ -647,25 +523,25 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
for (int i = 1; i < gamePoints.NumRounds; i++)
|
||||
{
|
||||
SPlayer[] temp = gamePoints.GetPlayer(i, _GameData.NumPlayerAtOnce);
|
||||
for (int p = 0; p < _GameData.NumPlayerAtOnce; p++)
|
||||
SPlayer[] temp = gamePoints.GetPlayer(i, GameData.NumPlayerAtOnce);
|
||||
for (int p = 0; p < GameData.NumPlayerAtOnce; p++)
|
||||
results[p].Points += temp[p].Points;
|
||||
}
|
||||
|
||||
for (int j = 0; j < _GameData.NumPlayerAtOnce; j++)
|
||||
for (int j = 0; j < GameData.NumPlayerAtOnce; j++)
|
||||
{
|
||||
results[j].Points = results[j].Points / gamePoints.NumRounds;
|
||||
_GameData.Results[_GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
|
||||
GameData.Results[GameData.CurrentRoundNr - 2, j] = (int)Math.Round(results[j].Points);
|
||||
}
|
||||
|
||||
List<SStats> points = _GetPointsForPlayer(results);
|
||||
|
||||
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
int index = -1;
|
||||
for (int j = 0; j < _GameData.ResultTable.Count; j++)
|
||||
for (int j = 0; j < GameData.ResultTable.Count; j++)
|
||||
{
|
||||
if (points[i].ProfileID == _GameData.ResultTable[j].PlayerID)
|
||||
if (points[i].ProfileID == GameData.ResultTable[j].PlayerID)
|
||||
{
|
||||
index = j;
|
||||
break;
|
||||
@@ -674,25 +550,25 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
CResultTableRow row = _GameData.ResultTable[index];
|
||||
CResultTableRow row = GameData.ResultTable[index];
|
||||
|
||||
row.NumPlayed++;
|
||||
row.NumWon += points[i].Won;
|
||||
row.NumSingPoints += points[i].SingPoints;
|
||||
row.NumGamePoints += points[i].GamePoints;
|
||||
|
||||
_GameData.ResultTable[index] = row;
|
||||
GameData.ResultTable[index] = row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_GameData.ResultTable.Sort();
|
||||
GameData.ResultTable.Sort();
|
||||
|
||||
//Update position-number
|
||||
int pos = 1;
|
||||
int lastPoints = 0;
|
||||
int lastSingPoints = 0;
|
||||
foreach (CResultTableRow resultRow in _GameData.ResultTable)
|
||||
foreach (CResultTableRow resultRow in GameData.ResultTable)
|
||||
{
|
||||
if (lastPoints > resultRow.NumGamePoints || lastSingPoints > resultRow.NumSingPoints)
|
||||
pos++;
|
||||
@@ -704,10 +580,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private List<SStats> _GetPointsForPlayer(SPlayer[] results)
|
||||
{
|
||||
List<SStats> result = new List<SStats>();
|
||||
for (int i = 0; i < _GameData.NumPlayerAtOnce; i++)
|
||||
var result = new List<SStats>();
|
||||
for (int i = 0; i < GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
SStats stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0};
|
||||
var stat = new SStats {ProfileID = results[i].ProfileID, SingPoints = (int)Math.Round(results[i].Points), Won = 0, GamePoints = 0};
|
||||
result.Add(stat);
|
||||
}
|
||||
|
||||
@@ -753,15 +629,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private void _CreateCatSongIndices()
|
||||
{
|
||||
if (_GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
|
||||
if (GameData.CatSongIndices == null && CBase.Songs.GetNumCategories() > 0 && _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_ON)
|
||||
{
|
||||
_GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()];
|
||||
for (int i = 0; i < _GameData.CatSongIndices.Length; i++)
|
||||
_GameData.CatSongIndices[i] = -1;
|
||||
GameData.CatSongIndices = new int[CBase.Songs.GetNumCategories()];
|
||||
for (int i = 0; i < GameData.CatSongIndices.Length; i++)
|
||||
GameData.CatSongIndices[i] = -1;
|
||||
}
|
||||
|
||||
if (CBase.Songs.GetNumCategories() == 0 || _ScreenSongOptions.Sorting.Tabs == EOffOn.TR_CONFIG_OFF)
|
||||
_GameData.CatSongIndices = null;
|
||||
GameData.CatSongIndices = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,12 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
// ReSharper disable UnusedMember.Global
|
||||
public class CPartyScreenChallengeMedleyConfig : CMenuParty
|
||||
public class CPartyScreenChallengeMedleyConfig : CPartyScreenChallengeMedley
|
||||
// ReSharper restore UnusedMember.Global
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
@@ -41,33 +39,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private int _MaxNumRounds = 100;
|
||||
private int _RoundSteps = 1;
|
||||
|
||||
private SDataFromScreen _Data;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_ThemeSelectSlides = new string[] {_SelectSlideNumPlayers, _SelectSlideNumMics, _SelectSlideNumRounds};
|
||||
_ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
|
||||
|
||||
_Data = new SDataFromScreen();
|
||||
SFromScreenConfig config = new SFromScreenConfig {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12};
|
||||
_Data.ScreenConfig = config;
|
||||
}
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
{
|
||||
try
|
||||
{
|
||||
SDataToScreenConfig config = (SDataToScreenConfig)receivedData;
|
||||
_Data.ScreenConfig.NumPlayer = config.NumPlayer;
|
||||
_Data.ScreenConfig.NumPlayerAtOnce = config.NumPlayerAtOnce;
|
||||
_Data.ScreenConfig.NumRounds = config.NumRounds;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen challenge config. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
@@ -81,17 +58,17 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
_UpdateSlides();
|
||||
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
_Next();
|
||||
_PartyMode.Next();
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
@@ -114,14 +91,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
_UpdateSlides();
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
_Next();
|
||||
_PartyMode.Next();
|
||||
}
|
||||
|
||||
if (mouseEvent.RB)
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -150,7 +127,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_SelectSlides[_SelectSlideNumPlayers].Clear();
|
||||
for (int i = _PartyMode.GetMinPlayer(); i <= _PartyMode.GetMaxPlayer(); i++)
|
||||
_SelectSlides[_SelectSlideNumPlayers].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumPlayers].Selection = _Data.ScreenConfig.NumPlayer - _PartyMode.GetMinPlayer();
|
||||
_SelectSlides[_SelectSlideNumPlayers].Selection = _PartyMode.GameData.NumPlayer - _PartyMode.GetMinPlayer();
|
||||
|
||||
_UpdateMicsAtOnce();
|
||||
_SetRoundSteps();
|
||||
@@ -159,21 +136,21 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private void _UpdateSlides()
|
||||
{
|
||||
int player = _Data.ScreenConfig.NumPlayer;
|
||||
int mics = _Data.ScreenConfig.NumPlayerAtOnce;
|
||||
_Data.ScreenConfig.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
|
||||
_Data.ScreenConfig.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
|
||||
_Data.ScreenConfig.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
|
||||
int player = _PartyMode.GameData.NumPlayer;
|
||||
int mics = _PartyMode.GameData.NumPlayerAtOnce;
|
||||
_PartyMode.GameData.NumPlayer = _SelectSlides[_SelectSlideNumPlayers].Selection + _PartyMode.GetMinPlayer();
|
||||
_PartyMode.GameData.NumPlayerAtOnce = _SelectSlides[_SelectSlideNumMics].Selection + _PartyMode.GetMinPlayer();
|
||||
_PartyMode.GameData.NumRounds = (_SelectSlides[_SelectSlideNumRounds].Selection + 1) * _RoundSteps;
|
||||
|
||||
_UpdateMicsAtOnce();
|
||||
_SetRoundSteps();
|
||||
|
||||
if (player != _Data.ScreenConfig.NumPlayer || mics != _Data.ScreenConfig.NumPlayerAtOnce)
|
||||
if (player != _PartyMode.GameData.NumPlayer || mics != _PartyMode.GameData.NumPlayerAtOnce)
|
||||
{
|
||||
int num = CHelper.CombinationCount(_Data.ScreenConfig.NumPlayer, _Data.ScreenConfig.NumPlayerAtOnce);
|
||||
int num = CHelper.CombinationCount(_PartyMode.GameData.NumPlayer, _PartyMode.GameData.NumPlayerAtOnce);
|
||||
while (num > _MaxNumRounds)
|
||||
num -= _RoundSteps;
|
||||
_Data.ScreenConfig.NumRounds = num;
|
||||
_PartyMode.GameData.NumRounds = num;
|
||||
}
|
||||
|
||||
_UpdateSlideRounds();
|
||||
@@ -181,19 +158,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private void _UpdateMicsAtOnce()
|
||||
{
|
||||
//Data.ScreenConfig.NumPlayerAtOnce
|
||||
int maxNum = _MaxNumMics;
|
||||
if (_Data.ScreenConfig.NumPlayer < _MaxNumMics)
|
||||
maxNum = _Data.ScreenConfig.NumPlayer;
|
||||
if (_PartyMode.GameData.NumPlayer < _MaxNumMics)
|
||||
maxNum = _PartyMode.GameData.NumPlayer;
|
||||
|
||||
if (_Data.ScreenConfig.NumPlayerAtOnce > maxNum)
|
||||
_Data.ScreenConfig.NumPlayerAtOnce = maxNum;
|
||||
if (_PartyMode.GameData.NumPlayerAtOnce > maxNum)
|
||||
_PartyMode.GameData.NumPlayerAtOnce = maxNum;
|
||||
|
||||
// build mics at once slide
|
||||
_SelectSlides[_SelectSlideNumMics].Clear();
|
||||
for (int i = 1; i <= maxNum; i++)
|
||||
_SelectSlides[_SelectSlideNumMics].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumMics].Selection = _Data.ScreenConfig.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
|
||||
_SelectSlides[_SelectSlideNumMics].Selection = _PartyMode.GameData.NumPlayerAtOnce - _PartyMode.GetMinPlayer();
|
||||
}
|
||||
|
||||
private void _UpdateSlideRounds()
|
||||
@@ -202,31 +178,21 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_SelectSlides[_SelectSlideNumRounds].Clear();
|
||||
for (int i = _RoundSteps; i <= _MaxNumRounds; i += _RoundSteps)
|
||||
_SelectSlides[_SelectSlideNumRounds].AddValue(i.ToString());
|
||||
_SelectSlides[_SelectSlideNumRounds].Selection = _Data.ScreenConfig.NumRounds / _RoundSteps - 1;
|
||||
_SelectSlides[_SelectSlideNumRounds].Selection = _PartyMode.GameData.NumRounds / _RoundSteps - 1;
|
||||
}
|
||||
|
||||
private void _SetRoundSteps()
|
||||
{
|
||||
if (_Data.ScreenConfig.NumPlayerAtOnce < 1 || _Data.ScreenConfig.NumPlayer < 1 || _Data.ScreenConfig.NumPlayerAtOnce > _Data.ScreenConfig.NumPlayer)
|
||||
if (_PartyMode.GameData.NumPlayerAtOnce < 1 || _PartyMode.GameData.NumPlayer < 1 || _PartyMode.GameData.NumPlayerAtOnce > _PartyMode.GameData.NumPlayer)
|
||||
{
|
||||
_RoundSteps = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
int res = _Data.ScreenConfig.NumPlayer / _Data.ScreenConfig.NumPlayerAtOnce;
|
||||
int mod = _Data.ScreenConfig.NumPlayer % _Data.ScreenConfig.NumPlayerAtOnce;
|
||||
int res = _PartyMode.GameData.NumPlayer / _PartyMode.GameData.NumPlayerAtOnce;
|
||||
int mod = _PartyMode.GameData.NumPlayer % _PartyMode.GameData.NumPlayerAtOnce;
|
||||
|
||||
_RoundSteps = mod == 0 ? res : _Data.ScreenConfig.NumPlayer;
|
||||
}
|
||||
|
||||
private void _Back()
|
||||
{
|
||||
_FadeTo(EScreens.ScreenParty);
|
||||
}
|
||||
|
||||
private void _Next()
|
||||
{
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
_RoundSteps = mod == 0 ? res : _PartyMode.GameData.NumPlayer;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
}
|
||||
|
||||
// ReSharper disable UnusedMember.Global
|
||||
public class CPartyScreenChallengeMedleyMain : CMenuParty
|
||||
public class CPartyScreenChallengeMedleyMain : CPartyScreenChallengeMedley
|
||||
// ReSharper restore UnusedMember.Global
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
@@ -79,8 +79,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private bool _ExitPopupVisible;
|
||||
|
||||
private SDataFromScreen _Data;
|
||||
private SDataToScreenMain _GameState;
|
||||
private List<STableRow> _PlayerTable;
|
||||
private List<CRoundsTableRow> _RoundsTable;
|
||||
|
||||
@@ -94,11 +92,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private const int _NumPlayerVisible = 10;
|
||||
private int _NumRoundsVisible = 3;
|
||||
|
||||
public CPartyScreenChallengeMedleyMain()
|
||||
{
|
||||
_Data = new SDataFromScreen {ScreenMain = new SFromScreenMain()};
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -121,7 +114,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
base.LoadTheme(xmlPath);
|
||||
|
||||
_GameState = new SDataToScreenMain();
|
||||
_BuildPlayerTable();
|
||||
_CreateRoundsTable();
|
||||
_NextPlayerTexts = new List<CText>();
|
||||
@@ -137,19 +129,6 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_Statics[_StaticNextPlayer].Visible = false;
|
||||
}
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
{
|
||||
try
|
||||
{
|
||||
var data = (SDataToScreenMain)receivedData;
|
||||
_GameState = data;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen challenge main. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
{
|
||||
base.HandleInput(keyEvent);
|
||||
@@ -163,8 +142,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
case Keys.Escape:
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (_GameState.CurrentRoundNr == 1)
|
||||
_Back();
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1)
|
||||
_PartyMode.Back();
|
||||
else
|
||||
_ShowPopup(true);
|
||||
}
|
||||
@@ -176,10 +155,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (_Buttons[_ButtonNextRound].Selected)
|
||||
_NextRound();
|
||||
if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
|
||||
_Back();
|
||||
if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
|
||||
_PartyMode.Next();
|
||||
if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1)
|
||||
_PartyMode.Back();
|
||||
if (_Buttons[_ButtonExit].Selected && _PartyMode.GameData.CurrentRoundNr > 1)
|
||||
_ShowPopup(true);
|
||||
if (_Buttons[_ButtonPlayerScrollUp].Selected)
|
||||
_ScrollPlayerTable(-1);
|
||||
@@ -212,10 +191,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (_Buttons[_ButtonNextRound].Selected)
|
||||
_NextRound();
|
||||
if (_Buttons[_ButtonBack].Selected && _GameState.CurrentRoundNr == 1)
|
||||
_Back();
|
||||
if (_Buttons[_ButtonExit].Selected && _GameState.CurrentRoundNr > 1)
|
||||
_PartyMode.Next();
|
||||
if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1)
|
||||
_PartyMode.Back();
|
||||
if (_Buttons[_ButtonExit].Selected && _PartyMode.GameData.CurrentRoundNr > 1)
|
||||
_ShowPopup(true);
|
||||
if (_Buttons[_ButtonPlayerScrollUp].Selected)
|
||||
_ScrollPlayerTable(-1);
|
||||
@@ -239,8 +218,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (_GameState.CurrentRoundNr == 1)
|
||||
_Back();
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1)
|
||||
_PartyMode.Back();
|
||||
else
|
||||
_ShowPopup(true);
|
||||
}
|
||||
@@ -269,13 +248,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_UpdatePlayerTable();
|
||||
_UpdateNextPlayerPositions();
|
||||
_UpdateNextPlayerContents();
|
||||
if (_GameState.CurrentRoundNr == 1)
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1)
|
||||
_BuildRoundsTable();
|
||||
else
|
||||
_ScrollRoundsTable(_GameState.CurrentRoundNr - 2);
|
||||
_ScrollRoundsTable(_PartyMode.GameData.CurrentRoundNr - 2);
|
||||
_UpdateRoundsTable();
|
||||
|
||||
if (_GameState.CurrentRoundNr == 1)
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1)
|
||||
{
|
||||
_Buttons[_ButtonBack].Visible = true;
|
||||
_Buttons[_ButtonExit].Visible = false;
|
||||
@@ -286,7 +265,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_Buttons[_ButtonExit].Visible = true;
|
||||
}
|
||||
|
||||
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
||||
if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.Rounds.Count)
|
||||
{
|
||||
_Buttons[_ButtonNextRound].Visible = true;
|
||||
_Texts[_TextFinishMessage].Visible = false;
|
||||
@@ -310,16 +289,9 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
return true;
|
||||
}
|
||||
|
||||
private void _NextRound()
|
||||
{
|
||||
_Data.ScreenMain.FadeToNameSelection = false;
|
||||
_Data.ScreenMain.FadeToSongSelection = true;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
}
|
||||
|
||||
private void _EndParty()
|
||||
{
|
||||
_FadeTo(EScreens.ScreenParty);
|
||||
CBase.Graphics.FadeTo(EScreen.Party);
|
||||
}
|
||||
|
||||
private void _ShowPopup(bool visible)
|
||||
@@ -335,19 +307,13 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_SelectElement(_Buttons[_ButtonPopupNo]);
|
||||
}
|
||||
|
||||
private void _Back()
|
||||
{
|
||||
_Data.ScreenMain.FadeToNameSelection = true;
|
||||
_Data.ScreenMain.FadeToSongSelection = false;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
}
|
||||
|
||||
private void _UpdateNextPlayerPositions()
|
||||
{
|
||||
float x = (float)CBase.Settings.GetRenderW() / 2 - ((_GameState.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_GameState.NumPlayerAtOnce - 1) * 15)) / 2;
|
||||
float x = (float)CBase.Settings.GetRenderW() / 2 -
|
||||
((_PartyMode.GameData.NumPlayerAtOnce * _Statics[_StaticNextPlayer].Rect.W) + ((_PartyMode.GameData.NumPlayerAtOnce - 1) * 15)) / 2;
|
||||
const float staticY = 590;
|
||||
const float textY = 550;
|
||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
//static
|
||||
_NextPlayerStatics[i].X = x;
|
||||
@@ -360,7 +326,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
x += _Statics[_StaticNextPlayer].Rect.W + 15;
|
||||
}
|
||||
for (int i = _GameState.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
|
||||
for (int i = _PartyMode.GameData.NumPlayerAtOnce; i < _PartyMode.GetMaxPlayer(); i++)
|
||||
{
|
||||
_NextPlayerStatics[i].Visible = false;
|
||||
_NextPlayerTexts[i].Visible = false;
|
||||
@@ -369,12 +335,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
|
||||
private void _UpdateNextPlayerContents()
|
||||
{
|
||||
if (_GameState.CurrentRoundNr <= _GameState.Combs.Count)
|
||||
if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.Rounds.Count)
|
||||
{
|
||||
_Texts[_TextNextPlayerMessage].Visible = true;
|
||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
int id = _GameState.ProfileIDs[_GameState.Combs[_GameState.CurrentRoundNr - 1].Player[i]];
|
||||
int id = _PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[_PartyMode.GameData.CurrentRoundNr - 1].Player[i]];
|
||||
_NextPlayerStatics[i].Texture = CBase.Profiles.GetAvatar(id);
|
||||
_NextPlayerTexts[i].Text = CBase.Profiles.GetPlayerName(id);
|
||||
_NextPlayerTexts[i].Color = CBase.Themes.GetPlayerColor(i + 1);
|
||||
@@ -383,7 +349,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
else
|
||||
{
|
||||
_Texts[_TextNextPlayerMessage].Visible = false;
|
||||
for (int i = 0; i < _GameState.NumPlayerAtOnce; i++)
|
||||
for (int i = 0; i < _PartyMode.GameData.NumPlayerAtOnce; i++)
|
||||
{
|
||||
_NextPlayerStatics[i].Visible = false;
|
||||
_NextPlayerTexts[i].Visible = false;
|
||||
@@ -429,10 +395,10 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_RoundsTableScrollArea = new SRectF();
|
||||
|
||||
const int numPlayerInOneRow = 3;
|
||||
_NumRoundsVisible = _GameState.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3;
|
||||
_NumRoundsVisible = _PartyMode.GameData.NumPlayerAtOnce <= numPlayerInOneRow ? 5 : 3;
|
||||
|
||||
if (_NumRoundsVisible > _GameState.Combs.Count)
|
||||
_NumRoundsVisible = _GameState.Combs.Count;
|
||||
if (_NumRoundsVisible > _PartyMode.GameData.Rounds.Count)
|
||||
_NumRoundsVisible = _PartyMode.GameData.Rounds.Count;
|
||||
|
||||
float numberX = _Texts[_TextRoundNumber].X;
|
||||
float numberY = _Texts[_TextRoundNumber].Y;
|
||||
@@ -449,15 +415,15 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
//Round-number
|
||||
roundRow.Number.X = numberX;
|
||||
roundRow.Number.Y = numberY;
|
||||
var numInnerRows = (int)Math.Ceiling(_GameState.NumPlayerAtOnce / ((double)numPlayerInOneRow));
|
||||
var numInnerRows = (int)Math.Ceiling(_PartyMode.GameData.NumPlayerAtOnce / ((double)numPlayerInOneRow));
|
||||
for (int row = 0; row < numInnerRows; row++)
|
||||
{
|
||||
int num = (row + 1) * numPlayerInOneRow;
|
||||
int numPlayerInThisRow = numPlayerInOneRow;
|
||||
if (num > _GameState.NumPlayerAtOnce)
|
||||
if (num > _PartyMode.GameData.NumPlayerAtOnce)
|
||||
{
|
||||
num = _GameState.NumPlayerAtOnce;
|
||||
numPlayerInThisRow = _GameState.NumPlayerAtOnce - (row * numPlayerInOneRow);
|
||||
num = _PartyMode.GameData.NumPlayerAtOnce;
|
||||
numPlayerInThisRow = _PartyMode.GameData.NumPlayerAtOnce - (row * numPlayerInOneRow);
|
||||
}
|
||||
for (int column = row * numPlayerInOneRow; column < num; column++)
|
||||
{
|
||||
@@ -473,7 +439,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
roundRow.TextScores[column].Y = numberY + delta;
|
||||
roundRow.TextScores[column].W = maxw;
|
||||
}
|
||||
numberY = numberY + delta + delta;
|
||||
numberY = numberY + 2 * delta;
|
||||
}
|
||||
numberY = numberY + delta / 2;
|
||||
}
|
||||
@@ -486,17 +452,18 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
||||
{
|
||||
if (_GameState.Combs.Count > i + _RoundsTableOffset && _GameState.Combs[i + _RoundsTableOffset].Player.Count > p)
|
||||
if (_PartyMode.GameData.Rounds.Count > i + _RoundsTableOffset && _PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player.Count > p)
|
||||
{
|
||||
_RoundsTable[i].Number.Visible = true;
|
||||
_RoundsTable[i].TextPlayer[p].Visible = true;
|
||||
_RoundsTable[i].TextScores[p].Visible = true;
|
||||
_RoundsTable[i].Number.Text = (i + 1 + _RoundsTableOffset) + ")";
|
||||
_RoundsTable[i].TextPlayer[p].Text = CBase.Profiles.GetPlayerName(_GameState.ProfileIDs[_GameState.Combs[i + _RoundsTableOffset].Player[p]]);
|
||||
_RoundsTable[i].TextPlayer[p].Text =
|
||||
CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDs[_PartyMode.GameData.Rounds[i + _RoundsTableOffset].Player[p]]);
|
||||
// ReSharper disable ConvertIfStatementToConditionalTernaryExpression
|
||||
if ((_GameState.CurrentRoundNr - 1) > i + _RoundsTableOffset)
|
||||
if ((_PartyMode.GameData.CurrentRoundNr - 1) > i + _RoundsTableOffset)
|
||||
// ReSharper restore ConvertIfStatementToConditionalTernaryExpression
|
||||
_RoundsTable[i].TextScores[p].Text = _GameState.Results[i + _RoundsTableOffset, p].ToString();
|
||||
_RoundsTable[i].TextScores[p].Text = _PartyMode.GameData.Results[i + _RoundsTableOffset, p].ToString();
|
||||
else
|
||||
_RoundsTable[i].TextScores[p].Text = "";
|
||||
}
|
||||
@@ -506,7 +473,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
_RoundsTable[i].TextScores[p].Visible = false;
|
||||
}
|
||||
}
|
||||
if (_GameState.Combs.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible)
|
||||
if (_PartyMode.GameData.Rounds.Count < i + _RoundsTableOffset || i + 1 > _NumRoundsVisible)
|
||||
{
|
||||
_RoundsTable[i].Number.Visible = false;
|
||||
for (int p = 0; p < _RoundsTable[i].TextPlayer.Count; p++)
|
||||
@@ -518,7 +485,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
}
|
||||
|
||||
_Buttons[_ButtonRoundsScrollUp].Visible = _RoundsTableOffset > 0;
|
||||
_Buttons[_ButtonRoundsScrollDown].Visible = _GameState.Combs.Count - _NumRoundsVisible - _RoundsTableOffset > 0;
|
||||
_Buttons[_ButtonRoundsScrollDown].Visible = _PartyMode.GameData.Rounds.Count - _NumRoundsVisible - _RoundsTableOffset > 0;
|
||||
}
|
||||
|
||||
private void _BuildPlayerTable()
|
||||
@@ -578,7 +545,7 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
{
|
||||
STableRow row = _PlayerTable[i];
|
||||
|
||||
if (i + _PlayerTableOffset < _GameState.ResultTable.Count)
|
||||
if (i + _PlayerTableOffset < _PartyMode.GameData.ResultTable.Count)
|
||||
{
|
||||
row.Pos.Visible = true;
|
||||
row.Name.Visible = true;
|
||||
@@ -587,12 +554,12 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
row.SingPoints.Visible = true;
|
||||
row.GamePoints.Visible = true;
|
||||
|
||||
row.Pos.Text = _GameState.ResultTable[i + _PlayerTableOffset].Position + ".";
|
||||
row.Name.Text = CBase.Profiles.GetPlayerName(_GameState.ResultTable[i + _PlayerTableOffset].PlayerID);
|
||||
row.Rounds.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString();
|
||||
row.Won.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumWon.ToString();
|
||||
row.SingPoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString();
|
||||
row.GamePoints.Text = _GameState.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString();
|
||||
row.Pos.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].Position + ".";
|
||||
row.Name.Text = CBase.Profiles.GetPlayerName(_PartyMode.GameData.ResultTable[i + _PlayerTableOffset].PlayerID);
|
||||
row.Rounds.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumPlayed.ToString();
|
||||
row.Won.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumWon.ToString();
|
||||
row.SingPoints.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumSingPoints.ToString();
|
||||
row.GamePoints.Text = _PartyMode.GameData.ResultTable[i + _PlayerTableOffset].NumGamePoints.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -606,37 +573,37 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
}
|
||||
|
||||
_Buttons[_ButtonPlayerScrollUp].Visible = _PlayerTableOffset > 0;
|
||||
_Buttons[_ButtonPlayerScrollDown].Visible = _GameState.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
|
||||
_Buttons[_ButtonPlayerScrollDown].Visible = _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible - _PlayerTableOffset > 0;
|
||||
}
|
||||
|
||||
private void _ScrollPlayerTable(int offset)
|
||||
{
|
||||
if (_GameState.ProfileIDs.Count <= _NumPlayerVisible)
|
||||
if (_PartyMode.GameData.ProfileIDs.Count <= _NumPlayerVisible)
|
||||
_PlayerTableOffset = 0;
|
||||
else if (offset < 0 && _PlayerTableOffset + offset >= 0)
|
||||
_PlayerTableOffset += offset;
|
||||
else if (offset < 0 && _PlayerTableOffset + offset < 0)
|
||||
_PlayerTableOffset = 0;
|
||||
else if (offset > 0 && _PlayerTableOffset + offset <= _GameState.ProfileIDs.Count - _NumPlayerVisible)
|
||||
else if (offset > 0 && _PlayerTableOffset + offset <= _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible)
|
||||
_PlayerTableOffset += offset;
|
||||
else if (offset > 0 && _PlayerTableOffset + offset > _GameState.ProfileIDs.Count - _NumPlayerVisible)
|
||||
_PlayerTableOffset = _GameState.ProfileIDs.Count - _NumPlayerVisible;
|
||||
else if (offset > 0 && _PlayerTableOffset + offset > _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible)
|
||||
_PlayerTableOffset = _PartyMode.GameData.ProfileIDs.Count - _NumPlayerVisible;
|
||||
|
||||
_UpdatePlayerTable();
|
||||
}
|
||||
|
||||
private void _ScrollRoundsTable(int offset)
|
||||
{
|
||||
if (_GameState.Combs.Count <= _NumRoundsVisible)
|
||||
if (_PartyMode.GameData.Rounds.Count <= _NumRoundsVisible)
|
||||
_RoundsTableOffset = 0;
|
||||
else if (offset < 0 && _RoundsTableOffset + offset >= 0)
|
||||
_RoundsTableOffset += offset;
|
||||
else if (offset < 0 && _RoundsTableOffset + offset < 0)
|
||||
_RoundsTableOffset = 0;
|
||||
else if (offset > 0 && _RoundsTableOffset + offset <= _GameState.Combs.Count - _NumRoundsVisible)
|
||||
else if (offset > 0 && _RoundsTableOffset + offset <= _PartyMode.GameData.Rounds.Count - _NumRoundsVisible)
|
||||
_RoundsTableOffset += offset;
|
||||
else if (offset > 0 && _RoundsTableOffset + offset > _GameState.Combs.Count - _NumRoundsVisible)
|
||||
_RoundsTableOffset = _GameState.Combs.Count - _NumRoundsVisible;
|
||||
else if (offset > 0 && _RoundsTableOffset + offset > _PartyMode.GameData.Rounds.Count - _NumRoundsVisible)
|
||||
_RoundsTableOffset = _PartyMode.GameData.Rounds.Count - _NumRoundsVisible;
|
||||
|
||||
_UpdateRoundsTable();
|
||||
}
|
||||
@@ -644,13 +611,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
private string _GetPlayerWinString()
|
||||
{
|
||||
string s = "";
|
||||
for (int i = 0; i < _GameState.ResultTable.Count; i++)
|
||||
|
||||
for (int i = 0; i < _PartyMode.GameData.ResultTable.Count; i++)
|
||||
{
|
||||
if (_GameState.ResultTable[i].Position == 1)
|
||||
if (_PartyMode.GameData.ResultTable[i].Position == 1)
|
||||
{
|
||||
if (i > 0)
|
||||
s += ", ";
|
||||
s += CBase.Profiles.GetPlayerName(_GameState.ResultTable[i].PlayerID);
|
||||
s += CBase.Profiles.GetPlayerName(_PartyMode.GameData.ResultTable[i].PlayerID);
|
||||
}
|
||||
else
|
||||
break;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
@@ -31,58 +30,38 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
private SDataFromScreen _Data;
|
||||
private new CPartyModeChallengeMedley _PartyMode;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_Data.ScreenNames.ProfileIDs = new List<int>();
|
||||
|
||||
_Data = new SDataFromScreen();
|
||||
var names = new SFromScreenNames {FadeToConfig = false, ProfileIDs = new List<int>()};
|
||||
_Data.ScreenNames = names;
|
||||
|
||||
_PartyMode = (CPartyModeChallengeMedley)base._PartyMode;
|
||||
_AllowChangePlayerNum = false;
|
||||
}
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
public override void OnShow()
|
||||
{
|
||||
try
|
||||
{
|
||||
var config = (SDataToScreenNames)receivedData;
|
||||
_Data.ScreenNames.ProfileIDs = config.ProfileIDs ?? new List<int>();
|
||||
base.OnShow();
|
||||
SetPartyModeData(_PartyMode.GameData.NumPlayer);
|
||||
while (_PartyMode.GameData.ProfileIDs.Count > _NumPlayer)
|
||||
_PartyMode.GameData.ProfileIDs.RemoveAt(_PartyMode.GameData.ProfileIDs.Count - 1);
|
||||
|
||||
SetPartyModeData(config.NumPlayer);
|
||||
|
||||
while (_Data.ScreenNames.ProfileIDs.Count > _NumPlayer)
|
||||
_Data.ScreenNames.ProfileIDs.RemoveAt(_Data.ScreenNames.ProfileIDs.Count - 1);
|
||||
|
||||
List<int>[] ids = new List<int>[] {_Data.ScreenNames.ProfileIDs};
|
||||
SetPartyModeProfiles(ids);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen challenge names. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
}
|
||||
List<int>[] ids = new List<int>[] {_PartyMode.GameData.ProfileIDs};
|
||||
SetPartyModeProfiles(ids);
|
||||
}
|
||||
|
||||
public override void Back()
|
||||
{
|
||||
SPartyNameOptions options = GetData();
|
||||
if (options.TeamList.Length == 1)
|
||||
_Data.ScreenNames.ProfileIDs = options.TeamList[0];
|
||||
_Data.ScreenNames.FadeToConfig = true;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
if (_TeamList.Length == 1)
|
||||
_PartyMode.GameData.ProfileIDs = _TeamList[0];
|
||||
_PartyMode.Back();
|
||||
}
|
||||
|
||||
public override void Next()
|
||||
{
|
||||
SPartyNameOptions options = GetData();
|
||||
if (options.TeamList.Length == 1)
|
||||
_Data.ScreenNames.ProfileIDs = options.TeamList[0];
|
||||
_Data.ScreenNames.FadeToConfig = false;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
if (_TeamList.Length == 1)
|
||||
_PartyMode.GameData.ProfileIDs = _TeamList[0];
|
||||
_PartyMode.Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -53,81 +53,20 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public bool Finished;
|
||||
}
|
||||
|
||||
#region Communication
|
||||
|
||||
#region ToScreen
|
||||
public struct SDataToScreenConfig
|
||||
public abstract class CPartyScreenTicTacToe : CMenuParty
|
||||
{
|
||||
public int NumFields;
|
||||
public ESongSource SongSource;
|
||||
public int CategoryID;
|
||||
public int PlaylistID;
|
||||
public EPartyGameMode GameMode;
|
||||
protected new CPartyModeTicTacToe _PartyMode;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
_PartyMode = (CPartyModeTicTacToe)base._PartyMode;
|
||||
}
|
||||
}
|
||||
|
||||
public struct SDataToScreenNames
|
||||
{
|
||||
public int NumPlayerTeam1;
|
||||
public int NumPlayerTeam2;
|
||||
public List<int> ProfileIDsTeam1;
|
||||
public List<int> ProfileIDsTeam2;
|
||||
}
|
||||
|
||||
public struct SDataToScreenMain
|
||||
{
|
||||
public int CurrentRoundNr;
|
||||
public int Team;
|
||||
public int NumFields;
|
||||
public List<CRound> Rounds;
|
||||
public List<int> Songs;
|
||||
public List<int> ProfileIDsTeam1;
|
||||
public List<int> ProfileIDsTeam2;
|
||||
public List<int> PlayerTeam1;
|
||||
public List<int> PlayerTeam2;
|
||||
public int[] NumJokerRandom;
|
||||
public int[] NumJokerRetry;
|
||||
}
|
||||
|
||||
public struct SDataFromScreen
|
||||
{
|
||||
public SFromScreenConfig ScreenConfig;
|
||||
public SFromScreenNames ScreenNames;
|
||||
public SFromScreenMain ScreenMain;
|
||||
}
|
||||
|
||||
public struct SFromScreenConfig
|
||||
{
|
||||
public int NumFields;
|
||||
public ESongSource SongSource;
|
||||
public int CategoryID;
|
||||
public int PlaylistID;
|
||||
public EPartyGameMode GameMode;
|
||||
}
|
||||
|
||||
public struct SFromScreenNames
|
||||
{
|
||||
public bool FadeToConfig;
|
||||
public int NumPlayerTeam1;
|
||||
public int NumPlayerTeam2;
|
||||
public List<int> ProfileIDsTeam1;
|
||||
public List<int> ProfileIDsTeam2;
|
||||
}
|
||||
|
||||
public struct SFromScreenMain
|
||||
{
|
||||
public bool FadeToSinging;
|
||||
public bool FadeToNameSelection;
|
||||
public List<int> PlayerTeam1;
|
||||
public List<int> PlayerTeam2;
|
||||
public List<CRound> Rounds;
|
||||
public int SingRoundNr;
|
||||
public List<int> Songs;
|
||||
}
|
||||
#endregion FromScreen
|
||||
|
||||
#endregion Communication
|
||||
|
||||
// ReSharper disable ClassNeverInstantiated.Global
|
||||
public sealed class CPartyModeTicTacToe : CPartyMode
|
||||
// ReSharper restore ClassNeverInstantiated.Global
|
||||
{
|
||||
private const int _MaxPlayer = 20;
|
||||
private const int _MinPlayer = 2;
|
||||
@@ -139,14 +78,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private enum EStage
|
||||
{
|
||||
NotStarted,
|
||||
Config,
|
||||
Names,
|
||||
Main,
|
||||
Singing
|
||||
}
|
||||
|
||||
private struct SData
|
||||
public struct SData
|
||||
{
|
||||
public int NumPlayerTeam1;
|
||||
public int NumPlayerTeam2;
|
||||
@@ -173,11 +111,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
public int[] NumJokerRetry;
|
||||
}
|
||||
|
||||
private SDataToScreenConfig _ToScreenConfig;
|
||||
private SDataToScreenNames _ToScreenNames;
|
||||
private SDataToScreenMain _ToScreenMain;
|
||||
|
||||
private SData _GameData;
|
||||
public SData GameData;
|
||||
private EStage _Stage;
|
||||
|
||||
public CPartyModeTicTacToe(int id, string folder)
|
||||
@@ -193,17 +127,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_ScreenSongOptions.Sorting.SearchActive = false;
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.NoDuets;
|
||||
|
||||
_Stage = EStage.NotStarted;
|
||||
|
||||
_ToScreenConfig = new SDataToScreenConfig();
|
||||
_ToScreenNames = new SDataToScreenNames();
|
||||
_ToScreenMain = new SDataToScreenMain();
|
||||
|
||||
_GameData = new SData
|
||||
GameData = new SData
|
||||
{
|
||||
NumFields = 9,
|
||||
NumPlayerTeam1 = 2,
|
||||
NumPlayerTeam2 = 2,
|
||||
NumFields = 9,
|
||||
ProfileIDsTeam1 = new List<int>(),
|
||||
ProfileIDsTeam2 = new List<int>(),
|
||||
PlayerTeam1 = new List<int>(),
|
||||
@@ -223,7 +151,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
public override bool Init()
|
||||
{
|
||||
_Stage = EStage.NotStarted;
|
||||
_Stage = EStage.Config;
|
||||
|
||||
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
|
||||
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
|
||||
@@ -233,100 +161,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (CBase.Config.GetTabs() == EOffOn.TR_CONFIG_ON && _ScreenSongOptions.Sorting.SongSorting != ESongSorting.TR_CONFIG_NONE)
|
||||
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
|
||||
|
||||
_ToScreenMain.Rounds = new List<CRound>();
|
||||
_ToScreenMain.Songs = new List<int>();
|
||||
_ToScreenMain.PlayerTeam1 = new List<int>();
|
||||
_ToScreenMain.PlayerTeam2 = new List<int>();
|
||||
_GameData.Songs = new List<int>();
|
||||
_GameData.Rounds = new List<CRound>();
|
||||
_GameData.PlayerTeam1 = new List<int>();
|
||||
_GameData.PlayerTeam2 = new List<int>();
|
||||
GameData.Songs = new List<int>();
|
||||
GameData.Rounds = new List<CRound>();
|
||||
GameData.PlayerTeam1 = new List<int>();
|
||||
GameData.PlayerTeam2 = new List<int>();
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void DataFromScreen(string screenName, Object data)
|
||||
{
|
||||
var dataFrom = new SDataFromScreen();
|
||||
switch (screenName)
|
||||
{
|
||||
case "PartyScreenTicTacToeConfig":
|
||||
|
||||
try
|
||||
{
|
||||
dataFrom = (SDataFromScreen)data;
|
||||
_GameData.NumFields = dataFrom.ScreenConfig.NumFields;
|
||||
_GameData.SongSource = dataFrom.ScreenConfig.SongSource;
|
||||
_GameData.CategoryID = dataFrom.ScreenConfig.CategoryID;
|
||||
_GameData.PlaylistID = dataFrom.ScreenConfig.PlaylistID;
|
||||
_GameData.GameMode = dataFrom.ScreenConfig.GameMode;
|
||||
|
||||
_Stage = EStage.Config;
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + screenName + ". " + e.Message);
|
||||
}
|
||||
break;
|
||||
|
||||
case "PartyScreenTicTacToeNames":
|
||||
try
|
||||
{
|
||||
dataFrom = (SDataFromScreen)data;
|
||||
if (dataFrom.ScreenNames.FadeToConfig)
|
||||
_Stage = EStage.NotStarted;
|
||||
else
|
||||
{
|
||||
_GameData.Team = CBase.Game.GetRandom(100) < 50 ? 0 : 1;
|
||||
_GameData.NumPlayerTeam1 = dataFrom.ScreenNames.NumPlayerTeam1;
|
||||
_GameData.NumPlayerTeam2 = dataFrom.ScreenNames.NumPlayerTeam2;
|
||||
_GameData.ProfileIDsTeam1 = dataFrom.ScreenNames.ProfileIDsTeam1;
|
||||
_GameData.ProfileIDsTeam2 = dataFrom.ScreenNames.ProfileIDsTeam2;
|
||||
_Stage = EStage.Names;
|
||||
}
|
||||
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + screenName + ". " + e.Message);
|
||||
}
|
||||
break;
|
||||
|
||||
case "PartyScreenTicTacToeMain":
|
||||
try
|
||||
{
|
||||
dataFrom = (SDataFromScreen)data;
|
||||
if (dataFrom.ScreenMain.FadeToSinging)
|
||||
{
|
||||
_Stage = EStage.Singing;
|
||||
_GameData.Rounds = dataFrom.ScreenMain.Rounds;
|
||||
_GameData.SingRoundNr = dataFrom.ScreenMain.SingRoundNr;
|
||||
_GameData.Songs = dataFrom.ScreenMain.Songs;
|
||||
_GameData.PlayerTeam1 = dataFrom.ScreenMain.PlayerTeam1;
|
||||
_GameData.PlayerTeam2 = dataFrom.ScreenMain.PlayerTeam2;
|
||||
}
|
||||
if (dataFrom.ScreenMain.FadeToNameSelection)
|
||||
_Stage = EStage.Config;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode TicTacToe. Can't cast received data from screen " + screenName + ". " + e.Message);
|
||||
}
|
||||
|
||||
|
||||
if (_Stage == EStage.Singing)
|
||||
_StartRound(dataFrom.ScreenMain.SingRoundNr);
|
||||
if (_Stage == EStage.Config)
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
break;
|
||||
|
||||
default:
|
||||
CBase.Log.LogError("Error in party mode TicTacToe. Wrong screen is sending: " + screenName);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void UpdateGame()
|
||||
{
|
||||
/*
|
||||
@@ -336,98 +177,83 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_ScreenSongOptions.Selection.RandomOnly = false;*/
|
||||
}
|
||||
|
||||
public override CMenuParty GetNextPartyScreen(out EScreens alternativeScreen)
|
||||
private IMenu _GetNextScreen()
|
||||
{
|
||||
CMenuParty screen = null;
|
||||
alternativeScreen = EScreens.ScreenSong;
|
||||
|
||||
switch (_Stage)
|
||||
{
|
||||
case EStage.NotStarted:
|
||||
_Screens.TryGetValue("CPartyScreenTicTacToeConfig", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
_ToScreenConfig.NumFields = _GameData.NumFields;
|
||||
_ToScreenConfig.SongSource = _GameData.SongSource;
|
||||
_ToScreenConfig.CategoryID = _GameData.CategoryID;
|
||||
_ToScreenConfig.PlaylistID = _GameData.PlaylistID;
|
||||
_ToScreenConfig.GameMode = _GameData.GameMode;
|
||||
screen.DataToScreen(_ToScreenConfig);
|
||||
}
|
||||
break;
|
||||
case EStage.Config:
|
||||
_Screens.TryGetValue("CPartyScreenTicTacToeNames", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
_ToScreenNames.NumPlayerTeam1 = _GameData.NumPlayerTeam1;
|
||||
_ToScreenNames.NumPlayerTeam2 = _GameData.NumPlayerTeam2;
|
||||
_ToScreenNames.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1;
|
||||
_ToScreenNames.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2;
|
||||
screen.DataToScreen(_ToScreenNames);
|
||||
}
|
||||
return _Screens["CPartyScreenTicTacToeConfig"];
|
||||
case EStage.Names:
|
||||
return _Screens["CPartyScreenTicTacToeNames"];
|
||||
case EStage.Main:
|
||||
return _Screens["CPartyScreenTicTacToeMain"];
|
||||
case EStage.Singing:
|
||||
return CBase.Graphics.GetScreen(EScreen.Song);
|
||||
default:
|
||||
throw new ArgumentException("Invalid stage: " + _Stage);
|
||||
}
|
||||
}
|
||||
|
||||
private void _FadeToScreen()
|
||||
{
|
||||
CBase.Graphics.FadeTo(_GetNextScreen());
|
||||
}
|
||||
|
||||
public void Next()
|
||||
{
|
||||
switch (_Stage)
|
||||
{
|
||||
case EStage.Config:
|
||||
_Stage = EStage.Names;
|
||||
break;
|
||||
case EStage.Names:
|
||||
_Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
_GameData.Team = _GameData.Team == 1 ? 0 : 1;
|
||||
CBase.Songs.ResetSongSung();
|
||||
_GameData.CurrentRoundNr = 1;
|
||||
_ToScreenMain.CurrentRoundNr = 1;
|
||||
_ToScreenMain.NumFields = _GameData.NumFields;
|
||||
_ToScreenMain.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1;
|
||||
_ToScreenMain.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2;
|
||||
_CreateRounds();
|
||||
_SetNumJokers();
|
||||
_PreparePlayerList(0);
|
||||
_PrepareSongList();
|
||||
_ToScreenMain.Rounds = _GameData.Rounds;
|
||||
_ToScreenMain.Songs = _GameData.Songs;
|
||||
_ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam1;
|
||||
_ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam2;
|
||||
_ToScreenMain.NumJokerRandom = _GameData.NumJokerRandom;
|
||||
_ToScreenMain.NumJokerRetry = _GameData.NumJokerRetry;
|
||||
_ToScreenMain.Team = _GameData.Team;
|
||||
screen.DataToScreen(_ToScreenMain);
|
||||
}
|
||||
_Stage = EStage.Main;
|
||||
GameData.Team = CBase.Game.GetRandom(100) < 50 ? 0 : 1;
|
||||
CBase.Songs.ResetSongSung();
|
||||
GameData.CurrentRoundNr = 1;
|
||||
_CreateRounds();
|
||||
_SetNumJokers();
|
||||
_PreparePlayerList(0);
|
||||
_PrepareSongList();
|
||||
break;
|
||||
case EStage.Main:
|
||||
//nothing to do
|
||||
_Stage = EStage.Singing;
|
||||
_StartRound(GameData.SingRoundNr);
|
||||
break;
|
||||
case EStage.Singing:
|
||||
_Screens.TryGetValue("CPartyScreenTicTacToeMain", out screen);
|
||||
if (screen != null)
|
||||
{
|
||||
_GameData.Team = _GameData.Team == 1 ? 0 : 1;
|
||||
_UpdateSongList();
|
||||
_UpdatePlayerList();
|
||||
_ToScreenMain.CurrentRoundNr = _GameData.CurrentRoundNr;
|
||||
_ToScreenMain.NumFields = _GameData.NumFields;
|
||||
_ToScreenMain.ProfileIDsTeam1 = _GameData.ProfileIDsTeam1;
|
||||
_ToScreenMain.ProfileIDsTeam2 = _GameData.ProfileIDsTeam2;
|
||||
_ToScreenMain.Rounds = _GameData.Rounds;
|
||||
_ToScreenMain.Songs = _GameData.Songs;
|
||||
_ToScreenMain.PlayerTeam1 = _GameData.PlayerTeam1;
|
||||
_ToScreenMain.PlayerTeam2 = _GameData.PlayerTeam2;
|
||||
_ToScreenMain.NumJokerRandom = _GameData.NumJokerRandom;
|
||||
_ToScreenMain.NumJokerRetry = _GameData.NumJokerRetry;
|
||||
_ToScreenMain.Team = _GameData.Team;
|
||||
screen.DataToScreen(_ToScreenMain);
|
||||
}
|
||||
_Stage = EStage.Main;
|
||||
GameData.Team = GameData.Team == 1 ? 0 : 1;
|
||||
_UpdateSongList();
|
||||
_UpdatePlayerList();
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Invalid stage: " + _Stage);
|
||||
}
|
||||
|
||||
return screen;
|
||||
_FadeToScreen();
|
||||
}
|
||||
|
||||
public override EScreens GetStartScreen()
|
||||
public void Back()
|
||||
{
|
||||
return EScreens.ScreenPartyDummy;
|
||||
switch (_Stage)
|
||||
{
|
||||
case EStage.Config:
|
||||
CBase.Graphics.FadeTo(EScreen.Party);
|
||||
return;
|
||||
case EStage.Names:
|
||||
_Stage = EStage.Config;
|
||||
break;
|
||||
case EStage.Main:
|
||||
_Stage = EStage.Config;
|
||||
break;
|
||||
default: // Rest is not allowed
|
||||
throw new ArgumentException("Invalid stage: " + _Stage);
|
||||
}
|
||||
_FadeToScreen();
|
||||
}
|
||||
|
||||
public override EScreens GetMainScreen()
|
||||
public override IMenu GetStartScreen()
|
||||
{
|
||||
return EScreens.ScreenPartyDummy;
|
||||
return _Screens["CPartyScreenTicTacToeConfig"];
|
||||
}
|
||||
|
||||
public override SScreenSongOptions GetScreenSongOptions()
|
||||
@@ -500,7 +326,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
var gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
|
||||
switch (_GameData.GameMode)
|
||||
switch (GameData.GameMode)
|
||||
{
|
||||
case EPartyGameMode.TR_GAMEMODE_NORMAL:
|
||||
gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
@@ -516,23 +342,23 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
CBase.Game.AddSong(songID, gm);
|
||||
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenSing);
|
||||
CBase.Graphics.FadeTo(EScreen.Sing);
|
||||
}
|
||||
|
||||
public override void LeavingHighscore()
|
||||
{
|
||||
CBase.Songs.AddPartySongSung(CBase.Game.GetSong(0).ID);
|
||||
_UpdateScores();
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
Next();
|
||||
}
|
||||
|
||||
private void _CreateRounds()
|
||||
{
|
||||
_GameData.Rounds = new List<CRound>();
|
||||
for (int i = 0; i < _GameData.NumFields; i++)
|
||||
GameData.Rounds = new List<CRound>();
|
||||
for (int i = 0; i < GameData.NumFields; i++)
|
||||
{
|
||||
var r = new CRound();
|
||||
_GameData.Rounds.Add(r);
|
||||
GameData.Rounds.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -542,41 +368,41 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_GameData.PlayerTeam1 = new List<int>();
|
||||
_GameData.PlayerTeam2 = new List<int>();
|
||||
GameData.PlayerTeam1 = new List<int>();
|
||||
GameData.PlayerTeam2 = new List<int>();
|
||||
|
||||
//Prepare Player-IDs
|
||||
var ids1 = new List<int>();
|
||||
var ids2 = new List<int>();
|
||||
//Add IDs to team-list
|
||||
while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] &&
|
||||
_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1])
|
||||
while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] &&
|
||||
GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1])
|
||||
{
|
||||
if (ids1.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < _GameData.NumPlayerTeam1; i++)
|
||||
for (int i = 0; i < GameData.NumPlayerTeam1; i++)
|
||||
ids1.Add(i);
|
||||
}
|
||||
if (ids2.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < _GameData.NumPlayerTeam2; i++)
|
||||
for (int i = 0; i < GameData.NumPlayerTeam2; i++)
|
||||
ids2.Add(i);
|
||||
}
|
||||
int num;
|
||||
if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0])
|
||||
if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0])
|
||||
{
|
||||
num = CBase.Game.GetRandom(ids1.Count);
|
||||
if (num >= ids1.Count)
|
||||
num = ids1.Count - 1;
|
||||
_GameData.PlayerTeam1.Add(ids1[num]);
|
||||
GameData.PlayerTeam1.Add(ids1[num]);
|
||||
ids1.RemoveAt(num);
|
||||
}
|
||||
if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1])
|
||||
if (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1])
|
||||
{
|
||||
num = CBase.Game.GetRandom(ids2.Count);
|
||||
if (num >= ids2.Count)
|
||||
num = ids2.Count - 1;
|
||||
_GameData.PlayerTeam2.Add(ids2[num]);
|
||||
GameData.PlayerTeam2.Add(ids2[num]);
|
||||
ids2.RemoveAt(num);
|
||||
}
|
||||
}
|
||||
@@ -587,19 +413,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
//Prepare Player-IDs
|
||||
var ids = new List<int>();
|
||||
//Add IDs to team-list
|
||||
while (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0] && ids.Count == 0)
|
||||
while (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0] && ids.Count == 0)
|
||||
{
|
||||
if (ids.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < _GameData.NumPlayerTeam1; i++)
|
||||
for (int i = 0; i < GameData.NumPlayerTeam1; i++)
|
||||
ids.Add(i);
|
||||
}
|
||||
if (_GameData.PlayerTeam1.Count < _GameData.NumFields + _GameData.NumJokerRetry[0])
|
||||
if (GameData.PlayerTeam1.Count < GameData.NumFields + GameData.NumJokerRetry[0])
|
||||
{
|
||||
int num = CBase.Game.GetRandom(ids.Count);
|
||||
if (num >= ids.Count)
|
||||
num = ids.Count - 1;
|
||||
_GameData.PlayerTeam1.Add(ids[num]);
|
||||
GameData.PlayerTeam1.Add(ids[num]);
|
||||
ids.RemoveAt(num);
|
||||
}
|
||||
}
|
||||
@@ -610,19 +436,19 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
//Prepare Player-IDs
|
||||
var ids = new List<int>();
|
||||
//Add IDs to team-list
|
||||
while (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1] && ids.Count == 0)
|
||||
while (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1] && ids.Count == 0)
|
||||
{
|
||||
if (ids.Count == 0)
|
||||
{
|
||||
for (int i = 0; i < _GameData.NumPlayerTeam2; i++)
|
||||
for (int i = 0; i < GameData.NumPlayerTeam2; i++)
|
||||
ids.Add(i);
|
||||
}
|
||||
if (_GameData.PlayerTeam2.Count < _GameData.NumFields + _GameData.NumJokerRetry[1])
|
||||
if (GameData.PlayerTeam2.Count < GameData.NumFields + GameData.NumJokerRetry[1])
|
||||
{
|
||||
int num = CBase.Game.GetRandom(ids.Count);
|
||||
if (num >= ids.Count)
|
||||
num = ids.Count - 1;
|
||||
_GameData.PlayerTeam2.Add(ids[num]);
|
||||
GameData.PlayerTeam2.Add(ids[num]);
|
||||
ids.RemoveAt(num);
|
||||
}
|
||||
}
|
||||
@@ -635,7 +461,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
var gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
|
||||
switch (_GameData.GameMode)
|
||||
switch (GameData.GameMode)
|
||||
{
|
||||
case EPartyGameMode.TR_GAMEMODE_NORMAL:
|
||||
gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
@@ -650,15 +476,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
break;
|
||||
}
|
||||
|
||||
while (_GameData.Songs.Count < (_GameData.NumFields + _GameData.NumJokerRandom[0] + _GameData.NumJokerRandom[1]))
|
||||
while (GameData.Songs.Count < (GameData.NumFields + GameData.NumJokerRandom[0] + GameData.NumJokerRandom[1]))
|
||||
{
|
||||
var songs = new List<int>();
|
||||
switch (_GameData.SongSource)
|
||||
switch (GameData.SongSource)
|
||||
{
|
||||
case ESongSource.TR_PLAYLIST:
|
||||
for (int i = 0; i < CBase.Playlist.GetSongCount(_GameData.PlaylistID); i++)
|
||||
for (int i = 0; i < CBase.Playlist.GetSongCount(GameData.PlaylistID); i++)
|
||||
{
|
||||
int id = CBase.Playlist.GetSong(_GameData.PlaylistID, i).SongID;
|
||||
int id = CBase.Playlist.GetSong(GameData.PlaylistID, i).SongID;
|
||||
// ReSharper disable LoopCanBeConvertedToQuery
|
||||
foreach (EGameMode mode in CBase.Songs.GetSongByID(id).AvailableGameModes)
|
||||
// ReSharper restore LoopCanBeConvertedToQuery
|
||||
@@ -683,7 +509,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
break;
|
||||
|
||||
case ESongSource.TR_CATEGORY:
|
||||
CBase.Songs.SetCategory(_GameData.CategoryID);
|
||||
CBase.Songs.SetCategory(GameData.CategoryID);
|
||||
for (int i = 0; i < CBase.Songs.GetNumSongsVisible(); i++)
|
||||
{
|
||||
// ReSharper disable LoopCanBeConvertedToQuery
|
||||
@@ -699,23 +525,23 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
while (songs.Count > 0)
|
||||
{
|
||||
_GameData.Songs.Add(songs[CBase.Game.GetRandom(songs.Count - 1)]);
|
||||
songs.Remove(_GameData.Songs[_GameData.Songs.Count - 1]);
|
||||
GameData.Songs.Add(songs[CBase.Game.GetRandom(songs.Count - 1)]);
|
||||
songs.Remove(GameData.Songs[GameData.Songs.Count - 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void _UpdatePlayerList()
|
||||
{
|
||||
if (_GameData.PlayerTeam1.Count == 0)
|
||||
if (GameData.PlayerTeam1.Count == 0)
|
||||
_PreparePlayerList(1);
|
||||
if (_GameData.PlayerTeam2.Count == 0)
|
||||
if (GameData.PlayerTeam2.Count == 0)
|
||||
_PreparePlayerList(2);
|
||||
}
|
||||
|
||||
private void _UpdateSongList()
|
||||
{
|
||||
if (_GameData.Songs.Count == 0)
|
||||
if (GameData.Songs.Count == 0)
|
||||
_PrepareSongList();
|
||||
}
|
||||
|
||||
@@ -733,7 +559,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (players.Length < 2)
|
||||
return;
|
||||
|
||||
CRound r = _GameData.Rounds[roundNr];
|
||||
CRound r = GameData.Rounds[roundNr];
|
||||
bool isDuet = CBase.Songs.GetSongByID(r.SongID).IsDuet;
|
||||
|
||||
for (int i = 0; i < 2; i++)
|
||||
@@ -745,11 +571,11 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
//try to fill with the right data
|
||||
if (r != null)
|
||||
{
|
||||
players[0].ProfileID = _GameData.ProfileIDsTeam1[r.SingerTeam1];
|
||||
players[0].ProfileID = GameData.ProfileIDsTeam1[r.SingerTeam1];
|
||||
if (isDuet)
|
||||
players[0].VoiceNr = 0;
|
||||
|
||||
players[1].ProfileID = _GameData.ProfileIDsTeam2[r.SingerTeam2];
|
||||
players[1].ProfileID = GameData.ProfileIDsTeam2[r.SingerTeam2];
|
||||
if (isDuet)
|
||||
players[1].VoiceNr = 1;
|
||||
|
||||
@@ -759,35 +585,35 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void _SetNumJokers()
|
||||
{
|
||||
switch (_GameData.NumFields)
|
||||
switch (GameData.NumFields)
|
||||
{
|
||||
case 9:
|
||||
_GameData.NumJokerRandom[0] = 1;
|
||||
_GameData.NumJokerRandom[1] = 1;
|
||||
_GameData.NumJokerRetry[0] = 0;
|
||||
_GameData.NumJokerRetry[1] = 0;
|
||||
GameData.NumJokerRandom[0] = 1;
|
||||
GameData.NumJokerRandom[1] = 1;
|
||||
GameData.NumJokerRetry[0] = 0;
|
||||
GameData.NumJokerRetry[1] = 0;
|
||||
break;
|
||||
|
||||
case 16:
|
||||
_GameData.NumJokerRandom[0] = 2;
|
||||
_GameData.NumJokerRandom[1] = 2;
|
||||
_GameData.NumJokerRetry[0] = 1;
|
||||
_GameData.NumJokerRetry[1] = 1;
|
||||
GameData.NumJokerRandom[0] = 2;
|
||||
GameData.NumJokerRandom[1] = 2;
|
||||
GameData.NumJokerRetry[0] = 1;
|
||||
GameData.NumJokerRetry[1] = 1;
|
||||
break;
|
||||
|
||||
case 25:
|
||||
_GameData.NumJokerRandom[0] = 3;
|
||||
_GameData.NumJokerRandom[1] = 3;
|
||||
_GameData.NumJokerRetry[0] = 2;
|
||||
_GameData.NumJokerRetry[1] = 2;
|
||||
GameData.NumJokerRandom[0] = 3;
|
||||
GameData.NumJokerRandom[1] = 3;
|
||||
GameData.NumJokerRetry[0] = 2;
|
||||
GameData.NumJokerRetry[1] = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void _UpdateScores()
|
||||
{
|
||||
if (!_GameData.Rounds[_GameData.SingRoundNr].Finished)
|
||||
_GameData.CurrentRoundNr++;
|
||||
if (!GameData.Rounds[GameData.SingRoundNr].Finished)
|
||||
GameData.CurrentRoundNr++;
|
||||
|
||||
SPlayer[] results = CBase.Game.GetPlayers();
|
||||
if (results == null)
|
||||
@@ -796,17 +622,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
if (results.Length < 2)
|
||||
return;
|
||||
|
||||
_GameData.Rounds[_GameData.SingRoundNr].PointsTeam1 = (int)Math.Round(results[0].Points);
|
||||
_GameData.Rounds[_GameData.SingRoundNr].PointsTeam2 = (int)Math.Round(results[1].Points);
|
||||
_GameData.Rounds[_GameData.SingRoundNr].Finished = true;
|
||||
if (_GameData.Rounds[_GameData.SingRoundNr].PointsTeam1 < _GameData.Rounds[_GameData.SingRoundNr].PointsTeam2)
|
||||
_GameData.Rounds[_GameData.SingRoundNr].Winner = 2;
|
||||
else if (_GameData.Rounds[_GameData.SingRoundNr].PointsTeam1 > _GameData.Rounds[_GameData.SingRoundNr].PointsTeam2)
|
||||
_GameData.Rounds[_GameData.SingRoundNr].Winner = 1;
|
||||
GameData.Rounds[GameData.SingRoundNr].PointsTeam1 = (int)Math.Round(results[0].Points);
|
||||
GameData.Rounds[GameData.SingRoundNr].PointsTeam2 = (int)Math.Round(results[1].Points);
|
||||
GameData.Rounds[GameData.SingRoundNr].Finished = true;
|
||||
if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 < GameData.Rounds[GameData.SingRoundNr].PointsTeam2)
|
||||
GameData.Rounds[GameData.SingRoundNr].Winner = 2;
|
||||
else if (GameData.Rounds[GameData.SingRoundNr].PointsTeam1 > GameData.Rounds[GameData.SingRoundNr].PointsTeam2)
|
||||
GameData.Rounds[GameData.SingRoundNr].Winner = 1;
|
||||
else
|
||||
{
|
||||
_GameData.Rounds[_GameData.SingRoundNr].Finished = false;
|
||||
_GameData.CurrentRoundNr--;
|
||||
GameData.Rounds[GameData.SingRoundNr].Finished = false;
|
||||
GameData.CurrentRoundNr--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,17 +15,15 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.Songs;
|
||||
|
||||
namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
// ReSharper disable UnusedMember.Global
|
||||
public class CPartyScreenTicTacToeConfig : CMenuParty
|
||||
public class CPartyScreenTicTacToeConfig : CPartyScreenTicTacToe
|
||||
// ReSharper restore UnusedMember.Global
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
@@ -44,8 +42,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private bool _ConfigOk = true;
|
||||
|
||||
private SDataFromScreen _Data;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -55,34 +51,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_SelectSlideNumFields, _SelectSlideSongSource, _SelectSlidePlaylist, _SelectSlideCategory, _SelectSlideGameMode
|
||||
};
|
||||
_ThemeButtons = new string[] {_ButtonNext, _ButtonBack};
|
||||
|
||||
_Data = new SDataFromScreen();
|
||||
var config = new SFromScreenConfig
|
||||
{
|
||||
PlaylistID = 0,
|
||||
NumFields = 9,
|
||||
GameMode = EPartyGameMode.TR_GAMEMODE_NORMAL,
|
||||
CategoryID = 0,
|
||||
SongSource = ESongSource.TR_ALLSONGS
|
||||
};
|
||||
_Data.ScreenConfig = config;
|
||||
}
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
{
|
||||
try
|
||||
{
|
||||
var config = (SDataToScreenConfig)receivedData;
|
||||
_Data.ScreenConfig.NumFields = config.NumFields;
|
||||
_Data.ScreenConfig.PlaylistID = config.PlaylistID;
|
||||
_Data.ScreenConfig.CategoryID = config.CategoryID;
|
||||
_Data.ScreenConfig.SongSource = config.SongSource;
|
||||
_Data.ScreenConfig.GameMode = config.GameMode;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe config. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
@@ -96,17 +64,17 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
_UpdateSlides();
|
||||
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
_Next();
|
||||
_PartyMode.Next();
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
@@ -129,14 +97,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
_UpdateSlides();
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
|
||||
if (_Buttons[_ButtonNext].Selected)
|
||||
_Next();
|
||||
_PartyMode.Next();
|
||||
}
|
||||
|
||||
if (mouseEvent.RB)
|
||||
_Back();
|
||||
_PartyMode.Back();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -164,15 +132,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_SelectSlides[_SelectSlideNumFields].AddValue("9");
|
||||
_SelectSlides[_SelectSlideNumFields].AddValue("16");
|
||||
_SelectSlides[_SelectSlideNumFields].AddValue("25");
|
||||
if (_Data.ScreenConfig.NumFields == 9)
|
||||
if (_PartyMode.GameData.NumFields == 9)
|
||||
_SelectSlides[_SelectSlideNumFields].Selection = 0;
|
||||
else if (_Data.ScreenConfig.NumFields == 16)
|
||||
else if (_PartyMode.GameData.NumFields == 16)
|
||||
_SelectSlides[_SelectSlideNumFields].Selection = 1;
|
||||
else if (_Data.ScreenConfig.NumFields == 25)
|
||||
else if (_PartyMode.GameData.NumFields == 25)
|
||||
_SelectSlides[_SelectSlideNumFields].Selection = 2;
|
||||
|
||||
_SelectSlides[_SelectSlideSongSource].Clear();
|
||||
_SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_Data.ScreenConfig.SongSource);
|
||||
_SelectSlides[_SelectSlideSongSource].SetValues<ESongSource>((int)_PartyMode.GameData.SongSource);
|
||||
|
||||
List<string> playlists = CBase.Playlist.GetNames();
|
||||
_SelectSlides[_SelectSlidePlaylist].Clear();
|
||||
@@ -181,8 +149,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
string value = playlists[i] + " (" + CBase.Playlist.GetSongCount(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
|
||||
_SelectSlides[_SelectSlidePlaylist].AddValue(value);
|
||||
}
|
||||
_SelectSlides[_SelectSlidePlaylist].Selection = _Data.ScreenConfig.PlaylistID;
|
||||
_SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
|
||||
_SelectSlides[_SelectSlidePlaylist].Selection = _PartyMode.GameData.PlaylistID;
|
||||
_SelectSlides[_SelectSlidePlaylist].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST;
|
||||
|
||||
var categories = new string[CBase.Songs.GetNumCategories()];
|
||||
for (int i = 0; i < CBase.Songs.GetNumCategories(); i++)
|
||||
@@ -193,30 +161,30 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
string value = categories[i] + " (" + CBase.Songs.GetNumSongsNotSungInCategory(i) + " " + CBase.Language.Translate("TR_SONGS", PartyModeID) + ")";
|
||||
_SelectSlides[_SelectSlideCategory].AddValue(value);
|
||||
}
|
||||
_SelectSlides[_SelectSlideCategory].Selection = _Data.ScreenConfig.CategoryID;
|
||||
_SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
|
||||
_SelectSlides[_SelectSlideCategory].Selection = _PartyMode.GameData.CategoryID;
|
||||
_SelectSlides[_SelectSlideCategory].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY;
|
||||
|
||||
_SelectSlides[_SelectSlideGameMode].Visible = true;
|
||||
_SelectSlides[_SelectSlideGameMode].SetValues<EPartyGameMode>((int)_Data.ScreenConfig.GameMode);
|
||||
_SelectSlides[_SelectSlideGameMode].SetValues<EPartyGameMode>((int)_PartyMode.GameData.GameMode);
|
||||
}
|
||||
|
||||
private void _UpdateSlides()
|
||||
{
|
||||
if (_SelectSlides[_SelectSlideNumFields].Selection == 0)
|
||||
_Data.ScreenConfig.NumFields = 9;
|
||||
_PartyMode.GameData.NumFields = 9;
|
||||
else if (_SelectSlides[_SelectSlideNumFields].Selection == 1)
|
||||
_Data.ScreenConfig.NumFields = 16;
|
||||
_PartyMode.GameData.NumFields = 16;
|
||||
else if (_SelectSlides[_SelectSlideNumFields].Selection == 2)
|
||||
_Data.ScreenConfig.NumFields = 25;
|
||||
_PartyMode.GameData.NumFields = 25;
|
||||
|
||||
_Data.ScreenConfig.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection;
|
||||
_Data.ScreenConfig.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection;
|
||||
_Data.ScreenConfig.CategoryID = _SelectSlides[_SelectSlideCategory].Selection;
|
||||
_Data.ScreenConfig.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection;
|
||||
_PartyMode.GameData.SongSource = (ESongSource)_SelectSlides[_SelectSlideSongSource].Selection;
|
||||
_PartyMode.GameData.PlaylistID = _SelectSlides[_SelectSlidePlaylist].Selection;
|
||||
_PartyMode.GameData.CategoryID = _SelectSlides[_SelectSlideCategory].Selection;
|
||||
_PartyMode.GameData.GameMode = (EPartyGameMode)_SelectSlides[_SelectSlideGameMode].Selection;
|
||||
|
||||
var gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
|
||||
switch (_Data.ScreenConfig.GameMode)
|
||||
switch (_PartyMode.GameData.GameMode)
|
||||
{
|
||||
case EPartyGameMode.TR_GAMEMODE_NORMAL:
|
||||
gm = EGameMode.TR_GAMEMODE_NORMAL;
|
||||
@@ -231,16 +199,16 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
break;
|
||||
}
|
||||
|
||||
if (_Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST)
|
||||
if (_PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST)
|
||||
{
|
||||
if (CBase.Playlist.GetNumPlaylists() > 0)
|
||||
{
|
||||
if (CBase.Playlist.GetSongCount(_Data.ScreenConfig.PlaylistID) > 0)
|
||||
if (CBase.Playlist.GetSongCount(_PartyMode.GameData.PlaylistID) > 0)
|
||||
{
|
||||
_ConfigOk = false;
|
||||
for (int i = 0; i < CBase.Playlist.GetSongCount(_Data.ScreenConfig.PlaylistID); i++)
|
||||
for (int i = 0; i < CBase.Playlist.GetSongCount(_PartyMode.GameData.PlaylistID); i++)
|
||||
{
|
||||
int id = CBase.Playlist.GetSong(_Data.ScreenConfig.PlaylistID, i).SongID;
|
||||
int id = CBase.Playlist.GetSong(_PartyMode.GameData.PlaylistID, i).SongID;
|
||||
_ConfigOk = CBase.Songs.GetSongByID(id).AvailableGameModes.Any(mode => mode == gm);
|
||||
if (_ConfigOk)
|
||||
break;
|
||||
@@ -252,15 +220,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
else
|
||||
_ConfigOk = false;
|
||||
}
|
||||
if (_Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY)
|
||||
if (_PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY)
|
||||
{
|
||||
if (CBase.Songs.GetNumCategories() == 0)
|
||||
_ConfigOk = false;
|
||||
else if (CBase.Songs.GetNumSongsNotSungInCategory(_Data.ScreenConfig.CategoryID) <= 0)
|
||||
else if (CBase.Songs.GetNumSongsNotSungInCategory(_PartyMode.GameData.CategoryID) <= 0)
|
||||
_ConfigOk = false;
|
||||
else
|
||||
{
|
||||
CBase.Songs.SetCategory(_Data.ScreenConfig.CategoryID);
|
||||
CBase.Songs.SetCategory(_PartyMode.GameData.CategoryID);
|
||||
_ConfigOk = false;
|
||||
foreach (CSong song in CBase.Songs.GetVisibleSongs())
|
||||
{
|
||||
@@ -271,7 +239,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
CBase.Songs.SetCategory(-1);
|
||||
}
|
||||
}
|
||||
if (_Data.ScreenConfig.SongSource == ESongSource.TR_ALLSONGS)
|
||||
if (_PartyMode.GameData.SongSource == ESongSource.TR_ALLSONGS)
|
||||
{
|
||||
if (CBase.Songs.GetNumSongs() > 0)
|
||||
{
|
||||
@@ -285,18 +253,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
else
|
||||
_ConfigOk = false;
|
||||
}
|
||||
_SelectSlides[_SelectSlideCategory].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_CATEGORY;
|
||||
_SelectSlides[_SelectSlidePlaylist].Visible = _Data.ScreenConfig.SongSource == ESongSource.TR_PLAYLIST;
|
||||
}
|
||||
|
||||
private void _Back()
|
||||
{
|
||||
_FadeTo(EScreens.ScreenParty);
|
||||
}
|
||||
|
||||
private void _Next()
|
||||
{
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
_SelectSlides[_SelectSlideCategory].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_CATEGORY;
|
||||
_SelectSlides[_SelectSlidePlaylist].Visible = _PartyMode.GameData.SongSource == ESongSource.TR_PLAYLIST;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
None
|
||||
}
|
||||
|
||||
public class CPartyScreenTicTacToeMain : CMenuParty
|
||||
// ReSharper disable UnusedMember.Global
|
||||
public class CPartyScreenTicTacToeMain : CPartyScreenTicTacToe
|
||||
// ReSharper restore UnusedMember.Global
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion
|
||||
@@ -71,9 +73,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private bool _ExitPopupVisible;
|
||||
|
||||
private SDataFromScreen _Data;
|
||||
private SDataToScreenMain _GameData;
|
||||
|
||||
private List<CField> _Fields;
|
||||
private float _FieldFirstX = 25;
|
||||
private float _FieldFirstY = 25;
|
||||
@@ -100,18 +99,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
};
|
||||
_ThemeStatics = new string[] {_StaticPopupBG, _StaticAvatarT1, _StaticAvatarT2};
|
||||
|
||||
_Data = new SDataFromScreen();
|
||||
var config = new SFromScreenMain();
|
||||
_GameData = new SDataToScreenMain();
|
||||
config.SingRoundNr = 1;
|
||||
config.Rounds = new List<CRound>();
|
||||
config.Songs = new List<int>();
|
||||
config.PlayerTeam1 = new List<int>();
|
||||
config.PlayerTeam2 = new List<int>();
|
||||
config.FadeToNameSelection = false;
|
||||
config.FadeToSinging = false;
|
||||
_Data.ScreenMain = config;
|
||||
|
||||
_Fields = new List<CField>();
|
||||
}
|
||||
|
||||
@@ -123,19 +110,6 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_Buttons[_ButtonField].Visible = false;
|
||||
}
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
{
|
||||
try
|
||||
{
|
||||
var config = (SDataToScreenMain)receivedData;
|
||||
_GameData = config;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe main. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
{
|
||||
base.HandleInput(keyEvent);
|
||||
@@ -149,7 +123,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
case Keys.Escape:
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (_GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
|
||||
_Back();
|
||||
else if (_Status == EStatus.None)
|
||||
_EndParty();
|
||||
@@ -165,13 +139,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
if (_Buttons[_ButtonNextRound].Selected)
|
||||
_NextRound();
|
||||
if (_Buttons[_ButtonBack].Selected && _GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
|
||||
if (_Buttons[_ButtonBack].Selected && _PartyMode.GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
|
||||
_Back();
|
||||
if (_Buttons[_ButtonExit].Selected && (_GameData.CurrentRoundNr > 1 || _Status == EStatus.FieldSelected) && _Status != EStatus.None)
|
||||
if (_Buttons[_ButtonExit].Selected && (_PartyMode.GameData.CurrentRoundNr > 1 || _Status == EStatus.FieldSelected) && _Status != EStatus.None)
|
||||
_ShowPopup(true);
|
||||
else if (_Status == EStatus.None)
|
||||
_EndParty();
|
||||
for (int i = 0; i < _GameData.NumFields; i++)
|
||||
for (int i = 0; i < _PartyMode.GameData.NumFields; i++)
|
||||
{
|
||||
switch (_Status)
|
||||
{
|
||||
@@ -236,7 +210,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
else
|
||||
_ShowPopup(true);
|
||||
}
|
||||
for (int i = 0; i < _GameData.NumFields; i++)
|
||||
for (int i = 0; i < _PartyMode.GameData.NumFields; i++)
|
||||
{
|
||||
switch (_Status)
|
||||
{
|
||||
@@ -282,7 +256,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
if (!_ExitPopupVisible)
|
||||
{
|
||||
if (_GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1 && _Status != EStatus.FieldSelected)
|
||||
_Back();
|
||||
else if (_Status == EStatus.None)
|
||||
_EndParty();
|
||||
@@ -304,7 +278,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
_PreviewStream = -1;
|
||||
|
||||
if (_GameData.CurrentRoundNr == 1)
|
||||
if (_PartyMode.GameData.CurrentRoundNr == 1)
|
||||
{
|
||||
_BuildWinnerPossibilities();
|
||||
_SelectedField = -1;
|
||||
@@ -325,7 +299,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_UpdateFieldContents();
|
||||
|
||||
int winner = _GetWinner();
|
||||
if (_GameData.CurrentRoundNr <= _GameData.NumFields && winner == 0)
|
||||
if (_PartyMode.GameData.CurrentRoundNr <= _PartyMode.GameData.NumFields && winner == 0)
|
||||
{
|
||||
_UpdateTeamChoosingMessage();
|
||||
_Texts[_TextNextPlayerT1].Visible = false;
|
||||
@@ -373,7 +347,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
base.OnClose();
|
||||
CBase.BackgroundMusic.SetDisabled(false);
|
||||
CBase.Sound.Fade(_PreviewStream, 0f, 0.5f, EStreamAction.Close);
|
||||
CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close);
|
||||
}
|
||||
|
||||
private void _CreateFields()
|
||||
@@ -390,7 +364,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void _UpdateFields()
|
||||
{
|
||||
var numOneRow = (int)Math.Sqrt(_GameData.NumFields);
|
||||
var numOneRow = (int)Math.Sqrt(_PartyMode.GameData.NumFields);
|
||||
float fieldSizeY = ((float)CBase.Settings.GetRenderH() - 150 - numOneRow * _FieldSpace) / numOneRow;
|
||||
float fieldSizeX = ((float)CBase.Settings.GetRenderW() - 300 - numOneRow * _FieldSpace) / numOneRow;
|
||||
_FieldSize = Math.Min(fieldSizeX, fieldSizeY);
|
||||
@@ -402,7 +376,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
float y = _FieldFirstY;
|
||||
for (int i = 0; i < _Fields.Count; i++)
|
||||
{
|
||||
if (i < _GameData.NumFields)
|
||||
if (i < _PartyMode.GameData.NumFields)
|
||||
{
|
||||
_Fields[i].Button.W = _FieldSize;
|
||||
_Fields[i].Button.H = _FieldSize;
|
||||
@@ -431,13 +405,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void _UpdateFieldContents()
|
||||
{
|
||||
for (int i = 0; i < _GameData.Rounds.Count; i++)
|
||||
for (int i = 0; i < _PartyMode.GameData.Rounds.Count; i++)
|
||||
{
|
||||
_Fields[i].Button.Selectable = true;
|
||||
_Fields[i].Button.Texture = _Buttons[_ButtonField].Texture;
|
||||
_Fields[i].Button.Color = _Buttons[_ButtonField].Color;
|
||||
_Fields[i].Button.SelColor = _Buttons[_ButtonField].SelColor;
|
||||
_Fields[i].Content = _GameData.Rounds[i];
|
||||
_Fields[i].Content = _PartyMode.GameData.Rounds[i];
|
||||
if (_Fields[i].Content.Finished)
|
||||
{
|
||||
_Fields[i].Button.Selectable = false;
|
||||
@@ -454,7 +428,7 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
}
|
||||
if (_Status == EStatus.JokerRetry && _Fields[i].Content.Finished)
|
||||
{
|
||||
_Fields[i].Button.SelColor = CBase.Themes.GetPlayerColor(_GameData.Team + 1);
|
||||
_Fields[i].Button.SelColor = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Team + 1);
|
||||
_Fields[i].Button.Selectable = true;
|
||||
}
|
||||
if (_Status == EStatus.JokerRetry && !_Fields[i].Content.Finished)
|
||||
@@ -471,40 +445,33 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
int singerTeam1 = 0;
|
||||
int singerTeam2 = 0;
|
||||
|
||||
if (_GameData.PlayerTeam1.Count > 0)
|
||||
if (_PartyMode.GameData.PlayerTeam1.Count > 0)
|
||||
{
|
||||
singerTeam1 = _GameData.PlayerTeam1[0];
|
||||
_GameData.PlayerTeam1.RemoveAt(0);
|
||||
singerTeam1 = _PartyMode.GameData.PlayerTeam1[0];
|
||||
_PartyMode.GameData.PlayerTeam1.RemoveAt(0);
|
||||
}
|
||||
|
||||
if (_GameData.PlayerTeam2.Count > 0)
|
||||
if (_PartyMode.GameData.PlayerTeam2.Count > 0)
|
||||
{
|
||||
singerTeam2 = _GameData.PlayerTeam2[0];
|
||||
_GameData.PlayerTeam2.RemoveAt(0);
|
||||
singerTeam2 = _PartyMode.GameData.PlayerTeam2[0];
|
||||
_PartyMode.GameData.PlayerTeam2.RemoveAt(0);
|
||||
}
|
||||
_GameData.Rounds[_SelectedField].SingerTeam1 = singerTeam1;
|
||||
_GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2;
|
||||
_PartyMode.GameData.Rounds[_SelectedField].SingerTeam1 = singerTeam1;
|
||||
_PartyMode.GameData.Rounds[_SelectedField].SingerTeam2 = singerTeam2;
|
||||
|
||||
_UpdatePlayerInformation();
|
||||
}
|
||||
int songID = 0;
|
||||
if (_GameData.Songs.Count > 0)
|
||||
if (_PartyMode.GameData.Songs.Count > 0)
|
||||
{
|
||||
songID = _GameData.Songs[0];
|
||||
_GameData.Songs.RemoveAt(0);
|
||||
songID = _PartyMode.GameData.Songs[0];
|
||||
_PartyMode.GameData.Songs.RemoveAt(0);
|
||||
}
|
||||
CSong song = CBase.Songs.GetSongByID(songID);
|
||||
|
||||
CBase.BackgroundMusic.SetDisabled(true);
|
||||
|
||||
_PreviewStream = CBase.Sound.Load(song.GetMP3());
|
||||
CBase.Sound.SetPosition(_PreviewStream, song.Preview.StartTime);
|
||||
CBase.Sound.SetStreamVolume(_PreviewStream, 0f);
|
||||
CBase.Sound.Play(_PreviewStream);
|
||||
CBase.Sound.Fade(_PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f);
|
||||
_StartPreview(songID);
|
||||
_Status = EStatus.FieldSelected;
|
||||
_Fields[_SelectedField].Content.SongID = songID;
|
||||
_GameData.Rounds[_SelectedField].SongID = songID;
|
||||
_PartyMode.GameData.Rounds[_SelectedField].SongID = songID;
|
||||
_UpdateFieldContents();
|
||||
_UpdateJokerButtons();
|
||||
|
||||
@@ -518,23 +485,15 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
private void _FieldSelectedAgain()
|
||||
{
|
||||
int songID = _Fields[_SelectedField].Content.SongID;
|
||||
CSong song = CBase.Songs.GetSongByID(songID);
|
||||
CBase.BackgroundMusic.SetDisabled(true);
|
||||
|
||||
_PreviewStream = CBase.Sound.Load(song.GetMP3());
|
||||
CBase.Sound.SetPosition(_PreviewStream, song.Preview.StartTime);
|
||||
CBase.Sound.SetStreamVolume(_PreviewStream, 0f);
|
||||
CBase.Sound.Play(_PreviewStream);
|
||||
CBase.Sound.Fade(_PreviewStream, CBase.Config.GetBackgroundMusicVolume(), 1f);
|
||||
_StartPreview(songID);
|
||||
_Status = EStatus.FieldSelected;
|
||||
_Fields[_SelectedField].Content.SongID = songID;
|
||||
_GameData.Rounds[_SelectedField].SongID = songID;
|
||||
_GameData.Rounds[_SelectedField].SingerTeam1 = _GameData.Rounds[_OldSelectedField].SingerTeam1;
|
||||
_GameData.Rounds[_SelectedField].SingerTeam2 = _GameData.Rounds[_OldSelectedField].SingerTeam2;
|
||||
_PartyMode.GameData.Rounds[_SelectedField].SongID = songID;
|
||||
_PartyMode.GameData.Rounds[_SelectedField].SingerTeam1 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam1;
|
||||
_PartyMode.GameData.Rounds[_SelectedField].SingerTeam2 = _PartyMode.GameData.Rounds[_OldSelectedField].SingerTeam2;
|
||||
_UpdateFieldContents();
|
||||
|
||||
_UpdatePlayerInformation();
|
||||
|
||||
_UpdateJokerButtons();
|
||||
|
||||
_Buttons[_ButtonNextRound].Visible = true;
|
||||
@@ -544,18 +503,31 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
_SelectElement(_Buttons[_ButtonNextRound]);
|
||||
}
|
||||
|
||||
private void _StartPreview(int songID)
|
||||
{
|
||||
CSong song = CBase.Songs.GetSongByID(songID);
|
||||
CBase.BackgroundMusic.SetDisabled(true);
|
||||
|
||||
_PreviewStream = CBase.Sound.Load(song.GetMP3());
|
||||
CBase.Sound.SetGlobalVolume(CBase.Config.GetMusicVolume(EMusicType.Preview));
|
||||
CBase.Sound.SetPosition(_PreviewStream, song.Preview.StartTime);
|
||||
CBase.Sound.SetStreamVolume(_PreviewStream, 0);
|
||||
CBase.Sound.Play(_PreviewStream);
|
||||
CBase.Sound.Fade(_PreviewStream, 100, 1f);
|
||||
}
|
||||
|
||||
private void _UpdatePlayerInformation()
|
||||
{
|
||||
_Texts[_TextNextPlayerT1].Visible = true;
|
||||
_Texts[_TextNextPlayerT2].Visible = true;
|
||||
_Texts[_TextNextPlayerNameT1].Visible = true;
|
||||
_Texts[_TextNextPlayerNameT2].Visible = true;
|
||||
_Texts[_TextNextPlayerNameT1].Text = CBase.Profiles.GetPlayerName(_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]);
|
||||
_Texts[_TextNextPlayerNameT2].Text = CBase.Profiles.GetPlayerName(_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]);
|
||||
_Texts[_TextNextPlayerNameT1].Text = CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam1]);
|
||||
_Texts[_TextNextPlayerNameT2].Text = CBase.Profiles.GetPlayerName(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam2]);
|
||||
_Statics[_StaticAvatarT1].Visible = true;
|
||||
_Statics[_StaticAvatarT2].Visible = true;
|
||||
_Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_GameData.ProfileIDsTeam1[_GameData.Rounds[_SelectedField].SingerTeam1]);
|
||||
_Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_GameData.ProfileIDsTeam2[_GameData.Rounds[_SelectedField].SingerTeam2]);
|
||||
_Statics[_StaticAvatarT1].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam1[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam1]);
|
||||
_Statics[_StaticAvatarT2].Texture = CBase.Profiles.GetAvatar(_PartyMode.GameData.ProfileIDsTeam2[_PartyMode.GameData.Rounds[_SelectedField].SingerTeam2]);
|
||||
}
|
||||
|
||||
private void _UseJoker(int teamNr, int jokerNum)
|
||||
@@ -564,9 +536,9 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
//Random-Joker
|
||||
case 0:
|
||||
if (_GameData.NumJokerRandom[teamNr] > 0)
|
||||
if (_PartyMode.GameData.NumJokerRandom[teamNr] > 0)
|
||||
{
|
||||
_GameData.NumJokerRandom[teamNr]--;
|
||||
_PartyMode.GameData.NumJokerRandom[teamNr]--;
|
||||
if (!CBase.Sound.IsFinished(_PreviewStream))
|
||||
CBase.Sound.Fade(_PreviewStream, 0, 1, EStreamAction.Close);
|
||||
_FieldSelected(true);
|
||||
@@ -575,10 +547,10 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
//Retry-Joker
|
||||
case 1:
|
||||
if (_GameData.NumJokerRetry[teamNr] > 0 && _GameData.CurrentRoundNr > 1)
|
||||
if (_PartyMode.GameData.NumJokerRetry[teamNr] > 0 && _PartyMode.GameData.CurrentRoundNr > 1)
|
||||
{
|
||||
_GameData.NumJokerRetry[teamNr]--;
|
||||
_GameData.Team = teamNr;
|
||||
_PartyMode.GameData.NumJokerRetry[teamNr]--;
|
||||
_PartyMode.GameData.Team = teamNr;
|
||||
if (!CBase.Sound.IsFinished(_PreviewStream))
|
||||
CBase.Sound.Fade(_PreviewStream, 0, 1, EStreamAction.Close);
|
||||
_Status = EStatus.JokerRetry;
|
||||
@@ -594,8 +566,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void _UpdateTeamChoosingMessage()
|
||||
{
|
||||
_Texts[_TextTeamChoosing].Color = CBase.Themes.GetPlayerColor(_GameData.Team + 1);
|
||||
_Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", PartyModeID) + " " + (_GameData.Team + 1) + "! " +
|
||||
_Texts[_TextTeamChoosing].Color = CBase.Themes.GetPlayerColor(_PartyMode.GameData.Team + 1);
|
||||
_Texts[_TextTeamChoosing].Text = CBase.Language.Translate("TR_TEAM", PartyModeID) + " " + (_PartyMode.GameData.Team + 1) + "! " +
|
||||
CBase.Language.Translate("TR_SCREENMAIN_TEAM_CHOOSE", PartyModeID);
|
||||
if (_Status == EStatus.JokerRetry || _Status == EStatus.FieldChoosing)
|
||||
_Texts[_TextTeamChoosing].Visible = true;
|
||||
@@ -607,35 +579,28 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
{
|
||||
_Buttons[_ButtonJokerRandomT1].Visible = true;
|
||||
_Buttons[_ButtonJokerRandomT2].Visible = true;
|
||||
_Buttons[_ButtonJokerRandomT1].Text.Text = _GameData.NumJokerRandom[0].ToString();
|
||||
_Buttons[_ButtonJokerRandomT2].Text.Text = _GameData.NumJokerRandom[1].ToString();
|
||||
_Buttons[_ButtonJokerRandomT1].Selectable = _GameData.NumJokerRandom[0] > 0;
|
||||
_Buttons[_ButtonJokerRandomT2].Selectable = _GameData.NumJokerRandom[1] > 0;
|
||||
_Buttons[_ButtonJokerRandomT1].Text.Text = _PartyMode.GameData.NumJokerRandom[0].ToString();
|
||||
_Buttons[_ButtonJokerRandomT2].Text.Text = _PartyMode.GameData.NumJokerRandom[1].ToString();
|
||||
_Buttons[_ButtonJokerRandomT1].Selectable = _PartyMode.GameData.NumJokerRandom[0] > 0;
|
||||
_Buttons[_ButtonJokerRandomT2].Selectable = _PartyMode.GameData.NumJokerRandom[1] > 0;
|
||||
_Buttons[_ButtonJokerRetryT1].Visible = true;
|
||||
_Buttons[_ButtonJokerRetryT2].Visible = true;
|
||||
_Buttons[_ButtonJokerRetryT1].Text.Text = _GameData.NumJokerRetry[0].ToString();
|
||||
_Buttons[_ButtonJokerRetryT2].Text.Text = _GameData.NumJokerRetry[1].ToString();
|
||||
_Buttons[_ButtonJokerRetryT1].Selectable = _GameData.NumJokerRetry[0] > 0;
|
||||
_Buttons[_ButtonJokerRetryT2].Selectable = _GameData.NumJokerRetry[1] > 0;
|
||||
_Buttons[_ButtonJokerRetryT1].Text.Text = _PartyMode.GameData.NumJokerRetry[0].ToString();
|
||||
_Buttons[_ButtonJokerRetryT2].Text.Text = _PartyMode.GameData.NumJokerRetry[1].ToString();
|
||||
_Buttons[_ButtonJokerRetryT1].Selectable = _PartyMode.GameData.NumJokerRetry[0] > 0;
|
||||
_Buttons[_ButtonJokerRetryT2].Selectable = _PartyMode.GameData.NumJokerRetry[1] > 0;
|
||||
}
|
||||
|
||||
private void _NextRound()
|
||||
{
|
||||
CBase.Sound.Fade(_PreviewStream, 0f, 0.5f, EStreamAction.Close);
|
||||
_Data.ScreenMain.Rounds = _GameData.Rounds;
|
||||
_Data.ScreenMain.FadeToNameSelection = false;
|
||||
_Data.ScreenMain.FadeToSinging = true;
|
||||
_Data.ScreenMain.Songs = _GameData.Songs;
|
||||
_Data.ScreenMain.SingRoundNr = _SelectedField;
|
||||
_Data.ScreenMain.PlayerTeam1 = _GameData.PlayerTeam1;
|
||||
_Data.ScreenMain.PlayerTeam2 = _GameData.PlayerTeam2;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close);
|
||||
_PartyMode.Next();
|
||||
}
|
||||
|
||||
private void _EndParty()
|
||||
{
|
||||
CBase.Sound.Fade(_PreviewStream, 0f, 0.5f, EStreamAction.Close);
|
||||
_FadeTo(EScreens.ScreenParty);
|
||||
CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close);
|
||||
CBase.Graphics.FadeTo(EScreen.Party);
|
||||
}
|
||||
|
||||
private void _ShowPopup(bool visible)
|
||||
@@ -653,16 +618,13 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
|
||||
private void _Back()
|
||||
{
|
||||
CBase.Sound.Fade(_PreviewStream, 0f, 0.5f, EStreamAction.Close);
|
||||
_Data.ScreenMain.FadeToNameSelection = true;
|
||||
_Data.ScreenMain.FadeToSinging = false;
|
||||
_Data.ScreenMain.SingRoundNr = _SelectedField;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
CBase.Sound.Fade(_PreviewStream, 0, 0.5f, EStreamAction.Close);
|
||||
_PartyMode.Back();
|
||||
}
|
||||
|
||||
private void _BuildWinnerPossibilities()
|
||||
{
|
||||
var numOneRow = (int)Math.Sqrt(_GameData.NumFields);
|
||||
var numOneRow = (int)Math.Sqrt(_PartyMode.GameData.NumFields);
|
||||
_Possibilities = new int[(numOneRow * 2) + 2,numOneRow];
|
||||
for (int i = 0; i < _Possibilities.GetLength(0); i++)
|
||||
{
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
@@ -31,89 +30,57 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
||||
get { return 1; }
|
||||
}
|
||||
|
||||
private int _NumPlayerTeam1 = 2;
|
||||
private int _NumPlayerTeam2 = 2;
|
||||
|
||||
private SDataFromScreen _Data;
|
||||
private new CPartyModeTicTacToe _PartyMode;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
|
||||
_Data.ScreenNames.ProfileIDsTeam1 = new List<int>();
|
||||
_Data.ScreenNames.ProfileIDsTeam2 = new List<int>();
|
||||
|
||||
_Data = new SDataFromScreen();
|
||||
var names = new SFromScreenNames {FadeToConfig = false, ProfileIDsTeam1 = new List<int>(), ProfileIDsTeam2 = new List<int>()};
|
||||
_Data.ScreenNames = names;
|
||||
}
|
||||
|
||||
public override void DataToScreen(object receivedData)
|
||||
{
|
||||
try
|
||||
{
|
||||
var config = (SDataToScreenNames)receivedData;
|
||||
_Data.ScreenNames.ProfileIDsTeam1 = config.ProfileIDsTeam1;
|
||||
_Data.ScreenNames.ProfileIDsTeam2 = config.ProfileIDsTeam2;
|
||||
if (_Data.ScreenNames.ProfileIDsTeam1 == null)
|
||||
_Data.ScreenNames.ProfileIDsTeam1 = new List<int>();
|
||||
if (_Data.ScreenNames.ProfileIDsTeam2 == null)
|
||||
_Data.ScreenNames.ProfileIDsTeam2 = new List<int>();
|
||||
|
||||
_NumPlayerTeam1 = config.NumPlayerTeam1;
|
||||
_NumPlayerTeam2 = config.NumPlayerTeam2;
|
||||
|
||||
while (_Data.ScreenNames.ProfileIDsTeam1.Count > _NumPlayerTeam1)
|
||||
_Data.ScreenNames.ProfileIDsTeam1.RemoveAt(_Data.ScreenNames.ProfileIDsTeam1.Count - 1);
|
||||
while (_Data.ScreenNames.ProfileIDsTeam2.Count > _NumPlayerTeam2)
|
||||
_Data.ScreenNames.ProfileIDsTeam2.RemoveAt(_Data.ScreenNames.ProfileIDsTeam2.Count - 1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CBase.Log.LogError("Error in party mode screen TicTacToe names. Can't cast received data from game mode " + ThemeName + ". " + e.Message);
|
||||
}
|
||||
_PartyMode = (CPartyModeTicTacToe)base._PartyMode;
|
||||
}
|
||||
|
||||
public override void OnShow()
|
||||
{
|
||||
base.OnShow();
|
||||
SetPartyModeData(2, _NumPlayerTeam1 + _NumPlayerTeam2, new int[] {_NumPlayerTeam1, _NumPlayerTeam2});
|
||||
List<int>[] ids = new List<int>[] {_Data.ScreenNames.ProfileIDsTeam1, _Data.ScreenNames.ProfileIDsTeam2};
|
||||
|
||||
while (_PartyMode.GameData.ProfileIDsTeam1.Count > _PartyMode.GameData.NumPlayerTeam1)
|
||||
_PartyMode.GameData.ProfileIDsTeam1.RemoveAt(_PartyMode.GameData.ProfileIDsTeam1.Count - 1);
|
||||
while (_PartyMode.GameData.ProfileIDsTeam2.Count > _PartyMode.GameData.NumPlayerTeam2)
|
||||
_PartyMode.GameData.ProfileIDsTeam2.RemoveAt(_PartyMode.GameData.ProfileIDsTeam2.Count - 1);
|
||||
|
||||
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};
|
||||
SetPartyModeProfiles(ids);
|
||||
}
|
||||
|
||||
public override void Back()
|
||||
{
|
||||
SPartyNameOptions options = GetData();
|
||||
if (options.TeamList.Length == 2)
|
||||
if (_TeamList.Length == 2)
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDsTeam1 = options.TeamList[0];
|
||||
_Data.ScreenNames.ProfileIDsTeam2 = options.TeamList[1];
|
||||
_PartyMode.GameData.ProfileIDsTeam1 = _TeamList[0];
|
||||
_PartyMode.GameData.ProfileIDsTeam2 = _TeamList[1];
|
||||
}
|
||||
if (options.NumPlayerTeams.Length == 2)
|
||||
if (_NumPlayerTeams.Length == 2)
|
||||
{
|
||||
_Data.ScreenNames.NumPlayerTeam1 = options.NumPlayerTeams[0];
|
||||
_Data.ScreenNames.NumPlayerTeam2 = options.NumPlayerTeams[1];
|
||||
_PartyMode.GameData.NumPlayerTeam1 = _NumPlayerTeams[0];
|
||||
_PartyMode.GameData.NumPlayerTeam2 = _NumPlayerTeams[1];
|
||||
}
|
||||
_Data.ScreenNames.FadeToConfig = true;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
_PartyMode.Back();
|
||||
}
|
||||
|
||||
public override void Next()
|
||||
{
|
||||
SPartyNameOptions options = GetData();
|
||||
if (options.TeamList.Length == 2)
|
||||
if (_TeamList.Length == 2)
|
||||
{
|
||||
_Data.ScreenNames.ProfileIDsTeam1 = options.TeamList[0];
|
||||
_Data.ScreenNames.ProfileIDsTeam2 = options.TeamList[1];
|
||||
_PartyMode.GameData.ProfileIDsTeam1 = _TeamList[0];
|
||||
_PartyMode.GameData.ProfileIDsTeam2 = _TeamList[1];
|
||||
}
|
||||
if (options.NumPlayerTeams.Length == 2)
|
||||
if (_NumPlayerTeams.Length == 2)
|
||||
{
|
||||
_Data.ScreenNames.NumPlayerTeam1 = options.NumPlayerTeams[0];
|
||||
_Data.ScreenNames.NumPlayerTeam2 = options.NumPlayerTeams[1];
|
||||
_PartyMode.GameData.NumPlayerTeam1 = _NumPlayerTeams[0];
|
||||
_PartyMode.GameData.NumPlayerTeam2 = _NumPlayerTeams[1];
|
||||
}
|
||||
_Data.ScreenNames.FadeToConfig = false;
|
||||
_PartyMode.DataFromScreen(ThemeName, _Data);
|
||||
_PartyMode.Next();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,8 @@ using System.Text.RegularExpressions;
|
||||
namespace ServerLib
|
||||
{
|
||||
public delegate bool SendKeyEventDelegate(string key);
|
||||
public delegate bool SendKeyStringEventDelegate(string keyString, bool isShiftPressed , bool isAltPressed , bool isCtrlPressed);
|
||||
|
||||
public delegate bool SendKeyStringEventDelegate(string keyString, bool isShiftPressed, bool isAltPressed, bool isCtrlPressed);
|
||||
|
||||
#region profile
|
||||
public delegate SProfileData GetProfileDataDelegate(int profileId, bool isReadonly);
|
||||
|
||||
@@ -161,10 +161,8 @@ namespace Vocaluxe.Base
|
||||
_AddBackgroundMusic();
|
||||
|
||||
_SongPlayer = new CSongPlayer();
|
||||
_SongPlayer.Volume = CConfig.BackgroundMusicVolume;
|
||||
|
||||
_PreviewPlayer = new CSongPlayer();
|
||||
_PreviewPlayer.Volume = CConfig.PreviewMusicVolume;
|
||||
_PreviewPlayer.RepeatSong = true;
|
||||
|
||||
_VideoEnabled = (CConfig.Config.Video.VideoBackgrounds == EOffOn.TR_CONFIG_ON && CConfig.Config.Video.VideosToBackground == EOffOn.TR_CONFIG_ON);
|
||||
@@ -213,6 +211,7 @@ namespace Vocaluxe.Base
|
||||
_PreviewPlayer.Stop();
|
||||
_PlaysPreview = false;
|
||||
Pause();
|
||||
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -344,6 +343,7 @@ namespace Vocaluxe.Base
|
||||
start = song.Preview.StartTime;
|
||||
|
||||
_PlaysPreview = true;
|
||||
CSound.SetGlobalVolume(CConfig.PreviewMusicVolume);
|
||||
_PreviewPlayer.Load(song, start);
|
||||
|
||||
float startposition = song.Preview.StartTime;
|
||||
@@ -375,6 +375,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
_PreviewPlayer.Stop();
|
||||
_PlaysPreview = false;
|
||||
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -19,6 +19,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -208,6 +209,39 @@ namespace Vocaluxe.Base
|
||||
private static readonly List<string> _Params = new List<string>();
|
||||
private static readonly List<string> _Values = new List<string>();
|
||||
|
||||
public static int GetVolumeByType(EMusicType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case EMusicType.Preview:
|
||||
return PreviewMusicVolume;
|
||||
case EMusicType.Game:
|
||||
return GameMusicVolume;
|
||||
case EMusicType.Background:
|
||||
return BackgroundMusicVolume;
|
||||
default:
|
||||
throw new ArgumentException("Invalid type: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
public static void SetVolumeByType(EMusicType type, int volume)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case EMusicType.Preview:
|
||||
PreviewMusicVolume = volume;
|
||||
break;
|
||||
case EMusicType.Game:
|
||||
GameMusicVolume = volume;
|
||||
break;
|
||||
case EMusicType.Background:
|
||||
BackgroundMusicVolume = volume;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Invalid type: " + type);
|
||||
}
|
||||
}
|
||||
|
||||
public static int BackgroundMusicVolume
|
||||
{
|
||||
get { return Config.Sound.BackgroundMusicVolume; }
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Vocaluxe.Screens;
|
||||
using Vocaluxe.SongQueue;
|
||||
using VocaluxeLib;
|
||||
using VocaluxeLib.Game;
|
||||
@@ -187,6 +188,11 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
}
|
||||
|
||||
public static void GotoNameSelection()
|
||||
{
|
||||
CGraphics.FadeTo(EScreen.Names);
|
||||
}
|
||||
|
||||
public static void ResetPlayer()
|
||||
{
|
||||
for (int i = 0; i < Players.Length; i++)
|
||||
|
||||
+94
-134
@@ -25,7 +25,6 @@ using Vocaluxe.Base.ThemeSystem;
|
||||
using Vocaluxe.Screens;
|
||||
using VocaluxeLib;
|
||||
using VocaluxeLib.Menu;
|
||||
using VocaluxeLib.PartyModes;
|
||||
|
||||
namespace Vocaluxe.Base
|
||||
{
|
||||
@@ -33,11 +32,7 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
private static CFading _Fading;
|
||||
private static readonly CCursor _Cursor = new CCursor();
|
||||
private static float _GlobalAlpha;
|
||||
private static float _ZOffset;
|
||||
|
||||
private static EScreens _CurrentScreen;
|
||||
private static EScreens _NextScreen;
|
||||
private static EPopupScreens _CurrentPopupScreen;
|
||||
|
||||
private static readonly List<IMenu> _Screens = new List<IMenu>();
|
||||
@@ -46,24 +41,20 @@ namespace Vocaluxe.Base
|
||||
private static Stopwatch _VolumePopupTimer;
|
||||
private static bool _CursorOverVolumeControl;
|
||||
|
||||
public static float GlobalAlpha
|
||||
{
|
||||
get { return _GlobalAlpha; }
|
||||
}
|
||||
public static float GlobalAlpha { get; private set; }
|
||||
|
||||
public static float ZOffset
|
||||
{
|
||||
get { return _ZOffset; }
|
||||
}
|
||||
public static float ZOffset { get; private set; }
|
||||
|
||||
public static EScreens CurrentScreen
|
||||
{
|
||||
get { return _CurrentScreen; }
|
||||
}
|
||||
public static IMenu CurrentScreen { get; private set; }
|
||||
|
||||
public static EScreens NextScreen
|
||||
public static IMenu NextScreen { get; private set; }
|
||||
public static EScreen NextScreenType
|
||||
{
|
||||
get { return _NextScreen; }
|
||||
get
|
||||
{
|
||||
int id = _Screens.IndexOf(NextScreen);
|
||||
return (EScreen)id;
|
||||
}
|
||||
}
|
||||
|
||||
#region public methods
|
||||
@@ -91,7 +82,8 @@ namespace Vocaluxe.Base
|
||||
_Screens.Add(new CScreenNames());
|
||||
_Screens.Add(new CScreenCredits());
|
||||
_Screens.Add(new CScreenParty());
|
||||
_Screens.Add(new CScreenPartyDummy());
|
||||
|
||||
Debug.Assert(_Screens.Count == (int)EScreen.CountEntry, "Screen list and screens enum do not match");
|
||||
|
||||
_PopupScreens.Add(new CPopupScreenPlayerControl());
|
||||
_PopupScreens.Add(new CPopupScreenVolumeControl());
|
||||
@@ -99,13 +91,13 @@ namespace Vocaluxe.Base
|
||||
|
||||
CLog.StopBenchmark("Build Screen List");
|
||||
|
||||
_CurrentScreen = EScreens.ScreenLoad;
|
||||
_NextScreen = EScreens.ScreenNull;
|
||||
CurrentScreen = _Screens[(int)EScreen.Load];
|
||||
NextScreen = null;
|
||||
_CurrentPopupScreen = EPopupScreens.NoPopup;
|
||||
_VolumePopupTimer = new Stopwatch();
|
||||
|
||||
_GlobalAlpha = 1f;
|
||||
_ZOffset = 0f;
|
||||
GlobalAlpha = 1f;
|
||||
ZOffset = 0f;
|
||||
|
||||
CLog.StartBenchmark("Load Theme");
|
||||
LoadTheme();
|
||||
@@ -116,8 +108,8 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
if (_CurrentPopupScreen != EPopupScreens.NoPopup && _PopupScreens.Count > 0)
|
||||
_PopupScreens[(int)_CurrentPopupScreen].OnClose();
|
||||
if (_Screens.Count > 0)
|
||||
_Screens[(int)_CurrentScreen].OnClose();
|
||||
if (CurrentScreen != null)
|
||||
CurrentScreen.OnClose();
|
||||
}
|
||||
|
||||
public static void LoadTheme()
|
||||
@@ -126,10 +118,10 @@ namespace Vocaluxe.Base
|
||||
|
||||
for (int i = 0; i < _Screens.Count; i++)
|
||||
{
|
||||
CLog.StartBenchmark("Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
|
||||
CLog.StartBenchmark("Load Theme " + Enum.GetNames(typeof(EScreen))[i]);
|
||||
_Screens[i].Init();
|
||||
_Screens[i].LoadTheme(CThemes.GetThemeScreensPath(_Screens[i].PartyModeID));
|
||||
CLog.StopBenchmark("Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
|
||||
CLog.StopBenchmark("Load Theme " + Enum.GetNames(typeof(EScreen))[i]);
|
||||
}
|
||||
|
||||
foreach (IMenu popup in _PopupScreens)
|
||||
@@ -181,8 +173,8 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static void InitFirstScreen()
|
||||
{
|
||||
_Screens[(int)_CurrentScreen].OnShow();
|
||||
_Screens[(int)_CurrentScreen].OnShowFinish();
|
||||
CurrentScreen.OnShow();
|
||||
CurrentScreen.OnShowFinish();
|
||||
}
|
||||
|
||||
public static bool UpdateGameLogic(CKeys keys, CMouse mouse)
|
||||
@@ -216,18 +208,18 @@ namespace Vocaluxe.Base
|
||||
|
||||
public static bool Draw()
|
||||
{
|
||||
if (_NextScreen != EScreens.ScreenNull && _Fading == null)
|
||||
if (NextScreen != null && _Fading == null)
|
||||
{
|
||||
_Fading = new CFading(0f, 1f, CConfig.Config.Graphics.FadeTime);
|
||||
|
||||
if (_NextScreen == EScreens.ScreenPartyDummy)
|
||||
if (NextScreen.PartyModeID != -1)
|
||||
{
|
||||
CFonts.PartyModeID = CParty.CurrentPartyModeID;
|
||||
_Screens[(int)_NextScreen].OnShow();
|
||||
CFonts.PartyModeID = NextScreen.PartyModeID;
|
||||
NextScreen.OnShow();
|
||||
CFonts.PartyModeID = -1;
|
||||
}
|
||||
else
|
||||
_Screens[(int)_NextScreen].OnShow();
|
||||
NextScreen.OnShow();
|
||||
|
||||
HidePopup(EPopupScreens.PopupPlayerControl);
|
||||
}
|
||||
@@ -239,35 +231,27 @@ namespace Vocaluxe.Base
|
||||
|
||||
if (!finished)
|
||||
{
|
||||
_GlobalAlpha = 1f; // -newAlpha / 100f;
|
||||
_ZOffset = CSettings.ZFar / 2;
|
||||
GlobalAlpha = 1f;
|
||||
ZOffset = CSettings.ZFar / 2;
|
||||
_DrawScreen(CurrentScreen);
|
||||
|
||||
_DrawScreen(_CurrentScreen);
|
||||
GlobalAlpha = newAlpha;
|
||||
ZOffset = 0f;
|
||||
_DrawScreen(NextScreen);
|
||||
|
||||
|
||||
_GlobalAlpha = newAlpha;
|
||||
_ZOffset = 0f;
|
||||
|
||||
_DrawScreen(_NextScreen);
|
||||
|
||||
_GlobalAlpha = 1f;
|
||||
GlobalAlpha = 1f;
|
||||
}
|
||||
else
|
||||
{
|
||||
_Screens[(int)_CurrentScreen].OnClose();
|
||||
_CurrentScreen = _NextScreen;
|
||||
_NextScreen = EScreens.ScreenNull;
|
||||
_Screens[(int)_CurrentScreen].OnShowFinish();
|
||||
_FinishScreenFading();
|
||||
if (_Cursor.IsActive)
|
||||
_Screens[(int)_CurrentScreen].ProcessMouseMove(_Cursor.X, _Cursor.Y);
|
||||
CurrentScreen.ProcessMouseMove(_Cursor.X, _Cursor.Y);
|
||||
|
||||
_DrawScreen(_CurrentScreen);
|
||||
|
||||
_Fading = null;
|
||||
_DrawScreen(CurrentScreen);
|
||||
}
|
||||
}
|
||||
else
|
||||
_DrawScreen(_CurrentScreen);
|
||||
_DrawScreen(CurrentScreen);
|
||||
|
||||
foreach (IMenu popup in _PopupScreens)
|
||||
popup.Draw();
|
||||
@@ -278,33 +262,53 @@ namespace Vocaluxe.Base
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void _DrawScreen(EScreens screen)
|
||||
private static void _FinishScreenFading()
|
||||
{
|
||||
if (screen == EScreens.ScreenPartyDummy)
|
||||
if (_Fading == null)
|
||||
return;
|
||||
Debug.Assert(NextScreen != null);
|
||||
CurrentScreen.OnClose();
|
||||
CurrentScreen = NextScreen;
|
||||
NextScreen = null;
|
||||
CurrentScreen.OnShowFinish();
|
||||
CSound.SetGlobalVolume(CConfig.GetVolumeByType(CurrentScreen.CurrentMusicType));
|
||||
_Fading = null;
|
||||
}
|
||||
|
||||
private static void _DrawScreen(IMenu screen)
|
||||
{
|
||||
if (screen.PartyModeID != -1)
|
||||
{
|
||||
CFonts.PartyModeID = CParty.CurrentPartyModeID;
|
||||
_Screens[(int)screen].Draw();
|
||||
CFonts.PartyModeID = screen.PartyModeID;
|
||||
screen.Draw();
|
||||
CFonts.PartyModeID = -1;
|
||||
}
|
||||
else
|
||||
_Screens[(int)screen].Draw();
|
||||
screen.Draw();
|
||||
}
|
||||
|
||||
public static void FadeTo(EScreens screen)
|
||||
public static IMenu GetScreen(EScreen screen)
|
||||
{
|
||||
if (screen == EScreens.ScreenPartyDummy)
|
||||
{
|
||||
EScreens alt;
|
||||
CMenu scr = CParty.GetNextPartyScreen(out alt);
|
||||
if (scr == null)
|
||||
{
|
||||
_NextScreen = alt;
|
||||
return;
|
||||
}
|
||||
_Screens[(int)EScreens.ScreenPartyDummy] = scr;
|
||||
}
|
||||
if (screen == EScreen.Unknown || screen == EScreen.CountEntry)
|
||||
throw new ArgumentException("Invalid screen: " + screen);
|
||||
return _Screens[(int)screen];
|
||||
}
|
||||
|
||||
_NextScreen = screen;
|
||||
public static void FadeTo(EScreen screen)
|
||||
{
|
||||
FadeTo(GetScreen(screen));
|
||||
}
|
||||
|
||||
public static void FadeTo(IMenu screen)
|
||||
{
|
||||
if (screen == null)
|
||||
throw new ArgumentNullException("screen");
|
||||
Debug.Assert(NextScreen==null || NextScreen!=screen, "Don't fade to currently fading screen!");
|
||||
if(screen==NextScreen)
|
||||
return;
|
||||
// Make sure the last screen change is done
|
||||
_FinishScreenFading();
|
||||
NextScreen = screen;
|
||||
}
|
||||
|
||||
public static void ShowPopup(EPopupScreens popupScreen)
|
||||
@@ -342,18 +346,12 @@ namespace Vocaluxe.Base
|
||||
SKeyEvent inputKeyEvent = new SKeyEvent();
|
||||
SMouseEvent inputMouseEvent = new SMouseEvent();
|
||||
|
||||
bool popupPlayerControlAllowed = _CurrentScreen != EScreens.ScreenOptionsRecord && _CurrentScreen != EScreens.ScreenSing &&
|
||||
(_CurrentScreen != EScreens.ScreenSong ||
|
||||
(_CurrentScreen == EScreens.ScreenSong && !CSongs.IsInCategory && CConfig.Config.Game.Tabs == EOffOn.TR_CONFIG_ON))
|
||||
&& _CurrentScreen != EScreens.ScreenCredits && !CBackgroundMusic.Disabled;
|
||||
|
||||
bool popupVolumeControlAllowed = _CurrentScreen != EScreens.ScreenCredits && _CurrentScreen != EScreens.ScreenOptionsRecord;
|
||||
bool popupPlayerControlAllowed = CurrentScreen.CurrentMusicType == EMusicType.Background && !CBackgroundMusic.Disabled;
|
||||
bool popupVolumeControlAllowed = CurrentScreen.CurrentMusicType != EMusicType.None;
|
||||
//Hide volume control for bg-music if bg-music is disabled
|
||||
if (popupVolumeControlAllowed && (_CurrentScreen != EScreens.ScreenSong || CSongs.Category == -1)
|
||||
&& _CurrentScreen != EScreens.ScreenSing && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
|
||||
if (popupVolumeControlAllowed && CurrentScreen.CurrentMusicType == EMusicType.Background && CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
|
||||
popupVolumeControlAllowed = false;
|
||||
|
||||
|
||||
bool resume = true;
|
||||
bool eventsAvailable;
|
||||
bool inputEventsAvailable = CController.PollKeyEvent(ref inputKeyEvent);
|
||||
@@ -451,53 +449,6 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
}
|
||||
|
||||
if (popupVolumeControlAllowed)
|
||||
{
|
||||
//TODO: Handle this in the volume popup
|
||||
int diff = 0;
|
||||
if ((keyEvent.ModShift && (keyEvent.Key == Keys.Add || keyEvent.Key == Keys.PageUp)) || (keyEvent.Sender == ESender.WiiMote && keyEvent.Key == Keys.Add))
|
||||
diff = 5;
|
||||
else if ((keyEvent.ModShift && (keyEvent.Key == Keys.Subtract || keyEvent.Key == Keys.PageDown)) ||
|
||||
(keyEvent.Sender == ESender.WiiMote && keyEvent.Key == Keys.Subtract))
|
||||
diff = -5;
|
||||
|
||||
if (diff != 0)
|
||||
{
|
||||
switch (CurrentScreen)
|
||||
{
|
||||
case EScreens.ScreenSong:
|
||||
if (CSongs.IsInCategory)
|
||||
{
|
||||
CConfig.PreviewMusicVolume += diff;
|
||||
CSound.SetGlobalVolume(CConfig.PreviewMusicVolume);
|
||||
}
|
||||
else
|
||||
{
|
||||
CConfig.BackgroundMusicVolume += diff;
|
||||
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
|
||||
}
|
||||
break;
|
||||
|
||||
case EScreens.ScreenSing:
|
||||
CConfig.GameMusicVolume += diff;
|
||||
CSound.SetGlobalVolume(CConfig.GameMusicVolume);
|
||||
break;
|
||||
|
||||
default:
|
||||
CConfig.BackgroundMusicVolume += diff;
|
||||
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
|
||||
break;
|
||||
}
|
||||
CConfig.SaveConfig();
|
||||
}
|
||||
|
||||
if (_CurrentPopupScreen == EPopupScreens.NoPopup && diff != 0)
|
||||
{
|
||||
ShowPopup(EPopupScreens.PopupVolumeControl);
|
||||
_VolumePopupTimer.Restart();
|
||||
}
|
||||
}
|
||||
|
||||
if (keyEvent.ModShift && (keyEvent.Key == Keys.F1))
|
||||
CSettings.ProgramState = EProgramState.EditTheme;
|
||||
else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter))
|
||||
@@ -510,10 +461,19 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
bool handled = false;
|
||||
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
||||
{
|
||||
handled = _PopupScreens[(int)_CurrentPopupScreen].HandleInput(keyEvent);
|
||||
if (popupVolumeControlAllowed && _CurrentPopupScreen == EPopupScreens.PopupVolumeControl && handled)
|
||||
_VolumePopupTimer.Restart();
|
||||
}
|
||||
else if (popupVolumeControlAllowed && _PopupScreens[(int)EPopupScreens.PopupVolumeControl].HandleInput(keyEvent))
|
||||
{
|
||||
ShowPopup(EPopupScreens.PopupVolumeControl);
|
||||
_VolumePopupTimer.Restart();
|
||||
}
|
||||
|
||||
if (!handled)
|
||||
resume &= _Screens[(int)_CurrentScreen].HandleInput(keyEvent);
|
||||
resume &= CurrentScreen.HandleInput(keyEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -570,7 +530,7 @@ namespace Vocaluxe.Base
|
||||
handled = _PopupScreens[(int)_CurrentPopupScreen].HandleMouse(mouseEvent);
|
||||
|
||||
if (!handled && _Fading == null && (_Cursor.IsActive || mouseEvent.LB || mouseEvent.RB || mouseEvent.MB))
|
||||
resume &= _Screens[(int)_CurrentScreen].HandleMouse(mouseEvent);
|
||||
resume &= CurrentScreen.HandleMouse(mouseEvent);
|
||||
|
||||
if (!eventsAvailable)
|
||||
inputEventsAvailable = CController.PollMouseEvent(ref inputMouseEvent);
|
||||
@@ -588,7 +548,7 @@ namespace Vocaluxe.Base
|
||||
if (keyEvent.ModShift && (keyEvent.Key == Keys.F1))
|
||||
{
|
||||
CSettings.ProgramState = EProgramState.Normal;
|
||||
_Screens[(int)_CurrentScreen].NextElement();
|
||||
CurrentScreen.NextElement();
|
||||
}
|
||||
else if (keyEvent.ModAlt && (keyEvent.Key == Keys.Enter))
|
||||
CConfig.Config.Graphics.FullScreen = (CConfig.Config.Graphics.FullScreen == EOffOn.TR_CONFIG_ON) ? EOffOn.TR_CONFIG_OFF : EOffOn.TR_CONFIG_ON;
|
||||
@@ -597,14 +557,14 @@ namespace Vocaluxe.Base
|
||||
else
|
||||
{
|
||||
if (_Fading == null)
|
||||
_Screens[(int)_CurrentScreen].HandleInputThemeEditor(keyEvent);
|
||||
CurrentScreen.HandleInputThemeEditor(keyEvent);
|
||||
}
|
||||
}
|
||||
|
||||
while (mouse.PollEvent(ref mouseEvent))
|
||||
{
|
||||
if (_Fading == null)
|
||||
_Screens[(int)_CurrentScreen].HandleMouseThemeEditor(mouseEvent);
|
||||
CurrentScreen.HandleMouseThemeEditor(mouseEvent);
|
||||
|
||||
_UpdateMousePosition(mouseEvent.X, mouseEvent.Y);
|
||||
}
|
||||
@@ -629,7 +589,7 @@ namespace Vocaluxe.Base
|
||||
|
||||
if (_CurrentPopupScreen != EPopupScreens.NoPopup)
|
||||
_PopupScreens[(int)_CurrentPopupScreen].UpdateGame();
|
||||
return _Screens[(int)_CurrentScreen].UpdateGame();
|
||||
return CurrentScreen.UpdateGame();
|
||||
}
|
||||
|
||||
private static void _DrawDebugInfos()
|
||||
|
||||
+26
-6
@@ -71,9 +71,9 @@ namespace Vocaluxe.Base
|
||||
CConfig.BackgroundMusicVolume = newVolume;
|
||||
}
|
||||
|
||||
public int GetBackgroundMusicVolume()
|
||||
public int GetMusicVolume(EMusicType type)
|
||||
{
|
||||
return CConfig.BackgroundMusicVolume;
|
||||
return CConfig.GetVolumeByType(type);
|
||||
}
|
||||
|
||||
public EBackgroundMusicOffOn GetBackgroundMusicStatus()
|
||||
@@ -446,7 +446,12 @@ namespace Vocaluxe.Base
|
||||
CGraphics.SaveTheme();
|
||||
}
|
||||
|
||||
public void FadeTo(EScreens nextScreen)
|
||||
public void FadeTo(EScreen nextScreen)
|
||||
{
|
||||
CGraphics.FadeTo(nextScreen);
|
||||
}
|
||||
|
||||
public void FadeTo(IMenu nextScreen)
|
||||
{
|
||||
CGraphics.FadeTo(nextScreen);
|
||||
}
|
||||
@@ -456,10 +461,20 @@ namespace Vocaluxe.Base
|
||||
return CGraphics.GlobalAlpha;
|
||||
}
|
||||
|
||||
public EScreens GetNextScreen()
|
||||
public IMenu GetNextScreen()
|
||||
{
|
||||
return CGraphics.NextScreen;
|
||||
}
|
||||
|
||||
public EScreen GetNextScreenType()
|
||||
{
|
||||
return CGraphics.NextScreenType;
|
||||
}
|
||||
|
||||
public IMenu GetScreen(EScreen screen)
|
||||
{
|
||||
return CGraphics.GetScreen(screen);
|
||||
}
|
||||
}
|
||||
|
||||
class CBlog : ILog
|
||||
@@ -828,7 +843,7 @@ namespace Vocaluxe.Base
|
||||
CSound.Play(soundStream);
|
||||
}
|
||||
|
||||
public void Fade(int soundStream, float targetVolume, float duration, EStreamAction afterFadeAction = EStreamAction.Nothing)
|
||||
public void Fade(int soundStream, int targetVolume, float duration, EStreamAction afterFadeAction = EStreamAction.Nothing)
|
||||
{
|
||||
CSound.Fade(soundStream, targetVolume, duration, afterFadeAction);
|
||||
}
|
||||
@@ -853,10 +868,15 @@ namespace Vocaluxe.Base
|
||||
return CSound.GetLength(soundStream);
|
||||
}
|
||||
|
||||
public void SetStreamVolume(int soundStream, float volume)
|
||||
public void SetStreamVolume(int soundStream, int volume)
|
||||
{
|
||||
CSound.SetStreamVolume(soundStream, volume);
|
||||
}
|
||||
|
||||
public void SetGlobalVolume(int volume)
|
||||
{
|
||||
CSound.SetGlobalVolume(volume);
|
||||
}
|
||||
}
|
||||
|
||||
class CBcover : ICover
|
||||
|
||||
+1
-11
@@ -113,11 +113,6 @@ namespace Vocaluxe.Base
|
||||
|
||||
_CurrentPartyMode.PartyMode.Init();
|
||||
}
|
||||
|
||||
public static CMenu GetNextPartyScreen(out EScreens alternativeScreen)
|
||||
{
|
||||
return _CurrentPartyMode.PartyMode.GetNextPartyScreen(out alternativeScreen);
|
||||
}
|
||||
#endregion public stuff
|
||||
|
||||
#region Interface
|
||||
@@ -126,16 +121,11 @@ namespace Vocaluxe.Base
|
||||
_CurrentPartyMode.PartyMode.UpdateGame();
|
||||
}
|
||||
|
||||
public static EScreens GetStartScreen()
|
||||
public static IMenu GetStartScreen()
|
||||
{
|
||||
return _CurrentPartyMode.PartyMode.GetStartScreen();
|
||||
}
|
||||
|
||||
public static EScreens GetMainScreen()
|
||||
{
|
||||
return _CurrentPartyMode.PartyMode.GetMainScreen();
|
||||
}
|
||||
|
||||
public static SScreenSongOptions GetSongSelectionOptions()
|
||||
{
|
||||
return _CurrentPartyMode.PartyMode.GetScreenSongOptions();
|
||||
|
||||
@@ -188,7 +188,7 @@ namespace Vocaluxe.Base
|
||||
if (VersionRevision != ERevision.Release)
|
||||
{
|
||||
// ReSharper restore ConditionIsAlwaysTrueOrFalse
|
||||
var gitversion = Application.ProductVersion;
|
||||
string gitversion = Application.ProductVersion;
|
||||
version += " " + _GetVersionStatus() + String.Format(" ({0})", gitversion);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace Vocaluxe.Base
|
||||
{
|
||||
static class CSongs
|
||||
{
|
||||
public delegate void CategoryChangedHandler();
|
||||
|
||||
private static readonly List<CSong> _Songs = new List<CSong>();
|
||||
private static readonly List<CSong> _SongsForRandom = new List<CSong>();
|
||||
|
||||
@@ -41,6 +43,7 @@ namespace Vocaluxe.Base
|
||||
public static readonly CSongCategorizer Categorizer = new CSongCategorizer();
|
||||
|
||||
private static Thread _CoverLoaderThread;
|
||||
public static event CategoryChangedHandler OnCategoryChanged;
|
||||
|
||||
public static List<CSong> Songs
|
||||
{
|
||||
@@ -84,8 +87,13 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _CatIndex)
|
||||
return;
|
||||
if (value == -1 || _IsCatIndexValid(value))
|
||||
{
|
||||
_CatIndex = value;
|
||||
OnCategoryChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+12
-9
@@ -15,7 +15,6 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Vocaluxe.Lib.Sound.Playback;
|
||||
using Vocaluxe.Lib.Sound.Playback.GstreamerSharp;
|
||||
@@ -61,7 +60,11 @@ namespace Vocaluxe.Base
|
||||
return _Playback.Init();
|
||||
}
|
||||
|
||||
public static void SetGlobalVolume(float volume)
|
||||
/// <summary>
|
||||
/// Sets the volume (in percent 0-100)
|
||||
/// </summary>
|
||||
/// <param name="volume"></param>
|
||||
public static void SetGlobalVolume(int volume)
|
||||
{
|
||||
_Playback.SetGlobalVolume(volume);
|
||||
}
|
||||
@@ -110,27 +113,27 @@ namespace Vocaluxe.Base
|
||||
_Playback.Stop(stream);
|
||||
}
|
||||
|
||||
public static void Fade(int stream, float targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing)
|
||||
public static void Fade(int stream, int targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing)
|
||||
{
|
||||
_Playback.Fade(stream, targetVolume, seconds, afterFadeAction);
|
||||
}
|
||||
|
||||
public static void FadeAndPause(int stream, float targetVolume, float seconds)
|
||||
public static void FadeAndPause(int stream, int targetVolume, float seconds)
|
||||
{
|
||||
Fade(stream, targetVolume, seconds, EStreamAction.Pause);
|
||||
}
|
||||
|
||||
public static void FadeAndClose(int stream, float targetVolume, float seconds)
|
||||
public static void FadeAndClose(int stream, int targetVolume, float seconds)
|
||||
{
|
||||
Fade(stream, targetVolume, seconds, EStreamAction.Close);
|
||||
}
|
||||
|
||||
public static void FadeAndStop(int stream, float targetVolume, float seconds)
|
||||
public static void FadeAndStop(int stream, int targetVolume, float seconds)
|
||||
{
|
||||
Fade(stream, targetVolume, seconds, EStreamAction.Stop);
|
||||
}
|
||||
|
||||
public static void SetStreamVolume(int stream, float volume)
|
||||
public static void SetStreamVolume(int stream, int volume)
|
||||
{
|
||||
_Playback.SetStreamVolume(stream, volume);
|
||||
}
|
||||
@@ -205,8 +208,8 @@ namespace Vocaluxe.Base
|
||||
}
|
||||
if (length > 0f)
|
||||
{
|
||||
SetStreamVolume(stream, 0f);
|
||||
Fade(stream, 100f, length);
|
||||
SetStreamVolume(stream, 0);
|
||||
Fade(stream, 100, length);
|
||||
}
|
||||
}
|
||||
return stream;
|
||||
|
||||
@@ -126,7 +126,7 @@ namespace Vocaluxe.Base.Server
|
||||
private static bool _SendKeyEvent(string key)
|
||||
{
|
||||
bool result = false;
|
||||
var lowerKey = key.ToLower();
|
||||
string lowerKey = key.ToLower();
|
||||
|
||||
if (!string.IsNullOrEmpty(lowerKey))
|
||||
{
|
||||
@@ -167,12 +167,12 @@ namespace Vocaluxe.Base.Server
|
||||
default:
|
||||
if (lowerKey.StartsWith("f"))
|
||||
{
|
||||
var numberString = lowerKey.Substring(1);
|
||||
string numberString = lowerKey.Substring(1);
|
||||
int number;
|
||||
Keys fKey;
|
||||
|
||||
if (Int32.TryParse(numberString, out number) && number >= 1
|
||||
&& number <= 12
|
||||
if (Int32.TryParse(numberString, out number) && number >= 1
|
||||
&& number <= 12
|
||||
&& Enum.TryParse("F" + number, true, out fKey))
|
||||
{
|
||||
Controller.AddKeyEvent(new SKeyEvent(ESender.Keyboard, false, false, false, false, Char.MinValue, fKey));
|
||||
@@ -186,17 +186,17 @@ namespace Vocaluxe.Base.Server
|
||||
return result;
|
||||
}
|
||||
|
||||
private static bool _sendKeyStringEvent(string keyString, bool isShiftPressed , bool isAltPressed , bool isCtrlPressed )
|
||||
private static bool _sendKeyStringEvent(string keyString, bool isShiftPressed, bool isAltPressed, bool isCtrlPressed)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
foreach (var key in keyString.ToCharArray())
|
||||
foreach (char key in keyString.ToCharArray())
|
||||
{
|
||||
Controller.AddKeyEvent(new SKeyEvent(ESender.Keyboard, isAltPressed,
|
||||
Char.IsUpper(key) || isShiftPressed,
|
||||
isCtrlPressed, true,
|
||||
isShiftPressed?Char.ToUpper(key) :key,
|
||||
_ParseKeys(key)));
|
||||
Controller.AddKeyEvent(new SKeyEvent(ESender.Keyboard, isAltPressed,
|
||||
Char.IsUpper(key) || isShiftPressed,
|
||||
isCtrlPressed, true,
|
||||
isShiftPressed ? Char.ToUpper(key) : key,
|
||||
_ParseKeys(key)));
|
||||
result = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ namespace Vocaluxe.Base.ThemeSystem
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
CLog.LogError("Can't load skin file \"" + _FileName + "\". Invalid file!", false, false, e);
|
||||
CLog.LogError("Can't load skin file \"" + Path.Combine(_Folder, _FileName) + "\". Invalid file!", false, false, e);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Vocaluxe.Lib.Sound.Playback
|
||||
public abstract bool IsPaused { get; set; }
|
||||
public abstract bool IsFinished { get; }
|
||||
|
||||
public CAudioStreamBase(int id, string medium, bool loop)
|
||||
protected CAudioStreamBase(int id, string medium, bool loop)
|
||||
{
|
||||
_ID = id;
|
||||
_Medium = medium;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using VocaluxeLib;
|
||||
@@ -62,19 +63,19 @@ namespace Vocaluxe.Lib.Sound.Playback
|
||||
}
|
||||
}
|
||||
|
||||
public float GetGlobalVolume()
|
||||
public int GetGlobalVolume()
|
||||
{
|
||||
return (_Initialized) ? _GlobalVolume * 100f : 100f;
|
||||
return (_Initialized) ? (int) Math.Round(_GlobalVolume * 100) : 100;
|
||||
}
|
||||
|
||||
public void SetGlobalVolume(float volume)
|
||||
public void SetGlobalVolume(int volume)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
volume = volume.Clamp(0f, 100f) / 100f;
|
||||
float volumeF = volume.Clamp(0, 100) / 100f;
|
||||
foreach (IAudioStream stream in _Streams)
|
||||
stream.VolumeMax = volume;
|
||||
_GlobalVolume = volume;
|
||||
stream.VolumeMax = volumeF;
|
||||
_GlobalVolume = volumeF;
|
||||
}
|
||||
|
||||
public int GetStreamCount()
|
||||
@@ -178,28 +179,28 @@ namespace Vocaluxe.Lib.Sound.Playback
|
||||
}
|
||||
}
|
||||
|
||||
public void Fade(int streamID, float targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing)
|
||||
public void Fade(int streamID, int targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
targetVolume = targetVolume.Clamp(0f, 100f) / 100f;
|
||||
float targetVolumeF = targetVolume.Clamp(0, 100) / 100f;
|
||||
lock (_Streams)
|
||||
{
|
||||
if (_StreamExists(streamID))
|
||||
_Streams[_GetStreamIndex(streamID)].Fade(targetVolume, seconds, afterFadeAction);
|
||||
_Streams[_GetStreamIndex(streamID)].Fade(targetVolumeF, seconds, afterFadeAction);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetStreamVolume(int streamID, float volume)
|
||||
public void SetStreamVolume(int streamID, int volume)
|
||||
{
|
||||
if (!_Initialized)
|
||||
return;
|
||||
volume = volume.Clamp(0f, 100f) / 100f;
|
||||
float volumeF = volume.Clamp(0, 100) / 100f;
|
||||
lock (_Streams)
|
||||
{
|
||||
if (_StreamExists(streamID))
|
||||
{
|
||||
_Streams[_GetStreamIndex(streamID)].Volume = volume;
|
||||
_Streams[_GetStreamIndex(streamID)].Volume = volumeF;
|
||||
_Streams[_GetStreamIndex(streamID)].CancelFading();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,9 @@ namespace Vocaluxe.Lib.Sound.Playback.GstreamerSharp
|
||||
get
|
||||
{
|
||||
//TODO: Is it ok, to remove this? Gst should post a message if duration was changed so this should not be required
|
||||
//if (base.Length < 0 && _Element != null)
|
||||
// _UpdateDuration();
|
||||
// Removing would not work in some cases where length is not know at startup
|
||||
if (base.Length < 0 && _Element != null)
|
||||
_UpdateDuration();
|
||||
return base.Length >= 0f ? base.Length : 0f;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,14 +23,14 @@ namespace Vocaluxe.Lib.Sound.Playback
|
||||
{
|
||||
bool Init();
|
||||
void Close();
|
||||
float GetGlobalVolume();
|
||||
int GetGlobalVolume();
|
||||
|
||||
/// <summary>
|
||||
/// Set the global (maximum) volume<br />
|
||||
/// All streams (existent and future ones) will have their maximum volume set to this value
|
||||
/// </summary>
|
||||
/// <param name="volume">Volume in percent</param>
|
||||
void SetGlobalVolume(float volume);
|
||||
void SetGlobalVolume(int volume);
|
||||
|
||||
int GetStreamCount();
|
||||
void CloseAll();
|
||||
@@ -42,14 +42,14 @@ namespace Vocaluxe.Lib.Sound.Playback
|
||||
void Play(int streamID);
|
||||
void Pause(int streamID);
|
||||
void Stop(int streamID);
|
||||
void Fade(int streamID, float targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing);
|
||||
void Fade(int streamID, int targetVolume, float seconds, EStreamAction afterFadeAction = EStreamAction.Nothing);
|
||||
|
||||
/// <summary>
|
||||
/// Set the streams current volume. Cancels fading
|
||||
/// </summary>
|
||||
/// <param name="streamID">Id of the stream (optained by Load)</param>
|
||||
/// <param name="volume">Volume in percent</param>
|
||||
void SetStreamVolume(int streamID, float volume);
|
||||
void SetStreamVolume(int streamID, int volume);
|
||||
|
||||
float GetLength(int streamID);
|
||||
float GetPosition(int streamID);
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
CGame.AddSong(songNr, gm);
|
||||
|
||||
CGraphics.FadeTo(EScreens.ScreenNames);
|
||||
CGame.GotoNameSelection();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Windows.Forms;
|
||||
using Vocaluxe.Base;
|
||||
using VocaluxeLib;
|
||||
using VocaluxeLib.Menu;
|
||||
@@ -56,6 +57,19 @@ namespace Vocaluxe.Screens
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
{
|
||||
_UpdateSlides();
|
||||
if (keyEvent.ModShift || keyEvent.Sender == ESender.WiiMote)
|
||||
{
|
||||
if (keyEvent.Key == Keys.Add || keyEvent.Key == Keys.PageUp)
|
||||
_SelectSlides[_SelectSlideVolume].Selection++;
|
||||
else if (keyEvent.Key == Keys.Subtract || keyEvent.Key == Keys.PageDown)
|
||||
_SelectSlides[_SelectSlideVolume].Selection--;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
||||
_SaveConfig();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -69,19 +83,13 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
if (mouseEvent.Wheel > 0 && CHelper.IsInBounds(ScreenArea, mouseEvent))
|
||||
{
|
||||
if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= 0)
|
||||
_SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel;
|
||||
else if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < 0)
|
||||
_SelectSlides[_SelectSlideVolume].Selection = 0;
|
||||
_SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel;
|
||||
_SaveConfig();
|
||||
return true;
|
||||
}
|
||||
if (mouseEvent.Wheel < 0 && CHelper.IsInBounds(ScreenArea, mouseEvent))
|
||||
{
|
||||
if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel < _SelectSlides[_SelectSlideVolume].NumValues)
|
||||
_SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel;
|
||||
else if (_SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel >= _SelectSlides[_SelectSlideVolume].NumValues)
|
||||
_SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].NumValues - 1;
|
||||
_SelectSlides[_SelectSlideVolume].Selection = _SelectSlides[_SelectSlideVolume].Selection - mouseEvent.Wheel;
|
||||
_SaveConfig();
|
||||
return true;
|
||||
}
|
||||
@@ -103,47 +111,14 @@ namespace Vocaluxe.Screens
|
||||
private void _SaveConfig()
|
||||
{
|
||||
int volume = _SelectSlides[_SelectSlideVolume].Selection * 5;
|
||||
switch (CGraphics.CurrentScreen)
|
||||
{
|
||||
case EScreens.ScreenSong:
|
||||
if (CSongs.IsInCategory)
|
||||
CConfig.PreviewMusicVolume = volume;
|
||||
else
|
||||
CConfig.BackgroundMusicVolume = volume;
|
||||
break;
|
||||
|
||||
case EScreens.ScreenSing:
|
||||
CConfig.GameMusicVolume = volume;
|
||||
break;
|
||||
|
||||
default:
|
||||
CConfig.BackgroundMusicVolume = volume;
|
||||
break;
|
||||
}
|
||||
CConfig.SetVolumeByType(CGraphics.CurrentScreen.CurrentMusicType, volume);
|
||||
CConfig.SaveConfig();
|
||||
CSound.SetGlobalVolume(volume);
|
||||
}
|
||||
|
||||
private void _UpdateSlides()
|
||||
{
|
||||
int volume;
|
||||
switch (CGraphics.CurrentScreen)
|
||||
{
|
||||
case EScreens.ScreenSong:
|
||||
if (CSongs.IsInCategory)
|
||||
volume = CConfig.PreviewMusicVolume;
|
||||
else
|
||||
volume = CConfig.BackgroundMusicVolume;
|
||||
break;
|
||||
|
||||
case EScreens.ScreenSing:
|
||||
volume = CConfig.GameMusicVolume;
|
||||
break;
|
||||
|
||||
default:
|
||||
volume = CConfig.BackgroundMusicVolume;
|
||||
break;
|
||||
}
|
||||
int volume = CConfig.GetVolumeByType(CGraphics.CurrentScreen.CurrentMusicType);
|
||||
_SelectSlides[_SelectSlideVolume].Selection = volume / 5;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,6 +145,11 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private SThemeBackground _BGTheme;
|
||||
|
||||
public override EMusicType CurrentMusicType
|
||||
{
|
||||
get { return EMusicType.None; }
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -292,7 +297,7 @@ namespace Vocaluxe.Screens
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
case Keys.Enter:
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -303,14 +308,14 @@ namespace Vocaluxe.Screens
|
||||
public override bool HandleMouse(SMouseEvent mouseEvent)
|
||||
{
|
||||
if (mouseEvent.LB || mouseEvent.RB)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool UpdateGame()
|
||||
{
|
||||
if (!_Animation())
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -137,11 +137,11 @@ namespace Vocaluxe.Screens
|
||||
|
||||
bool next = CConfig.Config.Theme.CoverLoading != ECoverLoading.TR_CONFIG_COVERLOADING_ATSTART || CSongs.CoverLoaded;
|
||||
|
||||
if ((_IntroOutPlayed || _SkipIntro) && next && CSettings.ProgramState != EProgramState.EditTheme && CSongs.SongsLoaded)
|
||||
if ((_IntroOutPlayed || _SkipIntro) && next && CSettings.ProgramState == EProgramState.Start && CSongs.SongsLoaded)
|
||||
{
|
||||
CSettings.ProgramState = EProgramState.Normal;
|
||||
|
||||
if (CSettings.ProgramState == EProgramState.Normal)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
}
|
||||
|
||||
_Texts[_TextStatus].Text =
|
||||
CLanguage.Translate("TR_SCREENLOAD_TOTAL") + ": " + CSongs.NumAllSongs + " " +
|
||||
|
||||
@@ -71,37 +71,37 @@ namespace Vocaluxe.Screens
|
||||
switch (keyEvent.Key)
|
||||
{
|
||||
case Keys.O:
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
break;
|
||||
|
||||
case Keys.S:
|
||||
if (CProfiles.NumProfiles > 0)
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
break;
|
||||
|
||||
case Keys.C:
|
||||
CGraphics.FadeTo(EScreens.ScreenCredits);
|
||||
CGraphics.FadeTo(EScreen.Credits);
|
||||
break;
|
||||
|
||||
case Keys.T:
|
||||
CGraphics.FadeTo(EScreens.ScreenTest);
|
||||
CGraphics.FadeTo(EScreen.Test);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (_Buttons[_ButtonSing].Selected)
|
||||
{
|
||||
CParty.SetNormalGameMode();
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
}
|
||||
|
||||
if (_Buttons[_ButtonParty].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenParty);
|
||||
CGraphics.FadeTo(EScreen.Party);
|
||||
|
||||
if (_Buttons[_ButtonOptions].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
|
||||
if (_Buttons[_ButtonProfiles].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenProfiles);
|
||||
CGraphics.FadeTo(EScreen.Profiles);
|
||||
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
return false;
|
||||
@@ -121,17 +121,17 @@ namespace Vocaluxe.Screens
|
||||
if (_Buttons[_ButtonSing].Selected)
|
||||
{
|
||||
CParty.SetNormalGameMode();
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
}
|
||||
|
||||
if (_Buttons[_ButtonParty].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenParty);
|
||||
CGraphics.FadeTo(EScreen.Party);
|
||||
|
||||
if (_Buttons[_ButtonOptions].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
|
||||
if (_Buttons[_ButtonProfiles].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenProfiles);
|
||||
CGraphics.FadeTo(EScreen.Profiles);
|
||||
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
return false;
|
||||
|
||||
@@ -180,14 +180,15 @@ namespace Vocaluxe.Screens
|
||||
return true;
|
||||
|
||||
_UpdateSelectedProfile(_SelectingFastPlayerNr - 1, _SelectedProfileID);
|
||||
|
||||
_SelectElement(_Buttons[_ButtonStart]);
|
||||
}
|
||||
//Started selecting with 'P'
|
||||
if (_SelectingFast)
|
||||
{
|
||||
if (_SelectingFastPlayerNr == CGame.NumPlayers)
|
||||
{
|
||||
resetSelection = true;
|
||||
_SelectElement(_Buttons[_ButtonStart]);
|
||||
}
|
||||
else
|
||||
{
|
||||
_SelectingFastPlayerNr++;
|
||||
@@ -225,6 +226,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
case Keys.Escape:
|
||||
resetSelection = true;
|
||||
_SelectElement(_SelectSlides[_SelectSlidePlayerNumber]);
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
@@ -277,14 +279,14 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
else
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
else if (_Buttons[_ButtonStart].Selected)
|
||||
_StartSong();
|
||||
|
||||
break;
|
||||
@@ -323,12 +325,20 @@ namespace Vocaluxe.Screens
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (_SelectingFastPlayerNr > 0 && _SelectingFastPlayerNr <= CConfig.Config.Game.NumPlayers)
|
||||
{
|
||||
_SelectingKeyboardActive = true;
|
||||
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
|
||||
}
|
||||
if (_NameSelections[_NameSelection].Selected && !_SelectingKeyboardActive)
|
||||
{
|
||||
_SelectingKeyboardActive = true;
|
||||
_ResetPlayerSelections();
|
||||
_SelectingFast = true;
|
||||
_SelectingFastPlayerNr = 1;
|
||||
_SelectingKeyboardActive = true;
|
||||
_NameSelections[_NameSelection].FastSelection(true, _SelectingFastPlayerNr);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -454,7 +464,7 @@ namespace Vocaluxe.Screens
|
||||
else if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
|
||||
{
|
||||
if (_Buttons[_ButtonBack].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
else if (_Buttons[_ButtonStart].Selected)
|
||||
_StartSong();
|
||||
else
|
||||
@@ -497,7 +507,7 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
}
|
||||
if (exit)
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
}
|
||||
|
||||
if (mouseEvent.MB && _SelectingFast)
|
||||
@@ -619,7 +629,7 @@ namespace Vocaluxe.Screens
|
||||
for (int i = 0; i < CGame.NumPlayers; i++)
|
||||
CGame.Players[i].VoiceNr = _SelectSlides[_SelectSlideDuetPlayer[i]].Selection;
|
||||
}
|
||||
CGraphics.FadeTo(EScreens.ScreenSing);
|
||||
CGraphics.FadeTo(EScreen.Sing);
|
||||
}
|
||||
|
||||
private void _UpdateSlides()
|
||||
|
||||
@@ -55,32 +55,32 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
break;
|
||||
|
||||
case Keys.S:
|
||||
CParty.SetNormalGameMode();
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (_Buttons[_ButtonOptionsGame].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsGame);
|
||||
CGraphics.FadeTo(EScreen.OptionsGame);
|
||||
|
||||
if (_Buttons[_ButtonOptionsSound].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsSound);
|
||||
CGraphics.FadeTo(EScreen.OptionsSound);
|
||||
|
||||
if (_Buttons[_ButtonOptionsRecord].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsRecord);
|
||||
CGraphics.FadeTo(EScreen.OptionsRecord);
|
||||
|
||||
if (_Buttons[_ButtonOptionsVideo].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsVideo);
|
||||
CGraphics.FadeTo(EScreen.OptionsVideo);
|
||||
|
||||
if (_Buttons[_ButtonOptionsLyrics].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsLyrics);
|
||||
CGraphics.FadeTo(EScreen.OptionsLyrics);
|
||||
|
||||
if (_Buttons[_ButtonOptionsTheme].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsTheme);
|
||||
CGraphics.FadeTo(EScreen.OptionsTheme);
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -95,26 +95,26 @@ namespace Vocaluxe.Screens
|
||||
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
|
||||
{
|
||||
if (_Buttons[_ButtonOptionsGame].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsGame);
|
||||
CGraphics.FadeTo(EScreen.OptionsGame);
|
||||
|
||||
if (_Buttons[_ButtonOptionsSound].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsSound);
|
||||
CGraphics.FadeTo(EScreen.OptionsSound);
|
||||
|
||||
if (_Buttons[_ButtonOptionsRecord].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsRecord);
|
||||
CGraphics.FadeTo(EScreen.OptionsRecord);
|
||||
|
||||
if (_Buttons[_ButtonOptionsVideo].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsVideo);
|
||||
CGraphics.FadeTo(EScreen.OptionsVideo);
|
||||
|
||||
if (_Buttons[_ButtonOptionsLyrics].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsLyrics);
|
||||
CGraphics.FadeTo(EScreen.OptionsLyrics);
|
||||
|
||||
if (_Buttons[_ButtonOptionsTheme].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsTheme);
|
||||
CGraphics.FadeTo(EScreen.OptionsTheme);
|
||||
}
|
||||
|
||||
if (mouseEvent.RB)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -73,19 +73,19 @@ namespace Vocaluxe.Screens
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
break;
|
||||
|
||||
case Keys.S:
|
||||
CParty.SetNormalGameMode();
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
else if (_Buttons[_ButtonServer].Selected)
|
||||
CGraphics.ShowPopup(EPopupScreens.PopupServerQR);
|
||||
@@ -110,14 +110,14 @@ namespace Vocaluxe.Screens
|
||||
if (mouseEvent.RB)
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
|
||||
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
|
||||
{
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
{
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
_SaveConfig();
|
||||
}
|
||||
else if (_Buttons[_ButtonServer].Selected)
|
||||
|
||||
@@ -62,19 +62,19 @@ namespace Vocaluxe.Screens
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
break;
|
||||
|
||||
case Keys.S:
|
||||
CParty.SetNormalGameMode();
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -97,13 +97,13 @@ namespace Vocaluxe.Screens
|
||||
if (mouseEvent.RB)
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
|
||||
{
|
||||
_SaveConfig();
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -63,6 +63,11 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private readonly CDelayTest _DelayTest = new CDelayTest(2);
|
||||
|
||||
public override EMusicType CurrentMusicType
|
||||
{
|
||||
get { return EMusicType.None; }
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -121,19 +126,19 @@ namespace Vocaluxe.Screens
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
_SaveMicConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
break;
|
||||
|
||||
case Keys.S:
|
||||
CParty.SetNormalGameMode();
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
{
|
||||
_SaveMicConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
|
||||
if (_Buttons[_ButtonDelayTest].Selected)
|
||||
@@ -180,7 +185,7 @@ namespace Vocaluxe.Screens
|
||||
if (mouseEvent.RB)
|
||||
{
|
||||
_SaveMicConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
|
||||
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
|
||||
@@ -198,7 +203,7 @@ namespace Vocaluxe.Screens
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
{
|
||||
_SaveMicConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
|
||||
if (_Buttons[_ButtonDelayTest].Selected)
|
||||
|
||||
@@ -78,19 +78,19 @@ namespace Vocaluxe.Screens
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
break;
|
||||
|
||||
case Keys.S:
|
||||
CParty.SetNormalGameMode();
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -113,13 +113,13 @@ namespace Vocaluxe.Screens
|
||||
if (mouseEvent.RB)
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
|
||||
{
|
||||
_SaveConfig();
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
case Keys.S:
|
||||
CParty.SetNormalGameMode();
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
@@ -157,7 +157,7 @@ namespace Vocaluxe.Screens
|
||||
private void _Close()
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
|
||||
private void _SaveConfig()
|
||||
|
||||
@@ -90,24 +90,24 @@ namespace Vocaluxe.Screens
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
break;
|
||||
|
||||
case Keys.S:
|
||||
CParty.SetNormalGameMode();
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
else if (_Buttons[_ButtonScreenAdjustments].Selected)
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsVideoAdjustments);
|
||||
CGraphics.FadeTo(EScreen.OptionsVideoAdjustments);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace Vocaluxe.Screens
|
||||
if (mouseEvent.RB)
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
}
|
||||
|
||||
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
|
||||
@@ -149,9 +149,9 @@ namespace Vocaluxe.Screens
|
||||
_OnCapabilitiesEvent();
|
||||
_SaveConfig();
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptions);
|
||||
CGraphics.FadeTo(EScreen.Options);
|
||||
if (_Buttons[_ButtonScreenAdjustments].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsVideoAdjustments);
|
||||
CGraphics.FadeTo(EScreen.OptionsVideoAdjustments);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,19 +51,19 @@ namespace Vocaluxe.Screens
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsVideo);
|
||||
CGraphics.FadeTo(EScreen.OptionsVideo);
|
||||
break;
|
||||
|
||||
case Keys.S:
|
||||
CParty.SetNormalGameMode();
|
||||
CGraphics.FadeTo(EScreens.ScreenSong);
|
||||
CGraphics.FadeTo(EScreen.Song);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsVideo);
|
||||
CGraphics.FadeTo(EScreen.OptionsVideo);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -78,14 +78,14 @@ namespace Vocaluxe.Screens
|
||||
if (mouseEvent.RB)
|
||||
{
|
||||
_SaveConfig();
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsVideo);
|
||||
CGraphics.FadeTo(EScreen.OptionsVideo);
|
||||
}
|
||||
|
||||
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
|
||||
{
|
||||
_SaveConfig();
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenOptionsVideo);
|
||||
CGraphics.FadeTo(EScreen.OptionsVideo);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
@@ -72,7 +72,7 @@ namespace Vocaluxe.Screens
|
||||
_StartPartyMode();
|
||||
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
break;
|
||||
|
||||
case Keys.Left:
|
||||
@@ -95,14 +95,14 @@ namespace Vocaluxe.Screens
|
||||
_StartPartyMode();
|
||||
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
|
||||
if (_SelectSlides[_SelectSlideModes].Selected)
|
||||
_UpdateSelection();
|
||||
}
|
||||
|
||||
if (mouseEvent.RB)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -194,7 +194,7 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
|
||||
CParty.SetPartyMode(_PartyModeInfos[index].PartyModeID);
|
||||
CGraphics.FadeTo(EScreens.ScreenPartyDummy);
|
||||
CGraphics.FadeTo(CParty.GetStartScreen());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -122,12 +122,12 @@ namespace Vocaluxe.Screens
|
||||
if (_EditMode == EEditMode.PlayerName)
|
||||
_EditMode = EEditMode.None;
|
||||
else
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
else if (_Buttons[_ButtonSave].Selected)
|
||||
_SaveProfiles();
|
||||
else if (_Buttons[_ButtonNew].Selected)
|
||||
@@ -159,7 +159,7 @@ namespace Vocaluxe.Screens
|
||||
_ProfilesChanged = true;
|
||||
}
|
||||
else
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
break;
|
||||
|
||||
case Keys.Delete:
|
||||
@@ -199,7 +199,7 @@ namespace Vocaluxe.Screens
|
||||
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent))
|
||||
{
|
||||
if (_Buttons[_ButtonExit].Selected)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
else if (_Buttons[_ButtonSave].Selected)
|
||||
_SaveProfiles();
|
||||
else if (_Buttons[_ButtonNew].Selected)
|
||||
@@ -246,7 +246,7 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
|
||||
if (mouseEvent.RB)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Vocaluxe.Screens
|
||||
private int _CurrentStream = -1;
|
||||
private float _Length = -1f;
|
||||
//private int _NextStream = -1;
|
||||
private const float _Volume = 100f;
|
||||
private const int _Volume = 100;
|
||||
private CVideoStream _CurrentVideo;
|
||||
private EAspect _VideoAspect = EAspect.Crop;
|
||||
private CTextureRef _CurrentWebcamFrameTexture;
|
||||
@@ -120,6 +120,11 @@ namespace Vocaluxe.Screens
|
||||
|
||||
private CBackground _SlideShow;
|
||||
|
||||
public override EMusicType CurrentMusicType
|
||||
{
|
||||
get { return EMusicType.Game; }
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
@@ -232,24 +237,6 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Add:
|
||||
case Keys.PageUp:
|
||||
if (keyEvent.ModShift)
|
||||
{
|
||||
CConfig.GameMusicVolume += 5;
|
||||
CSound.SetGlobalVolume(CConfig.GameMusicVolume);
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.Subtract:
|
||||
case Keys.PageDown:
|
||||
if (keyEvent.ModShift)
|
||||
{
|
||||
CConfig.GameMusicVolume -= 5;
|
||||
CSound.SetGlobalVolume(CConfig.GameMusicVolume);
|
||||
}
|
||||
break;
|
||||
|
||||
case Keys.V:
|
||||
if (_VideoAspect == EAspect.Zoom2)
|
||||
_VideoAspect = EAspect.Crop;
|
||||
@@ -422,7 +409,6 @@ namespace Vocaluxe.Screens
|
||||
_UpdateNames();
|
||||
|
||||
_CloseSong();
|
||||
CSound.SetGlobalVolume(CConfig.GameMusicVolume);
|
||||
}
|
||||
|
||||
public override void OnShowFinish()
|
||||
@@ -484,13 +470,14 @@ namespace Vocaluxe.Screens
|
||||
_CloseSong();
|
||||
if (_Webcam)
|
||||
CWebcam.Stop();
|
||||
CBackgroundMusic.Disabled = false;
|
||||
}
|
||||
|
||||
private void _CloseSong()
|
||||
{
|
||||
if (_CurrentStream > -1)
|
||||
{
|
||||
CSound.FadeAndClose(_CurrentStream, 0f, 0.5f);
|
||||
CSound.FadeAndClose(_CurrentStream, 0, 0.5f);
|
||||
_CurrentStream = -1;
|
||||
}
|
||||
CRecord.Stop();
|
||||
|
||||
@@ -94,6 +94,11 @@ namespace Vocaluxe.Screens
|
||||
private ISongMenu _SongMenu;
|
||||
private CPlaylist _Playlist;
|
||||
|
||||
public override EMusicType CurrentMusicType
|
||||
{
|
||||
get { return CSongs.IsInCategory ? EMusicType.Preview : EMusicType.Background; }
|
||||
}
|
||||
|
||||
public CScreenSong()
|
||||
{
|
||||
_AvailableGameModes = new List<EGameMode>();
|
||||
@@ -192,7 +197,7 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
case Keys.Escape:
|
||||
if ((CSongs.Category < 0 || _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) && !_Sso.Selection.PartyMode && !_SearchActive)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
if (_SearchActive)
|
||||
{
|
||||
_SearchActive = false;
|
||||
@@ -241,7 +246,7 @@ namespace Vocaluxe.Screens
|
||||
_ApplyNewSearchFilter(_SearchText.Remove(_SearchText.Length - 1));
|
||||
}
|
||||
else if ((!CSongs.IsInCategory || _Sso.Sorting.Tabs == EOffOn.TR_CONFIG_OFF) && !_Sso.Selection.PartyMode)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
|
||||
break;
|
||||
|
||||
@@ -372,26 +377,6 @@ namespace Vocaluxe.Screens
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int volumeDiff = 0;
|
||||
if (keyEvent.ModShift && (keyEvent.Key == Keys.Add || keyEvent.Key == Keys.PageUp))
|
||||
volumeDiff = 5;
|
||||
else if (keyEvent.ModShift && (keyEvent.Key == Keys.Subtract || keyEvent.Key == Keys.PageDown))
|
||||
volumeDiff = -5;
|
||||
if (volumeDiff != 0)
|
||||
{
|
||||
if (CSongs.IsInCategory)
|
||||
{
|
||||
CConfig.PreviewMusicVolume += volumeDiff;
|
||||
CSound.SetGlobalVolume(CConfig.PreviewMusicVolume);
|
||||
}
|
||||
else
|
||||
{
|
||||
CConfig.BackgroundMusicVolume += volumeDiff;
|
||||
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -447,7 +432,7 @@ namespace Vocaluxe.Screens
|
||||
|
||||
if (CSongs.Category < 0 && !_Sso.Selection.PartyMode && !_SearchActive)
|
||||
{
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -659,8 +644,17 @@ namespace Vocaluxe.Screens
|
||||
_Playlist.DragAndDropSongID = -1;
|
||||
|
||||
UpdateGame();
|
||||
if (CSongs.IsInCategory)
|
||||
CSound.SetGlobalVolume(CConfig.PreviewMusicVolume);
|
||||
}
|
||||
|
||||
public override void OnShowFinish()
|
||||
{
|
||||
base.OnShowFinish();
|
||||
CSongs.OnCategoryChanged += _OnCategoryChanged;
|
||||
}
|
||||
|
||||
private static void _OnCategoryChanged()
|
||||
{
|
||||
CSound.SetGlobalVolume(CSongs.IsInCategory ? CConfig.PreviewMusicVolume : CConfig.BackgroundMusicVolume);
|
||||
}
|
||||
|
||||
public override bool UpdateGame()
|
||||
@@ -716,12 +710,7 @@ namespace Vocaluxe.Screens
|
||||
base.OnClose();
|
||||
|
||||
_SongMenu.OnHide();
|
||||
|
||||
if (CGraphics.NextScreen != EScreens.ScreenNames || CConfig.Config.Sound.BackgroundMusic == EBackgroundMusicOffOn.TR_CONFIG_OFF)
|
||||
{
|
||||
CBackgroundMusic.Disabled = false;
|
||||
CSound.SetGlobalVolume(CConfig.BackgroundMusicVolume);
|
||||
}
|
||||
CSongs.OnCategoryChanged -= _OnCategoryChanged;
|
||||
}
|
||||
|
||||
private void _HandlePartySongSelection(int songNr)
|
||||
@@ -835,7 +824,7 @@ namespace Vocaluxe.Screens
|
||||
CGame.ClearSongs();
|
||||
|
||||
if (CGame.AddVisibleSong(songNr, gm))
|
||||
CGraphics.FadeTo(EScreens.ScreenNames);
|
||||
CGraphics.FadeTo(EScreen.Names);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -849,7 +838,7 @@ namespace Vocaluxe.Screens
|
||||
CGame.ClearSongs();
|
||||
|
||||
if (CGame.AddVisibleSong(songNr, gm))
|
||||
CGraphics.FadeTo(EScreens.ScreenNames);
|
||||
CGraphics.FadeTo(EScreen.Names);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -863,7 +852,7 @@ namespace Vocaluxe.Screens
|
||||
CGame.Reset();
|
||||
CGame.ClearSongs();
|
||||
if (CGame.AddVisibleSong(songNr, EGameMode.TR_GAMEMODE_MEDLEY))
|
||||
CGraphics.FadeTo(EScreens.ScreenNames);
|
||||
CGraphics.FadeTo(EScreen.Names);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -890,7 +879,7 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
|
||||
if (CGame.GetNumSongs() > 0)
|
||||
CGraphics.FadeTo(EScreens.ScreenNames);
|
||||
CGraphics.FadeTo(EScreen.Names);
|
||||
}
|
||||
|
||||
private void _StartRandomVisibleSongs()
|
||||
@@ -914,7 +903,7 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
|
||||
if (CGame.GetNumSongs() > 0)
|
||||
CGraphics.FadeTo(EScreens.ScreenNames);
|
||||
CGraphics.FadeTo(EScreen.Names);
|
||||
}
|
||||
|
||||
private void _StartRandomMedley(int numSongs, bool allSongs)
|
||||
@@ -950,7 +939,7 @@ namespace Vocaluxe.Screens
|
||||
}
|
||||
|
||||
if (CGame.GetNumSongs() > 0)
|
||||
CGraphics.FadeTo(EScreens.ScreenNames);
|
||||
CGraphics.FadeTo(EScreen.Names);
|
||||
}
|
||||
|
||||
private bool _SelectNextRandom(int teamNr)
|
||||
|
||||
@@ -63,11 +63,11 @@ namespace Vocaluxe.Screens
|
||||
{
|
||||
case Keys.Escape:
|
||||
case Keys.Back:
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
break;
|
||||
|
||||
case Keys.Enter:
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
break;
|
||||
|
||||
case Keys.F:
|
||||
@@ -92,10 +92,10 @@ namespace Vocaluxe.Screens
|
||||
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) {}
|
||||
|
||||
if (mouseEvent.LB)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
|
||||
if (mouseEvent.RB)
|
||||
CGraphics.FadeTo(EScreens.ScreenMain);
|
||||
CGraphics.FadeTo(EScreen.Main);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+34
-22
@@ -360,32 +360,44 @@ namespace VocaluxeLib
|
||||
Freestyle
|
||||
}
|
||||
|
||||
public enum EScreens
|
||||
public enum EMusicType
|
||||
{
|
||||
ScreenTest = 0,
|
||||
ScreenLoad = 1,
|
||||
ScreenMain = 2,
|
||||
ScreenSong = 3,
|
||||
ScreenOptions = 4,
|
||||
ScreenSing = 5,
|
||||
ScreenProfiles = 6,
|
||||
ScreenScore = 7,
|
||||
ScreenHighscore = 8,
|
||||
None,
|
||||
Background,
|
||||
Preview,
|
||||
Game
|
||||
}
|
||||
|
||||
ScreenOptionsGame = 9,
|
||||
ScreenOptionsSound = 10,
|
||||
ScreenOptionsRecord = 11,
|
||||
ScreenOptionsVideo = 12,
|
||||
ScreenOptionsVideoAdjustments = 13,
|
||||
ScreenOptionsLyrics = 14,
|
||||
ScreenOptionsTheme = 15,
|
||||
/// <summary>
|
||||
/// Base screens
|
||||
/// </summary>
|
||||
public enum EScreen
|
||||
{
|
||||
Unknown = -1,
|
||||
|
||||
ScreenNames = 16,
|
||||
ScreenCredits = 17,
|
||||
ScreenParty = 18,
|
||||
ScreenPartyDummy = 19,
|
||||
Test,
|
||||
Load,
|
||||
Main,
|
||||
Song,
|
||||
Options,
|
||||
Sing,
|
||||
Profiles,
|
||||
Score,
|
||||
Highscore,
|
||||
|
||||
ScreenNull = -1
|
||||
OptionsGame,
|
||||
OptionsSound,
|
||||
OptionsRecord,
|
||||
OptionsVideo,
|
||||
OptionsVideoAdjustments,
|
||||
OptionsLyrics,
|
||||
OptionsTheme,
|
||||
|
||||
Names,
|
||||
Credits,
|
||||
Party,
|
||||
|
||||
CountEntry //Leave this as last entry and never use it!
|
||||
}
|
||||
|
||||
public enum EPopupScreens
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace VocaluxeLib
|
||||
EOffOn GetSaveModifiedSongs();
|
||||
|
||||
void SetBackgroundMusicVolume(int newVolume);
|
||||
int GetBackgroundMusicVolume();
|
||||
int GetMusicVolume(EMusicType type);
|
||||
|
||||
EBackgroundMusicOffOn GetBackgroundMusicStatus();
|
||||
|
||||
@@ -147,11 +147,14 @@ namespace VocaluxeLib
|
||||
{
|
||||
void ReloadTheme();
|
||||
void SaveTheme();
|
||||
void FadeTo(EScreens nextScreen);
|
||||
void FadeTo(EScreen nextScreen);
|
||||
void FadeTo(IMenu nextScreen);
|
||||
|
||||
float GetGlobalAlpha();
|
||||
|
||||
EScreens GetNextScreen();
|
||||
IMenu GetNextScreen();
|
||||
EScreen GetNextScreenType();
|
||||
IMenu GetScreen(EScreen screen);
|
||||
}
|
||||
|
||||
public interface ILog
|
||||
@@ -264,14 +267,15 @@ namespace VocaluxeLib
|
||||
int Load(string soundFile, bool loop = false, bool prescan = false);
|
||||
void SetPosition(int soundStream, float newPosition);
|
||||
void Play(int soundStream);
|
||||
void Fade(int soundStream, float targetVolume, float duration, EStreamAction afterFadeAction = EStreamAction.Nothing);
|
||||
void Fade(int soundStream, int targetVolume, float duration, EStreamAction afterFadeAction = EStreamAction.Nothing);
|
||||
void Close(int soundStream);
|
||||
|
||||
bool IsFinished(int soundStream);
|
||||
float GetPosition(int soundStream);
|
||||
float GetLength(int soundStream);
|
||||
|
||||
void SetStreamVolume(int soundStream, float volume);
|
||||
void SetStreamVolume(int soundStream, int volume);
|
||||
void SetGlobalVolume(int volume);
|
||||
}
|
||||
|
||||
public interface ICover
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public bool Selectable
|
||||
{
|
||||
get { return _Selectable; }
|
||||
get { return _Selectable && Visible; }
|
||||
set
|
||||
{
|
||||
_Selectable = value;
|
||||
|
||||
@@ -112,11 +112,6 @@ namespace VocaluxeLib.Menu
|
||||
_ThemeScreenSettings = null;
|
||||
}
|
||||
|
||||
protected static void _FadeTo(EScreens nextScreen)
|
||||
{
|
||||
CBase.Graphics.FadeTo(nextScreen);
|
||||
}
|
||||
|
||||
#region ThemeHandler
|
||||
protected override void _ClearElements()
|
||||
{
|
||||
@@ -569,6 +564,11 @@ namespace VocaluxeLib.Menu
|
||||
get { return CBase.Settings.GetRenderRect(); }
|
||||
}
|
||||
|
||||
public virtual EMusicType CurrentMusicType
|
||||
{
|
||||
get { return EMusicType.Background; }
|
||||
}
|
||||
|
||||
protected void _ResumeBG()
|
||||
{
|
||||
foreach (CBackground bg in _Backgrounds)
|
||||
|
||||
@@ -29,7 +29,5 @@ namespace VocaluxeLib.Menu
|
||||
_PartyMode = partyMode;
|
||||
PartyModeID = partyMode.ID;
|
||||
}
|
||||
|
||||
public virtual void DataToScreen(Object data) {}
|
||||
}
|
||||
}
|
||||
@@ -22,12 +22,6 @@ using VocaluxeLib.Profile;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
{
|
||||
public struct SPartyNameOptions
|
||||
{
|
||||
public int[] NumPlayerTeams;
|
||||
public List<int>[] TeamList;
|
||||
}
|
||||
|
||||
public abstract class CMenuPartyNameSelection : CMenuParty
|
||||
{
|
||||
private bool _Teams;
|
||||
@@ -63,7 +57,7 @@ namespace VocaluxeLib.Menu
|
||||
private const string _SelectSlidePlayer = "SelectSlidePlayer";
|
||||
private const string _NameSelection = "NameSelection";
|
||||
|
||||
private List<int>[] _TeamList;
|
||||
protected List<int>[] _TeamList;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
@@ -558,12 +552,6 @@ namespace VocaluxeLib.Menu
|
||||
public abstract void Back();
|
||||
public abstract void Next();
|
||||
|
||||
public SPartyNameOptions GetData()
|
||||
{
|
||||
SPartyNameOptions option = new SPartyNameOptions {NumPlayerTeams = _NumPlayerTeams, TeamList = _TeamList};
|
||||
return option;
|
||||
}
|
||||
|
||||
public void IncreaseTeamNum()
|
||||
{
|
||||
if (!_AllowChangeTeamNum)
|
||||
|
||||
@@ -109,6 +109,12 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
private CStatic _PlayerSelector;
|
||||
|
||||
private SRectF _Rect;
|
||||
public override SRectF Rect
|
||||
{
|
||||
get { return _Rect; }
|
||||
}
|
||||
|
||||
public bool Selectable
|
||||
{
|
||||
get { return Visible; }
|
||||
@@ -140,8 +146,10 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
_PrepareTiles();
|
||||
|
||||
_PlayerSelector = new CStatic(_PartyModeID, _TextureTileSelected, new SColorF(), new SRectF(0, 0, _Theme.Tiles.W + 6, _Theme.Tiles.H + 6, Rect.Z - 0.5f));
|
||||
_PlayerSelector.Visible = false;
|
||||
_PlayerSelector = new CStatic(_PartyModeID, _TextureTileSelected, new SColorF(), new SRectF(0, 0, _Theme.Tiles.W + 6, _Theme.Tiles.H + 6, Rect.Z - 0.5f))
|
||||
{
|
||||
Visible = false
|
||||
};
|
||||
|
||||
_UpdateVisibleProfiles();
|
||||
|
||||
@@ -487,15 +495,19 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
for (int j = 0; j < _Theme.Tiles.NumW; j++)
|
||||
{
|
||||
var rect = new SRectF(Rect.X + j * (_Theme.Tiles.W + _Theme.Tiles.SpaceW), Rect.Y + i * (_Theme.Tiles.H + _Theme.Tiles.SpaceH), _Theme.Tiles.W, _Theme.Tiles.H,
|
||||
Rect.Z);
|
||||
var rect = new SRectF(MaxRect.X + j * (_Theme.Tiles.W + _Theme.Tiles.SpaceW), MaxRect.Y + i * (_Theme.Tiles.H + _Theme.Tiles.SpaceH),
|
||||
_Theme.Tiles.W, _Theme.Tiles.H, MaxRect.Z);
|
||||
var tileStatic = new CStatic(_PartyModeID, _TextureEmptyTile, _ColorEmptyTile, rect) {Aspect = EAspect.Crop};
|
||||
var tileText = new CText(rect.X + rect.W / 2, rect.Y + rect.H + _Theme.Tiles.Name.Space, rect.Z, _Theme.Tiles.Name.Height, rect.W, EAlignment.Center,
|
||||
_Theme.Tiles.Name.Style,
|
||||
_Theme.Tiles.Name.Font, _ColorNameTile, "");
|
||||
_Theme.Tiles.Name.Style, _Theme.Tiles.Name.Font, _ColorNameTile, "");
|
||||
_Tiles.Add(new CTile(tileStatic, tileText, -1));
|
||||
}
|
||||
}
|
||||
_Rect.X = MaxRect.X;
|
||||
_Rect.Y = MaxRect.Y;
|
||||
_Rect.Right = _Tiles[_Tiles.Count - 1].Avatar.Rect.Right;
|
||||
_Rect.Bottom = _Tiles[_Tiles.Count - 1].Name.Rect.Bottom;
|
||||
_Rect.Z = MaxRect.Z;
|
||||
}
|
||||
|
||||
private void _UpdateVisibleProfiles()
|
||||
|
||||
@@ -600,13 +600,13 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
case EDirection.Up:
|
||||
case EDirection.Down:
|
||||
if (!other.X.IsInRange(current.X, current.Right) && !other.Right.IsInRange(current.X, current.Right))
|
||||
if (!other.X.IsInRange(current.X, current.Right) && !other.Right.IsInRange(current.X, current.Right) && !current.X.IsInRange(other.X, other.Right))
|
||||
return float.MaxValue;
|
||||
break;
|
||||
|
||||
case EDirection.Left:
|
||||
case EDirection.Right:
|
||||
if (!other.Y.IsInRange(current.Y, current.Bottom) && !other.Bottom.IsInRange(current.Y, current.Bottom))
|
||||
if (!other.Y.IsInRange(current.Y, current.Bottom) && !other.Bottom.IsInRange(current.Y, current.Bottom) && !current.Y.IsInRange(other.Y, other.Bottom))
|
||||
return float.MaxValue;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1112,7 +1112,7 @@ namespace VocaluxeLib.Menu
|
||||
for (int i = 0; i < CBase.Playlist.GetSongCount(ActivePlaylistID); i++)
|
||||
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistID, i).SongID, CBase.Playlist.GetSong(ActivePlaylistID, i).GameMode);
|
||||
if (CBase.Game.GetNumSongs() > 0)
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenNames);
|
||||
CBase.Graphics.FadeTo(EScreen.Names);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1124,7 +1124,7 @@ namespace VocaluxeLib.Menu
|
||||
CBase.Game.AddSong(CBase.Playlist.GetSong(ActivePlaylistID, selected).SongID, CBase.Playlist.GetSong(ActivePlaylistID, selected).GameMode);
|
||||
|
||||
if (CBase.Game.GetNumSongs() > 0)
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenNames);
|
||||
CBase.Graphics.FadeTo(EScreen.Names);
|
||||
}
|
||||
|
||||
private void _Update()
|
||||
|
||||
@@ -42,6 +42,10 @@ namespace VocaluxeLib.Menu
|
||||
void OnClose();
|
||||
|
||||
SRectF ScreenArea { get; }
|
||||
/// <summary>
|
||||
/// Type of currently playing music
|
||||
/// </summary>
|
||||
EMusicType CurrentMusicType { get; }
|
||||
|
||||
void NextElement();
|
||||
void PrevElement();
|
||||
|
||||
@@ -243,7 +243,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
|
||||
public virtual void OnHide()
|
||||
{
|
||||
if (CBase.Graphics.GetNextScreen() != EScreens.ScreenNames || CBase.Config.GetBackgroundMusicStatus() == EBackgroundMusicOffOn.TR_CONFIG_OFF)
|
||||
if (CBase.Graphics.GetNextScreenType() != EScreen.Names || CBase.Config.GetBackgroundMusicStatus() == EBackgroundMusicOffOn.TR_CONFIG_OFF)
|
||||
_ResetPreview();
|
||||
}
|
||||
|
||||
|
||||
@@ -454,7 +454,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
}
|
||||
if (CBase.Songs.GetTabs() == EOffOn.TR_CONFIG_OFF && !songOptions.Selection.PartyMode)
|
||||
{
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenMain);
|
||||
CBase.Graphics.FadeTo(EScreen.Main);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
@@ -35,10 +34,7 @@ namespace VocaluxeLib.PartyModes
|
||||
}
|
||||
|
||||
#region Implementation
|
||||
public virtual bool Init()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
public abstract bool Init();
|
||||
|
||||
public void LoadTheme()
|
||||
{
|
||||
@@ -74,25 +70,9 @@ namespace VocaluxeLib.PartyModes
|
||||
entry.Value.SaveTheme();
|
||||
}
|
||||
|
||||
public virtual void DataFromScreen(string screenName, Object data) {}
|
||||
|
||||
public virtual void UpdateGame() {}
|
||||
|
||||
public virtual CMenuParty GetNextPartyScreen(out EScreens alternativeScreen)
|
||||
{
|
||||
alternativeScreen = EScreens.ScreenMain;
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual EScreens GetStartScreen()
|
||||
{
|
||||
return EScreens.ScreenSong;
|
||||
}
|
||||
|
||||
public virtual EScreens GetMainScreen()
|
||||
{
|
||||
return EScreens.ScreenSong;
|
||||
}
|
||||
public abstract IMenu GetStartScreen();
|
||||
|
||||
public virtual SScreenSongOptions GetScreenSongOptions()
|
||||
{
|
||||
@@ -157,21 +137,21 @@ namespace VocaluxeLib.PartyModes
|
||||
_ScreenSongOptions.Selection.NumJokers[teamNr]--;
|
||||
}
|
||||
|
||||
public virtual void SongSelected(int songID) {}
|
||||
public abstract void SongSelected(int songID);
|
||||
|
||||
public virtual void FinishedSinging()
|
||||
{
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenScore);
|
||||
CBase.Graphics.FadeTo(EScreen.Score);
|
||||
}
|
||||
|
||||
public virtual void LeavingScore()
|
||||
{
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenHighscore);
|
||||
CBase.Graphics.FadeTo(EScreen.Highscore);
|
||||
}
|
||||
|
||||
public virtual void LeavingHighscore()
|
||||
{
|
||||
CBase.Graphics.FadeTo(EScreens.ScreenSong);
|
||||
CBase.Graphics.FadeTo(EScreen.Song);
|
||||
}
|
||||
#endregion Implementation
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace VocaluxeLib.PartyModes
|
||||
{
|
||||
@@ -37,6 +38,16 @@ namespace VocaluxeLib.PartyModes
|
||||
_ScreenSongOptions.Sorting.DuetOptions = EDuetOptions.All;
|
||||
}
|
||||
|
||||
public override bool Init()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override IMenu GetStartScreen()
|
||||
{
|
||||
return CBase.Graphics.GetScreen(EScreen.Names);
|
||||
}
|
||||
|
||||
public override SScreenSongOptions GetScreenSongOptions()
|
||||
{
|
||||
_ScreenSongOptions.Sorting.SongSorting = CBase.Config.GetSongSorting();
|
||||
@@ -55,5 +66,10 @@ namespace VocaluxeLib.PartyModes
|
||||
_ScreenSongOptions.Sorting.SearchString = searchString;
|
||||
_ScreenSongOptions.Sorting.SearchActive = visible;
|
||||
}
|
||||
|
||||
public override void SongSelected(int songID)
|
||||
{
|
||||
CBase.Graphics.FadeTo(EScreen.Sing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,87 +0,0 @@
|
||||
#region license
|
||||
// This file is part of Vocaluxe.
|
||||
//
|
||||
// Vocaluxe is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Vocaluxe is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System.Windows.Forms;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace VocaluxeLib.PartyModes
|
||||
{
|
||||
public class CScreenPartyDummy : CMenuParty
|
||||
{
|
||||
// Version number for theme files. Increment it, if you've changed something on the theme files!
|
||||
protected override int _ScreenVersion
|
||||
{
|
||||
get { return 1; }
|
||||
}
|
||||
private CText _Warning;
|
||||
|
||||
public override void LoadTheme(string xmlPath)
|
||||
{
|
||||
_Warning = GetNewText();
|
||||
_Warning.Font.Height = 100f;
|
||||
_Warning.X = 150;
|
||||
_Warning.Y = 300;
|
||||
_Warning.Color = new SColorF(1f, 0f, 0f, 1f);
|
||||
_Warning.SelColor = new SColorF(1f, 0f, 0f, 1f);
|
||||
_Warning.Text = "SOMETHING WENT WRONG!";
|
||||
_AddText(_Warning);
|
||||
}
|
||||
|
||||
public override void ReloadTheme(string xmlPath) {}
|
||||
|
||||
public override void ReloadSkin() {}
|
||||
|
||||
public override void SaveTheme() {}
|
||||
|
||||
public override void UnloadSkin() {}
|
||||
|
||||
public override bool HandleInput(SKeyEvent keyEvent)
|
||||
{
|
||||
base.HandleInput(keyEvent);
|
||||
|
||||
if (keyEvent.KeyPressed) {}
|
||||
else
|
||||
{
|
||||
switch (keyEvent.Key)
|
||||
{
|
||||
case Keys.Back:
|
||||
case Keys.Escape:
|
||||
_FadeTo(EScreens.ScreenParty);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool HandleMouse(SMouseEvent mouseEvent)
|
||||
{
|
||||
base.HandleMouse(mouseEvent);
|
||||
|
||||
if (mouseEvent.LB && _IsMouseOverCurSelection(mouseEvent)) {}
|
||||
|
||||
if (mouseEvent.RB)
|
||||
_FadeTo(EScreens.ScreenParty);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool UpdateGame()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using VocaluxeLib.Menu;
|
||||
|
||||
namespace VocaluxeLib.PartyModes
|
||||
@@ -91,13 +90,10 @@ namespace VocaluxeLib.PartyModes
|
||||
|
||||
void AddScreen(CMenuParty screen, string screenName);
|
||||
void SaveScreens();
|
||||
void DataFromScreen(string screenName, Object data);
|
||||
|
||||
void UpdateGame();
|
||||
|
||||
CMenuParty GetNextPartyScreen(out EScreens alternativeScreen);
|
||||
EScreens GetStartScreen();
|
||||
EScreens GetMainScreen();
|
||||
IMenu GetStartScreen();
|
||||
SScreenSongOptions GetScreenSongOptions();
|
||||
|
||||
void OnSongChange(int songIndex, ref SScreenSongOptions screenSongOptions);
|
||||
|
||||
@@ -189,10 +189,20 @@ namespace VocaluxeLib
|
||||
public float Right
|
||||
{
|
||||
get { return X + W; }
|
||||
set
|
||||
{
|
||||
W = value - X;
|
||||
Debug.Assert(W >= 0);
|
||||
}
|
||||
}
|
||||
public float Bottom
|
||||
{
|
||||
get { return Y + H; }
|
||||
set
|
||||
{
|
||||
H = value - Y;
|
||||
Debug.Assert(H >= 0);
|
||||
}
|
||||
}
|
||||
public Size SizeI
|
||||
{
|
||||
|
||||
@@ -133,14 +133,7 @@ namespace VocaluxeLib.Utils.Player
|
||||
Load(file, position, autoplay);
|
||||
}
|
||||
|
||||
public new void Play()
|
||||
{
|
||||
CBase.Sound.SetPosition(_StreamID, _StartPosition);
|
||||
CBase.Video.Skip(_Video, _StartPosition, _Song.VideoGap);
|
||||
TogglePause();
|
||||
}
|
||||
|
||||
public new void Stop()
|
||||
public override void Stop()
|
||||
{
|
||||
base.Stop();
|
||||
|
||||
@@ -150,7 +143,7 @@ namespace VocaluxeLib.Utils.Player
|
||||
CBase.Video.Close(ref _Video);
|
||||
}
|
||||
|
||||
public new void TogglePause()
|
||||
public override void TogglePause()
|
||||
{
|
||||
if (IsPlaying && _Video != null)
|
||||
{
|
||||
|
||||
@@ -15,21 +15,16 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace VocaluxeLib.Utils.Player
|
||||
{
|
||||
public class CSoundPlayer
|
||||
{
|
||||
protected int _StreamID = -1;
|
||||
protected float _Volume;
|
||||
protected int _Volume = 100;
|
||||
protected float _StartPosition;
|
||||
protected float _FadeTime = CBase.Settings.GetSoundPlayerFadeTime();
|
||||
protected readonly float _FadeTime = CBase.Settings.GetSoundPlayerFadeTime();
|
||||
|
||||
public float Volume
|
||||
public int Volume
|
||||
{
|
||||
set
|
||||
{
|
||||
@@ -71,7 +66,7 @@ namespace VocaluxeLib.Utils.Player
|
||||
|
||||
public bool IsFinished
|
||||
{
|
||||
get { return RepeatSong ? false : CBase.Sound.IsFinished(_StreamID); }
|
||||
get { return !RepeatSong && CBase.Sound.IsFinished(_StreamID); }
|
||||
}
|
||||
|
||||
public CSoundPlayer(bool loop = false)
|
||||
@@ -107,19 +102,19 @@ namespace VocaluxeLib.Utils.Player
|
||||
return;
|
||||
|
||||
CBase.Sound.SetPosition(_StreamID, _StartPosition);
|
||||
CBase.Sound.SetStreamVolume(_StreamID, 0f);
|
||||
CBase.Sound.SetStreamVolume(_StreamID, 0);
|
||||
CBase.Sound.Fade(_StreamID, Volume, _FadeTime);
|
||||
CBase.Sound.Play(_StreamID);
|
||||
IsPlaying = true;
|
||||
}
|
||||
|
||||
public void TogglePause()
|
||||
public virtual void TogglePause()
|
||||
{
|
||||
if (_StreamID == -1)
|
||||
return;
|
||||
|
||||
if (IsPlaying)
|
||||
CBase.Sound.Fade(_StreamID, 0f, _FadeTime, EStreamAction.Pause);
|
||||
CBase.Sound.Fade(_StreamID, 0, _FadeTime, EStreamAction.Pause);
|
||||
else
|
||||
{
|
||||
CBase.Sound.Fade(_StreamID, Volume, _FadeTime);
|
||||
@@ -129,12 +124,12 @@ namespace VocaluxeLib.Utils.Player
|
||||
IsPlaying = !IsPlaying;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
public virtual void Stop()
|
||||
{
|
||||
if (_StreamID == -1 || !IsPlaying)
|
||||
return;
|
||||
|
||||
CBase.Sound.Fade(_StreamID, 0f, _FadeTime, EStreamAction.Close);
|
||||
CBase.Sound.Fade(_StreamID, 0, _FadeTime, EStreamAction.Close);
|
||||
_StreamID = -1;
|
||||
|
||||
IsPlaying = false;
|
||||
@@ -145,9 +140,8 @@ namespace VocaluxeLib.Utils.Player
|
||||
if (_StreamID == -1 || !IsPlaying)
|
||||
return;
|
||||
|
||||
float timeToPlay;
|
||||
float len = CBase.Sound.GetLength(_StreamID);
|
||||
timeToPlay = (len > 0f) ? len - CBase.Sound.GetPosition(_StreamID) : _FadeTime + 1f;
|
||||
float timeToPlay = (len > 0f) ? len - CBase.Sound.GetPosition(_StreamID) : _FadeTime + 1f;
|
||||
|
||||
bool finished = CBase.Sound.IsFinished(_StreamID);
|
||||
if (timeToPlay <= _FadeTime || finished)
|
||||
|
||||
@@ -139,7 +139,6 @@
|
||||
<Compile Include="Structs.cs" />
|
||||
<Compile Include="PartyModes\CPartyMode.cs" />
|
||||
<Compile Include="PartyModes\CPartyModeNone.cs" />
|
||||
<Compile Include="PartyModes\CScreenPartyDummy.cs" />
|
||||
<Compile Include="PartyModes\IPartyMode.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utils\CWavFile.cs" />
|
||||
|
||||
@@ -44,7 +44,8 @@ namespace VocaluxeLib.Xml
|
||||
/// Attribute for float fields to enforce normalized (0<=x<=1) values
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Field)]
|
||||
public class XmlNormalizedAttribute : XmlRangedAttribute {
|
||||
public class XmlNormalizedAttribute : XmlRangedAttribute
|
||||
{
|
||||
public XmlNormalizedAttribute() : base(0, 1) {}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user