-
Notifications
You must be signed in to change notification settings - Fork 0
/
MachineUI.gd
39 lines (29 loc) · 1.21 KB
/
MachineUI.gd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
extends Control
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
var inventory = []
# Called when the node enters the scene tree for the first time.
func _ready():
global.in_ui = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
var job = get_parent().current_job
if get_parent().working:
get_node("CanvasLayer/CurrentJob/GridContainer/Slot1/Sprite").texture = load(
"res://images/"+global.items[job[0]]+".png")
get_node("CanvasLayer/CurrentJob/GridContainer/Slot2/Sprite").texture = load(
"res://images/"+global.items[job[1]]+".png")
else:
get_node("CanvasLayer/CurrentJob/GridContainer/Slot1/Sprite").texture = null
get_node("CanvasLayer/CurrentJob/GridContainer/Slot2/Sprite").texture = null
for i in range (0,8):
if i <= inventory.size() - 1:
print("CanvasLayer/Panel/GridContainer/Slot%s/Sprite" % [i+1])
get_node("CanvasLayer/Panel/GridContainer/Slot%s/Sprite" % [i+1]).texture = load(
"res://images/"+global.items[inventory[i]]+".png")
else:
get_node("CanvasLayer/Panel/GridContainer/Slot%s/Sprite" % [i+1]).texture = null
if Input.is_action_pressed("ui_cancel"):
queue_free()
global.in_ui = false