rougetask.py 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. from game import control
  2. from game.algo import rougeGen
  3. from game.file_loader.fileLoader import load_json, load_png, save_encrypt_single_rouge_file, load_rouge_data
  4. import json
  5. import os
  6. import tkinter as tk
  7. from game.const import game as G
  8. from game.const import rouge as R
  9. from datetime import datetime
  10. import roguetest
  11. current_folder_path = os.getcwd()
  12. class Task:
  13. def __init__(self, master):
  14. self.master = master
  15. master.geometry("1000x700")
  16. master.configure(bg='#7E587E')
  17. master.title(f"QQTRogue二测β{G.VERSION}(底层逻辑:永恒; 地牢设计:100の雨女; 唯一官方群756422783免费下载; 擅自售卖皆属剽窃!")
  18. master.attributes('-topmost', True)
  19. now = datetime.now()
  20. user_documents_folder = os.path.expanduser("~\\Documents") # 获取用户的"文档"文件夹路径
  21. qqtpve_folder = os.path.join(user_documents_folder, "QQTPVE") # 构建QQTPVE文件夹路径
  22. os.makedirs(qqtpve_folder, exist_ok=True) # 确保QQTPVE文件夹存在,如果不存在则创建
  23. rouge_task_file_path = os.path.join(qqtpve_folder, "rougeOB_task.rougedata") # 构建任务文件路径
  24. # 第一次打开
  25. if not os.path.exists(rouge_task_file_path):
  26. rougeOB_task_data = {"1": {"task": "击杀5只命运维系者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  27. "2": {"task": "击杀3只渊烬龙王", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  28. "3": {"task": "到达3-1十次", "reward": "800经验", "process": 0, "finish": 10, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  29. "4": {"task": "击杀5只因果阅律者", "reward": "800经验", "process": 0, "finish": 5, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  30. "5": {"task": "完成20次挑衅敌人", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  31. "6": {"task": "使用小倩到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  32. "7": {"task": "使用波波丽到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  33. "8": {"task": "使用火影到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  34. "9": {"task": "使用阿莎到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  35. "10": {"task": "使用玛莉亚到达3-5三次", "reward": "800经验", "process": 0, "finish": 3, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  36. "11": {"task": "到达4-1一次", "reward": "800经验", "process": 0, "finish": 1, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  37. "12": {"task": "累积使用20次复活卡", "reward": "800经验", "process": 0, "finish": 20, "last_finish": 1970, "reward_exp": 800, "hero": "Fox", "rewarded": True},
  38. "today": {"task": "进行一盘游戏并到达2-1", "reward": "50经验", "process": 0, "finish": 1, "last_finish": "1970-1-1", "reward_exp": 50, "hero": "Fox", "rewarded": True}}
  39. save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
  40. # 正常打开
  41. else:
  42. rougeOB_task_data = load_rouge_data(rouge_task_file_path)
  43. # 格式化年月日
  44. year = now.strftime("%Y")
  45. month = now.strftime("%m")
  46. day = now.strftime("%d")
  47. # 移除月份和日期的前导零(如果有)
  48. month = month.lstrip("0")
  49. day = day.lstrip("0")
  50. if int(rougeOB_task_data[str(month)]["last_finish"]) < int(year):
  51. rougeOB_task_data[str(month)]["process"] = 0
  52. rougeOB_task_data[str(month)]["last_finish"] = year
  53. rougeOB_task_data[str(month)]["rewarded"] = False
  54. if rougeOB_task_data["today"]["last_finish"] != year + "-" + month + "-" + day:
  55. rougeOB_task_data["today"]["process"] = 0
  56. rougeOB_task_data["today"]["last_finish"] = year + "-" + month + "-" + day
  57. rougeOB_task_data["today"]["rewarded"] = False
  58. save_encrypt_single_rouge_file(rougeOB_task_data, "rougeOB_task")
  59. # 月常任务
  60. self.button0 = tk.Button(master, text= "本月任务: " + rougeOB_task_data[str(month)]["task"] + " \n (" + "奖励:" + rougeOB_task_data[str(month)]["reward"] + ")", bg="#C47451", font=("Microsoft YaHei", 20))
  61. self.button0.place(relx=0.1, rely=0.25, anchor='w')
  62. if rougeOB_task_data[str(month)]["process"] < rougeOB_task_data[str(month)]["finish"]:
  63. self.button1 = tk.Button(master, text= "进度: " + str(rougeOB_task_data[str(month)]["process"]) + "/" + str(rougeOB_task_data[str(month)]["finish"]) + " (未完成)", bg="#C47451", font=("Microsoft YaHei", 20))
  64. self.button1.place(relx=0.6, rely=0.25, anchor='w')
  65. else:
  66. self.button1 = tk.Button(master, text= "进度: " + str(rougeOB_task_data[str(month)]["process"]) + "/" + str(rougeOB_task_data[str(month)]["finish"]) + " \n (已使用" + R.hero_name[rougeOB_task_data["today"]["hero"]] + "领取奖励)", bg="#C47451", font=("Microsoft YaHei", 20))
  67. self.button1.place(relx=0.6, rely=0.25, anchor='w')
  68. # 日常任务
  69. self.button2 = tk.Button(master, text= "每日任务: " + rougeOB_task_data["today"]["task"] + " \n (" + "奖励:" + rougeOB_task_data["today"]["reward"] + ")", bg="#E6A9EC", font=("Microsoft YaHei", 20))
  70. self.button2.place(relx=0.1, rely=0.5, anchor='w')
  71. if rougeOB_task_data["today"]["process"] < rougeOB_task_data["today"]["finish"]:
  72. self.button3 = tk.Button(master, text= "进度: " + str(rougeOB_task_data["today"]["process"]) + "/" + str(rougeOB_task_data["today"]["finish"]) + " (未完成)", bg="#E6A9EC", font=("Microsoft YaHei", 20))
  73. self.button3.place(relx=0.6, rely=0.5, anchor='w')
  74. else:
  75. self.button3 = tk.Button(master, text= "进度: " + str(rougeOB_task_data["today"]["process"]) + "/" + str(rougeOB_task_data["today"]["finish"]) + " \n (已使用" + R.hero_name[rougeOB_task_data["today"]["hero"]] + "领取奖励)", bg="#E6A9EC", font=("Microsoft YaHei", 20))
  76. self.button3.place(relx=0.6, rely=0.5, anchor='w')
  77. # 返回主界面
  78. self.button0 = tk.Button(master, text= "返回主界面", command=lambda: self.button_return(), bg="#C68E17", font=("Microsoft YaHei", 24))
  79. self.button0.place(relx=0.5, rely=0.7, anchor='center')
  80. def button_return(self):
  81. self.master.destroy()
  82. def task():
  83. """
  84. Pygame 里直接做:
  85. from rougetask import Task
  86. Task()
  87. 就能跑出这个 Setting 界面。
  88. """
  89. root = tk.Tk()
  90. app = Task(root)
  91. root.mainloop()
  92. # if __name__ == "__main__":
  93. # root = tk.Tk()
  94. # app = Task(root)
  95. # root.mainloop()