public void ServerCloudScript(UUnitTestContext testContext) { var request = new ExecuteCloudScriptServerRequest { FunctionName = "helloWorld", PlayFabId = FakePlayFabId }; PlayFabServerAPI.ExecuteCloudScript(request, PlayFabUUnitUtils.ApiActionWrapper <ExecuteCloudScriptResult>(testContext, CloudScriptHwCallback), PlayFabUUnitUtils.ApiActionWrapper <PlayFabError>(testContext, SharedErrorCallback), testContext); }
private void grantCurrencies(string playerID, CurrencySymbol[] currencySymbols, int[] currencyValues, Action <string> onSuccessHandler, Action <string> onFailureHandler) { // If there are no currencies to grant, call success handler. if (currencyValues == null || currencyValues.Length == 0) { onSuccessHandler(playerID); return; } string[] currencyTypes = new string[currencySymbols.Length]; for (int t = 0; t < currencyTypes.Length; t++) { currencyTypes[t] = currencySymbols[t].ToString(); } ExecuteCloudScriptServerRequest request = new ExecuteCloudScriptServerRequest() { PlayFabId = playerID, FunctionName = GRANT_CURRENCIES_FUNC, FunctionParameter = new { currencyTypes = currencyTypes, currencyValues = currencyValues } }; PlayFabServerAPI.ExecuteCloudScriptAsync(request).ContinueWith(t => { if (t.Result.Error != null) { Log.Error("Couldn't grant currencies to playerID : " + playerID + " Error: " + t.Result.Error.ErrorMessage); onFailureHandler(playerID); } else { onSuccessHandler(playerID); } }); }