Files
mtgodot-poc/project/intro_empire_phase.gd
T
shenandshen 66d217b313 feat(client): 完成40250客户端核心功能1:1对齐与桥梁高度采样修复
- 桥梁与静态物体高度采样修复:
  - 严格对齐 40250 CMapOutdoor::GetHeight 与 CAttributeInstance::GetHeight
  - 解析 .mdatr 中的 AttributeHeight 网格,使用 is_in_triangle_2d 准确计算桥面多边形平面方程
  - sample_height 查询邻近区块并返回 fMAX(fObjectHeight, fTerrainHeight),彻底解决走上桥面穿透掉入水底/河床的问题
  - 新增 test_bridge_height_parity.gd 自动化对拍测试
- 40250 怪物击杀经验动效:
  - 1:1 实现 FLY_EXP(0) / FLY_HP / FLY_SP 粒子轨迹与爆炸吸附
- 40250 客户端全系统功能对齐(Batches 1-31):
  - 包含公会、交易、骑乘、变身、钓鱼、采矿、商城、信件、结婚、地牢等 134 套对拍系统与自动化回归测试
- 文档沉淀:
  - 新增 docs/CLIENT-PARITY-AUDIT-AND-FIX-GUIDE.md 客户端对拍缺陷发现与修复工程指南
2026-09-19 08:51:25 -07:00

100 lines
3.4 KiB
GDScript

# intro_empire_phase.gd —— 40250 三国阵营地貌 3D 运镜巡览系统 1:1
# 严格对照:
# Client/Eternexus/root/introempire.py (SelectEmpireWindow)
# ClientVS22/source/UserInterface/PythonApplicationCamera.cpp
# Client/Eternexus/root/uiscript/locale/en/empiredesc_*.txt
extends RefCounted
const EMPIRE_NONE := 0
const EMPIRE_SHINSOO := 1 # 赤蛇国 (进国 / 红色)
const EMPIRE_CHUNJO := 2 # 白虎国 (顺天 / 黄色)
const EMPIRE_JINNO := 3 # 苍龙国 (忍国 / 蓝色)
# 三国官方 3D 摄像机观察预设点位 (Position & Rotation Degrees)
const CAMERA_PRESETS := {
EMPIRE_SHINSOO: {
"cam_pos": Vector3(100.0, 50.0, -200.0),
"cam_rot": Vector3(-15.0, 45.0, 0.0),
"name": "赤蛇国 (Shinsoo)",
"capital": "Yongan",
"color": "#FF3333",
"desc": "Shinsoo 帝国雄踞大陆南部,商贸繁荣昌盛,是商旅与财富的汇聚之地。",
"trait": "商贾通达:全帝国交易税率降低 2%,行商收益提升。"
},
EMPIRE_CHUNJO: {
"cam_pos": Vector3(-150.0, 60.0, -180.0),
"cam_rot": Vector3(-12.0, 135.0, 0.0),
"name": "白虎国 (Chunjo)",
"capital": "Joan",
"color": "#FFCC00",
"desc": "Chunjo 帝国坐落大陆西部,是古老圣灵信仰的发源地,奉行神圣天道。",
"trait": "神圣庇佑:全帝国子民魔法防御力与精神抗性 +5%。"
},
EMPIRE_JINNO: {
"cam_pos": Vector3(0.0, 80.0, -250.0),
"cam_rot": Vector3(-18.0, 0.0, 0.0),
"name": "苍龙国 (Jinno)",
"capital": "Pyungmoo",
"color": "#3366FF",
"desc": "Jinno 帝国占据大陆东部,崇尚武道强权,铁血军纪森严,武士骁勇善战。",
"trait": "尚武好战:全帝国子民物理基础攻击力 +5%。"
}
}
var selected_empire: int = EMPIRE_SHINSOO
var current_cam_pos: Vector3 = Vector3.ZERO
var current_cam_rot: Vector3 = Vector3.ZERO
var target_cam_pos: Vector3 = Vector3.ZERO
var target_cam_rot: Vector3 = Vector3.ZERO
var is_transitioning: bool = false
var transition_t: float = 1.0
func _init(initial_empire: int = EMPIRE_SHINSOO) -> void:
select_empire(initial_empire)
current_cam_pos = target_cam_pos
current_cam_rot = target_cam_rot
is_transitioning = false
transition_t = 1.0
# 1. 选中帝国阵营 (1:1 SelectEmpireWindow.OnSelectEmpire)
func select_empire(empire_id: int) -> bool:
if not CAMERA_PRESETS.has(empire_id):
return false
selected_empire = empire_id
var preset: Dictionary = CAMERA_PRESETS[empire_id]
target_cam_pos = preset["cam_pos"]
target_cam_rot = preset["cam_rot"]
is_transitioning = true
transition_t = 0.0
return true
# 2. 摄像机平滑插值运镜更新 (1:1 PythonApplicationCamera::Update)
func update_camera_transition(delta_t: float) -> void:
if not is_transitioning:
return
transition_t = clamp(transition_t + delta_t, 0.0, 1.0)
current_cam_pos = current_cam_pos.lerp(target_cam_pos, transition_t)
current_cam_rot = current_cam_rot.lerp(target_cam_rot, transition_t)
if transition_t >= 1.0:
is_transitioning = false
current_cam_pos = target_cam_pos
current_cam_rot = target_cam_rot
# 3. 获取当前帝国的详情数据
func get_selected_empire_info() -> Dictionary:
return CAMERA_PRESETS.get(selected_empire, {})
# 4. 确认抉择帝国阵营并过渡到选角界面
func confirm_empire_selection() -> Dictionary:
var info := get_selected_empire_info()
return {
"success": true,
"empire_id": selected_empire,
"empire_name": info.get("name", ""),
"capital": info.get("capital", ""),
"next_phase": "CHARACTER_SELECT"
}