extends HBoxContainer


# Declare member variables here. Examples:
# var a = 2
# var b = "text"
onready var primary_item = $PrimaryItem
onready var secondary_item = $SecondaryItem

onready var _primary_item_count = $PrimaryItem/Label
onready var _secondary_item_count = $SecondaryItem/Label

# Called when the node enters the scene tree for the first time.
func _ready():
	pass
	#secondary_item.texture = PlayerInfo.player_inventory.secondary_selection.inventory_icon

func _process(delta):
	if (PlayerInfo.player_inventory.primary_selection):
		primary_item.texture = PlayerInfo.player_inventory.primary_selection.inventory_icon
		var count = PlayerInfo.player_inventory.get_item_inventory_count(PlayerInfo.player_inventory.primary_selection)
		if count > 1:
			_primary_item_count.text = str(count)
		else:
			_primary_item_count.text = ''
	else:
		primary_item.texture = null
		_primary_item_count.text = ''
	
	if (PlayerInfo.player_inventory.secondary_selection):
		secondary_item.texture = PlayerInfo.player_inventory.secondary_selection.inventory_icon
		var count = PlayerInfo.player_inventory.get_item_inventory_count(PlayerInfo.player_inventory.secondary_selection)
		if count > 1:
			_secondary_item_count.text = str(count)
		else:
			_secondary_item_count.text = ''
	else:
		secondary_item.texture = null
		_secondary_item_count.text = ''
