name selection converted

This commit is contained in:
Alexander Eckart committed 2012-12-13 22:39:45 +01:00
1 parent 6f6456171f
commit cff2865e23
9 files changed
+128 -81

No files matched your search

-32
View File
@@ -12,38 +12,6 @@ using Vocaluxe.Menu.SingNotes;
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
{
private static IGameMode _GameMode;
+4 -2
View File
@@ -280,14 +280,16 @@ namespace Vocaluxe.Menu
for (int i = 0; i < _Screens.Count; 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();
CLog.StopBenchmark(1, "Load Theme " + Enum.GetNames(typeof(EScreens))[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();
}
}
+27
View File
@@ -19,6 +19,8 @@ namespace Vocaluxe.Base
public static ILog Log = new BLog();
public static IFonts Fonts = new BFonts();
public static ILanguage Language = new BLanguage();
public static IGame Game = new BGame();
public static IProfiles Profiles = new BProfiles();
}
class BConfig : IConfig
@@ -131,6 +133,10 @@ namespace Vocaluxe.Base
return CTheme.GetColor(ColorName, SkinIndex, ref Color);
}
public SColorF GetPlayerColor(int PlayerNr)
{
return CTheme.GetPlayerColor(PlayerNr);
}
public void UnloadSkins()
{
@@ -312,4 +318,25 @@ namespace Vocaluxe.Base
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;
}
}
}
+1 -24
View File
@@ -9,30 +9,7 @@ using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu;
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
{
private static XmlWriterSettings _settings = new XmlWriterSettings();
+2
View File
@@ -4,6 +4,8 @@ using System.Text;
using Vocaluxe.Base;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu;
using Vocaluxe.Menu.SongMenu;
namespace Vocaluxe.GameModes
{
+1
View File
@@ -4,6 +4,7 @@ using System.Text;
using Vocaluxe.Base;
using Vocaluxe.Lib.Song;
using Vocaluxe.Menu;
namespace Vocaluxe.GameModes
{
+9 -3
View File
@@ -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();
}
@@ -2329,8 +2330,11 @@ namespace Vocaluxe.Menu
public IGraphics Graphics;
public IFonts Fonts;
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.Settings = Settings;
@@ -2342,6 +2346,8 @@ namespace Vocaluxe.Menu
this.Graphics = Graphics;
this.Fonts = Fonts;
this.Language = Language;
this.Game = Game;
this.Profiles = Profiles;
}
}
}
+14 -17
View File
@@ -6,9 +6,6 @@ using System.Xml;
using System.Xml.XPath;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
namespace Vocaluxe.Menu
{
struct SThemeNameSelection
@@ -125,7 +122,7 @@ namespace Vocaluxe.Menu
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
{
@@ -149,7 +146,7 @@ namespace Vocaluxe.Menu
_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))
{
_ThemeLoaded &= CTheme.GetColor(_Theme.NameColorName, SkinIndex, ref _Theme.NameColor);
_ThemeLoaded &= _Base.Theme.GetColor(_Theme.NameColorName, SkinIndex, ref _Theme.NameColor);
}
else
{
@@ -370,7 +367,7 @@ namespace Vocaluxe.Menu
if (active && Selection != -1)
{
_player = player;
PlayerSelector.Color = CTheme.GetPlayerColor(player);
PlayerSelector.Color = _Base.Theme.GetPlayerColor(player);
}
//Normal activation
else if (active)
@@ -378,7 +375,7 @@ namespace Vocaluxe.Menu
Selection = 0;
_actualSelection = 0;
_player = player;
PlayerSelector.Color = CTheme.GetPlayerColor(player);
PlayerSelector.Color = _Base.Theme.GetPlayerColor(player);
PlayerSelector.Visible = true;
}
//Deactivate
@@ -416,9 +413,9 @@ namespace Vocaluxe.Menu
{
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].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];
}
else
@@ -478,14 +475,14 @@ namespace Vocaluxe.Menu
public void LoadTextures()
{
_TextureEmptyTile = CTheme.GetSkinTexture(_Theme.TextureEmptyTileName);
_TextureTileSelected = CTheme.GetSkinTexture(_Theme.TextureTileSelectedName);
_TextureEmptyTile = _Base.Theme.GetSkinTexture(_Theme.TextureEmptyTileName);
_TextureTileSelected = _Base.Theme.GetSkinTexture(_Theme.TextureTileSelectedName);
if (_Theme.ColorEmptyTileName != String.Empty)
ColorEmptyTile = CTheme.GetColor(_Theme.ColorEmptyTileName);
ColorEmptyTile = _Base.Theme.GetColor(_Theme.ColorEmptyTileName);
if (_Theme.NameColorName != String.Empty)
_Theme.NameColor = CTheme.GetColor(_Theme.NameColorName);
_Theme.NameColor = _Base.Theme.GetColor(_Theme.NameColorName);
}
public void ReloadTextures()
@@ -514,18 +511,18 @@ namespace Vocaluxe.Menu
private void UpdateVisibleProfiles()
{
VisibleProfiles.Clear();
for (int i = 0; i < CProfiles.Profiles.Length; i++)
for (int i = 0; i < _Base.Profiles.GetProfiles().Length; i++)
{
bool visible = false;
//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;
}
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
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;
}
+70 -3
View File
@@ -4,14 +4,14 @@ using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Vocaluxe.Base;
using Vocaluxe.Lib.Draw;
using Vocaluxe.Menu.SingNotes;
namespace Vocaluxe.Menu
{
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 SaveTheme();
@@ -78,6 +78,7 @@ namespace Vocaluxe.Menu
SColorF GetColor(string ColorName);
bool GetColor(string ColorName, int SkinIndex, ref SColorF Color);
SColorF GetPlayerColor(int PlayerNr);
void UnloadSkins();
void ListSkins();
@@ -147,6 +148,17 @@ namespace Vocaluxe.Menu
bool TranslationExists(string KeyWord);
}
public interface IGame
{
int GetNumPlayer();
SPlayer[] GetPlayer();
}
public interface IProfiles
{
SProfile[] GetProfiles();
}
[Flags]
public enum EModifier
{
@@ -593,4 +605,59 @@ namespace Vocaluxe.Menu
Golden,
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;
}
}