void InitialUpdateContainerDisplay(List <SelectedGenerationItem> selectedItems) { Debug.Log("Initial update"); List <GiveGeneratedItemResult> generatedItemResult = new List <GiveGeneratedItemResult>(); foreach (SelectedGenerationItem selectedItem in selectedItems) { GiveGeneratedItemResult giveItem = new GiveGeneratedItemResult(); giveItem.ItemId = selectedItem.ItemId; giveItem.Amount = selectedItem.Amount; giveItem.StackLocationId = Guid.Empty; generatedItemResult.Add(giveItem); } container.UpdateContainerWithItems(generatedItemResult); }
public List <GiveGeneratedItemResult> ConvertToListGiveGenerationItemResult(string dataString) { List <GiveGeneratedItemResult> listGiveGenerationItemResult = new List <GiveGeneratedItemResult>(); string parsedString = ParseString(dataString); JsonData dataArray = LitJson.JsonMapper.ToObject(parsedString); int statusCode = 0; if (!int.TryParse(dataArray["StatusCode"].ToString(), out statusCode)) { Debug.LogError("GenerationID was not valid"); statusCode = 0; } if (statusCode == 1) { JsonData giveItemResultData = JsonMapper.ToObject(dataArray["Message"].ToString()); for (int i = 0; i < giveItemResultData.Count; i++) { GiveGeneratedItemResult giveItemResult = new GiveGeneratedItemResult(); giveItemResult.ItemId = int.Parse(giveItemResultData[i]["ItemId"].ToString()); giveItemResult.StackLocationId = new Guid(giveItemResultData[i]["StackLocationId"].ToString()); giveItemResult.Amount = int.Parse(giveItemResultData[i]["Amount"].ToString()); listGiveGenerationItemResult.Add(giveItemResult); } return(listGiveGenerationItemResult); } else { Debug.LogError("StatusCode returned error"); return(new List <GiveGeneratedItemResult>()); } }