diff --git a/Assets/Editor/Editor AddOn.meta b/Assets/Editor/Editor AddOn.meta index c80949d..830f8a2 100644 --- a/Assets/Editor/Editor AddOn.meta +++ b/Assets/Editor/Editor AddOn.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 1eba5231ebd032b4db5d58d699e0f0de +guid: 6d9a64deb119a514eae5ed7f5abd8eb1 folderAsset: yes DefaultImporter: externalObjects: {} diff --git a/Assets/Editor/Editor Addon/JsonViewer.meta b/Assets/Editor/Editor Addon/JsonViewer.meta new file mode 100644 index 0000000..86a4bef --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 163546d147384b941b46466505aa9d68 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Scripts.meta b/Assets/Editor/Editor Addon/JsonViewer/Scripts.meta new file mode 100644 index 0000000..dd73e92 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Scripts.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 15d05434831483c41b2a06cb9a59fed9 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Scripts/JsonEditorWindow.cs b/Assets/Editor/Editor Addon/JsonViewer/Scripts/JsonEditorWindow.cs new file mode 100644 index 0000000..304a876 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Scripts/JsonEditorWindow.cs @@ -0,0 +1,191 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using SimpleJSON; +using SFB; +using System.IO; + +public class JsonEditorWindow : EditorWindow +{ + + public string RawJson = ""; + public string OldJson = ""; + public JSONNode jsonRoot; + + + private Vector2 scrollpos; + private Dictionary FoldHash; + private bool isFile = false; + private string FilePath; + + // Add menu named "My Window" to the Window menu + [MenuItem("Tools/Editor Add On/Json Editor")] + public static void Init() + { + // Get existing open window or if none, make a new one: + JsonEditorWindow window = (JsonEditorWindow)EditorWindow.GetWindow(typeof(JsonEditorWindow)); + + window.Initialise(""); + window.Show(); + } + + public static void Init(string json) + { + // Get existing open window or if none, make a new one: + JsonEditorWindow window = (JsonEditorWindow)EditorWindow.GetWindow(typeof(JsonEditorWindow)); + + window.Initialise(json); + window.Show(); + } + + + private void Initialise(string json = "") + { + if (!string.IsNullOrEmpty(json)) + RawJson = json; + + } + + public void OnGUI() + { + inputGUI(); + JsonGUI(); + } + + private void inputGUI() + { + EditorGUILayout.BeginHorizontal(); + if (!isFile) + { + if (GUILayout.Button("Open File",GUILayout.Width(80))) + { + FilePath = StandaloneFileBrowser.OpenFilePanel("Open Location File", FilePath, "txt", false)[0]; + + if (File.Exists(FilePath)) + { + RawJson = File.ReadAllText(FilePath); + isFile = true; + } + else + { + RawJson = null; + isFile = false; + } + } + } + else + { + if (GUILayout.Button("Clear", GUILayout.Width(80))) + { + RawJson = null; + isFile = false; + } + } + + if (!isFile) + { + RawJson = EditorGUILayout.TextField(RawJson); + } + else + { + EditorGUILayout.LabelField(Path.GetFileName(FilePath)); + } + + + EditorGUILayout.EndHorizontal(); + + + if (OldJson == RawJson) + return; + + OldJson = RawJson; + + try + { + jsonRoot = JSON.Parse(RawJson); + FoldHash = new Dictionary(); + } + catch + { + Debug.LogWarning("Can not parse Json string"); + jsonRoot = null; + } + } + + private void JsonGUI() + { + scrollpos = GUILayout.BeginScrollView(scrollpos); + DrawNode(jsonRoot); + GUILayout.EndScrollView(); + + if (jsonRoot != null) + { + RawJson = jsonRoot.ToString(); + OldJson = jsonRoot.ToString(); + } + + } + + private void DrawJsonObject(JSONNode node,string key) + { + if (!FoldHash.ContainsKey(node)) + FoldHash.Add(node, false); + + FoldHash[node] = EditorGUILayout.Foldout(FoldHash[node], key); + if (!FoldHash[node]) + return; + + foreach (KeyValuePair child in node) + { + DrawNode(child.Value,child.Key); + } + } + + private void DrawJsonArray(JSONNode node, string key) + { + if (!FoldHash.ContainsKey(node)) + FoldHash.Add(node, false); + + FoldHash[node] = EditorGUILayout.Foldout(FoldHash[node], key); + if (!FoldHash[node]) + return; + + foreach (JSONNode child in node) + DrawNode(child); + } + + + + private void DrawNode(JSONNode node,string key = "") + { + if (node == null) return; + + EditorGUI.indentLevel++; + + switch (node.Tag) + { + case JSONNodeType.Object: + DrawJsonObject(node,key); + break; + case JSONNodeType.Array: + DrawJsonArray(node,key); + break; + default: + EditorGUILayout.BeginHorizontal(); + node.Value = EditorGUILayout.TextField(key,node.Value); + + EditorGUILayout.EndHorizontal(); + break; + } + + EditorGUI.indentLevel--; + } + + private void DebugNode(JSONNode node) + { + EditorGUILayout.TextArea(node.ToString(1)); + } + + +} diff --git a/Assets/Editor/Editor Addon/JsonViewer/Scripts/JsonEditorWindow.cs.meta b/Assets/Editor/Editor Addon/JsonViewer/Scripts/JsonEditorWindow.cs.meta new file mode 100644 index 0000000..da2090b --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Scripts/JsonEditorWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 017756f271c30ba43b71d59b3d79b11b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party.meta new file mode 100644 index 0000000..c080fdb --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: f183afe0cb678eb44b8f5695e56f6efb +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson.meta new file mode 100644 index 0000000..303a5b9 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bf8e1b4a99cdf864b9115839a367c306 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/LICENSE b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/LICENSE new file mode 100644 index 0000000..c41ebf5 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2012-2017 Markus Göbel (Bunny83) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/LICENSE.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/LICENSE.meta new file mode 100644 index 0000000..c683b5d --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/LICENSE.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 62836419310492541ace26572f0db5c8 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/README b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/README new file mode 100644 index 0000000..e69de29 diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/README.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/README.meta new file mode 100644 index 0000000..12b25f4 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/README.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ba25a3b339332594d9a93bae2ae511fc +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSON.cs b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSON.cs new file mode 100644 index 0000000..21b485a --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSON.cs @@ -0,0 +1,1351 @@ +/* * * * * + * A simple JSON Parser / builder + * ------------------------------ + * + * It mainly has been written as a simple JSON parser. It can build a JSON string + * from the node-tree, or generate a node tree from any valid JSON string. + * + * If you want to use compression when saving to file / stream / B64 you have to include + * SharpZipLib ( http://www.icsharpcode.net/opensource/sharpziplib/ ) in your project and + * define "USE_SharpZipLib" at the top of the file + * + * Written by Bunny83 + * 2012-06-09 + * + * [2012-06-09 First Version] + * - provides strongly typed node classes and lists / dictionaries + * - provides easy access to class members / array items / data values + * - the parser now properly identifies types. So generating JSON with this framework should work. + * - only double quotes (") are used for quoting strings. + * - provides "casting" properties to easily convert to / from those types: + * int / float / double / bool + * - provides a common interface for each node so no explicit casting is required. + * - the parser tries to avoid errors, but if malformed JSON is parsed the result is more or less undefined + * - It can serialize/deserialize a node tree into/from an experimental compact binary format. It might + * be handy if you want to store things in a file and don't want it to be easily modifiable + * + * [2012-12-17 Update] + * - Added internal JSONLazyCreator class which simplifies the construction of a JSON tree + * Now you can simple reference any item that doesn't exist yet and it will return a JSONLazyCreator + * The class determines the required type by it's further use, creates the type and removes itself. + * - Added binary serialization / deserialization. + * - Added support for BZip2 zipped binary format. Requires the SharpZipLib ( http://www.icsharpcode.net/opensource/sharpziplib/ ) + * The usage of the SharpZipLib library can be disabled by removing or commenting out the USE_SharpZipLib define at the top + * - The serializer uses different types when it comes to store the values. Since my data values + * are all of type string, the serializer will "try" which format fits best. The order is: int, float, double, bool, string. + * It's not the most efficient way but for a moderate amount of data it should work on all platforms. + * + * [2017-03-08 Update] + * - Optimised parsing by using a StringBuilder for token. This prevents performance issues when large + * string data fields are contained in the json data. + * - Finally refactored the badly named JSONClass into JSONObject. + * - Replaced the old JSONData class by distict typed classes ( JSONString, JSONNumber, JSONBool, JSONNull ) this + * allows to propertly convert the node tree back to json without type information loss. The actual value + * parsing now happens at parsing time and not when you actually access one of the casting properties. + * + * [2017-04-11 Update] + * - Fixed parsing bug where empty string values have been ignored. + * - Optimised "ToString" by using a StringBuilder internally. This should heavily improve performance for large files + * - Changed the overload of "ToString(string aIndent)" to "ToString(int aIndent)" + * + * [2017-11-29 Update] + * - Removed the IEnumerator implementations on JSONArray & JSONObject and replaced it with a common + * struct Enumerator in JSONNode that should avoid garbage generation. The enumerator always works + * on KeyValuePair, even for JSONArray. + * - Added two wrapper Enumerators that allows for easy key or value enumeration. A JSONNode now has + * a "Keys" and a "Values" enumerable property. Those are also struct enumerators / enumerables + * - A KeyValuePair can now be implicitly converted into a JSONNode. This allows + * a foreach loop over a JSONNode to directly access the values only. Since KeyValuePair as well as + * all the Enumerators are structs, no garbage is allocated. + * - To add Linq support another "LinqEnumerator" is available through the "Linq" property. This + * enumerator does implement the generic IEnumerable interface so most Linq extensions can be used + * on this enumerable object. This one does allocate memory as it's a wrapper class. + * - The Escape method now escapes all control characters (# < 32) in strings as uncode characters + * (\uXXXX) and if the static bool JSONNode.forceASCII is set to true it will also escape all + * characters # > 127. This might be useful if you require an ASCII output. Though keep in mind + * when your strings contain many non-ascii characters the strings become much longer (x6) and are + * no longer human readable. + * - The node types JSONObject and JSONArray now have an "Inline" boolean switch which will default to + * false. It can be used to serialize this element inline even you serialize with an indented format + * This is useful for arrays containing numbers so it doesn't place every number on a new line + * - Extracted the binary serialization code into a seperate extension file. All classes are now declared + * as "partial" so an extension file can even add a new virtual or abstract method / interface to + * JSONNode and override it in the concrete type classes. It's of course a hacky approach which is + * generally not recommended, but i wanted to keep everything tightly packed. + * - Added a static CreateOrGet method to the JSONNull class. Since this class is immutable it could + * be reused without major problems. If you have a lot null fields in your data it will help reduce + * the memory / garbage overhead. I also added a static setting (reuseSameInstance) to JSONNull + * (default is true) which will change the behaviour of "CreateOrGet". If you set this to false + * CreateOrGet will not reuse the cached instance but instead create a new JSONNull instance each time. + * I made the JSONNull constructor private so if you need to create an instance manually use + * JSONNull.CreateOrGet() + * + * [2018-01-09 Update] + * - Changed all double.TryParse and double.ToString uses to use the invariant culture to avoid problems + * on systems with a culture that uses a comma as decimal point. + * + * [2018-01-26 Update] + * - Added AsLong. Note that a JSONNumber is stored as double and can't represent all long values. However + * storing it as string would work. + * - Added static setting "JSONNode.longAsString" which controls the default type that is used by the + * LazyCreator when using AsLong + * + * [2018-04-25 Update] + * - Added support for parsing single values (JSONBool, JSONString, JSONNumber, JSONNull) as top level value. + * + * The MIT License (MIT) + * + * Copyright (c) 2012-2017 Markus Göbel (Bunny83) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * * * * */ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; + +namespace SimpleJSON +{ + public enum JSONNodeType + { + Array = 1, + Object = 2, + String = 3, + Number = 4, + NullValue = 5, + Boolean = 6, + None = 7, + Custom = 0xFF, + } + public enum JSONTextMode + { + Compact, + Indent + } + + public abstract partial class JSONNode + { + #region Enumerators + public struct Enumerator + { + private enum Type { None, Array, Object } + private Type type; + private Dictionary.Enumerator m_Object; + private List.Enumerator m_Array; + public bool IsValid { get { return type != Type.None; } } + public Enumerator(List.Enumerator aArrayEnum) + { + type = Type.Array; + m_Object = default(Dictionary.Enumerator); + m_Array = aArrayEnum; + } + public Enumerator(Dictionary.Enumerator aDictEnum) + { + type = Type.Object; + m_Object = aDictEnum; + m_Array = default(List.Enumerator); + } + public KeyValuePair Current + { + get { + if (type == Type.Array) + return new KeyValuePair(string.Empty, m_Array.Current); + else if (type == Type.Object) + return m_Object.Current; + return new KeyValuePair(string.Empty, null); + } + } + public bool MoveNext() + { + if (type == Type.Array) + return m_Array.MoveNext(); + else if (type == Type.Object) + return m_Object.MoveNext(); + return false; + } + } + public struct ValueEnumerator + { + private Enumerator m_Enumerator; + public ValueEnumerator(List.Enumerator aArrayEnum) : this(new Enumerator(aArrayEnum)) { } + public ValueEnumerator(Dictionary.Enumerator aDictEnum) : this(new Enumerator(aDictEnum)) { } + public ValueEnumerator(Enumerator aEnumerator) { m_Enumerator = aEnumerator; } + public JSONNode Current { get { return m_Enumerator.Current.Value; } } + public bool MoveNext() { return m_Enumerator.MoveNext(); } + public ValueEnumerator GetEnumerator() { return this; } + } + public struct KeyEnumerator + { + private Enumerator m_Enumerator; + public KeyEnumerator(List.Enumerator aArrayEnum) : this(new Enumerator(aArrayEnum)) { } + public KeyEnumerator(Dictionary.Enumerator aDictEnum) : this(new Enumerator(aDictEnum)) { } + public KeyEnumerator(Enumerator aEnumerator) { m_Enumerator = aEnumerator; } + public JSONNode Current { get { return m_Enumerator.Current.Key; } } + public bool MoveNext() { return m_Enumerator.MoveNext(); } + public KeyEnumerator GetEnumerator() { return this; } + } + + public class LinqEnumerator : IEnumerator>, IEnumerable> + { + private JSONNode m_Node; + private Enumerator m_Enumerator; + internal LinqEnumerator(JSONNode aNode) + { + m_Node = aNode; + if (m_Node != null) + m_Enumerator = m_Node.GetEnumerator(); + } + public KeyValuePair Current { get { return m_Enumerator.Current; } } + object IEnumerator.Current { get { return m_Enumerator.Current; } } + public bool MoveNext() { return m_Enumerator.MoveNext(); } + + public void Dispose() + { + m_Node = null; + m_Enumerator = new Enumerator(); + } + + public IEnumerator> GetEnumerator() + { + return new LinqEnumerator(m_Node); + } + + public void Reset() + { + if (m_Node != null) + m_Enumerator = m_Node.GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return new LinqEnumerator(m_Node); + } + } + + #endregion Enumerators + + #region common interface + + public static bool forceASCII = false; // Use Unicode by default + public static bool longAsString = false; // lazy creator creates a JSONString instead of JSONNumber + + public abstract JSONNodeType Tag { get; } + + public virtual JSONNode this[int aIndex] { get { return null; } set { } } + + public virtual JSONNode this[string aKey] { get { return null; } set { } } + + public virtual string Value { get { return ""; } set { } } + + public virtual int Count { get { return 0; } } + + public virtual bool IsNumber { get { return false; } } + public virtual bool IsString { get { return false; } } + public virtual bool IsBoolean { get { return false; } } + public virtual bool IsNull { get { return false; } } + public virtual bool IsArray { get { return false; } } + public virtual bool IsObject { get { return false; } } + + public virtual bool Inline { get { return false; } set { } } + + public virtual void Add(string aKey, JSONNode aItem) + { + } + public virtual void Add(JSONNode aItem) + { + Add("", aItem); + } + + public virtual JSONNode Remove(string aKey) + { + return null; + } + + public virtual JSONNode Remove(int aIndex) + { + return null; + } + + public virtual JSONNode Remove(JSONNode aNode) + { + return aNode; + } + + public virtual IEnumerable Children + { + get + { + yield break; + } + } + + public IEnumerable DeepChildren + { + get + { + foreach (var C in Children) + foreach (var D in C.DeepChildren) + yield return D; + } + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + WriteToStringBuilder(sb, 0, 0, JSONTextMode.Compact); + return sb.ToString(); + } + + public virtual string ToString(int aIndent) + { + StringBuilder sb = new StringBuilder(); + WriteToStringBuilder(sb, 0, aIndent, JSONTextMode.Indent); + return sb.ToString(); + } + internal abstract void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode); + + public abstract Enumerator GetEnumerator(); + public IEnumerable> Linq { get { return new LinqEnumerator(this); } } + public KeyEnumerator Keys { get { return new KeyEnumerator(GetEnumerator()); } } + public ValueEnumerator Values { get { return new ValueEnumerator(GetEnumerator()); } } + + #endregion common interface + + #region typecasting properties + + + public virtual double AsDouble + { + get + { + double v = 0.0; + if (double.TryParse(Value,NumberStyles.Float, CultureInfo.InvariantCulture, out v)) + return v; + return 0.0; + } + set + { + Value = value.ToString(CultureInfo.InvariantCulture); + } + } + + public virtual int AsInt + { + get { return (int)AsDouble; } + set { AsDouble = value; } + } + + public virtual float AsFloat + { + get { return (float)AsDouble; } + set { AsDouble = value; } + } + + public virtual bool AsBool + { + get + { + bool v = false; + if (bool.TryParse(Value, out v)) + return v; + return !string.IsNullOrEmpty(Value); + } + set + { + Value = (value) ? "true" : "false"; + } + } + + public virtual long AsLong + { + get + { + long val = 0; + if (long.TryParse(Value, out val)) + return val; + return 0L; + } + set + { + Value = value.ToString(); + } + } + + public virtual JSONArray AsArray + { + get + { + return this as JSONArray; + } + } + + public virtual JSONObject AsObject + { + get + { + return this as JSONObject; + } + } + + + #endregion typecasting properties + + #region operators + + public static implicit operator JSONNode(string s) + { + return new JSONString(s); + } + public static implicit operator string(JSONNode d) + { + return (d == null) ? null : d.Value; + } + + public static implicit operator JSONNode(double n) + { + return new JSONNumber(n); + } + public static implicit operator double(JSONNode d) + { + return (d == null) ? 0 : d.AsDouble; + } + + public static implicit operator JSONNode(float n) + { + return new JSONNumber(n); + } + public static implicit operator float(JSONNode d) + { + return (d == null) ? 0 : d.AsFloat; + } + + public static implicit operator JSONNode(int n) + { + return new JSONNumber(n); + } + public static implicit operator int(JSONNode d) + { + return (d == null) ? 0 : d.AsInt; + } + + public static implicit operator JSONNode(long n) + { + if (longAsString) + return new JSONString(n.ToString()); + return new JSONNumber(n); + } + public static implicit operator long(JSONNode d) + { + return (d == null) ? 0L : d.AsLong; + } + + public static implicit operator JSONNode(bool b) + { + return new JSONBool(b); + } + public static implicit operator bool(JSONNode d) + { + return (d == null) ? false : d.AsBool; + } + + public static implicit operator JSONNode(KeyValuePair aKeyValue) + { + return aKeyValue.Value; + } + + public static bool operator ==(JSONNode a, object b) + { + if (ReferenceEquals(a, b)) + return true; + bool aIsNull = a is JSONNull || ReferenceEquals(a, null) || a is JSONLazyCreator; + bool bIsNull = b is JSONNull || ReferenceEquals(b, null) || b is JSONLazyCreator; + if (aIsNull && bIsNull) + return true; + return !aIsNull && a.Equals(b); + } + + public static bool operator !=(JSONNode a, object b) + { + return !(a == b); + } + + public override bool Equals(object obj) + { + return ReferenceEquals(this, obj); + } + + public override int GetHashCode() + { + return base.GetHashCode(); + } + + #endregion operators + + [ThreadStatic] + private static StringBuilder m_EscapeBuilder; + internal static StringBuilder EscapeBuilder + { + get { + if (m_EscapeBuilder == null) + m_EscapeBuilder = new StringBuilder(); + return m_EscapeBuilder; + } + } + internal static string Escape(string aText) + { + var sb = EscapeBuilder; + sb.Length = 0; + if (sb.Capacity < aText.Length + aText.Length / 10) + sb.Capacity = aText.Length + aText.Length / 10; + foreach (char c in aText) + { + switch (c) + { + case '\\': + sb.Append("\\\\"); + break; + case '\"': + sb.Append("\\\""); + break; + case '\n': + sb.Append("\\n"); + break; + case '\r': + sb.Append("\\r"); + break; + case '\t': + sb.Append("\\t"); + break; + case '\b': + sb.Append("\\b"); + break; + case '\f': + sb.Append("\\f"); + break; + default: + if (c < ' ' || (forceASCII && c > 127)) + { + ushort val = c; + sb.Append("\\u").Append(val.ToString("X4")); + } + else + sb.Append(c); + break; + } + } + string result = sb.ToString(); + sb.Length = 0; + return result; + } + + private static JSONNode ParseElement(string token, bool quoted) + { + if (quoted) + return token; + string tmp = token.ToLower(); + if (tmp == "false" || tmp == "true") + return tmp == "true"; + if (tmp == "null") + return JSONNull.CreateOrGet(); + double val; + if (double.TryParse(token, NumberStyles.Float, CultureInfo.InvariantCulture, out val)) + return val; + else + return token; + } + + public static JSONNode Parse(string aJSON) + { + Stack stack = new Stack(); + JSONNode ctx = null; + int i = 0; + StringBuilder Token = new StringBuilder(); + string TokenName = ""; + bool QuoteMode = false; + bool TokenIsQuoted = false; + while (i < aJSON.Length) + { + switch (aJSON[i]) + { + case '{': + if (QuoteMode) + { + Token.Append(aJSON[i]); + break; + } + stack.Push(new JSONObject()); + if (ctx != null) + { + ctx.Add(TokenName, stack.Peek()); + } + TokenName = ""; + Token.Length = 0; + ctx = stack.Peek(); + break; + + case '[': + if (QuoteMode) + { + Token.Append(aJSON[i]); + break; + } + + stack.Push(new JSONArray()); + if (ctx != null) + { + ctx.Add(TokenName, stack.Peek()); + } + TokenName = ""; + Token.Length = 0; + ctx = stack.Peek(); + break; + + case '}': + case ']': + if (QuoteMode) + { + + Token.Append(aJSON[i]); + break; + } + if (stack.Count == 0) + throw new Exception("JSON Parse: Too many closing brackets"); + + stack.Pop(); + if (Token.Length > 0 || TokenIsQuoted) + ctx.Add(TokenName, ParseElement(Token.ToString(), TokenIsQuoted)); + TokenIsQuoted = false; + TokenName = ""; + Token.Length = 0; + if (stack.Count > 0) + ctx = stack.Peek(); + break; + + case ':': + if (QuoteMode) + { + Token.Append(aJSON[i]); + break; + } + TokenName = Token.ToString(); + Token.Length = 0; + TokenIsQuoted = false; + break; + + case '"': + QuoteMode ^= true; + TokenIsQuoted |= QuoteMode; + break; + + case ',': + if (QuoteMode) + { + Token.Append(aJSON[i]); + break; + } + if (Token.Length > 0 || TokenIsQuoted) + ctx.Add(TokenName, ParseElement(Token.ToString(), TokenIsQuoted)); + TokenIsQuoted = false; + TokenName = ""; + Token.Length = 0; + TokenIsQuoted = false; + break; + + case '\r': + case '\n': + break; + + case ' ': + case '\t': + if (QuoteMode) + Token.Append(aJSON[i]); + break; + + case '\\': + ++i; + if (QuoteMode) + { + char C = aJSON[i]; + switch (C) + { + case 't': + Token.Append('\t'); + break; + case 'r': + Token.Append('\r'); + break; + case 'n': + Token.Append('\n'); + break; + case 'b': + Token.Append('\b'); + break; + case 'f': + Token.Append('\f'); + break; + case 'u': + { + string s = aJSON.Substring(i + 1, 4); + Token.Append((char)int.Parse( + s, + System.Globalization.NumberStyles.AllowHexSpecifier)); + i += 4; + break; + } + default: + Token.Append(C); + break; + } + } + break; + + default: + Token.Append(aJSON[i]); + break; + } + ++i; + } + if (QuoteMode) + { + throw new Exception("JSON Parse: Quotation marks seems to be messed up."); + } + if (ctx == null) + return ParseElement(Token.ToString(), TokenIsQuoted); + return ctx; + } + + } + // End of JSONNode + + public partial class JSONArray : JSONNode + { + private List m_List = new List(); + private bool inline = false; + public override bool Inline + { + get { return inline; } + set { inline = value; } + } + + public override JSONNodeType Tag { get { return JSONNodeType.Array; } } + public override bool IsArray { get { return true; } } + public override Enumerator GetEnumerator() { return new Enumerator(m_List.GetEnumerator()); } + + public override JSONNode this[int aIndex] + { + get + { + if (aIndex < 0 || aIndex >= m_List.Count) + return new JSONLazyCreator(this); + return m_List[aIndex]; + } + set + { + if (value == null) + value = JSONNull.CreateOrGet(); + if (aIndex < 0 || aIndex >= m_List.Count) + m_List.Add(value); + else + m_List[aIndex] = value; + } + } + + public override JSONNode this[string aKey] + { + get { return new JSONLazyCreator(this); } + set + { + if (value == null) + value = JSONNull.CreateOrGet(); + m_List.Add(value); + } + } + + public override int Count + { + get { return m_List.Count; } + } + + public override void Add(string aKey, JSONNode aItem) + { + if (aItem == null) + aItem = JSONNull.CreateOrGet(); + m_List.Add(aItem); + } + + public override JSONNode Remove(int aIndex) + { + if (aIndex < 0 || aIndex >= m_List.Count) + return null; + JSONNode tmp = m_List[aIndex]; + m_List.RemoveAt(aIndex); + return tmp; + } + + public override JSONNode Remove(JSONNode aNode) + { + m_List.Remove(aNode); + return aNode; + } + + public override IEnumerable Children + { + get + { + foreach (JSONNode N in m_List) + yield return N; + } + } + + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append('['); + int count = m_List.Count; + if (inline) + aMode = JSONTextMode.Compact; + for (int i = 0; i < count; i++) + { + if (i > 0) + aSB.Append(','); + if (aMode == JSONTextMode.Indent) + aSB.AppendLine(); + + if (aMode == JSONTextMode.Indent) + aSB.Append(' ', aIndent + aIndentInc); + m_List[i].WriteToStringBuilder(aSB, aIndent + aIndentInc, aIndentInc, aMode); + } + if (aMode == JSONTextMode.Indent) + aSB.AppendLine().Append(' ', aIndent); + aSB.Append(']'); + } + } + // End of JSONArray + + public partial class JSONObject : JSONNode + { + private Dictionary m_Dict = new Dictionary(); + + private bool inline = false; + public override bool Inline + { + get { return inline; } + set { inline = value; } + } + + public override JSONNodeType Tag { get { return JSONNodeType.Object; } } + public override bool IsObject { get { return true; } } + + public override Enumerator GetEnumerator() { return new Enumerator(m_Dict.GetEnumerator()); } + + + public override JSONNode this[string aKey] + { + get + { + if (m_Dict.ContainsKey(aKey)) + return m_Dict[aKey]; + else + return new JSONLazyCreator(this, aKey); + } + set + { + if (value == null) + value = JSONNull.CreateOrGet(); + if (m_Dict.ContainsKey(aKey)) + m_Dict[aKey] = value; + else + m_Dict.Add(aKey, value); + } + } + + public override JSONNode this[int aIndex] + { + get + { + if (aIndex < 0 || aIndex >= m_Dict.Count) + return null; + return m_Dict.ElementAt(aIndex).Value; + } + set + { + if (value == null) + value = JSONNull.CreateOrGet(); + if (aIndex < 0 || aIndex >= m_Dict.Count) + return; + string key = m_Dict.ElementAt(aIndex).Key; + m_Dict[key] = value; + } + } + + public override int Count + { + get { return m_Dict.Count; } + } + + public override void Add(string aKey, JSONNode aItem) + { + if (aItem == null) + aItem = JSONNull.CreateOrGet(); + + if (!string.IsNullOrEmpty(aKey)) + { + if (m_Dict.ContainsKey(aKey)) + m_Dict[aKey] = aItem; + else + m_Dict.Add(aKey, aItem); + } + else + m_Dict.Add(Guid.NewGuid().ToString(), aItem); + } + + public override JSONNode Remove(string aKey) + { + if (!m_Dict.ContainsKey(aKey)) + return null; + JSONNode tmp = m_Dict[aKey]; + m_Dict.Remove(aKey); + return tmp; + } + + public override JSONNode Remove(int aIndex) + { + if (aIndex < 0 || aIndex >= m_Dict.Count) + return null; + var item = m_Dict.ElementAt(aIndex); + m_Dict.Remove(item.Key); + return item.Value; + } + + public override JSONNode Remove(JSONNode aNode) + { + try + { + var item = m_Dict.Where(k => k.Value == aNode).First(); + m_Dict.Remove(item.Key); + return aNode; + } + catch + { + return null; + } + } + + public override IEnumerable Children + { + get + { + foreach (KeyValuePair N in m_Dict) + yield return N.Value; + } + } + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append('{'); + bool first = true; + if (inline) + aMode = JSONTextMode.Compact; + foreach (var k in m_Dict) + { + if (!first) + aSB.Append(','); + first = false; + if (aMode == JSONTextMode.Indent) + aSB.AppendLine(); + if (aMode == JSONTextMode.Indent) + aSB.Append(' ', aIndent + aIndentInc); + aSB.Append('\"').Append(Escape(k.Key)).Append('\"'); + if (aMode == JSONTextMode.Compact) + aSB.Append(':'); + else + aSB.Append(" : "); + k.Value.WriteToStringBuilder(aSB, aIndent + aIndentInc, aIndentInc, aMode); + } + if (aMode == JSONTextMode.Indent) + aSB.AppendLine().Append(' ', aIndent); + aSB.Append('}'); + } + + } + // End of JSONObject + + public partial class JSONString : JSONNode + { + private string m_Data; + + public override JSONNodeType Tag { get { return JSONNodeType.String; } } + public override bool IsString { get { return true; } } + + public override Enumerator GetEnumerator() { return new Enumerator(); } + + + public override string Value + { + get { return m_Data; } + set + { + m_Data = value; + } + } + + public JSONString(string aData) + { + m_Data = aData; + } + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append('\"').Append(Escape(m_Data)).Append('\"'); + } + public override bool Equals(object obj) + { + if (base.Equals(obj)) + return true; + string s = obj as string; + if (s != null) + return m_Data == s; + JSONString s2 = obj as JSONString; + if (s2 != null) + return m_Data == s2.m_Data; + return false; + } + public override int GetHashCode() + { + return m_Data.GetHashCode(); + } + } + // End of JSONString + + public partial class JSONNumber : JSONNode + { + private double m_Data; + + public override JSONNodeType Tag { get { return JSONNodeType.Number; } } + public override bool IsNumber { get { return true; } } + public override Enumerator GetEnumerator() { return new Enumerator(); } + + public override string Value + { + get { return m_Data.ToString(CultureInfo.InvariantCulture); } + set + { + double v; + if (double.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out v)) + m_Data = v; + } + } + + public override double AsDouble + { + get { return m_Data; } + set { m_Data = value; } + } + public override long AsLong + { + get { return (long)m_Data; } + set { m_Data = value; } + } + + public JSONNumber(double aData) + { + m_Data = aData; + } + + public JSONNumber(string aData) + { + Value = aData; + } + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append(Value); + } + private static bool IsNumeric(object value) + { + return value is int || value is uint + || value is float || value is double + || value is decimal + || value is long || value is ulong + || value is short || value is ushort + || value is sbyte || value is byte; + } + public override bool Equals(object obj) + { + if (obj == null) + return false; + if (base.Equals(obj)) + return true; + JSONNumber s2 = obj as JSONNumber; + if (s2 != null) + return m_Data == s2.m_Data; + if (IsNumeric(obj)) + return Convert.ToDouble(obj) == m_Data; + return false; + } + public override int GetHashCode() + { + return m_Data.GetHashCode(); + } + } + // End of JSONNumber + + public partial class JSONBool : JSONNode + { + private bool m_Data; + + public override JSONNodeType Tag { get { return JSONNodeType.Boolean; } } + public override bool IsBoolean { get { return true; } } + public override Enumerator GetEnumerator() { return new Enumerator(); } + + public override string Value + { + get { return m_Data.ToString(); } + set + { + bool v; + if (bool.TryParse(value, out v)) + m_Data = v; + } + } + public override bool AsBool + { + get { return m_Data; } + set { m_Data = value; } + } + + public JSONBool(bool aData) + { + m_Data = aData; + } + + public JSONBool(string aData) + { + Value = aData; + } + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append((m_Data) ? "true" : "false"); + } + public override bool Equals(object obj) + { + if (obj == null) + return false; + if (obj is bool) + return m_Data == (bool)obj; + return false; + } + public override int GetHashCode() + { + return m_Data.GetHashCode(); + } + } + // End of JSONBool + + public partial class JSONNull : JSONNode + { + static JSONNull m_StaticInstance = new JSONNull(); + public static bool reuseSameInstance = true; + public static JSONNull CreateOrGet() + { + if (reuseSameInstance) + return m_StaticInstance; + return new JSONNull(); + } + private JSONNull() { } + + public override JSONNodeType Tag { get { return JSONNodeType.NullValue; } } + public override bool IsNull { get { return true; } } + public override Enumerator GetEnumerator() { return new Enumerator(); } + + public override string Value + { + get { return "null"; } + set { } + } + public override bool AsBool + { + get { return false; } + set { } + } + + public override bool Equals(object obj) + { + if (object.ReferenceEquals(this, obj)) + return true; + return (obj is JSONNull); + } + public override int GetHashCode() + { + return 0; + } + + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append("null"); + } + } + // End of JSONNull + + internal partial class JSONLazyCreator : JSONNode + { + private JSONNode m_Node = null; + private string m_Key = null; + public override JSONNodeType Tag { get { return JSONNodeType.None; } } + public override Enumerator GetEnumerator() { return new Enumerator(); } + + public JSONLazyCreator(JSONNode aNode) + { + m_Node = aNode; + m_Key = null; + } + + public JSONLazyCreator(JSONNode aNode, string aKey) + { + m_Node = aNode; + m_Key = aKey; + } + + private T Set(T aVal) where T : JSONNode + { + if (m_Key == null) + m_Node.Add(aVal); + else + m_Node.Add(m_Key, aVal); + m_Node = null; // Be GC friendly. + return aVal; + } + + public override JSONNode this[int aIndex] + { + get { return new JSONLazyCreator(this); } + set { Set(new JSONArray()).Add(value); } + } + + public override JSONNode this[string aKey] + { + get { return new JSONLazyCreator(this, aKey); } + set { Set(new JSONObject()).Add(aKey, value); } + } + + public override void Add(JSONNode aItem) + { + Set(new JSONArray()).Add(aItem); + } + + public override void Add(string aKey, JSONNode aItem) + { + Set(new JSONObject()).Add(aKey, aItem); + } + + public static bool operator ==(JSONLazyCreator a, object b) + { + if (b == null) + return true; + return System.Object.ReferenceEquals(a, b); + } + + public static bool operator !=(JSONLazyCreator a, object b) + { + return !(a == b); + } + + public override bool Equals(object obj) + { + if (obj == null) + return true; + return System.Object.ReferenceEquals(this, obj); + } + + public override int GetHashCode() + { + return 0; + } + + public override int AsInt + { + get { Set(new JSONNumber(0)); return 0; } + set { Set(new JSONNumber(value)); } + } + + public override float AsFloat + { + get { Set(new JSONNumber(0.0f)); return 0.0f; } + set { Set(new JSONNumber(value)); } + } + + public override double AsDouble + { + get { Set(new JSONNumber(0.0)); return 0.0; } + set { Set(new JSONNumber(value)); } + } + + public override long AsLong + { + get + { + if (longAsString) + Set(new JSONString("0")); + else + Set(new JSONNumber(0.0)); + return 0L; + } + set + { + if (longAsString) + Set(new JSONString(value.ToString())); + else + Set(new JSONNumber(value)); + } + } + + public override bool AsBool + { + get { Set(new JSONBool(false)); return false; } + set { Set(new JSONBool(value)); } + } + + public override JSONArray AsArray + { + get { return Set(new JSONArray()); } + } + + public override JSONObject AsObject + { + get { return Set(new JSONObject()); } + } + internal override void WriteToStringBuilder(StringBuilder aSB, int aIndent, int aIndentInc, JSONTextMode aMode) + { + aSB.Append("null"); + } + } + // End of JSONLazyCreator + + public static class JSON + { + public static JSONNode Parse(string aJSON) + { + return JSONNode.Parse(aJSON); + } + } +} diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSON.cs.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSON.cs.meta new file mode 100644 index 0000000..7828349 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSON.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cb81df6cab146cb40a0ef2e57844fba8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONBinary.cs b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONBinary.cs new file mode 100644 index 0000000..a341251 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONBinary.cs @@ -0,0 +1,297 @@ +//#define USE_SharpZipLib +/* * * * * + * This is an extension of the SimpleJSON framework to provide methods to + * serialize a JSON object tree into a compact binary format. Optionally the + * binary stream can be compressed with the SharpZipLib when using the define + * "USE_SharpZipLib" + * + * Those methods where originally part of the framework but since it's rarely + * used I've extracted this part into this seperate module file. + * + * You can use the define "SimpleJSON_ExcludeBinary" to selectively disable + * this extension without the need to remove the file from the project. + * + * + * The MIT License (MIT) + * + * Copyright (c) 2012-2017 Markus Göbel (Bunny83) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * * * * */ +using System; + +namespace SimpleJSON +{ +#if !SimpleJSON_ExcludeBinary + public abstract partial class JSONNode + { + public abstract void SerializeBinary(System.IO.BinaryWriter aWriter); + + public void SaveToBinaryStream(System.IO.Stream aData) + { + var W = new System.IO.BinaryWriter(aData); + SerializeBinary(W); + } + +#if USE_SharpZipLib + public void SaveToCompressedStream(System.IO.Stream aData) + { + using (var gzipOut = new ICSharpCode.SharpZipLib.BZip2.BZip2OutputStream(aData)) + { + gzipOut.IsStreamOwner = false; + SaveToBinaryStream(gzipOut); + gzipOut.Close(); + } + } + + public void SaveToCompressedFile(string aFileName) + { + + System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName); + using(var F = System.IO.File.OpenWrite(aFileName)) + { + SaveToCompressedStream(F); + } + } + public string SaveToCompressedBase64() + { + using (var stream = new System.IO.MemoryStream()) + { + SaveToCompressedStream(stream); + stream.Position = 0; + return System.Convert.ToBase64String(stream.ToArray()); + } + } + +#else + public void SaveToCompressedStream(System.IO.Stream aData) + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } + + public void SaveToCompressedFile(string aFileName) + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } + + public string SaveToCompressedBase64() + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } +#endif + + public void SaveToBinaryFile(string aFileName) + { + System.IO.Directory.CreateDirectory((new System.IO.FileInfo(aFileName)).Directory.FullName); + using (var F = System.IO.File.OpenWrite(aFileName)) + { + SaveToBinaryStream(F); + } + } + + public string SaveToBinaryBase64() + { + using (var stream = new System.IO.MemoryStream()) + { + SaveToBinaryStream(stream); + stream.Position = 0; + return System.Convert.ToBase64String(stream.ToArray()); + } + } + + public static JSONNode DeserializeBinary(System.IO.BinaryReader aReader) + { + JSONNodeType type = (JSONNodeType)aReader.ReadByte(); + switch (type) + { + case JSONNodeType.Array: + { + int count = aReader.ReadInt32(); + JSONArray tmp = new JSONArray(); + for (int i = 0; i < count; i++) + tmp.Add(DeserializeBinary(aReader)); + return tmp; + } + case JSONNodeType.Object: + { + int count = aReader.ReadInt32(); + JSONObject tmp = new JSONObject(); + for (int i = 0; i < count; i++) + { + string key = aReader.ReadString(); + var val = DeserializeBinary(aReader); + tmp.Add(key, val); + } + return tmp; + } + case JSONNodeType.String: + { + return new JSONString(aReader.ReadString()); + } + case JSONNodeType.Number: + { + return new JSONNumber(aReader.ReadDouble()); + } + case JSONNodeType.Boolean: + { + return new JSONBool(aReader.ReadBoolean()); + } + case JSONNodeType.NullValue: + { + return JSONNull.CreateOrGet(); + } + default: + { + throw new Exception("Error deserializing JSON. Unknown tag: " + type); + } + } + } + +#if USE_SharpZipLib + public static JSONNode LoadFromCompressedStream(System.IO.Stream aData) + { + var zin = new ICSharpCode.SharpZipLib.BZip2.BZip2InputStream(aData); + return LoadFromStream(zin); + } + public static JSONNode LoadFromCompressedFile(string aFileName) + { + using(var F = System.IO.File.OpenRead(aFileName)) + { + return LoadFromCompressedStream(F); + } + } + public static JSONNode LoadFromCompressedBase64(string aBase64) + { + var tmp = System.Convert.FromBase64String(aBase64); + var stream = new System.IO.MemoryStream(tmp); + stream.Position = 0; + return LoadFromCompressedStream(stream); + } +#else + public static JSONNode LoadFromCompressedFile(string aFileName) + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } + + public static JSONNode LoadFromCompressedStream(System.IO.Stream aData) + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } + + public static JSONNode LoadFromCompressedBase64(string aBase64) + { + throw new Exception("Can't use compressed functions. You need include the SharpZipLib and uncomment the define at the top of SimpleJSON"); + } +#endif + + public static JSONNode LoadFromBinaryStream(System.IO.Stream aData) + { + using (var R = new System.IO.BinaryReader(aData)) + { + return DeserializeBinary(R); + } + } + + public static JSONNode LoadFromBinaryFile(string aFileName) + { + using (var F = System.IO.File.OpenRead(aFileName)) + { + return LoadFromBinaryStream(F); + } + } + + public static JSONNode LoadFromBinaryBase64(string aBase64) + { + var tmp = System.Convert.FromBase64String(aBase64); + var stream = new System.IO.MemoryStream(tmp); + stream.Position = 0; + return LoadFromBinaryStream(stream); + } + } + + public partial class JSONArray : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.Array); + aWriter.Write(m_List.Count); + for (int i = 0; i < m_List.Count; i++) + { + m_List[i].SerializeBinary(aWriter); + } + } + } + + public partial class JSONObject : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.Object); + aWriter.Write(m_Dict.Count); + foreach (string K in m_Dict.Keys) + { + aWriter.Write(K); + m_Dict[K].SerializeBinary(aWriter); + } + } + } + + public partial class JSONString : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.String); + aWriter.Write(m_Data); + } + } + + public partial class JSONNumber : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.Number); + aWriter.Write(m_Data); + } + } + + public partial class JSONBool : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.Boolean); + aWriter.Write(m_Data); + } + } + public partial class JSONNull : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + aWriter.Write((byte)JSONNodeType.NullValue); + } + } + internal partial class JSONLazyCreator : JSONNode + { + public override void SerializeBinary(System.IO.BinaryWriter aWriter) + { + + } + } +#endif +} diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONBinary.cs.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONBinary.cs.meta new file mode 100644 index 0000000..8be342f --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONBinary.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6b7c9134b21d6114f8b65e86ad5dc09b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONUnity.cs b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONUnity.cs new file mode 100644 index 0000000..63b42cb --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONUnity.cs @@ -0,0 +1,369 @@ +#region License and information +/* * * * * + * + * Unity extension for the SimpleJSON framework. It does only work together with + * the SimpleJSON.cs + * It provides several helpers and conversion operators to serialize/deserialize + * common Unity types such as Vector2/3/4, Rect, RectOffset, Quaternion and + * Matrix4x4 as JSONObject or JSONArray. + * This extension will add 3 static settings to the JSONNode class: + * ( VectorContainerType, QuaternionContainerType, RectContainerType ) which + * control what node type should be used for serializing the given type. So a + * Vector3 as array would look like [12,32,24] and {"x":12, "y":32, "z":24} as + * object. + * + * + * The MIT License (MIT) + * + * Copyright (c) 2012-2017 Markus Göbel (Bunny83) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * * * * */ + +#endregion License and information + +using UnityEngine; + +namespace SimpleJSON +{ + public enum JSONContainerType { Array, Object } + public partial class JSONNode + { + public static JSONContainerType VectorContainerType = JSONContainerType.Array; + public static JSONContainerType QuaternionContainerType = JSONContainerType.Array; + public static JSONContainerType RectContainerType = JSONContainerType.Array; + private static JSONNode GetContainer(JSONContainerType aType) + { + if (aType == JSONContainerType.Array) + return new JSONArray(); + return new JSONObject(); + } + + #region implicit conversion operators + public static implicit operator JSONNode(Vector2 aVec) + { + JSONNode n = GetContainer(VectorContainerType); + n.WriteVector2(aVec); + return n; + } + public static implicit operator JSONNode(Vector3 aVec) + { + JSONNode n = GetContainer(VectorContainerType); + n.WriteVector3(aVec); + return n; + } + public static implicit operator JSONNode(Vector4 aVec) + { + JSONNode n = GetContainer(VectorContainerType); + n.WriteVector4(aVec); + return n; + } + public static implicit operator JSONNode(Quaternion aRot) + { + JSONNode n = GetContainer(QuaternionContainerType); + n.WriteQuaternion(aRot); + return n; + } + public static implicit operator JSONNode(Rect aRect) + { + JSONNode n = GetContainer(RectContainerType); + n.WriteRect(aRect); + return n; + } + public static implicit operator JSONNode(RectOffset aRect) + { + JSONNode n = GetContainer(RectContainerType); + n.WriteRectOffset(aRect); + return n; + } + + public static implicit operator Vector2(JSONNode aNode) + { + return aNode.ReadVector2(); + } + public static implicit operator Vector3(JSONNode aNode) + { + return aNode.ReadVector3(); + } + public static implicit operator Vector4(JSONNode aNode) + { + return aNode.ReadVector4(); + } + public static implicit operator Quaternion(JSONNode aNode) + { + return aNode.ReadQuaternion(); + } + public static implicit operator Rect(JSONNode aNode) + { + return aNode.ReadRect(); + } + public static implicit operator RectOffset(JSONNode aNode) + { + return aNode.ReadRectOffset(); + } + #endregion implicit conversion operators + + #region Vector2 + public Vector2 ReadVector2(Vector2 aDefault) + { + if (IsObject) + return new Vector2(this["x"].AsFloat, this["y"].AsFloat); + if (IsArray) + return new Vector2(this[0].AsFloat, this[1].AsFloat); + return aDefault; + } + public Vector2 ReadVector2(string aXName, string aYName) + { + if (IsObject) + { + return new Vector2(this[aXName].AsFloat, this[aYName].AsFloat); + } + return Vector2.zero; + } + + public Vector2 ReadVector2() + { + return ReadVector2(Vector2.zero); + } + public JSONNode WriteVector2(Vector2 aVec, string aXName = "x", string aYName = "y") + { + if (IsObject) + { + Inline = true; + this[aXName].AsFloat = aVec.x; + this[aYName].AsFloat = aVec.y; + } + else if (IsArray) + { + Inline = true; + this[0].AsFloat = aVec.x; + this[1].AsFloat = aVec.y; + } + return this; + } + #endregion Vector2 + + #region Vector3 + public Vector3 ReadVector3(Vector3 aDefault) + { + if (IsObject) + return new Vector3(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat); + if (IsArray) + return new Vector3(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat); + return aDefault; + } + public Vector3 ReadVector3(string aXName, string aYName, string aZName) + { + if (IsObject) + return new Vector3(this[aXName].AsFloat, this[aYName].AsFloat, this[aZName].AsFloat); + return Vector3.zero; + } + public Vector3 ReadVector3() + { + return ReadVector3(Vector3.zero); + } + public JSONNode WriteVector3(Vector3 aVec, string aXName = "x", string aYName = "y", string aZName = "z") + { + if (IsObject) + { + Inline = true; + this[aXName].AsFloat = aVec.x; + this[aYName].AsFloat = aVec.y; + this[aZName].AsFloat = aVec.z; + } + else if (IsArray) + { + Inline = true; + this[0].AsFloat = aVec.x; + this[1].AsFloat = aVec.y; + this[2].AsFloat = aVec.z; + } + return this; + } + #endregion Vector3 + + #region Vector4 + public Vector4 ReadVector4(Vector4 aDefault) + { + if (IsObject) + return new Vector4(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat, this["w"].AsFloat); + if (IsArray) + return new Vector4(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat); + return aDefault; + } + public Vector4 ReadVector4() + { + return ReadVector4(Vector4.zero); + } + public JSONNode WriteVector4(Vector4 aVec) + { + if (IsObject) + { + Inline = true; + this["x"].AsFloat = aVec.x; + this["y"].AsFloat = aVec.y; + this["z"].AsFloat = aVec.z; + this["w"].AsFloat = aVec.w; + } + else if (IsArray) + { + Inline = true; + this[0].AsFloat = aVec.x; + this[1].AsFloat = aVec.y; + this[2].AsFloat = aVec.z; + this[3].AsFloat = aVec.w; + } + return this; + } + #endregion Vector4 + + #region Quaternion + public Quaternion ReadQuaternion(Quaternion aDefault) + { + if (IsObject) + return new Quaternion(this["x"].AsFloat, this["y"].AsFloat, this["z"].AsFloat, this["w"].AsFloat); + if (IsArray) + return new Quaternion(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat); + return aDefault; + } + public Quaternion ReadQuaternion() + { + return ReadQuaternion(Quaternion.identity); + } + public JSONNode WriteQuaternion(Quaternion aRot) + { + if (IsObject) + { + Inline = true; + this["x"].AsFloat = aRot.x; + this["y"].AsFloat = aRot.y; + this["z"].AsFloat = aRot.z; + this["w"].AsFloat = aRot.w; + } + else if (IsArray) + { + Inline = true; + this[0].AsFloat = aRot.x; + this[1].AsFloat = aRot.y; + this[2].AsFloat = aRot.z; + this[3].AsFloat = aRot.w; + } + return this; + } + #endregion Quaternion + + #region Rect + public Rect ReadRect(Rect aDefault) + { + if (IsObject) + return new Rect(this["x"].AsFloat, this["y"].AsFloat, this["width"].AsFloat, this["height"].AsFloat); + if (IsArray) + return new Rect(this[0].AsFloat, this[1].AsFloat, this[2].AsFloat, this[3].AsFloat); + return aDefault; + } + public Rect ReadRect() + { + return ReadRect(new Rect()); + } + public JSONNode WriteRect(Rect aRect) + { + if (IsObject) + { + Inline = true; + this["x"].AsFloat = aRect.x; + this["y"].AsFloat = aRect.y; + this["width"].AsFloat = aRect.width; + this["height"].AsFloat = aRect.height; + } + else if (IsArray) + { + Inline = true; + this[0].AsFloat = aRect.x; + this[1].AsFloat = aRect.y; + this[2].AsFloat = aRect.width; + this[3].AsFloat = aRect.height; + } + return this; + } + #endregion Rect + + #region RectOffset + public RectOffset ReadRectOffset(RectOffset aDefault) + { + if (this is JSONObject) + return new RectOffset(this["left"].AsInt, this["right"].AsInt, this["top"].AsInt, this["bottom"].AsInt); + if (this is JSONArray) + return new RectOffset(this[0].AsInt, this[1].AsInt, this[2].AsInt, this[3].AsInt); + return aDefault; + } + public RectOffset ReadRectOffset() + { + return ReadRectOffset(new RectOffset()); + } + public JSONNode WriteRectOffset(RectOffset aRect) + { + if (IsObject) + { + Inline = true; + this["left"].AsInt = aRect.left; + this["right"].AsInt = aRect.right; + this["top"].AsInt = aRect.top; + this["bottom"].AsInt = aRect.bottom; + } + else if (IsArray) + { + Inline = true; + this[0].AsInt = aRect.left; + this[1].AsInt = aRect.right; + this[2].AsInt = aRect.top; + this[3].AsInt = aRect.bottom; + } + return this; + } + #endregion RectOffset + + #region Matrix4x4 + public Matrix4x4 ReadMatrix() + { + Matrix4x4 result = Matrix4x4.identity; + if (IsArray) + { + for (int i = 0; i < 16; i++) + { + result[i] = this[i].AsFloat; + } + } + return result; + } + public JSONNode WriteMatrix(Matrix4x4 aMatrix) + { + if (IsArray) + { + Inline = true; + for (int i = 0; i < 16; i++) + { + this[i].AsFloat = aMatrix[i]; + } + } + return this; + } + #endregion Matrix4x4 + } +} diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONUnity.cs.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONUnity.cs.meta new file mode 100644 index 0000000..11822ed --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/SimpleJson/SimpleJSONUnity.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 654270d8a6b35bb4d820487fa92bc255 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser.meta new file mode 100644 index 0000000..be3cde2 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 97a61172c32476b43ba1a4b95cd2d16e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/IStandaloneFileBrowser.cs b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/IStandaloneFileBrowser.cs new file mode 100644 index 0000000..19c089d --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/IStandaloneFileBrowser.cs @@ -0,0 +1,13 @@ +using System; + +namespace SFB { + public interface IStandaloneFileBrowser { + string[] OpenFilePanel(string title, string directory, ExtensionFilter[] extensions, bool multiselect); + string[] OpenFolderPanel(string title, string directory, bool multiselect); + string SaveFilePanel(string title, string directory, string defaultName, ExtensionFilter[] extensions); + + void OpenFilePanelAsync(string title, string directory, ExtensionFilter[] extensions, bool multiselect, Action cb); + void OpenFolderPanelAsync(string title, string directory, bool multiselect, Action cb); + void SaveFilePanelAsync(string title, string directory, string defaultName, ExtensionFilter[] extensions, Action cb); + } +} diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/IStandaloneFileBrowser.cs.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/IStandaloneFileBrowser.cs.meta new file mode 100644 index 0000000..297c5e8 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/IStandaloneFileBrowser.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 7609f7b6787a54496aa41a3053fcc76a +timeCreated: 1483902788 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins.meta new file mode 100644 index 0000000..416e8f9 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: fabd0452d926f4a79b1a6ac2a3524117 +folderAsset: yes +timeCreated: 1483902786 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll new file mode 100644 index 0000000..5c6bcfa Binary files /dev/null and b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll differ diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll.meta new file mode 100644 index 0000000..13e560d --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/Ookii.Dialogs.dll.meta @@ -0,0 +1,145 @@ +fileFormatVersion: 2 +guid: e60958662eed5413d86143a0a69b731e +timeCreated: 1491979494 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXIntel: 1 + Exclude OSXIntel64: 1 + Exclude OSXUniversal: 1 + Exclude WebGL: 1 + Exclude Win: 0 + Exclude Win64: 0 + Exclude iOS: 1 + data: + first: + '': Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + OS: AnyOS + data: + first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + data: + first: + Any: + second: + enabled: 0 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + data: + first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + data: + first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + data: + first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: OSXIntel + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: OSXIntel64 + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: Win + second: + enabled: 1 + settings: + CPU: AnyCPU + data: + first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: AnyCPU + data: + first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + data: + first: + iPhone: iOS + second: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle.meta new file mode 100644 index 0000000..6bc6f5e --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle.meta @@ -0,0 +1,46 @@ +fileFormatVersion: 2 +guid: a2a9837b81577491baf2ffadec5e2852 +folderAsset: yes +timeCreated: 1491979493 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + Any: + second: + enabled: 0 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + data: + first: + Standalone: OSXIntel + second: + enabled: 1 + settings: {} + data: + first: + Standalone: OSXIntel64 + second: + enabled: 1 + settings: {} + data: + first: + Standalone: OSXUniversal + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents.meta new file mode 100644 index 0000000..2a5fc52 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 46dc4eb12fae14a349800ec0e97ac0c2 +folderAsset: yes +timeCreated: 1505756859 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/Info.plist b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/Info.plist new file mode 100644 index 0000000..f1e6248 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/Info.plist @@ -0,0 +1,46 @@ + + + + + BuildMachineOSBuild + 16G29 + CFBundleDevelopmentRegion + English + CFBundleExecutable + StandaloneFileBrowser + CFBundleIdentifier + com.gkngkc.sfb + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + StandaloneFileBrowser + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 1.0 + CSResourcesFileMapped + + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 9A235 + DTPlatformVersion + GM + DTSDKBuild + 17A360 + DTSDKName + macosx10.13 + DTXcode + 0900 + DTXcodeBuild + 9A235 + + diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/Info.plist.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/Info.plist.meta new file mode 100644 index 0000000..22c9f90 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/Info.plist.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ce685769797f44046afa3e567860c94c +timeCreated: 1505756861 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS.meta new file mode 100644 index 0000000..7b02f38 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: ee557323b3b2e4d0f8b4d5a2fdca2f1b +folderAsset: yes +timeCreated: 1505756861 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS/StandaloneFileBrowser b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS/StandaloneFileBrowser new file mode 100644 index 0000000..586df9f Binary files /dev/null and b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS/StandaloneFileBrowser differ diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS/StandaloneFileBrowser.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS/StandaloneFileBrowser.meta new file mode 100644 index 0000000..a298a74 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.bundle/Contents/MacOS/StandaloneFileBrowser.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: ddf122e0e89124ce78aacfeecb3ec554 +timeCreated: 1508179371 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib new file mode 100644 index 0000000..47b5634 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib @@ -0,0 +1,91 @@ +var StandaloneFileBrowserWebGLPlugin = { + // Open file. + // gameObjectNamePtr: GameObject name required for calling back unity side with SendMessage. And it should be unique + // filter(disabled): Filter files. Example filters: + // Match all image files: "image/*" + // Match all video files: "video/*" + // Match all audio files: "audio/*" + // Custom: ".plist,.xml,.yaml" + // multiselect(disabled): Allows multiple file selection + UploadFile: function(gameObjectNamePtr/*, filter, multiselect*/) { + gameObjectName = Pointer_stringify(gameObjectNamePtr); + + // Delete if element exist + var fileInput = document.getElementById(gameObjectName) + if (fileInput) { + document.body.removeChild(fileInput); + } + + fileInput = document.createElement('input'); + fileInput.setAttribute('id', gameObjectName); + fileInput.setAttribute('type', 'file'); + fileInput.setAttribute('style','display:none;'); + fileInput.setAttribute('style','visibility:hidden;'); + // if (multiselect) { + // fileInput.setAttribute('multiple', multiselect); + // } + // if (filter) { + // fileInput.setAttribute('accept', filter); + // } + fileInput.onclick = function (event) { + // File dialog opened + this.value = null; + }; + fileInput.onchange = function (event) { + // multiselect works + // for (var i = 0; i < event.target.files.length; i++) { + // console.log(URL.createObjectURL(event.target.files[i])); + // } + // File selected + SendMessage(gameObjectName, 'OnFileUploaded', URL.createObjectURL(event.target.files[0])); + + // Remove after file selected + document.body.removeChild(fileInput); + } + document.body.appendChild(fileInput); + + document.onmouseup = function() { + fileInput.click(); + document.onmouseup = null; + } + }, + + // Open folder. - NOT IMPLEMENTED + UploadFolder: function(gameObjectNamePtr) { + gameObjectName = Pointer_stringify(gameObjectNamePtr); + SendMessage(gameObjectName, 'OnFolderUploaded', ''); + }, + + // Save file + // DownloadFile method does not open SaveFileDialog like standalone builds, its just allows user to download file + // gameObjectNamePtr: GameObject name required for calling back unity side with SendMessage. And it should be unique + // DownloadFile does not return any info, just calls 'OnFileDownloaded' without any parameter + // filenamePtr: Filename with extension + // byteArray: byte[] + // byteArraySize: byte[].Length + DownloadFile: function(gameObjectNamePtr, filenamePtr, byteArray, byteArraySize) { + gameObjectName = Pointer_stringify(gameObjectNamePtr); + filename = Pointer_stringify(filenamePtr); + + var bytes = new Uint8Array(byteArraySize); + for (var i = 0; i < byteArraySize; i++) { + bytes[i] = HEAPU8[byteArray + i]; + } + + var downloader = window.document.createElement('a'); + downloader.setAttribute('id', gameObjectName); + downloader.href = window.URL.createObjectURL(new Blob([bytes], { type: 'application/octet-stream' })); + downloader.download = filename; + document.body.appendChild(downloader); + + document.onmouseup = function() { + downloader.click(); + document.body.removeChild(downloader); + document.onmouseup = null; + + SendMessage(gameObjectName, 'OnFileDownloaded'); + } + } +}; + +mergeInto(LibraryManager.library, StandaloneFileBrowserWebGLPlugin); \ No newline at end of file diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib.meta new file mode 100644 index 0000000..b4115d6 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/StandaloneFileBrowser.jslib.meta @@ -0,0 +1,39 @@ +fileFormatVersion: 2 +guid: 265aaf20a6d564e0fb00a9c4a7a9c300 +timeCreated: 1491979497 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + Any: + second: + enabled: 0 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 0 + settings: + DefaultValueInitialized: true + data: + first: + Facebook: WebGL + second: + enabled: 1 + settings: {} + data: + first: + WebGL: WebGL + second: + enabled: 1 + settings: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll new file mode 100644 index 0000000..f6d8475 Binary files /dev/null and b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll differ diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll.meta new file mode 100644 index 0000000..f757441 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Plugins/System.Windows.Forms.dll.meta @@ -0,0 +1,145 @@ +fileFormatVersion: 2 +guid: 7d459a96865cc4aaab657012c6dc4833 +timeCreated: 1491979494 +licenseType: Pro +PluginImporter: + serializedVersion: 2 + iconMap: {} + executionOrder: {} + isPreloaded: 0 + isOverridable: 0 + platformData: + data: + first: + '': Any + second: + enabled: 0 + settings: + Exclude Android: 1 + Exclude Editor: 0 + Exclude Linux: 1 + Exclude Linux64: 1 + Exclude LinuxUniversal: 1 + Exclude OSXIntel: 1 + Exclude OSXIntel64: 1 + Exclude OSXUniversal: 1 + Exclude WebGL: 1 + Exclude Win: 0 + Exclude Win64: 0 + Exclude iOS: 1 + data: + first: + '': Editor + second: + enabled: 0 + settings: + CPU: AnyCPU + OS: AnyOS + data: + first: + Android: Android + second: + enabled: 0 + settings: + CPU: ARMv7 + data: + first: + Any: + second: + enabled: 0 + settings: {} + data: + first: + Editor: Editor + second: + enabled: 1 + settings: + DefaultValueInitialized: true + data: + first: + Facebook: Win + second: + enabled: 0 + settings: + CPU: AnyCPU + data: + first: + Facebook: Win64 + second: + enabled: 0 + settings: + CPU: AnyCPU + data: + first: + Standalone: Linux + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: Linux64 + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: LinuxUniversal + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: OSXIntel + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: OSXIntel64 + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: OSXUniversal + second: + enabled: 0 + settings: + CPU: None + data: + first: + Standalone: Win + second: + enabled: 1 + settings: + CPU: AnyCPU + data: + first: + Standalone: Win64 + second: + enabled: 1 + settings: + CPU: AnyCPU + data: + first: + Windows Store Apps: WindowsStoreApps + second: + enabled: 0 + settings: + CPU: AnyCPU + data: + first: + iPhone: iOS + second: + enabled: 0 + settings: + CompileFlags: + FrameworkDependencies: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample.meta new file mode 100644 index 0000000..e7b41d4 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample.meta @@ -0,0 +1,9 @@ +fileFormatVersion: 2 +guid: 3f5dfc38c7ff8490b8d3d8c600024d7f +folderAsset: yes +timeCreated: 1483902786 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSample.cs b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSample.cs new file mode 100644 index 0000000..77e427f --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSample.cs @@ -0,0 +1,119 @@ +using System.Collections; +using UnityEngine; +using SFB; + +public class BasicSample : MonoBehaviour { + private string _path; + + void OnGUI() { + var guiScale = new Vector3(Screen.width / 800.0f, Screen.height / 600.0f, 1.0f); + GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, guiScale); + + GUILayout.Space(20); + GUILayout.BeginHorizontal(); + GUILayout.Space(20); + GUILayout.BeginVertical(); + + // Open File Samples + + if (GUILayout.Button("Open File")) { + WriteResult(StandaloneFileBrowser.OpenFilePanel("Open File", "", "", false)); + } + GUILayout.Space(5); + if (GUILayout.Button("Open File Async")) { + StandaloneFileBrowser.OpenFilePanelAsync("Open File", "", "", false, (string[] paths) => { WriteResult(paths); }); + } + GUILayout.Space(5); + if (GUILayout.Button("Open File Multiple")) { + WriteResult(StandaloneFileBrowser.OpenFilePanel("Open File", "", "", true)); + } + GUILayout.Space(5); + if (GUILayout.Button("Open File Extension")) { + WriteResult(StandaloneFileBrowser.OpenFilePanel("Open File", "", "txt", true)); + } + GUILayout.Space(5); + if (GUILayout.Button("Open File Directory")) { + WriteResult(StandaloneFileBrowser.OpenFilePanel("Open File", Application.dataPath, "", true)); + } + GUILayout.Space(5); + if (GUILayout.Button("Open File Filter")) { + var extensions = new [] { + new ExtensionFilter("Image Files", "png", "jpg", "jpeg" ), + new ExtensionFilter("Sound Files", "mp3", "wav" ), + new ExtensionFilter("All Files", "*" ), + }; + WriteResult(StandaloneFileBrowser.OpenFilePanel("Open File", "", extensions, true)); + } + + GUILayout.Space(15); + + // Open Folder Samples + + if (GUILayout.Button("Open Folder")) { + var paths = StandaloneFileBrowser.OpenFolderPanel("Select Folder", "", true); + WriteResult(paths); + } + GUILayout.Space(5); + if (GUILayout.Button("Open Folder Async")) { + StandaloneFileBrowser.OpenFolderPanelAsync("Select Folder", "", true, (string[] paths) => { WriteResult(paths); }); + } + GUILayout.Space(5); + if (GUILayout.Button("Open Folder Directory")) { + var paths = StandaloneFileBrowser.OpenFolderPanel("Select Folder", Application.dataPath, true); + WriteResult(paths); + } + + GUILayout.Space(15); + + // Save File Samples + + if (GUILayout.Button("Save File")) { + _path = StandaloneFileBrowser.SaveFilePanel("Save File", "", "", ""); + } + GUILayout.Space(5); + if (GUILayout.Button("Save File Async")) { + StandaloneFileBrowser.SaveFilePanelAsync("Save File", "", "", "", (string path) => { WriteResult(path); }); + } + GUILayout.Space(5); + if (GUILayout.Button("Save File Default Name")) { + _path = StandaloneFileBrowser.SaveFilePanel("Save File", "", "MySaveFile", ""); + } + GUILayout.Space(5); + if (GUILayout.Button("Save File Default Name Ext")) { + _path = StandaloneFileBrowser.SaveFilePanel("Save File", "", "MySaveFile", "dat"); + } + GUILayout.Space(5); + if (GUILayout.Button("Save File Directory")) { + _path = StandaloneFileBrowser.SaveFilePanel("Save File", Application.dataPath, "", ""); + } + GUILayout.Space(5); + if (GUILayout.Button("Save File Filter")) { + // Multiple save extension filters with more than one extension support. + var extensionList = new [] { + new ExtensionFilter("Binary", "bin"), + new ExtensionFilter("Text", "txt"), + }; + _path = StandaloneFileBrowser.SaveFilePanel("Save File", "", "MySaveFile", extensionList); + } + + GUILayout.EndVertical(); + GUILayout.Space(20); + GUILayout.Label(_path); + GUILayout.EndHorizontal(); + } + + public void WriteResult(string[] paths) { + if (paths.Length == 0) { + return; + } + + _path = ""; + foreach (var p in paths) { + _path += p + "\n"; + } + } + + public void WriteResult(string path) { + _path = path; + } +} diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSample.cs.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSample.cs.meta new file mode 100644 index 0000000..9319b42 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSample.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 5148400295519405d82bb0fa65246ea2 +timeCreated: 1483902788 +licenseType: Pro +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSampleScene.unity b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSampleScene.unity new file mode 100644 index 0000000..d370ffc --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSampleScene.unity @@ -0,0 +1,220 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 7 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 3 + m_SkyboxMaterial: {fileID: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1} +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 7 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_TemporalCoherenceThreshold: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 0 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 4 + m_Resolution: 2 + m_BakeResolution: 40 + m_TextureWidth: 1024 + m_TextureHeight: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_DirectLightInLightProbes: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_LightingDataAsset: {fileID: 0} + m_RuntimeCPUUsage: 25 +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 2 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + accuratePlacement: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &382763637 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 382763642} + - component: {fileID: 382763641} + - component: {fileID: 382763640} + - component: {fileID: 382763639} + - component: {fileID: 382763638} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &382763638 +AudioListener: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 382763637} + m_Enabled: 1 +--- !u!124 &382763639 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 382763637} + m_Enabled: 1 +--- !u!92 &382763640 +Behaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 382763637} + m_Enabled: 1 +--- !u!20 &382763641 +Camera: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 382763637} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 1 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 + m_StereoMirrorMode: 0 +--- !u!4 &382763642 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 382763637} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &986049433 +GameObject: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + serializedVersion: 5 + m_Component: + - component: {fileID: 986049435} + - component: {fileID: 986049434} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &986049434 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 986049433} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5148400295519405d82bb0fa65246ea2, type: 3} + m_Name: + m_EditorClassIdentifier: +--- !u!4 &986049435 +Transform: + m_ObjectHideFlags: 0 + m_PrefabParentObject: {fileID: 0} + m_PrefabInternal: {fileID: 0} + m_GameObject: {fileID: 986049433} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 0} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSampleScene.unity.meta b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSampleScene.unity.meta new file mode 100644 index 0000000..e012535 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/BasicSampleScene.unity.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: d97280fe82b874466870f709c3315d41 +timeCreated: 1483902786 +licenseType: Pro +DefaultImporter: + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs new file mode 100644 index 0000000..8ff7da9 --- /dev/null +++ b/Assets/Editor/Editor Addon/JsonViewer/Third Party/StandaloneFileBrowser/Sample/CanvasSampleOpenFileImage.cs @@ -0,0 +1,60 @@ +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using UnityEngine; +using UnityEngine.UI; +using UnityEngine.EventSystems; +using SFB; + +[RequireComponent(typeof(Button))] +public class CanvasSampleOpenFileImage : MonoBehaviour, IPointerDownHandler { + public string Title = ""; + public string FileName = ""; + public string Directory = ""; + public string Extension = ""; + public bool Multiselect = false; + + public RawImage output; + +#if UNITY_WEBGL && !UNITY_EDITOR + // + // WebGL + // + [DllImport("__Internal")] + private static extern void UploadFile(string id); + + public void OnPointerDown(PointerEventData eventData) { + UploadFile(gameObject.name); + } + + // Called from browser + public void OnFileUploaded(string url) { + StartCoroutine(OutputRoutine(url)); + } +#else + // + // Standalone platforms & editor + // + public void OnPointerDown(PointerEventData eventData) { } + + void Start() { + var button = GetComponent