Inheritance: IDisposable
Exemplo n.º 1
0
    private static bool HandleSyncConflict(Amazon.CognitoSync.SyncManager.Dataset dataset, List <SyncConflict> conflicts)
    {
        if (dataset.Metadata != null)
        {
            Debug.LogWarning("Sync conflicct resolution required for dataset: " + dataset.Metadata.DatasetName);
        }
        else
        {
            Debug.LogWarning("Sync conflicct resolution required for dataset");
        }

        List <Amazon.CognitoSync.SyncManager.Record> resolvedRecords = new List <Amazon.CognitoSync.SyncManager.Record>();

        foreach (SyncConflict conflictRecord in conflicts)
        {
            // This example resolves all the conflicts using ResolveWithRemoteRecord
            // SyncManager provides the following default conflict resolution methods:
            //      ResolveWithRemoteRecord - overwrites the local with remote records
            //      ResolveWithLocalRecord - overwrites the remote with local records
            //      ResolveWithValue - for developer logic
            resolvedRecords.Add(conflictRecord.ResolveWithRemoteRecord());
        }

        // resolves the conflicts in local storage
        dataset.Resolve(resolvedRecords);

        // on return true the synchronize operation continues where it left,
        //      returning false cancels the synchronize operation

        AdvanceGameState();

        return(true);
    }
Exemplo n.º 2
0
    private bool HandleSyncConflict(Amazon.CognitoSync.SyncManager.Dataset dataset, List <SyncConflict> conflicts)
    {
        List <Amazon.CognitoSync.SyncManager.Record> resolvedRecords = new List <Amazon.CognitoSync.SyncManager.Record>();

        foreach (SyncConflict conflictRecord in conflicts)
        {
            resolvedRecords.Add(conflictRecord.ResolveWithRemoteRecord());
        }
        // resolves the conflicts in local storage
        dataset.Resolve(resolvedRecords);
        // on return true the synchronize operation continues where it left,
        //      returning false cancels the synchronize operation
        return(true);
    }
Exemplo n.º 3
0
        void Start()
        {

            // Open your datasets
            playerInfo = SyncManager.OpenOrCreateDataset("PlayerInfo");

            // Fetch locally stored data from a previous run
            alias = string.IsNullOrEmpty(playerInfo.Get("alias")) ? "Enter your alias" : playerInfo.Get("alias");
            playerName = string.IsNullOrEmpty(playerInfo.Get("playerName")) ? "Enter your full name" : playerInfo.Get("playerName");

			// Define Synchronize callbacks
			// when ds.Synchronize() is called the localDataset is merged with the remoteDataset 
            // OnDatasetDeleted, OnDatasetMerged, OnDatasetSuccess,  the corresponding callback is fired.
            // The developer has the freedom of handling these events needed for the Dataset
            playerInfo.OnSyncSuccess += this.HandleSyncSuccess; // OnSyncSucess uses events/delegates pattern
            playerInfo.OnSyncFailure += this.HandleSyncFailure; // OnSyncFailure uses events/delegates pattern
            playerInfo.OnSyncConflict = this.HandleSyncConflict;
            playerInfo.OnDatasetMerged = this.HandleDatasetMerged;
            playerInfo.OnDatasetDeleted = this.HandleDatasetDeleted;

        }
Exemplo n.º 4
0
        private bool HandleSyncConflict(Amazon.CognitoSync.SyncManager.Dataset dataset, List <SyncConflict> conflicts)
        {
            statusMessage = "Handling Sync Conflicts.";
            Debug.Log("OnSyncConflict");
            List <Amazon.CognitoSync.SyncManager.Record> resolvedRecords = new List <Amazon.CognitoSync.SyncManager.Record>();

            foreach (SyncConflict conflictRecord in conflicts)
            {
                // This example resolves all the conflicts using ResolveWithRemoteRecord
                // SyncManager provides the following default conflict resolution methods:
                //      ResolveWithRemoteRecord - overwrites the local with remote records
                //      ResolveWithLocalRecord - overwrites the remote with local records
                //      ResolveWithValue - for developer logic
                resolvedRecords.Add(conflictRecord.ResolveWithRemoteRecord());
            }

            // resolves the conflicts in local storage
            dataset.Resolve(resolvedRecords);

            // on return true the synchronize operation continues where it left,
            //      returning false cancels the synchronize operation
            return(true);
        }
Exemplo n.º 5
0
    private bool HandleSyncConflict(Amazon.CognitoSync.SyncManager.Dataset dataset, List <SyncConflict> conflicts)
    {
        if (dataset.Metadata != null)
        {
            Debug.LogWarning("Sync conflict " + dataset.Metadata.DatasetName);
        }
        else
        {
            //In case we called synchronize after deleting the dataset, we can not access it anymore
            Debug.LogWarning("Sync conflict");
        }

        List <Amazon.CognitoSync.SyncManager.Record> resolvedRecords = new List <Amazon.CognitoSync.SyncManager.Record>();

        foreach (SyncConflict conflictRecord in conflicts)
        {
            resolvedRecords.Add(conflictRecord.ResolveWithRemoteRecord());
        }
        // resolves the conflicts in local storage
        dataset.Resolve(resolvedRecords);
        // on return true the synchronize operation continues where it left,
        //      returning false cancels the synchronize operation
        return(true);
    }
Exemplo n.º 6
0
 public bool HandleDatasetMerged(Dataset dataset, List<string> datasetNames)
 {
     statusMessage = "Merging datasets between different identities.";
     Debug.Log(dataset + " Dataset needs merge");
     // returning true allows the Synchronize to resume and false cancels it
     return true;
 }
Exemplo n.º 7
0
        private bool HandleDatasetDeleted(Dataset dataset)
        {

            statusMessage = dataset.Metadata.DatasetName + "Dataset has been deleted.";
            Debug.Log(dataset.Metadata.DatasetName + " Dataset has been deleted");

            // Clean up if necessary 

            // returning true informs the corresponding dataset can be purged in the local storage and return false retains the local dataset
            return true;
        }