diff --git a/Vocaluxe.UI.Unity/Assets/ScreenHandler.cs b/Vocaluxe.UI.Unity/Assets/ScreenHandler.cs index 4f19cb6d..cfe308fc 100644 --- a/Vocaluxe.UI.Unity/Assets/ScreenHandler.cs +++ b/Vocaluxe.UI.Unity/Assets/ScreenHandler.cs @@ -105,7 +105,7 @@ public class ScreenHandler : MonoBehaviour button.GetComponent().color = Color.green; var buttonText = button.GetComponentInChildren().gameObject; - SetProperties((CUiElementText)buttonInfo.AsQueryable().FirstOrDefault(x => x is CUiElementText), buttonText); + SetProperties((CUiElementText)buttonInfo.FirstOrDefault(x => x is CUiElementText), buttonText); } private GameObject CreateElement(CUiElementText textInfo) @@ -117,6 +117,9 @@ public class ScreenHandler : MonoBehaviour private void SetProperties(CUiElementText textInfo, GameObject text) { + var textComponent = text.GetComponent(); + // Add text to the text component + textComponent.text = textInfo.Controller.Text; PositionElement(textInfo, text); } diff --git a/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll b/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll deleted file mode 100644 index 24f4c242..00000000 Binary files a/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll and /dev/null differ diff --git a/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll.mdb b/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll.mdb deleted file mode 100644 index e025a7f6..00000000 Binary files a/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll.mdb and /dev/null differ diff --git a/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll.mdb.meta b/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll.mdb.meta deleted file mode 100644 index c842be6e..00000000 --- a/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll.mdb.meta +++ /dev/null @@ -1,7 +0,0 @@ -fileFormatVersion: 2 -guid: ee53898f2ecb9f947bf75286bc93aee0 -DefaultImporter: - externalObjects: {} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll.meta b/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll.meta deleted file mode 100644 index 2487a4a5..00000000 --- a/Vocaluxe.UI.Unity/Assets/Vocaluxe.UI.dll.meta +++ /dev/null @@ -1,96 +0,0 @@ -fileFormatVersion: 2 -guid: c159d6aca28a19847ace6c3ea7bfad8c -PluginImporter: - externalObjects: {} - serializedVersion: 2 - iconMap: {} - executionOrder: {} - isPreloaded: 0 - isOverridable: 0 - platformData: - - first: - '': Any - second: - enabled: 0 - settings: - Exclude Editor: 0 - Exclude Linux: 0 - Exclude Linux64: 0 - Exclude LinuxUniversal: 0 - Exclude OSXUniversal: 0 - Exclude Win: 0 - Exclude Win64: 0 - Exclude WindowsStoreApps: 0 - - first: - Any: - second: - enabled: 1 - settings: {} - - first: - Editor: Editor - second: - enabled: 1 - settings: - CPU: AnyCPU - DefaultValueInitialized: true - OS: AnyOS - - first: - Facebook: Win - second: - enabled: 0 - settings: - CPU: AnyCPU - - first: - Facebook: Win64 - second: - enabled: 0 - settings: - CPU: AnyCPU - - first: - Standalone: Linux - second: - enabled: 1 - settings: - CPU: x86 - - first: - Standalone: Linux64 - second: - enabled: 1 - settings: - CPU: x86_64 - - first: - Standalone: LinuxUniversal - second: - enabled: 1 - settings: {} - - first: - Standalone: OSXUniversal - second: - enabled: 1 - settings: - CPU: AnyCPU - - first: - Standalone: Win - second: - enabled: 1 - settings: - CPU: AnyCPU - - first: - Standalone: Win64 - second: - enabled: 1 - settings: - CPU: AnyCPU - - first: - Windows Store Apps: WindowsStoreApps - second: - enabled: 1 - settings: - CPU: AnyCPU - DontProcess: false - PlaceholderPath: - SDK: AnySDK - ScriptingBackend: AnyScriptingBackend - userData: - assetBundleName: - assetBundleVariant: diff --git a/Vocaluxe.UI/BasicElements/Text/CUiElementText.cs b/Vocaluxe.UI/BasicElements/Text/CUiElementText.cs index 12526734..62e2d184 100644 --- a/Vocaluxe.UI/BasicElements/Text/CUiElementText.cs +++ b/Vocaluxe.UI/BasicElements/Text/CUiElementText.cs @@ -10,7 +10,10 @@ namespace Vocaluxe.UI.BasicElements.Text public static CUiElementText CreateInstance(Dictionary properties, IEnumerable<(CUiElement uiElement, string bindingId)> children) { - return CUiElement.CreateInstance(properties, children); + var instance = CUiElement.CreateInstance(properties, children); + properties.TryGetValue("value", out string value); + instance.Controller.Text = value; + return instance; } } } diff --git a/Vocaluxe.UI/Parser/CUiScreenParser.cs b/Vocaluxe.UI/Parser/CUiScreenParser.cs index 8bdd3537..0157c03e 100644 --- a/Vocaluxe.UI/Parser/CUiScreenParser.cs +++ b/Vocaluxe.UI/Parser/CUiScreenParser.cs @@ -8,47 +8,6 @@ namespace Vocaluxe.UI.Parser { public static class CUiScreenParser { - public static CUiScreen ParseOld(string path) - { - if(!File.Exists(path)) - throw new FileNotFoundException(path); - - using (XmlReader reader = XmlReader.Create(path, new XmlReaderSettings { IgnoreWhitespace = true })) - { - return _ParseElementOld(reader)[0].Item1 as CUiScreen ?? throw new ArgumentException("First node must be a screen element"); - } - } - - private static List<(CUiElement uiElement, string bindingId)> _ParseElementOld(XmlReader reader) - { - List<(CUiElement, string)> elementList = new List<(CUiElement uiElement, string bindingId)>(); - - while (reader.Read()) - { - if (reader.NodeType != XmlNodeType.Element) - continue; - - string elementName = reader.Name; - - var subtreeReader = reader.ReadSubtree(); - subtreeReader.Read(); - List<(CUiElement uiElement, string bindingId)> childElements = _ParseElementOld(subtreeReader); - - Dictionary attributes = new Dictionary(); - for (var attrIndex = 0; attrIndex < reader.AttributeCount; attrIndex++) - { - reader.MoveToAttribute(attrIndex); - attributes.Add(reader.Name, reader.Value); - } - - attributes.TryGetValue("bindingId", out string bindingId); - elementList.Add((CUiElementFactory.CreateElement(elementName, attributes, childElements), bindingId)); - } - - reader.Close(); - return elementList; - } - public static CUiScreen Parse(string path) { if (!File.Exists(path)) @@ -68,12 +27,18 @@ namespace Vocaluxe.UI.Parser return resultElement; List<(CUiElement uiElement, string bindingId)> childElements = new List<(CUiElement uiElement, string bindingId)>(); - foreach (XmlElement childNode in node.ChildNodes) + Dictionary attributes = new Dictionary(); + foreach (XmlNode childNode in node.ChildNodes) { - childElements.Add(_ParseElement(childNode)); + if(!(childNode is XmlElement)) + { + attributes.Add("value", childNode.Value); + continue; + } + childElements.Add(_ParseElement((XmlElement)childNode)); } - Dictionary attributes = new Dictionary(); + foreach (XmlAttribute attribute in node.Attributes) { attributes.Add(attribute.Name, attribute.Value); diff --git a/Vocaluxe.UI/Vocaluxe.UI.csproj b/Vocaluxe.UI/Vocaluxe.UI.csproj index 4704dadc..d242d0da 100644 --- a/Vocaluxe.UI/Vocaluxe.UI.csproj +++ b/Vocaluxe.UI/Vocaluxe.UI.csproj @@ -119,4 +119,8 @@ + + copy /Y "$(TargetDir)$(ProjectName).dll" "$(SolutionDir)Vocaluxe.UI.Unity\Assets\$(ProjectName).dll" +copy /Y "$(TargetDir)$(ProjectName).pdb" "$(SolutionDir)Vocaluxe.UI.Unity\Assets\$(ProjectName).pdb" + \ No newline at end of file