Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Control
- var item: String
- var icon: String
- var available: bool = false
- var is_focused: bool = false
- # Set the icon and item name for other nodes to refrence
- func _ready():
- if item in Inventory.recipies_dict:
- %TextureRect.texture = load(Inventory.item_dict[item]["Icon"])
- else:
- self.queue_free()
- if !available:
- $"Panel".theme = load("res://Assets/UI/Ui_Theme_Inactive.tres")
- func _process(delta):
- # print(is_focused)
- if is_focused:
- self.get_parent().owner._set_craftable(item)
- self.scale = Vector2(1.08, 1.08)
- else:
- self.scale = Vector2.ONE
- # Detect Focus
- # TODO: Fix border color change, currently crashes. maybe use animation?
- # $"Panel".add_theme_stylebox_override("Panel/styles/panel", Globals.Color_NearWhite)
- # $"Panel".add_theme_stylebox_override("border_color", Globals.Color_NearBlack)
- func _on_focus_entered():
- is_focused = true
- print(item + " Is focused")
- func _on_focus_exited():
- print(item + " unfocused")
- is_focused = false
- func _on_mouse_entered():
- self.grab_focus()
Advertisement
Add Comment
Please, Sign In to add comment