初始化项目以及GUI简单实现

This commit is contained in:
moweishan
2026-03-18 15:48:40 +08:00
parent f7e429a9b3
commit b67c5be2f3
25 changed files with 1650 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
"""
挂机任务模块
所有任务逻辑代码写死实现
"""
from .daily_tasks import DailyTaskRunner
from .misc_tasks import MiscTaskRunner
from .pending_tasks import PendingTaskRunner
__all__ = [
"DailyTaskRunner",
"MiscTaskRunner",
"PendingTaskRunner",
]

View File

@@ -0,0 +1,69 @@
"""
日常挂机任务
"""
from typing import Dict, Any
from src.utils.logger import logger
class DailyTaskRunner:
"""日常任务执行器"""
# 任务配置 - 代码写死
TASKS = {
"daily_mission": {
"name": "每日委托",
"enabled": True,
"description": "完成每日任务",
},
"resin_farming": {
"name": "清体力",
"enabled": True,
"description": "消耗体力刷资源",
},
"monthly_card": {
"name": "领月卡",
"enabled": False,
"description": "领取月卡奖励",
},
"friend_gift": {
"name": "好友礼物",
"enabled": True,
"description": "领取好友赠送的礼物",
},
"shop_daily": {
"name": "每日商店",
"enabled": False,
"description": "购买每日商店物品",
},
}
def __init__(self):
self._config = self.TASKS.copy()
def get_tasks(self) -> Dict[str, Any]:
"""获取所有任务配置"""
return self._config
def update_task(self, task_id: str, enabled: bool):
"""更新任务启用状态"""
if task_id in self._config:
self._config[task_id]["enabled"] = enabled
logger.info(f"任务 {task_id} 状态更新为: {enabled}")
def run(self, actions):
"""执行启用的任务"""
for task_id, config in self._config.items():
if not config["enabled"]:
continue
logger.info(f"执行任务: {config['name']}")
try:
self._execute_task(task_id, actions)
except Exception as e:
logger.error(f"任务 {config['name']} 执行失败: {e}")
def _execute_task(self, task_id: str, actions):
"""执行具体任务"""
# TODO: 实现具体任务逻辑
logger.debug(f"执行任务逻辑: {task_id}")

View File

@@ -0,0 +1,64 @@
"""
杂项功能任务
"""
from typing import Dict, Any
from src.utils.logger import logger
class MiscTaskRunner:
"""杂项功能执行器"""
# 功能配置 - 代码写死
FEATURES = {
"auto_pickup": {
"name": "自动拾取",
"enabled": True,
"description": "自动拾取掉落物品",
},
"auto_skip": {
"name": "自动跳过对话",
"enabled": False,
"description": "自动跳过游戏对话",
},
"auto_heal": {
"name": "自动回血",
"enabled": True,
"description": "低血量自动回血",
},
"auto_repair": {
"name": "自动修理",
"enabled": False,
"description": "装备损坏自动修理",
},
}
def __init__(self):
self._config = self.FEATURES.copy()
def get_features(self) -> Dict[str, Any]:
"""获取所有功能配置"""
return self._config
def update_feature(self, feature_id: str, enabled: bool):
"""更新功能启用状态"""
if feature_id in self._config:
self._config[feature_id]["enabled"] = enabled
logger.info(f"功能 {feature_id} 状态更新为: {enabled}")
def run(self, actions):
"""执行启用的功能"""
for feature_id, config in self._config.items():
if not config["enabled"]:
continue
logger.info(f"执行功能: {config['name']}")
try:
self._execute_feature(feature_id, actions)
except Exception as e:
logger.error(f"功能 {config['name']} 执行失败: {e}")
def _execute_feature(self, feature_id: str, actions):
"""执行具体功能"""
# TODO: 实现具体功能逻辑
logger.debug(f"执行功能逻辑: {feature_id}")

View File

@@ -0,0 +1,48 @@
"""
待定功能任务
预留功能占位
"""
from typing import Dict, Any
from src.utils.logger import logger
class PendingTaskRunner:
"""待定功能执行器"""
# 待定功能配置 - 代码写死
PENDING_FEATURES = {
"feature_a": {
"name": "功能A待开发",
"enabled": False,
"description": "预留功能A",
},
"feature_b": {
"name": "功能B待开发",
"enabled": False,
"description": "预留功能B",
},
"feature_c": {
"name": "功能C待开发",
"enabled": False,
"description": "预留功能C",
},
}
def __init__(self):
self._config = self.PENDING_FEATURES.copy()
def get_features(self) -> Dict[str, Any]:
"""获取所有待定功能"""
return self._config
def update_feature(self, feature_id: str, enabled: bool):
"""更新功能状态"""
if feature_id in self._config:
self._config[feature_id]["enabled"] = enabled
logger.info(f"待定功能 {feature_id} 状态更新为: {enabled}")
def run(self, actions):
"""执行启用的功能"""
logger.info("待定功能模块 - 暂无实现")
# 待定功能暂不执行任何操作