Add server-authoritative RZ Coin rewards

This commit is contained in:
hz
2026-08-01 01:28:38 -05:00
parent 8c439c6294
commit ddc36a8048
24 changed files with 670 additions and 104 deletions
+26
View File
@@ -38,12 +38,38 @@ func _ready() -> void:
theme_service = get_node("/root/UIThemeService")
Style.apply_app_theme(self)
_build_ui()
CreditsService.award_received.connect(_show_coin_award)
theme_service.theme_changed.connect(_on_theme_changed)
resized.connect(_update_responsive_layout)
_update_responsive_layout()
show_screen(("legal_consent" if AuthState.requires_legal_acceptance else "dashboard") if AuthState.is_logged_in else "login")
func _show_coin_award(amount: int, reason: String) -> void:
var toast := PanelContainer.new()
toast.z_index = 200
toast.mouse_filter = Control.MOUSE_FILTER_IGNORE
toast.set_anchors_preset(Control.PRESET_TOP_RIGHT)
toast.position = Vector2(-360, 76)
toast.custom_minimum_size = Vector2(340, 52)
toast.add_theme_stylebox_override("panel", Brand.content_card_box(UIThemeService.is_dark_mode(), true, Brand.AMBER))
var label := Label.new()
label.text = "+%d RZ Coins · %s" % [amount, reason]
label.add_theme_font_override("font", Brand.font)
label.add_theme_font_size_override("font_size", 14)
label.add_theme_color_override("font_color", Brand.text_color(UIThemeService.is_dark_mode()))
label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
toast.add_child(label)
add_child(toast)
toast.modulate.a = 0.0
var tween := create_tween()
tween.tween_property(toast, "modulate:a", 1.0, 0.18)
tween.tween_interval(2.8)
tween.tween_property(toast, "modulate:a", 0.0, 0.25)
tween.tween_callback(toast.queue_free)
func _update_responsive_layout() -> void:
compact_shell = size.x < 900.0
if sidebar != null: