Skip to content

VendorPanelUI ​

Inherits: PanelUI < Control

Refactored vendor panel that uses definition-based VendorSlotUI for shop display Left side: Vendor items (VendorSlotUI grid) Right side: Player inventory (InventoryUI for selling items back) Refactored to remove ui_manager references

Properties ​

boolshow_repair_buttontrue
intvendor_slots_per_row6
intmax_vendor_rows8
PackedScenevendor_slot_scene
PackedScenecurrency_display_scene

Variables ​

VendorInventoryComponentvendor_inventory
Entityplayer_entity
boolis_repair_modefalse
Array[VendorSlotUI]vendor_slots[]
Dictionarycurrency_displays{} # currency_id -> CurrencyDisplay

Methods ​

voidinitialize_ui( p_system_hub: GameHost.SystemHub )
voidsetup_vendor_panel( vendor: VendorInventoryComponent, player: Entity )
voidclear_vendor_slots()
voidclose_panel()

Signals ​

transaction_completed( success: bool, message: String ) ​

Emitted when a purchase or a sale ends: whether it worked and a message.

Property descriptions ​

bool show_repair_button = true ​

True shows the repair button.

int vendor_slots_per_row = 6 ​

How many vendor slots are in a row.

int max_vendor_rows = 8 ​

How many rows of vendor slots the panel shows.

PackedScene vendor_slot_scene ​

The scene of one vendor slot.

PackedScene currency_display_scene ​

The scene of one currency display.

Variable descriptions ​

VendorInventoryComponent vendor_inventory ​

The stock of the vendor.

Entity player_entity ​

The player who trades.

bool is_repair_mode = false ​

True while the player picks an item to repair.

Array[VendorSlotUI] vendor_slots = [] ​

Vendor slot management

Dictionary currency_displays = # currency_id -> CurrencyDisplay ​

Currency displays

Method descriptions ​

void initialize_ui( p_system_hub: GameHost.SystemHub ) ​

Sets the part up with the hub of the game systems: connects the signals it listens to and fills it.

void setup_vendor_panel( vendor: VendorInventoryComponent, player: Entity ) ​

Setup the vendor panel with vendor and player data

void clear_vendor_slots() ​

Clear all vendor slots

void close_panel() ​

Closes the window.