コード例 #1
0
        /** 鍵作成。
         */
        public static void CreatePublicKeyPrivateKey(Fee.File.Path a_public_key, Fee.File.Path a_private_key)
        {
            string t_public_key;
            string t_private_key;

            if (CreateCryptKey(out t_public_key, out t_private_key) == true)
            {
                //public
                {
                    Fee.JsonItem.JsonItem t_jsonitem        = new Fee.JsonItem.JsonItem(new Fee.JsonItem.Value_AssociativeArray());
                    Fee.JsonItem.JsonItem t_jsonitem_public = new Fee.JsonItem.JsonItem(new Fee.JsonItem.Value_StringData(t_public_key));
                    t_jsonitem.SetItem("public", t_jsonitem_public, false);

                    Utility.WriteJsonFile(a_public_key, t_jsonitem, true);
                }

                //private
                {
                    Fee.JsonItem.JsonItem t_jsonitem         = new Fee.JsonItem.JsonItem(new Fee.JsonItem.Value_AssociativeArray());
                    Fee.JsonItem.JsonItem t_jsonitem_private = new Fee.JsonItem.JsonItem(new Fee.JsonItem.Value_StringData(t_private_key));
                    t_jsonitem.SetItem("private", t_jsonitem_private, false);

                    Utility.WriteJsonFile(a_private_key, t_jsonitem, true);
                }

                UnityEditor.AssetDatabase.Refresh();
            }
        }
コード例 #2
0
        /** 更新。
         */
        public static void Main(string a_label = nameof(Test_05))
        {
            UnityEngine.Debug.Log("----- " + a_label + " -----");

            try{
                Item t_item_from = new Item();
                {
                    t_item_from.type = Type.Value;

                    t_item_from.type_byte_min   = Type_Byte.Min;
                    t_item_from.type_sbyte_min  = Type_SByte.Min;
                    t_item_from.type_short_min  = Type_Short.Min;
                    t_item_from.type_ushort_min = Type_Ushort.Min;
                    t_item_from.type_int_min    = Type_Int.Min;
                    t_item_from.type_uint_min   = Type_Uint.Min;
                    t_item_from.type_long_min   = Type_Long.Min;
                    t_item_from.type_ulong_min  = Type_Ulong.Min;

                    t_item_from.type_byte_max   = Type_Byte.Max;
                    t_item_from.type_sbyte_max  = Type_SByte.Max;
                    t_item_from.type_short_max  = Type_Short.Max;
                    t_item_from.type_ushort_max = Type_Ushort.Max;
                    t_item_from.type_int_max    = Type_Int.Max;
                    t_item_from.type_uint_max   = Type_Uint.Max;
                    t_item_from.type_long_max   = Type_Long.Max;
                    t_item_from.type_ulong_max  = Type_Ulong.Max;
                }

                //オブジェクト ==> JSONITEM。
                                #if (FEE_JSON)
                Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <Item>(t_item_from);
                                #endif

                //JSONITEM ==> JSON文字列。
                                #if (FEE_JSON)
                string t_jsonstring = t_jsonitem.ConvertToJsonString();
                                #else
                string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from);
                                #endif

                //JSON文字列 ==> オブジェクト。
                                #if (FEE_JSON)
                Item t_item_to = Fee.JsonItem.Convert.JsonStringToObject <Item>(t_jsonstring);
                                #else
                Item t_item_to = UnityEngine.JsonUtility.FromJson <Item>(t_jsonstring);
                                #endif

                //ログ。
                UnityEngine.Debug.Log(a_label + " : " + t_jsonstring);

                //チェック。
                if (Check(t_item_from, t_item_to) == false)
                {
                    UnityEngine.Debug.LogError("mismatch");
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message);
            }
        }
コード例 #3
0
        /** constructor
         */
        public ExcelToJsonSheet()
        {
            //excel
            this.excel = null;

            //jsonitem_jsonsheet
            this.jsonitem_jsonsheet = null;
        }
コード例 #4
0
        /** 更新。
         */
        public static void Main(string a_label = nameof(Test_28))
        {
            UnityEngine.Debug.Log("----- " + a_label + " -----");

            try{
                Item t_item_from = new Item();
                {
                    System.Collections.Generic.Dictionary <Type_Key, int> t_list_type = new System.Collections.Generic.Dictionary <Type_Key, int>();
                    t_list_type.Add(Type_Key.Key_A, 100);
                    t_list_type.Add(Type_Key.Key_B, 200);
                    t_list_type.Add(Type_Key.Key_C, 300);

                    System.Collections.Generic.Dictionary <int, int> t_list_int = new System.Collections.Generic.Dictionary <int, int>();
                    t_list_int.Add(1, 100);
                    t_list_int.Add(2, 200);
                    t_list_int.Add(3, 300);

                    System.Collections.Generic.Dictionary <Item_Key, int> t_list_class = new System.Collections.Generic.Dictionary <Item_Key, int>();
                    t_list_class.Add(new Item_Key(1), 100);
                    t_list_class.Add(new Item_Key(2), 200);
                    t_list_class.Add(new Item_Key(3), 300);

                    t_item_from.list_int   = t_list_int;
                    t_item_from.list_type  = t_list_type;
                    t_item_from.list_class = t_list_class;
                }

                //オブジェクト ==> JSONITEM。
                                #if (FEE_JSON)
                Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <Item>(t_item_from);
                                #endif

                //JSONITEM ==> JSON文字列。
                                #if (FEE_JSON)
                string t_jsonstring = t_jsonitem.ConvertToJsonString();
                                #else
                string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from);
                                #endif

                //JSON文字列 ==> オブジェクト。
                                #if (FEE_JSON)
                Item t_item_to = Fee.JsonItem.Convert.JsonStringToObject <Item>(t_jsonstring);
                                #else
                Item t_item_to = UnityEngine.JsonUtility.FromJson <Item>(t_jsonstring);
                                #endif

                //ログ。
                UnityEngine.Debug.Log(a_label + " : " + t_jsonstring);

                //チェック。
                if (Check(t_item_from, t_item_to) == false)
                {
                    UnityEngine.Debug.LogError("mismatch");
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message);
            }
        }
コード例 #5
0
        /** CoroutineMain
         */
        public System.Collections.IEnumerator CoroutineMain(OnSoundPoolCoroutine_CallBackInterface a_callback_interface, Fee.File.Path a_path)
        {
            //result
            this.result = new ResultType();

            //ローカル、パックJSONのロード。
            Fee.JsonItem.JsonItem t_local_pack_json = null;
            {
                Fee.File.Item t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadLocalTextFile, a_path);

                do
                {
                    if (a_callback_interface != null)
                    {
                        a_callback_interface.OnSoundPoolCoroutine(t_item.GetResultProgress());
                    }
                    yield return(null);
                }while(t_item.IsBusy() == true);

                if (t_item.GetResultAssetType() == Asset.AssetType.Text)
                {
                    t_local_pack_json = new JsonItem.JsonItem(t_item.GetResultAssetText());
                    if (t_local_pack_json == null)
                    {
                        //コンバート失敗。
                        this.result.errorstring = "Coroutine_LoadLocalPack : local_pack_json == null";
                        yield break;
                    }
                }
                else
                {
                    //ローカルにキャッシュなし。
                }
            }

            Pack t_local_pack = Fee.JsonItem.Convert.JsonItemToObject <Pack>(t_local_pack_json);

            if (t_local_pack == null)
            {
                //コンバート失敗。
                this.result.errorstring = "Coroutine_LoadLocalPack : local_pack == null";
                yield break;
            }

            //パス解決。
            {
                t_local_pack.fullpath_list = new System.Collections.Generic.List <File.Path>();
                for (int ii = 0; ii < t_local_pack.name_list.Count; ii++)
                {
                    t_local_pack.fullpath_list.Add(File.Path.CreateLocalPath(t_local_pack.name_list[ii], Fee.File.Path.SEPARATOR));
                }
            }

            this.result.pack = t_local_pack;
            yield break;
        }
コード例 #6
0
ファイル: JsonViewer.cs プロジェクト: bluebackblue/jsontest
        /** スクロール作成。
         */
        public void CreateScroll(int a_layer, Fee.JsonItem.JsonItem a_parent_jsonitem)
        {
            this.DeleteScroll(a_layer);

            Fee.Ui.Scroll <JsonViewer_Item> t_scroll = Fee.Ui.Scroll <JsonViewer_Item> .Create(null, DrawPriority, Fee.Ui.Scroll_Type.Vertical, JsonViewer_Item.GetH());

            {
                t_scroll.SetRect(100 + this.scroll.Count * (JsonViewer_Item.GetW() + 2), 100, JsonViewer_Item.GetW(), Fee.Render2D.Config.VIRTUAL_H - 200);

                switch (a_parent_jsonitem.GetValueType())
                {
                case Fee.JsonItem.ValueType.AssociativeArray:
                {
                    if (a_parent_jsonitem.GetListMax() == 0)
                    {
                        JsonViewer_Item t_scrollitem = new JsonViewer_Item("リストが空", this, this.scroll.Count, null);
                        t_scroll.PushItem(t_scrollitem);
                    }
                    else
                    {
                        foreach (string t_key_string in a_parent_jsonitem.GetAssociativeKeyList())
                        {
                            JsonViewer_Item t_scrollitem = new JsonViewer_Item(t_key_string, this, this.scroll.Count, a_parent_jsonitem.GetItem(t_key_string));
                            t_scroll.PushItem(t_scrollitem);
                        }
                    }
                } break;

                case Fee.JsonItem.ValueType.IndexArray:
                {
                    if (a_parent_jsonitem.GetListMax() == 0)
                    {
                        JsonViewer_Item t_scrollitem = new JsonViewer_Item("リストが空", this, this.scroll.Count, null);
                        t_scroll.PushItem(t_scrollitem);
                    }
                    else
                    {
                        for (int ii = 0; ii < a_parent_jsonitem.GetListMax(); ii++)
                        {
                            JsonViewer_Item t_scrollitem = new JsonViewer_Item("[" + ii.ToString() + "]", this, this.scroll.Count, a_parent_jsonitem.GetItem(ii));
                            t_scroll.PushItem(t_scrollitem);
                        }
                    }
                } break;

                default:
                {
                    JsonViewer_Item t_scrollitem = new JsonViewer_Item("", this, this.scroll.Count, a_parent_jsonitem);
                    t_scroll.PushItem(t_scrollitem);
                } break;
                }
            }
            this.scroll.Add(t_scroll);
        }
コード例 #7
0
        /** 更新。
         */
        public static void Main(string a_label = nameof(Test_02))
        {
            UnityEngine.Debug.Log("----- " + a_label + " -----");

            try{
                Item t_item_from = new Item();
                {
                    t_item_from.value_bool        = false;
                    t_item_from.value_sbyte       = sbyte.MinValue;
                    t_item_from.value_byte        = byte.MinValue;
                    t_item_from.value_short       = short.MinValue;
                    t_item_from.value_ushort      = ushort.MinValue;
                    t_item_from.value_int         = int.MinValue;
                    t_item_from.value_uint        = uint.MinValue;
                    t_item_from.value_long        = long.MinValue;
                    t_item_from.value_ulong       = ulong.MinValue;
                    t_item_from.value_char        = char.MinValue;
                    t_item_from.value_float       = float.MinValue;
                    t_item_from.value_double      = double.MinValue;
                    t_item_from.value_decimal     = decimal.MinValue;
                    t_item_from.value_decimal_min = 0.0000000000000000000000000001m;
                }

                //オブジェクト ==> JSONITEM。
                                #if (FEE_JSON)
                Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <Item>(t_item_from);
                                #endif

                //JSONITEM ==> JSON文字列。
                                #if (FEE_JSON)
                string t_jsonstring = t_jsonitem.ConvertToJsonString();
                                #else
                string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from);
                                #endif

                //JSON文字列 ==> オブジェクト。
                                #if (FEE_JSON)
                Item t_item_to = Fee.JsonItem.Convert.JsonStringToObject <Item>(t_jsonstring);
                                #else
                Item t_item_to = UnityEngine.JsonUtility.FromJson <Item>(t_jsonstring);
                                #endif

                //ログ。
                UnityEngine.Debug.Log(a_label + " : " + t_jsonstring);

                //チェック。
                if (Check(t_item_from, t_item_to) == false)
                {
                    UnityEngine.Debug.LogError("mismatch");
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message);
            }
        }
コード例 #8
0
        /** 更新。
         */
        public static void Main(string a_label = nameof(Test_16))
        {
            UnityEngine.Debug.Log("----- " + a_label + " -----");

            try{
                Item t_item_from = new Item();
                {
                    //value_class
                    t_item_from.value_class = null;

                    //value_string
                    t_item_from.value_string = null;

                    //value_list
                    t_item_from.value_list = null;

                    //value_dictionary
                    t_item_from.value_dictionary = null;

                    //value_array
                    t_item_from.value_array = null;
                }

                //オブジェクト ==> JSONITEM。
                                #if (FEE_JSON)
                Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <Item>(t_item_from);
                                #endif

                //JSONITEM ==> JSON文字列。
                                #if (FEE_JSON)
                string t_jsonstring = t_jsonitem.ConvertToJsonString();
                                #else
                string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from);
                                #endif

                //JSON文字列 ==> オブジェクト。
                                #if (FEE_JSON)
                Item t_item_to = Fee.JsonItem.Convert.JsonStringToObject <Item>(t_jsonstring);
                                #else
                Item t_item_to = UnityEngine.JsonUtility.FromJson <Item>(t_jsonstring);
                                #endif

                //ログ。
                UnityEngine.Debug.Log(a_label + " : " + t_jsonstring);

                //チェック。
                if (Check(t_item_from, t_item_to) == false)
                {
                    UnityEngine.Debug.LogError("mismatch");
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message);
            }
        }
コード例 #9
0
ファイル: Test_19.cs プロジェクト: bluebackblue/jsontest
        /** 更新。
         */
        public static void Main(string a_label = nameof(Test_19))
        {
            UnityEngine.Debug.Log("----- " + a_label + " -----");

            try{
                Item t_item_from = new Item();
                {
                    t_item_from.sorted_dictionary = new System.Collections.Generic.SortedDictionary <string, int>();
                    t_item_from.sorted_dictionary.Add("value_1", 1);
                    t_item_from.sorted_dictionary.Add("value_2", 2);
                    t_item_from.sorted_dictionary.Add("value_3", 3);

                    t_item_from.sorted_list = new System.Collections.Generic.SortedList <string, int>();
                    t_item_from.sorted_list.Add("value_1", 1);
                    t_item_from.sorted_list.Add("value_2", 2);
                    t_item_from.sorted_list.Add("value_3", 3);
                }

                //オブジェクト ==> JSONITEM。
                                #if (FEE_JSON)
                Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <Item>(t_item_from);
                                #endif

                //JSONITEM ==> JSON文字列。
                                #if (FEE_JSON)
                string t_jsonstring = t_jsonitem.ConvertToJsonString();
                                #else
                string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from);
                                #endif

                //JSON文字列 ==> オブジェクト。
                                #if (FEE_JSON)
                Item t_item_to = Fee.JsonItem.Convert.JsonStringToObject <Item>(t_jsonstring);
                                #else
                Item t_item_to = UnityEngine.JsonUtility.FromJson <Item>(t_jsonstring);
                                #endif

                //ログ。
                UnityEngine.Debug.Log(a_label + " : " + t_jsonstring);

                //チェック。
                if (Check(t_item_from, t_item_to) == false)
                {
                    UnityEngine.Debug.LogError("mismatch");
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message);
            }
        }
コード例 #10
0
        /** JSONファイル書き込み。
         */
        public static void WriteJsonFile(Fee.File.Path a_assets_path, Fee.JsonItem.JsonItem a_jsonitem)
        {
            try{
                string t_json_string = a_jsonitem.ConvertToJsonString();

                using (System.IO.StreamWriter t_steram = new System.IO.StreamWriter(Fee.File.Path.CreateAssetsPath(a_assets_path, Fee.File.Path.SEPARATOR).GetPath(), false, new System.Text.UTF8Encoding(false))){
                    t_steram.Write(t_json_string);
                    t_steram.Flush();
                    t_steram.Close();
                }

                Tool.EditorLog("WriteJsonFile : " + a_assets_path.GetPath());
            }catch (System.Exception t_exception) {
                Tool.EditorLogError(t_exception.Message);
            }
        }
コード例 #11
0
        /** 更新。
         */
        public static void Main(string a_label = nameof(Test_11))
        {
            UnityEngine.Debug.Log("----- " + a_label + " -----");

            try{
                Item t_item_from = new Item(0, null);
                {
                    Item t_current_item = t_item_from;
                    for (int ii = 0; ii < 13; ii++)
                    {
                        t_current_item.value = ii;
                        t_current_item.item  = new Item(-1, null);
                        t_current_item       = t_current_item.item;
                    }
                }

                //オブジェクト ==> JSONITEM。
                                #if (FEE_JSON)
                Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <Item>(t_item_from);
                                #endif

                //JSONITEM ==> JSON文字列。
                                #if (FEE_JSON)
                string t_jsonstring = t_jsonitem.ConvertToJsonString();
                                #else
                string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from);
                                #endif

                //JSON文字列 ==> オブジェクト。
                                #if (FEE_JSON)
                Item t_item_to = Fee.JsonItem.Convert.JsonStringToObject <Item>(t_jsonstring);
                                #else
                Item t_item_to = UnityEngine.JsonUtility.FromJson <Item>(t_jsonstring);
                                #endif

                //ログ。
                UnityEngine.Debug.Log(a_label + " : " + t_jsonstring);

                //チェック。
                if (Check(t_item_from, t_item_to) == false)
                {
                    UnityEngine.Debug.LogError("mismatch");
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message);
            }
        }
コード例 #12
0
ファイル: Test_99.cs プロジェクト: bluebackblue/jsontest
        /** 更新。
         */
        public static void Main(string a_label = nameof(Test_99))
        {
            UnityEngine.Debug.Log("----- " + a_label + " -----");

            try{
                Item t_item_from = new Item();
                {
                    //material
                    t_item_from.material = new UnityEngine.Material(UnityEngine.Shader.Find("Fee/Render2D/Add"));

                    //monobehaviour
                    UnityEngine.GameObject t_gameobject = new UnityEngine.GameObject("gameobject");
                    t_item_from.monobehaviour = t_gameobject.AddComponent <Test_MonoBehaviour>();
                }

                //オブジェクト ==> JSONITEM。
                                #if (FEE_JSON)
                Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <Item>(t_item_from);
                                #endif

                //JSONITEM ==> JSON文字列。
                                #if (FEE_JSON)
                string t_jsonstring = t_jsonitem.ConvertToJsonString();
                                #else
                string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from);
                                #endif

                //JSON文字列 ==> オブジェクト。
                                #if (FEE_JSON)
                Item t_item_to = Fee.JsonItem.Convert.JsonStringToObject <Item>(t_jsonstring);
                                #else
                Item t_item_to = UnityEngine.JsonUtility.FromJson <Item>(t_jsonstring);
                                #endif

                //ログ。
                UnityEngine.Debug.Log(a_label + " : " + t_jsonstring);

                //チェック。
                if (Check(t_item_from, t_item_to) == false)
                {
                    UnityEngine.Debug.LogError("mismatch");
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message);
            }
        }
コード例 #13
0
ファイル: Test_08.cs プロジェクト: bluebackblue/jsontest
        /** 更新。
         */
        public static void Main(string a_label = nameof(Test_08))
        {
            UnityEngine.Debug.Log("----- " + a_label + " -----");

            try{
                System.Collections.Generic.List <int> t_item_from = new System.Collections.Generic.List <int>();
                {
                    t_item_from.Add(1);
                    t_item_from.Add(2);
                    t_item_from.Add(3);
                }

                //オブジェクト ==> JSONITEM。
                                #if (FEE_JSON)
                Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <System.Collections.Generic.List <int> >(t_item_from);
                                #endif

                //JSONITEM ==> JSON文字列。
                                #if (FEE_JSON)
                string t_jsonstring = t_jsonitem.ConvertToJsonString();
                                #else
                //{}
                string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from);
                                #endif

                //JSON文字列 ==> オブジェクト。
                                #if (FEE_JSON)
                System.Collections.Generic.List <int> t_item_to = Fee.JsonItem.Convert.JsonStringToObject <System.Collections.Generic.List <int> >(t_jsonstring);
                                #else
                System.Collections.Generic.List <int> t_item_to = UnityEngine.JsonUtility.FromJson <System.Collections.Generic.List <int> >(t_jsonstring);
                                #endif

                //ログ。
                UnityEngine.Debug.Log(a_label + " : " + t_jsonstring);

                //チェック。
                if (Check(t_item_from, t_item_to) == false)
                {
                    UnityEngine.Debug.LogError("mismatch");
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message);
            }
        }
コード例 #14
0
ファイル: Test_09.cs プロジェクト: bluebackblue/jsontest
        /** 更新。
         */
        public static void Main(string a_label = nameof(Test_09))
        {
            UnityEngine.Debug.Log("----- " + a_label + " -----");

            try{
                int[] t_item_from = new int[3] {
                    1,
                    2,
                    3,
                };

                //オブジェクト ==> JSONITEM。
                                #if (FEE_JSON)
                Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <int[]>(t_item_from);
                                #endif

                //JSONITEM ==> JSON文字列。
                                #if (FEE_JSON)
                string t_jsonstring = t_jsonitem.ConvertToJsonString();
                                #else
                string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from);
                                #endif

                //JSON文字列 ==> オブジェクト。
                                #if (FEE_JSON)
                int[] t_item_to = Fee.JsonItem.Convert.JsonStringToObject <int[]>(t_jsonstring);
                                #else
                int[] t_item_to = UnityEngine.JsonUtility.FromJson <int[]>(t_jsonstring);
                                #endif

                //ログ。
                UnityEngine.Debug.Log(a_label + " : " + t_jsonstring);

                //チェック。
                if (Check(t_item_from, t_item_to) == false)
                {
                    UnityEngine.Debug.LogError("mismatch");
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message);
            }
        }
コード例 #15
0
ファイル: Utility.cs プロジェクト: bluebackblue/jsontest
        /** JSONファイル書き込み。
         *
         *      a_full_path : フルパス。
         *
         */
        public static void WriteJsonFile(Fee.File.Path a_full_path, Fee.JsonItem.JsonItem a_jsonitem, bool a_refresh)
        {
            try{
                string t_json_string = a_jsonitem.ConvertToJsonString();

                using (System.IO.StreamWriter t_steram = new System.IO.StreamWriter(a_full_path.GetPath(), false, new System.Text.UTF8Encoding(false))){
                    t_steram.Write(t_json_string);
                    t_steram.Flush();
                    t_steram.Close();
                }

                UnityEngine.Debug.Log("WriteJsonFile : " + a_full_path.GetPath());

                if (a_refresh == true)
                {
                    UnityEditor.AssetDatabase.Refresh();
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(t_exception.Message);
            }
        }
コード例 #16
0
        /** コンバート。
         *
         *      a_param			: パラメータ。
         *      a_assets_path	: アセットフォルダからの相対パス。
         *      a_sheet			: JSONシート。
         *
         */
        public static void Convert(string a_param, Fee.File.Path a_assets_path, Fee.JsonItem.JsonItem[] a_sheet)
        {
            try{
                Fee.JsonItem.JsonItem t_jsonitem = new Fee.JsonItem.JsonItem(new Fee.JsonItem.Value_IndexArray());

                if (a_sheet != null)
                {
                    for (int ii = 0; ii < a_sheet.Length; ii++)
                    {
                        if (a_sheet[ii] != null)
                        {
                            int jj_max = a_sheet[ii].GetListMax();
                            for (int jj = 0; jj < jj_max; jj++)
                            {
                                Fee.JsonItem.JsonItem t_list_item = a_sheet[ii].GetItem(jj);
                                if (t_list_item != null)
                                {
                                    t_jsonitem.AddItem(t_list_item, false);
                                }
                                else
                                {
                                    Tool.Assert(false);
                                }
                            }
                        }
                    }
                }
                else
                {
                    Tool.Assert(false);
                }

                Fee.EditorTool.Utility.WriteTextFile(Fee.File.Path.CreateAssetsPath(a_assets_path), t_jsonitem.ConvertToJsonString(), true);
            }catch (System.Exception t_exception) {
                Tool.DebugReThrow(t_exception);
            }
        }
コード例 #17
0
        /** コンバート。
         */
        public bool Convert(File.Path a_path)
        {
            this.jsonitem_jsonsheet = new JsonItem.JsonItem(new Fee.JsonItem.Value_AssociativeArray());

            {
                                #if (USE_DEF_FEE_EXCELDATAREADER)
                {
                    this.excel = new Excel_ExcelDataReader();
                }
                                #else
                {
                    this.excel = new Excel_Dummy();
                }
                                #endif

                if (this.excel.ReadOpen(a_path) == true)
                {
                    int t_sheet_count = this.excel.GetSheetCount();
                    for (int ii = 0; ii < t_sheet_count; ii++)
                    {
                        if (this.excel.SetActiveSheet(ii) == true)
                        {
                            this.Convert_Sheet();
                        }
                    }
                    this.excel.Close();
                }
                else
                {
                    //失敗。
                    return(false);
                }
            }

            return(true);
        }
コード例 #18
0
        /** コンバート
         */
        public static bool ConvertFromJsonSheet(Fee.JsonItem.JsonItem a_jsonitem, Fee.JsonSheet.ConvertParam a_convertparam)
        {
            if (a_jsonitem == null)
            {
                Tool.Assert(false);
                return(false);
            }

            if (a_jsonitem.IsAssociativeArray() == false)
            {
                Tool.Assert(false);
                return(false);
            }

            //コンバードシート。確認。
            if (a_jsonitem.IsExistItem(Config.SHEETNAME_CONVERT, Fee.JsonItem.ValueType.IndexArray) == false)
            {
                Tool.Assert(false);
                return(false);
            }

            //コンバートシート。取得。
            Fee.JsonItem.JsonItem t_jsonitem_convertsheet = a_jsonitem.GetItem(Config.SHEETNAME_CONVERT);
            if (t_jsonitem_convertsheet == null)
            {
                Tool.Assert(false);
                return(false);
            }

            //コンバートシート。取得。
            System.Collections.Generic.List <ConvertListItem> t_list_convert = Fee.JsonItem.Convert.JsonItemToObject <System.Collections.Generic.List <ConvertListItem> >(t_jsonitem_convertsheet);
            if (t_list_convert == null)
            {
                return(false);
            }

            //処理。
            for (int ii = 0; ii < t_list_convert.Count; ii++)
            {
                Fee.JsonItem.JsonItem[] t_jsonitem_list = new Fee.JsonItem.JsonItem[4] {
                    null, null, null, null
                };

                if (string.IsNullOrEmpty(t_list_convert[ii].convert_sheet_0) == false)
                {
                    if (a_jsonitem.IsExistItem(t_list_convert[ii].convert_sheet_0, Fee.JsonItem.ValueType.IndexArray) == true)
                    {
                        t_jsonitem_list[0] = a_jsonitem.GetItem(t_list_convert[ii].convert_sheet_0);
                    }
                    else
                    {
                        Tool.Assert(false);
                    }
                }

                if (string.IsNullOrEmpty(t_list_convert[ii].convert_sheet_1) == false)
                {
                    if (a_jsonitem.IsExistItem(t_list_convert[ii].convert_sheet_1, Fee.JsonItem.ValueType.IndexArray) == true)
                    {
                        t_jsonitem_list[1] = a_jsonitem.GetItem(t_list_convert[ii].convert_sheet_1);
                    }
                    else
                    {
                        Tool.Assert(false);
                    }
                }

                if (string.IsNullOrEmpty(t_list_convert[ii].convert_sheet_2) == false)
                {
                    if (a_jsonitem.IsExistItem(t_list_convert[ii].convert_sheet_2, Fee.JsonItem.ValueType.IndexArray) == true)
                    {
                        t_jsonitem_list[2] = a_jsonitem.GetItem(t_list_convert[ii].convert_sheet_2);
                    }
                    else
                    {
                        Tool.Assert(false);
                    }
                }

                if (string.IsNullOrEmpty(t_list_convert[ii].convert_sheet_3) == false)
                {
                    if (a_jsonitem.IsExistItem(t_list_convert[ii].convert_sheet_3, Fee.JsonItem.ValueType.IndexArray) == true)
                    {
                        t_jsonitem_list[3] = a_jsonitem.GetItem(t_list_convert[ii].convert_sheet_3);
                    }
                    else
                    {
                        Tool.Assert(false);
                    }
                }

                switch (t_list_convert[ii].convert_command)
                {
                case ConvertSheet_Enum.COMMAND:
                {
                    //ENUM。
                    ConvertSheet_Enum.Convert(t_list_convert[ii].convert_param, new Fee.File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;

                case ConvertSheet_Json.COMMAND:
                {
                    //JSON。
                    ConvertSheet_Json.Convert(t_list_convert[ii].convert_param, new Fee.File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;

                case ConvertSheet_Prefab.COMMAND:
                {
                    //プレハブ。
                    ConvertSheet_Prefab.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;

                case ConvertSheet_Data.COMMAND:
                {
                    //データ。
                    ConvertSheet_Data.Convert(t_list_convert[ii].convert_param, new Fee.File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;



                case ConvertSheet_AudioPrefab.COMMAND:
                {
                    //オーディオプレハブ。
                    ConvertSheet_AudioPrefab.Convert(t_list_convert[ii].convert_param, new Fee.File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;

                case ConvertSheet_MaterialPrefab.COMMAND:
                {
                    //マテリアルプレハブ。
                    ConvertSheet_MaterialPrefab.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;

                case ConvertSheet_VideoPrefab.COMMAND:
                {
                    //ビデオプレハブ。
                    ConvertSheet_VideoPrefab.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;

                case ConvertSheet_TexturePrefab.COMMAND:
                {
                    //テクスチャプレハブ。
                    ConvertSheet_TexturePrefab.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;

                case ConvertSheet_FontPrefab.COMMAND:
                {
                    //フォントプレハブ。
                    ConvertSheet_FontPrefab.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;

                case ConvertSheet_TextAssetPrefab.COMMAND:
                {
                    //テキストアセットプレハブ。
                    ConvertSheet_TextAssetPrefab.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;

                case ConvertSheet_RAControllerPrefab.COMMAND:
                {
                    //ランタイムアニメータコントローラプレハブ。
                    ConvertSheet_RAControllerPrefab.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;



                case ConvertSheet_AnimatorController.COMMAND:
                {
                    //アニメータコントローラ。
                    ConvertSheet_AnimatorController.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list, a_convertparam);
                } break;



                default:
                {
                    Tool.LogError("ConvertFromJsonSheet", t_list_convert[ii].convert_command);
                } break;
                }
            }

            Fee.EditorTool.AssetTool.Refresh();

            return(true);
        }
コード例 #19
0
        /** Create
         */
        public static void Create(ref System.Object a_to_ref_object, System.Type a_to_type, Fee.JsonItem.JsonItem a_from_jsonitem)
        {
            switch (a_to_type.FullName)
            {
            case "System." + nameof(System.Char):
            case "System." + nameof(System.SByte):
            case "System." + nameof(System.Byte):
            case "System." + nameof(System.Int16):
            case "System." + nameof(System.UInt16):
            case "System." + nameof(System.Int32):
            case "System." + nameof(System.UInt32):
            case "System." + nameof(System.Int64):
            case "System." + nameof(System.UInt64):
            case "System." + nameof(System.Single):
            case "System." + nameof(System.Double):
            case "System." + nameof(System.Boolean):
            case "System." + nameof(System.Decimal):
            case "System." + nameof(System.String):
            case "System." + nameof(System.Object):
            {
                return;
            } break;

            default:
            {
                if (a_from_jsonitem.IsNull() == true)
                {
                    //NULL処理。
                    return;
                }
                else
                {
                    if (a_to_type.IsArray == true)
                    {
                        //[]

                        int t_list_count = 0;
                        if (a_from_jsonitem.IsIndexArray() == true)
                        {
                            t_list_count = a_from_jsonitem.GetListMax();
                        }

                        try{
                            System.Type t_element_type = a_to_type.GetElementType();
                            a_to_ref_object = System.Array.CreateInstance(t_element_type, t_list_count);
                            return;
                        }catch (System.Exception t_exception) {
                            Tool.DebugReThrow(t_exception);
                        }
                    }
                    else
                    {
                        //インスタンス。
                        try{
                            a_to_ref_object = System.Activator.CreateInstance(a_to_type);
                            return;
                        }catch (System.Exception t_exception) {
                            //引数なしconstructorの呼び出しに失敗。
                            //UnityEngine.Object系は[Fee.JsonItem.Ignore]を指定して除外するべき。
                            Tool.DebugReThrow(t_exception);
                        }
                    }
                }

                //失敗。
                Tool.Assert(false);
                return;
            } break;
            }
        }
コード例 #20
0
        /** Get
         */
        public static System.Type Get(Fee.JsonItem.JsonItem a_jsonitem)
        {
            System.Type t_type = null;

            switch (a_jsonitem.GetValueType())
            {
            case ValueType.Null:
            {
                //値型が不明なので値型はSystem.Objectにする。
                t_type = typeof(System.Object);
            } break;

            case ValueType.AssociativeArray:
            {
                //値型が不明なので値型はSystem.Objectにする。
                t_type = typeof(System.Collections.Generic.Dictionary <string, System.Object>);
            } break;

            case ValueType.IndexArray:
            {
                //値型が不明なので値型はSystem.Objectにする。
                t_type = typeof(System.Collections.Generic.List <System.Object>);
            } break;

            case ValueType.StringData:
            {
                t_type = typeof(System.String);
            } break;

            case ValueType.SignedNumber:
            {
                t_type = JsonItem.GetSignedNumberType();
            } break;

            case ValueType.UnsignedNumber:
            {
                t_type = JsonItem.GetUnsignedNumberType();
            } break;

            case ValueType.FloatingNumber:
            {
                t_type = JsonItem.GetFloatingNumberType();
            } break;

            case ValueType.BoolData:
            {
                t_type = typeof(System.Boolean);
            } break;

            case ValueType.DecimalNumber:
            {
                t_type = typeof(System.Decimal);
            } break;

            case ValueType.BinaryData:
            {
                t_type = typeof(System.Collections.Generic.List <byte>);
            } break;

            default:
            {
                Tool.Assert(false);
            } break;
            }

            return(t_type);
        }
コード例 #21
0
        /** CoroutineMain
         */
        public System.Collections.IEnumerator CoroutineMain(OnSoundPoolCoroutine_CallBackInterface a_callback_interface, File.Path a_path, UnityEngine.WWWForm a_post_data, Fee.File.CustomCertificateHandler a_certificate_handler, bool a_is_streamingassets, uint a_data_version)
        {
            //result
            this.result = new ResultType();

            Fee.Pattern.Progress t_progress = new Fee.Pattern.Progress(new float[] {
                0.05f,
                0.1f,
                0.8f,
                0.05f
            });

            //ローカル、サウンロプール管理ファイル。相対パス。
            Fee.File.Path t_local_caoundpool_path = new File.Path(a_path.GetFileName());

            //ローカル、サウンドプール管理ファイルのロード。
            Fee.JsonItem.JsonItem t_local_soundpool_json = null;
            if (Config.USE_LOADURL_SOUNDPOOL_CACHE == true)
            {
                Fee.File.Item t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadLocalTextFile, t_local_caoundpool_path);

                do
                {
                    //■ステップ0。
                    if (a_callback_interface != null)
                    {
                        t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_0_LoadLocal_SoundPool, 0, 1);
                        a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress()));
                    }
                    yield return(null);
                }while(t_item.IsBusy() == true);

                if (t_item.GetResultAssetType() == Asset.AssetType.Text)
                {
                    t_local_soundpool_json = new JsonItem.JsonItem(t_item.GetResultAssetText());
                    if (t_local_soundpool_json == null)
                    {
                        //コンバート失敗。
                        this.result.errorstring = "Coroutine_LoadSoundPool : local_soundpool_json == null";
                        yield break;
                    }
                }
                else
                {
                    //ローカルにキャッシュなし。
                }
            }

            //チェック。
            if (t_local_soundpool_json != null)
            {
                if ((t_local_soundpool_json.IsAssociativeArray() == true) && (t_local_soundpool_json.IsExistItem("data_version")))
                {
                    uint t_data_version = t_local_soundpool_json.GetItem("data_version").CastToUint16();
                    if (t_data_version == a_data_version)
                    {
                        Fee.Audio.Pack_SoundPool t_local_soundpool = Fee.JsonItem.Convert.JsonItemToObject <Fee.Audio.Pack_SoundPool>(t_local_soundpool_json);
                        if (t_local_soundpool != null)
                        {
                            //最新を取得する必要なし。

                            //パス解決。
                            {
                                t_local_soundpool.fullpath_list = new System.Collections.Generic.List <File.Path>();
                                for (int ii = 0; ii < t_local_soundpool.name_list.Count; ii++)
                                {
                                    t_local_soundpool.fullpath_list.Add(File.Path.CreateLocalPath(t_local_soundpool.name_list[ii]));
                                }
                            }

                            this.result.soundpool      = t_local_soundpool;
                            this.result.responseheader = null;
                            yield break;
                        }
                        else
                        {
                            //コンバート失敗。
                        }
                    }
                    else
                    {
                        //最新のバージョンが必要。
                    }
                }
                else
                {
                    //不明なデータ。
                }

                t_local_soundpool_json = null;
            }

            //ロード。
            string t_load_stringjson = null;

            Fee.Audio.Pack_SoundPool t_load_soundpool = null;

            //サウンドプール管理ファイルのロード。
            {
                Fee.File.Item t_item = null;

                if (a_is_streamingassets == true)
                {
                    t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsTextFile, a_path);
                }
                else
                {
                    t_item = Fee.File.File.GetInstance().RequestLoadUrl(File.File.LoadRequestType.LoadUrlTextFile, a_path, a_post_data, a_certificate_handler);
                }

                do
                {
                    //■ステップ1。
                    if (a_callback_interface != null)
                    {
                        t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_1_Load_SoundPool, 0, 1);
                        a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress()));
                    }
                    yield return(null);
                }while(t_item.IsBusy() == true);

                this.result.responseheader = t_item.GetResultResponseHeader();

                if (t_item.GetResultAssetType() == Asset.AssetType.Text)
                {
                    //成功。
                    t_load_stringjson = t_item.GetResultAssetText();
                }
                else
                {
                    //失敗。
                    this.result.errorstring = t_item.GetResultErrorString();
                    yield break;
                }

                t_load_soundpool = JsonItem.Convert.JsonStringToObject <Fee.Audio.Pack_SoundPool>(t_load_stringjson);

                if (t_load_soundpool == null)
                {
                    //コンバート失敗。
                    this.result.errorstring = "Coroutine_LoadSoundPool : load_soundpool == null";
                    yield break;
                }
                else if (t_load_soundpool.name_list == null)
                {
                    //不明なデータ。
                    this.result.errorstring = "Coroutine_LoadSoundPool : load_soundpool.name_list == null";
                    yield break;
                }
                else if (t_load_soundpool.volume_list == null)
                {
                    //不明なデータ。
                    this.result.errorstring = "Coroutine_LoadSoundPool : load_soundpool.volume_list == null";
                    yield break;
                }
            }

            //登録サウンドのロード。
            {
                for (int ii = 0; ii < t_load_soundpool.name_list.Count; ii++)
                {
                    byte[] t_sound_binary = null;

                    //ロード。
                    {
                        Fee.File.Path t_sound_url = a_path.CreateFileNameChangePath(t_load_soundpool.name_list[ii]);

                        Fee.File.Item t_item = null;

                        if (a_is_streamingassets)
                        {
                            t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadStreamingAssetsBinaryFile, t_sound_url);
                        }
                        else
                        {
                            t_item = Fee.File.File.GetInstance().RequestLoad(File.File.LoadRequestType.LoadUrlBinaryFile, t_sound_url);
                        }

                        do
                        {
                            //■ステップ2。
                            if (a_callback_interface != null)
                            {
                                t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_2_Sound, ii * 2 + 0, t_load_soundpool.name_list.Count * 2);
                                a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress()));
                            }
                            yield return(null);
                        }while(t_item.IsBusy() == true);

                        if (t_item.GetResultAssetType() == Asset.AssetType.Binary)
                        {
                            //成功。
                            t_sound_binary = t_item.GetResultAssetBinary();
                        }
                        else
                        {
                            //失敗。
                            this.result.errorstring = t_item.GetResultErrorString();
                            yield break;
                        }
                    }

                    //セーブローカル。
                    {
                        Fee.File.Path t_sound_url = new File.Path(t_load_soundpool.name_list[ii]);

                        File.Item t_item = Fee.File.File.GetInstance().RequestSaveBinaryFile(File.File.SaveRequestType.SaveLocalBinaryFile, t_sound_url, t_sound_binary);

                        do
                        {
                            //■ステップ2。
                            if (a_callback_interface != null)
                            {
                                t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_2_Sound, ii * 2 + 1, t_load_soundpool.name_list.Count * 2);
                                a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress()));
                            }
                            yield return(null);
                        }while(t_item.IsBusy() == true);

                        if (t_item.GetResultType() == File.Item.ResultType.SaveEnd)
                        {
                            //成功。
                        }
                        else
                        {
                            //失敗。
                            this.result.errorstring = t_item.GetResultErrorString();
                            yield break;
                        }
                    }
                }
            }

            //ローカル、サウンドプール管理ファイルのセーブ。
            {
                File.Item t_item = Fee.File.File.GetInstance().RequestSaveTextFile(File.File.SaveRequestType.SaveLocalTextFile, t_local_caoundpool_path, t_load_stringjson);

                do
                {
                    //■ステップ3。
                    if (a_callback_interface != null)
                    {
                        t_progress.SetStep((int)Progress_MainStep.Progress_MainStep_3_SaveLocal_SoundPool, 0, 1);
                        a_callback_interface.OnSoundPoolCoroutine(t_progress.CalcProgress(t_item.GetResultProgress()));
                    }
                    yield return(null);
                }while(t_item.IsBusy() == true);

                if (t_item.GetResultType() == File.Item.ResultType.SaveEnd)
                {
                    //成功。
                }
                else
                {
                    //失敗。
                    this.result.errorstring = t_item.GetResultErrorString();
                    yield break;
                }
            }

            //パス解決。
            {
                t_load_soundpool.fullpath_list = new System.Collections.Generic.List <File.Path>();
                for (int ii = 0; ii < t_load_soundpool.name_list.Count; ii++)
                {
                    t_load_soundpool.fullpath_list.Add(Fee.File.Path.CreateLocalPath(t_load_soundpool.name_list[ii]));
                }
            }

            this.result.soundpool = t_load_soundpool;
            yield break;
        }
コード例 #22
0
        /** Convert
         */
        public static void Convert(ref System.Object a_to_ref_object, System.Type a_to_type, JsonItem a_from_jsonitem, JsonItemToObject_WorkPool a_workpool)
        {
            try{
                //IList
                {
                    System.Collections.IList t_to_list = a_to_ref_object as System.Collections.IList;
                    if (t_to_list != null)
                    {
                        //値型。取得。
                        System.Type t_list_value_type = Fee.ReflectionTool.Utility.GetListValueType(a_to_type);

                        if (t_to_list.IsFixedSize == true)
                        {
                            //[]

                            //ワークに追加。
                            for (int ii = a_from_jsonitem.GetListMax() - 1; ii >= 0; ii--)
                            {
                                JsonItem t_jsonitem_listitem = a_from_jsonitem.GetItem(ii);
                                a_workpool.AddFirst(JsonItemToObject_WorkPool.ModeSetList.Start, t_jsonitem_listitem, t_to_list, ii, t_list_value_type);
                            }
                        }
                        else
                        {
                            //Generic.List

                            //ワークに追加。
                            for (int ii = a_from_jsonitem.GetListMax() - 1; ii >= 0; ii--)
                            {
                                JsonItem t_jsonitem_listitem = a_from_jsonitem.GetItem(ii);
                                a_workpool.AddFirst(JsonItemToObject_WorkPool.ModeAddList.Start, t_jsonitem_listitem, t_to_list, t_list_value_type);
                            }
                        }

                        //成功。
                        return;
                    }
                }

                //IEnumerable
                {
                    System.Collections.IEnumerable t_to_enumerable = a_to_ref_object as System.Collections.IEnumerable;
                    if (t_to_enumerable != null)
                    {
                        System.Type t_generic_type = Fee.ReflectionTool.Utility.GetGenericTypeDefinition(a_to_type);

                        //値型。取得。
                        System.Type t_list_value_type = Fee.ReflectionTool.Utility.GetListValueType(a_to_type);

                        //メソッド取得。
                        System.Reflection.MethodInfo t_methodinfo = null;
                        if (t_generic_type == typeof(System.Collections.Generic.Stack <>))
                        {
                            //Generic.Stack

                            t_methodinfo = ConvertTool.GetMethod_Stack_Push(a_to_type, t_list_value_type);

                            if (t_methodinfo != null)
                            {
                                //ワークに追加。
                                for (int ii = 0; ii < a_from_jsonitem.GetListMax(); ii++)
                                {
                                    JsonItem t_jsonitem_listitem = a_from_jsonitem.GetItem(ii);
                                    a_workpool.AddFirst(JsonItemToObject_WorkPool.ModeIEnumerable.Start_Param1, t_jsonitem_listitem, t_to_enumerable, t_methodinfo, t_list_value_type);
                                }

                                //成功。
                                return;
                            }
                        }
                        else if (t_generic_type == typeof(System.Collections.Generic.LinkedList <>))
                        {
                            //Generic.LinkedList
                            t_methodinfo = ConvertTool.GetMethod_LinkedList_AddLast(a_to_type, t_list_value_type);
                        }
                        else if (t_generic_type == typeof(System.Collections.Generic.HashSet <>))
                        {
                            //Generic.HashSet
                            t_methodinfo = ConvertTool.GetMethod_HashSet_Add(a_to_type, t_list_value_type);
                        }
                        else if (t_generic_type == typeof(System.Collections.Generic.Queue <>))
                        {
                            //Generic.Queue
                            t_methodinfo = ConvertTool.GetMethod_Queue_Enqueue(a_to_type, t_list_value_type);
                        }
                        else if (t_generic_type == typeof(System.Collections.Generic.SortedSet <>))
                        {
                            //Generic.SortedSet
                            t_methodinfo = ConvertTool.GetMethod_SortedSet_Add(a_to_type, t_list_value_type);
                        }

                        if (t_methodinfo != null)
                        {
                            //ワークに追加。
                            for (int ii = a_from_jsonitem.GetListMax() - 1; ii >= 0; ii--)
                            {
                                JsonItem t_jsonitem_listitem = a_from_jsonitem.GetItem(ii);
                                a_workpool.AddFirst(JsonItemToObject_WorkPool.ModeIEnumerable.Start_Param1, t_jsonitem_listitem, t_to_enumerable, t_methodinfo, t_list_value_type);
                            }

                            //成功。
                            return;
                        }
                    }
                }

                //IDictionary
                {
                    System.Collections.IDictionary t_to_dictionary = a_to_ref_object as System.Collections.IDictionary;
                    if (t_to_dictionary != null)
                    {
                        //キー型。
                        System.Type t_list_key_type = Fee.ReflectionTool.Utility.GetDictionaryKeyType(a_to_type);

                        //値型。
                        System.Type t_list_value_type = Fee.ReflectionTool.Utility.GetListValueType(a_to_type);

                        //ワークに追加。
                        for (int ii = 0; ii < a_from_jsonitem.GetListMax(); ii++)
                        {
                            Fee.JsonItem.JsonItem t_listitem_jsonitem = a_from_jsonitem.GetItem(ii);

                            Fee.JsonItem.JsonItem t_key_jsonitem   = null;
                            Fee.JsonItem.JsonItem t_value_jsonitem = null;

                            if (t_listitem_jsonitem.IsAssociativeArray() == true)
                            {
                                if (t_listitem_jsonitem.IsExistItem("KEY"))
                                {
                                    t_key_jsonitem = t_listitem_jsonitem.GetItem("KEY");
                                }
                                if (t_listitem_jsonitem.IsExistItem("VALUE"))
                                {
                                    t_value_jsonitem = t_listitem_jsonitem.GetItem("VALUE");
                                }
                            }

                            a_workpool.AddFirst(JsonItemToObject_WorkPool.ModeAddAnyDictionary.Start, t_key_jsonitem, t_value_jsonitem, t_to_dictionary, t_list_key_type, t_list_value_type);
                        }

                        //成功。
                        return;
                    }
                }
            }catch (System.Exception t_exception) {
                Tool.DebugReThrow(t_exception);
            }

            //失敗。
            Tool.Assert(false);
        }
コード例 #23
0
ファイル: JsonSheet.cs プロジェクト: bluebackblue/jsontest
        /** コンバート
         */
        public static bool ConvertFromJsonSheet(Fee.JsonItem.JsonItem a_jsonitem)
        {
            if (a_jsonitem == null)
            {
                Tool.Assert(false);
                return(false);
            }

            if (a_jsonitem.IsAssociativeArray() == false)
            {
                Tool.Assert(false);
                return(false);
            }

            //コンバードシート。確認。
            if (a_jsonitem.IsExistItem(Config.SHEETNAME_CONVERT, Fee.JsonItem.ValueType.IndexArray) == false)
            {
                Tool.Assert(false);
                return(false);
            }

            //コンバートシート。取得。
            Fee.JsonItem.JsonItem t_jsonitem_convertsheet = a_jsonitem.GetItem(Config.SHEETNAME_CONVERT);
            if (t_jsonitem_convertsheet == null)
            {
                Tool.Assert(false);
                return(false);
            }

            //コンバートシート。取得。
            System.Collections.Generic.List <ConvertSheet_ListItem> t_list_convert = Fee.JsonItem.Convert.JsonItemToObject <System.Collections.Generic.List <ConvertSheet_ListItem> >(t_jsonitem_convertsheet);
            if (t_list_convert == null)
            {
                return(false);
            }

            //処理。
            for (int ii = 0; ii < t_list_convert.Count; ii++)
            {
                Fee.JsonItem.JsonItem[] t_jsonitem_list = new Fee.JsonItem.JsonItem[4] {
                    null, null, null, null
                };

                if (string.IsNullOrEmpty(t_list_convert[ii].convert_sheet_0) == false)
                {
                    if (a_jsonitem.IsExistItem(t_list_convert[ii].convert_sheet_0, Fee.JsonItem.ValueType.IndexArray) == true)
                    {
                        t_jsonitem_list[0] = a_jsonitem.GetItem(t_list_convert[ii].convert_sheet_0);
                    }
                    else
                    {
                        Tool.Assert(false);
                    }
                }

                if (string.IsNullOrEmpty(t_list_convert[ii].convert_sheet_1) == false)
                {
                    if (a_jsonitem.IsExistItem(t_list_convert[ii].convert_sheet_1, Fee.JsonItem.ValueType.IndexArray) == true)
                    {
                        t_jsonitem_list[1] = a_jsonitem.GetItem(t_list_convert[ii].convert_sheet_1);
                    }
                    else
                    {
                        Tool.Assert(false);
                    }
                }

                if (string.IsNullOrEmpty(t_list_convert[ii].convert_sheet_2) == false)
                {
                    if (a_jsonitem.IsExistItem(t_list_convert[ii].convert_sheet_2, Fee.JsonItem.ValueType.IndexArray) == true)
                    {
                        t_jsonitem_list[2] = a_jsonitem.GetItem(t_list_convert[ii].convert_sheet_2);
                    }
                    else
                    {
                        Tool.Assert(false);
                    }
                }

                if (string.IsNullOrEmpty(t_list_convert[ii].convert_sheet_3) == false)
                {
                    if (a_jsonitem.IsExistItem(t_list_convert[ii].convert_sheet_3, Fee.JsonItem.ValueType.IndexArray) == true)
                    {
                        t_jsonitem_list[3] = a_jsonitem.GetItem(t_list_convert[ii].convert_sheet_3);
                    }
                    else
                    {
                        Tool.Assert(false);
                    }
                }

                switch (t_list_convert[ii].convert_command)
                {
                case Convert_JsonSheet.COMMAND:
                {
                    //JSONシート。
                    Convert_JsonSheet.Convert(t_list_convert[ii].convert_param, new Fee.File.Path(t_list_convert[ii].convert_output), t_jsonitem_list);
                } break;

                case Convert_EnumSheet.COMMAND:
                {
                    //ENUMシート。
                    Convert_EnumSheet.Convert(t_list_convert[ii].convert_param, new Fee.File.Path(t_list_convert[ii].convert_output), t_jsonitem_list);
                } break;

                case Convert_AudioSheet.COMMAND:
                {
                    //オーディオシート。
                    Convert_AudioSheet.Convert(t_list_convert[ii].convert_param, new Fee.File.Path(t_list_convert[ii].convert_output), t_jsonitem_list);
                } break;

                case Convert_DataSheet.COMMAND:
                {
                    //データシート。
                    Convert_DataSheet.Convert(t_list_convert[ii].convert_param, new Fee.File.Path(t_list_convert[ii].convert_output), t_jsonitem_list);
                } break;

                case Convert_TextureSheet.COMMAND:
                {
                    //テクスチャーシート。
                    Convert_TextureSheet.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list);
                } break;

                case Convert_FontSheet.COMMAND:
                {
                    //フォントシート。
                    Convert_FontSheet.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list);
                } break;

                case Convert_TextAssetSheet.COMMAND:
                {
                    //テキストアセットシート。
                    Convert_TextAssetSheet.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list);
                } break;

                case Convert_Videoheet.COMMAND:
                {
                    //ムービーシート。
                    Convert_Videoheet.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list);
                } break;

                case Convert_PrefabSheet.COMMAND:
                {
                    //プレハブシート。
                    Convert_PrefabSheet.Convert(t_list_convert[ii].convert_param, new File.Path(t_list_convert[ii].convert_output), t_jsonitem_list);
                } break;

                default:
                {
                    Tool.Assert(false);
                } break;
                }
            }

            return(true);
        }
コード例 #24
0
        /** コンバート。JSON出力。
         */
        public static void Convert_WriteJson(string a_param, Fee.File.Path a_assets_path, Fee.JsonItem.JsonItem[] a_sheet)
        {
            try{
                if (a_sheet != null)
                {
                    System.Collections.Generic.Dictionary <string, Data.JsonListItem> t_list = new System.Collections.Generic.Dictionary <string, Data.JsonListItem>();

                    for (int ii = 0; ii < a_sheet.Length; ii++)
                    {
                        if (a_sheet[ii] != null)
                        {
                            System.Collections.Generic.List <ListItem> t_sheet = Fee.JsonItem.Convert.JsonItemToObject <System.Collections.Generic.List <ListItem> >(a_sheet[ii]);
                            if (t_sheet != null)
                            {
                                for (int jj = 0; jj < t_sheet.Count; jj++)
                                {
                                    Data.JsonListItem t_item = null;

                                    switch (t_sheet[jj].data_command)
                                    {
                                    case Convert_DataSheet.DATACOMMAND_RESOURCES_PREFAB:
                                    {
                                        //リソース。プレハブ。

                                        if (a_param == Convert_DataSheet.DATAPARAM_RELEASE)
                                        {
                                            if (string.IsNullOrEmpty(t_sheet[jj].data_assetbundle_name) == false)
                                            {
                                                //アセットバンドル使用。
                                                t_item = new Data.JsonListItem(Data.PathType.AssetBundle_Prefab, "", t_sheet[jj].data_assetbundle_name);
                                            }
                                            else
                                            {
                                                //リソース使用。
                                                t_item = new Data.JsonListItem(Data.PathType.Resources_Prefab, t_sheet[jj].data_path, "");
                                            }
                                        }
                                        else if (a_param == Convert_DataSheet.DATAPARAM_DEBUG)
                                        {
                                            //リソース使用。
                                            t_item = new Data.JsonListItem(Data.PathType.Resources_Prefab, t_sheet[jj].data_path, "");
                                        }
                                        else
                                        {
                                            Tool.Assert(false);
                                        }
                                    } break;

                                    case Convert_DataSheet.DATACOMMAND_RESOURCES_TEXTURE:
                                    {
                                        //リソース。テクスチャ。

                                        if (a_param == Convert_DataSheet.DATAPARAM_RELEASE)
                                        {
                                            if (string.IsNullOrEmpty(t_sheet[jj].data_assetbundle_name) == false)
                                            {
                                                //アセットバンドル使用。
                                                t_item = new Data.JsonListItem(Data.PathType.AssetBundle_Texture, "", t_sheet[jj].data_assetbundle_name);
                                            }
                                            else
                                            {
                                                //リソース使用。
                                                t_item = new Data.JsonListItem(Data.PathType.Resources_Texture, t_sheet[jj].data_path, "");
                                            }
                                        }
                                        else if (a_param == Convert_DataSheet.DATAPARAM_DEBUG)
                                        {
                                            //リソース使用。
                                            t_item = new Data.JsonListItem(Data.PathType.Resources_Texture, t_sheet[jj].data_path, "");
                                        }
                                        else
                                        {
                                            Tool.Assert(false);
                                        }
                                    } break;

                                    case Convert_DataSheet.DATACOMMAND_RESOURCES_TEXT:
                                    {
                                        //リソース。テキスト。

                                        if (a_param == Convert_DataSheet.DATAPARAM_RELEASE)
                                        {
                                            if (string.IsNullOrEmpty(t_sheet[jj].data_assetbundle_name) == false)
                                            {
                                                //アセットバンドル使用。
                                                t_item = new Data.JsonListItem(Data.PathType.AssetBundle_Text, "", t_sheet[jj].data_assetbundle_name);
                                            }
                                            else
                                            {
                                                //リソース使用。
                                                t_item = new Data.JsonListItem(Data.PathType.Resources_Text, t_sheet[jj].data_path, "");
                                            }
                                        }
                                        else if (a_param == Convert_DataSheet.DATAPARAM_DEBUG)
                                        {
                                            //リソース使用。
                                            t_item = new Data.JsonListItem(Data.PathType.Resources_Text, t_sheet[jj].data_path, "");
                                        }
                                        else
                                        {
                                            Tool.Assert(false);
                                        }
                                    } break;

                                    case Convert_DataSheet.DATACOMMAND_STREAMINGASSETS_TEXTURE:
                                    {
                                        //ストリーミングアセット。テクスチャ。

                                        Tool.Assert(string.IsNullOrEmpty(t_sheet[jj].data_assetbundle_name) == true);
                                        t_item = new Data.JsonListItem(Data.PathType.StreamingAssets_Texture, t_sheet[jj].data_path, "");
                                    } break;

                                    case Convert_DataSheet.DATACOMMAND_STREAMINGASSETS_TEXT:
                                    {
                                        //ストリーミングアセット。テキスト。

                                        Tool.Assert(string.IsNullOrEmpty(t_sheet[jj].data_assetbundle_name) == true);
                                        t_item = new Data.JsonListItem(Data.PathType.StreamingAssets_Text, t_sheet[jj].data_path, "");
                                    } break;

                                    case Convert_DataSheet.DATACOMMAND_STREAMINGASSETS_BINARY:
                                    {
                                        //ストリーミングアセット。テキスト。

                                        Tool.Assert(string.IsNullOrEmpty(t_sheet[jj].data_assetbundle_name) == true);
                                        t_item = new Data.JsonListItem(Data.PathType.StreamingAssets_Binary, t_sheet[jj].data_path, "");
                                    } break;

                                    case Convert_DataSheet.DATACOMMAND_URL_TEXTURE:
                                    {
                                        //URL。テクスチャ。

                                        Tool.Assert(string.IsNullOrEmpty(t_sheet[jj].data_assetbundle_name) == true);
                                        t_item = new Data.JsonListItem(Data.PathType.Url_Texture, t_sheet[jj].data_path, "");
                                    } break;

                                    case Convert_DataSheet.DATACOMMAND_URL_TEXT:
                                    {
                                        //URL。テキスト。

                                        Tool.Assert(string.IsNullOrEmpty(t_sheet[jj].data_assetbundle_name) == true);
                                        t_item = new Data.JsonListItem(Data.PathType.Url_Text, t_sheet[jj].data_path, "");
                                    } break;

                                    case Convert_DataSheet.DATACOMMAND_URL_BINARY:
                                    {
                                        //URL。バイナリ。

                                        Tool.Assert(string.IsNullOrEmpty(t_sheet[jj].data_assetbundle_name) == true);
                                        t_item = new Data.JsonListItem(Data.PathType.Url_Binary, t_sheet[jj].data_path, "");
                                    } break;
                                    }

                                    if (t_item != null)
                                    {
                                        t_list.Add(t_sheet[jj].data_id, t_item);
                                    }
                                    else
                                    {
                                        Tool.Assert(false);
                                    }
                                }
                            }
                            else
                            {
                                Tool.Assert(false);
                            }
                        }
                    }

                    //JSON。出力。
                    Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem(t_list);
                    string t_jsonstring = t_jsonitem.ConvertToJsonString();
                    Fee.EditorTool.Utility.WriteTextFile(Fee.File.Path.CreateAssetsPath(a_assets_path), t_jsonstring, true);
                }
                else
                {
                    Tool.Assert(false);
                }
            }catch (System.Exception t_exception) {
                Tool.DebugReThrow(t_exception);
            }
        }
コード例 #25
0
        /** 更新。
         */
        public static void Main(string a_label = nameof(Test_14))
        {
            UnityEngine.Debug.Log("----- " + a_label + " -----");

            try{
                ITEM_TYPE t_item_from = new ITEM_TYPE();
                {
                                        #if (NEST_12)
                    t_item_from.Add("list_0", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > > > > > > > > >());
                    t_item_from["list_0"].Add("list_1", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > > > > > > > >());
                    t_item_from["list_0"]["list_1"].Add("list_2", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > > > > > > >());
                    t_item_from["list_0"]["list_1"]["list_2"].Add("list_3", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > > > > > >());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"].Add("list_4", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > > > > >());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"]["list_4"].Add("list_5", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > > > >());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"]["list_4"]["list_5"].Add("list_6", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > > >());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"]["list_4"]["list_5"]["list_6"].Add("list_7", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > >());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"]["list_4"]["list_5"]["list_6"]["list_7"].Add("list_8", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > >());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"]["list_4"]["list_5"]["list_6"]["list_7"]["list_8"].Add("list_9", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> >());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"]["list_4"]["list_5"]["list_6"]["list_7"]["list_8"]["list_9"].Add("list_10", new System.Collections.Generic.Dictionary <string, int>());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"]["list_4"]["list_5"]["list_6"]["list_7"]["list_8"]["list_9"]["list_10"].Add("value", -1);
                                        #elif (NEST_7)
                    t_item_from.Add("list_0", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > > > >());
                    t_item_from["list_0"].Add("list_1", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > > >());
                    t_item_from["list_0"]["list_1"].Add("list_2", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > >());
                    t_item_from["list_0"]["list_1"]["list_2"].Add("list_3", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > >());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"].Add("list_4", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> >());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"]["list_4"].Add("list_5", new System.Collections.Generic.Dictionary <string, int>());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"]["list_4"]["list_5"].Add("value", -1);
                                        #elif (NEST_6)
                    t_item_from.Add("list_0", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > > >());
                    t_item_from["list_0"].Add("list_1", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > >());
                    t_item_from["list_0"]["list_1"].Add("list_2", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > >());
                    t_item_from["list_0"]["list_1"]["list_2"].Add("list_3", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> >());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"].Add("list_4", new System.Collections.Generic.Dictionary <string, int>());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"]["list_4"].Add("value", -1);
                                        #elif (NEST_5)
                    t_item_from.Add("list_0", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > > >());
                    t_item_from["list_0"].Add("list_1", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> > >());
                    t_item_from["list_0"]["list_1"].Add("list_2", new System.Collections.Generic.Dictionary <string, System.Collections.Generic.Dictionary <string, int> >());
                    t_item_from["list_0"]["list_1"]["list_2"].Add("list_3", new System.Collections.Generic.Dictionary <string, int>());
                    t_item_from["list_0"]["list_1"]["list_2"]["list_3"].Add("value", -1);
                                        #endif
                }

                //オブジェクト ==> JSONITEM。
                                #if (FEE_JSON)
                Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <ITEM_TYPE>(t_item_from);
                                #endif

                //JSONITEM ==> JSON文字列。
                                #if (FEE_JSON)
                string t_jsonstring = t_jsonitem.ConvertToJsonString();
                                #else
                string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from);
                                #endif

                //JSON文字列 ==> オブジェクト。
                                #if (FEE_JSON)
                ITEM_TYPE t_item_to = Fee.JsonItem.Convert.JsonStringToObject <ITEM_TYPE>(t_jsonstring);
                                #else
                ITEM_TYPE t_item_to = UnityEngine.JsonUtility.FromJson <ITEM_TYPE>(t_jsonstring);
                                #endif

                //ログ。
                UnityEngine.Debug.Log(a_label + " : " + t_jsonstring);

                //チェック。
                if (Check(t_item_from, t_item_to) == false)
                {
                    UnityEngine.Debug.LogError("mismatch");
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message);
            }
        }
コード例 #26
0
        /** 更新。
         */
        public static void Main(string a_label = nameof(Test_03))
        {
            UnityEngine.Debug.Log("----- " + a_label + " -----");

            try{
                Item t_item_from = new Item();
                {
                    //文字。
                    t_item_from.value_string = "aあア亜ぁアA\u3042";

                    //ベル。
                    t_item_from.value_bell = "\a";

                    //ヌル。
                    t_item_from.value_null = "-\0-";

                    //バックスペース。
                    t_item_from.value_backspace = "\b";

                    //ラインフィード。
                    t_item_from.value_linefeed = "\r";

                    //タブ。
                    t_item_from.value_tab = "\t";

                    //ダブルクォーテーション。
                    t_item_from.value_double_quotation = "\"";

                    //シングルクォーテーション。
                    t_item_from.value_single_quotation = "'";

                    //バックスラッシュ。
                    t_item_from.value_back_slash = "\\";

                    //キャリッジリターン。
                    t_item_from.value_carriage_return = "\n";

                    //スラッシュ。
                    t_item_from.value_slash = "/";

                    //ニューページ。
                    t_item_from.value_new_page = "\f";
                }

                //オブジェクト ==> JSONITEM。
                                #if (FEE_JSON)
                Fee.JsonItem.JsonItem t_jsonitem = Fee.JsonItem.Convert.ObjectToJsonItem <Item>(t_item_from);
                                #endif

                //JSONITEM ==> JSON文字列。
                                #if (FEE_JSON)
                string t_jsonstring = t_jsonitem.ConvertToJsonString();
                                #else
                string t_jsonstring = UnityEngine.JsonUtility.ToJson(t_item_from);
                                #endif

                //JSON文字列 ==> オブジェクト。
                                #if (FEE_JSON)
                Item t_item_to = Fee.JsonItem.Convert.JsonStringToObject <Item>(t_jsonstring);
                                #else
                Item t_item_to = UnityEngine.JsonUtility.FromJson <Item>(t_jsonstring);
                                #endif

                //ログ。
                UnityEngine.Debug.Log(a_label + " : " + t_jsonstring);

                //チェック。
                if (Check(t_item_from, t_item_to) == false)
                {
                    UnityEngine.Debug.LogError("mismatch");
                }
            }catch (System.Exception t_exception) {
                UnityEngine.Debug.LogError(a_label + " : exception : " + t_exception.Message);
            }
        }
コード例 #27
0
        /** constructor
         */
        public JsonViewer_Item(string a_label, JsonViewer a_viewer, int a_layer, Fee.JsonItem.JsonItem a_jsonitem)
        {
            //deleter
            this.deleter = new Fee.Deleter.Deleter();

            //viewer
            this.viewer = a_viewer;

            //layer
            this.layer = a_layer;

            //jsonitem
            this.jsonitem = a_jsonitem;

            string t_text;

            UnityEngine.Color t_color = UnityEngine.Color.black;
            {
                if (a_jsonitem == null)
                {
                    t_text = a_label;
                }
                else
                {
                    //親がインデックス配列ならインデックス、連想配列ならキー名。
                    t_text = "label = " + a_label + "\n";

                    //データタイプ名。
                    t_text += a_jsonitem.GetValueType().ToString() + "\n";

                    //データ。
                    switch (a_jsonitem.GetValueType())
                    {
                    case Fee.JsonItem.ValueType.AssociativeArray:
                    {
                        t_text += "count = " + a_jsonitem.GetListMax().ToString() + "\n";
                        t_color = new UnityEngine.Color(0.2f, 0.3f, 0.2f, 1.0f);
                    } break;

                    case Fee.JsonItem.ValueType.IndexArray:
                    {
                        t_text += "count = " + a_jsonitem.GetListMax().ToString() + "\n";
                        t_color = new UnityEngine.Color(0.4f, 0.2f, 0.5f, 1.0f);
                    } break;

                    case Fee.JsonItem.ValueType.BoolData:
                    {
                        t_text += "value = " + a_jsonitem.GetBoolData().ToString() + "\n";
                        t_color = new UnityEngine.Color(0.1f, 0.2f, 0.4f, 1.0f);
                    } break;

                    case Fee.JsonItem.ValueType.SignedNumber:
                    {
                        t_text += "value = " + a_jsonitem.GetSignedNumber().ToString() + "\n";
                        t_color = new UnityEngine.Color(0.5f, 0.2f, 0.8f, 1.0f);
                    } break;

                    case Fee.JsonItem.ValueType.UnsignedNumber:
                    {
                        t_text += "value = " + a_jsonitem.GetUnsignedNumber().ToString() + "\n";
                        t_color = new UnityEngine.Color(0.4f, 0.6f, 0.3f, 1.0f);
                    } break;

                    case Fee.JsonItem.ValueType.FloatingNumber:
                    {
                        t_text += "value = " + a_jsonitem.GetFloatingNumber().ToString() + "\n";
                        t_color = new UnityEngine.Color(0.2f, 0.2f, 0.5f, 1.0f);
                    } break;

                    case Fee.JsonItem.ValueType.DecimalNumber:
                    {
                        t_text += "value = " + a_jsonitem.GetDecimalNumber().ToString() + "\n";
                        t_color = new UnityEngine.Color(0.1f, 0.1f, 0.1f, 1.0f);
                    } break;

                    case Fee.JsonItem.ValueType.StringData:
                    {
                        t_text += "value = " + a_jsonitem.GetStringData() + "\n";
                        t_color = new UnityEngine.Color(0.5f, 0.2f, 0.2f, 1.0f);
                    } break;
                    }
                }
            }

            //text
            this.text = Fee.Render2D.Text2D.Create(this.deleter, 0);
            this.text.SetText(t_text);
            this.text.SetAlignmentType(Fee.Render2D.Text2D_HorizontalAlignmentType.Left, Fee.Render2D.Text2D_VerticalAlignmentType.Top);
            this.text.SetColor(in t_color);
            this.text.SetClip(true);
            this.text.SetVisible(false);

            //button
            this.button = Fee.Ui.Button.Create(this.deleter, 0);
            this.button.SetNormalTexture(UnityEngine.Texture2D.whiteTexture);
            this.button.SetOnTexture(UnityEngine.Texture2D.whiteTexture);
            this.button.SetDownTexture(UnityEngine.Texture2D.whiteTexture);
            this.button.SetLockTexture(UnityEngine.Texture2D.whiteTexture);
            this.button.SetNormalColor(0.8f, 0.8f, 0.8f, 1.0f);
            this.button.SetOnColor(0.7f, 0.7f, 0.7f, 1.0f);
            this.button.SetDownColor(0.6f, 0.6f, 0.6f, 1.0f);
            this.button.SetLockColor(0.5f, 0.5f, 0.5f, 1.0f);
            this.button.SetOnButtonClick(this, -1);
            this.button.SetClip(true);
            this.button.SetVisible(false);
            this.button.SetDragCancelFlag(true);
        }