完善客户端功能并同步差距文档
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
# CursorManager —— 对齐 ClientVS22 mousemodule.py 的光标状态机。
|
||||
#
|
||||
# 光标和“鼠标跟随物品”是两层:本节点只管理当前交互语义,
|
||||
# MouseController 负责跟随鼠标的物品图标。没有对应 .sub 资源时使用 Godot
|
||||
# 系统光标,避免把资源缺失误报成输入状态缺失。
|
||||
extends Node
|
||||
|
||||
signal changed(shape: String)
|
||||
|
||||
const NORMAL := "NORMAL"
|
||||
const ATTACK := "ATTACK"
|
||||
const TALK := "TALK"
|
||||
const CANT_GO := "CANT_GO"
|
||||
const PICK := "PICK"
|
||||
const BUY := "BUY"
|
||||
const SELL := "SELL"
|
||||
const ITEM := "ITEM"
|
||||
|
||||
var _shape := NORMAL
|
||||
|
||||
func set_cursor(shape: String) -> void:
|
||||
if shape not in [NORMAL, ATTACK, TALK, CANT_GO, PICK, BUY, SELL, ITEM]:
|
||||
shape = NORMAL
|
||||
_shape = shape
|
||||
Input.set_default_cursor_shape(_godot_shape(shape))
|
||||
changed.emit(shape)
|
||||
|
||||
func get_cursor() -> String:
|
||||
return _shape
|
||||
|
||||
func reset() -> void:
|
||||
set_cursor(NORMAL)
|
||||
|
||||
func _godot_shape(shape: String) -> Input.CursorShape:
|
||||
match shape:
|
||||
ATTACK:
|
||||
return Input.CURSOR_CROSS
|
||||
TALK, BUY, SELL, PICK:
|
||||
return Input.CURSOR_POINTING_HAND
|
||||
CANT_GO:
|
||||
return Input.CURSOR_FORBIDDEN
|
||||
ITEM:
|
||||
return Input.CURSOR_DRAG
|
||||
_:
|
||||
return Input.CURSOR_ARROW
|
||||
Reference in New Issue
Block a user