mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-25 23:17:34 -04:00
add license, move folders
This commit is contained in:
parent
185cc74060
commit
271c4a46a1
132 changed files with 21 additions and 0 deletions
42
app/scripts/ui/world/world_ui.gd
Normal file
42
app/scripts/ui/world/world_ui.gd
Normal file
|
@ -0,0 +1,42 @@
|
|||
extends Control
|
||||
|
||||
@export var ui_events: UiEvents
|
||||
@export var gate_events: GateEvents
|
||||
@export var command_events: CommandEvents
|
||||
|
||||
var mouse_mode: int = Input.MOUSE_MODE_VISIBLE
|
||||
var _visible: bool = true
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
command_events.set_mouse_mode.connect(set_mouse_mode)
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
|
||||
|
||||
func set_mouse_mode(mode: int) -> void:
|
||||
mouse_mode = mode
|
||||
if not _visible: Input.set_mouse_mode(mode)
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("show_ui") and not event.is_echo():
|
||||
if _visible:
|
||||
hide_ui()
|
||||
else:
|
||||
show_ui()
|
||||
|
||||
|
||||
func show_ui() -> void:
|
||||
if _visible: return
|
||||
_visible = true
|
||||
|
||||
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
|
||||
ui_events.ui_mode_changed_emit(UiEvents.UiMode.INITIAL)
|
||||
|
||||
|
||||
func hide_ui() -> void:
|
||||
if not _visible: return
|
||||
_visible = false
|
||||
|
||||
Input.set_mouse_mode(mouse_mode)
|
||||
ui_events.ui_mode_changed_emit(UiEvents.UiMode.FULL_SCREEN)
|
Loading…
Add table
Add a link
Reference in a new issue