コード例 #1
0
        public void Save <U>(U saveObject, out string saveText)
        {
            StringBuilder nameSave = new StringBuilder();

            nameSave.Append(prefixSave);
            nameSave.Append(myType.ToString());
            nameSave.Append(SaveController.GetNumSave());
            string serialized = JsonUtility.ToJson(saveObject);

            saveText = serialized;
        }
コード例 #2
0
        public void Save <U>(U saveObject)
        {
            StringBuilder nameSave = new StringBuilder();

            nameSave.Append(prefixSave);
            nameSave.Append(myType.ToString());
            nameSave.Append(SaveController.GetNumSave());
            string serialized = JsonUtility.ToJson(saveObject);

            PlayerPrefs.SetString(nameSave.ToString(), serialized);
        }
コード例 #3
0
        public void Load <U>(ref U loadObject)
        {
            StringBuilder nameSave = new StringBuilder();

            nameSave.Append(prefixSave);
            nameSave.Append(myType.ToString());
            nameSave.Append(SaveController.GetNumSave());
            if (PlayerPrefs.HasKey(nameSave.ToString()))
            {
                string serialized = PlayerPrefs.GetString(nameSave.ToString());
                loadObject = JsonUtility.FromJson <U>(serialized);
            }
        }
コード例 #4
0
 public void InitObject()
 {
     myType = this.GetType();
     SaveController.AddObj(this);
 }