Correct selection orientation, game-entry lifecycle, mounted NPCs, labels and skill panels. Add the native GPU scene path, resident geometry, bounded texture and Python caches, and collision broad phase. Pin the independently maintained Metin2 SDK through a submodule and document reproducible setup. Include rendering regressions and macOS packaging improvements. Validation: client Debug build and 12 targeted client tests passed; SDK build and all 14 SDK tests passed.
91 lines
3.1 KiB
Python
91 lines
3.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
import ui
|
|
import grp
|
|
import math
|
|
import player
|
|
import app
|
|
import wndMgr
|
|
|
|
class MobileCombatWheel(ui.Window):
|
|
"""
|
|
移动端核心战斗轮盘 (Combat Radial Controller)
|
|
- 位于屏幕右下角
|
|
- 超大普攻按钮 (长按/轻点)
|
|
- 环绕式扇形技能槽位 (带 CD 倒计时遮罩与等阶显示)
|
|
- 辅助功能按键 (自动锁定、上下马等)
|
|
"""
|
|
def __init__(self, origin_x=None, origin_y=None):
|
|
ui.Window.__init__(self)
|
|
self.SetWindowName("MobileCombatWheel")
|
|
|
|
sw = wndMgr.GetScreenWidth()
|
|
sh = wndMgr.GetScreenHeight()
|
|
if origin_x is None:
|
|
origin_x = sw - 120
|
|
if origin_y is None:
|
|
origin_y = sh - 120
|
|
|
|
self.origin_x = origin_x
|
|
self.origin_y = origin_y
|
|
|
|
self.SetPosition(origin_x - 260, origin_y - 260)
|
|
self.SetSize(380, 380)
|
|
|
|
# 1. 普通攻击主键 (超大圆形热区)
|
|
self.attack_btn = ui.Button()
|
|
self.attack_btn.SetParent(self)
|
|
self.attack_btn.SetPosition(260 - 55, 260 - 55)
|
|
self.attack_btn.SetUpVisual("d:/ymir work/ui/game/taskbar/attack_button_01.sub")
|
|
self.attack_btn.SetOverVisual("d:/ymir work/ui/game/taskbar/attack_button_02.sub")
|
|
self.attack_btn.SetDownVisual("d:/ymir work/ui/game/taskbar/attack_button_03.sub")
|
|
self.attack_btn.SetEvent(ui.__mem_func__(self.__OnAttackClick))
|
|
self.attack_btn.Show()
|
|
|
|
# 2. 扇形技能槽位群
|
|
self.skills = []
|
|
angles = [180, 150, 120, 90] # 左上四个扇区
|
|
radius = 150
|
|
for i, ang in enumerate(angles):
|
|
rad = math.radians(ang)
|
|
sx = int(260 + radius * math.cos(rad) - 30)
|
|
sy = int(260 - radius * math.sin(rad) - 30)
|
|
|
|
slot = ui.Button()
|
|
slot.SetParent(self)
|
|
slot.SetPosition(sx, sy)
|
|
slot.SetUpVisual("d:/ymir work/ui/game/taskbar/quickslot_01.sub")
|
|
slot.SetOverVisual("d:/ymir work/ui/game/taskbar/quickslot_02.sub")
|
|
slot.SetDownVisual("d:/ymir work/ui/game/taskbar/quickslot_03.sub")
|
|
slot.SetEvent(lambda s=i: self.__OnSkillCast(s))
|
|
slot.Show()
|
|
|
|
# CD 遮罩
|
|
cd_text = ui.TextLine()
|
|
cd_text.SetParent(slot)
|
|
cd_text.SetPosition(15, 20)
|
|
cd_text.SetText("")
|
|
cd_text.Show()
|
|
|
|
self.skills.append({'btn': slot, 'cd_text': cd_text, 'slot': i})
|
|
|
|
def __del__(self):
|
|
ui.Window.__del__(self)
|
|
|
|
def __OnAttackClick(self):
|
|
player.SetAttackKeyState(True)
|
|
app.RegisterDelayedCall(0.15, lambda: player.SetAttackKeyState(False))
|
|
|
|
def __OnSkillCast(self, index):
|
|
# 释放技能 (对应 Metin2 技能槽 1~4)
|
|
player.ClickSkillSlot(index + 1)
|
|
|
|
def OnUpdate(self):
|
|
# 刷新技能冷却状态
|
|
for item in self.skills:
|
|
slot_idx = item['slot'] + 1
|
|
if player.IsSkillCoolTime(slot_idx):
|
|
remaining = player.GetSkillCoolTime(slot_idx)
|
|
item['cd_text'].SetText("%.1f" % remaining)
|
|
else:
|
|
item['cd_text'].SetText("")
|