private void OnConflict(string data) { Debug.Log("SavedGamesManager: OnConflict"); string[] storeData; storeData = data.Split(AndroidNative.DATA_SPLITTER [0]); string Title = storeData [0]; long LastModifiedTimestamp = System.Convert.ToInt64(storeData [1]); string Description = storeData [2]; string CoverImageUrl = storeData [3]; long TotalPlayedTime = System.Convert.ToInt64(storeData [4]); byte[] decodedFromBase64 = System.Convert.FromBase64String(storeData [5]); GP_Snapshot Snapshot1 = new GP_Snapshot(); Snapshot1.meta.Title = Title; Snapshot1.meta.Description = Description; Snapshot1.meta.CoverImageUrl = CoverImageUrl; Snapshot1.meta.LastModifiedTimestamp = LastModifiedTimestamp; Snapshot1.meta.TotalPlayedTime = TotalPlayedTime; Snapshot1.bytes = decodedFromBase64; Snapshot1.stringData = GetString(decodedFromBase64); Title = storeData [6]; LastModifiedTimestamp = System.Convert.ToInt64(storeData [7]); Description = storeData [8]; CoverImageUrl = storeData [9]; TotalPlayedTime = System.Convert.ToInt64(storeData [10]); decodedFromBase64 = System.Convert.FromBase64String(storeData [11]); GP_Snapshot Snapshot2 = new GP_Snapshot(); Snapshot2.meta.Title = Title; Snapshot2.meta.Description = Description; Snapshot2.meta.CoverImageUrl = CoverImageUrl; Snapshot2.meta.LastModifiedTimestamp = LastModifiedTimestamp; Snapshot2.meta.TotalPlayedTime = TotalPlayedTime; Snapshot2.bytes = decodedFromBase64; Snapshot2.stringData = GetString(decodedFromBase64); GP_SnapshotConflict result = new GP_SnapshotConflict(Snapshot1, Snapshot2); dispatch(CONFLICT, result); ActionConflict(result); }
private void ActionConflict(GP_SnapshotConflict result) { GP_Snapshot snapshot = result.Snapshot; GP_Snapshot conflictSnapshot = result.ConflictingSnapshot; // Resolve between conflicts by selecting the newest of the conflicting snapshots. GP_Snapshot mResolvedSnapshot = snapshot; if (snapshot.meta.LastModifiedTimestamp < conflictSnapshot.meta.LastModifiedTimestamp) { mResolvedSnapshot = conflictSnapshot; } result.Resolve(mResolvedSnapshot); }
private void ActionConflict(GP_SnapshotConflict result) { Debug.Log("Conflict Detected: "); GP_Snapshot snapshot = result.Snapshot; GP_Snapshot conflictSnapshot = result.ConflictingSnapshot; // Resolve between conflicts by selecting the newest of the conflicting snapshots. GP_Snapshot mResolvedSnapshot = snapshot; if (snapshot.meta.LastModifiedTimestamp < conflictSnapshot.meta.LastModifiedTimestamp) { mResolvedSnapshot = conflictSnapshot; } result.Resolve(mResolvedSnapshot); }