feature/list-object-counter (#60)
Co-authored-by: VAILLANT Jeremy <vaillant.jeremy@dev-crea.com> Reviewed-on: Athena/game-source#60 Co-authored-by: darknight <vaillant.jeremy@dev-crea.com> Co-committed-by: darknight <vaillant.jeremy@dev-crea.com>
This commit is contained in:
@@ -1,19 +1,25 @@
|
||||
extends Node
|
||||
|
||||
func _ready():
|
||||
print("[Settings#_ready]")
|
||||
_translation()
|
||||
_apply_translation()
|
||||
_apply_settings_language()
|
||||
_apply_settings_gyroscope()
|
||||
_apply_settings_sound_ambient()
|
||||
_apply_settings_resolution()
|
||||
_apply_settings_fullscreen()
|
||||
|
||||
## PRIVATE
|
||||
func _translation():
|
||||
$VBoxContainer/Langue/HBoxContainer/Label.text = tr("SETTINGS_LABEL_LANGUE")
|
||||
func _apply_translation():
|
||||
$VBoxContainer/langue/VBoxContainer/Label.text = tr("SETTINGS_LABEL_LANGUE")
|
||||
$VBoxContainer/gyroscope/HBoxContainer/Label.text = tr("SETTINGS_LABEL_GYROSCOPE")
|
||||
|
||||
func _apply_settings_language():
|
||||
$VBoxContainer/Langue/HBoxContainer/data.set_text(Global.get_setting_language())
|
||||
var data = $VBoxContainer/langue/VBoxContainer/data
|
||||
|
||||
data.add_item("English", load("res://assets/ui/flags/english.png"), true) # id : 0
|
||||
data.add_item("Français", load("res://assets/ui/flags/french.png"), true) # id : 1
|
||||
|
||||
data.select(Global.get_setting_language())
|
||||
|
||||
func _apply_settings_gyroscope():
|
||||
$VBoxContainer/gyroscope/HBoxContainer/data.set_pressed(Global.get_setting_gyrosocpe())
|
||||
@@ -21,10 +27,32 @@ func _apply_settings_gyroscope():
|
||||
func _apply_settings_sound_ambient():
|
||||
$VBoxContainer/ambient_sound/HBoxContainer/data.set_pressed(Global.get_setting_ambient_sound())
|
||||
|
||||
func _apply_settings_resolution():
|
||||
var data = $VBoxContainer/resolution/VBoxContainer/data
|
||||
|
||||
data.add_item("2560 x 1440", null, true) # id : 0
|
||||
data.add_item("1920 x 1080", null, true) # id : 1
|
||||
data.add_item("1280 x 720", null, true) # id : 2
|
||||
data.add_item("854 x 576", null, true) # id : 3
|
||||
|
||||
for index in range(4):
|
||||
if data.get_item_text(index).split(' x ') == Global.get_setting_resolution():
|
||||
data.select(index)
|
||||
|
||||
func _apply_settings_fullscreen():
|
||||
$VBoxContainer/fullscreen/HBoxContainer/data.set_pressed(Global.get_setting_fullscreen())
|
||||
|
||||
func _on_gyroscope_pressed():
|
||||
print("[Settings#_on_gyroscope_pressed] change value to database ...........")
|
||||
Global.set_setting_gyroscope(int($VBoxContainer/gyroscope/HBoxContainer/data.pressed))
|
||||
|
||||
func _on_ambient_sound_pressed():
|
||||
print("[Settings#_on_ambient_sound_pressed] change value to database ...........")
|
||||
Global.set_setting_ambient_sound(int($VBoxContainer/ambient_sound/HBoxContainer/data.pressed))
|
||||
|
||||
func _on_langue_item_selected(index):
|
||||
Global.set_setting_language(index)
|
||||
|
||||
func _on_resolution_item_selected(index):
|
||||
Global.set_setting_resolution($VBoxContainer/resolution/VBoxContainer/data.get_item_text(index))
|
||||
|
||||
func _on_fullscreen_item_selected():
|
||||
Global.set_setting_fullscreen(int($VBoxContainer/fullscreen/HBoxContainer/data.pressed))
|
||||
|
||||
Reference in New Issue
Block a user