Align AVA2 Windows behavior and improve mobile touch interactions
This commit is contained in:
@@ -22,7 +22,7 @@ class MobileCombatWheel(ui.Window):
|
||||
"""
|
||||
ATTACK_RADIUS = 60
|
||||
SLOT_DIAMETER = 50
|
||||
SMALL_DIAMETER = 40
|
||||
SMALL_DIAMETER = 44
|
||||
AUTO_DIAMETER = 46
|
||||
# (半径, 角度):角度从 +x 逆时针,内外圈各 4 格,外圈错开半格;相邻格间距大于格子直径
|
||||
SLOT_LAYOUT = [(108, 90), (108, 120), (108, 150), (108, 180),
|
||||
@@ -66,6 +66,8 @@ class MobileCombatWheel(ui.Window):
|
||||
self.attack_icon.Show()
|
||||
except:
|
||||
pass
|
||||
self.aim_marker = widgets.MakeDisc(self, 0, 0, 44, widgets.STYLE_JOY_KNOB)
|
||||
self.aim_marker.Hide()
|
||||
self.attack_pressed = False
|
||||
touch.SetAttackButton(origin_x, origin_y, r)
|
||||
|
||||
@@ -138,6 +140,13 @@ class MobileCombatWheel(ui.Window):
|
||||
slot.Refresh()
|
||||
|
||||
def OnUpdate(self):
|
||||
active, ox, oy, x, y = touch.GetSkillAim()
|
||||
if active and math.hypot(x - ox, y - oy) > 14:
|
||||
px, py = self.GetGlobalPosition()
|
||||
self.aim_marker.SetPosition(int(x - px - 22), int(y - py - 22))
|
||||
self.aim_marker.Show()
|
||||
else:
|
||||
self.aim_marker.Hide()
|
||||
pressed = touch.IsAttackPressed()
|
||||
if pressed != self.attack_pressed:
|
||||
self.attack_pressed = pressed
|
||||
|
||||
Reference in New Issue
Block a user