Skip to content

Commit

Permalink
🍡🌺 -> #5 XP Function & API Integration
Browse files Browse the repository at this point in the history
  • Loading branch information
Gizmotronn committed Jan 28, 2022
1 parent 17c5f33 commit a93e80a
Show file tree
Hide file tree
Showing 3 changed files with 1,545 additions and 3 deletions.
Binary file modified .DS_Store
Binary file not shown.
17 changes: 15 additions & 2 deletions Assets/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
using System;

public class GameManager : MonoBehaviour {
public UnityEngine.UI.InputField PlayerNameInputField;
public UnityEngine.UI.InputField PlayerNameInputField, XpIncreaseInputField;
public GameObject CreatePlayerButton;
public GameObject LoginButton;
Guid currentDeviceId;

public void CreatePlayer() {
Expand All @@ -28,11 +29,23 @@ public void CreatePlayer() {
public void Login() {
LootLockerSDKManager.StartSession(PlayerPrefs.GetString("GUID", ""), (response => {
if (response.success) {
LootLockerSDKManager.SetPlayerName(PlayerNameInputField.text, null);
Debug.Log("Success");
} else {
Debug.Log("Failed, " + response.Error);
}
}));
}

public void GiveXP() {
LootLockerSDKManager.SubmitXp(int.Parse(XpIncreaseInputField.text), (response) => {
if (response.success) {
CreatePlayerButton.SetActive(false);
LoginButton.SetActive(false);
PlayerNameInputField.gameObject.SetActive(false);
Debug.Log("Success");
} else {
Debug.Log("Failed, " + response.Error);
}
});
}
}
Loading

0 comments on commit a93e80a

Please sign in to comment.