public void SaveToCloud() { SaveData.CloudGameData temp = new SaveData.CloudGameData(); temp.purchasedData = SaveData.Instance.GetLocalPurchasedData(); temp.userData = SaveData.Instance.GetLocalUserData(); //string dataToSave = SaveData.Instance.GetCloudSaveData(); string dataToSave = JsonUtility.ToJson(temp); //Debug.Log("Debug : Save To Cloud"); //PrintData(JsonUtility.FromJson<SaveData.CloudGameData>(dataToSave)); if (dataToSave == null) { //Debug.Log("dataToSave is null"); } if (isAuthenticated) { ActiveWaitScreen(); loadedData = dataToSave; isProcessing = true; ((PlayGamesPlatform)Social.Active).SavedGame.OpenWithAutomaticConflictResolution(m_saveFileName, DataSource.ReadCacheOrNetwork, ConflictResolutionStrategy.UseLongestPlaytime, OnFileOpenToSave); SaveData.Instance.SetCloudSaveDataToLocalData(temp); } else { Login(); } }
private void SetCloudDataToLocal(string data) { SaveData.CloudGameData saveData = new SaveData.CloudGameData(); saveData = JsonUtility.FromJson <SaveData.CloudGameData>(data); //Debug.Log("SetCloudDataToLocal"); //PrintData(saveData); SaveData.Instance.SetCloudSaveDataToLocalData(saveData, isApplyToLocal); isApplyToLocal = true; }
public void SetDataFromCloudSave(SaveData.CloudGameData data) { if (textMyCoin == null) { textMyCoin = GameObject.Find("TextMyCoins").GetComponent <Text>(); } if (textMyScore == null) { textMyScore = GameObject.Find("TextMyScore").GetComponent <Text>(); } myCoins = data.userData.coins; myScore = data.userData.bestScore; myBestScore = myScore; textMyCoin.text = "" + myCoins; textMyScore.text = "" + myScore; }
public void PrintData(SaveData.CloudGameData data) { Debug.Log("Score " + data.userData.bestScore); Debug.Log("Coin " + data.userData.coins); foreach (var p in data.purchasedData) { string detail = string.Format( " Name : {0} \n life : {1} \n" + " Slot : {2} \n Shield : {3} \n" + " Price : {4} \n Purchased : {5} \n" + " Selected : {6}", p.name, p.lifeTime, p.itemSlot, p.shieldDuration, p.price, p.purchased, p.selected); Debug.Log(detail); } }