Exemplo n.º 1
0
 private void LoadGameProcessing(SavedGameRequestStatus status, ISavedGameMetadata metaData,
                                 SocialCallbackLoadGame loadResult)
 {
     #if UNITY_ANDROID
     if (status == SavedGameRequestStatus.Success)
     {
         ((PlayGamesPlatform)Social.Active).SavedGame.ReadBinaryData(metaData,
                                                                     //Lamda Result
                                                                     (SavedGameRequestStatus statusReading, byte[] bytes) => {
             if (statusReading == SavedGameRequestStatus.Success)
             {
                 loadResult.Invoke(ESocialCloudState.ESocialCloudState_Completed, bytes);
             }
             else
             {
                 loadResult.Invoke(ESocialCloudState.ESocialCloudState_Failure_CannotLoadGame, null);
             }
         }
                                                                     );
     }
     else
     {
         loadResult.Invoke(ESocialCloudState.ESocialCloudState_Failure_CannotOpenSavedGame, null);
     }
     #else
     loadResult.Invoke(ESocialCloudState.ESocialCloudState_Failure_CannotOpenSavedGame, null);
     #endif
 }
Exemplo n.º 2
0
 public void LoadGame(SocialCallbackLoadGame loadDelegate)
 {
     if (IsUserConnected())
     {
         //TODO Implement Async. StartCoroutine?UniTask?
         #if UNITY_ANDROID
         ((PlayGamesPlatform)Social.Active).SavedGame.OpenWithAutomaticConflictResolution(CLOUD_SAVE_FILENAME,
                                                                                          DataSource.ReadCacheOrNetwork,
                                                                                          ConflictResolutionStrategy.UseLongestPlaytime,
                                                                                          (SavedGameRequestStatus s, ISavedGameMetadata m) => LoadGameProcessing(s, m, loadDelegate));
         #else
         loadDelegate.Invoke(ESocialCloudState.ESocialCloudState_Failure_CannotLoadGame);
         #endif
     }
     else
     {
         loadDelegate.Invoke(ESocialCloudState.ESocialCloudState_NotAuthenticated, null);
     }
 }
 public void LoadGame(SocialCallbackLoadGame loadDelegate)
 {
     Debug.Log("SocialMacPc, LoadGame : Not implemented so far on PC/Mac");
     loadDelegate.Invoke(ESocialCloudState.ESocialCloudState_NotSupportedByPlatform, null);
 }