Refactor NumStatus enum values in main.py

This commit is contained in:
shenjack 2024-04-06 18:01:47 +08:00
parent 96fb0526f2
commit b9275ae298
Signed by: shenjack
GPG Key ID: 7B1134A979775551

View File

@ -17,24 +17,24 @@ gray = (200, 200, 200)
class NumStatus(IntEnum): class NumStatus(IntEnum):
"""未被选中""" """未被选中"""
wait = 0 wait = 8
# 血量 # 血量
hp = 1 hp = 0
# 攻击 # 攻击
attack = 2 attack = 1
# 防御 # 防御
defense = 3 defense = 2
# 速度 # 速度
speed = 4 speed = 3
# 敏捷 # 敏捷
agility = 5 agility = 4
# 魔法 # 魔法
magic = 6 magic = 5
# 抗性 # 抗性
resistance = 7 resistance = 6
# 智慧 # 智慧
wisdom = 8 wisdom = 7
class NumWidget: class NumWidget:
@ -155,12 +155,11 @@ class MainWindow(Window):
self.update_num_display() self.update_num_display()
def update_num_display(self) -> None: def update_num_display(self) -> None:
for status, widgets in self.display_dict.items(): for status, widgets in self.display_dict.items():
num_count = 0 num_count = 0
for widget in widgets: for widget in widgets:
print(f"status: {status}, num_count: {num_count} {status.value=}") # print(f"status: {status}, num_count: {num_count} {status.value=}")
widget.x = 40 + (40 * status.value) widget.x = 40 + (65 * status.value)
widget.y = self.height - (170 + 30 * num_count) widget.y = self.height - (170 + 30 * num_count)
num_count += 1 num_count += 1