Merge branch 'develop' of github.com:Flamefire/Vocaluxe into theme
This commit is contained in:
commit
a55d724620
21 files changed
+192
-111
No files matched your search
@@ -24,17 +24,17 @@ namespace VocaluxeLib
|
||||
public class CXMLReader
|
||||
{
|
||||
private readonly XPathNavigator _Navigator;
|
||||
private readonly String _FileName;
|
||||
private readonly String _FilePath;
|
||||
|
||||
public string FileName
|
||||
public string FilePath
|
||||
{
|
||||
get { return _FileName; }
|
||||
get { return _FilePath; }
|
||||
}
|
||||
|
||||
//Private method. Use OpenFile factory method to get an instance
|
||||
private CXMLReader(string uri)
|
||||
{
|
||||
_FileName = uri;
|
||||
_FilePath = uri;
|
||||
var xmlDoc = new XPathDocument(uri);
|
||||
_Navigator = xmlDoc.CreateNavigator();
|
||||
}
|
||||
@@ -88,7 +88,24 @@ namespace VocaluxeLib
|
||||
return GetValue(xPath, out val, value.ToString()) && CHelper.TryParse(val, out value);
|
||||
}
|
||||
|
||||
public bool GetValue(string xPath, out string value, string defaultValue)
|
||||
public bool TryGetColorFromRGBA(string xPath, ref SColorF value)
|
||||
{
|
||||
bool result = true;
|
||||
result &= TryGetFloatValue(xPath + "/R", ref value.R);
|
||||
result &= TryGetFloatValue(xPath + "/G", ref value.G);
|
||||
result &= TryGetFloatValue(xPath + "/B", ref value.B);
|
||||
result &= TryGetFloatValue(xPath + "/A", ref value.A);
|
||||
if (result)
|
||||
{
|
||||
value.R = value.R.Clamp(0f, 1f);
|
||||
value.G = value.G.Clamp(0f, 1f);
|
||||
value.B = value.B.Clamp(0f, 1f);
|
||||
value.A = value.A.Clamp(0f, 1f);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public bool GetValue(string xPath, out string value, string defaultValue = "")
|
||||
{
|
||||
int resultCt = 0;
|
||||
string val = string.Empty;
|
||||
|
||||
@@ -166,7 +166,7 @@ namespace VocaluxeLib
|
||||
|
||||
public interface ILog
|
||||
{
|
||||
void LogError(string errorText);
|
||||
void LogError(string errorText, bool showMsg = false, bool exit = false);
|
||||
void LogDebug(string text);
|
||||
void LogSongInfo(string text);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,18 @@ namespace VocaluxeLib.Menu
|
||||
}
|
||||
}
|
||||
public bool Visible = true;
|
||||
public bool Enabled = true;
|
||||
private bool _Enabled = true;
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get { return _Enabled; }
|
||||
set
|
||||
{
|
||||
_Enabled = value;
|
||||
if (!_Enabled)
|
||||
_Selected = false;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetThemeName()
|
||||
{
|
||||
@@ -138,7 +149,7 @@ namespace VocaluxeLib.Menu
|
||||
_SelText = new CText(button._SelText);
|
||||
Selected = false;
|
||||
EditMode = false;
|
||||
Enabled = button.Enabled;
|
||||
_Enabled = button._Enabled;
|
||||
|
||||
_Reflection = button._Reflection;
|
||||
_ReflectionHeight = button._ReflectionHeight;
|
||||
@@ -318,7 +329,7 @@ namespace VocaluxeLib.Menu
|
||||
|
||||
CTexture texture;
|
||||
|
||||
if (!Selected && !Pressed || !Enabled)
|
||||
if (!Selected && !Pressed || !_Enabled)
|
||||
{
|
||||
texture = Texture ?? CBase.Theme.GetSkinTexture(_Theme.TextureName, _PartyModeID);
|
||||
|
||||
|
||||
@@ -84,18 +84,21 @@ namespace VocaluxeLib.Profile
|
||||
{
|
||||
PlayerName = value;
|
||||
string avatarFileName;
|
||||
xmlReader.TryGetEnumValue("//root/Info/Difficulty", ref Difficulty);
|
||||
xmlReader.GetValue("//root/Info/Avatar", out avatarFileName, String.Empty);
|
||||
bool ok = xmlReader.TryGetEnumValue("//root/Info/Difficulty", ref Difficulty);
|
||||
ok &= xmlReader.GetValue("//root/Info/Avatar", out avatarFileName);
|
||||
Avatar = CBase.Profiles.GetAvatarByFilename(avatarFileName);
|
||||
xmlReader.TryGetEnumValue("//root/Info/UserRole", ref UserRole);
|
||||
xmlReader.TryGetEnumValue("//root/Info/Active", ref Active);
|
||||
ok &= Avatar != null;
|
||||
ok &= xmlReader.TryGetEnumValue("//root/Info/UserRole", ref UserRole);
|
||||
ok &= xmlReader.TryGetEnumValue("//root/Info/Active", ref Active);
|
||||
string passwordHash;
|
||||
xmlReader.GetValue("//root/Info/PasswordHash", out passwordHash, "");
|
||||
xmlReader.GetValue("//root/Info/PasswordHash", out passwordHash);
|
||||
PasswordHash = !string.IsNullOrEmpty(passwordHash) ? Convert.FromBase64String(passwordHash) : null;
|
||||
string passwordSalt;
|
||||
xmlReader.GetValue("//root/Info/PasswordSalt", out passwordSalt, "");
|
||||
xmlReader.GetValue("//root/Info/PasswordSalt", out passwordSalt);
|
||||
PasswordSalt = !string.IsNullOrEmpty(passwordSalt) ? Convert.FromBase64String(passwordSalt) : null;
|
||||
return true;
|
||||
if (!ok)
|
||||
CBase.Log.LogError("Error loading profile file: " + FileName);
|
||||
return ok;
|
||||
}
|
||||
|
||||
CBase.Log.LogError("Can't find PlayerName in Profile File: " + FileName);
|
||||
|
||||
@@ -56,18 +56,11 @@ namespace VocaluxeLib.Songs
|
||||
return Songs.Count(sp => !sp.IsSung);
|
||||
}
|
||||
|
||||
public CCategory(string name, CTexture coverSmall, CTexture coverBig)
|
||||
public CSong GetSong(int numInCategory)
|
||||
{
|
||||
Name = name;
|
||||
CoverTextureSmall = coverSmall;
|
||||
CoverTextureBig = coverBig;
|
||||
}
|
||||
|
||||
public CCategory(CCategory cat)
|
||||
{
|
||||
Name = cat.Name;
|
||||
CoverTextureSmall = cat.CoverTextureSmall;
|
||||
CoverTextureBig = cat.CoverTextureBig;
|
||||
if (numInCategory >= 0 && numInCategory < Songs.Count)
|
||||
return CBase.Songs.GetSongByID(Songs[numInCategory].SongID);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user