-
-
Save JoshuaStrunk/357f8c8602b2c2de7529ed76ab3dac71 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void GetMoney(Action<string> onMoneyPulled, Action onFail) | |
{ | |
PlayFabClientAPI.GetUserData( | |
new GetUserDataRequest(), | |
result => { | |
if (result.Data == null || !result.Data.ContainsKey("Money")) | |
{ | |
Debug.Log("No value for money"); | |
onFail(); | |
} | |
else | |
{ | |
amount = result.Data["Money"].Value; | |
Debug.Log(amount); | |
onMoneyPulled(amount); | |
} | |
}, | |
(error) => { | |
Debug.Log(error.GenerateErrorReport()); | |
onFail(); | |
}); | |
} | |
void Start() { | |
GetMoney( | |
money=> { | |
moneyText.text = money; | |
}, | |
() => { | |
moneyText.text = "Failed to pull money"; | |
} | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment