public void ButtonClicked() { if (currentAsset.asset != null) { if (currentAsset.asset.files != null && currentAsset.asset.files.Length > 0) { StagesManager.instance.GoToStage(StagesManager.StageID.Files, currentAsset.asset); return; } } string header = "Equip"; string btnText = "Equip"; Dictionary <string, string> data = new Dictionary <string, string>(); data.Add("Asset Name", currentAsset.asset.name); data.Add("Asset Context", currentAsset.asset.context); PopupSystem.ShowPopup(header, data, btnText, () => { LoadingManager.ShowLoadingScreen(); LootLockerSDKManager.EquipIdAssetToDefaultCharacter(currentAsset.inventory.instance_id.ToString(), (response) => { LoadingManager.HideLoadingScreen(); if (response.success) { header = "Success"; data.Clear(); //Preparing data to display or error messages we have data.Add("1", "You successfully equipped: " + currentAsset.inventory.asset.name); LoadingManager.ShowLoadingScreen(); StagesManager.instance.GoToStage(StagesManager.StageID.Inventory, null); PopupSystem.ShowApprovalFailPopUp(header, data, currentAsset.asset.url, false); } else { Debug.LogError(response.Error); header = "Failed"; data.Clear(); //Preparing data to display or error messages we have string correctedResponse = response.Error.First() == '{' ? response.Error : response.Error.Substring(response.Error.IndexOf('{')); ResponseError equipErrorResponse = new ResponseError(); equipErrorResponse = JsonConvert.DeserializeObject <ResponseError>(correctedResponse); data.Add("1", equipErrorResponse.messages[0]); PopupSystem.ShowApprovalFailPopUp(header, data, currentAsset.asset.url, true); } }); }, currentAsset.asset.url); }
public void EquipIdAssetToDefaultCharacter() { LootLockerSDKManager.EquipIdAssetToDefaultCharacter(assetInstanceId, (response) => { if (response.success) { labelText = "Success\n" + response.text; } else { labelText = "Failed\n" + response.text; } }); }