增加末日和虚构的分数现实 (#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): class AbyssNodeDetail(Struct):
challenge_time: Union[AbyssTime, None] challenge_time: Union[AbyssTime, None]
avatars: List[AbyssAvatar] avatars: List[AbyssAvatar]
score: Optional[str] = None
class AbyssFloorDetail(Struct): class AbyssFloorDetail(Struct):

View File

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

View File

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