示例#1
0
        public void OpenWithManualConflictResolution(string name, bool prefetchDataOnConflict,
                                                     SavedGameConflictResolver resolverFunction,
                                                     Action <SavedGame, string> completedCallback)
        {
#if EM_GPGS
            Util.NullArgumentTest(name);
            Util.NullArgumentTest(resolverFunction);
            Util.NullArgumentTest(completedCallback);

            PlayGamesPlatform.Instance.SavedGame.OpenWithManualConflictResolution(
                name,
                AsDataSource(EM_Settings.GameServices.GPGSDataSource),
                prefetchDataOnConflict,
                // Internal conflict callback
                (IConflictResolver resolver,
                 ISavedGameMetadata original, byte[] originalData,
                 ISavedGameMetadata unmerged, byte[] unmergedData) =>
            {
                // Invoke the user's conflict resolving function, get their choice
                var choice = resolverFunction(new SavedGame(original), originalData, new SavedGame(unmerged), unmergedData);
                ISavedGameMetadata selectedGame = null;

                switch (choice)
                {
                case SavedGameConflictResolutionStrategy.UseBase:
                    selectedGame = original;
                    break;

                case SavedGameConflictResolutionStrategy.UseRemote:
                    selectedGame = unmerged;
                    break;

                default:
                    Debug.LogError("Unhandled conflict resolution strategy: " + choice.ToString());
                    break;
                }

                // Let the internal client know the selected saved game
                resolver.ChooseMetadata(selectedGame);
            },
                // Completed callback
                (SavedGameRequestStatus status, ISavedGameMetadata game) =>
            {
                completedCallback(game != null ? new SavedGame(game) : null,
                                  status == SavedGameRequestStatus.Success ? null : status.ToString());
            });
#else
            Debug.LogError(SDK_MISSING_MESSAGE);
#endif
        }
示例#2
0
        public void OpenWithManualConflictResolution(string name, bool prefetchDataOnConflict,
                                                     SavedGameConflictResolver resolverFunction,
                                                     Action <SavedGame, string> completedCallback)
        {
            Util.NullArgumentTest(name);
            Util.NullArgumentTest(resolverFunction);
            Util.NullArgumentTest(completedCallback);

            InternalOpenWithManualConflictResolution(
                name,
                prefetchDataOnConflict,
                // Internal conflict callback
                (IIOSConflictResolver resolver,
                 iOSGKSavedGame baseGame, byte[] baseData,
                 iOSGKSavedGame remoteGame, byte[] remoteData) =>
            {
                // Invoke the user's conflict resolving function, get their choice
                var choice = resolverFunction(new SavedGame(baseGame), baseData, new SavedGame(remoteGame), remoteData);

                // Let the internal client know the selected saved game,
                // if the passed data is null if will loaded automatically from the chosen iOSGKSavedGame
                iOSGKSavedGame selectedGame = null;
                byte[] selectedData         = null;

                switch (choice)
                {
                case SavedGameConflictResolutionStrategy.UseBase:
                    selectedGame = baseGame;
                    selectedData = baseData;
                    break;

                case SavedGameConflictResolutionStrategy.UseRemote:
                    selectedGame = remoteGame;
                    selectedData = remoteData;
                    break;

                default:
                    Debug.LogError("Unhandled conflict resolution strategy: " + choice.ToString());
                    break;
                }

                resolver.ChooseGKSavedGame(selectedGame, selectedData);
            },
                // Completed callback
                (iOSGKSavedGame gkSavedGame, string error) =>
            {
                completedCallback(gkSavedGame != null ? new SavedGame(gkSavedGame) : null, error);
            }
                );
        }
示例#3
0
 public void OpenWithManualConflictResolution(string name, bool prefetchDataOnConflict,
                                              SavedGameConflictResolver resolverFunction,
                                              Action <SavedGame, string> completedCallback)
 {
     Debug.LogWarning(UNAVAILABLE_MESSAGE);
 }