diff --git a/Unity/Assets/Editor/Figma Convert/Code/API/APIService.cs b/Unity/Assets/Editor/Figma Convert/Code/API/APIService.cs index 9b321ea..2e23712 100644 --- a/Unity/Assets/Editor/Figma Convert/Code/API/APIService.cs +++ b/Unity/Assets/Editor/Figma Convert/Code/API/APIService.cs @@ -2,6 +2,7 @@ using UnityEngine.Networking; using System; using System.Collections.Generic; +using System.Text.RegularExpressions; using System.Net; using System.IO; @@ -13,15 +14,10 @@ public static File GetDocument() { using (HttpWebResponse response = (HttpWebResponse) request.GetResponse()) { StreamReader reader = new StreamReader(response.GetResponseStream()); string json = reader.ReadToEnd(); + Regex regex = new Regex("(|(Distance)|(RotationX)|(RotationY))#[0-9]+:[0-9]+"); + json = regex.Replace(json, "$1"); return JsonUtility.FromJson(json); } - - // HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - // StreamReader reader = new StreamReader(response.GetResponseStream()); - // string json = reader.ReadToEnd(); - // return JsonUtility.FromJson(json); - // return JsonConvert.DeserializeObject>(json); - // return JsonConvert.DeserializeObject(json); } public static string GetImage() { diff --git a/Unity/Assets/Editor/Figma Convert/Code/API/JSON/File/ObjectProperty.cs b/Unity/Assets/Editor/Figma Convert/Code/API/JSON/File/ObjectProperty.cs index 0efe8f0..6643c88 100644 --- a/Unity/Assets/Editor/Figma Convert/Code/API/JSON/File/ObjectProperty.cs +++ b/Unity/Assets/Editor/Figma Convert/Code/API/JSON/File/ObjectProperty.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + [System.Serializable] public class ObjectProperty { public string id; @@ -5,7 +7,7 @@ public class ObjectProperty { public bool visible = true; public string type; public string scrollBehavior; - // public ComponentProperty componentPropertyDefinitions; + public ComponentProperty componentPropertyDefinitions; public string blendMode; public ObjectProperty[] children = null; public Absolute absoluteBoundingBox; diff --git a/Unity/Assets/Editor/Figma Convert/Code/API/JSON/File/Objects/ComponentProperty.cs b/Unity/Assets/Editor/Figma Convert/Code/API/JSON/File/Objects/ComponentProperty.cs new file mode 100644 index 0000000..d4a3aca --- /dev/null +++ b/Unity/Assets/Editor/Figma Convert/Code/API/JSON/File/Objects/ComponentProperty.cs @@ -0,0 +1,6 @@ +[System.Serializable] +public class ComponentProperty { + public PropertyDefinitions Distance; + public PropertyDefinitions RotationX; + public PropertyDefinitions RotationY; +} \ No newline at end of file diff --git a/Unity/Assets/Editor/Figma Convert/Code/API/JSON/File/Objects/PropertyDefinitions.cs b/Unity/Assets/Editor/Figma Convert/Code/API/JSON/File/Objects/PropertyDefinitions.cs new file mode 100644 index 0000000..b27bf57 --- /dev/null +++ b/Unity/Assets/Editor/Figma Convert/Code/API/JSON/File/Objects/PropertyDefinitions.cs @@ -0,0 +1,5 @@ +[System.Serializable] +public class PropertyDefinitions{ + public string type; + public string defaultValue; +} \ No newline at end of file diff --git a/Unity/Assets/Editor/Figma Convert/Code/Core.cs b/Unity/Assets/Editor/Figma Convert/Code/Core.cs index 92a1c1f..4adf3f0 100644 --- a/Unity/Assets/Editor/Figma Convert/Code/Core.cs +++ b/Unity/Assets/Editor/Figma Convert/Code/Core.cs @@ -18,9 +18,8 @@ public static void Start(int escala){ // Chamada da API File apiDocument = APIService.GetDocument(); - // Object apiDocument = APIService.GetDocument(); Global.apiImage = APIService.GetImage(); - + // Loop Pagina for(int i = 0; i