| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- import json
- import os
- from game.const import game as G
- from game.const import window as W
- from game.const import rouge as R
- from datetime import datetime
- from game.ui.menu.component import PygameButton, PygameButtonBackIMG, Particle, PygameTaskBoard
- from game.const.task import daily_task, weekly_task, monthly_task, single_task
- from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
- current_folder_path = os.getcwd()
- class TaskPage:
- def __init__(self):
- self.screen = W.MENU
- def draw(self):
- # 日常任务
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.5, 0.25, "res/ui/button/task_daily.png", "res/ui/button/task_daily_press.png", action=self.draw_daily, anchor='center')
- )
- # 周常任务
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.35, 0.4, "res/ui/button/task_weekly.png", "res/ui/button/task_weekly_press.png", action=self.draw_weekly, anchor='center')
- )
- # 月常任务
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.65, 0.4, "res/ui/button/task_monthly.png", "res/ui/button/task_monthly_press.png", action=self.draw_monthly, anchor='center')
- )
- # 常驻任务
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.5, 0.55, "res/ui/button/task_single.png", "res/ui/button/task_single_press.png", action=self.draw_single, anchor='center')
- )
- # 返回主界面
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.66, 0.72, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.refresh, anchor='center')
- )
- def draw_daily(self):
- self.draw_task_page(daily_task)
- def draw_weekly(self):
- self.draw_task_page(weekly_task)
- def draw_monthly(self):
- self.draw_task_page(monthly_task)
- def draw_single(self):
- self.draw_task_page(single_task)
- def draw_task_page(self, task_dic):
- self.screen.buttons.clear()
- board = PygameTaskBoard(
- menu=self.screen,
- screen=self.screen.screen,
- relx=0.5, rely=0.42,
- font_name="hk4e_zh-cn.ttf",
- font_size=18,
- small_scale=0.8,
- default_img_path="res/ui/button/task_board.png",
- action=None,
- anchor='center',
- tasks_dict=task_dic,
- bar_color_fg=(129, 89, 146),
- row_color=(53, 26, 2),
- row_color_disabled=(53, 26, 2),
- row_color_done=(32, 67, 42),
- padding=(26, 30, 26, 50)
- )
- self.screen.buttons.append(board)
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.12, 0.4, "res/ui/button/left.png", "res/ui/button/left_press.png", action=board.prev_page, anchor='center', shiny_spark=False)
- )
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.88, 0.4, "res/ui/button/right.png", "res/ui/button/right_press.png", action=board.next_page, anchor='center', shiny_spark=False)
- )
- self.screen.buttons.append(PygameButtonBackIMG(
- self.screen, self.screen.screen, 0.66, 0.86, "res/ui/button/return.png", "res/ui/button/return_press.png", action=self.screen.open_task, anchor='center')
- )
|