public void Write_And_Read_MultipleData()
        {
            List <STestJson> listTestJson  = new List <STestJson>();
            List <STestJson> listTestJson2 = new List <STestJson>();

            for (int i = 0; i < 3; i++)
            {
                STestJson pTestJson = new STestJson();
                pTestJson.DoSetDataRandom();

                listTestJson.Add(pTestJson);
            }

            JsonUtilityExtension.DoWriteJsonArray(const_strFolderPath, nameof(Write_And_Read_MultipleData), listTestJson.ToArray());
            JsonUtilityExtension.DoReadJsonArray(const_strFolderPath, nameof(Write_And_Read_MultipleData), ref listTestJson2);

            for (int i = 0; i < 3; i++)
            {
                STestJson pTestJson  = listTestJson[i];
                STestJson pTestJson2 = listTestJson2[i];

                Assert.IsTrue(pTestJson._int == pTestJson2._int);
                Assert.IsTrue(pTestJson._string == pTestJson2._string);
                Assert.IsTrue(pTestJson._vector3 == pTestJson2._vector3);
            }
        }
Example #2
0
    static public void DoInit(string strDBArray)
    {
        GameConfigData[] arrConfigData = JsonUtilityExtension.DoReadJsonArray <GameConfigData>(strDBArray);
        _mapGameConfigData.DoClear_And_AddItem(arrConfigData);

        for (int i = 0; i < arrConfigData.Length; i++)
        {
            arrConfigData[i].DoInit();
        }
    }
        public void Write_And_Read_SingleScriptableData()
        {
            STestJson_ScriptableObject pTestJson  = ScriptableObject.CreateInstance <STestJson_ScriptableObject>();
            STestJson_ScriptableObject pTestJson2 = ScriptableObject.CreateInstance <STestJson_ScriptableObject>();

            pTestJson.DoSetDataRandom();

            Assert.IsFalse(pTestJson._int == pTestJson2._int);
            Assert.IsFalse(pTestJson._string == pTestJson2._string);
            Assert.IsFalse(pTestJson._vector3 == pTestJson2._vector3);

            JsonUtilityExtension.DoWriteJson(const_strFolderPath, nameof(Write_And_Read_SingleScriptableData), pTestJson);
            JsonUtilityExtension.DoReadJson_ScriptableObject(const_strFolderPath, nameof(Write_And_Read_SingleScriptableData), out pTestJson2);

            Assert.IsTrue(pTestJson._int == pTestJson2._int);
            Assert.IsTrue(pTestJson._string == pTestJson2._string);
            Assert.IsTrue(pTestJson._vector3 == pTestJson2._vector3);
        }
        public void Write_And_Read_SingleData()
        {
            STestJson pTestJson  = new STestJson();
            STestJson pTestJson2 = new STestJson();

            pTestJson.DoSetDataRandom();

            Assert.IsFalse(pTestJson._int == pTestJson2._int);
            Assert.IsFalse(pTestJson._string == pTestJson2._string);
            Assert.IsFalse(pTestJson._vector3 == pTestJson2._vector3);

            JsonUtilityExtension.DoWriteJson(const_strFolderPath, nameof(Write_And_Read_SingleData), pTestJson);
            JsonUtilityExtension.DoReadJson(const_strFolderPath, nameof(Write_And_Read_SingleData), out pTestJson2);

            Assert.IsTrue(pTestJson._int == pTestJson2._int);
            Assert.IsTrue(pTestJson._string == pTestJson2._string);
            Assert.IsTrue(pTestJson._vector3 == pTestJson2._vector3);
        }
    // ========================================================================== //

    /* public - [Do] Function
     * 외부 객체가 호출(For External class call)*/

    public void DoInit(string strDBDataArray)
    {
        p_list_DBContainer.Clear();
        _mapDBContainer.Clear();

        CLASS_DB[] arrDBData = JsonUtilityExtension.DoReadJsonArray_ScriptableObject <CLASS_DB>(strDBDataArray);
        for (int i = 0; i < arrDBData.Length; i++)
        {
            CLASS_DB pData        = arrDBData[i];
            string   strDBDataKey = pData.IDictionaryItem_GetKey();
            if (string.IsNullOrEmpty(strDBDataKey))
            {
                continue;
            }

            pData.name = strDBDataKey;
            OnInitDBContainer(strDBDataKey, pData);

            _mapDBContainer.Add(strDBDataKey, pData);
            p_list_DBContainer.Add(pData);
        }
    }