Add legal consent and reliable external redirects
This commit is contained in:
@@ -52,6 +52,27 @@ func _ready() -> void:
|
||||
sound_toggle.toggled.connect(UISoundService.set_sounds_enabled)
|
||||
content.add_child(sound_toggle)
|
||||
|
||||
var legal_panel := PanelContainer.new()
|
||||
legal_panel.custom_minimum_size = Vector2(520, 0)
|
||||
legal_panel.size_flags_horizontal = Control.SIZE_SHRINK_BEGIN
|
||||
legal_panel.add_theme_stylebox_override("panel", Brand.panel_box(UIThemeService.is_dark_mode()))
|
||||
legal_panel.set_meta("legal_panel", true)
|
||||
add_child(legal_panel)
|
||||
var legal_content := VBoxContainer.new()
|
||||
legal_content.add_theme_constant_override("separation", 10)
|
||||
legal_panel.add_child(legal_content)
|
||||
var legal_heading := Label.new()
|
||||
legal_heading.text = "Legal"
|
||||
legal_heading.add_theme_font_override("font", Brand.font)
|
||||
legal_heading.add_theme_font_size_override("font_size", 20)
|
||||
legal_content.add_child(legal_heading)
|
||||
for spec in [["Terms of Service", "terms"], ["Privacy Policy", "privacy"]]:
|
||||
var button := Button.new()
|
||||
button.text = spec[0]
|
||||
button.alignment = HORIZONTAL_ALIGNMENT_LEFT
|
||||
button.pressed.connect(_open_legal_document.bind(str(spec[1])))
|
||||
legal_content.add_child(button)
|
||||
|
||||
UIThemeService.theme_changed.connect(_on_theme_changed)
|
||||
|
||||
|
||||
@@ -64,8 +85,15 @@ func _on_theme_toggled(enabled: bool) -> void:
|
||||
UIThemeService.set_dark_mode(enabled)
|
||||
|
||||
|
||||
func _open_legal_document(kind: String) -> void:
|
||||
main.open_legal_document(kind)
|
||||
|
||||
|
||||
func _on_theme_changed(is_dark: bool) -> void:
|
||||
theme_toggle.set_pressed_no_signal(is_dark)
|
||||
var panel := theme_toggle.get_parent().get_parent() as PanelContainer
|
||||
if panel != null:
|
||||
panel.add_theme_stylebox_override("panel", Brand.panel_box(is_dark))
|
||||
for node in get_children():
|
||||
if node is PanelContainer and node.has_meta("legal_panel"):
|
||||
node.add_theme_stylebox_override("panel", Brand.panel_box(is_dark))
|
||||
|
||||
Reference in New Issue
Block a user