From 6ea040727501f374e478c4c352570a12821cb6a2 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Sat, 6 Apr 2024 19:58:48 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=8A=EF=BC=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- maker-py/main.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/maker-py/main.py b/maker-py/main.py index adbe3f3..741e62c 100644 --- a/maker-py/main.py +++ b/maker-py/main.py @@ -42,6 +42,7 @@ class NumWidget: def __init__(self, num: int, batch: Batch, group: Group, x: int, y: int) -> None: self._y = y self._x = x + self._display = True font = load_font("黑体", 15) font_height = font.ascent - font.descent self.label_group = Group(parent=group, order=20) @@ -73,6 +74,16 @@ class NumWidget: def value(self) -> int: return int(self.label.text) + @property + def display(self) -> bool: + return self._display + + @display.setter + def display(self, value: bool) -> None: + self._display = value + self.label_group.visible = value + self.background_group.visible = value + @property def x(self) -> int: return self._x @@ -234,11 +245,18 @@ class MainWindow(Window): widget.x = 40 + (65 * status.value) widget.y = self.height - (170 + 30 * num_count) num_count += 1 + # wait 的单独处理, 因为有滚动条 num_count = 0 for widget in self.display_dict[NumStatus.wait]: widget.x = 40 + (65 * NumStatus.wait.value) widget.y = self.height - (170 + 30 * num_count) + self.num_slide + # 如果太高了, 就不显示了 + if widget.y > self.height - 200: + # 给我不显示啊啊啊啊啊啊 + widget.display = False + else: + widget.display = True num_count += 1 # 计算数据 hp = sum(widget.value for widget in self.display_dict[NumStatus.hp][3:6]) + 154