27 lines
660 B
GDScript
27 lines
660 B
GDScript
class_name ItemUI extends PanelContainer
|
|
|
|
@export var texture_sprite: TextureRect
|
|
@export var texture_dictionary: Dictionary[String, Texture2D] = {}
|
|
@export var audio_stream_player: AudioStreamPlayer
|
|
|
|
var item_name: String = "":
|
|
set(value):
|
|
item_name = value
|
|
#print("okey setze werte")
|
|
if is_inside_tree() and texture_sprite:
|
|
#print("muss jetzt in sachen rein laden ")
|
|
_set_up_item_ui()
|
|
|
|
func _set_up_item_ui()->void:
|
|
if texture_dictionary.has(item_name):
|
|
texture_sprite.texture = texture_dictionary[item_name]
|
|
|
|
func set_item_key(key:String)->void:
|
|
#print("hello")
|
|
item_name = key
|
|
|
|
func play_audio()->void:
|
|
audio_stream_player.play()
|
|
|
|
|