Files
toads/modules/Book.py
T
Dmitrium12 a877b80606 починил все баги
начал доставать всё из базы
сделал новую игру
2023-01-26 17:01:39 +07:00

43 lines
2.0 KiB
Python

import pygame as pg
from modules import DB
class Book: # Окно с необходимой информацией
@staticmethod
def info(screen, event):
db = DB.UseDB("game")
response = db.find_document({})[0]
pg.draw.rect(screen, (38, 33, 55), (85, 0, 520, 500))
pg.draw.rect(screen, (255, 255, 255), (100, 90, 495, 280), 1)
texts = [f'День {response["day"]}', 'Сегодня произошло следующее:',
f"{event['name']}", f"{event['description']}"]
sizes = [60, 30, 30, 30]
coords = [(260, 30), (110, 100), (110, 150), (110, 190)]
for i in range(len(texts)):
font = pg.font.Font(None, sizes[i])
text = font.render(texts[i], True, (255, 255, 255))
screen.blit(text, coords[i])
frogs = []
for i in response["frogs"]:
frogs.append((i["name"], [i["hp"], i["hunger"]]))
font = pg.font.Font(None, 15) # Здесь будет указана информация о некоторых лягушках
for col in range(1):
for row in range(1):
pg.draw.rect(screen, (255, 255, 255), (100 + 120 * col, 375 + 40 * row, 35, 35),
1) # Рамка с портретом лягушки
if col == 0:
i = row
elif col == 1:
i = row + 3
elif col == 2:
i = row + 6
else:
i = row + 9
text = font.render(f'{frogs[i][0]} - ', True, (255, 255, 255))
screen.blit(text, (140 + 120 * col, 375 + 40 * row))
text = font.render(f'{frogs[i][-1][0]}% зд.,', True, (255, 255, 255))
screen.blit(text, (140 + 120 * col, 385 + 40 * row))
text = font.render(f'{frogs[i][-1][1]}% голода', True, (255, 255, 255))
screen.blit(text, (140 + 120 * col, 395 + 40 * row))