mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-25 05:17:25 -04:00
gate not responding popup
This commit is contained in:
parent
4fc2d7aeb9
commit
08708f2b59
14 changed files with 205 additions and 13 deletions
47
app/scripts/ui/world/not_responding.gd
Normal file
47
app/scripts/ui/world/not_responding.gd
Normal file
|
@ -0,0 +1,47 @@
|
|||
extends Control
|
||||
|
||||
const SHOWN = Color(1, 1, 1, 1)
|
||||
const HIDDEN = Color(1, 1, 1, 0)
|
||||
|
||||
@export var gate_events: GateEvents
|
||||
@export var root: TextureButton
|
||||
@export var fade_in: float = 1.0
|
||||
@export var fade_out: float = 0.2
|
||||
|
||||
var tween: Tween
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
gate_events.not_responding.connect(show_message)
|
||||
root.pressed.connect(hide_message)
|
||||
|
||||
visible = true
|
||||
root.hide()
|
||||
root.modulate = HIDDEN
|
||||
root.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
|
||||
|
||||
func show_message() -> void:
|
||||
if root.visible: return
|
||||
|
||||
root.show()
|
||||
|
||||
if is_instance_valid(tween): tween.stop()
|
||||
tween = get_tree().create_tween()
|
||||
tween.tween_property(root, "modulate", SHOWN, fade_in)
|
||||
await tween.finished
|
||||
|
||||
root.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
|
||||
|
||||
func hide_message() -> void:
|
||||
if not root.visible: return
|
||||
|
||||
root.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
|
||||
if is_instance_valid(tween): tween.stop()
|
||||
tween = get_tree().create_tween()
|
||||
tween.tween_property(root, "modulate", HIDDEN, fade_out)
|
||||
await tween.finished
|
||||
|
||||
root.hide()
|
|
@ -11,6 +11,7 @@ var _visible: bool = true
|
|||
|
||||
func _ready() -> void:
|
||||
command_events.set_mouse_mode.connect(set_mouse_mode)
|
||||
gate_events.not_responding.connect(func(): set_mouse_mode(Input.MOUSE_MODE_VISIBLE))
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue