feat(mobile): optimize touch skill layout and add auto-hunt HUD and combat entries

This commit is contained in:
shen
2026-10-18 18:23:28 -07:00
parent 82251cb524
commit 0558166243
5 changed files with 111 additions and 52 deletions
+25 -2
View File
@@ -32,6 +32,7 @@ class RoundAction(ui.Window):
self.SetParent(parent)
self.action = action
self.down = False
self.active = False
self.label = _Text(self, text)
self.label.SetHorizontalAlignCenter()
self.label.SetVerticalAlignCenter()
@@ -57,13 +58,19 @@ class RoundAction(ui.Window):
def OnRender(self):
x, y = self.GetGlobalPosition()
r = self.GetWidth()/2.0
grp.SetColor(0xE0664B2D if self.down else 0xBB281A16)
if getattr(self, "active", False):
grp.SetColor(0xEE207028 if self.down else 0xCC185820)
else:
grp.SetColor(0xE0664B2D if self.down else 0xBB281A16)
# Horizontal strips fill a round button without requiring extra image assets.
for row in xrange(0, self.GetHeight(), 3):
dy = min(r, row + 1.5 - r)
half = math.sqrt(max(0, r*r - dy*dy))
grp.RenderBar(x+r-half, y+row, half*2, min(3, self.GetHeight()-row))
grp.SetColor(0xFFE6CB8D if self.down else 0xCCB99A66)
if getattr(self, "active", False):
grp.SetColor(0xFFB0FFB0 if self.down else 0xFF80FF90)
else:
grp.SetColor(0xFFE6CB8D if self.down else 0xCCB99A66)
for i in xrange(32):
a = i * math.pi / 16
b = (i+1) * math.pi / 16
@@ -196,7 +203,15 @@ class HUD(ui.Window):
("", 2, interface.ToggleMessenger),
("", 3, interface.ToggleSystemDialog)):
self.top.append(RoundAction(self, text, action, self.taskbar.toggleButtonDict[index].GetUpVisualFileName()))
def _OnAutoHuntAction():
try:
import mt_autohunt
mt_autohunt.OpenSettings()
except Exception:
pass
self.btnAutoHunt = RoundAction(self, "挂机", _OnAutoHuntAction)
self.side = [RoundAction(self, "任务", lambda: interface.ToggleCharacterWindow("QUEST")),
self.btnAutoHunt,
RoundAction(self, "帮助", interface.OpenHelpWindow),
RoundAction(self, "聊天", interface.ToggleChat)]
self.dimensions = None
@@ -243,6 +258,14 @@ class HUD(ui.Window):
# Match TaskBar.SetExperience's unsigned 32-bit experience counters.
exp, total = (value & 0xffffffff for value in self.status.values[4:6])
self.experienceText.SetText((L("经验 %.2f%%") % (100.0*exp/total)) if total > 0 else L("经验 --"))
if hasattr(self, "btnAutoHunt") and self.btnAutoHunt:
try:
is_on = bool(player.AutoHuntIsEnabled())
except Exception:
is_on = False
self.btnAutoHunt.active = is_on
self.btnAutoHunt.label.SetText(L("挂机中") if is_on else L("挂机"))
self.btnAutoHunt.label.SetPackedFontColor(0xFFB0FFB0 if is_on else 0xFFFFFFFF)
def Destroy(self):
self.Hide()