- Server: Add SkyboxType + 6 CubeUrl fields to SkyboxDefinition entity - Server: EF migration AddSkyboxCubemapType - Server: GetSkyboxConfigResponse now returns array of all active skyboxes - Admin: SkyboxManagerPage supports Panoramic/AnimatedPanorama/Cubemap types, 6 face URL fields for cubemap, and independent per-skybox active toggle - Client: ContentCache fetches + caches skyboxes; adds get_random_skybox, get_skybox_bg_url, load_texture_async, apply_scene_background helpers - Client: game_screen replaces _fetch_skybox with ContentCache-based approach; adds _load_cubemap_skybox / _apply_cubemap_images / _apply_cubemap_material - Client: 12 2D scene scripts call ContentCache.apply_scene_background(self) in _ready() to replace solid-color backgrounds with CDN skybox images Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
116 lines
4.6 KiB
GDScript
116 lines
4.6 KiB
GDScript
extends Control
|
|
## Settings screen — audio volume, mute, gameplay, and highlight override controls.
|
|
## Reads initial values from the Settings autoload and writes back on change.
|
|
|
|
@onready var back_btn : Button = %BackBtn
|
|
@onready var music_slider : HSlider = %MusicSlider
|
|
@onready var music_mute_btn : CheckButton = %MusicMuteBtn
|
|
@onready var sfx_slider : HSlider = %SfxSlider
|
|
@onready var sfx_mute_btn : CheckButton = %SfxMuteBtn
|
|
@onready var camera_follow_btn : CheckButton = %CameraFollowBtn
|
|
|
|
const _HI_TYPES : Array = ["movement", "attack", "ability", "terramorpha", "selector"]
|
|
const _HI_LABELS: Array = ["Movement", "Attack", "Ability", "Terramorpha", "Selector"]
|
|
|
|
# ── Lifecycle ─────────────────────────────────────────────────────────────────
|
|
|
|
func _ready() -> void:
|
|
ContentCache.apply_scene_background(self)
|
|
# Populate controls from current settings (no signal spam).
|
|
music_slider.set_value_no_signal(Settings.music_volume)
|
|
music_mute_btn.set_pressed_no_signal(Settings.music_muted)
|
|
sfx_slider.set_value_no_signal(Settings.sfx_volume)
|
|
sfx_mute_btn.set_pressed_no_signal(Settings.sfx_muted)
|
|
camera_follow_btn.set_pressed_no_signal(Settings.camera_follow_unit)
|
|
|
|
_refresh_slider_states()
|
|
_build_highlight_section()
|
|
|
|
back_btn.pressed.connect(_on_back)
|
|
music_slider.value_changed.connect(func(v): Settings.music_volume = v)
|
|
music_mute_btn.toggled.connect(func(on):
|
|
Settings.music_muted = on
|
|
_refresh_slider_states())
|
|
sfx_slider.value_changed.connect(func(v): Settings.sfx_volume = v)
|
|
sfx_mute_btn.toggled.connect(func(on):
|
|
Settings.sfx_muted = on
|
|
_refresh_slider_states())
|
|
camera_follow_btn.toggled.connect(func(on): Settings.camera_follow_unit = on)
|
|
|
|
# ── Helpers ───────────────────────────────────────────────────────────────────
|
|
|
|
func _refresh_slider_states() -> void:
|
|
music_slider.editable = not Settings.music_muted
|
|
sfx_slider.editable = not Settings.sfx_muted
|
|
music_slider.modulate = Color(1, 1, 1, 0.4 if Settings.music_muted else 1.0)
|
|
sfx_slider.modulate = Color(1, 1, 1, 0.4 if Settings.sfx_muted else 1.0)
|
|
|
|
|
|
func _on_back() -> void:
|
|
get_tree().change_scene_to_file("res://scenes/main/MainScreen.tscn")
|
|
|
|
|
|
# ── Highlight override section (built programmatically) ───────────────────────
|
|
|
|
func _build_highlight_section() -> void:
|
|
var sections : VBoxContainer = get_node_or_null(
|
|
"Layout/ScrollContainer/Content/ContentMargin/Sections")
|
|
if sections == null:
|
|
return
|
|
|
|
var section := VBoxContainer.new()
|
|
section.add_theme_constant_override("separation", 6)
|
|
|
|
var header := Label.new()
|
|
header.text = "Highlight Texture Overrides"
|
|
header.add_theme_font_size_override("font_size", 16)
|
|
section.add_child(header)
|
|
|
|
var note := Label.new()
|
|
note.text = "Enter a custom texture URL for each highlight type, or leave blank to use\nthe server default. Changes apply immediately."
|
|
note.autowrap_mode = TextServer.AUTOWRAP_WORD
|
|
note.modulate = Color(0.75, 0.75, 0.75)
|
|
note.add_theme_font_size_override("font_size", 12)
|
|
section.add_child(note)
|
|
|
|
for i in range(_HI_TYPES.size()):
|
|
var key : String = _HI_TYPES[i]
|
|
var label : String = _HI_LABELS[i]
|
|
var row := _make_override_row(key, label)
|
|
section.add_child(row)
|
|
|
|
sections.add_child(section)
|
|
|
|
|
|
func _make_override_row(key: String, label: String) -> HBoxContainer:
|
|
var row := HBoxContainer.new()
|
|
row.add_theme_constant_override("separation", 8)
|
|
|
|
var lbl := Label.new()
|
|
lbl.text = label
|
|
lbl.custom_minimum_size = Vector2(90, 0)
|
|
lbl.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
row.add_child(lbl)
|
|
|
|
var edit := LineEdit.new()
|
|
edit.placeholder_text = "https://cdn.sor.gg/highlights/… (leave blank for default)"
|
|
edit.text = str(Settings.highlight_overrides.get(key, ""))
|
|
edit.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
row.add_child(edit)
|
|
|
|
var reset_btn := Button.new()
|
|
reset_btn.text = "Reset"
|
|
reset_btn.tooltip_text = "Remove override — use server default"
|
|
row.add_child(reset_btn)
|
|
|
|
# Apply URL when the LineEdit loses focus or Enter is pressed.
|
|
edit.text_submitted.connect(func(url: String) -> void:
|
|
Settings.set_highlight_override(key, url.strip_edges()))
|
|
edit.focus_exited.connect(func() -> void:
|
|
Settings.set_highlight_override(key, edit.text.strip_edges()))
|
|
reset_btn.pressed.connect(func() -> void:
|
|
Settings.clear_highlight_override(key)
|
|
edit.text = "")
|
|
|
|
return row
|