1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 01:29:49 +00:00
Pixelorama/Scripts/PreferencesDialog.gd
OverloadedOrama 3cf44a6d55 Created basic theme changing under Preferences
Also fixed bug where Global.can_draw wasn't being set to true after PreferencesDialog was hidden
2019-12-19 01:18:57 +02:00

48 lines
2.1 KiB
GDScript

extends AcceptDialog
func _on_LanguageOption_item_selected(ID : int) -> void:
if ID == 0:
TranslationServer.set_locale(OS.get_locale())
else:
TranslationServer.set_locale(Global.loaded_locales[ID - 1])
if Global.loaded_locales[ID - 1] == "zh_TW":
Global.control.theme.default_font = preload("res://Assets/Fonts/NotoSansCJKtc-Regular.tres")
else:
Global.control.theme.default_font = preload("res://Assets/Fonts/Roboto-Regular.tres")
Global.config_cache.set_value("preferences", "locale", TranslationServer.get_locale())
Global.config_cache.save("user://cache.ini")
func _on_ThemeOption_item_selected(ID : int) -> void:
var main_theme
var top_menu_style
var ruler_style
if ID == 0: #Main Theme
main_theme = preload("res://Themes & Styles/Main Theme/Main Theme.tres")
top_menu_style = preload("res://Themes & Styles/Main Theme/TopMenuStyle.tres")
ruler_style = preload("res://Themes & Styles/Main Theme/RulerStyle.tres")
elif ID == 1: #Dark Theme
main_theme = preload("res://Themes & Styles/Dark Theme/Dark Theme.tres")
top_menu_style = preload("res://Themes & Styles/Dark Theme/DarkTopMenuStyle.tres")
ruler_style = preload("res://Themes & Styles/Dark Theme/DarkRulerStyle.tres")
Global.control.theme = main_theme
Global.top_menu_container.add_stylebox_override("panel", top_menu_style)
Global.horizontal_ruler.add_stylebox_override("normal", ruler_style)
Global.horizontal_ruler.add_stylebox_override("pressed", ruler_style)
Global.horizontal_ruler.add_stylebox_override("hover", ruler_style)
Global.horizontal_ruler.add_stylebox_override("focus", ruler_style)
Global.vertical_ruler.add_stylebox_override("normal", ruler_style)
Global.vertical_ruler.add_stylebox_override("pressed", ruler_style)
Global.vertical_ruler.add_stylebox_override("hover", ruler_style)
Global.vertical_ruler.add_stylebox_override("focus", ruler_style)
func _on_GridWidthValue_value_changed(value : float) -> void:
Global.grid_width = value
func _on_GridHeightValue_value_changed(value : float) -> void:
Global.grid_height = value
func _on_GridColor_color_changed(color : Color) -> void:
Global.grid_color = color