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
IEnumerator UpdatePlayerStorage() | |
{ | |
Debug.Log("Updating player color with player storage"); | |
using (UnityWebRequest webRequest = UnityWebRequest.Post(LootLocker.baseUrl + "v1/player/storage", "")) | |
{ | |
// Set the header to authenticate the request, using our session token | |
webRequest.SetRequestHeader("x-session-token", this.sessionToken); | |
// Set header to let the server know we are sending JSON |
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
IEnumerator GetPlayerStorage() | |
{ | |
Debug.Log("Getting player storage"); | |
using (UnityWebRequest webRequest = UnityWebRequest.Get(LootLocker.baseUrl + "v1/player/storage")) | |
{ | |
// Set the header to authenticate the request | |
webRequest.SetRequestHeader("x-session-token", this.sessionToken); | |
// Send request and wait for the response |
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
IEnumerator Login() | |
{ | |
if (loginStarted) | |
{ | |
loginDone = true; | |
loginFailed = true; | |
Debug.Log("Multiple calls to login detected. Rejected attempt."); | |
} | |
else | |
{ |
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 class LootLocker : MonoBehaviour | |
{ | |
// Configuration | |
private string LootLockerAPIKey = ""; // Found in settings @ my.lootlocker.io | |
private string PlayerIdentifier = ""; // In this case, your 64-bit steam ID - Looks like this: 76561298123001763 (Use https://steamid.io/lookup to find it) | |
private string baseUrl = "https://api.lootlocker.io/game/v1/"; | |
// State | |
private bool loginDone = false; | |
private bool loginStarted = false; |
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
curl -X POST 'https://api.lootlocker.io/game/v1/player/storage' \ | |
-H 'Content-Type: application/json' \ | |
-H 'x-session-token: your session token' \ | |
-d '[{ | |
"order": 1, | |
"key": "characterColor", | |
"value": "0,193,82" | |
}]' |
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
curl -X GET 'https://api.lootlocker.io/game/v1/player/storage' \ | |
-H 'x-session-token: your session token' |
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
curl -X POST 'https://api.lootlocker.io/game/v2/session' \ | |
-H 'Content-Type: application/json' \ | |
-d '{ | |
"game_key": "your game api key", | |
"platform": "ios", | |
"player_identifier": "93c2e0e2-e399-41a1-af86-a9e1d0189b77", | |
"game_version": "1.0.0", | |
"development_mode": "false" | |
} |
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
CURL *curl; | |
CURLcode res; | |
curl = curl_easy_init(); | |
if(curl) { | |
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_easy_setopt(curl, CURLOPT_URL, "https://api.lootlocker.io/game/v1/player/storage"); | |
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); | |
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https"); | |
struct curl_slist *headers = NULL; | |
headers = curl_slist_append(headers, "Content-Type: application/json"); |
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
var client = new RestClient("https://api.lootlocker.io/game/v1/player/storage"); | |
var request = new RestRequest(Method.GET); | |
request.AddHeader("x-session-token", "your session token"); | |
IRestResponse response = client.Execute(request); |
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
CURL *curl; | |
CURLcode res; | |
curl = curl_easy_init(); | |
if(curl) { | |
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST"); | |
curl_easy_setopt(curl, CURLOPT_URL, "https://api.lootlocker.io/game/v2/session"); | |
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); | |
curl_easy_setopt(curl, CURLOPT_DEFAULT_PROTOCOL, "https"); | |
struct curl_slist *headers = NULL; |
NewerOlder