aboutsummaryrefslogtreecommitdiff
path: root/game/src/MainMenu
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2023-03-29 08:18:16 +0200
committer GitHub <noreply@github.com>2023-03-29 08:18:16 +0200
commit8f213935bdea2400b6809f9d5db45dde3416dedc (patch)
tree9d333d26e18e0ad29979170edc031f60866e40cd /game/src/MainMenu
parentcb5858b80c6dc9918b8366a433ca78a5d4adebed (diff)
parent793a8939c4f721844c276a3d49293c23c902c8d3 (diff)
Merge pull request #79 from Spartan322/general-release-info
Diffstat (limited to 'game/src/MainMenu')
-rw-r--r--game/src/MainMenu/MainMenu.gd7
-rw-r--r--game/src/MainMenu/MainMenu.tscn24
-rw-r--r--game/src/MainMenu/ReleaseInfoBox.gd31
-rw-r--r--game/src/MainMenu/ReleaseInfoBox.tscn38
4 files changed, 73 insertions, 27 deletions
diff --git a/game/src/MainMenu/MainMenu.gd b/game/src/MainMenu/MainMenu.gd
index 662cd90..4420786 100644
--- a/game/src/MainMenu/MainMenu.gd
+++ b/game/src/MainMenu/MainMenu.gd
@@ -7,18 +7,11 @@ signal credits_button_pressed
@export
var _new_game_button : BaseButton
-@export
-var _checksum_label : Label
-
# REQUIREMENTS:
# * SS-3
-# * UIFUN-97
func _ready():
print("From GDScript")
TestSingleton.hello_singleton()
- # UI-111
- _checksum_label.tooltip_text = "Checksum " + Checksum.get_checksum_text()
- _checksum_label.text = "(" + Checksum.get_checksum_text().substr(0, 4) + ")"
_on_new_game_button_visibility_changed()
# REQUIREMENTS:
diff --git a/game/src/MainMenu/MainMenu.tscn b/game/src/MainMenu/MainMenu.tscn
index 6159ea6..10bf526 100644
--- a/game/src/MainMenu/MainMenu.tscn
+++ b/game/src/MainMenu/MainMenu.tscn
@@ -1,10 +1,11 @@
-[gd_scene load_steps=4 format=3 uid="uid://c5nyjkpsx14h1"]
+[gd_scene load_steps=5 format=3 uid="uid://bp5n3mlu45ygw"]
[ext_resource type="Theme" uid="uid://qoi3oec48jp0" path="res://theme/main_menu.tres" id="1_1yri4"]
[ext_resource type="Script" path="res://src/MainMenu/MainMenu.gd" id="2_nm1fq"]
[ext_resource type="PackedScene" uid="uid://b7oncobnacxmt" path="res://src/LocaleButton.tscn" id="3_amonp"]
+[ext_resource type="PackedScene" uid="uid://cen7wkmn6og66" path="res://src/MainMenu/ReleaseInfoBox.tscn" id="3_km0er"]
-[node name="MainMenu" type="Control" node_paths=PackedStringArray("_new_game_button", "_checksum_label")]
+[node name="MainMenu" type="Control" node_paths=PackedStringArray("_new_game_button")]
editor_description = "UI-13"
layout_mode = 3
anchors_preset = 15
@@ -15,7 +16,6 @@ grow_vertical = 2
theme = ExtResource("1_1yri4")
script = ExtResource("2_nm1fq")
_new_game_button = NodePath("Panel/VBox/Margin/ButtonList/NewGameButton")
-_checksum_label = NodePath("Panel/VBox/BottomMargin/VersionChecksumBox/ChecksumLabel")
[node name="Panel" type="PanelContainer" parent="."]
layout_mode = 1
@@ -132,25 +132,9 @@ size_flags_stretch_ratio = 0.35
layout_mode = 2
theme_type_variation = &"BottomMargin"
-[node name="VersionChecksumBox" type="HBoxContainer" parent="Panel/VBox/BottomMargin"]
-editor_description = "UI-31"
+[node name="ReleaseInfoBox" parent="Panel/VBox/BottomMargin" instance=ExtResource("3_km0er")]
layout_mode = 2
-[node name="VersionLabel" type="Label" parent="Panel/VBox/BottomMargin/VersionChecksumBox"]
-layout_mode = 2
-tooltip_text = "OpenVic2 v0.01 \"Primum Mobile\""
-mouse_filter = 1
-theme_type_variation = &"VersionLabel"
-text = "v0.01"
-
-[node name="ChecksumLabel" type="Label" parent="Panel/VBox/BottomMargin/VersionChecksumBox"]
-editor_description = "UI-111"
-layout_mode = 2
-tooltip_text = "Checksum 00000000"
-mouse_filter = 1
-theme_type_variation = &"ChecksumLabel"
-text = "(0000)"
-
[node name="LocaleButton" parent="Panel/VBox/BottomMargin" instance=ExtResource("3_amonp")]
layout_mode = 2
size_flags_horizontal = 8
diff --git a/game/src/MainMenu/ReleaseInfoBox.gd b/game/src/MainMenu/ReleaseInfoBox.gd
new file mode 100644
index 0000000..48686f3
--- /dev/null
+++ b/game/src/MainMenu/ReleaseInfoBox.gd
@@ -0,0 +1,31 @@
+extends HBoxContainer
+
+@export
+var _version_label : Button
+
+@export
+var _commit_label : Button
+
+@export
+var _checksum_label : Button
+
+# REQUIREMENTS:
+# * UIFUN-97
+func _ready():
+ _version_label.text = _GIT_INFO_.release_name
+ _version_label.tooltip_text = _GIT_INFO_.tag
+ _commit_label.text = _GIT_INFO_.short_hash
+ _commit_label.tooltip_text = _GIT_INFO_.commit_hash
+ # UI-111
+ _checksum_label.tooltip_text = "Checksum " + Checksum.get_checksum_text()
+ _checksum_label.text = "(" + Checksum.get_checksum_text().substr(0, 4) + ")"
+
+
+func _on_version_label_pressed():
+ DisplayServer.clipboard_set(_GIT_INFO_.tag)
+
+func _on_commit_label_pressed():
+ DisplayServer.clipboard_set(_GIT_INFO_.commit_hash)
+
+func _on_checksum_label_pressed():
+ DisplayServer.clipboard_set(Checksum.get_checksum_text())
diff --git a/game/src/MainMenu/ReleaseInfoBox.tscn b/game/src/MainMenu/ReleaseInfoBox.tscn
new file mode 100644
index 0000000..d15ae31
--- /dev/null
+++ b/game/src/MainMenu/ReleaseInfoBox.tscn
@@ -0,0 +1,38 @@
+[gd_scene load_steps=2 format=3 uid="uid://cen7wkmn6og66"]
+
+[ext_resource type="Script" path="res://src/MainMenu/ReleaseInfoBox.gd" id="1_y2djw"]
+
+[node name="ReleaseInfoBox" type="HBoxContainer" node_paths=PackedStringArray("_version_label", "_commit_label", "_checksum_label")]
+editor_description = "UI-31"
+script = ExtResource("1_y2djw")
+_version_label = NodePath("VersionLabel")
+_commit_label = NodePath("CommitLabel")
+_checksum_label = NodePath("ChecksumLabel")
+
+[node name="VersionLabel" type="Button" parent="."]
+layout_mode = 2
+tooltip_text = "OpenVic2 v0.01 \"Primum Mobile\""
+theme_type_variation = &"VersionLabel"
+text = "v0.01"
+flat = true
+alignment = 0
+
+[node name="CommitLabel" type="Button" parent="."]
+layout_mode = 2
+theme_type_variation = &"CommitLabel"
+text = "ffffffff"
+flat = true
+alignment = 0
+
+[node name="ChecksumLabel" type="Button" parent="."]
+editor_description = "UI-111"
+layout_mode = 2
+tooltip_text = "Checksum 00000000"
+theme_type_variation = &"ChecksumLabel"
+text = "(0000)"
+flat = true
+alignment = 0
+
+[connection signal="pressed" from="VersionLabel" to="." method="_on_version_label_pressed"]
+[connection signal="pressed" from="CommitLabel" to="." method="_on_commit_label_pressed"]
+[connection signal="pressed" from="ChecksumLabel" to="." method="_on_checksum_label_pressed"]