name selection converted
This commit is contained in:
1 parent
6f6456171f
commit
cff2865e23
9 files changed
+127
-80
No files matched your search
@@ -12,38 +12,6 @@ using Vocaluxe.Menu.SingNotes;
|
|||||||
|
|
||||||
namespace Vocaluxe.Base
|
namespace Vocaluxe.Base
|
||||||
{
|
{
|
||||||
struct SPlayer
|
|
||||||
{
|
|
||||||
public int ProfileID;
|
|
||||||
public string Name;
|
|
||||||
public EGameDifficulty Difficulty;
|
|
||||||
public double Points;
|
|
||||||
public double PointsLineBonus;
|
|
||||||
public double PointsGoldenNotes;
|
|
||||||
public int NoteDiff;
|
|
||||||
public int LineNr;
|
|
||||||
public List<CLine> SingLine;
|
|
||||||
public int CurrentLine;
|
|
||||||
public int CurrentNote;
|
|
||||||
|
|
||||||
public int SongID;
|
|
||||||
public bool Medley;
|
|
||||||
public bool Duet;
|
|
||||||
public bool ShortSong;
|
|
||||||
public long DateTicks;
|
|
||||||
public bool SongFinished;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SScores
|
|
||||||
{
|
|
||||||
public string Name;
|
|
||||||
public int Score;
|
|
||||||
public string Date;
|
|
||||||
public EGameDifficulty Difficulty;
|
|
||||||
public int LineNr;
|
|
||||||
public int ID;
|
|
||||||
}
|
|
||||||
|
|
||||||
static class CGame
|
static class CGame
|
||||||
{
|
{
|
||||||
private static IGameMode _GameMode;
|
private static IGameMode _GameMode;
|
||||||
|
|||||||
@@ -280,14 +280,16 @@ namespace Vocaluxe.Menu
|
|||||||
for (int i = 0; i < _Screens.Count; i++)
|
for (int i = 0; i < _Screens.Count; i++)
|
||||||
{
|
{
|
||||||
CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
|
CLog.StartBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
|
||||||
_Screens[i].Initialize(CMain.Config, CMain.Settings, CMain.Theme, CMain.Helper, CMain.Log, CMain.BackgroundMusic, CMain.Draw, CMain.Graphics, CMain.Fonts, CMain.Language);
|
_Screens[i].Initialize(CMain.Config, CMain.Settings, CMain.Theme, CMain.Helper, CMain.Log, CMain.BackgroundMusic, CMain.Draw,
|
||||||
|
CMain.Graphics, CMain.Fonts, CMain.Language, CMain.Game, CMain.Profiles);
|
||||||
_Screens[i].LoadTheme();
|
_Screens[i].LoadTheme();
|
||||||
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
|
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < _PopupScreens.Count; i++)
|
for (int i = 0; i < _PopupScreens.Count; i++)
|
||||||
{
|
{
|
||||||
_PopupScreens[i].Initialize(CMain.Config, CMain.Settings, CMain.Theme, CMain.Helper, CMain.Log, CMain.BackgroundMusic, CMain.Draw, CMain.Graphics, CMain.Fonts, CMain.Language);
|
_PopupScreens[i].Initialize(CMain.Config, CMain.Settings, CMain.Theme, CMain.Helper, CMain.Log, CMain.BackgroundMusic, CMain.Draw,
|
||||||
|
CMain.Graphics, CMain.Fonts, CMain.Language, CMain.Game, CMain.Profiles);
|
||||||
_PopupScreens[i].LoadTheme();
|
_PopupScreens[i].LoadTheme();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ namespace Vocaluxe.Base
|
|||||||
public static ILog Log = new BLog();
|
public static ILog Log = new BLog();
|
||||||
public static IFonts Fonts = new BFonts();
|
public static IFonts Fonts = new BFonts();
|
||||||
public static ILanguage Language = new BLanguage();
|
public static ILanguage Language = new BLanguage();
|
||||||
|
public static IGame Game = new BGame();
|
||||||
|
public static IProfiles Profiles = new BProfiles();
|
||||||
}
|
}
|
||||||
|
|
||||||
class BConfig : IConfig
|
class BConfig : IConfig
|
||||||
@@ -131,6 +133,10 @@ namespace Vocaluxe.Base
|
|||||||
return CTheme.GetColor(ColorName, SkinIndex, ref Color);
|
return CTheme.GetColor(ColorName, SkinIndex, ref Color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SColorF GetPlayerColor(int PlayerNr)
|
||||||
|
{
|
||||||
|
return CTheme.GetPlayerColor(PlayerNr);
|
||||||
|
}
|
||||||
|
|
||||||
public void UnloadSkins()
|
public void UnloadSkins()
|
||||||
{
|
{
|
||||||
@@ -312,4 +318,25 @@ namespace Vocaluxe.Base
|
|||||||
return CLanguage.TranslationExists(KeyWord);
|
return CLanguage.TranslationExists(KeyWord);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class BGame : IGame
|
||||||
|
{
|
||||||
|
public int GetNumPlayer()
|
||||||
|
{
|
||||||
|
return CGame.NumPlayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SPlayer[] GetPlayer()
|
||||||
|
{
|
||||||
|
return CGame.Player;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class BProfiles : IProfiles
|
||||||
|
{
|
||||||
|
public SProfile[] GetProfiles()
|
||||||
|
{
|
||||||
|
return CProfiles.Profiles;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -10,29 +10,6 @@ using Vocaluxe.Menu;
|
|||||||
|
|
||||||
namespace Vocaluxe.Base
|
namespace Vocaluxe.Base
|
||||||
{
|
{
|
||||||
struct SProfile
|
|
||||||
{
|
|
||||||
public string PlayerName;
|
|
||||||
public string ProfileFile;
|
|
||||||
|
|
||||||
public EGameDifficulty Difficulty;
|
|
||||||
public SAvatar Avatar;
|
|
||||||
public EOffOn GuestProfile;
|
|
||||||
public EOffOn Active;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct SAvatar
|
|
||||||
{
|
|
||||||
public string FileName;
|
|
||||||
public STexture Texture;
|
|
||||||
|
|
||||||
public SAvatar(int dummy)
|
|
||||||
{
|
|
||||||
FileName = String.Empty;
|
|
||||||
Texture = new STexture(-1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static class CProfiles
|
static class CProfiles
|
||||||
{
|
{
|
||||||
private static XmlWriterSettings _settings = new XmlWriterSettings();
|
private static XmlWriterSettings _settings = new XmlWriterSettings();
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ using System.Text;
|
|||||||
|
|
||||||
using Vocaluxe.Base;
|
using Vocaluxe.Base;
|
||||||
using Vocaluxe.Lib.Song;
|
using Vocaluxe.Lib.Song;
|
||||||
|
using Vocaluxe.Menu;
|
||||||
|
using Vocaluxe.Menu.SongMenu;
|
||||||
|
|
||||||
namespace Vocaluxe.GameModes
|
namespace Vocaluxe.GameModes
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Text;
|
|||||||
|
|
||||||
using Vocaluxe.Base;
|
using Vocaluxe.Base;
|
||||||
using Vocaluxe.Lib.Song;
|
using Vocaluxe.Lib.Song;
|
||||||
|
using Vocaluxe.Menu;
|
||||||
|
|
||||||
namespace Vocaluxe.GameModes
|
namespace Vocaluxe.GameModes
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -96,9 +96,10 @@ namespace Vocaluxe.Menu
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic, IDrawing Draw, IGraphics Graphics, IFonts Fonts, ILanguage Language)
|
public void Initialize(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic, IDrawing Draw,
|
||||||
|
IGraphics Graphics, IFonts Fonts, ILanguage Language, IGame Game, IProfiles Profiles)
|
||||||
{
|
{
|
||||||
_Base = new Base(Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language);
|
_Base = new Base(Config, Settings, Theme, Helper, Log, BackgroundMusic, Draw, Graphics, Fonts, Language, Game, Profiles);
|
||||||
Init();
|
Init();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2329,8 +2330,11 @@ namespace Vocaluxe.Menu
|
|||||||
public IGraphics Graphics;
|
public IGraphics Graphics;
|
||||||
public IFonts Fonts;
|
public IFonts Fonts;
|
||||||
public ILanguage Language;
|
public ILanguage Language;
|
||||||
|
public IGame Game;
|
||||||
|
public IProfiles Profiles;
|
||||||
|
|
||||||
public Base(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic, IDrawing Draw, IGraphics Graphics, IFonts Fonts, ILanguage Language)
|
public Base(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic,
|
||||||
|
IDrawing Draw, IGraphics Graphics, IFonts Fonts, ILanguage Language, IGame Game, IProfiles Profiles)
|
||||||
{
|
{
|
||||||
this.Config = Config;
|
this.Config = Config;
|
||||||
this.Settings = Settings;
|
this.Settings = Settings;
|
||||||
@@ -2342,6 +2346,8 @@ namespace Vocaluxe.Menu
|
|||||||
this.Graphics = Graphics;
|
this.Graphics = Graphics;
|
||||||
this.Fonts = Fonts;
|
this.Fonts = Fonts;
|
||||||
this.Language = Language;
|
this.Language = Language;
|
||||||
|
this.Game = Game;
|
||||||
|
this.Profiles = Profiles;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,9 +6,6 @@ using System.Xml;
|
|||||||
using System.Xml.XPath;
|
using System.Xml.XPath;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using Vocaluxe.Base;
|
|
||||||
using Vocaluxe.Lib.Draw;
|
|
||||||
|
|
||||||
namespace Vocaluxe.Menu
|
namespace Vocaluxe.Menu
|
||||||
{
|
{
|
||||||
struct SThemeNameSelection
|
struct SThemeNameSelection
|
||||||
@@ -125,7 +122,7 @@ namespace Vocaluxe.Menu
|
|||||||
|
|
||||||
if (CHelper.GetValueFromXML(item + "/ColorEmptyTile", navigator, ref _Theme.ColorEmptyTileName, String.Empty))
|
if (CHelper.GetValueFromXML(item + "/ColorEmptyTile", navigator, ref _Theme.ColorEmptyTileName, String.Empty))
|
||||||
{
|
{
|
||||||
_ThemeLoaded &= CTheme.GetColor(_Theme.ColorEmptyTileName, SkinIndex, ref ColorEmptyTile);
|
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.ColorEmptyTileName, SkinIndex, ref ColorEmptyTile);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -149,7 +146,7 @@ namespace Vocaluxe.Menu
|
|||||||
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EStyle>(item + "/Tiles/Name/Style", navigator, ref _Theme.NameStyle);
|
_ThemeLoaded &= CHelper.TryGetEnumValueFromXML<EStyle>(item + "/Tiles/Name/Style", navigator, ref _Theme.NameStyle);
|
||||||
if (CHelper.GetValueFromXML(item + "/Tiles/Name/Color", navigator, ref _Theme.NameColorName, String.Empty))
|
if (CHelper.GetValueFromXML(item + "/Tiles/Name/Color", navigator, ref _Theme.NameColorName, String.Empty))
|
||||||
{
|
{
|
||||||
_ThemeLoaded &= CTheme.GetColor(_Theme.NameColorName, SkinIndex, ref _Theme.NameColor);
|
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.NameColorName, SkinIndex, ref _Theme.NameColor);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -370,7 +367,7 @@ namespace Vocaluxe.Menu
|
|||||||
if (active && Selection != -1)
|
if (active && Selection != -1)
|
||||||
{
|
{
|
||||||
_player = player;
|
_player = player;
|
||||||
PlayerSelector.Color = CTheme.GetPlayerColor(player);
|
PlayerSelector.Color = _Base.Theme.GetPlayerColor(player);
|
||||||
}
|
}
|
||||||
//Normal activation
|
//Normal activation
|
||||||
else if (active)
|
else if (active)
|
||||||
@@ -378,7 +375,7 @@ namespace Vocaluxe.Menu
|
|||||||
Selection = 0;
|
Selection = 0;
|
||||||
_actualSelection = 0;
|
_actualSelection = 0;
|
||||||
_player = player;
|
_player = player;
|
||||||
PlayerSelector.Color = CTheme.GetPlayerColor(player);
|
PlayerSelector.Color = _Base.Theme.GetPlayerColor(player);
|
||||||
PlayerSelector.Visible = true;
|
PlayerSelector.Visible = true;
|
||||||
}
|
}
|
||||||
//Deactivate
|
//Deactivate
|
||||||
@@ -416,9 +413,9 @@ namespace Vocaluxe.Menu
|
|||||||
{
|
{
|
||||||
if ((i + offset * _Tiles.Count) < VisibleProfiles.Count)
|
if ((i + offset * _Tiles.Count) < VisibleProfiles.Count)
|
||||||
{
|
{
|
||||||
_Tiles[i].Avatar.Texture = CProfiles.Profiles[VisibleProfiles[i + offset * _Tiles.Count]].Avatar.Texture;
|
_Tiles[i].Avatar.Texture = _Base.Profiles.GetProfiles()[VisibleProfiles[i + offset * _Tiles.Count]].Avatar.Texture;
|
||||||
_Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1);
|
_Tiles[i].Avatar.Color = new SColorF(1, 1, 1, 1);
|
||||||
_Tiles[i].Name.Text = CProfiles.Profiles[VisibleProfiles[i + offset * _Tiles.Count]].PlayerName;
|
_Tiles[i].Name.Text = _Base.Profiles.GetProfiles()[VisibleProfiles[i + offset * _Tiles.Count]].PlayerName;
|
||||||
_Tiles[i].PlayerNr = VisibleProfiles[i + offset * _Tiles.Count];
|
_Tiles[i].PlayerNr = VisibleProfiles[i + offset * _Tiles.Count];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -478,14 +475,14 @@ namespace Vocaluxe.Menu
|
|||||||
|
|
||||||
public void LoadTextures()
|
public void LoadTextures()
|
||||||
{
|
{
|
||||||
_TextureEmptyTile = CTheme.GetSkinTexture(_Theme.TextureEmptyTileName);
|
_TextureEmptyTile = _Base.Theme.GetSkinTexture(_Theme.TextureEmptyTileName);
|
||||||
_TextureTileSelected = CTheme.GetSkinTexture(_Theme.TextureTileSelectedName);
|
_TextureTileSelected = _Base.Theme.GetSkinTexture(_Theme.TextureTileSelectedName);
|
||||||
|
|
||||||
if (_Theme.ColorEmptyTileName != String.Empty)
|
if (_Theme.ColorEmptyTileName != String.Empty)
|
||||||
ColorEmptyTile = CTheme.GetColor(_Theme.ColorEmptyTileName);
|
ColorEmptyTile = _Base.Theme.GetColor(_Theme.ColorEmptyTileName);
|
||||||
|
|
||||||
if (_Theme.NameColorName != String.Empty)
|
if (_Theme.NameColorName != String.Empty)
|
||||||
_Theme.NameColor = CTheme.GetColor(_Theme.NameColorName);
|
_Theme.NameColor = _Base.Theme.GetColor(_Theme.NameColorName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadTextures()
|
public void ReloadTextures()
|
||||||
@@ -514,18 +511,18 @@ namespace Vocaluxe.Menu
|
|||||||
private void UpdateVisibleProfiles()
|
private void UpdateVisibleProfiles()
|
||||||
{
|
{
|
||||||
VisibleProfiles.Clear();
|
VisibleProfiles.Clear();
|
||||||
for (int i = 0; i < CProfiles.Profiles.Length; i++)
|
for (int i = 0; i < _Base.Profiles.GetProfiles().Length; i++)
|
||||||
{
|
{
|
||||||
bool visible = false;
|
bool visible = false;
|
||||||
//Show profile only if active
|
//Show profile only if active
|
||||||
if (CProfiles.Profiles[i].Active == EOffOn.TR_CONFIG_ON)
|
if (_Base.Profiles.GetProfiles()[i].Active == EOffOn.TR_CONFIG_ON)
|
||||||
{
|
{
|
||||||
visible = true;
|
visible = true;
|
||||||
}
|
}
|
||||||
for (int p = 0; p < CGame.NumPlayer; p++)
|
for (int p = 0; p < _Base.Game.GetNumPlayer(); p++)
|
||||||
{
|
{
|
||||||
//Don't show profile if is selected, but if selected and guest
|
//Don't show profile if is selected, but if selected and guest
|
||||||
if (CGame.Player[p].ProfileID == i && CProfiles.Profiles[i].GuestProfile == EOffOn.TR_CONFIG_OFF)
|
if (_Base.Game.GetPlayer()[p].ProfileID == i && _Base.Profiles.GetProfiles()[i].GuestProfile == EOffOn.TR_CONFIG_OFF)
|
||||||
{
|
{
|
||||||
visible = false;
|
visible = false;
|
||||||
}
|
}
|
||||||
|
|||||||
+70
-3
@@ -4,14 +4,14 @@ using System.Drawing;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
using Vocaluxe.Base;
|
using Vocaluxe.Menu.SingNotes;
|
||||||
using Vocaluxe.Lib.Draw;
|
|
||||||
|
|
||||||
namespace Vocaluxe.Menu
|
namespace Vocaluxe.Menu
|
||||||
{
|
{
|
||||||
interface IMenu
|
interface IMenu
|
||||||
{
|
{
|
||||||
void Initialize(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic, IDrawing Draw, IGraphics Graphics, IFonts Fonts, ILanguage Language);
|
void Initialize(IConfig Config, ISettings Settings, ITheme Theme, IHelper Helper, ILog Log, IBackgroundMusic BackgroundMusic, IDrawing Draw,
|
||||||
|
IGraphics Graphics, IFonts Fonts, ILanguage Language, IGame Game, IProfiles Profiles);
|
||||||
|
|
||||||
void LoadTheme();
|
void LoadTheme();
|
||||||
void SaveTheme();
|
void SaveTheme();
|
||||||
@@ -78,6 +78,7 @@ namespace Vocaluxe.Menu
|
|||||||
|
|
||||||
SColorF GetColor(string ColorName);
|
SColorF GetColor(string ColorName);
|
||||||
bool GetColor(string ColorName, int SkinIndex, ref SColorF Color);
|
bool GetColor(string ColorName, int SkinIndex, ref SColorF Color);
|
||||||
|
SColorF GetPlayerColor(int PlayerNr);
|
||||||
|
|
||||||
void UnloadSkins();
|
void UnloadSkins();
|
||||||
void ListSkins();
|
void ListSkins();
|
||||||
@@ -147,6 +148,17 @@ namespace Vocaluxe.Menu
|
|||||||
bool TranslationExists(string KeyWord);
|
bool TranslationExists(string KeyWord);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface IGame
|
||||||
|
{
|
||||||
|
int GetNumPlayer();
|
||||||
|
SPlayer[] GetPlayer();
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface IProfiles
|
||||||
|
{
|
||||||
|
SProfile[] GetProfiles();
|
||||||
|
}
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum EModifier
|
public enum EModifier
|
||||||
{
|
{
|
||||||
@@ -593,4 +605,59 @@ namespace Vocaluxe.Menu
|
|||||||
Golden,
|
Golden,
|
||||||
Freestyle
|
Freestyle
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public struct SProfile
|
||||||
|
{
|
||||||
|
public string PlayerName;
|
||||||
|
public string ProfileFile;
|
||||||
|
|
||||||
|
public EGameDifficulty Difficulty;
|
||||||
|
public SAvatar Avatar;
|
||||||
|
public EOffOn GuestProfile;
|
||||||
|
public EOffOn Active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct SAvatar
|
||||||
|
{
|
||||||
|
public string FileName;
|
||||||
|
public STexture Texture;
|
||||||
|
|
||||||
|
public SAvatar(int dummy)
|
||||||
|
{
|
||||||
|
FileName = String.Empty;
|
||||||
|
Texture = new STexture(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct SPlayer
|
||||||
|
{
|
||||||
|
public int ProfileID;
|
||||||
|
public string Name;
|
||||||
|
public EGameDifficulty Difficulty;
|
||||||
|
public double Points;
|
||||||
|
public double PointsLineBonus;
|
||||||
|
public double PointsGoldenNotes;
|
||||||
|
public int NoteDiff;
|
||||||
|
public int LineNr;
|
||||||
|
public List<CLine> SingLine;
|
||||||
|
public int CurrentLine;
|
||||||
|
public int CurrentNote;
|
||||||
|
|
||||||
|
public int SongID;
|
||||||
|
public bool Medley;
|
||||||
|
public bool Duet;
|
||||||
|
public bool ShortSong;
|
||||||
|
public long DateTicks;
|
||||||
|
public bool SongFinished;
|
||||||
|
}
|
||||||
|
|
||||||
|
public struct SScores
|
||||||
|
{
|
||||||
|
public string Name;
|
||||||
|
public int Score;
|
||||||
|
public string Date;
|
||||||
|
public EGameDifficulty Difficulty;
|
||||||
|
public int LineNr;
|
||||||
|
public int ID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user