Implement playable Mac client and rendering validation

This commit is contained in:
shen
2026-09-11 14:58:22 +08:00
parent 1ab68bd06e
commit 374d4165d8
233 changed files with 6546 additions and 284 deletions
+12 -2
View File
@@ -25,6 +25,7 @@ const JOB_DIR := {
}
signal skill_activated(skill_id: int) # game_scene 接它播技能特效
signal skill_cast_started(skill_id: int, target_vid: int) # resolved target, not later selection
# §3.8 修改 1:三层校验挡下(code = OnCannotUseSkill 字符串码),game_scene 弹文案
signal skill_rejected(skill_id: int, code: String)
@@ -44,6 +45,7 @@ var item_mouse: Node
var _assets_root := ""
var _slots := [] # 当前页 UI[{btn, cd, lbl, icon, grade}]
var _state := [] # 36 个服务端槽:[{kind, id, cd_end:float}]
var _skill_cooldowns := {} # skill identity survives slot moves/restores within this UI session
var _page := 0
var _move_from := -1
var _mobile_mode := false
@@ -93,7 +95,9 @@ func restore_from_server() -> void:
continue
match int(qs.get("type", 0)):
1: restored[pos] = {"kind": "item", "id": int(qs.get("ref", 0)), "cd_end": 0.0}
2: restored[pos] = {"kind": "skill", "id": int(qs.get("ref", 0)), "cd_end": 0.0}
2:
var skill_id := int(qs.get("ref", 0))
restored[pos] = {"kind": "skill", "id": skill_id, "cd_end": float(_skill_cooldowns.get(skill_id, 0.0))}
3: restored[pos] = {"kind": "emote", "id": int(qs.get("ref", 0)), "cd_end": 0.0}
_state = restored
_refresh_page()
@@ -108,7 +112,7 @@ func assign(slot: int, kind: String, id: int, persist := true) -> bool:
var type := 2 if kind == "skill" else 1 if kind == "item" else 3 if kind == "emote" else 0
if type == 0 or not client.quickslot_add(global, type, id):
return false
_state[global] = {"kind": kind, "id": id, "cd_end": 0.0}
_state[global] = {"kind": kind, "id": id, "cd_end": float(_skill_cooldowns.get(id, 0.0)) if kind == "skill" else 0.0}
_refresh_slot(slot)
return true
@@ -207,8 +211,13 @@ func _activate_slot(slot: int, screen_direction: Vector2) -> void:
if client.has_method("use_skill"):
intent_sent = client.use_skill(int(s.id), target_vid)
if intent_sent and client.cast_skill(mi, yaw, int(xy.x), int(xy.y)):
skill_cast_started.emit(int(s.id), target_vid)
s.cd_end = _now() + _skill_cooldown(int(s.id))
_state[global] = s
_skill_cooldowns[int(s.id)] = s.cd_end
for peer in _state:
if peer.kind == "skill" and peer.id == s.id:
peer.cd_end = s.cd_end
# §3.4:扇形 / 圆形技能的附加 fly-targeting(主目标已在 use_skill 里发过;
# PythonPlayerSkill.cpp:684 的 `if (dwTargetMaxCount>0 …)` 补目标块)。
if target_vid != 0 and net_play and table \
@@ -550,6 +559,7 @@ func _refresh_page() -> void:
_refresh_slot(slot)
func _on_cd_end(skill_id: int) -> void:
_skill_cooldowns.erase(skill_id)
for i in _state.size():
var s: Dictionary = _state[i]
if s.kind == "skill" and s.id == skill_id: