From f499ba82675899069550b573a9fdc3c80c2d7321 Mon Sep 17 00:00:00 2001 From: mattak Date: Wed, 11 Aug 2021 11:16:07 +0900 Subject: [PATCH] :recycle: fix/minijson move MiniJSON --- Assets/Plugins/MiniJSON.meta | 3 +- .../Scripts/Experimental/Editor/MiniJSON.meta | 3 ++ .../Experimental/Editor}/MiniJSON/MiniJSON.cs | 2 +- .../Editor}/MiniJSON/MiniJSON.cs.meta | 0 .../Editor/StateJsonFileWrapperInspector.cs | 33 ++++++++++--------- 5 files changed, 23 insertions(+), 18 deletions(-) create mode 100644 Assets/Plugins/Unidux/Scripts/Experimental/Editor/MiniJSON.meta rename Assets/Plugins/{ => Unidux/Scripts/Experimental/Editor}/MiniJSON/MiniJSON.cs (99%) rename Assets/Plugins/{ => Unidux/Scripts/Experimental/Editor}/MiniJSON/MiniJSON.cs.meta (100%) diff --git a/Assets/Plugins/MiniJSON.meta b/Assets/Plugins/MiniJSON.meta index fd00747..dfc7c12 100644 --- a/Assets/Plugins/MiniJSON.meta +++ b/Assets/Plugins/MiniJSON.meta @@ -1,9 +1,8 @@ fileFormatVersion: 2 guid: 0aae60de32a1f4244be8d8e41dc8abf9 folderAsset: yes -timeCreated: 1497112048 -licenseType: Free DefaultImporter: + externalObjects: {} userData: assetBundleName: assetBundleVariant: diff --git a/Assets/Plugins/Unidux/Scripts/Experimental/Editor/MiniJSON.meta b/Assets/Plugins/Unidux/Scripts/Experimental/Editor/MiniJSON.meta new file mode 100644 index 0000000..7d5f04c --- /dev/null +++ b/Assets/Plugins/Unidux/Scripts/Experimental/Editor/MiniJSON.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: dfb260c37d7c487684b263a797acce3c +timeCreated: 1628648090 \ No newline at end of file diff --git a/Assets/Plugins/MiniJSON/MiniJSON.cs b/Assets/Plugins/Unidux/Scripts/Experimental/Editor/MiniJSON/MiniJSON.cs similarity index 99% rename from Assets/Plugins/MiniJSON/MiniJSON.cs rename to Assets/Plugins/Unidux/Scripts/Experimental/Editor/MiniJSON/MiniJSON.cs index 513f1c0..b526737 100644 --- a/Assets/Plugins/MiniJSON/MiniJSON.cs +++ b/Assets/Plugins/Unidux/Scripts/Experimental/Editor/MiniJSON/MiniJSON.cs @@ -32,7 +32,7 @@ using System.IO; using System.Text; -namespace MiniJSON { +namespace Unidux.Experimental.Editor.MiniJSON { // Example usage: // // using UnityEngine; diff --git a/Assets/Plugins/MiniJSON/MiniJSON.cs.meta b/Assets/Plugins/Unidux/Scripts/Experimental/Editor/MiniJSON/MiniJSON.cs.meta similarity index 100% rename from Assets/Plugins/MiniJSON/MiniJSON.cs.meta rename to Assets/Plugins/Unidux/Scripts/Experimental/Editor/MiniJSON/MiniJSON.cs.meta diff --git a/Assets/Plugins/Unidux/Scripts/Experimental/Editor/StateJsonFileWrapperInspector.cs b/Assets/Plugins/Unidux/Scripts/Experimental/Editor/StateJsonFileWrapperInspector.cs index 3a7e7be..0928258 100644 --- a/Assets/Plugins/Unidux/Scripts/Experimental/Editor/StateJsonFileWrapperInspector.cs +++ b/Assets/Plugins/Unidux/Scripts/Experimental/Editor/StateJsonFileWrapperInspector.cs @@ -3,7 +3,7 @@ using System.IO; using System.Linq; using System.Text; -using MiniJSON; +using Unidux.Experimental.Editor.MiniJSON; using UnityEditor; using UnityEngine; @@ -20,7 +20,7 @@ public class StateJsonFileWrapperInspector : UnityEditor.Editor public override void OnInspectorGUI() { - StateJsonFileWrapper wrapper = (StateJsonFileWrapper) target; + StateJsonFileWrapper wrapper = (StateJsonFileWrapper)target; RenderHeader(wrapper); @@ -73,11 +73,13 @@ private void RenderHeader(StateJsonFileWrapper wrapper) { System.Diagnostics.Process.Start("/usr/bin/open", wrapper.FileName); } + if (GUILayout.Button("OpenDir", EditorStyles.miniButton)) { System.Diagnostics.Process.Start("/usr/bin/open", Path.GetDirectoryName(wrapper.FileName)); } } + EditorGUILayout.EndHorizontal(); } @@ -105,13 +107,13 @@ private bool RenderJsonDictionary(string[] parentsKey, Dictionary int.MaxValue || __value < int.MinValue) { Debug.LogWarning("StateJsonEditor not handled long size value => " + __value); } - int value = (int) __value; + int value = (int)__value; int newValue = EditorGUILayout.DelayedIntField(key, value); if (newValue != value) @@ -122,7 +124,7 @@ private bool RenderJsonDictionary(string[] parentsKey, Dictionary) _value); + dirty = RenderJsonArray(newParentsKey, key, (List)_value); } } else if (_value is Dictionary) @@ -165,7 +167,7 @@ private bool RenderJsonDictionary(string[] parentsKey, Dictionary) _value); + dirty = RenderJsonDictionary(newParentsKey, (Dictionary)_value); } } else @@ -200,13 +202,13 @@ private bool RenderJsonArray(string[] parentsKey, string arrayKey, List else if (_value is long) { // XXX: There are no DelayedLongField - long __value = (long) _value; + long __value = (long)_value; if (__value > int.MaxValue || __value < int.MinValue) { Debug.LogWarning("StateJsonEditor not handled long size value => " + __value); } - int value = (int) __value; + int value = (int)__value; int newValue = EditorGUILayout.DelayedIntField(key, value); if (newValue != value) @@ -217,7 +219,7 @@ private bool RenderJsonArray(string[] parentsKey, string arrayKey, List } else if (_value is double) { - double value = (double) _value; + double value = (double)_value; double newValue = EditorGUILayout.DelayedDoubleField(key, value); if (newValue != value) @@ -228,7 +230,7 @@ private bool RenderJsonArray(string[] parentsKey, string arrayKey, List } else if (_value is bool) { - bool value = (bool) _value; + bool value = (bool)_value; bool newValue = EditorGUILayout.Toggle(key, value); if (newValue != value) @@ -302,7 +304,7 @@ private bool CustomFold(string title, bool display) private string[] CreateParentsKey(string[] parentsKey, string key) { - if (parentsKey == null) return new string[] {key}; + if (parentsKey == null) return new string[] { key }; var list = new List(parentsKey); list.Add(key); return list.ToArray(); @@ -316,7 +318,8 @@ private string CreateFoldoutKey(string[] parentsKey) private string CreateDisplayKey(string[] parentsKey) { if (parentsKey.Length == 1) return parentsKey[0]; - return new StringBuilder(new string('.', parentsKey.Length-1)).Append(parentsKey.LastOrDefault()).ToString(); + return new StringBuilder(new string('.', parentsKey.Length - 1)).Append(parentsKey.LastOrDefault()) + .ToString(); } private bool ShouldFoldout(string name, string foldoutKey) @@ -327,4 +330,4 @@ private bool ShouldFoldout(string name, string foldoutKey) return this.foldoutMap[foldoutKey]; } } -} +} \ No newline at end of file