VendorSlotUI ​
Inherits: MarginContainer
Clean VendorSlotUI that initializes everything in setup_vendor_slot() instead of _ready() Refactored to use system_hub instead of ui_manager
Variables ​
ItemDefinition | item_definition | |
VendorInventoryComponent | vendor_inventory | |
Entity | player_entity | |
int | item_id | |
int | stock_quantity | |
int | item_price | |
CurrencyDefinition | currency_definition | |
bool | is_interactable | true |
Color | default_background_color | Color.WHITE |
Color | hover_background_color | Color(1.2, 1.2, 1.2, 1.0) |
Color | unavailable_background_color | Color(0.5, 0.5, 0.5, 1.0) |
Color | out_of_stock_background_color | Color(0.3, 0.3, 0.3, 1.0) |
Methods ​
void | setup_vendor_slot( item_def: ItemDefinition, vendor_inv: VendorInventoryComponent, player: Entity ) |
void | refresh_display() |
String | get_vendor_buy_price() |
bool | has_item() |
String | get_price_string() |
bool | can_purchase() |
void | update_stock_display( new_stock: int ) |
int | get_stock_quantity() |
int | get_item_price() |
void | update_affordability() |
Signals ​
purchase_requested( item_id: int, quantity: int ) ​
Emitted when the player wants to buy: the item and how many.
item_tooltip_requested( item: ItemInstance, definition: ItemDefinition, context: String, additional_data: Dictionary ) ​
Tooltips
hide_tooltip( force_hide: bool ) ​
Asks the interface to hide the tooltip (force hides it at once).
message_requested( message: String ) ​
Messages
warning_message_requested( message: String ) ​
Asks the interface to show a warning.
ui_sfx_request( sound: AudioManager.UISound, volume_modifier: float ) ​
Audio Request
Constants ​
intUNLIMITED_STOCK =-1- Constant for unlimited stock
Variable descriptions ​
ItemDefinition item_definition ​
The item the slot sells.
VendorInventoryComponent vendor_inventory ​
The stock of the vendor.
Entity player_entity ​
The player who buys.
int item_id ​
The id of the item.
int stock_quantity ​
How many are in stock.
int item_price ​
The price of one.
CurrencyDefinition currency_definition ​
The currency of the price.
bool is_interactable = true ​
True when the player can buy from the slot.
Color default_background_color = Color.WHITE ​
The color of the background.
Color hover_background_color = Color(1.2, 1.2, 1.2, 1.0) ​
The color of the background under the mouse.
Color unavailable_background_color = Color(0.5, 0.5, 0.5, 1.0) ​
The color of the background when the player cannot buy.
Color out_of_stock_background_color = Color(0.3, 0.3, 0.3, 1.0) ​
The color of the background when it is out of stock.
Method descriptions ​
void setup_vendor_slot( item_def: ItemDefinition, vendor_inv: VendorInventoryComponent, player: Entity ) ​
Setup this slot with vendor item data - call this after adding as child
void refresh_display() ​
Refresh all display elements
String get_vendor_buy_price() ​
Get vendor's buy-back price for this item type
bool has_item() ​
Does the slot sell something?
String get_price_string() ​
The price as text, with the currency.
bool can_purchase() ​
Can the player buy from the slot (it is in stock)?
void update_stock_display( new_stock: int ) ​
Shows a new stock quantity.
int get_stock_quantity() ​
How many are in stock.
int get_item_price() ​
The price of one.
void update_affordability() ​
Checks whether the player can pay, and updates the slot.