Esempio n. 1
0
 public void Load(string _filename)
 {
     if (System.IO.File.Exists(Application.persistentDataPath + "/" + _filename))
     {
         byte[]       bytes    = System.IO.File.ReadAllBytes(Application.persistentDataPath + "/" + _filename);
         string       jsonText = System.Text.Encoding.UTF8.GetString(bytes);
         StoreRecords sr       = JsonUtility.FromJson <StoreRecords> (jsonText);
         records = sr.records;
     }
 }
Esempio n. 2
0
        void OnGUI()
        {
            string jsonText;

            if (GUI.Button(new Rect(100, 10, 100, 30), "Record"))
            {
                records   = new Record[] {};
                mode      = RecordMode.record;
                startTime = Time.time;
            }
            if (GUI.Button(new Rect(210, 10, 100, 30), "RecordPlay"))
            {
                mode      = RecordMode.play;
                place     = 0;
                startTime = Time.time;
                allObject = new Dictionary <string, GameObject>();
            }
            if (GUI.Button(new Rect(310, 10, 100, 30), "Save"))
            {
                new StoreRecords(records).Save("_record.json");
                mode      = RecordMode.none;
                place     = 0;
                startTime = 0;
            }
            if (GUI.Button(new Rect(410, 10, 100, 30), "Load"))
            {
                StoreRecords sr = new StoreRecords("_record.json");
                records   = sr.records;
                mode      = RecordMode.play;
                place     = 0;
                startTime = Time.time;
                allObject = new Dictionary <string, GameObject>();
            }
            if (GUI.Button(new Rect(510, 10, 100, 30), "RenameScene"))
            {
                Scene src = SceneManager.GetSceneByName("TowerAtack");
                Scene dst = SceneManager.CreateScene("NewTestScene");
                SceneManager.MergeScenes(src, dst);
            }
        }