#21 - Add commit short hash to UI

This commit is contained in:
AleaJactaEst 2022-03-30 22:32:56 +02:00
parent b58bcca228
commit c65da26e3d
10 changed files with 76 additions and 18 deletions

View file

@ -65,6 +65,9 @@ msgstr "Themes"
msgid "HUD/LANGUAGES"
msgstr "Languages"
msgid "HUD/ABOUT"
msgstr "About"
msgid "HUD/QUIT"
msgstr "Quit"
@ -229,3 +232,6 @@ msgstr "Camera move only"
msgid "INPUT_ACTION_JUMP"
msgstr "Jump"
msgid "POPUP_ABOUT_MESSAGE/TITLE"
msgstr "About"

View file

@ -65,6 +65,9 @@ msgstr "Thèmes"
msgid "HUD/LANGUAGES"
msgstr "Langue"
msgid "HUD/ABOUT"
msgstr "A propos"
msgid "HUD/QUIT"
msgstr "Quitter"
@ -229,3 +232,6 @@ msgstr "Déplacer la caméra seulement"
msgid "INPUT_ACTION_JUMP"
msgstr "Sauter"
msgid "POPUP_ABOUT_MESSAGE/TITLE"
msgstr "A propos"

Binary file not shown.

View file

@ -56,6 +56,9 @@ msgstr ""
msgid "HUD/LANGUAGES"
msgstr ""
msgid "HUD/ABOUT"
msgstr ""
msgid "HUD/QUIT"
msgstr ""
@ -220,3 +223,6 @@ msgstr ""
msgid "INPUT_ACTION_JUMP"
msgstr ""
msgid "POPUP_ABOUT_MESSAGE/TITLE"
msgstr ""

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,9 +1,20 @@
extends Control
var git_branch:String
var git_commit:String
func _ready():
# .connect("mute_pressed", self, "_on_signal_mute_pressed")
$MenuTheme.connect("update_theme", update_theme.bind())
var file = File.new()
file.open("res://.git/HEAD", File.READ)
var content = file.get_as_text().strip_escapes()
file.close()
git_branch = content.split(' ')[1]
file.open("res://.git/" + git_branch, File.READ)
git_commit = file.get_as_text().strip_escapes()
file.close()
Common.msg_debug("Commit: " + git_commit)
func update_theme():
@ -44,3 +55,10 @@ func _on_keys_pressed():
func _on_themes_pressed():
$MenuTheme/Window.popup_centered()
$MenuTheme/Window.visible = true
func _on_about_pressed():
var aboutmessage = "Khaganat client test\nBranch: " + git_branch + "\nCommit: " + git_commit
$AboutMessage.set_text(aboutmessage)
$AboutMessage.popup_centered()
$AboutMessage.visible = true

View file

@ -58,6 +58,11 @@ offset_right = 574.0
offset_bottom = 40.0
text = "HUD/LANGUAGES"
[node name="About" type="Button" parent="Menu"]
offset_right = 40.0
offset_bottom = 19.0
text = "HUD/ABOUT"
[node name="Quit" type="Button" parent="Menu"]
offset_left = 578.0
offset_right = 619.0
@ -73,6 +78,9 @@ autostart = true
title = "POPUP_CONFIRM_QUIT/TITLE"
dialog_text = "POPUP_CONFIRM_QUIT/MESSAGE"
[node name="AboutMessage" type="AcceptDialog" parent="."]
title = "POPUP_ABOUT_MESSAGE/TITLE"
[node name="MenuOption" parent="." instance=ExtResource( "2_um8fw" )]
visible = false
@ -84,6 +92,7 @@ visible = false
[connection signal="pressed" from="Menu/Keys" to="." method="_on_keys_pressed"]
[connection signal="pressed" from="Menu/Themes" to="." method="_on_themes_pressed"]
[connection signal="pressed" from="Menu/Languages" to="." method="_on_languages_pressed"]
[connection signal="pressed" from="Menu/About" to="." method="_on_about_pressed"]
[connection signal="pressed" from="Menu/Quit" to="." method="_on_quit_pressed"]
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
[connection signal="confirmed" from="ConfirmQuit" to="." method="_on_confirmation_dialog_confirmed"]

View file

@ -3,6 +3,19 @@ extends Node3D
var oldobject:Node3D = null
@onready var player_ptr = $player
func _init():
var file = File.new()
file.open("res://.git/HEAD", File.READ)
var content = file.get_as_text().strip_escapes()
file.close()
var head:String = content.split(' ')[1]
file.open("res://.git/" + head, File.READ)
content = file.get_as_text().strip_escapes()
file.close()
Common.msg_debug("Commit: " + content)
# Called when the node enters the scene tree for the first time.
func _ready():
$player.connect("switch_to_ship", self.switch_to_ship.bind() )