feat: add GUI enhancement for Leaderboard, and Timer

This commit is contained in:
2026-03-26 02:57:04 +08:00
parent c46e28a69d
commit 66f54e34ab
27 changed files with 779 additions and 224 deletions
+17 -28
View File
@@ -51,9 +51,8 @@ var red_tint_overlay: ColorRect
# Traffic Light / StopTimer Visuals
var stop_timer_node: PanelContainer
var stop_segments: Array[Panel] = []
var lit_style: StyleBoxFlat
var dim_style: StyleBoxFlat
var red_style: StyleBoxFlat
var empty_styles: Array[StyleBoxTexture] = []
var filled_styles: Array[StyleBoxTexture] = []
func _ready():
set_process(false)
@@ -155,29 +154,19 @@ func _update_stop_timer_visuals():
var hbox = stop_timer_node.get_node_or_null("HBox")
if hbox:
stop_segments.clear()
empty_styles.clear()
filled_styles.clear()
for i in range(3):
var seg = hbox.get_node_or_null("Segment%d" % i)
if seg: stop_segments.append(seg)
# Prepare styles
lit_style = StyleBoxFlat.new()
lit_style.bg_color = Color.YELLOW
lit_style.border_width_left = 2
lit_style.border_width_top = 2
lit_style.border_width_right = 2
lit_style.border_width_bottom = 2
lit_style.border_color = Color(1.0, 1.0, 1.0, 0.5)
dim_style = StyleBoxFlat.new()
dim_style.bg_color = Color(0.1, 0.1, 0.1, 0.8) # Dark dim
red_style = StyleBoxFlat.new()
red_style.bg_color = Color.RED
red_style.border_width_left = 2
red_style.border_width_top = 2
red_style.border_width_right = 2
red_style.border_width_bottom = 2
red_style.border_color = Color(1.0, 0.5, 0.5, 0.5)
var e_style = StyleBoxTexture.new()
e_style.texture = load("res://assets/graphics/gui/stop_timer/Segment%d_empty.png" % i)
empty_styles.append(e_style)
var f_style = StyleBoxTexture.new()
f_style.texture = load("res://assets/graphics/gui/stop_timer/Segment%d_filled.png" % i)
filled_styles.append(f_style)
if not stop_timer_node: return
@@ -185,17 +174,17 @@ func _update_stop_timer_visuals():
stop_timer_node.visible = true
if current_phase == Phase.GO:
# GO Phase: All dim unless in last 3 seconds (lights up 3, 2, 1s)
# GO Phase: All empty unless in last 3 seconds (lights up 3, 2, 1s)
for i in range(stop_segments.size()):
var threshold = 3.0 - (i * 1.0)
if phase_timer <= threshold:
stop_segments[i].add_theme_stylebox_override("panel", lit_style)
stop_segments[i].add_theme_stylebox_override("panel", filled_styles[i])
else:
stop_segments[i].add_theme_stylebox_override("panel", dim_style)
stop_segments[i].add_theme_stylebox_override("panel", empty_styles[i])
else:
# STOP Phase: All Red
for seg in stop_segments:
seg.add_theme_stylebox_override("panel", red_style)
for i in range(stop_segments.size()):
stop_segments[i].add_theme_stylebox_override("panel", filled_styles[i])
func activate_client_side():
is_active = true