24 lines
653 B
GDScript
24 lines
653 B
GDScript
extends TextureRect
|
|
class_name CurrencyMemberSprite
|
|
|
|
@export var currency: Currency
|
|
@export var allegiance: Allegiance
|
|
|
|
func _ready() -> void:
|
|
sync()
|
|
|
|
func sync():
|
|
if allegiance != null:
|
|
set_instance_shader_parameter("border_color", allegiance.color)
|
|
if currency != null:
|
|
set_instance_shader_parameter("fill_color", currency.color)
|
|
|
|
func _on_mouse_entered() -> void:
|
|
UserContext.focus_member(self)
|
|
|
|
func _on_mouse_exited() -> void:
|
|
UserContext.unfocus_member(self)
|
|
|
|
func _input(event: InputEvent) -> void:
|
|
if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT:
|
|
UserContext.select_focused_member()
|