public static SaveGold GetSav() { //如果_sav为空,则初始化_sav,否则直接返回_sav if (_sav == null) { GameObject obj = new GameObject(); _sav = obj.AddComponent <SaveGold> (); } return(_sav); }
public void OnSuccess(object response) { Storage storage = (Storage)response; IList <Storage.JSONDocument> jsonDocList = storage.GetJsonDocList(); SaveGold saveGold = JsonUtility.FromJson <SaveGold>(jsonDocList[0].GetJsonDoc()); GameManager.Instance.gold = saveGold.gold; PlayerPrefs.SetInt("GoldPre", PlayerPrefs.GetInt("Gold", 10)); Debug.Log(GameManager.Instance.gold); UIManager.Instance.PushGiveGold("The restore process has completed successfully !"); //Mng.mng.ui.loading.SetActive(false); }
void Awak() { _sav = this; }