增加末日和虚构的分数现实 (#43)

This commit is contained in:
RBAmeto 2024-10-11 12:59:56 +08:00 committed by GitHub
parent 730e098ad0
commit 0eeb17c5cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 55 additions and 2 deletions

View File

@ -256,6 +256,7 @@ class AbyssAvatar(Struct):
class AbyssNodeDetail(Struct):
challenge_time: Union[AbyssTime, None]
avatars: List[AbyssAvatar]
score: Optional[str] = None
class AbyssFloorDetail(Struct):

View File

@ -92,6 +92,7 @@ async def _draw_floor_card(
img: Image.Image,
index_floor: int,
floor_name: str,
sum_score: Union[int, None],
):
for index_num in [0, 1, 2]:
star_num = index_num + 1
@ -108,6 +109,15 @@ async def _draw_floor_card(
fill=white_color,
anchor="mm",
)
#总分todo
if sum_score:
floor_pic_draw.text(
(800, 60),
f"{sum_score}",
font=sr_font_42,
fill="#fec86f",
anchor="rm",
)
img.paste(floor_pic, (0, 657 + index_floor * 570), floor_pic)
@ -192,12 +202,18 @@ async def draw_abyss_img(
floor_name = level.name
node_1 = level.node_1
node_2 = level.node_2
if node_1.score and node_2.score:
sum_score = int(node_1.score) + int(node_2.score)
else:
sum_score = None
for index_part in [0, 1]:
node_num = index_part + 1
if node_num == 1:
time_array = node_1.challenge_time
score = node_1.score
else:
time_array = node_2.challenge_time
score = node_2.score
assert time_array is not None
time_str = f"{time_array.year}-{time_array.month}"
time_str = f"{time_str}-{time_array.day}"
@ -217,6 +233,15 @@ async def draw_abyss_img(
sr_font_22,
"lm",
)
# 分数todo
if score :
floor_pic_draw.text(
(800, 120 + index_part * 219),
f"{score}",
"#fec86f",
sr_font_30,
"rm",
)
if node_num == 1:
avatars_array = node_1
else:
@ -235,6 +260,7 @@ async def draw_abyss_img(
img,
index_floor,
floor_name,
sum_score,
)
res = await convert_img(img)

View File

@ -100,6 +100,7 @@ async def _draw_floor_card(
index_floor: int,
floor_name: str,
round_num: Union[int, None],
sum_score: Union[int, None],
):
for index_num in [0, 1, 2]:
star_num = index_num + 1
@ -116,10 +117,19 @@ async def _draw_floor_card(
fill=white_color,
anchor="mm",
)
#总分todo
if sum_score:
floor_pic_draw.text(
(802, 60),
(800, 40),
f"{sum_score}",
font=sr_font_22,
fill="#fec86f",
anchor="rm",
)
floor_pic_draw.text(
(800, 70),
f"使用轮: {round_num}",
font=sr_font_28,
font=sr_font_22,
fill=gray_color,
anchor="rm",
)
@ -208,12 +218,18 @@ async def draw_abyss_img(
round_num = level.round_num
node_1 = level.node_1
node_2 = level.node_2
if node_1.score and node_2.score:
sum_score = int(node_1.score) + int(node_2.score)
else:
sum_score = None
for index_part in [0, 1]:
node_num = index_part + 1
if node_num == 1:
time_array = node_1.challenge_time
score = node_1.score
else:
time_array = node_2.challenge_time
score = node_2.score
assert time_array is not None
time_str = f"{time_array.year}-{time_array.month}"
time_str = f"{time_str}-{time_array.day}"
@ -233,6 +249,15 @@ async def draw_abyss_img(
sr_font_22,
"lm",
)
# 分数todo
if score :
floor_pic_draw.text(
(800, 120 + index_part * 219),
f"{score}",
"#fec86f",
sr_font_30,
"rm",
)
if node_num == 1:
avatars_array = node_1
else:
@ -253,6 +278,7 @@ async def draw_abyss_img(
index_floor,
floor_name,
round_num,
sum_score,
)
res = await convert_img(img)