# KatisianRobot **Repository Path**: null_742_3501/KatisianRobot ## Basic Information - **Project Name**: KatisianRobot - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-02 - **Last Updated**: 2026-04-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Android游戏自动化脚本框架 一个基于Python的Android游戏自动化脚本框架,支持图像识别、OCR文字识别、多任务流程管理。 ## 功能特性 - **图像识别**: 基于OpenCV的模板匹配,支持多尺度匹配 - **OCR识别**: 集成PPOCR,支持中英文文字识别 - **设备控制**: 基于scrcpy和adb的设备控制 - **任务流程**: 支持复杂的多分支任务流程 - **配置驱动**: JSON配置文件,无需修改代码 - **内存缓存**: 帧缓存管理,避免频繁IO ## 项目结构 ``` KatisianRobot/ ├── core/ # 核心数据结构 │ ├── types.py # 枚举和数据类定义 │ └── __init__.py ├── engine/ # 核心引擎 │ ├── frame_buffer.py # 帧缓存管理 │ ├── vision_engine.py # 视觉识别引擎 │ ├── action_executor.py # 动作执行器 │ └── __init__.py ├── config/ # 配置文件 │ ├── opt.json # 操作单元配置 │ └── opt_ship.json # 任务流程配置 ├── resources/ # 资源文件(图片模板等) ├── models/ # OCR模型文件 ├── main.py # 主入口 └── requirements.txt # 依赖列表 ``` ## 安装 1. 安装依赖: ```bash pip install -r requirements.txt ``` 2. 下载OCR模型文件到`models/`目录 3. 准备ADB环境并连接Android设备 ## 使用方法 ### 1. 配置操作单元 编辑`config/opt.json`定义操作单元: ```json { "operation_units": { "op_click_button": { "name": "点击按钮", "op_type": "image_click", "enabled": true, "params": { "trigger": { "type": "image", "value": "resources/button.png", "region": [100, 200, 300, 400], "threshold": 0.8 }, "action": { "type": "click", "region": "auto" } } } } } ``` ### 2. 配置任务流程 编辑`config/opt_ship.json`定义任务流程: ```json { "ships": { "daily_mission": { "name": "每日任务", "start_unit": "op_start", "units": { "op_start": { "next": "op_click_button" }, "op_click_button": { "next": null } } } } } ``` ### 3. 运行 ```python from main import GameAutomationFramework # 创建框架 framework = GameAutomationFramework() # 加载配置 framework.load_config() # 连接设备 framework.connect_device() # 运行任务 framework.run_ship("daily_mission") ``` ## 操作单元类型 - `IMAGE_CLICK`: 等待图片出现后点击 - `TEXT_CLICK`: 等待文字出现后点击 - `SWIPE_FIND_TEXT_CLICK`: 滑动查找文字后点击 - `SWIPE_FIND_IMAGE_CLICK`: 滑动查找图片后点击 - `WAIT_DISAPPEAR_CLICK`: 等待消失后点击 ## 触发条件类型 - `image`: 图片出现 - `text`: 文字出现 - `image_disappear`: 图片消失 - `text_disappear`: 文字消失 - `always`: 总是触发 ## 开发计划 - [ ] GUI可视化编辑器 - [ ] 操作录制功能 - [ ] 更多的图像识别算法 - [ ] 性能优化 - [ ] 多设备支持 ## 许可证 MIT License