Make partymodes reload their themes
Move PartyModeIds into Partymodes Fix bug where wrong text size is used (CalculatedFont is now used) Fix bug where text of the main table in partymodes is displayed wrong
This commit is contained in:
1 parent
5d28b19066
commit
aa0579a4f1
16 files changed
+194
-113
No files matched your search
@@ -158,8 +158,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
private SData _GameData;
|
private SData _GameData;
|
||||||
private EStage _Stage;
|
private EStage _Stage;
|
||||||
|
|
||||||
public CPartyModeChallenge(string folder)
|
public CPartyModeChallenge(int id, string folder)
|
||||||
: base(folder)
|
: base(id, folder)
|
||||||
{
|
{
|
||||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||||
_ScreenSongOptions.Selection.PartyMode = true;
|
_ScreenSongOptions.Selection.PartyMode = true;
|
||||||
|
|||||||
@@ -431,6 +431,8 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
|
|
||||||
private void _BuildRoundsTable()
|
private void _BuildRoundsTable()
|
||||||
{
|
{
|
||||||
|
if (_RoundsTable.Count == 0)
|
||||||
|
return;
|
||||||
_RoundsTableScrollArea = new SRectF();
|
_RoundsTableScrollArea = new SRectF();
|
||||||
|
|
||||||
const int numPlayerInOneRow = 3;
|
const int numPlayerInOneRow = 3;
|
||||||
@@ -439,14 +441,14 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
if (_NumRoundsVisible > _GameState.Combs.Count)
|
if (_NumRoundsVisible > _GameState.Combs.Count)
|
||||||
_NumRoundsVisible = _GameState.Combs.Count;
|
_NumRoundsVisible = _GameState.Combs.Count;
|
||||||
|
|
||||||
float numberX = _Texts[_TextRoundNumber].X;
|
float numberX = _RoundsTable[0].Number.X;
|
||||||
float numberY = _Texts[_TextRoundNumber].Y;
|
float numberY = _RoundsTable[0].Number.Y;
|
||||||
|
|
||||||
_RoundsTableScrollArea.X = numberX;
|
_RoundsTableScrollArea.X = numberX;
|
||||||
_RoundsTableScrollArea.Y = numberY;
|
_RoundsTableScrollArea.Y = numberY;
|
||||||
_RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20;
|
_RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - _RoundsTable[0].Number.X - 20;
|
||||||
|
|
||||||
float delta = _Texts[_TextRoundNumber].Rect.H;
|
float delta = _RoundsTable[0].Number.Rect.H;
|
||||||
|
|
||||||
//Update statics and texts for rounds
|
//Update statics and texts for rounds
|
||||||
foreach (CRoundsTableRow roundRow in _RoundsTable)
|
foreach (CRoundsTableRow roundRow in _RoundsTable)
|
||||||
@@ -479,7 +481,7 @@ namespace VocaluxeLib.PartyModes.Challenge
|
|||||||
roundRow.TextScores[column].Y = numberY + delta;
|
roundRow.TextScores[column].Y = numberY + delta;
|
||||||
roundRow.TextScores[column].MaxWidth = maxw;
|
roundRow.TextScores[column].MaxWidth = maxw;
|
||||||
}
|
}
|
||||||
numberY = numberY + 2*delta;
|
numberY = numberY + 2 * delta;
|
||||||
}
|
}
|
||||||
numberY = numberY + delta / 2;
|
numberY = numberY + delta / 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -163,8 +163,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
private SData _GameData;
|
private SData _GameData;
|
||||||
private EStage _Stage;
|
private EStage _Stage;
|
||||||
|
|
||||||
public CPartyModeChallengeMedley(string folder)
|
public CPartyModeChallengeMedley(int id, string folder)
|
||||||
: base(folder)
|
: base(id, folder)
|
||||||
{
|
{
|
||||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||||
_ScreenSongOptions.Selection.PartyMode = true;
|
_ScreenSongOptions.Selection.PartyMode = true;
|
||||||
|
|||||||
@@ -431,6 +431,8 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
|
|
||||||
private void _BuildRoundsTable()
|
private void _BuildRoundsTable()
|
||||||
{
|
{
|
||||||
|
if (_RoundsTable.Count == 0)
|
||||||
|
return;
|
||||||
_RoundsTableScrollArea = new SRectF();
|
_RoundsTableScrollArea = new SRectF();
|
||||||
|
|
||||||
const int numPlayerInOneRow = 3;
|
const int numPlayerInOneRow = 3;
|
||||||
@@ -439,14 +441,14 @@ namespace VocaluxeLib.PartyModes.ChallengeMedley
|
|||||||
if (_NumRoundsVisible > _GameState.Combs.Count)
|
if (_NumRoundsVisible > _GameState.Combs.Count)
|
||||||
_NumRoundsVisible = _GameState.Combs.Count;
|
_NumRoundsVisible = _GameState.Combs.Count;
|
||||||
|
|
||||||
float numberX = _Texts[_TextRoundNumber].X;
|
float numberX = _RoundsTable[0].Number.X;
|
||||||
float numberY = _Texts[_TextRoundNumber].Y;
|
float numberY = _RoundsTable[0].Number.Y;
|
||||||
|
|
||||||
_RoundsTableScrollArea.X = numberX;
|
_RoundsTableScrollArea.X = numberX;
|
||||||
_RoundsTableScrollArea.Y = numberY;
|
_RoundsTableScrollArea.Y = numberY;
|
||||||
_RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - _Texts[_TextRoundNumber].X - 20;
|
_RoundsTableScrollArea.W = CBase.Settings.GetRenderW() - _RoundsTable[0].Number.X - 20;
|
||||||
|
|
||||||
float delta = _Texts[_TextRoundNumber].Rect.H;
|
float delta = _RoundsTable[0].Number.Rect.H;
|
||||||
|
|
||||||
//Update statics and texts for rounds
|
//Update statics and texts for rounds
|
||||||
foreach (CRoundsTableRow roundRow in _RoundsTable)
|
foreach (CRoundsTableRow roundRow in _RoundsTable)
|
||||||
|
|||||||
@@ -180,8 +180,8 @@ namespace VocaluxeLib.PartyModes.TicTacToe
|
|||||||
private SData _GameData;
|
private SData _GameData;
|
||||||
private EStage _Stage;
|
private EStage _Stage;
|
||||||
|
|
||||||
public CPartyModeTicTacToe(string folder)
|
public CPartyModeTicTacToe(int id, string folder)
|
||||||
: base(folder)
|
: base(id, folder)
|
||||||
{
|
{
|
||||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||||
_ScreenSongOptions.Selection.PartyMode = true;
|
_ScreenSongOptions.Selection.PartyMode = true;
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.IO;
|
|
||||||
using System.Xml.Serialization;
|
|
||||||
using Vocaluxe.Base.Fonts;
|
using Vocaluxe.Base.Fonts;
|
||||||
using Vocaluxe.Base.ThemeSystem;
|
using Vocaluxe.Base.ThemeSystem;
|
||||||
using Vocaluxe.Screens;
|
using Vocaluxe.Screens;
|
||||||
@@ -148,6 +146,8 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
foreach (IMenu popup in _PopupScreens)
|
foreach (IMenu popup in _PopupScreens)
|
||||||
popup.ReloadTheme(CThemes.GetThemeScreensPath(popup.PartyModeID));
|
popup.ReloadTheme(CThemes.GetThemeScreensPath(popup.PartyModeID));
|
||||||
|
|
||||||
|
CParty.ReloadTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ReloadSkin()
|
public static void ReloadSkin()
|
||||||
@@ -158,6 +158,8 @@ namespace Vocaluxe.Base
|
|||||||
|
|
||||||
foreach (IMenu menu in _PopupScreens)
|
foreach (IMenu menu in _PopupScreens)
|
||||||
menu.ReloadTextures();
|
menu.ReloadTextures();
|
||||||
|
|
||||||
|
CParty.ReloadTextures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveTheme()
|
public static void SaveTheme()
|
||||||
|
|||||||
+49
-48
@@ -32,7 +32,6 @@ namespace Vocaluxe.Base
|
|||||||
#region Structs
|
#region Structs
|
||||||
struct SPartyMode
|
struct SPartyMode
|
||||||
{
|
{
|
||||||
public int PartyModeID;
|
|
||||||
public int PartyModeSystemVersion;
|
public int PartyModeSystemVersion;
|
||||||
public string Name;
|
public string Name;
|
||||||
public string Description;
|
public string Description;
|
||||||
@@ -64,9 +63,9 @@ namespace Vocaluxe.Base
|
|||||||
_NextID = 0;
|
_NextID = 0;
|
||||||
|
|
||||||
//add dummy normal game mode and set it as default
|
//add dummy normal game mode and set it as default
|
||||||
var pm = new SPartyMode {PartyMode = new CPartyModeNone(null), ScreenFiles = new List<string>(), PartyModeID = _NextID++};
|
var pm = new SPartyMode {ScreenFiles = new List<string>(), PartyMode = new CPartyModeNone(_NextID++, null)};
|
||||||
_NormalGameModeID = pm.PartyModeID;
|
_NormalGameModeID = pm.PartyMode.ID;
|
||||||
_PartyModes.Add(pm.PartyModeID, pm);
|
_PartyModes.Add(pm.PartyMode.ID, pm);
|
||||||
_CurrentPartyMode = pm;
|
_CurrentPartyMode = pm;
|
||||||
|
|
||||||
//load other party modes
|
//load other party modes
|
||||||
@@ -77,8 +76,8 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_CurrentPartyMode.PartyModeID != _NormalGameModeID)
|
if (_CurrentPartyMode.PartyMode.ID != _NormalGameModeID)
|
||||||
return _CurrentPartyMode.PartyModeID;
|
return _CurrentPartyMode.PartyMode.ID;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -89,45 +88,50 @@ namespace Vocaluxe.Base
|
|||||||
get { return _PartyModes.Count; }
|
get { return _PartyModes.Count; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ReloadTheme()
|
||||||
|
{
|
||||||
|
foreach (SPartyMode pm in _PartyModes.Values)
|
||||||
|
pm.PartyMode.ReloadTheme();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReloadTextures()
|
||||||
|
{
|
||||||
|
foreach (SPartyMode pm in _PartyModes.Values)
|
||||||
|
pm.PartyMode.ReloadTextures();
|
||||||
|
}
|
||||||
|
|
||||||
public static void SaveThemes()
|
public static void SaveThemes()
|
||||||
{
|
{
|
||||||
foreach (KeyValuePair<int, SPartyMode> pair in _PartyModes)
|
foreach (SPartyMode pm in _PartyModes.Values)
|
||||||
pair.Value.PartyMode.SaveScreens();
|
pm.PartyMode.SaveScreens();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<SPartyModeInfos> GetPartyModeInfos()
|
public static List<SPartyModeInfos> GetPartyModeInfos()
|
||||||
{
|
{
|
||||||
var infos = new List<SPartyModeInfos>();
|
var infos = new List<SPartyModeInfos>();
|
||||||
|
|
||||||
var pmIDs = new int[_PartyModes.Count];
|
foreach (KeyValuePair<int, SPartyMode> kvp in _PartyModes)
|
||||||
_PartyModes.Keys.CopyTo(pmIDs, 0);
|
|
||||||
|
|
||||||
foreach (int pmID in pmIDs)
|
|
||||||
{
|
{
|
||||||
if (pmID != _NormalGameModeID)
|
if (kvp.Key != _NormalGameModeID)
|
||||||
{
|
{
|
||||||
SPartyMode mode;
|
SPartyMode mode = kvp.Value;
|
||||||
_PartyModes.TryGetValue(pmID, out mode);
|
|
||||||
|
|
||||||
if (mode.PartyMode != null)
|
var info = new SPartyModeInfos
|
||||||
{
|
{
|
||||||
var info = new SPartyModeInfos
|
Author = mode.Author,
|
||||||
{
|
Description = mode.Description,
|
||||||
Author = mode.Author,
|
Name = mode.Name,
|
||||||
Description = mode.Description,
|
PartyModeID = mode.PartyMode.ID,
|
||||||
Name = mode.Name,
|
VersionMajor = mode.PartyModeVersionMajor,
|
||||||
PartyModeID = mode.PartyModeID,
|
VersionMinor = mode.PartyModeVersionMinor,
|
||||||
VersionMajor = mode.PartyModeVersionMajor,
|
TargetAudience = mode.TargetAudience,
|
||||||
VersionMinor = mode.PartyModeVersionMinor,
|
MaxPlayers = mode.PartyMode.GetMaxPlayer(),
|
||||||
TargetAudience = mode.TargetAudience,
|
MinPlayers = mode.PartyMode.GetMinPlayer(),
|
||||||
MaxPlayers = mode.PartyMode.GetMaxPlayer(),
|
MaxTeams = mode.PartyMode.GetMaxTeams(),
|
||||||
MinPlayers = mode.PartyMode.GetMinPlayer(),
|
MinTeams = mode.PartyMode.GetMinTeams()
|
||||||
MaxTeams = mode.PartyMode.GetMaxTeams(),
|
};
|
||||||
MinTeams = mode.PartyMode.GetMinTeams()
|
|
||||||
};
|
|
||||||
|
|
||||||
infos.Add(info);
|
infos.Add(info);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return infos;
|
return infos;
|
||||||
@@ -225,13 +229,13 @@ namespace Vocaluxe.Base
|
|||||||
{
|
{
|
||||||
SPartyMode pm;
|
SPartyMode pm;
|
||||||
if (_LoadPartyMode(file, out pm))
|
if (_LoadPartyMode(file, out pm))
|
||||||
_PartyModes.Add(pm.PartyModeID, pm);
|
_PartyModes.Add(pm.PartyMode.ID, pm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool _LoadPartyMode(string file, out SPartyMode pm)
|
private static bool _LoadPartyMode(string file, out SPartyMode pm)
|
||||||
{
|
{
|
||||||
pm = new SPartyMode {PartyModeID = _NextID++, ScreenFiles = new List<string>()};
|
pm = new SPartyMode {ScreenFiles = new List<string>()};
|
||||||
|
|
||||||
CXMLReader xmlReader = CXMLReader.OpenFile(file);
|
CXMLReader xmlReader = CXMLReader.OpenFile(file);
|
||||||
|
|
||||||
@@ -280,14 +284,8 @@ namespace Vocaluxe.Base
|
|||||||
if (output == null)
|
if (output == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!CLanguage.LoadPartyLanguageFiles(pm.PartyModeID, Path.Combine(pathToPm, CSettings.FolderNamePartyModeLanguages)))
|
|
||||||
{
|
|
||||||
CLog.LogError("Error loading language files for PartyMode: " + file);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Folder + "." + pm.PartyModeFile, false,
|
object instance = output.CreateInstance(typeof(IPartyMode).Namespace + "." + pm.Folder + "." + pm.PartyModeFile, false,
|
||||||
BindingFlags.Public | BindingFlags.Instance,null, new object[]{pathToPm}, null, null);
|
BindingFlags.Public | BindingFlags.Instance, null, new object[] {_NextID++, pathToPm}, null, null);
|
||||||
if (instance == null)
|
if (instance == null)
|
||||||
{
|
{
|
||||||
CLog.LogError("Error creating Instance of PartyMode file: " + file);
|
CLog.LogError("Error creating Instance of PartyMode file: " + file);
|
||||||
@@ -304,28 +302,31 @@ namespace Vocaluxe.Base
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!CThemes.ReadThemesFromFolder(Path.Combine(pathToPm, CSettings.FolderNameThemes), pm.PartyModeID))
|
if (!CLanguage.LoadPartyLanguageFiles(pm.PartyMode.ID, Path.Combine(pathToPm, CSettings.FolderNamePartyModeLanguages)))
|
||||||
|
{
|
||||||
|
CLog.LogError("Error loading language files for PartyMode: " + file);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!CThemes.ReadThemesFromFolder(Path.Combine(pathToPm, CSettings.FolderNameThemes), pm.PartyMode.ID))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!CThemes.LoadPartymodeTheme(pm.PartyModeID))
|
if (!CThemes.LoadPartymodeTheme(pm.PartyMode.ID))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
foreach (string screenfile in pm.ScreenFiles)
|
foreach (string screenfile in pm.ScreenFiles)
|
||||||
{
|
{
|
||||||
string xmlPath = CThemes.GetThemeScreensPath(pm.PartyModeID);
|
|
||||||
CMenuParty screen = _GetPartyScreenInstance(output, screenfile, pm.Folder);
|
CMenuParty screen = _GetPartyScreenInstance(output, screenfile, pm.Folder);
|
||||||
|
|
||||||
if (screen != null)
|
if (screen != null)
|
||||||
{
|
{
|
||||||
screen.Init();
|
|
||||||
screen.AssignPartyMode(pm.PartyMode);
|
screen.AssignPartyMode(pm.PartyMode);
|
||||||
screen.SetPartyModeID(pm.PartyModeID);
|
|
||||||
screen.LoadTheme(xmlPath);
|
|
||||||
pm.PartyMode.AddScreen(screen, screenfile);
|
pm.PartyMode.AddScreen(screen, screenfile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
pm.PartyMode.LoadTheme();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ namespace Vocaluxe.Base.Fonts
|
|||||||
/// <returns>RectangleF object containing the bounds</returns>
|
/// <returns>RectangleF object containing the bounds</returns>
|
||||||
public static RectangleF GetTextBounds(CText text)
|
public static RectangleF GetTextBounds(CText text)
|
||||||
{
|
{
|
||||||
return new RectangleF(text.X, text.Y, GetTextWidth(text.TranslatedText, text.Font), GetTextHeight(text.TranslatedText, text.Font));
|
return new RectangleF(text.X, text.Y, GetTextWidth(text.TranslatedText, text.CalculatedFont), GetTextHeight(text.TranslatedText, text.CalculatedFont));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Font GetSystemFont(CFont font)
|
public static Font GetSystemFont(CFont font)
|
||||||
|
|||||||
@@ -74,6 +74,13 @@ namespace VocaluxeLib
|
|||||||
_Height = font.Size;
|
_Height = font.Size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public CFont(CFont font)
|
||||||
|
{
|
||||||
|
_Name = font._Name;
|
||||||
|
_Style = font._Style;
|
||||||
|
_Height = font._Height;
|
||||||
|
}
|
||||||
|
|
||||||
public CFont(string fontFamily, EStyle style, float h)
|
public CFont(string fontFamily, EStyle style, float h)
|
||||||
{
|
{
|
||||||
_Name = fontFamily;
|
_Name = fontFamily;
|
||||||
|
|||||||
+46
-25
@@ -20,7 +20,6 @@ using System.Collections.Generic;
|
|||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using System.Xml;
|
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using VocaluxeLib.Draw;
|
using VocaluxeLib.Draw;
|
||||||
using VocaluxeLib.Menu.SingNotes;
|
using VocaluxeLib.Menu.SingNotes;
|
||||||
@@ -62,7 +61,7 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
public abstract class CMenu : IMenu
|
public abstract class CMenu : IMenu
|
||||||
{
|
{
|
||||||
private List<CInteraction> _Interactions;
|
private readonly List<CInteraction> _Interactions;
|
||||||
private int _Selection;
|
private int _Selection;
|
||||||
public string ThemePath { get; private set; }
|
public string ThemePath { get; private set; }
|
||||||
|
|
||||||
@@ -94,19 +93,19 @@ namespace VocaluxeLib.Menu
|
|||||||
protected string[] _ThemeParticleEffects;
|
protected string[] _ThemeParticleEffects;
|
||||||
protected string[] _ThemeScreenSettings;
|
protected string[] _ThemeScreenSettings;
|
||||||
|
|
||||||
protected COrderedDictionaryLite<CButton> _Buttons { get; private set; }
|
protected readonly COrderedDictionaryLite<CButton> _Buttons;
|
||||||
protected COrderedDictionaryLite<CText> _Texts { get; private set; }
|
protected readonly COrderedDictionaryLite<CText> _Texts;
|
||||||
protected COrderedDictionaryLite<CBackground> _Backgrounds { get; private set; }
|
protected readonly COrderedDictionaryLite<CBackground> _Backgrounds;
|
||||||
protected COrderedDictionaryLite<CStatic> _Statics { get; private set; }
|
protected readonly COrderedDictionaryLite<CStatic> _Statics;
|
||||||
protected COrderedDictionaryLite<CSelectSlide> _SelectSlides { get; private set; }
|
protected readonly COrderedDictionaryLite<CSelectSlide> _SelectSlides;
|
||||||
protected COrderedDictionaryLite<CSongMenu> _SongMenus { get; private set; }
|
protected readonly COrderedDictionaryLite<CSongMenu> _SongMenus;
|
||||||
protected COrderedDictionaryLite<CLyric> _Lyrics { get; private set; }
|
protected readonly COrderedDictionaryLite<CLyric> _Lyrics;
|
||||||
protected COrderedDictionaryLite<CSingNotes> _SingNotes { get; private set; }
|
protected readonly COrderedDictionaryLite<CSingNotes> _SingNotes;
|
||||||
protected COrderedDictionaryLite<CNameSelection> _NameSelections { get; private set; }
|
protected readonly COrderedDictionaryLite<CNameSelection> _NameSelections;
|
||||||
protected COrderedDictionaryLite<CEqualizer> _Equalizers { get; private set; }
|
protected readonly COrderedDictionaryLite<CEqualizer> _Equalizers;
|
||||||
protected COrderedDictionaryLite<CPlaylist> _Playlists { get; private set; }
|
protected readonly COrderedDictionaryLite<CPlaylist> _Playlists;
|
||||||
protected COrderedDictionaryLite<CParticleEffect> _ParticleEffects { get; private set; }
|
protected readonly COrderedDictionaryLite<CParticleEffect> _ParticleEffects;
|
||||||
protected COrderedDictionaryLite<CScreenSetting> _ScreenSettings { get; private set; }
|
protected readonly COrderedDictionaryLite<CScreenSetting> _ScreenSettings;
|
||||||
// ReSharper restore MemberCanBePrivate.Global
|
// ReSharper restore MemberCanBePrivate.Global
|
||||||
|
|
||||||
protected SRectF _ScreenArea;
|
protected SRectF _ScreenArea;
|
||||||
@@ -115,16 +114,11 @@ namespace VocaluxeLib.Menu
|
|||||||
get { return _ScreenArea; }
|
get { return _ScreenArea; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Init()
|
protected CMenu()
|
||||||
{
|
{
|
||||||
ThemeName = GetType().Name;
|
|
||||||
if (ThemeName[0] == 'C' && Char.IsUpper(ThemeName[1]))
|
|
||||||
ThemeName = ThemeName.Remove(0, 1);
|
|
||||||
|
|
||||||
PartyModeID = -1;
|
PartyModeID = -1;
|
||||||
_Interactions = new List<CInteraction>();
|
|
||||||
_Selection = 0;
|
|
||||||
|
|
||||||
|
_Interactions = new List<CInteraction>();
|
||||||
_Backgrounds = new COrderedDictionaryLite<CBackground>(this);
|
_Backgrounds = new COrderedDictionaryLite<CBackground>(this);
|
||||||
_Buttons = new COrderedDictionaryLite<CButton>(this);
|
_Buttons = new COrderedDictionaryLite<CButton>(this);
|
||||||
_Texts = new COrderedDictionaryLite<CText>(this);
|
_Texts = new COrderedDictionaryLite<CText>(this);
|
||||||
@@ -138,6 +132,15 @@ namespace VocaluxeLib.Menu
|
|||||||
_Playlists = new COrderedDictionaryLite<CPlaylist>(this);
|
_Playlists = new COrderedDictionaryLite<CPlaylist>(this);
|
||||||
_ParticleEffects = new COrderedDictionaryLite<CParticleEffect>(this);
|
_ParticleEffects = new COrderedDictionaryLite<CParticleEffect>(this);
|
||||||
_ScreenSettings = new COrderedDictionaryLite<CScreenSetting>(this);
|
_ScreenSettings = new COrderedDictionaryLite<CScreenSetting>(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void Init()
|
||||||
|
{
|
||||||
|
ThemeName = GetType().Name;
|
||||||
|
if (ThemeName[0] == 'C' && Char.IsUpper(ThemeName[1]))
|
||||||
|
ThemeName = ThemeName.Remove(0, 1);
|
||||||
|
|
||||||
|
_Selection = 0;
|
||||||
|
|
||||||
_PrevMouseX = 0;
|
_PrevMouseX = 0;
|
||||||
_PrevMouseY = 0;
|
_PrevMouseY = 0;
|
||||||
@@ -163,6 +166,24 @@ namespace VocaluxeLib.Menu
|
|||||||
_ThemeScreenSettings = null;
|
_ThemeScreenSettings = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void _ClearElements()
|
||||||
|
{
|
||||||
|
_Interactions.Clear();
|
||||||
|
_Backgrounds.Clear();
|
||||||
|
_Buttons.Clear();
|
||||||
|
_Texts.Clear();
|
||||||
|
_Statics.Clear();
|
||||||
|
_SelectSlides.Clear();
|
||||||
|
_SongMenus.Clear();
|
||||||
|
_Lyrics.Clear();
|
||||||
|
_SingNotes.Clear();
|
||||||
|
_NameSelections.Clear();
|
||||||
|
_Equalizers.Clear();
|
||||||
|
_Playlists.Clear();
|
||||||
|
_ParticleEffects.Clear();
|
||||||
|
_ScreenSettings.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
protected static void _FadeTo(EScreens nextScreen)
|
protected static void _FadeTo(EScreens nextScreen)
|
||||||
{
|
{
|
||||||
CBase.Graphics.FadeTo(nextScreen);
|
CBase.Graphics.FadeTo(nextScreen);
|
||||||
@@ -258,7 +279,7 @@ namespace VocaluxeLib.Menu
|
|||||||
foreach (SThemeText te in Theme.Texts)
|
foreach (SThemeText te in Theme.Texts)
|
||||||
_AddText(new CText(te, PartyModeID), te.Name);
|
_AddText(new CText(te, PartyModeID), te.Name);
|
||||||
}
|
}
|
||||||
catch (InvalidOperationException e)
|
catch (InvalidOperationException)
|
||||||
{
|
{
|
||||||
CBase.Log.LogError("Error while reading " + ThemeName + ".xml", true, true);
|
CBase.Log.LogError("Error while reading " + ThemeName + ".xml", true, true);
|
||||||
}
|
}
|
||||||
@@ -348,7 +369,7 @@ namespace VocaluxeLib.Menu
|
|||||||
Theme.SingNotes.Add(el.GetTheme());
|
Theme.SingNotes.Add(el.GetTheme());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ThemePath == "" || ThemePath == null)
|
if (string.IsNullOrEmpty(ThemePath))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
try
|
try
|
||||||
@@ -456,7 +477,7 @@ namespace VocaluxeLib.Menu
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
UnloadTextures();
|
UnloadTextures();
|
||||||
Init();
|
_ClearElements();
|
||||||
LoadTheme(xmlPath);
|
LoadTheme(xmlPath);
|
||||||
}
|
}
|
||||||
#endregion ThemeHandler
|
#endregion ThemeHandler
|
||||||
|
|||||||
@@ -24,14 +24,10 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
protected IPartyMode _PartyMode;
|
protected IPartyMode _PartyMode;
|
||||||
|
|
||||||
public void SetPartyModeID(int partyModeID)
|
|
||||||
{
|
|
||||||
PartyModeID = partyModeID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void AssignPartyMode(IPartyMode partyMode)
|
public void AssignPartyMode(IPartyMode partyMode)
|
||||||
{
|
{
|
||||||
_PartyMode = partyMode;
|
_PartyMode = partyMode;
|
||||||
|
PartyModeID = partyMode.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void DataToScreen(Object data) {}
|
public virtual void DataToScreen(Object data) {}
|
||||||
|
|||||||
@@ -83,5 +83,11 @@ namespace VocaluxeLib.Menu
|
|||||||
{
|
{
|
||||||
return GetEnumerator();
|
return GetEnumerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Clear()
|
||||||
|
{
|
||||||
|
_HtIndex.Clear();
|
||||||
|
_Items.Clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+20
-10
@@ -190,8 +190,6 @@ namespace VocaluxeLib.Menu
|
|||||||
_Text = translation;
|
_Text = translation;
|
||||||
if (_EditMode)
|
if (_EditMode)
|
||||||
_Text += "|";
|
_Text += "|";
|
||||||
//Reset height, it might have been reduced in _UpdatePosition
|
|
||||||
Font.Height = _Theme.FontHeight;
|
|
||||||
_PositionNeedsUpdate = true;
|
_PositionNeedsUpdate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -238,6 +236,17 @@ namespace VocaluxeLib.Menu
|
|||||||
}
|
}
|
||||||
|
|
||||||
public float Alpha = 1f;
|
public float Alpha = 1f;
|
||||||
|
private CFont _CalculatedFont;
|
||||||
|
|
||||||
|
public CFont CalculatedFont
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_PositionNeedsUpdate)
|
||||||
|
_UpdateTextPosition();
|
||||||
|
return _CalculatedFont;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public CText(int partyModeID)
|
public CText(int partyModeID)
|
||||||
{
|
{
|
||||||
@@ -257,7 +266,7 @@ namespace VocaluxeLib.Menu
|
|||||||
_MaxWidth = text._MaxWidth;
|
_MaxWidth = text._MaxWidth;
|
||||||
_Align = text._Align;
|
_Align = text._Align;
|
||||||
_ResizeAlign = text._ResizeAlign;
|
_ResizeAlign = text._ResizeAlign;
|
||||||
Font = text.Font; //Use setter to set observer
|
Font = new CFont(text.Font); //Use setter to set observer
|
||||||
|
|
||||||
Color = new SColorF(text.Color);
|
Color = new SColorF(text.Color);
|
||||||
SelColor = new SColorF(text.SelColor);
|
SelColor = new SColorF(text.SelColor);
|
||||||
@@ -399,10 +408,10 @@ namespace VocaluxeLib.Menu
|
|||||||
SColorF currentColor = (Selected) ? SelColor : Color;
|
SColorF currentColor = (Selected) ? SelColor : Color;
|
||||||
var color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
|
var color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
|
||||||
|
|
||||||
CBase.Fonts.DrawText(_Text, Font, Rect.X, Rect.Y, Z, color);
|
CBase.Fonts.DrawText(_Text, CalculatedFont, Rect.X, Rect.Y, Z, color);
|
||||||
|
|
||||||
if (ReflectionHeight > 0)
|
if (ReflectionHeight > 0)
|
||||||
CBase.Fonts.DrawTextReflection(_Text, Font, Rect.X, Rect.Y, Z, color, ReflectionSpace, ReflectionHeight);
|
CBase.Fonts.DrawTextReflection(_Text, CalculatedFont, Rect.X, Rect.Y, Z, color, ReflectionSpace, ReflectionHeight);
|
||||||
|
|
||||||
if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
|
if (Selected && (CBase.Settings.GetProgramState() == EProgramState.EditTheme))
|
||||||
CBase.Drawing.DrawRect(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(Rect.X, Rect.Y, Rect.W, Rect.H, Z));
|
CBase.Drawing.DrawRect(new SColorF(0.5f, 1f, 0.5f, 0.5f), new SRectF(Rect.X, Rect.Y, Rect.W, Rect.H, Z));
|
||||||
@@ -413,7 +422,7 @@ namespace VocaluxeLib.Menu
|
|||||||
SColorF currentColor = (Selected) ? SelColor : Color;
|
SColorF currentColor = (Selected) ? SelColor : Color;
|
||||||
var color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
|
var color = new SColorF(currentColor.R, currentColor.G, currentColor.B, currentColor.A * Alpha);
|
||||||
|
|
||||||
CBase.Fonts.DrawText(Text, Font, Rect.X, Rect.Y, Z, color, begin, end);
|
CBase.Fonts.DrawText(Text, CalculatedFont, Rect.X, Rect.Y, Z, color, begin, end);
|
||||||
|
|
||||||
if (ReflectionHeight > 0)
|
if (ReflectionHeight > 0)
|
||||||
{
|
{
|
||||||
@@ -503,10 +512,13 @@ namespace VocaluxeLib.Menu
|
|||||||
|
|
||||||
private void _UpdateTextPosition()
|
private void _UpdateTextPosition()
|
||||||
{
|
{
|
||||||
|
_CalculatedFont = new CFont(Font);
|
||||||
|
_PositionNeedsUpdate = false;
|
||||||
|
|
||||||
if (_Text == "")
|
if (_Text == "")
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float h = Font.Height;
|
float h = _CalculatedFont.Height;
|
||||||
float y = Y;
|
float y = Y;
|
||||||
RectangleF bounds = CBase.Fonts.GetTextBounds(this);
|
RectangleF bounds = CBase.Fonts.GetTextBounds(this);
|
||||||
|
|
||||||
@@ -527,7 +539,7 @@ namespace VocaluxeLib.Menu
|
|||||||
y += step * 0.75f;
|
y += step * 0.75f;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Font.Height = h;
|
_CalculatedFont.Height = h;
|
||||||
bounds = CBase.Fonts.GetTextBounds(this);
|
bounds = CBase.Fonts.GetTextBounds(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,8 +558,6 @@ namespace VocaluxeLib.Menu
|
|||||||
_Rect.Y = y;
|
_Rect.Y = y;
|
||||||
_Rect.W = bounds.Width;
|
_Rect.W = bounds.Width;
|
||||||
_Rect.H = bounds.Height;
|
_Rect.H = bounds.Height;
|
||||||
|
|
||||||
_PositionNeedsUpdate = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FontChanged()
|
public void FontChanged()
|
||||||
|
|||||||
@@ -24,22 +24,50 @@ namespace VocaluxeLib.PartyModes
|
|||||||
public abstract class CPartyMode : IPartyMode
|
public abstract class CPartyMode : IPartyMode
|
||||||
{
|
{
|
||||||
private readonly string _Folder;
|
private readonly string _Folder;
|
||||||
protected SScreenSongOptions _ScreenSongOptions;
|
public int ID { get; private set; }
|
||||||
protected readonly Dictionary<string, CMenuParty> _Screens;
|
protected SScreenSongOptions _ScreenSongOptions = new SScreenSongOptions { Selection = new SSelectionOptions(), Sorting = new SSortingOptions() };
|
||||||
|
protected readonly Dictionary<string, CMenuParty> _Screens = new Dictionary<string, CMenuParty>();
|
||||||
|
|
||||||
protected CPartyMode(string folder)
|
protected CPartyMode(int id,string folder)
|
||||||
{
|
{
|
||||||
_Screens = new Dictionary<string, CMenuParty>();
|
ID = id;
|
||||||
_ScreenSongOptions = new SScreenSongOptions {Selection = new SSelectionOptions(), Sorting = new SSortingOptions()};
|
|
||||||
_Folder = folder;
|
_Folder = folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Implementation
|
#region Implementation
|
||||||
|
|
||||||
public virtual bool Init()
|
public virtual bool Init()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void LoadTheme()
|
||||||
|
{
|
||||||
|
string xmlPath = CBase.Themes.GetThemeScreensPath(ID);
|
||||||
|
foreach (CMenuParty menu in _Screens.Values)
|
||||||
|
{
|
||||||
|
menu.Init();
|
||||||
|
menu.LoadTheme(xmlPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReloadTextures()
|
||||||
|
{
|
||||||
|
foreach (CMenuParty menu in _Screens.Values)
|
||||||
|
{
|
||||||
|
menu.ReloadTextures();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReloadTheme()
|
||||||
|
{
|
||||||
|
string xmlPath = CBase.Themes.GetThemeScreensPath(ID);
|
||||||
|
foreach (CMenuParty menu in _Screens.Values)
|
||||||
|
{
|
||||||
|
menu.ReloadTheme(xmlPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void AddScreen(CMenuParty screen, string screenName)
|
public void AddScreen(CMenuParty screen, string screenName)
|
||||||
{
|
{
|
||||||
_Screens.Add(screenName, screen);
|
_Screens.Add(screenName, screen);
|
||||||
|
|||||||
@@ -22,8 +22,8 @@ namespace VocaluxeLib.PartyModes
|
|||||||
public class CPartyModeNone : CPartyMode
|
public class CPartyModeNone : CPartyMode
|
||||||
{
|
{
|
||||||
//just a dummy for normal game mode
|
//just a dummy for normal game mode
|
||||||
public CPartyModeNone(string folder)
|
public CPartyModeNone(int id, string folder)
|
||||||
: base(folder)
|
: base(id, folder)
|
||||||
{
|
{
|
||||||
_ScreenSongOptions.Selection.RandomOnly = false;
|
_ScreenSongOptions.Selection.RandomOnly = false;
|
||||||
_ScreenSongOptions.Selection.PartyMode = false;
|
_ScreenSongOptions.Selection.PartyMode = false;
|
||||||
|
|||||||
@@ -82,7 +82,13 @@ namespace VocaluxeLib.PartyModes
|
|||||||
|
|
||||||
public interface IPartyMode
|
public interface IPartyMode
|
||||||
{
|
{
|
||||||
|
int ID { get; }
|
||||||
bool Init();
|
bool Init();
|
||||||
|
|
||||||
|
void LoadTheme();
|
||||||
|
void ReloadTextures();
|
||||||
|
void ReloadTheme();
|
||||||
|
|
||||||
void AddScreen(CMenuParty screen, string screenName);
|
void AddScreen(CMenuParty screen, string screenName);
|
||||||
void SaveScreens();
|
void SaveScreens();
|
||||||
void DataFromScreen(string screenName, Object data);
|
void DataFromScreen(string screenName, Object data);
|
||||||
|
|||||||
Reference in new issue
Block a user