void ProcessCloudData(byte[] cloudData) { if (cloudData == null) { Debug.Log("No data saved to the cloud yet..."); return; } Debug.Log("Decoding cloud data from bytes."); GameProgress progress = GameProgress.FromBytes(cloudData); Debug.Log("Merging with existing game progress."); mProgress.MergeWith(progress); }
public byte[] OnStateConflict(int slot, byte[] local, byte[] server) { Debug.Log("Conflict callback called. Resolving conflict."); // decode byte arrays into game progress and merge them GameProgress localProgress = local == null ? new GameProgress() : GameProgress.FromBytes(local); GameProgress serverProgress = server == null ? new GameProgress() : GameProgress.FromBytes(server); localProgress.MergeWith(serverProgress); // resolve conflict return(localProgress.ToBytes()); }