47 lines
1.5 KiB
GDScript
47 lines
1.5 KiB
GDScript
extends Control
|
|
|
|
var alarm_label: Label
|
|
var dismiss_button: Button
|
|
|
|
func _ready() -> void:
|
|
visible = false
|
|
process_mode = Node.PROCESS_MODE_ALWAYS
|
|
mouse_filter = Control.MOUSE_FILTER_STOP
|
|
|
|
alarm_label = find_child("AlarmLabel", true, false) as Label
|
|
dismiss_button = find_child("DismissButton", true, false) as Button
|
|
|
|
if dismiss_button:
|
|
dismiss_button.pressed.connect(hide_banner)
|
|
|
|
if not GameState.scramble_begun.is_connected(_on_scramble):
|
|
GameState.scramble_begun.connect(_on_scramble)
|
|
|
|
func _on_scramble() -> void:
|
|
visible = true
|
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
|
|
|
if alarm_label == null:
|
|
alarm_label = find_child("AlarmLabel", true, false) as Label
|
|
|
|
if alarm_label:
|
|
alarm_label.modulate = Color.WHITE
|
|
alarm_label.self_modulate = Color.WHITE
|
|
alarm_label.add_theme_color_override("font_color", Color.WHITE)
|
|
alarm_label.add_theme_font_size_override("font_size", 22)
|
|
alarm_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
|
|
alarm_label.vertical_alignment = VERTICAL_ALIGNMENT_CENTER
|
|
alarm_label.autowrap_mode = TextServer.AUTOWRAP_WORD_SMART
|
|
alarm_label.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
alarm_label.text = "PRIORITY ALERT — PEOPLE'S PRIVATEER FLEET INBOUND\nUnregistered prize crews on approach. All hands to extraction. ~10 minutes."
|
|
|
|
print("SCRAMBLE: PPF inbound")
|
|
|
|
func hide_banner() -> void:
|
|
if not visible:
|
|
return
|
|
visible = false
|
|
if not get_tree().paused:
|
|
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
|
print("SCRAMBLE banner dismissed")
|