示例#1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Alpha3))
     {
         //Load
         Debug.Log("Loading data and updating text...");
         UpdateText();
         PersistentDataManager.LoadData();
     }
     if (Input.GetKeyDown(KeyCode.Alpha4))
     {
         //Save
         Debug.Log("Saving GameManager...");
         PersistentDataManager.SaveData();
     }
     if (Input.GetKeyDown(KeyCode.UpArrow))
     {
         //Increment Money
         GameManager.gameManager.AddMoney(1);
         Debug.Log("Increment success!");
     }
     if (Input.GetKeyDown(KeyCode.DownArrow))
     {
         //Decrement Money
         GameManager.gameManager.AddMoney(-1);
         Debug.Log("Decrement success!");
     }
 }
    void Start()
    {
        if (StaticDataManager.LoadData(Application.dataPath))
        {
            // do something with data
        }
        else
        {
            StaticDataManager.SetupDefaultData();
        }
        //string locText = localizationDictionary["MyKey"]["en"];
        if (PersistentDataManager.LoadData())
        {
            // do something with data
        }
        else
        {
            PersistentDataManager.CreateDefaultData();
            PersistentDataManager.SaveData();
        }

        LoadLocalizationData();
    }
 public void SavePlayerData()
 {
     PersistentDataManager.SaveData();
 }
示例#4
0
 void OnDestroy()
 {
     PersistentDataManager.SaveData();
 }
示例#5
0
 void OnApplicationQuit()
 {
     PersistentDataManager.SaveData();
 }
示例#6
0
 public void SetMoney(int amount)
 {
     Money = amount;
     PersistentDataManager.SaveData();
     UpdateUI();
 }