Files
net-gunner/scripts/hack_icon.gd

25 lines
856 B
GDScript

class_name HackIcon extends Control
const hack_icons : Dictionary = {
Hack.Type.BOMB : preload("res://visuals/images/icons/bomb.png"),
Hack.Type.GAS : preload("res://visuals/images/icons/gas.png"),
Hack.Type.PITFALL : preload("res://visuals/images/icons/pitfall.png"),
Hack.Type.FORCE_PANEL : preload("res://visuals/images/icons/force_panel.png"),
Hack.Type.SWITCH : preload("res://visuals/images/icons/switch.png"),
Hack.Type.MINE : preload("res://visuals/images/icons/mine.png"),
}
@onready var icon_image : TextureRect = %Icon
@onready var qty_label : Label = %Label
func setup(type : Hack.Type, qty : int) -> void:
icon_image.texture = hack_icons[type]
set_quantity(qty)
func set_quantity(qty : int) -> void:
qty_label.text = str(qty)
if qty < 1:
icon_image.modulate = Color.DIM_GRAY
else:
icon_image.modulate = Color.WHITE