Fix: Crash after starting a second challenge mode #169

This commit is contained in:
z3ro01 committed 2015-12-21 10:50:19 +01:00
1 parent caa46763cd
commit dc375de632
6 files changed
+35 -10

No files matched your search

@@ -153,10 +153,8 @@ namespace VocaluxeLib.PartyModes.Challenge
GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, NumJokers = 5, RefillJokers = true, CurrentRoundNr = 1, ProfileIDs = new List<int>(), CatSongIndices = null, Results = null};
}
public override bool Init()
public override void SetDefaults()
{
if (!base.Init())
return false;
_Stage = EStage.Config;
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
@@ -168,7 +166,15 @@ namespace VocaluxeLib.PartyModes.Challenge
_ScreenSongOptions.Sorting.Tabs = EOffOn.TR_CONFIG_ON;
GameData.ResultTable = new List<CResultTableRow>();
}
public override bool Init()
{
if (!base.Init())
return false;
_Stage = EStage.Config;
SetDefaults();
return true;
}
@@ -168,14 +168,19 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
GameData = new SData {NumPlayer = 4, NumPlayerAtOnce = 2, NumRounds = 12, CurrentRoundNr = 1, ProfileIDs = new List<int>(), NumSongs = 5, Songs = new List<int>(), SongSource = ESongSource.TR_ALLSONGS, CatSongIndices = null, Results = null};
}
public override void SetDefaults()
{
_Stage = EStage.Config;
GameData.CurrentRoundNr = 1;
GameData.ResultTable = new List<CResultTableRow>();
}
public override bool Init()
{
if (!base.Init())
return false;
_Stage = EStage.Config;
GameData.ResultTable = new List<CResultTableRow>();
SetDefaults();
return true;
}
@@ -168,10 +168,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
};
}
public override bool Init()
public override void SetDefaults()
{
if (!base.Init())
return false;
_Stage = EStage.Config;
_ScreenSongOptions.Sorting.IgnoreArticles = CBase.Config.GetIgnoreArticles();
@@ -186,6 +184,14 @@ namespace VocaluxeLib.PartyModes.TicTacToe
GameData.Rounds.Clear();
GameData.PlayerTeam1.Clear();
GameData.PlayerTeam2.Clear();
}
public override bool Init()
{
if (!base.Init())
return false;
SetDefaults();
return true;
}
+3 -1
View File
@@ -63,8 +63,10 @@ namespace Vocaluxe.Base
get { return _CurrentPartyMode.ID; }
set
{
if (_CurrentPartyMode.ID == value)
if (_CurrentPartyMode.ID == value) {
_CurrentPartyMode.SetDefaults();
return;
}
if (value != -1 && !_PartyModes.ContainsKey(value))
throw new ArgumentException("Partymode with ID=" + value + " does not exist!");
IPartyMode pm = _PartyModes[value].PartyMode;
+5
View File
@@ -48,6 +48,11 @@ namespace VocaluxeLib.PartyModes
return true;
}
public virtual void SetDefaults()
{
return;
}
public void LoadTheme()
{
string xmlPath = CBase.Themes.GetThemeScreensPath(ID);
+1
View File
@@ -99,6 +99,7 @@ namespace VocaluxeLib.PartyModes
bool Init();
void SetDefaults();
void LoadTheme();
void ReloadSkin();
void ReloadTheme();