Server / DB:
- New HighlightConfig entity (catalog.highlight_configs): one row per
highlight type (Movement/Attack/Ability/Terramorpha/Selector). Supports
static texture URL or animated (base folder + frame count + FPS) with a
FallbackHex RGBA colour for when no texture is configured.
- EF migration AddHighlightConfig.
- CosmeticType.HighlightPack added; AssetCdnUrl stores serialised JSON with
per-type texture config so players can buy full highlight packs in the Bazaar.
- content.get_highlight_config handler in SOR.Content; response DTOs added to
ContentMessages.cs; handler registered in ServiceRegistration.
Admin:
- /content/highlights page: inline editor for all five highlight types
(CDN path, animated toggle, frame count, FPS, fallback hex with swatch).
Upserts rows — no delete needed since there is always exactly one row per type.
- Highlights nav link added to Content section in NavMenu.
- CosmeticEditor: HighlightPack type renders a per-type table (Movement/
Attack/Ability/Terramorpha/Selector), serialising to JSON in AssetCdnUrl.
Client (Godot):
- HighlightConfig autoload: fetches content.get_highlight_config on startup,
caches to user://highlight_config.json. Provides get_texture(type) and
get_color(type). Supports set_override/clear_override/apply_cosmetic_pack
for cosmetic and settings overrides.
- Settings autoload: highlight_overrides Dictionary persisted in settings.cfg.
set_highlight_override/clear_highlight_override push into HighlightConfig.
- settings_screen.gd: programmatic "Highlight Texture Overrides" section added
with a LineEdit + Reset button per type; appended to Sections VBoxContainer.
- game_screen.gd:
• _add_highlight() rewritten to use flat PlaneMesh quads with textured
StandardMaterial3D. Accepts a string type key ("movement", "attack",
"ability", "terramorpha", "selector") instead of a Color constant.
• _cursor_highlight + _hover_team_overlay: two permanently-allocated quads
that are never freed. The selector highlights the tile under the mouse at
all times; the team overlay shows a coloured tint when hovering an occupied
tile. Both are preserved across _clear_highlights() and _build_board().
• _update_hover(): called on every InputEventMouseMotion event. Moves the
selector quad, shows the team-colour overlay when hovering an occupied tile,
and boosts MeshInstance3D emission on the hovered unit via
set_surface_override_material (reset when hover leaves).
• All existing _highlight_tiles() / _add_highlight() callers updated from
HI_* Color constants to type key strings.
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>
115 lines
4.6 KiB
GDScript
115 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:
|
|
# 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
|