73 lines
1.6 KiB
GDScript3
73 lines
1.6 KiB
GDScript3
|
extends Control
|
||
|
|
||
|
|
||
|
func read_license(key):
|
||
|
var file = File.new()
|
||
|
var filenews = ""
|
||
|
if key.empty():
|
||
|
filenews = "res://LICENSE"
|
||
|
else:
|
||
|
filenews = "res://LICENSE_" + key
|
||
|
|
||
|
if file.file_exists(filenews):
|
||
|
#print(filenews + " exist ! ")
|
||
|
file.open(filenews, File.READ)
|
||
|
var content = file.get_as_text()
|
||
|
file.close()
|
||
|
$window_dialog/margin_container/v_box_container/tab_container/OPTION_INFO_LICENSE.text = content
|
||
|
return true
|
||
|
return false
|
||
|
|
||
|
func load_license():
|
||
|
var current_locale = TranslationServer.get_locale()
|
||
|
var root_language = current_locale.split('_')[0]
|
||
|
var file = File.new()
|
||
|
var filenews = ""
|
||
|
|
||
|
if read_license(current_locale):
|
||
|
pass
|
||
|
elif read_license(root_language):
|
||
|
pass
|
||
|
elif read_license(""):
|
||
|
pass
|
||
|
|
||
|
func read_authors(key):
|
||
|
var file = File.new()
|
||
|
var filenews = ""
|
||
|
if key.empty():
|
||
|
filenews = "res://AUTHORS"
|
||
|
else:
|
||
|
filenews = "res://AUTHORS_" + key
|
||
|
|
||
|
if file.file_exists(filenews):
|
||
|
#print(filenews + " exist ! ")
|
||
|
file.open(filenews, File.READ)
|
||
|
var content = file.get_as_text()
|
||
|
file.close()
|
||
|
$window_dialog/margin_container/v_box_container/tab_container/OPTION_INFO_AUTHORS.text = content
|
||
|
return true
|
||
|
return false
|
||
|
|
||
|
func load_authors():
|
||
|
var current_locale = TranslationServer.get_locale()
|
||
|
var root_language = current_locale.split('_')[0]
|
||
|
var file = File.new()
|
||
|
var filenews = ""
|
||
|
|
||
|
if read_authors(current_locale):
|
||
|
pass
|
||
|
elif read_authors(root_language):
|
||
|
pass
|
||
|
elif read_authors(""):
|
||
|
pass
|
||
|
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
load_authors()
|
||
|
load_license()
|
||
|
|
||
|
|
||
|
func _on_button_pressed():
|
||
|
$window_dialog.hide()
|