|
@@ -0,0 +1,126 @@
|
|
|
|
|
+from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
|
|
|
|
|
+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
|
|
|
|
|
+
|
|
|
|
|
+current_folder_path = os.getcwd()
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+class TaskPage:
|
|
|
|
|
+ def __init__(self):
|
|
|
|
|
+ self.screen = W.MENU
|
|
|
|
|
+ self.now = datetime.now()
|
|
|
|
|
+ self.year = "1970"
|
|
|
|
|
+ self.month = "1"
|
|
|
|
|
+ self.day = "1"
|
|
|
|
|
+ user_documents_folder = os.path.expanduser("~\\Documents") # 获取用户的"文档"文件夹路径
|
|
|
|
|
+ qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE") # 构建QQTPVE文件夹路径
|
|
|
|
|
+ os.makedirs(qqtpve_folder, exist_ok=True) # 确保QQTPVE文件夹存在,如果不存在则创建
|
|
|
|
|
+ self.rouge_task_file_path = os.path.join(qqtpve_folder, "rougeOB_task.rougedata") # 构建任务文件路径
|
|
|
|
|
+ self.rougeOB_task_data = {}
|
|
|
|
|
+ self.init_task()
|
|
|
|
|
+
|
|
|
|
|
+ def init_task(self):
|
|
|
|
|
+ # 第一次打开
|
|
|
|
|
+ if not os.path.exists(self.rouge_task_file_path):
|
|
|
|
|
+ self.rougeOB_task_data = {
|
|
|
|
|
+ "1": {"task": "击杀5只命运维系者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "2": {"task": "击杀3只渊烬龙王", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "3": {"task": "到达3-1十次", "reward": "800经验", "process": 0, "finish": 10, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "4": {"task": "击杀5只因果阅律者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "5": {"task": "完成20次挑衅敌人", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "6": {"task": "使用小倩到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "7": {"task": "使用波波丽到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "8": {"task": "使用火影到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "9": {"task": "使用阿莎到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "10": {"task": "使用玛莉亚到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "11": {"task": "到达4-1一次", "reward": "800经验", "process": 0, "finish": 1, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "12": {"task": "累积使用20次复活卡", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
|
|
|
|
|
+ "today": {"task": "进行一盘游戏并到达2-1", "reward": "50经验", "process": 0, "finish": 1, "last_finish": "1970-1-1", "reward_exp": 50, "hero": "Fox", "rewarded": True}
|
|
|
|
|
+ }
|
|
|
|
|
+ save_encrypt_single_rouge_file(self.rougeOB_task_data, "rougeOB_task")
|
|
|
|
|
+ # 正常打开
|
|
|
|
|
+ else:
|
|
|
|
|
+ self.rougeOB_task_data = load_rouge_data(self.rouge_task_file_path)
|
|
|
|
|
+
|
|
|
|
|
+ # 格式化年月日
|
|
|
|
|
+ year = self.now.strftime("%Y")
|
|
|
|
|
+ month = self.now.strftime("%m")
|
|
|
|
|
+ day = self.now.strftime("%d")
|
|
|
|
|
+ # 移除月份和日期的前导零(如果有)
|
|
|
|
|
+ month = month.lstrip("0")
|
|
|
|
|
+ day = day.lstrip("0")
|
|
|
|
|
+ self.year = str(year)
|
|
|
|
|
+ self.month = str(month)
|
|
|
|
|
+ self.day = str(day)
|
|
|
|
|
+
|
|
|
|
|
+ if int(self.rougeOB_task_data[str(month)]["last_finish"]) < int(year):
|
|
|
|
|
+ self.rougeOB_task_data[str(month)]["process"] = 0
|
|
|
|
|
+ self.rougeOB_task_data[str(month)]["last_finish"] = year
|
|
|
|
|
+ self.rougeOB_task_data[str(month)]["rewarded"] = False
|
|
|
|
|
+ if self.rougeOB_task_data["today"]["last_finish"] != year + "-" + month + "-" + day:
|
|
|
|
|
+ self.rougeOB_task_data["today"]["process"] = 0
|
|
|
|
|
+ self.rougeOB_task_data["today"]["last_finish"] = year + "-" + month + "-" + day
|
|
|
|
|
+ self.rougeOB_task_data["today"]["rewarded"] = False
|
|
|
|
|
+ save_encrypt_single_rouge_file(self.rougeOB_task_data, "rougeOB_task")
|
|
|
|
|
+
|
|
|
|
|
+ def draw(self):
|
|
|
|
|
+ """
|
|
|
|
|
+ # ============================================= 月常任务 =============================================
|
|
|
|
|
+ if self.rougeOB_task_data[self.month]["process"] < self.rougeOB_task_data[self.month]["finish"]:
|
|
|
|
|
+ # 若还未完成
|
|
|
|
|
+ text = f"○月度征召\n{self.rougeOB_task_data[self.month]['task']} \n酬谢: {self.rougeOB_task_data[self.month]['reward']}\n进度: {self.rougeOB_task_data[self.month]['process']}/{self.rougeOB_task_data[self.month]['finish']}"
|
|
|
|
|
+ self.screen.buttons.append(
|
|
|
|
|
+ PygameButton(self.screen.screen, text, 0.3, 0.35, 18, "#2a2a2a",
|
|
|
|
|
+ fg_color=(215,220,217), anchor="center", is_bold=True, fix_shape=(280,160), bg_alpha=159,
|
|
|
|
|
+ frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ text = f"○月度征召\n{self.rougeOB_task_data[self.month]['task']} \n酬谢: {self.rougeOB_task_data[self.month]['reward']}\n\n by {R.hero_name[self.rougeOB_task_data['today']['hero']]}"
|
|
|
|
|
+ self.screen.buttons.append(
|
|
|
|
|
+ PygameButton(self.screen.screen, text, 0.3, 0.35, 18, "#2a2a2a",
|
|
|
|
|
+ fg_color=(215,220,217), anchor="center", is_bold=True, fix_shape=(280,160), bg_alpha=159,
|
|
|
|
|
+ frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen)
|
|
|
|
|
+ )
|
|
|
|
|
+ self.screen.buttons.append(PygameButtonBackIMG(
|
|
|
|
|
+ self.screen, self.screen.screen, 0.3, 0.41, "res/ui/button/task_finish.png", "res/ui/button/task_finish.png", anchor='center')
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ # ============================================= 日常任务 =============================================
|
|
|
|
|
+ print(self.rougeOB_task_data["today"]["process"], self.rougeOB_task_data["today"]["finish"])
|
|
|
|
|
+ if self.rougeOB_task_data["today"]["process"] < self.rougeOB_task_data["today"]["finish"]:
|
|
|
|
|
+ # 若还未完成
|
|
|
|
|
+ text = f"○日常委托\n{self.rougeOB_task_data['today']['task']} \n酬谢: {self.rougeOB_task_data['today']['reward']}\n进度: {self.rougeOB_task_data['today']['process']}/{self.rougeOB_task_data['today']['finish']}"
|
|
|
|
|
+ self.screen.buttons.append(
|
|
|
|
|
+ PygameButton(self.screen.screen, text, 0.7, 0.35, 18, "#2a2a2a",
|
|
|
|
|
+ fg_color=(215,220,217), anchor="center", is_bold=True, fix_shape=(280,160), bg_alpha=159,
|
|
|
|
|
+ frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen)
|
|
|
|
|
+ )
|
|
|
|
|
+ else:
|
|
|
|
|
+ text = f"○日常委托\n{self.rougeOB_task_data['today']['task']} \n酬谢: {self.rougeOB_task_data['today']['reward']}\n\n by {R.hero_name[self.rougeOB_task_data['today']['hero']]}"
|
|
|
|
|
+ self.screen.buttons.append(
|
|
|
|
|
+ PygameButton(self.screen.screen, text, 0.7, 0.35, 18, "#2a2a2a",
|
|
|
|
|
+ fg_color=(215,220,217), anchor="center", is_bold=True, fix_shape=(280,160), bg_alpha=159,
|
|
|
|
|
+ frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21), background=self.screen)
|
|
|
|
|
+ )
|
|
|
|
|
+ self.screen.buttons.append(PygameButtonBackIMG(
|
|
|
|
|
+ self.screen, self.screen.screen, 0.7, 0.41, "res/ui/button/task_finish.png", "res/ui/button/task_finish.png", anchor='center')
|
|
|
|
|
+ )
|
|
|
|
|
+ """
|
|
|
|
|
+ text = f"\n\n任务系统升级中.."
|
|
|
|
|
+ self.screen.buttons.append(
|
|
|
|
|
+ PygameButton(self.screen.screen, text, 0.5, 0.35, 18, "#2a2a2a",
|
|
|
|
|
+ fg_color=(215,220,217), anchor="center", is_bold=True, fix_shape=(280,160), bg_alpha=159,
|
|
|
|
|
+ frosted_glass=True, blur_radius=12, glass_alpha=127, frame_radius=4, glass_surf_color=(41,34,21),
|
|
|
|
|
+ background=self.screen)
|
|
|
|
|
+ )
|
|
|
|
|
+
|
|
|
|
|
+ # 返回主界面
|
|
|
|
|
+ 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')
|
|
|
|
|
+ )
|
|
|
|
|
+
|