CTheme and CText changes

This commit is contained in:
Flamefire committed 2013-03-19 23:01:04 +01:00
1 parent 6380c739aa
commit 7469e86617
16 files changed
+96 -162

No files matched your search

@@ -1,5 +1,13 @@
ScreenSong
++++++++++
Version 5:
Add:
<ButtonOptionsOpenSelectedItem>
Remove:
ButtonOptionsOpenPlaylist
++++++++++
Version 4:
+2 -2
View File
@@ -247,9 +247,9 @@ namespace Vocaluxe.Base
return CTheme.GetColor(ColorName, PartyModeID);
}
public bool GetColor(string ColorName, int SkinIndex, ref SColorF Color)
public bool GetColor(string ColorName, int SkinIndex, out SColorF Color)
{
return CTheme.GetColor(ColorName, SkinIndex, ref Color);
return CTheme.GetColor(ColorName, SkinIndex, out Color);
}
public SColorF GetPlayerColor(int PlayerNr)
+8 -28
View File
@@ -855,25 +855,15 @@ namespace Vocaluxe.Base
#region Color Handling
public static SColorF GetColor(string ColorName, int PartyModeID)
{
SColorF color = new SColorF(1f, 1f, 1f, 1f);
SColorF color;
int SkinIndex = GetSkinIndex(PartyModeID);
foreach (SColorScheme scheme in _Skins[SkinIndex].ThemeColors.ColorSchemes)
{
if (scheme.Name == ColorName)
{
color.R = scheme.Color.R;
color.G = scheme.Color.G;
color.B = scheme.Color.B;
color.A = scheme.Color.A;
return color;
}
}
return GetPlayerColor(ColorName);
GetColor(ColorName, SkinIndex, out color);
return color;
}
public static bool GetColor(string ColorName, int SkinIndex, ref SColorF Color)
public static bool GetColor(string ColorName, int SkinIndex, out SColorF Color)
{
foreach (SColorScheme scheme in _Skins[SkinIndex].ThemeColors.ColorSchemes)
{
@@ -885,7 +875,7 @@ namespace Vocaluxe.Base
}
bool success;
GetPlayerColor(ColorName, GetSkinIndex(-1), out success);
Color = GetPlayerColor(ColorName, GetSkinIndex(-1), out success);
return success;
}
@@ -909,19 +899,9 @@ namespace Vocaluxe.Base
public static SColorF GetPlayerColor(string PlayerNrString, int SkinIndex, out bool success)
{
SColorF color = new SColorF(1f, 1f, 1f, 1f);
if (_Skins[SkinIndex].PartyModeID != -1)
SkinIndex = GetSkinIndex(-1);
int selection = -1;
for (int i = 0; i < _Skins[SkinIndex].ThemeColors.Player.Length; i++)
{
if (PlayerNrString == "Player" + (i + 1).ToString())
{
selection = i + 1;
break;
}
}
int selection = 0;
if (PlayerNrString.StartsWith("Player"))
int.TryParse(PlayerNrString.Substring(6), out selection);
return GetPlayerColor(selection, SkinIndex, out success);
}
+1 -1
View File
@@ -60,7 +60,7 @@ namespace Vocaluxe.Screens
private string _SearchText = String.Empty;
private bool _SearchActive = false;
private List<string> ButtonsJoker = new List<string>();
private readonly List<string> ButtonsJoker = new List<string>();
private List<string> TextsPlayer = new List<string>();
private bool _SongOptionsActive = false;
private bool _PlaylistActive = false;
+1 -1
View File
@@ -65,7 +65,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
+2 -2
View File
@@ -147,7 +147,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
@@ -159,7 +159,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, ref SColor);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out SColor);
}
else
{
+2 -2
View File
@@ -93,7 +93,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
@@ -105,7 +105,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/MaxColor", ref _Theme.MaxColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
+2 -2
View File
@@ -118,7 +118,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
@@ -130,7 +130,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, ref ColorProcessed);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out ColorProcessed);
}
else
{
+2 -2
View File
@@ -119,7 +119,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/ColorEmptyTile", ref _Theme.ColorEmptyTileName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, SkinIndex, ref ColorEmptyTile);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorEmptyTileName, SkinIndex, out ColorEmptyTile);
}
else
{
@@ -143,7 +143,7 @@ namespace Vocaluxe.Menu
_ThemeLoaded &= xmlReader.TryGetEnumValue<EStyle>(item + "/Tiles/Name/Style", ref _Theme.NameStyle);
if (xmlReader.GetValue(item + "/Tiles/Name/Color", ref _Theme.NameColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, SkinIndex, ref _Theme.NameColor);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.NameColorName, SkinIndex, out _Theme.NameColor);
}
else
{
+1 -1
View File
@@ -388,7 +388,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
+2 -2
View File
@@ -245,7 +245,7 @@ namespace Vocaluxe.Menu
_ThemeLoaded &= xmlReader.TryGetFloatValue(item + "/H", ref Rect.H);
if (xmlReader.GetValue(item + "/ColorBackground", ref _Theme.ColorBackgroundName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, SkinIndex, ref BackgroundColor);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorBackgroundName, SkinIndex, out BackgroundColor);
}
else
{
@@ -256,7 +256,7 @@ namespace Vocaluxe.Menu
}
if (xmlReader.GetValue(item + "/SColorBackground", ref _Theme.SColorBackgroundName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorBackgroundName, SkinIndex, ref BackgroundSColor);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorBackgroundName, SkinIndex, out BackgroundSColor);
}
else
{
+8 -10
View File
@@ -254,7 +254,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
@@ -266,7 +266,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, ref SColor);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out SColor);
}
else
{
@@ -278,7 +278,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/HColor", ref _Theme.HColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.HColorName, SkinIndex, ref HColor);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.HColorName, SkinIndex, out HColor);
}
else
{
@@ -302,7 +302,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/ArrowColor", ref _Theme.ArrowColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, SkinIndex, ref ColorArrow);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ArrowColorName, SkinIndex, out ColorArrow);
}
else
{
@@ -314,7 +314,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/ArrowSColor", ref _Theme.SArrowColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SArrowColorName, SkinIndex, ref SColorArrow);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SArrowColorName, SkinIndex, out SColorArrow);
}
else
{
@@ -326,7 +326,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/TextColor", ref _Theme.TextColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, SkinIndex, ref TextColor);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.TextColorName, SkinIndex, out TextColor);
}
else
{
@@ -338,7 +338,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/TextSColor", ref _Theme.STextColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.STextColorName, SkinIndex, ref STextColor);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.STextColorName, SkinIndex, out STextColor);
}
else
{
@@ -780,9 +780,7 @@ namespace Vocaluxe.Menu
_ValueBounds.Clear();
for (int i = 0; i < numvis; i++)
{
CText Text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, String.Empty);
Text.PartyModeID = _ValuePartyModeIDs[i + offset];
Text.Text = _ValueNames[i + offset];
CText Text = new CText(0, 0, 0, TextH, MaxW, EAlignment.Center, _Theme.TextStyle, _Theme.TextFont, TextColor, _ValueNames[i + offset], _ValuePartyModeIDs[i + offset]);
SColorF Alpha = new SColorF(1f, 1f, 1f, 0.35f);
if (i + offset == _Selection)
+1 -1
View File
@@ -141,7 +141,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
+54 -106
View File
@@ -36,16 +36,16 @@ namespace Vocaluxe.Menu
public class CText : IMenuElement
{
private SThemeText _Theme;
private bool _ThemeLoaded;
private int _PartyModeID;
private int _TranslationID;
private bool _ThemeLoaded=false;
private int _PartyModeID=-1;
private int _TranslationID=-1;
public string GetThemeName()
{
return _Theme.Name;
}
private bool _ButtonText;
private bool _ButtonText=false;
private bool _PositionNeedsUpdate = true;
private STextPosition _DrawPosition = new STextPosition(0);
@@ -82,14 +82,7 @@ namespace Vocaluxe.Menu
public float Z
{
get { return _Z; }
set
{
if (_Z != value)
{
_Z = value;
_PositionNeedsUpdate = true;
}
}
set { _Z = value; }
}
private float _Height = 0f;
@@ -198,7 +191,7 @@ namespace Vocaluxe.Menu
public SColorF Color; //normal Color
public SColorF SColor; //selected Color for Buttons
public bool Reflection;
public bool Reflection=false;
public float ReflectionSpace;
public float ReflectionHeight;
@@ -221,13 +214,6 @@ namespace Vocaluxe.Menu
public int PartyModeID
{
get { return _PartyModeID; }
set
{
_Text = CBase.Language.Translate(_Text, value);
_PositionNeedsUpdate = true;
_PartyModeID = value;
_TranslationID = value;
}
}
public int TranslationID
@@ -235,67 +221,56 @@ namespace Vocaluxe.Menu
get { return _TranslationID; }
set
{
_Text = CBase.Language.Translate(_Text, value);
_PositionNeedsUpdate = true;
_TranslationID = value;
if (_TranslationID != value)
{
_Text = CBase.Language.Translate(_Text, value);
_TranslationID = value;
_PositionNeedsUpdate = true;
}
}
}
public bool Selected;
public bool Selected=false;
public bool Visible = true;
public bool EditMode = false;
private bool _EditMode = false;
public bool EditMode
{
get { return _EditMode; }
set
{
if (_EditMode != value)
{
_Text = (value) ? _Text + "|" : _Text.Substring(0, _Text.Length - 1);
_EditMode = value;
_PositionNeedsUpdate = true;
}
}
}
public float Alpha = 1f;
public CText(int PartyModeID)
{
_Theme = new SThemeText();
_ThemeLoaded = false;
_ButtonText = false;
_PartyModeID = PartyModeID;
_TranslationID = _PartyModeID;
X = 0f;
Y = 0f;
Z = 0f;
Height = 1f;
MaxWidth = 0f;
Bounds = new SRectF();
Align = EAlignment.Left;
HAlign = EHAlignment.Center;
Style = EStyle.Normal;
Font = "Normal";
Color = new SColorF();
SColor = new SColorF();
Reflection = false;
ReflectionSpace = 0f;
ReflectionHeight = 0f;
Text = String.Empty;
Selected = false;
Visible = true;
Alpha = 1f;
_Font = "Normal";
}
public CText(CText text)
{
_Theme = new SThemeText();
_ThemeLoaded = false;
_ButtonText = false;
_PartyModeID = text._PartyModeID;
_TranslationID = text._TranslationID;
X = text._X;
Y = text._Y;
Z = text._Z;
Height = text._Height;
MaxWidth = text._MaxWidth;
Bounds = new SRectF(text._Bounds);
Align = text._Align;
HAlign = text._HAlign;
Style = text._Style;
Font = text._Font;
_X = text._X;
_Y = text._Y;
_Z = text._Z;
_Height = text._Height;
_MaxWidth = text._MaxWidth;
_Bounds = new SRectF(text._Bounds);
_Align = text._Align;
_HAlign = text._HAlign;
_Style = text._Style;
_Font = text._Font;
Color = new SColorF(text.Color);
SColor = new SColorF(text.SColor);
@@ -303,12 +278,12 @@ namespace Vocaluxe.Menu
ReflectionSpace = text.ReflectionSpace;
ReflectionHeight = text.ReflectionHeight;
Text = text._Text;
_Text = text._Text;
Selected = text.Selected;
Visible = text.Visible;
Alpha = text.Alpha;
EditMode = text.EditMode;
_EditMode = text._EditMode;
}
public CText(float x, float y, float z, EAlignment align, float h, float mw, float r, float g, float b, float a, EStyle style, string font, string text, float rspace, float rheight)
@@ -426,13 +401,13 @@ namespace Vocaluxe.Menu
ReflectionHeight = rheight;
}
public CText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text)
public CText(float x, float y, float z, float h, float mw, EAlignment align, EStyle style, string font, SColorF col, string text, int PartyModeID = -1)
{
_Theme = new SThemeText();
_ThemeLoaded = false;
_ButtonText = false;
_PartyModeID = -1;
_TranslationID = -1;
_PartyModeID = PartyModeID;
_TranslationID = _PartyModeID;
X = x;
Y = y;
@@ -484,7 +459,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, ref Color);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out Color);
}
else
{
@@ -496,7 +471,7 @@ namespace Vocaluxe.Menu
if (xmlReader.GetValue(item + "/SColor", ref _Theme.SColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, ref SColor);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.SColorName, SkinIndex, out SColor);
}
else
{
@@ -525,28 +500,18 @@ namespace Vocaluxe.Menu
Reflection = false;
// Set values
X = _X;
Y = _Y;
Z = _Z;
Height = _Height;
MaxWidth = _MaxWidth;
Text = _Theme.Text;
Font = _Font;
Align = _Align;
HAlign = _HAlign;
Style = _Style;
_Theme.Name = ElementName;
_ButtonText = ButtonText;
_PositionNeedsUpdate = true;
if (_ThemeLoaded)
{
_Theme.Name = ElementName;
LoadTextures();
if (MaxWidth > 0)
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), MaxWidth, 3f * CBase.Settings.GetRenderH(), 0f);
else
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
_ButtonText = ButtonText;
Bounds = new SRectF(-CBase.Settings.GetRenderW(), -CBase.Settings.GetRenderH(), 3f * CBase.Settings.GetRenderW(), 3f * CBase.Settings.GetRenderH(), 0f);
}
return _ThemeLoaded;
}
@@ -667,10 +632,7 @@ namespace Vocaluxe.Menu
SColorF color = new SColorF(CurrentColor.R, CurrentColor.G, CurrentColor.B, CurrentColor.A * Alpha);
if (!EditMode)
CBase.Fonts.DrawText(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color);
else
CBase.Fonts.DrawText(_Text + "|", _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color);
CBase.Fonts.DrawText(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color);
if (Reflection)
{
@@ -689,10 +651,7 @@ namespace Vocaluxe.Menu
default:
break;
}
if (!EditMode)
CBase.Fonts.DrawTextReflection(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + sFactor, ReflectionHeight);
else
CBase.Fonts.DrawTextReflection(_Text + "|", _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + sFactor, ReflectionHeight);
CBase.Fonts.DrawTextReflection(_Text, _DrawPosition.tH, _DrawPosition.X, _DrawPosition.Y, Z, color, ReflectionSpace + sFactor, ReflectionHeight);
}
if (Selected && (CBase.Settings.GetGameState() == EGameState.EditTheme))
@@ -730,10 +689,7 @@ namespace Vocaluxe.Menu
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
if (!EditMode)
CBase.Fonts.DrawText(Text, Height, x, Y, Z, color, begin, end);
else
CBase.Fonts.DrawText(Text + "|", Height, x, Y, Z, color, begin, end);
CBase.Fonts.DrawText(Text, Height, x, Y, Z, color, begin, end);
if (Reflection)
{
@@ -816,20 +772,14 @@ namespace Vocaluxe.Menu
CBase.Fonts.SetFont(Font);
CBase.Fonts.SetStyle(Style);
if (!EditMode)
CBase.Fonts.DrawText(_Text, h, x, y, Z, color);
else
CBase.Fonts.DrawText(_Text + "|", h, x, y, Z, color);
CBase.Fonts.DrawText(_Text, h, x, y, Z, color);
if (reflection)
{
float space = (rectHeight - Y - bounds.Height) * 2f + reflectionSpace;
float height = reflectionHeight - (rectHeight - Y) + bounds.Height;
if (!EditMode)
CBase.Fonts.DrawTextReflection(_Text, h, x, y, Z, color, space, height);
else
CBase.Fonts.DrawTextReflection(_Text + "|", h, x, y, Z, color, space, height);
CBase.Fonts.DrawTextReflection(_Text, h, x, y, Z, color, space, height);
}
if (Selected && (CBase.Settings.GetGameState() == EGameState.EditTheme))
@@ -916,8 +866,6 @@ namespace Vocaluxe.Menu
case EAlignment.Right:
x = X - bounds.Width;
break;
default:
break;
}
_DrawPosition.X = x;
+1 -1
View File
@@ -114,7 +114,7 @@ namespace Vocaluxe.Menu
void SkinVideoPause(string VideoName, int PartyModeID);
SColorF GetColor(string ColorName, int PartyModeID);
bool GetColor(string ColorName, int SkinIndex, ref SColorF Color);
bool GetColor(string ColorName, int SkinIndex, out SColorF Color);
SColorF GetPlayerColor(int PlayerNr);
void UnloadSkins();
@@ -270,7 +270,7 @@ namespace Vocaluxe.Menu.SongMenu
if (xmlReader.GetValue(item + "/Color", ref _Theme.ColorName, String.Empty))
{
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, ref _Color);
_ThemeLoaded &= CBase.Theme.GetColor(_Theme.ColorName, SkinIndex, out _Color);
}
else
{