Skip to content

Commit

Permalink
微调召唤师头像经验条组件
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzaphkiel committed Jul 27, 2024
1 parent 4c167dd commit efa4687
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 10 additions & 7 deletions app/components/profile_level_icon_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(self, parent=None, useAni=True, text="", fontSize=10):
self.text = text
self.fontSize = fontSize
self.drawVal = 0
self.ringGap = 30
super().__init__(parent, useAni=useAni)

def paintEvent(self, e):
Expand All @@ -35,21 +36,23 @@ def paintEvent(self, e):
bc = self.darkBackgroundColor if isDarkTheme() else self.lightBackgroundColor
pen = QPen(bc, cw, cap=Qt.RoundCap, join=Qt.RoundJoin)
painter.setPen(pen)
painter.drawArc(rc, 315 * 16, 270 * 16)
painter.drawArc(rc, (self.ringGap-90)*16, (360-2*self.ringGap)*16)

if self.maximum() <= self.minimum():
return

# draw bar
pen.setColor(themeColor())
painter.setPen(pen)
degree = int(self.drawVal / (self.maximum() - self.minimum()) * 270)
painter.drawArc(rc, -135 * 16, -degree * 16)
degree = int(self.drawVal / (self.maximum() -
self.minimum()) * (360 - 2*self.ringGap))
painter.drawArc(rc, -(self.ringGap + 90) * 16, -degree * 16)

painter.setFont(QFont('Microsoft YaHei', self.fontSize, QFont.Bold))
text_rect = QRectF(0, self.height() * 0.85,
self.width(), self.height() * 0.15)
text_rect = QRectF(0, self.height() * 0.88,
self.width(), self.height() * 0.12)

painter.drawText(text_rect, Qt.AlignCenter, f"Lv.{self.text}")
painter.drawText(text_rect, Qt.AlignCenter, f"{self.text}")


class RoundLevelAvatar(QWidget):
Expand All @@ -73,7 +76,7 @@ def __init__(self,
self.xpSinceLastLevel = xpSinceLastLevel
self.xpUntilNextLevel = xpUntilNextLevel
self.progressRing = ProgressArc(
self, text=text, fontSize=int(.1 * diameter))
self, text=text, fontSize=int(.09 * diameter))
self.progressRing.setTextVisible(False)
self.progressRing.setFixedSize(self.diameter, self.diameter)

Expand Down
2 changes: 2 additions & 0 deletions app/view/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,8 @@ async def __onChampionSelectBegin(self):
# 英雄选择时,英雄改变 / 楼层改变时触发
@asyncSlot(dict)
async def __onChampSelectChanged(self, data):
data = data['data']

phase = {
'PLANNING': [autoPick],
'BAN_PICK': [autoBan, autoPick, autoComplete, autoSwap, showOpggBuild],
Expand Down

0 comments on commit efa4687

Please sign in to comment.