Fix some resharper warnings and errors
This commit is contained in:
1 parent
167202e8ff
commit
cd59b82b7b
35 files changed
+82
-174
No files matched your search
@@ -27,9 +27,11 @@ namespace VocaluxeLib
|
||||
|
||||
public struct SThemeFont
|
||||
{
|
||||
// ReSharper disable UnassignedField.Global
|
||||
public string Name;
|
||||
public EStyle Style;
|
||||
public float Size;
|
||||
// ReSharper restore UnassignedField.Global
|
||||
}
|
||||
|
||||
public class CFont
|
||||
|
||||
@@ -84,7 +84,6 @@ namespace VocaluxeLib.Menu
|
||||
_PartyModeID = partyModeID;
|
||||
|
||||
ThemeLoaded = true;
|
||||
LoadSkin();
|
||||
}
|
||||
#endregion Constructors
|
||||
|
||||
|
||||
@@ -122,7 +122,6 @@ namespace VocaluxeLib.Menu
|
||||
EditMode = false;
|
||||
|
||||
ThemeLoaded = true;
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
public CButton(CButton button)
|
||||
|
||||
@@ -95,7 +95,6 @@ namespace VocaluxeLib.Menu
|
||||
_Theme = theme;
|
||||
|
||||
ThemeLoaded = true;
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace VocaluxeLib.Menu
|
||||
ParticleEffect
|
||||
}
|
||||
|
||||
class CInteraction
|
||||
public class CInteraction
|
||||
{
|
||||
public readonly int Num;
|
||||
public readonly EType Type;
|
||||
|
||||
@@ -103,7 +103,6 @@ namespace VocaluxeLib.Menu
|
||||
LyricStyle = ELyricStyle.Fill;
|
||||
|
||||
ThemeLoaded = true;
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
|
||||
+20
-83
@@ -201,13 +201,27 @@ namespace VocaluxeLib.Menu
|
||||
_AddSingNote(new CSingNotes(sb, PartyModeID), sb.Name);
|
||||
|
||||
foreach (SThemeSongMenu sm in Theme.SongMenus)
|
||||
_AddSongMenu(CSongMenuFactory.GetSongMenu(sm, PartyModeID), sm.Name);
|
||||
_AddSongMenu(CSongMenuFactory.CreateSongMenu(sm, PartyModeID), sm.Name);
|
||||
|
||||
foreach (SThemeStatic st in Theme.Statics)
|
||||
_AddStatic(new CStatic(st, PartyModeID), st.Name);
|
||||
|
||||
foreach (SThemeText te in Theme.Texts)
|
||||
_AddText(new CText(te, PartyModeID), te.Name);
|
||||
|
||||
if (_ScreenVersion != Theme.Informations.ScreenVersion)
|
||||
{
|
||||
string msg = "Can't load screen file of screen \"" + ThemeName + "\", ";
|
||||
if (Theme.Informations.ScreenVersion < _ScreenVersion)
|
||||
msg += "the file ist outdated! ";
|
||||
else
|
||||
msg += "the file is for newer program versions! ";
|
||||
|
||||
msg += "Current screen version is " + _ScreenVersion;
|
||||
CBase.Log.LogError(msg);
|
||||
}
|
||||
foreach (IThemeable el in _Elements.Select(_GetElement).OfType<IThemeable>())
|
||||
el.LoadSkin();
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
@@ -217,17 +231,6 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
CBase.Log.LogError(e.Message + e.StackTrace, true, true);
|
||||
}
|
||||
if (_ScreenVersion != Theme.Informations.ScreenVersion)
|
||||
{
|
||||
string msg = "Can't load screen file of screen \"" + ThemeName + "\", ";
|
||||
if (Theme.Informations.ScreenVersion < _ScreenVersion)
|
||||
msg += "the file ist outdated! ";
|
||||
else
|
||||
msg += "the file is for newer program versions! ";
|
||||
|
||||
msg += "Current screen version is " + _ScreenVersion;
|
||||
CBase.Log.LogError(msg);
|
||||
}
|
||||
}
|
||||
|
||||
private void _AddScreenSetting(CScreenSetting screenSetting, string name)
|
||||
@@ -257,7 +260,7 @@ namespace VocaluxeLib.Menu
|
||||
_LoadThemeElement<CSelectSlide>(_ThemeSelectSlides, _AddSelectSlide, xmlReader);
|
||||
foreach (string elName in _ThemeSongMenus)
|
||||
{
|
||||
ISongMenu element = CSongMenuFactory.GetSongMenu(PartyModeID);
|
||||
ISongMenu element = CSongMenuFactory.CreateSongMenu(PartyModeID);
|
||||
if (element.LoadTheme("//root/" + ThemeName, elName, xmlReader))
|
||||
_AddSongMenu(element, elName);
|
||||
else
|
||||
@@ -338,80 +341,14 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
public virtual void ReloadSkin()
|
||||
{
|
||||
foreach (CBackground background in _Backgrounds)
|
||||
background.ReloadSkin();
|
||||
|
||||
foreach (CButton button in _Buttons)
|
||||
button.ReloadSkin();
|
||||
|
||||
foreach (CText text in _Texts)
|
||||
text.ReloadSkin();
|
||||
|
||||
foreach (CStatic stat in _Statics)
|
||||
stat.ReloadSkin();
|
||||
|
||||
foreach (CSelectSlide slide in _SelectSlides)
|
||||
slide.ReloadSkin();
|
||||
|
||||
foreach (CSongMenuFramework sm in _SongMenus)
|
||||
sm.ReloadSkin();
|
||||
|
||||
foreach (CLyric lyric in _Lyrics)
|
||||
lyric.ReloadSkin();
|
||||
|
||||
foreach (CSingNotes sn in _SingNotes)
|
||||
sn.ReloadSkin();
|
||||
|
||||
foreach (CNameSelection ns in _NameSelections)
|
||||
ns.ReloadSkin();
|
||||
|
||||
foreach (CEqualizer eq in _Equalizers)
|
||||
eq.ReloadSkin();
|
||||
|
||||
foreach (CPlaylist pls in _Playlists)
|
||||
pls.ReloadSkin();
|
||||
|
||||
foreach (CParticleEffect pe in _ParticleEffects)
|
||||
pe.ReloadSkin();
|
||||
foreach (IThemeable el in _Elements.Select(_GetElement).OfType<IThemeable>())
|
||||
el.ReloadSkin();
|
||||
}
|
||||
|
||||
public virtual void UnloadSkin()
|
||||
{
|
||||
foreach (CBackground background in _Backgrounds)
|
||||
background.UnloadSkin();
|
||||
|
||||
foreach (CButton button in _Buttons)
|
||||
button.UnloadSkin();
|
||||
|
||||
foreach (CText text in _Texts)
|
||||
text.UnloadSkin();
|
||||
|
||||
foreach (CStatic stat in _Statics)
|
||||
stat.UnloadSkin();
|
||||
|
||||
foreach (CSelectSlide slide in _SelectSlides)
|
||||
slide.UnloadSkin();
|
||||
|
||||
foreach (CSongMenuFramework sm in _SongMenus)
|
||||
sm.UnloadSkin();
|
||||
|
||||
foreach (CLyric lyric in _Lyrics)
|
||||
lyric.UnloadSkin();
|
||||
|
||||
foreach (CSingNotes sn in _SingNotes)
|
||||
sn.UnloadSkin();
|
||||
|
||||
foreach (CNameSelection ns in _NameSelections)
|
||||
ns.UnloadSkin();
|
||||
|
||||
foreach (CPlaylist pls in _Playlists)
|
||||
pls.UnloadSkin();
|
||||
|
||||
foreach (CEqualizer eq in _Equalizers)
|
||||
eq.UnloadSkin();
|
||||
|
||||
foreach (CParticleEffect pe in _ParticleEffects)
|
||||
pe.UnloadSkin();
|
||||
foreach (IThemeable el in _Elements.Select(_GetElement).OfType<IThemeable>())
|
||||
el.UnloadSkin();
|
||||
}
|
||||
|
||||
public virtual void ReloadTheme(string xmlPath)
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
// along with Vocaluxe. If not, see <http://www.gnu.org/licenses/>.
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using VocaluxeLib.PartyModes;
|
||||
|
||||
namespace VocaluxeLib.Menu
|
||||
|
||||
@@ -136,7 +136,6 @@ namespace VocaluxeLib.Menu
|
||||
_UsedProfiles = new List<int>();
|
||||
|
||||
ThemeLoaded = true;
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
public void Init()
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace VocaluxeLib.Menu
|
||||
{
|
||||
public abstract class CObjectInteractions
|
||||
{
|
||||
private readonly List<CInteraction> _Elements = new List<CInteraction>();
|
||||
protected readonly List<CInteraction> _Elements = new List<CInteraction>();
|
||||
private int _Selection;
|
||||
|
||||
private Point _PrevMouse;
|
||||
@@ -245,7 +245,7 @@ namespace VocaluxeLib.Menu
|
||||
return _Selection >= 0 && _Selection < _Elements.Count;
|
||||
}
|
||||
|
||||
private IMenuElement _GetElement(CInteraction element)
|
||||
protected IMenuElement _GetElement(CInteraction element)
|
||||
{
|
||||
switch (element.Type)
|
||||
{
|
||||
|
||||
@@ -125,7 +125,6 @@ namespace VocaluxeLib.Menu
|
||||
Visible = true;
|
||||
|
||||
ThemeLoaded = true;
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
|
||||
@@ -253,14 +253,6 @@ namespace VocaluxeLib.Menu
|
||||
_ButtonPlaylistSing = new CButton(_Theme.ButtonPlaylistSing, _PartyModeID);
|
||||
_SelectSlideGameMode = new CSelectSlide(_Theme.SelectSlideGameMode, _PartyModeID);
|
||||
|
||||
Visible = false;
|
||||
Selected = false;
|
||||
ThemeLoaded = true;
|
||||
}
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
base.Init();
|
||||
_AddStatic(_StaticPlaylistFooter);
|
||||
_AddStatic(_StaticPlaylistHeader);
|
||||
_AddButton(_ButtonPlaylistName);
|
||||
@@ -268,7 +260,10 @@ namespace VocaluxeLib.Menu
|
||||
_AddButton(_ButtonPlaylistDelete);
|
||||
_AddButton(_ButtonPlaylistSave);
|
||||
_AddButton(_ButtonPlaylistSing);
|
||||
LoadSkin();
|
||||
|
||||
Visible = false;
|
||||
Selected = false;
|
||||
ThemeLoaded = true;
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
@@ -886,11 +881,13 @@ namespace VocaluxeLib.Menu
|
||||
if (_ChangeOrderSource >= _PlaylistElementContents.Count)
|
||||
return true;
|
||||
|
||||
_ChangeOrderElement = new CPlaylistElement(_PlaylistElements[_CurrentPlaylistElement]);
|
||||
_ChangeOrderElement.Background.Z = CBase.Settings.GetZNear();
|
||||
_ChangeOrderElement.Cover.Z = CBase.Settings.GetZNear();
|
||||
_ChangeOrderElement.SelectSlide.Z = CBase.Settings.GetZNear();
|
||||
_ChangeOrderElement.Text1.Z = CBase.Settings.GetZNear();
|
||||
_ChangeOrderElement = new CPlaylistElement(_PlaylistElements[_CurrentPlaylistElement])
|
||||
{
|
||||
Background = {Z = CBase.Settings.GetZNear()},
|
||||
Cover = {Z = CBase.Settings.GetZNear()},
|
||||
SelectSlide = {Z = CBase.Settings.GetZNear()},
|
||||
Text1 = {Z = CBase.Settings.GetZNear()}
|
||||
};
|
||||
|
||||
_ChangeOrderElement.Background.Texture = CBase.Themes.GetSkinTexture(_Theme.SkinBackground, _PartyModeID);
|
||||
_ChangeOrderElement.Background.Color = _BackgroundColor;
|
||||
|
||||
@@ -264,7 +264,6 @@ namespace VocaluxeLib.Menu
|
||||
_ValuePartyModeIDs = new List<int>();
|
||||
|
||||
ThemeLoaded = true;
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
|
||||
@@ -111,8 +111,6 @@ namespace VocaluxeLib.Menu
|
||||
_PartyModeID = partyModeID;
|
||||
_Theme = theme;
|
||||
ThemeLoaded = true;
|
||||
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
|
||||
@@ -292,7 +292,6 @@ namespace VocaluxeLib.Menu
|
||||
_ButtonText = buttonText;
|
||||
|
||||
ThemeLoaded = true;
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
public bool LoadTheme(string xmlPath, string elementName, CXmlReader xmlReader)
|
||||
|
||||
@@ -84,7 +84,6 @@ namespace VocaluxeLib.Menu.SingNotes
|
||||
_BarPos = new SRectF[CBase.Settings.GetMaxNumPlayer(),CBase.Settings.GetMaxNumPlayer()];
|
||||
|
||||
ThemeLoaded = true;
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
public string GetThemeName()
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
{
|
||||
public static class CSongMenuFactory
|
||||
{
|
||||
public static ISongMenu GetSongMenu(SThemeSongMenu theme, int partyModeID)
|
||||
public static ISongMenu CreateSongMenu(SThemeSongMenu theme, int partyModeID)
|
||||
{
|
||||
switch (CBase.Config.GetSongMenuType())
|
||||
{
|
||||
@@ -47,7 +47,7 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
/// </summary>
|
||||
/// <param name="partyModeID"></param>
|
||||
/// <returns></returns>
|
||||
public static ISongMenu GetSongMenu(int partyModeID)
|
||||
public static ISongMenu CreateSongMenu(int partyModeID)
|
||||
{
|
||||
switch (CBase.Config.GetSongMenuType())
|
||||
{
|
||||
|
||||
@@ -157,7 +157,6 @@ namespace VocaluxeLib.Menu.SongMenu
|
||||
_Theme = theme;
|
||||
|
||||
ThemeLoaded = true;
|
||||
LoadSkin();
|
||||
}
|
||||
|
||||
#region Theme
|
||||
|
||||
@@ -416,7 +416,9 @@ namespace VocaluxeLib.Songs
|
||||
{
|
||||
//PreviewStart is not set or <=0
|
||||
_Song.Preview.StartTime = (headerFlags & EHeaderFlags.MedleyStartBeat) != 0 ? CBase.Game.GetTimeFromBeats(_Song.Medley.StartBeat, _Song.BPM) : 0f;
|
||||
// ReSharper disable CompareOfFloatsByEqualityOperator
|
||||
_Song.Preview.Source = _Song.Preview.StartTime == 0 ? EDataSource.None : EDataSource.Calculated;
|
||||
// ReSharper restore CompareOfFloatsByEqualityOperator
|
||||
}
|
||||
|
||||
if ((headerFlags & EHeaderFlags.MedleyStartBeat) != 0 && (headerFlags & EHeaderFlags.MedleyEndBeat) != 0)
|
||||
|
||||
Reference in new issue
Block a user