void DrawVerifyTwoFactorAuthView() { GUILayout.BeginArea(ContentSection); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); GUI.DrawTexture(new Rect((Screen.width / 2) - 100, 100, 200, 200), tfaTexture); EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Back", GUILayout.Height(20))) { currentView = LootLockerView.Games; } EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Please scan the QR code on your Google Authenticator then enter your secret code"); //EditorGUILayout.LabelField("You can obtain it from google authenticator", new GUIStyle(GUI.skin.label) { fontSize = 10 }); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); verify2FASecret = EditorGUILayout.IntField(verify2FASecret); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Verify", GUILayout.Height(20))) { currentView = LootLockerView.Loading; LootLockerSDKAdminManager.VerifyTwoFactorAuthenticationSetup(verify2FASecret, (response) => { if (response.success) { Debug.LogError("Successfully verified two factor authentication setup: " + response.text); verify2FARecovery = response.recover_token; currentView = LootLockerView.VerifySuccess; } else { Debug.LogError("failed to set two factor authentication: " + response.Error); currentView = LootLockerView.Games; } }); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); GUILayout.EndArea(); }
void PopulateAssets(string search = null) { LootLockerSDKAdminManager.DebugMessage("Getting assets.."); currentView = LootLockerView.Loading; LootLockerSDKAdminManager.GetAssets((response) => { LootLockerSDKAdminManager.GetContexts((contextResponse) => { if (contextResponse.success) { Contexts = contextResponse.Contexts; ContextNames = Contexts.Select(x => x.name).ToArray(); LootLockerSDKAdminManager.DebugMessage("Successful got all contexts: " + contextResponse.text); } else { LootLockerSDKAdminManager.DebugMessage("failed to get all contexts: " + contextResponse.Error, true); } if (response.success) { assetsResponse = response; currentView = LootLockerView.Assets; Repaint(); LootLockerSDKAdminManager.DebugMessage("Successful got all assets: " + response.text); } else { LootLockerSDKAdminManager.DebugMessage("failed to get all assets: " + response.Error, true); } }); }, search); }
public void UpdatingInformationAboutAGame() { Dictionary <string, object> keyValuePairs = new Dictionary <string, object>(); List <bool> sendBools = new List <bool> { sendNewName, sendNewGameKey, sendNewSteamAppID, sendNewSteamAPIKey, sendNewSandboxMode }; List <string> itemNames = new List <string> { "name", "game_key", "steam_app_id", "steam_api_key", "sandbox_mode" }; List <object> objectsToAdd = new List <object> { newName, newGameKey, newSteamAppID, newSteamAPIKey, newSandboxMode }; for (int i = 0; i < sendBools.Count; i++) { if (sendBools[i]) { keyValuePairs.Add(itemNames[i], objectsToAdd[i]); } } LootLockerSDKAdminManager.UpdatingInformationAboutAGame(gameIDToUpdateInfo, keyValuePairs, (response) => { if (response.success) { Debug.LogError("Successful updated info about game " + gameIDToUpdateInfo.ToString() + ": " + response.text); } else { Debug.LogError("failed to update info about game " + gameIDToUpdateInfo.ToString() + ": " + response.Error); } }); }
public void UploadFile() { string path = EditorUtility.OpenFolderPanel("Select folder to upload", "", ""); string[] files = Directory.GetFiles(path); if (files != null && files.Length > 0) { foreach (string file in files) { Debug.Log(GetIdFromFile(file)); if (!file.EndsWith(".meta")) { LootLockerSDKAdminManager.UploadAFile(file, sendAssetID, LootLockerAdminConfig.current.gameID, (response) => { if (response.success) { Debug.LogError("Successful created event: " + response.text); } else { Debug.LogError("failed to create event: " + response.Error); } }); } } } // EditorUtility.DisplayDialog("Select Texture", "You must select a texture first!", "OK"); }
private void SetCurrentGame(int id, bool setToDelete = false) { Debug.Log("Current Game set to: " + id); activeGameID = id; if (!setToDelete) { currentView = LootLockerView.Loading; LootLockerSDKAdminManager.GetDetailedInformationAboutAGame(id.ToString(), (response) => { if (response.success) { LootLockerAdminConfig.current.gameName = response.game.development.name; LootLockerAdminConfig.current.apiKey = response.game.development.game_key; LootLockerAdminConfig.current.gameID = response.game.development.id; //normal setup if (LootLockerConfig.current != null) { LootLockerConfig.current.apiKey = response.game.game_key; LootLockerConfig.current.gameID = response.game.id; } currentView = LootLockerView.Menu; } else { Debug.LogError("Could not get game details"); } }); } else { currentView = LootLockerView.DeleteGameConfirmation; } }
public void AdminLogin() { currentView = LootLockerView.Loading; LootLockerSDKAdminManager.InitialAuthRequest(email, password, (response) => { if (response.success) { Debug.Log("Successful got admin auth response: " + response.text); if (response.mfa_key != null) { mfaState = true; Debug.Log("the admin enabled 2fa"); StartTwoFA(response.mfa_key); } else { mfaState = false; Debug.Log("the admin didn't enable 2fa"); FinalAuth(response); } } else { ResetToLogin(); Debug.LogError("failed to get admin auth response: " + response.Error); } }); }
void DrawFileView() { GUILayout.BeginArea(ContentSection); EditorGUILayout.LabelField("Tags"); EditorGUILayout.LabelField("saperated by comma", new GUIStyle(GUI.skin.label) { fontSize = 10 }); FileTags = EditorGUILayout.TextField(FileTags); if (GUILayout.Button("Update", GUILayout.Height(50))) { LootLockerSDKAdminManager.UpdateFile(activeFile.id.ToString(), new LootLockerUpdateFileRequest() { tags = FileTags.Split(',') }, (updateResponse) => { if (updateResponse.success) { ButtomMessage = "Update Succeeded"; Debug.Log("Successful update file: " + updateResponse.text); } else { Debug.LogError("failed to update file: " + updateResponse.Error); } }); } if (GUILayout.Button("Delete", GUILayout.Height(50))) { LootLockerSDKAdminManager.DeleteFile(activeFile.id.ToString(), (response) => { if (response.success) { ButtomMessage = "Delete Succeeded"; PopulateFiles(); Debug.Log("Successful deleted file: " + response.text); } else { Debug.LogError("failed to delete file: " + response.Error); } }); } if (GUILayout.Button("Back", GUILayout.Height(20))) { PopulateFiles(); } GUILayout.EndArea(); }
public void UpdatingMaps() { LootLockerSDKAdminManager.UpdatingMaps(updatedMap, mapID, (response) => { if (response.success) { Debug.LogError("Successful updated map: " + response.text); } else { Debug.LogError("failed to update map: " + response.Error); } }); }
public void GettingAllMapsToAGAme() { LootLockerSDKAdminManager.GettingAllMapsToAGame(gameIDToGetMaps, (response) => { if (response.success) { Debug.LogError("Successful got all maps: " + response.text); } else { Debug.LogError("failed to get all maps: " + response.Error); } }); }
public void SetupTwoFactorAuthentication() { LootLockerSDKAdminManager.SetupTwoFactorAuthentication((response) => { if (response.success) { LootLockerSDKAdminManager.DebugMessage("Successful setup two factor authentication: " + response.text); } else { LootLockerSDKAdminManager.DebugMessage("failed to set two factor authentication: " + response.Error, true); } }); }
public void CreateMap(LootLockerCreatingMapsRequest mapToCreate, bool includeAssetID, bool includeSpawnPoints) { LootLockerSDKAdminManager.CreatingMaps(mapToCreate, includeAssetID, includeSpawnPoints, (response) => { if (response.success) { Debug.Log("Successful created map: " + response.text); } else { Debug.LogError("failed to create map: " + response.Error); } }); }
public void TwoFactorAuthenticationCodeVerification() { LootLockerSDKAdminManager.TwoFactorAuthVerification(mfa_key, secret, (response) => { if (response.success) { Debug.Log("Successful got two-factor authentication code: " + response.text); } else { Debug.LogError("failed to get two-factor authentication code: " + response.Error); } }); }
public void SubsequentRequests() { LootLockerSDKAdminManager.SubsequentRequestsRequest((response) => { if (response.success) { Debug.LogError("Successful got Subsequent requests: " + response.text); } else { Debug.LogError("failed to get Subsequent requests: " + response.Error); } }); }
void DrawRemoveTwoFactorAuthView() { GUILayout.BeginArea(ContentSection); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("To remove Two-Factor Authentication, Please enter a secret key from your Google Authenticator and click Remove"); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); remove2FASecret = EditorGUILayout.IntField(remove2FASecret); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Remove", GUILayout.Height(20))) { currentView = LootLockerView.Loading; LootLockerSDKAdminManager.RemoveTwoFactorAuthentication(remove2FASecret, (response) => { if (response.success) { Debug.Log("Successful removed 2fa: " + response.text); mfaState = false; currentView = LootLockerView.Games; } else { currentView = LootLockerView.Remove2FAConfirm; Debug.LogError("failed to get admin auth response: " + response.Error); } }); } EditorGUILayout.EndHorizontal(); if (GUILayout.Button("Back", GUILayout.Height(20))) { currentView = LootLockerView.Login; } EditorGUILayout.EndVertical(); GUILayout.EndArea(); }
public void GetAllGamesToTheCurrentUser() { LootLockerSDKAdminManager.GetAllGamesToTheCurrentUser((response) => { if (response.success) { Debug.LogError("Successful got all games: " + response.text); } else { Debug.LogError("failed to get all games: " + response.Error); } }); }
public void CreatingAGame() { LootLockerSDKAdminManager.CreatingAGame(gameName, gameSteamAppID, sandboxMode, organisationID, false, (response) => { if (response.success) { Debug.LogError("Successful created a game: " + response.text); } else { Debug.LogError("failed to get all games: " + response.Error); } }); }
public void UpdateMap(LootLockerCreatingMapsRequest updatedMap) { LootLockerSDKAdminManager.UpdatingMaps(updatedMap, activeMap.map_id, (response) => { if (response.success) { Debug.Log("Successful updated map: " + response.text); } else { Debug.LogError("failed to update map: " + response.Error); } }); }
public void DeletingGames() { LootLockerSDKAdminManager.DeletingGames(gameIDToDelete, (response) => { if (response.success) { Debug.LogError("Successful deleted a game: " + response.text); } else { Debug.LogError("failed to delete a game: " + response.Error); } }); }
public void InitialAuthenticationRequest() { LootLockerSDKAdminManager.InitialAuthRequest(email, password, (response) => { if (response.success) { Debug.LogError("Successful got admin auth response: " + response.text); mfa_key = response.mfa_key; } else { Debug.LogError("failed to get admin auth response: " + response.Error); } }); }
public void GettingAllEvents() { LootLockerSDKAdminManager.GettingAllEvents(gameID, (response) => { if (response.success) { Debug.LogError("Successful got events: " + response.text); } else { Debug.LogError("failed to get events: " + response.Error); } }); }
public void CreateGame(LootLockerCreatingAGameRequest gameToCreate) { LootLockerSDKAdminManager.CreatingAGame(gameToCreate.name, gameToCreate.steam_app_id, gameToCreate.sandbox_mode, gameToCreate.organisation_id, gameToCreate.demo, (response) => { if (response.success) { Debug.Log("Successful created game: " + response.text); PopulateGames(); } else { Debug.LogError("failed to create game: " + response.Error); currentView = LootLockerView.CreateGame; } }); }
/// <summary> /// called in 2 cases: first time to open and edting the code /// </summary> private void OnEnable() { LootLockerSDKAdminManager.Init(); InitTexture(); InitSections(); email = LootLockerAdminConfig.current.email; password = LootLockerAdminConfig.current.password; //these will be exposed to UI if (currentView == LootLockerView.Login && !string.IsNullOrEmpty(email) && !string.IsNullOrEmpty(password)) { AdminLogin(); } }
public void CreatingEvent() { LootLockerSDKAdminManager.CreatingEvent(eventToCreate.GetCreatingEventRequestDictionary(sendAssetID, sendPosterPath, sendRounds, sendRoundLength, sendCompletionBonus, sendDifficultyName, sendDifficultyMultiplier, sendTimeScoreMultiplier, sendGoals, sendCheckpoints, sendFilters), (response) => { if (response.success) { Debug.LogError("Successful created event: " + response.text); } else { Debug.LogError("failed to create event: " + response.Error); } }); }
public void UpdatingEvent() { LootLockerSDKAdminManager.UpdatingEvent(eventID, UpdatedEventData.GetUpdatingEventRequestDictionary(protectName, sendAssetID_U, sendPosterPath_U, sendRounds_U, sendRoundLength_U, sendCompletionBonus_U, sendDifficultyName_U, sendDifficultyMultiplier_U, sendTimeScoreMultiplier_U, sendGoals_U, sendCheckpoints_U, sendFilters_U), (response) => { if (response.success) { Debug.LogError("Successful updated event: " + response.text); } else { Debug.LogError("failed to update event: " + response.Error); } }); }
public void GetDetailedInformationAboutAGame() { //LootLockerGetRequest lootLockerGetRequest = new LootLockerGetRequest(); //lootLockerGetRequest.getRequests.Add(gameIDToGetInfo.ToString()); LootLockerSDKAdminManager.GetDetailedInformationAboutAGame(gameIDToGetInfo.ToString(), (response) => { if (response.success) { Debug.LogError("Successful got info about game " + gameIDToGetInfo.ToString() + ": " + response.text); } else { Debug.LogError("failed to get info about game " + gameIDToGetInfo.ToString() + ": " + response.Error); } }); }
public void PopulateGames() { Repaint(); Debug.Log("Getting games.."); LootLockerSDKAdminManager.GetAllGamesToTheCurrentUser((response) => { if (response.success) { gamesResponse = response; currentView = LootLockerView.Games; Repaint(); Debug.Log("Successful got all games: " + response.text); } else { Debug.LogError("failed to get all games: " + response.Error); } }); }
public void AdminSetup2FA() { currentView = LootLockerView.Loading; LootLockerSDKAdminManager.SetupTwoFactorAuthentication((response) => { if (response.success) { Debug.LogError("Successful setup two factor authentication: " + response.text); tfaTexture = new Texture2D(200, 200); tfaTexture.LoadImage(Convert.FromBase64String(response.mfa_token_url.Substring(22))); currentView = LootLockerView.VerifyTwoFactorAuth; } else { Debug.LogError("failed to set two factor authentication: " + response.Error); ResetToLogin(); } }); }
public void PopulateMaps() { Repaint(); Debug.Log("Getting maps.."); mapsResponse = null; currentView = LootLockerView.Loading; LootLockerSDKAdminManager.GettingAllMapsToAGame(activeGameID, (response) => { if (response.success) { mapsResponse = response; currentView = LootLockerView.Maps; Repaint(); Debug.Log("Successful got all maps: " + response.text); } else { Debug.LogError("failed to get all maps: " + response.Error); } }); }
protected override void RefreshTokenAndCompleteCall(LootLockerServerRequest cacheServerRequest, Action <LootLockerResponse> OnServerResponse) { var authRequest = new LootLockerInitialAuthRequest(); authRequest.email = activeConfig.email; authRequest.password = activeConfig.password; LootLockerAPIManagerAdmin.InitialAuthenticationRequest(authRequest, (response) => { if (response.success) { Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("x-auth-token", activeConfig.token); cacheServerRequest.extraHeaders = headers; if (cacheServerRequest.retryCount < 4) { SendRequest(cacheServerRequest, OnServerResponse); cacheServerRequest.retryCount++; } else { LootLockerSDKAdminManager.DebugMessage("Admin token refresh failed"); LootLockerResponse res = new LootLockerResponse(); res.statusCode = 401; res.Error = "Admin token Expired"; res.hasError = true; OnServerResponse?.Invoke(res); } } else { LootLockerSDKAdminManager.DebugMessage("Admin token refresh failed", true); LootLockerResponse res = new LootLockerResponse(); res.statusCode = 401; res.Error = "Admin token Expired"; res.hasError = true; OnServerResponse?.Invoke(res); } }); }
void DrawTwoFactorAuthView() { GUILayout.BeginArea(ContentSection); EditorGUILayout.LabelField("Please Enter Your Secret Code"); EditorGUILayout.LabelField("You can obtain it from google authenticator", new GUIStyle(GUI.skin.label) { fontSize = 10 }); SecretCode = EditorGUILayout.TextField(SecretCode); if (GUILayout.Button("Submit")) { LootLockerSDKAdminManager.TwoFactorAuthVerification(MFAKey, SecretCode, (response) => { if (response.success) { Debug.Log("Successful 2FA: " + response.text); FinalAuth(response); } else { ResetToLogin(); Debug.LogError("failed to get admin auth response: " + response.Error); } }); } if (GUILayout.Button("Back", GUILayout.Height(20))) { currentView = LootLockerView.Login; } GUILayout.EndArea(); }