2022-02-12 19:45:44 +00:00
|
|
|
extends Control
|
|
|
|
|
2022-03-30 20:32:56 +00:00
|
|
|
var git_branch:String
|
|
|
|
var git_commit:String
|
2022-04-15 07:53:44 +00:00
|
|
|
var tag_release:String
|
2022-02-12 19:45:44 +00:00
|
|
|
|
2022-02-15 22:21:57 +00:00
|
|
|
func _ready():
|
2023-04-13 17:35:20 +00:00
|
|
|
#$MenuTheme.connect("update_theme", update_theme.bind())
|
2022-10-31 18:43:59 +00:00
|
|
|
#var fileCheck = FileAccess.open("res://commit.txt")
|
|
|
|
if FileAccess.file_exists("res://commit.txt"):
|
|
|
|
var file = FileAccess.open("res://commit.txt", FileAccess.READ)
|
2022-04-15 07:53:44 +00:00
|
|
|
tag_release = file.get_as_text().strip_escapes()
|
2022-10-31 18:43:59 +00:00
|
|
|
file = null # File is closed.
|
2022-04-15 07:53:44 +00:00
|
|
|
Common.msg_debug("Tag: " + tag_release)
|
2022-10-31 18:43:59 +00:00
|
|
|
elif FileAccess.file_exists("res://.git/HEAD"):
|
|
|
|
var file = FileAccess.open("res://.git/HEAD", FileAccess.READ)
|
2022-04-15 07:53:44 +00:00
|
|
|
var content = file.get_as_text().strip_escapes()
|
|
|
|
git_branch = content.split(' ')[1]
|
|
|
|
|
2023-04-10 22:12:51 +00:00
|
|
|
#file.open("res://.git/" + git_branch, FileAccess.READ)
|
|
|
|
file = null # File is closed.
|
|
|
|
file = FileAccess.open("res://.git/" + git_branch, FileAccess.READ)
|
2022-04-15 07:53:44 +00:00
|
|
|
git_commit = file.get_as_text().strip_escapes()
|
2022-10-31 18:43:59 +00:00
|
|
|
file = null # File is closed.
|
2022-04-15 07:53:44 +00:00
|
|
|
Common.msg_debug("Commit: " + git_commit)
|
|
|
|
else:
|
|
|
|
git_branch = "Unknown"
|
|
|
|
git_commit = "Unknown"
|
2022-02-15 22:21:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
func update_theme():
|
|
|
|
var select_theme = load(Themes.THEMES_CONTROL[Themes.current_theme])
|
|
|
|
#$Control.set_theme(Themes.THEMES_CONTROL[Themes.current_theme])
|
2022-06-26 13:20:42 +00:00
|
|
|
Common.msg_debug($Control)
|
2022-02-15 22:21:57 +00:00
|
|
|
self.set_theme(select_theme)
|
|
|
|
|
|
|
|
|
2023-04-13 17:35:20 +00:00
|
|
|
func _input(_event:InputEvent):
|
2022-02-12 22:15:01 +00:00
|
|
|
if Input.is_action_just_pressed("ui_menu"):
|
2022-02-12 19:45:44 +00:00
|
|
|
$Menu.visible = ! $Menu.visible
|
2023-04-13 17:35:20 +00:00
|
|
|
if $Menu.visible:
|
|
|
|
# Force focus on Keys
|
|
|
|
$Menu/About.grab_focus()
|
2023-04-19 22:24:05 +00:00
|
|
|
Common.set_menu_visible(true)
|
|
|
|
else:
|
|
|
|
Common.set_menu_visible(false)
|
2023-04-13 17:35:20 +00:00
|
|
|
# elif $Menu.visible:
|
|
|
|
# if _event.is_action_pressed("INPUT_ACTION_RIGHT"):
|
|
|
|
# print("INPUT_ACTION_RIGHT 2")
|
|
|
|
# #$Control.accept_event()
|
|
|
|
# #Input.flush_buffered_events()
|
|
|
|
# elif _event.is_action_pressed("INPUT_ACTION_LEFT"):
|
|
|
|
# print("INPUT_ACTION_LEFT 2")
|
|
|
|
# elif Input.is_action_just_pressed("INPUT_ACTION_LEFT"):
|
|
|
|
# print("INPUT_ACTION_LEFT")
|
|
|
|
# elif Input.is_action_just_pressed("INPUT_ACTION_RIGHT"):
|
|
|
|
# print("INPUT_ACTION_RIGHT")
|
|
|
|
# #set_input_as_handled()
|
|
|
|
# #accept_event()
|
|
|
|
# #Viewport.set_input_as_handled()
|
|
|
|
# #self.get_parent_control().set_input_as_handled()
|
2022-02-12 19:45:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_timer_timeout():
|
|
|
|
$Message/Label.visible = false
|
|
|
|
|
|
|
|
|
|
|
|
func _on_quit_pressed():
|
|
|
|
$ConfirmQuit.popup_centered()
|
|
|
|
$ConfirmQuit.visible = true
|
|
|
|
|
|
|
|
|
|
|
|
func _on_confirmation_dialog_confirmed():
|
|
|
|
get_tree().quit()
|
|
|
|
|
|
|
|
|
|
|
|
func _on_languages_pressed():
|
2022-06-15 20:53:34 +00:00
|
|
|
#$MenuLanguage/Window.popup_centered()
|
2022-06-26 13:20:42 +00:00
|
|
|
$MenuLanguage.show_window()
|
2022-02-12 22:15:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_keys_pressed():
|
2022-02-24 22:08:03 +00:00
|
|
|
$MenuControl.configure_control()
|
|
|
|
$MenuControl/Window.visible = true
|
2022-02-15 22:21:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_themes_pressed():
|
|
|
|
$MenuTheme/Window.popup_centered()
|
|
|
|
$MenuTheme/Window.visible = true
|
2022-03-30 20:32:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_about_pressed():
|
2022-04-15 07:53:44 +00:00
|
|
|
var aboutmessage:String
|
|
|
|
if tag_release.is_empty():
|
|
|
|
aboutmessage = "Khaganat client test\nBranch: " + git_branch + "\nCommit: " + git_commit
|
|
|
|
else:
|
|
|
|
aboutmessage = "Khaganat client test\nVersion: " + tag_release
|
2022-03-30 20:32:56 +00:00
|
|
|
$AboutMessage.set_text(aboutmessage)
|
|
|
|
$AboutMessage.popup_centered()
|
|
|
|
$AboutMessage.visible = true
|
2022-04-15 07:53:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_music_pressed():
|
|
|
|
$MusicManager.show_config()
|