Ejemplo n.º 1
0
    public void Save(int i)
    {
        playerData.id             = i;
        playerData.roleVo         = roleVo.Save();
        playerData.servantsModel  = servantModel.Save();
        playerData.skillModel     = skillModel.Save();
        playerData.equipModel     = equipModel.Save();
        playerData.itemModel      = itemModel.Save();
        playerData.mapModel       = mapModel.Save();
        playerData.baseSkillModel = "";

        string jsonInfo = JsonUtility.ToJson(playerData);

        StreamWriter sw;
        FileInfo     t = new FileInfo(Application.persistentDataPath + "//playerData_" + i + ".json");

        if (!t.Exists)
        {
            sw = t.CreateText();
        }
        else
        {
            sw = t.CreateText();
        }
        sw.Write(jsonInfo);
        sw.Close();
        sw.Dispose();
    }