void loadSnapshotSucceededEvent( GPGSnapshot snapshot )
 {
     Debug.Log( "loadSnapshotSucceededEvent" );
     Prime31.Utils.logObject( snapshot );
 }
	private static void LoadSnapshotSuccess(GPGSnapshot snapshot)
	{
		if(snapshot.hasDataAvailable)
		{
			if(PlayerPrefs.HasKey(TIMESTAMP))
			{
				Debug.Log(string.Format("Local TIMESTAMP: {0} / SNAPSHOT TIMESTAMP: {1}", (double)PlayerPrefs.GetFloat(TIMESTAMP), snapshot.metadata.lastModifiedTimestamp));
				if((double)PlayerPrefs.GetFloat(TIMESTAMP) > snapshot.metadata.lastModifiedTimestamp)
				{
					Debug.Log("Loaded from PlayerPrefs: " + PlayerPrefs.GetString("_metadata"));
					snapshotKeys = Json.decode<Dictionary<string,object>>(PlayerPrefs.GetString("_metadata"));
				}
				else
				{
					Debug.Log("Loaded from Snapshot: " + System.Text.Encoding.UTF8.GetString(snapshot.snapshotData));
					snapshotKeys = Json.decode<Dictionary<string,object>>(System.Text.Encoding.UTF8.GetString(snapshot.snapshotData));	
				}
			}
			else
			{
				Debug.Log("Loaded from Snapshot: " + System.Text.Encoding.UTF8.GetString(snapshot.snapshotData));
				snapshotKeys = Json.decode<Dictionary<string,object>>(System.Text.Encoding.UTF8.GetString(snapshot.snapshotData));
			}

			if(snapshotKeys == null)
				snapshotKeys = new Dictionary<string, object>();

			isLoaded = true;
			if(OnFinishedLoading != null)
				OnFinishedLoading();
		}

		Debug.Log("Load Snapshot Success. Snapshot count: " + snapshotKeys.Count);
	}
예제 #3
0
 void loadSnapshotSucceededEvent(GPGSnapshot snapshot)
 {
     Debug.Log("loadSnapshotSucceededEvent");
     Prime31.Utils.logObject(snapshot);
 }