public static void CreatingAGame(LootLockerCreatingAGameRequest data, Action <LootLockerCreatingAGameResponse> onComplete) { string json = ""; if (data == null) { return; } else { json = JsonConvert.SerializeObject(data); } EndPointClass endPoint = LootLockerEndPointsAdmin.current.creatingAGame; LootLockerServerRequest.CallAPI(endPoint.endPoint, endPoint.httpMethod, json, (serverResponse) => { LootLockerCreatingAGameResponse response = new LootLockerCreatingAGameResponse(); if (string.IsNullOrEmpty(serverResponse.Error)) { response = JsonConvert.DeserializeObject <LootLockerCreatingAGameResponse>(serverResponse.text); response.text = serverResponse.text; onComplete?.Invoke(response); } else { response.message = serverResponse.message; response.Error = serverResponse.Error; onComplete?.Invoke(response); } }, useAuthToken: true, callerRole: LootLocker.LootLockerEnums.LootLockerCallerRole.Admin); }
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> /// This is an admin call, for creating games /// </summary> /// <param name="name"></param> /// <param name="steam_app_id"></param> /// <param name="sandbox_mode"></param> /// <param name="organisation_id"></param> /// <param name="demo"></param> /// <param name="onComplete"></param> public static void CreatingAGame(string name, string steam_app_id, bool sandbox_mode, int organisation_id, bool demo, Action <LootLockerCreatingAGameResponse> onComplete) { if (!CheckInitialized()) { return; } LootLockerCreatingAGameRequest data = new LootLockerCreatingAGameRequest { name = name, steam_app_id = steam_app_id, sandbox_mode = sandbox_mode, organisation_id = organisation_id, demo = demo }; DemoAppAdminRequests.CreatingAGame(data, onComplete); }
void DrawCreateGameView() { style = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter }; GUIStyle createGameWordStyle = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter, fontSize = 20 }; GUIStyle propertyNameStyle = new GUIStyle(GUI.skin.label) { alignment = TextAnchor.MiddleCenter, fontSize = 15 }; GUIStyle propertyValueStyle = new GUIStyle(GUI.skin.textField) { alignment = TextAnchor.MiddleCenter, fontSize = 15 }; // gamesSection.x = 0; // gamesSection.y = 60; // gamesSection.width = Screen.width; // gamesSection.height = Screen.height - 100; // GUI.DrawTexture(gamesSection, defaultSectionTexture); GUILayout.BeginArea(ContentSection); EditorGUILayout.BeginVertical(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Create Game", createGameWordStyle, GUILayout.Height(20)); EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Game name", propertyNameStyle, GUILayout.Height(20)); CreateGame_gameName = EditorGUILayout.TextField(CreateGame_gameName, propertyValueStyle); EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Sandbox mode", propertyNameStyle, GUILayout.Height(20)); CreateGame_sandboxMode = EditorGUILayout.Toggle(CreateGame_sandboxMode); EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Organization ID", propertyNameStyle, GUILayout.Height(20)); int selectedOrganizationID = 0; //EditorGUI.BeginChangeCheck(); selectedOrganizationID = EditorGUILayout.Popup(selectedOrganizationID, organizationIDs.ToArray()); //if (EditorGUI.EndChangeCheck()) //{ // int.TryParse(organizationIDs[selectedOrganizationID], out CreateGame_organisationID); //} int.TryParse(organizationIDs[selectedOrganizationID], out CreateGame_organisationID); EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Steam App ID", propertyNameStyle, GUILayout.Height(20)); CreateGame_steamAppID = EditorGUILayout.IntField(CreateGame_steamAppID, propertyValueStyle); EditorGUILayout.EndHorizontal(); EditorGUILayout.Separator(); EditorGUILayout.Separator(); EditorGUILayout.EndVertical(); EditorGUILayout.Space(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Create", GUILayout.Height(40))) { LootLockerCreatingAGameRequest cagr = new LootLockerCreatingAGameRequest { name = CreateGame_gameName, sandbox_mode = CreateGame_sandboxMode, organisation_id = CreateGame_organisationID, steam_app_id = CreateGame_steamAppID.ToString() }; CreateGame(cagr); currentView = LootLockerView.Loading; } EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); if (GUILayout.Button("Back", GUILayout.Height(40))) { PopulateGames(); } EditorGUILayout.EndHorizontal(); GUILayout.EndArea(); }