public void SelectItem() { ItemListEntry itemEntry = shopList.GetEntry(); if (!itemEntry || !itemEntry.affordable) { return; } if (!promptMode) { promptMode = true; buyPrompt.ShowYesNoPopup((shopList.buyMode) ? "Buy item?" : "Sell item?", true); } else { if (buyPrompt.Click(true) == MyPrompt.Result.OK1) { if (shopList.buyMode) // Buy item { totalMoney.value -= itemEntry.tuple.cost; playerData.items.Add(itemEntry.tuple.StoreData()); } else // Sell item { totalMoney.value += (int)(itemEntry.tuple.cost * sellRatio.value); playerData.items.RemoveAt(itemEntry.index); shopList.RemoveEntry(); } } shopList.UpdateCost(); SetupItemInfo(); DeselectItem(); } }
private void TakeItem() { Debug.Log("Take item"); ItemListEntry item = convoy.GetEntry(); if (!item) { return; } InventoryContainer invCon = charList.GetEntry().invCon; if (!invCon.AddItem(playerData.items[item.index])) { prompt.ShowOkPopup("Inventory is full!"); currentMode = State.MENU; return; } convoy.RemoveEntry(); playerData.items.RemoveAt(item.index); ShowCharInfo(); ShowCharInfoTake(); ShowItemInfo(); }
private void TakeItem() { ItemListEntry item = convoy.GetEntry(); if (!item) { return; } Debug.Log("Take item"); InventoryContainer invCon = characters.GetEntry().invCon; if (!invCon.AddItem(playerData.items[item.index])) { restockPrompt.ShowOkPopup("Inventory is full!"); promptMode = true; return; } convoy.RemoveEntry(); playerData.items.RemoveAt(item.index); ShowCharInfo(); }