Esempio n. 1
0
    public void loadbagdata()
    {
        string filepath = Application.dataPath + @"/characterdata/bagdata.json";

        Debug.Log(filepath);

        if (!File.Exists(filepath))
        {
            Debug.Log("no file");
            return;
        }
        StreamReader sr      = new StreamReader(filepath);
        string       dataset = sr.ReadToEnd();

        Debug.Log(dataset);
        bag_Data = JsonMapper.ToObject <bag_data>(dataset);
    }
Esempio n. 2
0
    public void savebagdata(bag_data bag_Data)
    {
        string filepath = Application.dataPath + @"/characterdata/bagdata.json";

        Debug.Log(filepath);

        string bagdata = JsonMapper.ToJson(bag_Data);

        Debug.Log(bagdata);

        FileInfo     file = new FileInfo(filepath);
        StreamWriter sw   = new StreamWriter(filepath);//试一下

        sw.WriteLine(bagdata);
        sw.Close();
        sw.Dispose();
        AssetDatabase.Refresh();
    }