mirror of
https://github.com/Nokorpo/LibreAim.git
synced 2025-06-09 17:44:47 +09:00
Refactor stuff
This commit is contained in:
parent
871fb45e29
commit
9cad1e22bd
2 changed files with 13 additions and 16 deletions
|
@ -3,25 +3,25 @@ extends Control
|
|||
@onready var panel := $HBoxContainer/Panel
|
||||
@onready var exit_button = $HBoxContainer/MarginContainer/VBoxContainer/Quit
|
||||
|
||||
func _ready():
|
||||
func _ready() -> void:
|
||||
hide_options()
|
||||
if OS.has_feature("web"):
|
||||
exit_button.visible = false
|
||||
|
||||
func _on_play_pressed():
|
||||
func _on_play_pressed() -> void:
|
||||
hide_options()
|
||||
$HBoxContainer/Panel/SelectLevel.visible = true
|
||||
|
||||
func _on_quit_pressed():
|
||||
func _on_quit_pressed() -> void:
|
||||
get_tree().quit()
|
||||
|
||||
func _on_settings_pressed():
|
||||
func _on_settings_pressed() -> void:
|
||||
hide_options()
|
||||
$HBoxContainer/Panel/Settings.visible = true
|
||||
|
||||
func _on_source_code_pressed():
|
||||
|
||||
func _on_source_code_pressed() -> void:
|
||||
OS.shell_open("https://github.com/antimundo/libre-aim")
|
||||
|
||||
func hide_options():
|
||||
|
||||
func hide_options() -> void:
|
||||
for child in panel.get_children():
|
||||
child.visible = false
|
||||
|
|
|
@ -7,19 +7,16 @@ const games_sensitivities: Dictionary = {
|
|||
@onready var game = $MarginContainer/VBoxContainer/HBoxContainer2/Game
|
||||
@onready var sensitivity = $MarginContainer/VBoxContainer/HBoxContainer2/Sensitivity
|
||||
|
||||
func _ready():
|
||||
AddGamesSensitivities()
|
||||
func _ready() -> void:
|
||||
for sens in games_sensitivities:
|
||||
game.add_item(sens)
|
||||
var category = DataManager.categories.SETTINGS
|
||||
if DataManager.get_data(category, "sensitivity"):
|
||||
sensitivity.text = str(DataManager.get_data(category, "sensitivity"))
|
||||
if DataManager.get_data(category, "sensitivity_game"):
|
||||
game.selected = DataManager.get_data(category, "sensitivity_game")
|
||||
|
||||
func AddGamesSensitivities():
|
||||
for sens in games_sensitivities:
|
||||
game.add_item(sens)
|
||||
|
||||
func _on_sensitivity_text_changed(new_text):
|
||||
func _on_sensitivity_text_changed(new_text) -> void:
|
||||
DataManager.save_data("sensitivity_game", game.get_selected_id(), \
|
||||
DataManager.categories.SETTINGS)
|
||||
DataManager.save_data("sensitivity_game_value", games_sensitivities.get(game.get_item_text(game.get_selected_id())), \
|
||||
|
@ -27,7 +24,7 @@ func _on_sensitivity_text_changed(new_text):
|
|||
DataManager.save_data("sensitivity", float(new_text), \
|
||||
DataManager.categories.SETTINGS)
|
||||
|
||||
func _on_game_item_selected(index):
|
||||
func _on_game_item_selected(index) -> void:
|
||||
DataManager.save_data("sensitivity_game", index, \
|
||||
DataManager.categories.SETTINGS)
|
||||
DataManager.save_data("sensitivity_game_value", games_sensitivities.get(game.get_item_text(index)), \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue