protected override void OnDropEvent() { if (UIDragDropHandler.CurrentData == null) { if (UIDragDropHandler.Active) { UIDragDropHandler.Return(); } return; } if (UIDragDropHandler.CurrentData.Get <InventoryItem>()?.Identified ?? false) { UIFloatingText.Spawn("Doesn't need to be identified", transform as RectTransform, Color.green, UIFloatingText.Orietation.Center); UIDragDropHandler.Return(); return; } var price = GameOptions.IdentifyEstimate(UIDragDropHandler.CurrentData); if (Player.Currency.Value < price) { UIFloatingText.Spawn(string.Format("Identify Cost: {0} Not enough {1}", price, GameLabels.Currency), transform as RectTransform, Color.green, UIFloatingText.Orietation.Center); UIDragDropHandler.Return(); return; } UIModalQuestion.Set(ConfirmIdentify, string.Format("Identify for {0} {1}?", price, GameLabels.Currency)); }
public void SetInputListen(InputMapper.Context context) { PlayerInput.AllInputBlocked = true; _inputMapper.Start(context); UIModalQuestion.Set((int i) => { PlayerInput.AllInputBlocked = false; _inputMapper.Stop(); }, "Press the new button", "Cancel"); }
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 TryBuy() { if (Data == null) { return; } if (Player.MainInventory.IsFull) { StatusMessages("Inventory full"); return; } var sellPrice = RulesSystem.TotalPrice(InventoryItem); if (Player.DefaultCurrencyHolder.Value < sellPrice) { StatusMessages(string.Format("Costs {0}, Not enough {1}", sellPrice, GameText.DefaultCurrencyLabel)); return; } UIModalQuestion.Set(CheckBuy, string.Format("Buy for {0} {1}?", sellPrice, GameText.DefaultCurrencyLabel)); }
private void TryBuy() { if (Data == null) { return; } if (Player.MainInventory.IsFull) { StatusMessages(null, "Inventory full"); return; } var sellPrice = InventoryItem.TotalPrice(); if (Player.Currency.Value < sellPrice) { StatusMessages(null, string.Format("Costs {0}, Not enough {1}", sellPrice, GameLabels.Currency)); return; } UIModalQuestion.Set(CheckBuy, string.Format("Buy for {0} {1}?", sellPrice, GameLabels.Currency)); }
private void BuyClickDel(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 sellPrice = item.TotalPrice(); if (Player.Currency.Value < sellPrice) { FloatingText(button.RectTransform, string.Format("Costs {0}, Not enough {1}", sellPrice, GameLabels.Currency)); return; } _currentButton = button; UIModalQuestion.Set(CheckBuy, string.Format("Buy for {0} {1}?", sellPrice, GameLabels.Currency)); }
private void CheckQuit(int index) { UIModalQuestion.Set(QuitConfirm, "Are you sure you want to Quit?", "Yes", "No"); }