public void ExecuteCloudLoad() { #if !NO_GPGS platformSaveUtil.ShowLoadProgressPopup(); var savedGameClient = PlayGamesPlatform.Instance.SavedGame; if (savedGameClient != null) { Open(savedGameClient, true, OnSavedGameOpenedAndReadConflictResolve, OnSavedGameOpenedAndRead); } else { // handle error platformSaveUtil.ShowLoadErrorPopup("OnClick_cloudSave: savedGameClient null"); PlatformInterface.instance.logManager.Add(PlatformInterface.instance.logEntryType.GameCloudLoadFailure, 0, 2); } #endif }
public void OnSavedGameOpenedAndRead(SavedGameRequestStatus status, ISavedGameMetadata game) { if (status == SavedGameRequestStatus.Success) { // handle reading or writing of saved game. SushiDebug.LogFormat("Save game open (read) success! Filename: {0}", game.Filename); LoadGameData(game); } else { // handle error PlatformSaveUtil.ShowLoadErrorPopup("OnSavedGameOpenedAndRead: status != SavedGameRequestStatus.Success"); BalloonLogManager.Add(BalloonLogEntry.Type.GameCloudLoadFailure, 0, 3); } }
public void OnSavedGameDataRead(SavedGameRequestStatus status, byte[] data) { if (status == SavedGameRequestStatus.Success) { // handle processing the byte array data SushiDebug.LogFormat("OnSavedGameDataRead success! - Data size: {0} bytes", data.Length); var remoteSaveDict = PlatformSaveUtil.DeserializeSaveData(data); PlatformSaveUtil.LoadDataAndLoadSplashScene(remoteSaveDict); } else { // handle error PlatformSaveUtil.ShowLoadErrorPopup("OnSavedGameDataRead: status == SavedGameRequestStatus.Success"); BalloonLogManager.Add(BalloonLogEntry.Type.GameCloudLoadFailure, 0, 4); } }
public void OnCloudLoadResult(string result, byte[] data) { if (result == "OK") { PlatformInterface.instance.logger.LogFormat("OnCloudLoadResult: data length {0} bytes", data?.Length ?? 0); // 메타데이터 조회의 경우와 실제 세이브 데이터 로딩의 경우를 나눠서 처리 if (onPeekResultSave != null) { PlatformInterface.instance.logger.Log("OnCloudLoadResult: onPeekResultSave valid"); onPeekResultSave(data); onPeekResultSave = null; } else { PlatformInterface.instance.logger.Log("OnCloudLoadResult: onPeekResultSave empty. data load..."); if (data == null || data.Length == 0) { platformSaveUtil.ShowLoadErrorPopup("OnCloudLoadResult: Cloud save data corrupted"); } else { PlatformInterface.instance.logger.LogFormat("OnCloudLoadResult: success! - Data size: {0} bytes", data.Length); var remoteSaveDict = PlatformInterface.instance.saveUtil.DeserializeSaveData(data); PlatformInterface.instance.saveUtil.LoadDataAndLoadSplashScene(remoteSaveDict); } } } else { platformSaveUtil.ShowSaveErrorPopup( PlatformInterface.instance.textHelper.GetText("platform_cloud_load_fail") + "\n\n" + result); } }
public void OnCloudLoadResult(string result, byte[] data) { if (result == "OK") { SushiDebug.LogFormat("OnCloudLoadResult: data length {0} bytes", data != null ? data.Length : 0); // 메타데이터 조회의 경우와 실제 세이브 데이터 로딩의 경우를 나눠서 처리 if (onPeekResultSave != null) { SushiDebug.Log("OnCloudLoadResult: onPeekResultSave valid"); var cloudMetadata = CloudMetadata.Invalid; if (data == null || data.Length == 0) { } else { try { var remoteSaveDict = PlatformSaveUtil.DeserializeSaveData(data); cloudMetadata = new CloudMetadata { level = PlatformSaveUtil.GetInt32FromRemoteSaveDict(remoteSaveDict, PlatformSaveUtil.ACCOUNT_LEVEL_KEY), levelExp = PlatformSaveUtil.GetInt32FromRemoteSaveDict(remoteSaveDict, PlatformSaveUtil.ACCOUNT_LEVEL_EXP_KEY), gem = PlatformSaveUtil.GetBigIntegerFromRemoteSaveDict(remoteSaveDict, PlatformSaveUtil.ACCOUNT_GEM_KEY), riceRate = PlatformSaveUtil.GetBigIntegerFromRemoteSaveDict(remoteSaveDict, PlatformSaveUtil.ACCOUNT_RICE_RATE_KEY), saveDate = PlatformSaveUtil.GetInt64FromRemoteSaveDict(remoteSaveDict, PlatformSaveUtil.SAVE_DATE_KEY) }; } catch { cloudMetadata = CloudMetadata.Invalid; } } onPeekResultSave(cloudMetadata); onPeekResultSave = null; } else { SushiDebug.Log("OnCloudLoadResult: onPeekResultSave empty. data load..."); if (data == null || data.Length == 0) { PlatformSaveUtil.ShowLoadErrorPopup("OnCloudLoadResult: Cloud save data corrupted"); } else { SushiDebug.LogFormat("OnCloudLoadResult: success! - Data size: {0} bytes", data.Length); var remoteSaveDict = PlatformSaveUtil.DeserializeSaveData(data); PlatformSaveUtil.LoadDataAndLoadSplashScene(remoteSaveDict); } } } else { PlatformSaveUtil.ShowSaveErrorPopup(TextHelper.GetText("platform_cloud_load_fail") + "\n\n" + result); } }