完善客户端功能并同步差距文档
This commit is contained in:
@@ -35,6 +35,7 @@ func _ready() -> void:
|
||||
_dim.set_anchors_preset(Control.PRESET_FULL_RECT)
|
||||
_dim.visible = false
|
||||
_root.add_child(_dim)
|
||||
set_process_input(true)
|
||||
set_process_unhandled_input(true)
|
||||
|
||||
# --- open / close --------------------------------------------------------
|
||||
@@ -85,6 +86,32 @@ func close_top() -> bool:
|
||||
func top() -> Control:
|
||||
return _stack[-1] if not _stack.is_empty() else null
|
||||
|
||||
# wndMgr 的输入边界:打开的窗口先拿到键盘 / 鼠标语义,世界控制不能从窗口
|
||||
# 下方穿透。非模态窗口保留原版常用的开关键,便于 I/K/V/N 等键关闭当前窗;
|
||||
# 模态确认框只允许 ESC 回到窗口栈。
|
||||
func blocks_game_input(event: InputEvent) -> bool:
|
||||
if _stack.is_empty():
|
||||
return false
|
||||
var top_window: Control = _stack[-1]
|
||||
if top_window == null or not is_instance_valid(top_window) or not top_window.visible:
|
||||
return false
|
||||
if bool(top_window.get_meta("modal", false)):
|
||||
return not (event is InputEventKey and event.keycode == KEY_ESCAPE)
|
||||
if event is InputEventMouse:
|
||||
return top_window.get_global_rect().has_point(event.position)
|
||||
if event is InputEventKey:
|
||||
if event.keycode == KEY_ESCAPE:
|
||||
return false
|
||||
return event.keycode not in [KEY_I, KEY_K, KEY_V, KEY_N, KEY_B, KEY_L, KEY_M, KEY_O]
|
||||
return false
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
# Keyboard events do not automatically enter Control.gui_input. Consume
|
||||
# blocked keys here, before PlayerController/GameCamera receive them through
|
||||
# _unhandled_input; mouse events remain available to child controls.
|
||||
if event is InputEventKey and blocks_game_input(event):
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
func _restack() -> void:
|
||||
var any_modal := false
|
||||
for i in _stack.size():
|
||||
|
||||
Reference in New Issue
Block a user