Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
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);
            }
        }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
        /** 更新。
         */
        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);
            }
        }
Exemplo n.º 6
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);
            }
        }
Exemplo n.º 7
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);
            }
        }
Exemplo n.º 8
0
        /** 更新。
         */
        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);
            }
        }
Exemplo n.º 9
0
        /** 更新。
         */
        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);
            }
        }
Exemplo n.º 10
0
        /** 更新。
         */
        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);
            }
        }
Exemplo n.º 11
0
        /** 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);
            }
        }
Exemplo n.º 12
0
        /** コンバート。
         */
        public static void Convert(string a_convert_param, Fee.File.Path a_assets_path, Fee.JsonItem.JsonItem[] a_sheet, Fee.JsonSheet.ConvertParam a_convertparam)
        {
            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.AssetTool.WriteTextFile(a_assets_path, t_jsonitem.ConvertToJsonString());
            }catch (System.Exception t_exception) {
                Tool.DebugReThrow(t_exception);
            }
        }
Exemplo n.º 13
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);
            }
        }
Exemplo n.º 14
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);
            }
        }
Exemplo n.º 15
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);
            }
        }