Add partymode path as constructor param
This commit is contained in:
1 parent
e119e46c5a
commit
5d28b19066
8 files changed
+14
-45
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<string>()};
|
||||
pm.PartyMode.Initialize();
|
||||
pm.PartyModeID = _NextID++;
|
||||
var pm = new SPartyMode {PartyMode = new CPartyModeNone(null), ScreenFiles = new List<string>(), 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;
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -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<string, CMenuParty> _Screens;
|
||||
|
||||
protected CPartyMode()
|
||||
protected CPartyMode(string folder)
|
||||
{
|
||||
_Screens = new Dictionary<string, CMenuParty>();
|
||||
_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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in new issue
Block a user