Inheritance: PlayFab.SharedModels.PlayFabResultCommon
	void OnCheckInCallback(ExecuteCloudScriptResult result)
	{
		// output any errors that happend within cloud script
		if(result.Error != null)
		{
			Debug.LogError(string.Format("{0} -- {1}", result.Error, result.Error.Message));
			return;
		}	

		Debug.Log("CheckIn Results:");
        List<ItemInstance> grantedItems = PlayFab.Json.JsonWrapper.DeserializeObject<List<ItemInstance>>(result.FunctionResult.ToString());
		
		if(grantedItems != null && grantedItems.Count > 0)
		{
			Debug.Log(string.Format("You were granted {0} items:", grantedItems.Count));
			
			string output = string.Empty;
			foreach(var item in grantedItems)
			{
				output += string.Format("\t {0}: {1}\n", item.ItemId, item.Annotation);
			}
			Debug.Log(output);
		}
		else if(result.Logs.Count > 0)
		{
			foreach(var statement in result.Logs)
			{
				Debug.Log(statement.Message);
			}
		}
		else
		{
			Debug.Log("CheckIn Successful! No items granted.");
		}
	}
Example #2
0
 private void CloudScriptHwCallback(ExecuteCloudScriptResult result)
 {
     var testContext = (UUnitTestContext)result.CustomData;
     testContext.NotNull(result.FunctionResult);
     var jobj = (JsonObject)result.FunctionResult;
     var messageValue = jobj["messageValue"] as string;
     testContext.StringEquals("Hello " + _playFabId + "!", messageValue);
     testContext.EndTest(UUnitFinishState.PASSED, null);
 }
	void OnRedeemReferralCodeCallback(ExecuteCloudScriptResult result) 
	{
		// output any errors that happend within cloud script
		if(result.Error != null)
		{
			Debug.LogError(string.Format("{0} -- {1}", result.Error, result.Error.Message));
			return;
		}

		List<ItemInstance> grantedItems = PlayFab.Json.JsonWrapper.DeserializeObject<List<ItemInstance>>(result.FunctionResult.ToString());
		if(grantedItems != null)
		{
			Debug.Log("SUCCESS!...\nYou Just Recieved:");
			string output = string.Empty;
			foreach(var itemInstance in grantedItems)
			{			
				output += string.Format("\t {0} \n", itemInstance.DisplayName); 
			}
			
			this.inventory.AddRange(grantedItems);
			SearchForReferralBadge();
			ShowReferredGroup();
			Debug.Log(output);
			foreach(var statement in result.Logs)
			{
				Debug.Log(statement.Message);
			}
		}
		else
		{
			Debug.LogError("An error occured when attemtpting to deserialize the granted items.");
		}
	}
	void ToBattleCallback (ExecuteCloudScriptResult result)
	{
		// output any errors that happend within cloud script
		if(result.Error != null)
		{
			Debug.LogError(string.Format("{0} -- {1}", result.Error, result.Error.Message));
			return;
		}

		Debug.Log("BATTLE REPORT:");
		BattleResults grantedItems = PlayFab.Json.JsonWrapper.DeserializeObject<BattleResults>(result.FunctionResult.ToString());
		
		if(grantedItems != null)
		{
			Debug.Log(string.Format("You found {0} gems. \n You lost {1} lives.", grantedItems.gemsFound, grantedItems.lostALife ? 1 : 0));
			GetInventory();
		}
		else
		{
			Debug.LogError("An error occured when attemtpting to deserialize the BattleResults.");
		}
	}