replace with multiplayer-coop files
This commit is contained in:
82
src/scripts/level_complete_ui.gd
Normal file
82
src/scripts/level_complete_ui.gd
Normal file
@@ -0,0 +1,82 @@
|
||||
extends CanvasLayer
|
||||
|
||||
# Level Complete UI - Shows stats when level is completed
|
||||
|
||||
var title_label: Label = null
|
||||
var enemies_label: Label = null
|
||||
var downed_label: Label = null
|
||||
var exp_label: Label = null
|
||||
var coins_label: Label = null
|
||||
|
||||
func _ready():
|
||||
visible = false
|
||||
# Find labels (works for both scene-based and programmatically created UI)
|
||||
var vbox = get_child(0) if get_child_count() > 0 else null
|
||||
if vbox:
|
||||
for child in vbox.get_children():
|
||||
if child is Label and child.text == "LEVEL COMPLETE!":
|
||||
title_label = child
|
||||
elif child.name == "EnemiesLabel":
|
||||
enemies_label = child
|
||||
elif child.name == "DownedLabel":
|
||||
downed_label = child
|
||||
elif child.name == "ExpLabel":
|
||||
exp_label = child
|
||||
elif child.name == "CoinsLabel":
|
||||
coins_label = child
|
||||
elif child is VBoxContainer:
|
||||
# Stats container
|
||||
for stat_child in child.get_children():
|
||||
if stat_child.name == "EnemiesLabel":
|
||||
enemies_label = stat_child
|
||||
elif stat_child.name == "DownedLabel":
|
||||
downed_label = stat_child
|
||||
elif stat_child.name == "ExpLabel":
|
||||
exp_label = stat_child
|
||||
elif stat_child.name == "CoinsLabel":
|
||||
coins_label = stat_child
|
||||
|
||||
func show_stats(enemies_defeated: int, times_downed: int, exp_collected: float, coins_collected: int):
|
||||
# Update labels
|
||||
if title_label:
|
||||
title_label.text = "LEVEL COMPLETE!"
|
||||
|
||||
if enemies_label:
|
||||
enemies_label.text = "Enemies Defeated: " + str(enemies_defeated)
|
||||
|
||||
if downed_label:
|
||||
downed_label.text = "Times Downed: " + str(times_downed)
|
||||
|
||||
if exp_label:
|
||||
exp_label.text = "EXP Collected: " + str(int(exp_collected))
|
||||
|
||||
if coins_label:
|
||||
coins_label.text = "Coins Collected: " + str(coins_collected)
|
||||
|
||||
# Show UI
|
||||
visible = true
|
||||
|
||||
# Fade in - fade the VBoxContainer and all labels
|
||||
var vbox = get_child(0) if get_child_count() > 0 else null
|
||||
if vbox:
|
||||
vbox.modulate.a = 0.0
|
||||
var fade_in = create_tween()
|
||||
fade_in.set_parallel(true)
|
||||
fade_in.tween_property(vbox, "modulate:a", 1.0, 0.5)
|
||||
|
||||
# Also fade individual labels if they exist
|
||||
if title_label:
|
||||
title_label.modulate.a = 0.0
|
||||
fade_in.tween_property(title_label, "modulate:a", 1.0, 0.5)
|
||||
if enemies_label:
|
||||
enemies_label.modulate.a = 0.0
|
||||
fade_in.tween_property(enemies_label, "modulate:a", 1.0, 0.5)
|
||||
if downed_label:
|
||||
downed_label.modulate.a = 0.0
|
||||
fade_in.tween_property(downed_label, "modulate:a", 1.0, 0.5)
|
||||
if exp_label:
|
||||
exp_label.modulate.a = 0.0
|
||||
fade_in.tween_property(exp_label, "modulate:a", 1.0, 0.5)
|
||||
if coins_label:
|
||||
coins_label.modulate.a = 0.0
|
||||
fade_in.tween_property(coins_label, "modulate:a", 1.0, 0.5)
|
||||
Reference in New Issue
Block a user