Add action buttons and related functionality; refactor production logic and update entity definitions
This commit is contained in:
Binary file not shown.
@@ -0,0 +1,33 @@
|
||||
extends HBoxContainer
|
||||
class_name OwniverseAction
|
||||
|
||||
signal action_pressed(page_id, amount: float)
|
||||
|
||||
@onready var action_labels: Array = [
|
||||
$ActionControl0/Label,
|
||||
$ActionControl1/Label,
|
||||
$ActionControl2/Label,
|
||||
$ActionControl3/Label,
|
||||
$ActionControl4/Label,
|
||||
]
|
||||
|
||||
var page_id: int = -1
|
||||
|
||||
var action_values: Dictionary = {
|
||||
0: 0,
|
||||
1: 0,
|
||||
2: 0,
|
||||
3: 0,
|
||||
4: 0,
|
||||
}
|
||||
|
||||
|
||||
|
||||
func set_action_values(values: Array) -> void:
|
||||
for ind in range(0, 5):
|
||||
action_values[ind] = values[ind]
|
||||
action_labels[ind].text = str(values[ind]) if values[ind] > 0 else ""
|
||||
|
||||
|
||||
func _on_action_button_pressed(button_id: int) -> void:
|
||||
action_pressed.emit(page_id, action_values[button_id])
|
||||
@@ -0,0 +1 @@
|
||||
uid://c2ech05mh56y8
|
||||
@@ -0,0 +1,115 @@
|
||||
[gd_scene format=3 uid="uid://dwneq2qq5p8ek"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c2ech05mh56y8" path="res://ui/actions/actions.gd" id="1_cjivn"]
|
||||
[ext_resource type="FontFile" uid="uid://d3k1ddvv0rmhs" path="res://fonts/Roboto_Condensed/RobotoCondensed-Light.ttf" id="1_lgdyb"]
|
||||
[ext_resource type="Texture2D" uid="uid://gsclv7fr1rbr" path="res://ui/actions/action_button.png" id="2_cjivn"]
|
||||
|
||||
[node name="Actions" type="HBoxContainer" unique_id=503388208]
|
||||
custom_minimum_size = Vector2(0, 184)
|
||||
script = ExtResource("1_cjivn")
|
||||
|
||||
[node name="ActionControl0" type="Control" parent="." unique_id=1275614326]
|
||||
custom_minimum_size = Vector2(216, 216)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ActionControl0" unique_id=1639484784]
|
||||
custom_minimum_size = Vector2(216, 32)
|
||||
layout_mode = 0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 40.0
|
||||
theme_override_fonts/font = ExtResource("1_lgdyb")
|
||||
theme_override_font_sizes/font_size = 32
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="TextureButton" type="TextureButton" parent="ActionControl0" unique_id=1122042557]
|
||||
layout_mode = 0
|
||||
offset_top = 32.0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 216.0
|
||||
texture_normal = ExtResource("2_cjivn")
|
||||
|
||||
[node name="ActionControl1" type="Control" parent="." unique_id=428212496]
|
||||
custom_minimum_size = Vector2(216, 216)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ActionControl1" unique_id=382714464]
|
||||
custom_minimum_size = Vector2(216, 32)
|
||||
layout_mode = 0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 40.0
|
||||
theme_override_fonts/font = ExtResource("1_lgdyb")
|
||||
theme_override_font_sizes/font_size = 32
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="TextureButton" type="TextureButton" parent="ActionControl1" unique_id=1538851090]
|
||||
layout_mode = 0
|
||||
offset_top = 32.0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 216.0
|
||||
texture_normal = ExtResource("2_cjivn")
|
||||
|
||||
[node name="ActionControl2" type="Control" parent="." unique_id=1758592847]
|
||||
custom_minimum_size = Vector2(216, 216)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ActionControl2" unique_id=1162569223]
|
||||
custom_minimum_size = Vector2(216, 32)
|
||||
layout_mode = 0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 40.0
|
||||
theme_override_fonts/font = ExtResource("1_lgdyb")
|
||||
theme_override_font_sizes/font_size = 32
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="TextureButton" type="TextureButton" parent="ActionControl2" unique_id=1137903803]
|
||||
layout_mode = 0
|
||||
offset_top = 32.0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 216.0
|
||||
texture_normal = ExtResource("2_cjivn")
|
||||
|
||||
[node name="ActionControl3" type="Control" parent="." unique_id=615206748]
|
||||
custom_minimum_size = Vector2(216, 216)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ActionControl3" unique_id=580732513]
|
||||
custom_minimum_size = Vector2(216, 32)
|
||||
layout_mode = 0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 40.0
|
||||
theme_override_fonts/font = ExtResource("1_lgdyb")
|
||||
theme_override_font_sizes/font_size = 32
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="TextureButton" type="TextureButton" parent="ActionControl3" unique_id=1783481629]
|
||||
layout_mode = 0
|
||||
offset_top = 32.0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 216.0
|
||||
texture_normal = ExtResource("2_cjivn")
|
||||
|
||||
[node name="ActionControl4" type="Control" parent="." unique_id=473471606]
|
||||
custom_minimum_size = Vector2(216, 216)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="ActionControl4" unique_id=1862337838]
|
||||
custom_minimum_size = Vector2(216, 32)
|
||||
layout_mode = 0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 40.0
|
||||
theme_override_fonts/font = ExtResource("1_lgdyb")
|
||||
theme_override_font_sizes/font_size = 32
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="TextureButton" type="TextureButton" parent="ActionControl4" unique_id=1477690280]
|
||||
layout_mode = 0
|
||||
offset_top = 32.0
|
||||
offset_right = 216.0
|
||||
offset_bottom = 216.0
|
||||
texture_normal = ExtResource("2_cjivn")
|
||||
|
||||
[connection signal="pressed" from="ActionControl0/TextureButton" to="." method="_on_action_button_pressed" binds= [0]]
|
||||
[connection signal="pressed" from="ActionControl1/TextureButton" to="." method="_on_action_button_pressed" binds= [1]]
|
||||
[connection signal="pressed" from="ActionControl2/TextureButton" to="." method="_on_action_button_pressed" binds= [2]]
|
||||
[connection signal="pressed" from="ActionControl3/TextureButton" to="." method="_on_action_button_pressed" binds= [3]]
|
||||
[connection signal="pressed" from="ActionControl4/TextureButton" to="." method="_on_action_button_pressed" binds= [4]]
|
||||
Reference in New Issue
Block a user