private void SellClickDel(UISimpleGameDataButton button, PointerEventData.InputButton buttonEvent) { var item = button.Data.Get <InventoryItem>(); if (item == null) { return; } if (Player.MainInventory.IsFull) { FloatingText(button.RectTransform, "Inventory full"); return; } var price = GameOptions.PriceEstimateSell(item.GetEntity()); _currentButton = button; UIModalQuestion.Set(CheckSell, string.Format("Sell for {0} {1}?", price, GameLabels.Currency)); }
private void CheckSell(int index) { if (index > 0) { _currentButton = null; return; } var item = _currentButton.Data.Get <InventoryItem>(); if (item == null) { _currentButton = null; return; } var price = GameOptions.PriceEstimateSell(item.GetEntity()); FloatingText(_currentButton.RectTransform, string.Format("Sold for {0} {1}", price, GameLabels.Currency)); Player.Currency.AddToValue(price); _sellingInventory.TryAdd(item.GetEntity()); //item.Despawn(); better to be able to buy back _currentButton = null; }