Add new PNG assets for time and speed UI components

This commit is contained in:
Kirill
2026-08-20 20:09:14 +03:00
parent 8513bf0313
commit 777ec2907b
211 changed files with 41 additions and 41 deletions
Binary file not shown.
+46
View File
@@ -0,0 +1,46 @@
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 current_item_id = ""
var action_values: Dictionary = {
0: 0,
1: 0,
2: 0,
3: 0,
4: 0,
}
func set_actions(item_id: String, value: float) -> void:
current_item_id = item_id
_set_action_values(_get_distribution(value))
func _get_distribution(value: float) -> Array:
var distribution: Array = [value, 0, 0, 0, 0]
var exp_value = int(floor(log(abs(value)) / log(10.0)))
var floor_value = max(exp_value - 4, -1)
for ev in range(exp_value, floor_value, -1):
distribution.push_front(pow(10.0, ev))
return distribution
func _set_action_values(values: Array) -> void:
for ind in range(0, 5):
action_values[ind] = values[ind]
action_labels[ind].text = Global.format_number(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])
+1
View File
@@ -0,0 +1 @@
uid://c2ech05mh56y8
+121
View File
@@ -0,0 +1,121 @@
[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, 216)
theme_override_constants/separation = 0
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]
custom_minimum_size = Vector2(216, 184)
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]
custom_minimum_size = Vector2(216, 184)
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]
custom_minimum_size = Vector2(216, 184)
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]
custom_minimum_size = Vector2(216, 184)
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]
custom_minimum_size = Vector2(216, 184)
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]]