private void SaveGameProcessing(SavedGameRequestStatus status, ISavedGameMetadata metaData, ISaveGame game, SocialCallbackSaveGame saveResult) { #if UNITY_ANDROID if (status == SavedGameRequestStatus.Success) { byte[] data = game.ObjectToBytes(); SavedGameMetadataUpdate.Builder builder = new SavedGameMetadataUpdate.Builder(); SavedGameMetadataUpdate updatedMetadata = builder.Build(); ((PlayGamesPlatform)Social.Active).SavedGame.CommitUpdate(metaData, updatedMetadata, data, //Lamda Result (SavedGameRequestStatus statusCommit, ISavedGameMetadata metaDataCommit) => { if (statusCommit == SavedGameRequestStatus.Success) { saveResult.Invoke(ESocialCloudState.ESocialCloudState_Completed); } else { saveResult.Invoke(ESocialCloudState.ESocialCloudState_Failure_CannotSaveGame); } }); } else { saveResult.Invoke(ESocialCloudState.ESocialCloudState_Failure_CannotOpenSavedGame); } #else saveResult.Invoke(ESocialCloudState.ESocialCloudState_Failure_CannotOpenSavedGame); #endif }
public void SaveGame(ISaveGame objectToSave, SocialCallbackSaveGame saveDelegate) { if (IsUserConnected()) { #if UNITY_ANDROID //TODO Implement Async. StartCoroutine?UniTask? ((PlayGamesPlatform)Social.Active).SavedGame.OpenWithAutomaticConflictResolution(CLOUD_SAVE_FILENAME, DataSource.ReadCacheOrNetwork, ConflictResolutionStrategy.UseLongestPlaytime, (SavedGameRequestStatus s, ISavedGameMetadata m) => SaveGameProcessing(s, m, objectToSave, saveDelegate)); #else saveDelegate.Invoke(ESocialCloudState.ESocialCloudState_Failure_CannotSaveGame); #endif } else { saveDelegate.Invoke(ESocialCloudState.ESocialCloudState_NotAuthenticated); } }
public void SaveGame(ISaveGame objectToSave, SocialCallbackSaveGame saveDelegate) { Debug.Log("SocialMacPc, SaveGame : Not implemented so far on PC/Mac"); saveDelegate.Invoke(ESocialCloudState.ESocialCloudState_NotSupportedByPlatform); }