diff --git a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs index da2b74f7..2dc24d47 100644 --- a/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs +++ b/PartyModes/PartyModeChallenge/CPartyModeChallenge.cs @@ -158,7 +158,8 @@ namespace VocaluxeLib.PartyModes.Challenge private SData _GameData; private EStage _Stage; - public CPartyModeChallenge() + public CPartyModeChallenge(string folder) + : base(folder) { _ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.PartyMode = true; diff --git a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs index 623681b6..3c12810f 100644 --- a/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs +++ b/PartyModes/PartyModeChallengeMedley/CPartyModeChallengeMedley.cs @@ -163,7 +163,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley private SData _GameData; private EStage _Stage; - public CPartyModeChallengeMedley() + public CPartyModeChallengeMedley(string folder) + : base(folder) { _ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.PartyMode = true; diff --git a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs index 1fcf18c2..fa7cb48b 100644 --- a/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs +++ b/PartyModes/PartyModeTicTacToe/CPartyModeTicTacToe.cs @@ -180,7 +180,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe private SData _GameData; private EStage _Stage; - public CPartyModeTicTacToe() + public CPartyModeTicTacToe(string folder) + : base(folder) { _ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.PartyMode = true; diff --git a/Vocaluxe/Base/CParty.cs b/Vocaluxe/Base/CParty.cs index 03b4632a..244f2335 100644 --- a/Vocaluxe/Base/CParty.cs +++ b/Vocaluxe/Base/CParty.cs @@ -64,9 +64,7 @@ namespace Vocaluxe.Base _NextID = 0; //add dummy normal game mode and set it as default - var pm = new SPartyMode {PartyMode = new CPartyModeNone(), ScreenFiles = new List()}; - pm.PartyMode.Initialize(); - pm.PartyModeID = _NextID++; + var pm = new SPartyMode {PartyMode = new CPartyModeNone(null), ScreenFiles = new List(), PartyModeID = _NextID++}; _NormalGameModeID = pm.PartyModeID; _PartyModes.Add(pm.PartyModeID, pm); _CurrentPartyMode = pm; @@ -288,7 +286,8 @@ namespace Vocaluxe.Base return false; } - object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Folder + "." + pm.PartyModeFile); + object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Folder + "." + pm.PartyModeFile, false, + BindingFlags.Public | BindingFlags.Instance,null, new object[]{pathToPm}, null, null); if (instance == null) { CLog.LogError("Error creating Instance of PartyMode file: " + file); @@ -304,8 +303,6 @@ namespace Vocaluxe.Base CLog.LogError("Error casting PartyMode file: " + file + "; " + e.Message); return false; } - pm.PartyMode.Initialize(); - pm.PartyMode.SetFolder(pathToPm); if (!CThemes.ReadThemesFromFolder(Path.Combine(pathToPm, CSettings.FolderNameThemes), pm.PartyModeID)) return false; diff --git a/VocaluxeLib/Menu/CMenuParty.cs b/VocaluxeLib/Menu/CMenuParty.cs index 865f8b35..96faa6c2 100644 --- a/VocaluxeLib/Menu/CMenuParty.cs +++ b/VocaluxeLib/Menu/CMenuParty.cs @@ -24,11 +24,6 @@ namespace VocaluxeLib.Menu { protected IPartyMode _PartyMode; - protected CMenuParty() - { - _PartyMode = new CPartyModeNone(); - } - public void SetPartyModeID(int partyModeID) { PartyModeID = partyModeID; @@ -40,23 +35,5 @@ namespace VocaluxeLib.Menu } public virtual void DataToScreen(Object data) {} - - /* - public sealed override void LoadTheme() - { - } - - public sealed override void ReloadTextures() - { - } - - public sealed override void ReloadTheme() - { - } - - public override void UnloadTextures() - { - } - */ } } \ No newline at end of file diff --git a/VocaluxeLib/PartyModes/CPartyMode.cs b/VocaluxeLib/PartyModes/CPartyMode.cs index 3a5cf701..2153d122 100644 --- a/VocaluxeLib/PartyModes/CPartyMode.cs +++ b/VocaluxeLib/PartyModes/CPartyMode.cs @@ -23,14 +23,15 @@ namespace VocaluxeLib.PartyModes { public abstract class CPartyMode : IPartyMode { - private string _Folder; + private readonly string _Folder; protected SScreenSongOptions _ScreenSongOptions; protected readonly Dictionary _Screens; - protected CPartyMode() + protected CPartyMode(string folder) { _Screens = new Dictionary(); _ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()}; + _Folder = folder; } #region Implementation @@ -39,8 +40,6 @@ namespace VocaluxeLib.PartyModes return false; } - public void Initialize() {} - public void AddScreen(CMenuParty screen, string screenName) { _Screens.Add(screenName, screen); @@ -121,11 +120,6 @@ namespace VocaluxeLib.PartyModes return _Folder; } - public void SetFolder(string folder) - { - _Folder = folder; - } - public virtual void SetSearchString(string searchString, bool visible) {} public virtual void JokerUsed(int teamNr) diff --git a/VocaluxeLib/PartyModes/CPartyModeNone.cs b/VocaluxeLib/PartyModes/CPartyModeNone.cs index 7b2e06e9..2a90dbd2 100644 --- a/VocaluxeLib/PartyModes/CPartyModeNone.cs +++ b/VocaluxeLib/PartyModes/CPartyModeNone.cs @@ -22,7 +22,8 @@ namespace VocaluxeLib.PartyModes public class CPartyModeNone : CPartyMode { //just a dummy for normal game mode - public CPartyModeNone() + public CPartyModeNone(string folder) + : base(folder) { _ScreenSongOptions.Selection.RandomOnly = false; _ScreenSongOptions.Selection.PartyMode = false; diff --git a/VocaluxeLib/PartyModes/IPartyMode.cs b/VocaluxeLib/PartyModes/IPartyMode.cs index 642cce6d..52d40054 100644 --- a/VocaluxeLib/PartyModes/IPartyMode.cs +++ b/VocaluxeLib/PartyModes/IPartyMode.cs @@ -83,7 +83,6 @@ namespace VocaluxeLib.PartyModes public interface IPartyMode { bool Init(); - void Initialize(); void AddScreen(CMenuParty screen, string screenName); void SaveScreens(); void DataFromScreen(string screenName, Object data); @@ -105,8 +104,6 @@ namespace VocaluxeLib.PartyModes int GetMinPlayerPerTeam(); int GetMaxPlayerPerTeam(); int GetMaxNumRounds(); - string GetFolder(); - void SetFolder(string folder); void SetSearchString(string searchString, bool visible);