示例#1
0
    private void changeSaveData()
    {
        Debug.Log("old data = " + Application.persistentDataPath + "/savedata.json");
        foreach (JSONObject charItem in StaticVariables.saveData.GetField("characters").list)
        {
            //DO something
            charItem.SetField("SkillCD", charItem.GetField("SkillCD").n + 20);
        }
        //sample code
        JSONObject charData = StaticVariables.GetCharacterStatus(0);

        Debug.Log(charData.GetField("MaxMP").n);
        charData.SetField("MaxMP", charData.GetField("MaxMP").n + 10);
        charData.SetField("MaxHP", charData.GetField("MaxHP").n + 15);


        int coinT = StaticVariables.GetTotalCoins();

        StaticVariables.SetTotalCoins(coinT + 100);

        Save.saveState();
        Debug.Log("new data saved!!");
    }