Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c137911234 | ||
|
|
d30e05b365 | ||
|
|
e969b5a96f | ||
|
|
40c84face6 |
No files matched your search
@@ -0,0 +1,22 @@
|
||||
---
|
||||
name: Bug report / 错误报告
|
||||
about: Create a report to help us improve / 创建报告以帮助我们改进
|
||||
title: "[bug]请补充标题内容"
|
||||
labels: bug
|
||||
---
|
||||
|
||||
<!--
|
||||
请提供下述完整信息以便快速定位问题 / Please provide the following information to quickly locate the problem
|
||||
-->
|
||||
|
||||
- 系统环境 / System Environment:
|
||||
|
||||
|
||||
- BetterGI版本号 / BetterGI Version:
|
||||
|
||||
|
||||
- 问题描述 / Description of the issue:
|
||||
|
||||
|
||||
- 复现步骤 / Reproduction steps:
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
name: Bug report / 错误报告
|
||||
description: 提交可复现的问题,帮助我们定位错误 / Report a reproducible problem
|
||||
title: "[bug] "
|
||||
labels:
|
||||
- BUG
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 提交确认 / Checklist
|
||||
description: Checklist before submitting
|
||||
options:
|
||||
- label: 我已经搜索过现有 issue,确认这不是重复问题 / I have searched existing issues and confirmed this is not a duplicate
|
||||
required: true
|
||||
- label: "我已阅读过[文档](https://www.bettergi.com/doc.html),确认文档的内容无法解决我的问题 / I have read the [documentation](https://www.bettergi.com/doc.html) and confirmed it does not solve my problem"
|
||||
required: true
|
||||
- label: 我愿意为了解决这个问题尽自己所能 / I am willing to do my part to help resolve this issue
|
||||
- type: textarea
|
||||
id: environment
|
||||
attributes:
|
||||
label: 系统环境
|
||||
description: System environment,例如操作系统版本、运行时版本、显卡驱动版本
|
||||
placeholder: Windows 11 24H2 (26100.3775) / .NET Desktop Runtime 8.0.15 / NVIDIA 572.83
|
||||
validations:
|
||||
required: true
|
||||
- type: input
|
||||
id: version
|
||||
attributes:
|
||||
label: BetterGI 版本号
|
||||
description: BetterGI Version
|
||||
placeholder: e.g. 0.58.0
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: 问题描述
|
||||
description: Describe the actual behavior and impact
|
||||
placeholder: 请描述实际出现的问题,以及这个问题对使用造成了什么影响 / Describe the actual behavior and impact
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: expected
|
||||
attributes:
|
||||
label: 期望结果
|
||||
description: Expected behavior
|
||||
placeholder: 请描述你期望出现的正确行为或结果 / Describe the expected behavior or result
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: steps
|
||||
attributes:
|
||||
label: 复现步骤
|
||||
description: Reproduction steps
|
||||
placeholder: |-
|
||||
1. 打开…… / Open ...
|
||||
2. 点击…… / Click ...
|
||||
3. 出现…… / Observe ...
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: logs
|
||||
attributes:
|
||||
label: 日志与附件
|
||||
description: Logs and attachments,可直接拖拽上传日志文件、压缩包、截图或视频
|
||||
placeholder: |-
|
||||
可在这里补充日志和附件说明 / Add logs and attachment notes here:
|
||||
- 可直接粘贴关键日志片段 / Paste key log snippets directly
|
||||
- 可拖拽上传日志文件或压缩包 / Drag and drop log files or archives
|
||||
- 可拖拽上传截图、录屏或演示视频 / Drag and drop screenshots or videos
|
||||
- 若附件较多,请说明对应的时间点、任务名称或异常现象 / If there are many files, explain the relevant timestamps or symptoms
|
||||
- 提交前请注意移除账号、路径等隐私信息 / Remove private information before submitting
|
||||
validations:
|
||||
required: false
|
||||
@@ -1,9 +1,9 @@
|
||||
blank_issues_enabled: false
|
||||
contact_links:
|
||||
- name: 官方文档 / Document
|
||||
url: https://www.bettergi.com/doc.html
|
||||
url: https://bgi.huiyadan.com/doc.html
|
||||
about: 请在提出问题前阅读文档 / Read the document before submit the issue
|
||||
|
||||
- name: 常见问题 / FAQ
|
||||
url: https://www.bettergi.com/faq.html
|
||||
url: https://bgi.huiyadan.com/faq.html
|
||||
about: 常见的用户提出的问题 / Common questions asked by users
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
name: I have feature requesting / 我有新功能请求
|
||||
about: Your request may come as a surprise. / 你的请求也许成为惊喜
|
||||
title: "[feature] "
|
||||
labels: feature 功能请求
|
||||
---
|
||||
|
||||
- Your feature requesting / 你的新功能请求
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
name: I have feature requesting / 我有功能需求
|
||||
description: 提出新的功能想法 / Share a feature request
|
||||
title: "[feature] "
|
||||
labels:
|
||||
- 功能建议
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 提交确认 / Checklist
|
||||
description: Please confirm the following before submitting
|
||||
options:
|
||||
- label: 我已经搜索过现有 issue,确认这不是重复建议 / I have searched existing issues and confirmed this is not a duplicate request
|
||||
required: true
|
||||
- label: 我已确认当前版本中尚未提供该功能,或至少没有等价实现 / I have confirmed this feature, or an equivalent one, is not already available in the current version
|
||||
required: true
|
||||
- label: 我认为这个需求能为更多用户带来明确收益,而不仅仅是个人偏好 / I believe this request provides clear value to a broader group of users, not just my personal preference
|
||||
required: true
|
||||
- label: 我理解这个需求可能因实现成本、维护成本或项目方向而暂不采纳 / I understand this request may not be accepted due to implementation cost, maintenance cost, or project direction
|
||||
required: true
|
||||
- type: textarea
|
||||
id: request
|
||||
attributes:
|
||||
label: 功能请求
|
||||
description: Feature Request
|
||||
placeholder: 请简要说明你希望新增什么能力 / Briefly describe the capability you want to add
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: scenario
|
||||
attributes:
|
||||
label: 使用场景
|
||||
description: Use Case
|
||||
placeholder: 这个功能要解决什么问题?在哪些场景下使用? / What problem does this feature solve, and when would it be used?
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: impact
|
||||
attributes:
|
||||
label: 潜在影响
|
||||
description: Potential Impact
|
||||
placeholder: 请说明这个功能是否可能带来新的问题、维护成本、使用门槛或兼容性影响;如果没有,请填写“无” / Describe any potential downsides such as new issues, maintenance cost, usability barriers, or compatibility impact. Write "None" if there are no obvious downsides.
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: extra
|
||||
attributes:
|
||||
label: 补充信息
|
||||
description: Optional
|
||||
placeholder: "可选,补充示意图、交互草图、参考链接或相关背景信息 / Optional: add mockups, interaction sketches, reference links, or other background information"
|
||||
validations:
|
||||
required: false
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
name: Feel free to express / 随便写写
|
||||
about: Record something / 简单写写记录记录
|
||||
---
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
name: Feel free to express / 自由描述
|
||||
description: 记录你想反馈的内容 / Share general feedback
|
||||
title: "[feedback] "
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 提交确认 / Checklist
|
||||
description: Please confirm the following before submitting
|
||||
options:
|
||||
- label: 我已经搜索过现有 issue,确认这不是重复反馈 / I have searched existing issues and confirmed this is not duplicate feedback
|
||||
required: true
|
||||
- label: "我已阅读过[文档](https://www.bettergi.com/doc.html),确认文档的内容无法解决我的问题或覆盖我的反馈 / I have read the [documentation](https://www.bettergi.com/doc.html) and confirmed it does not solve my problem or cover my feedback"
|
||||
required: true
|
||||
- type: textarea
|
||||
id: description
|
||||
attributes:
|
||||
label: 描述
|
||||
description: Description
|
||||
placeholder: 请描述你想反馈的内容 / Describe what you want to share
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
name: I have a question / 我有疑问
|
||||
about: Solve your problem / 解决你的疑问
|
||||
title: "[question] "
|
||||
labels: question
|
||||
---
|
||||
|
||||
- Problem Description / 问题描述
|
||||
- 请尽量提供问题相关的截图/日志等内容
|
||||
@@ -1,32 +0,0 @@
|
||||
name: I have a question / 我有疑问
|
||||
description: 提交你的问题,我们会尽量帮助你解决 / Ask a question
|
||||
title: "[question] "
|
||||
labels:
|
||||
- 问题咨询
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 提交确认 / Checklist
|
||||
description: Please confirm the following before submitting
|
||||
options:
|
||||
- label: 我已经搜索过现有 issue,确认这不是重复问题 / I have searched existing issues and confirmed this is not a duplicate question
|
||||
required: true
|
||||
- label: "我已阅读过[文档](https://www.bettergi.com/doc.html),确认文档的内容无法解决我的问题 / I have read the [documentation](https://www.bettergi.com/doc.html) and confirmed it does not solve my problem"
|
||||
required: true
|
||||
- type: textarea
|
||||
id: question
|
||||
attributes:
|
||||
label: 问题描述
|
||||
description: Problem Description
|
||||
placeholder: 请清楚描述你的问题 / Clearly describe your question
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: tried
|
||||
attributes:
|
||||
label: 已尝试内容
|
||||
description: Screenshots / logs / what you already tried
|
||||
placeholder: 可附上截图、日志,以及你已经尝试过的排查过程 / Add screenshots, logs, and what you have already tried
|
||||
validations:
|
||||
required: true
|
||||
@@ -0,0 +1,9 @@
|
||||
---
|
||||
name: I have suggestions / 我有建议
|
||||
about: Your suggestions may benefit everyone / 你的建议可能让所有人受益
|
||||
title: "[suggestion] "
|
||||
labels: suggestion
|
||||
---
|
||||
|
||||
- Your suggestions / 你的建议
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
name: I have suggestions / 我有建议
|
||||
description: 分享对项目的改进建议 / Share an improvement suggestion
|
||||
title: "[suggestion] "
|
||||
labels:
|
||||
- 功能建议
|
||||
body:
|
||||
- type: checkboxes
|
||||
id: checks
|
||||
attributes:
|
||||
label: 提交确认 / Checklist
|
||||
description: Please confirm the following before submitting
|
||||
options:
|
||||
- label: 我已经搜索过现有 issue,确认这不是重复建议 / I have searched existing issues and confirmed this is not a duplicate suggestion
|
||||
required: true
|
||||
- label: "我已阅读过[文档](https://www.bettergi.com/doc.html),确认文档的内容无法解决我的问题或覆盖我的建议 / I have read the [documentation](https://www.bettergi.com/doc.html) and confirmed it does not solve my problem or cover my suggestion"
|
||||
required: true
|
||||
- type: textarea
|
||||
id: suggestion
|
||||
attributes:
|
||||
label: 建议内容
|
||||
description: Suggestion
|
||||
placeholder: 请描述你的建议内容 / Describe your suggestion
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
id: benefit
|
||||
attributes:
|
||||
label: 预期收益
|
||||
description: Expected Benefit
|
||||
placeholder: 这个建议会给用户或项目带来什么帮助? / What benefits would this suggestion bring to users or the project?
|
||||
validations:
|
||||
required: true
|
||||
@@ -1,229 +0,0 @@
|
||||
runtime:
|
||||
languageMode: auto
|
||||
dryRun: false
|
||||
|
||||
providers:
|
||||
openAiCompatible:
|
||||
enabled: true
|
||||
baseUrl: https://api.openai.com/v1
|
||||
model: gpt-5.4
|
||||
apiStyle: responses
|
||||
timeoutMs: 30000
|
||||
|
||||
issues:
|
||||
autoProcessing:
|
||||
skipCreatedBefore: auto
|
||||
validation:
|
||||
enabled: true
|
||||
fallbackTemplateKey: normal
|
||||
commentAnchor: issue-bot:validation
|
||||
templates:
|
||||
- key: bug
|
||||
detect:
|
||||
markers:
|
||||
- bug
|
||||
titlePrefixes:
|
||||
- "[bug]"
|
||||
requiredSections:
|
||||
- id: environment
|
||||
aliases:
|
||||
- 系统环境
|
||||
- System Environment
|
||||
- id: version
|
||||
aliases:
|
||||
- BetterGI 版本号
|
||||
- BetterGI Version
|
||||
- id: description
|
||||
aliases:
|
||||
- 问题描述
|
||||
- Description of the issue
|
||||
- id: steps
|
||||
aliases:
|
||||
- 复现步骤
|
||||
- Reproduction steps
|
||||
labels:
|
||||
whenValid:
|
||||
- BUG
|
||||
whenInvalid:
|
||||
- 需要更多信息
|
||||
- key: feature
|
||||
detect:
|
||||
markers:
|
||||
- feature
|
||||
titlePrefixes:
|
||||
- "[feature]"
|
||||
requiredSections:
|
||||
- id: request
|
||||
aliases:
|
||||
- 功能请求
|
||||
- Feature Request
|
||||
- id: scenario
|
||||
aliases:
|
||||
- 使用场景
|
||||
- Use Case
|
||||
labels:
|
||||
whenValid:
|
||||
- 功能建议
|
||||
whenInvalid:
|
||||
- 需要更多信息
|
||||
- key: suggestion
|
||||
detect:
|
||||
markers:
|
||||
- suggestion
|
||||
titlePrefixes:
|
||||
- "[suggestion]"
|
||||
requiredSections:
|
||||
- id: suggestion
|
||||
aliases:
|
||||
- 建议内容
|
||||
- Suggestion
|
||||
- id: benefit
|
||||
aliases:
|
||||
- 预期收益
|
||||
- Expected Benefit
|
||||
labels:
|
||||
whenValid:
|
||||
- 功能建议
|
||||
whenInvalid:
|
||||
- 需要更多信息
|
||||
- key: question
|
||||
detect:
|
||||
markers:
|
||||
- question
|
||||
titlePrefixes:
|
||||
- "[question]"
|
||||
requiredSections:
|
||||
- id: question
|
||||
aliases:
|
||||
- 问题描述
|
||||
- Problem Description
|
||||
- id: tried
|
||||
aliases:
|
||||
- 已尝试内容
|
||||
- What I Tried
|
||||
labels:
|
||||
whenValid:
|
||||
- 问题咨询
|
||||
whenInvalid:
|
||||
- 需要更多信息
|
||||
- key: normal
|
||||
detect:
|
||||
markers:
|
||||
- normal
|
||||
titlePrefixes:
|
||||
- "[feedback]"
|
||||
- "[normal]"
|
||||
requiredSections:
|
||||
- id: description
|
||||
aliases:
|
||||
- 描述
|
||||
- Description
|
||||
labels:
|
||||
whenValid: []
|
||||
whenInvalid:
|
||||
- 需要更多信息
|
||||
duplicateDetection:
|
||||
enabled: true
|
||||
bypassLabels:
|
||||
- 跳过重复检测
|
||||
duplicateLabel: 重复
|
||||
searchResultLimit: 50
|
||||
candidateLimit: 20
|
||||
aiReviewMaxCandidates: 3
|
||||
thresholds:
|
||||
exact: 0.995
|
||||
highConfidence: 0.93
|
||||
reviewMin: 0.82
|
||||
similarityComment:
|
||||
enabled: false
|
||||
commentAnchor: issue-bot:similar-issues
|
||||
minScore: 0.3
|
||||
maxCandidates: 3
|
||||
labeling:
|
||||
enabled: true
|
||||
autoCreateMissing: true
|
||||
managed:
|
||||
- BUG
|
||||
- 功能建议
|
||||
- 问题咨询
|
||||
- 需要更多信息
|
||||
- 重复
|
||||
definitions:
|
||||
BUG:
|
||||
color: d73a4a
|
||||
description: 程序存在缺陷或异常行为。
|
||||
功能建议:
|
||||
color: a2eeef
|
||||
description: 新功能建议或现有功能改进。
|
||||
问题咨询:
|
||||
color: d876e3
|
||||
description: 使用问题、求助或咨询。
|
||||
# 需要更多信息:
|
||||
# color: fbca04
|
||||
# description: 当前 Issue 缺少必要信息。
|
||||
重复:
|
||||
color: cfd3d7
|
||||
description: 已存在相同或高度相似的问题。
|
||||
keywordRules: []
|
||||
aiClassification:
|
||||
enabled: false
|
||||
maxLabels: 3
|
||||
minConfidence: 0.65
|
||||
include: []
|
||||
exclude:
|
||||
- BUG
|
||||
- 功能请求
|
||||
- 重复
|
||||
- 不会修复
|
||||
- 使用问题
|
||||
- 需要帮助
|
||||
- 已完成
|
||||
- 未解决
|
||||
- 待确认
|
||||
- P0
|
||||
- P1
|
||||
- 需要文档
|
||||
- 优化点
|
||||
- 急急急
|
||||
prompt: 优先给 BetterGI Issue 选择能反映具体功能模块、子系统或使用场景的标签,例如一条龙、调度器、脚本、设置项、地图追踪;避免只选择宽泛的流程或状态标签。
|
||||
sourceRepository:
|
||||
owner: babalae
|
||||
repo: better-genshin-impact
|
||||
aiHelp:
|
||||
enabled: true
|
||||
triggerLabels: []
|
||||
commentAnchor: issue-bot:ai
|
||||
projectContext:
|
||||
enabled: true
|
||||
includeRepositoryMetadata: true
|
||||
includeReadme: true
|
||||
readmeMaxChars: 3000
|
||||
profile:
|
||||
name: BetterGI
|
||||
aliases:
|
||||
- BGI
|
||||
- Better Genshin Impact
|
||||
summary: BetterGI is a desktop automation assistant for Genshin Impact.
|
||||
techStack:
|
||||
- C#
|
||||
- WPF
|
||||
- .NET
|
||||
commands:
|
||||
enabled: true
|
||||
mentions:
|
||||
- "@bot"
|
||||
- "@bettergi-repo-bot"
|
||||
access: collaborators
|
||||
fix:
|
||||
enabled: true
|
||||
commentAnchor: issue-bot:fix
|
||||
refresh:
|
||||
enabled: true
|
||||
|
||||
pullRequests:
|
||||
review:
|
||||
enabled: false
|
||||
labeling:
|
||||
enabled: false
|
||||
summary:
|
||||
enabled: false
|
||||
@@ -7,7 +7,6 @@ on:
|
||||
|
||||
jobs:
|
||||
mirrorchyan_release_note:
|
||||
if: github.repository_owner == 'babalae'
|
||||
runs-on: macos-latest
|
||||
|
||||
steps:
|
||||
|
||||
@@ -7,7 +7,6 @@ on:
|
||||
|
||||
jobs:
|
||||
mirrorchyan:
|
||||
if: github.repository_owner == 'babalae'
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: 📥 Download release
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
name: Repo Bot
|
||||
|
||||
on:
|
||||
issues:
|
||||
types:
|
||||
- opened
|
||||
- edited
|
||||
- reopened
|
||||
- labeled
|
||||
issue_comment:
|
||||
types:
|
||||
- created
|
||||
- edited
|
||||
|
||||
jobs:
|
||||
repo-bot:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
contents: read
|
||||
steps:
|
||||
- name: Detect GitHub App configuration
|
||||
id: auth-mode
|
||||
shell: bash
|
||||
env:
|
||||
REPO_BOT_GITHUB_APP_ID: ${{ vars.REPO_BOT_GITHUB_APP_ID }}
|
||||
REPO_BOT_GITHUB_APP_PRIVATE_KEY: ${{ secrets.REPO_BOT_GITHUB_APP_PRIVATE_KEY }}
|
||||
run: |
|
||||
if [ -n "$REPO_BOT_GITHUB_APP_ID" ] && [ -n "$REPO_BOT_GITHUB_APP_PRIVATE_KEY" ]; then
|
||||
echo "use_app=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "use_app=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Create GitHub App token
|
||||
if: ${{ steps.auth-mode.outputs.use_app == 'true' }}
|
||||
id: app-token
|
||||
uses: actions/create-github-app-token@v3
|
||||
with:
|
||||
app-id: ${{ vars.REPO_BOT_GITHUB_APP_ID }}
|
||||
private-key: ${{ secrets.REPO_BOT_GITHUB_APP_PRIVATE_KEY }}
|
||||
|
||||
- name: Run Repo Bot
|
||||
uses: ddaodan/bettergi-github-bot@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
REPO_BOT_GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
REPO_BOT_AI_API_KEY: ${{ secrets.REPO_BOT_AI_API_KEY }}
|
||||
REPO_BOT_AI_BASE_URL: ${{ vars.REPO_BOT_AI_BASE_URL }}
|
||||
with:
|
||||
config-path: .github/repo-bot.yml
|
||||
config-overrides-json: ${{ vars.REPO_BOT_CONFIG_OVERRIDES_JSON }}
|
||||
@@ -30,13 +30,8 @@ github_actions_cache/
|
||||
|
||||
# Rider
|
||||
.idea
|
||||
.trae
|
||||
.claude
|
||||
CLAUDE.md
|
||||
|
||||
__pycache__/
|
||||
|
||||
|
||||
# Trae
|
||||
.trae/*
|
||||
!.trae/rules/
|
||||
!.trae/rules/**
|
||||
!.trae/skills/
|
||||
!.trae/skills/**
|
||||
@@ -1,86 +0,0 @@
|
||||
本项目使用了 WPF-UI、 CommunityToolkit.Mvvm、Microsoft.Xaml.Behaviors.Wpf 来实现 MVVM 架构。在编写代码的时候请注意:
|
||||
|
||||
### 主要依赖框架
|
||||
#### UI 框架
|
||||
- **WPF-UI (4.0.2)** - 现代化 WPF UI 框架
|
||||
- **gong-wpf-dragdrop(3.2.1)** - 拖拽框架
|
||||
|
||||
#### MVVM 框架
|
||||
- **CommunityToolkit.Mvvm (8.2.2)** - 微软官方 MVVM 工具包
|
||||
- 所有 ViewModel 必须继承自 `ObservableObject`
|
||||
- 使用 `[ObservableProperty]` 特性自动生成属性
|
||||
- 使用 `[RelayCommand]` 特性自动生成命令
|
||||
- **Microsoft.Xaml.Behaviors.Wpf(1.1.122)** - WPF 行为扩展库
|
||||
- 请尽量使用 Behaviors 库来实现交互,避免不符合 MVVM 规范的交互事件触发方式。
|
||||
|
||||
### 其他框架使用要求
|
||||
1. 请优先使用 Newtonsoft.Json 作为json序列化工具,但是如果这个模型已经被System.Text.Json序列化过了,那么就直接使用System.Text.Json反序列化。
|
||||
2. 所有简单的对话框弹出需求优先使用 ThemedMessageBox 弹出。而不是 WPF 自带的 MessageBox。
|
||||
|
||||
## MVVM 架构规则
|
||||
|
||||
### 基础架构
|
||||
|
||||
### ViewModel 编写规范
|
||||
|
||||
1. **继承规则**
|
||||
```csharp
|
||||
public partial class ExampleViewModel : ViewModel
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string _title = "";
|
||||
|
||||
[RelayCommand]
|
||||
private void DoSomething()
|
||||
{
|
||||
// 实现逻辑
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. **属性命名**
|
||||
- 私有字段使用下划线前缀: `_fieldName`
|
||||
- 公共属性使用 PascalCase: `PropertyName`
|
||||
- 使用 `[ObservableProperty]` 自动生成属性
|
||||
|
||||
3. **命令实现**
|
||||
- 使用 `[RelayCommand]` 特性
|
||||
- 异步命令使用 `[RelayCommand]` + `async Task`
|
||||
|
||||
### View 编写规范
|
||||
|
||||
1. **代码后置**
|
||||
```csharp
|
||||
public partial class ExamplePage : UserControl
|
||||
{
|
||||
public ExampleViewModel ViewModel { get; }
|
||||
|
||||
public ExamplePage(ExampleViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. **XAML 绑定**
|
||||
- 使用 `{Binding}` 语法绑定 ViewModel 属性
|
||||
- 命令绑定: `Command="{Binding ExampleCommand}"`
|
||||
- 避免在 XAML 中编写复杂逻辑
|
||||
|
||||
### 依赖注入规范
|
||||
|
||||
1. **服务注册**
|
||||
```csharp
|
||||
// 在 App.xaml.cs 中注册
|
||||
services.AddView<ExamplePage, ExampleViewModel>();
|
||||
services.AddSingleton<IExampleService, ExampleService>();
|
||||
```
|
||||
|
||||
最后,程序能够编译就认为成功,无需实际运行程序。
|
||||
|
||||
编译指令参考,如果出现程序占用场景,直接放弃编译验证即可
|
||||
```
|
||||
dotnet build BetterGenshinImpact.sln -c Debug
|
||||
```
|
||||
@@ -1,62 +0,0 @@
|
||||
---
|
||||
name: "github-issue-triage"
|
||||
description: "Reads GitHub issues, extracts reporter details and <=10MB attachments/images, then decides discuss/research vs direct fix vs implementation plan. Invoke when user shares an issue URL."
|
||||
---
|
||||
|
||||
# GitHub Issue Triage
|
||||
|
||||
用于处理 GitHub issue 链接,并在结合当前仓库代码后给出执行路径。
|
||||
|
||||
## 触发时机
|
||||
|
||||
- 用户提供 GitHub issue URL,并希望你分析内容后继续行动
|
||||
- 需要先读取 issue 创建者信息、附件或图片,再决定如何推进
|
||||
- 需要判断是先讨论研究、直接修复,还是先制定方案
|
||||
|
||||
## 输入
|
||||
|
||||
- 必填:GitHub issue URL,例如 `https://github.com/<owner>/<repo>/issues/<id>`
|
||||
- 可选:用户额外上下文(复现步骤、期望行为、优先级)
|
||||
|
||||
## 执行流程
|
||||
|
||||
1. 读取 issue 内容
|
||||
- 获取标题、正文、标签、状态、创建者、创建时间
|
||||
- 提取创建者在 issue 中提供的关键信息(正文 + 创建者本人评论)
|
||||
- 区分“创建者信息”与“其他参与者讨论”
|
||||
|
||||
2. 收集附件与图片(限制 10MB)
|
||||
- 从 issue 正文和创建者评论中提取附件/图片链接
|
||||
- 对每个链接获取文件大小与类型,只有 `<= 10MB` 才下载
|
||||
- 优先下载图片(png/jpg/jpeg/webp/gif)与问题复现相关附件
|
||||
- 记录已下载与跳过原因(超限、类型不符、不可访问)
|
||||
|
||||
3. 结合代码库研判
|
||||
- 先做高层语义检索定位相关模块,再做符号/关键字精查
|
||||
- 找到与 issue 直接相关的代码路径、入口点、可能影响范围
|
||||
- 判断是否已有类似问题处理逻辑、开关、兜底或已知限制
|
||||
|
||||
4. 路径决策
|
||||
- 讨论研究问题:信息不足、无法稳定复现、需求存在歧义、外部依赖阻塞
|
||||
- 直接修复问题:根因清晰、改动范围可控、验收标准明确
|
||||
- 计划方案:涉及跨模块改造、兼容性权衡、需要分阶段实施
|
||||
|
||||
5. 执行动作
|
||||
- 若“直接修复问题”:直接修改代码并完成必要验证
|
||||
- 若“计划方案”:输出分步计划、影响面、风险与验证策略
|
||||
- 若“讨论研究问题”:给出需要补充的信息与建议实验步骤
|
||||
|
||||
## 输出格式
|
||||
|
||||
- Issue 摘要:标题、创建者、关键诉求、复现线索
|
||||
- 创建者信息提炼:仅保留创建者提供的有效信息
|
||||
- 附件处理结果:下载清单(<=10MB)与跳过清单(含原因)
|
||||
- 代码关联分析:相关模块、关键函数、潜在根因
|
||||
- 决策结论:讨论研究 / 直接修复 / 计划方案
|
||||
- 下一步:立即执行项
|
||||
|
||||
## 质量要求
|
||||
|
||||
- 必须优先依据创建者提供的信息,不被无关评论干扰
|
||||
- 必须在代码层面给出证据,不做纯主观结论
|
||||
- 决策应可执行,并且与当前仓库结构一致
|
||||
@@ -1,142 +0,0 @@
|
||||
---
|
||||
name: "release-note-generator"
|
||||
description: "Generates release notes from git commits/diffs and outputs one Chinese MD file. Invoke when user asks for release notes bounded by previous non-alpha version."
|
||||
---
|
||||
|
||||
# Release Note Generator
|
||||
|
||||
用于基于当前仓库的 git 历史自动生成发布说明,确保不遗漏提交,并为每条变更记录追加提交人的 GitHub ID(`@id`)。默认输出一个 Markdown 文件到 `.trae/documents` 目录:变更内容。
|
||||
|
||||
## 触发时机
|
||||
|
||||
- 用户要求生成 Release Note / 更新日志
|
||||
- 用户要求基于最近提交和实际代码变更做汇总
|
||||
- 用户要求以“上一个非 alpha 版本”为边界统计变更
|
||||
|
||||
## 输入约定
|
||||
|
||||
- 默认分支当前 `HEAD`
|
||||
- 版本边界规则:从最新提交向后遍历,遇到“提交信息包含版本号且不含 alpha”的最近一个提交作为边界
|
||||
- 若用户指定分支、Tag 或版本正则,优先使用用户指定
|
||||
- 未指定时,默认输出文档路径为:`.trae/documents/release_notes-<version>.md`
|
||||
|
||||
## 实战经验(本项目)
|
||||
|
||||
- 不直接依赖终端长输出:大量 `git log` 在终端中容易被截断,导致误判“提交缺失”
|
||||
- 不用 `|` 等普通分隔符解析:提交标题可能包含分隔符,必须使用 NUL 分隔(`\x00`)保证可解析
|
||||
- 统一 UTF-8:PowerShell 下中文提交信息可能乱码,调用 git 时需显式设置输出编码
|
||||
- 避免在 `RunCommand` 的内联脚本中直接硬编码中文常量(标题、分类名、文件名):在 Windows/PowerShell 链路中可能被替换为 `?`
|
||||
- 发布文件名使用 ASCII:不要在文件名中使用中文(如 `ReleaseNotes-变更内容-<version>.md`),否则编码异常时会变成非法字符 `?` 导致写文件失败
|
||||
- 中文文案仅放在 Markdown 内容里,并在写入后做一次乱码校验:若出现 `???`、`### ??` 等占位符,必须重新生成
|
||||
- 明确分支范围:优先使用 `HEAD` 可达历史,必要时用 `--first-parent` 辅助核对发布主线
|
||||
- 先计数再明细:先取 `rev-list --count`,再逐条采集,最后做数量一致性校验
|
||||
- 版本边界要可回退:目标版本不存在时,自动回退到最近可识别的“上一非 alpha 版本”并在结果中声明
|
||||
|
||||
## 日志采集方式(强制)
|
||||
|
||||
- 必须使用 Python 脚本拉取 commit 与 diff,不直接用终端拼接命令产出最终结果
|
||||
- Python 内通过 `subprocess.run([...], check=True, capture_output=True, text=True, encoding="utf-8", errors="replace")` 调 git
|
||||
- git 命令需附加编码参数:`-c i18n.logOutputEncoding=utf8 -c core.quotepath=false`
|
||||
- 提交元数据推荐格式:`--pretty=format:%H%x00%h%x00%an%x00%ae%x00%ad%x00%s%x00`,按 `\x00` 解析
|
||||
- diff 证据至少包含:
|
||||
- 区间总览:`git diff --shortstat <base>..<head>`
|
||||
- 文件变更:`git diff --name-status <base>..<head>`
|
||||
- 行级统计:`git diff --numstat <base>..<head>`
|
||||
- 必要时单提交详情:`git show --name-status --numstat --format= <sha>`
|
||||
- Python 脚本需输出结构化数据(JSON/对象)后再生成 release note 文本
|
||||
- 若通过终端执行 Python,优先将中文文案写成 `\\uXXXX` 形式或由程序运行期拼接,避免命令传输阶段损坏字符
|
||||
|
||||
## 执行流程
|
||||
|
||||
1. 获取提交序列(防遗漏)
|
||||
- 从 `HEAD` 向后扫描提交,定位边界提交 `boundary_commit`
|
||||
- 使用可识别 SemVer 的正则提取版本号(例如 `v1.2.3`、`1.2.3`)
|
||||
- 判断“非 alpha”时使用大小写不敏感匹配:提交信息不包含 `alpha`
|
||||
- 生成统计区间:`(boundary_commit, HEAD]`,边界提交本身不计入变更列表
|
||||
- 使用 Python 执行 git 并解析 NUL 分隔结果,禁止依赖终端显示内容做解析
|
||||
|
||||
2. 完整性校验(必须)
|
||||
- 先取区间提交总数 `N`
|
||||
- 再逐条收集区间内每个 commit 的详情
|
||||
- 输出前校验“已收集条数 == N”,不一致则重新拉取,直到一致
|
||||
- 若存在 merge,额外给出 `--first-parent` 视角的校验结果,避免发布主线理解偏差
|
||||
|
||||
3. 采集每条提交的证据
|
||||
- 提交元数据:hash、标题、作者、时间
|
||||
- 实际改动:由 Python 采集 `--name-status`、`--numstat`、`--shortstat` 与必要 diff 片段
|
||||
- 将提交按功能模块归类(如 UI、任务、配置、脚本、基础设施等)
|
||||
|
||||
4. 提炼发布内容
|
||||
- 先按用户指定分类规则归类;若未指定,使用更接近 GitHub Releases 页面的默认分类顺序:
|
||||
1) 新功能
|
||||
2) 地图遮罩
|
||||
3) 独立任务
|
||||
4) JS相关
|
||||
5) 其他
|
||||
- 分类名尽量贴近业务语义:例如“地图追踪”“自动剧情”“七圣召唤”等可作为二级小节并入对应一级分类
|
||||
- 无法稳定归类的小变更统一放入“其他”
|
||||
- 每条摘要都要可追溯到至少一个 commit
|
||||
- 识别“变更最大点”并在首屏摘要中突出展示
|
||||
- 主体正文只展示可读的变更描述,不在分类正文中堆叠 hash
|
||||
- 完整提交清单放在文末,避免正文可读性下降
|
||||
- 输出文案需去掉 Conventional Commits 前缀:至少移除 `feat:`、`fix:`(区分大小写不敏感),再写入分类正文与完整提交清单
|
||||
|
||||
5. 生成提交人 GitHub ID(逐条记录追加 `@id`)
|
||||
- 必须以“当前方式”解析:对区间内每个 commit 逐条调用 GitHub 提交接口,禁止仅依赖本地 `author name`:
|
||||
- 接口:`https://api.github.com/repos/<owner>/<repo>/commits/<sha>`
|
||||
- 请求头至少包含:`Accept: application/vnd.github+json`、`User-Agent: <custom>`
|
||||
- 解析顺序固定:优先 `author.login`,为空时取 `committer.login`
|
||||
- 必须保证覆盖全量区间提交:
|
||||
- 对每个 SHA 单独请求并记录结果
|
||||
- 输出前校验“已解析 login 数 == 区间提交数”,不一致则进入回退链
|
||||
- 回退链(仅当 API 某条未命中时):
|
||||
- 先用“同区间内已解析结果”做映射回填(同 author email / 同 author name)
|
||||
- 再解析 GitHub noreply 邮箱:
|
||||
- `[email protected]` -> `@login`
|
||||
- `[email protected]` -> `@login`
|
||||
- 再回退 `.atom`:`https://github.com/<owner>/<repo>/commits/<branch>.atom` 按 SHA 匹配 `<entry>` 获取 `<author><name>`
|
||||
- 最后才允许作者名标准化兜底,并明确标记为推断
|
||||
- 为每条变更记录绑定对应作者的 `@id`
|
||||
- 若一条汇总涉及多个 commit,按去重后多作者格式追加:`@id1 @id2`
|
||||
|
||||
## 输出格式(强制,需贴近 GitHub Releases 风格)
|
||||
|
||||
必须产出 1 个文件:
|
||||
|
||||
1. 变更内容文件(全中文)
|
||||
- 文件路径:`.trae/documents/ReleaseNotes-<version>.md`(文件名必须 ASCII)
|
||||
- 内容结构(推荐模板):
|
||||
- 一级标题:`## <version> <版本主题>`(示例:`## 0.58 月之五适配`)
|
||||
- 开场一句话:版本背景或问候语(可选,1~2 句)
|
||||
- 分类正文:按以下顺序输出存在内容的分类:
|
||||
- `新功能`
|
||||
- `地图遮罩`
|
||||
- `独立任务`
|
||||
- `JS相关`
|
||||
- `其他`(必须保留,即使只有 1 条)
|
||||
- 分类内每条为单行 bullet,格式:
|
||||
- `<变更描述> (#PR号可选) @githubId`
|
||||
- 若某条由多人提交,使用:`@id1 @id2`
|
||||
- 文末追加“完整提交清单”(倒序,不能缺项,每条带 `@id`)
|
||||
- 在标题下方补充统计信息:`边界提交 / 区间 / 提交数 / shortstat`
|
||||
|
||||
补充要求:
|
||||
- 变更内容文件必须全中文
|
||||
- 仅内容全中文;文件名必须为 ASCII,避免 Windows 下出现 `?` 非法路径
|
||||
- 风格贴近 GitHub Releases:简洁分段、先讲用户可感知变化,再给完整清单
|
||||
- 正文优先使用自然语言,不直接复制 commit 原文
|
||||
- 分类不允许缺失“其他”
|
||||
- 内容中不保留 `feat:`、`fix:` 前缀
|
||||
- 生成后必须执行乱码检查:若命中 `\\?{2,}` 或 `### \\?+`,视为失败并重生成
|
||||
|
||||
## 质量门槛
|
||||
|
||||
- 不允许遗漏区间内任意 commit
|
||||
- 不允许仅基于 commit 标题,必须结合实际代码改动
|
||||
- 每条变更记录必须带作者 `@id`,不允许只在末尾集中列出
|
||||
- 必须通过 Python 脚本获取日志与 diff,禁止直接依赖终端长输出结果
|
||||
- 解析 `@id` 时必须逐条调用 GitHub Commit API(`/repos/<owner>/<repo>/commits/<sha>`),不得以本地昵称直接替代
|
||||
- 未找到边界版本时,必须明确说明并给出当前采用的兜底范围
|
||||
- 分类默认遵循“新功能 / 地图遮罩 / 独立任务 / JS相关 / 其他”,其中“其他”必须出现
|
||||
- Markdown 文件必须实际落盘到仓库中的 `.trae/documents` 目录
|
||||
- 不允许输出出现乱码占位符(如 `???`、`??` 分类名);发现即判定为不合格
|
||||
@@ -1,86 +0,0 @@
|
||||
本项目使用了 WPF-UI、 CommunityToolkit.Mvvm、Microsoft.Xaml.Behaviors.Wpf 来实现 MVVM 架构。在编写代码的时候请注意:
|
||||
|
||||
### 主要依赖框架
|
||||
#### UI 框架
|
||||
- **WPF-UI (4.0.2)** - 现代化 WPF UI 框架
|
||||
- **gong-wpf-dragdrop(3.2.1)** - 拖拽框架
|
||||
|
||||
#### MVVM 框架
|
||||
- **CommunityToolkit.Mvvm (8.2.2)** - 微软官方 MVVM 工具包
|
||||
- 所有 ViewModel 必须继承自 `ObservableObject`
|
||||
- 使用 `[ObservableProperty]` 特性自动生成属性
|
||||
- 使用 `[RelayCommand]` 特性自动生成命令
|
||||
- **Microsoft.Xaml.Behaviors.Wpf(1.1.122)** - WPF 行为扩展库
|
||||
- 请尽量使用 Behaviors 库来实现交互,避免不符合 MVVM 规范的交互事件触发方式。
|
||||
|
||||
### 其他框架使用要求
|
||||
1. 请优先使用 Newtonsoft.Json 作为json序列化工具,但是如果这个模型已经被System.Text.Json序列化过了,那么就直接使用System.Text.Json反序列化。
|
||||
2. 所有简单的对话框弹出需求优先使用 ThemedMessageBox 弹出。而不是 WPF 自带的 MessageBox。
|
||||
|
||||
## MVVM 架构规则
|
||||
|
||||
### 基础架构
|
||||
|
||||
### ViewModel 编写规范
|
||||
|
||||
1. **继承规则**
|
||||
```csharp
|
||||
public partial class ExampleViewModel : ViewModel
|
||||
{
|
||||
[ObservableProperty]
|
||||
private string _title = "";
|
||||
|
||||
[RelayCommand]
|
||||
private void DoSomething()
|
||||
{
|
||||
// 实现逻辑
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. **属性命名**
|
||||
- 私有字段使用下划线前缀: `_fieldName`
|
||||
- 公共属性使用 PascalCase: `PropertyName`
|
||||
- 使用 `[ObservableProperty]` 自动生成属性
|
||||
|
||||
3. **命令实现**
|
||||
- 使用 `[RelayCommand]` 特性
|
||||
- 异步命令使用 `[RelayCommand]` + `async Task`
|
||||
|
||||
### View 编写规范
|
||||
|
||||
1. **代码后置**
|
||||
```csharp
|
||||
public partial class ExamplePage : UserControl
|
||||
{
|
||||
public ExampleViewModel ViewModel { get; }
|
||||
|
||||
public ExamplePage(ExampleViewModel viewModel)
|
||||
{
|
||||
ViewModel = viewModel;
|
||||
DataContext = this;
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. **XAML 绑定**
|
||||
- 使用 `{Binding}` 语法绑定 ViewModel 属性
|
||||
- 命令绑定: `Command="{Binding ExampleCommand}"`
|
||||
- 避免在 XAML 中编写复杂逻辑
|
||||
|
||||
### 依赖注入规范
|
||||
|
||||
1. **服务注册**
|
||||
```csharp
|
||||
// 在 App.xaml.cs 中注册
|
||||
services.AddView<ExamplePage, ExampleViewModel>();
|
||||
services.AddSingleton<IExampleService, ExampleService>();
|
||||
```
|
||||
|
||||
最后,程序能够编译就认为成功,无需实际运行程序。
|
||||
|
||||
编译指令参考,如果出现程序占用场景,直接放弃编译验证即可
|
||||
```
|
||||
dotnet build BetterGenshinImpact.sln -c Debug
|
||||
```
|
||||
@@ -1,10 +1,7 @@
|
||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=chyan/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=enkanomiya/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Kongying/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=mirrorchan/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=onslaugh/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=retcode/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=serenitea/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=steambird/@EntryIndexedValue">True</s:Boolean>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Teyvat/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=steambird/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -17,7 +17,6 @@
|
||||
|
||||
<FontFamily x:Key="TextThemeFontFamily">/Resources/Fonts/MiSans-Regular.ttf#MiSans</FontFamily>
|
||||
<FontFamily x:Key="DigitalThemeFontFamily">/Resources/Fonts/deluge-led.ttf#Deluge LED</FontFamily>
|
||||
<bgivc:DomainNameToCascadingItemConverter x:Key="DomainNameConverter" />
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<bgivc:BooleanToVisibilityRevertConverter x:Key="BooleanToVisibilityRevertConverter" />
|
||||
<bgivc:BooleanToEnableTextConverter x:Key="BooleanToEnableTextConverter" />
|
||||
@@ -25,9 +24,6 @@
|
||||
<bgivc:NotNullConverter x:Key="NotNullConverter" />
|
||||
<bgivc:EnumToKVPConverter x:Key="EnumToKVPConverter" />
|
||||
<bgivc:CultureInfoNameToKVPConverter x:Key="CultureInfoNameToKVPConverter" />
|
||||
<bgivc:StringToColorConverter x:Key="StringToColorConverter" />
|
||||
<bgivc:TrConverter x:Key="TrConverter" />
|
||||
<bgivc:AdaptiveUniformGridColumnsConverter x:Key="AdaptiveUniformGridColumnsConverter" />
|
||||
<Style BasedOn="{StaticResource DefaultTextBoxStyle}" TargetType="{x:Type TextBox}">
|
||||
<Setter Property="behavior:ClipboardInterceptor.EnableSafeClipboard" Value="True" />
|
||||
</Style>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
@@ -21,8 +20,6 @@ using BetterGenshinImpact.View.Pages;
|
||||
using BetterGenshinImpact.ViewModel;
|
||||
using BetterGenshinImpact.ViewModel.Pages;
|
||||
using BetterGenshinImpact.ViewModel.Pages.View;
|
||||
using LazyCache;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -31,13 +28,8 @@ using Serilog.Events;
|
||||
using Serilog.Sinks.RichTextBox.Abstraction;
|
||||
using Wpf.Ui;
|
||||
using Wpf.Ui.DependencyInjection;
|
||||
using Wpf.Ui.Violeta.Appearance;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
|
||||
// Wine 平台适配
|
||||
using BetterGenshinImpact.Platform.Wine;
|
||||
using BetterGenshinImpact.Service.Tavern;
|
||||
|
||||
namespace BetterGenshinImpact;
|
||||
|
||||
public partial class App : Application
|
||||
@@ -52,7 +44,8 @@ public partial class App : Application
|
||||
.UseElevated()
|
||||
.UseSingleInstance("BetterGI")
|
||||
.ConfigureLogging(builder => { builder.ClearProviders(); })
|
||||
.ConfigureServices((context, services) =>
|
||||
.ConfigureServices(
|
||||
(context, services) =>
|
||||
{
|
||||
// 提前初始化配置
|
||||
var configService = new ConfigService();
|
||||
@@ -73,7 +66,7 @@ public partial class App : Application
|
||||
rollingInterval: RollingInterval.Day,
|
||||
retainedFileCountLimit: 31,
|
||||
retainedFileTimeLimit: TimeSpan.FromDays(21))
|
||||
.WriteTo.Console(outputTemplate:
|
||||
.WriteTo.Console(outputTemplate:
|
||||
"[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}")
|
||||
.MinimumLevel.Debug()
|
||||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning)
|
||||
@@ -85,25 +78,7 @@ public partial class App : Application
|
||||
}
|
||||
|
||||
Log.Logger = loggerConfiguration.CreateLogger();
|
||||
services.AddSingleton<IMissingTranslationReporter, SupabaseMissingTranslationReporter>();
|
||||
services.AddSingleton<ITranslationService, JsonTranslationService>();
|
||||
|
||||
services.AddLogging(c => c.AddSerilog());
|
||||
// if ("zh-Hans".Equals(all.OtherConfig.UiCultureInfoName, StringComparison.OrdinalIgnoreCase))
|
||||
// {
|
||||
// services.AddLogging(c => c.AddSerilog());
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// services.AddLogging(logging =>
|
||||
// {
|
||||
// logging.ClearProviders();
|
||||
// logging.SetMinimumLevel(LogLevel.Debug);
|
||||
// logging.AddFilter("Microsoft", LogLevel.Warning);
|
||||
// logging.AddFilter("Microsoft.Hosting.Lifetime", LogLevel.Warning);
|
||||
// logging.Services.AddSingleton<ILoggerProvider, TranslatingSerilogLoggerProvider>();
|
||||
// });
|
||||
// }
|
||||
|
||||
services.AddLocalization();
|
||||
|
||||
@@ -159,21 +134,12 @@ public partial class App : Application
|
||||
services.AddSingleton<HutaoNamedPipe>();
|
||||
services.AddSingleton<BgiOnnxFactory>();
|
||||
services.AddSingleton<OcrFactory>();
|
||||
services.AddMemoryCache();
|
||||
services.AddSingleton<IAppCache, CachingService>();
|
||||
services.AddSingleton<MemoryFileCache>();
|
||||
services.AddSingleton<IMihoyoMapApiService, MihoyoMapApiService>();
|
||||
services.AddSingleton<IKongyingTavernApiService, KongyingTavernApiService>();
|
||||
services.AddSingleton<IHoYoLabMapApiService, HoYoLabMapApiService>();
|
||||
services.AddSingleton<IMaskMapPointService, MaskMapPointService>();
|
||||
|
||||
|
||||
services.AddSingleton(TimeProvider.System);
|
||||
services.AddSingleton<IServerTimeProvider, ServerTimeProvider>();
|
||||
|
||||
// Configuration
|
||||
//services.Configure<AppConfig>(context.Configuration.GetSection(nameof(AppConfig)));
|
||||
|
||||
I18N.Culture = new CultureInfo("zh-Hans"); // #1846
|
||||
}
|
||||
)
|
||||
.Build();
|
||||
@@ -210,8 +176,6 @@ public partial class App : Application
|
||||
/// </summary>
|
||||
protected override async void OnStartup(StartupEventArgs e)
|
||||
{
|
||||
// Wine 平台适配
|
||||
WinePlatformAddon.ApplyApplicationConfig();
|
||||
base.OnStartup(e);
|
||||
|
||||
try
|
||||
@@ -225,19 +189,10 @@ public partial class App : Application
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// DEBUG only, no overhead
|
||||
Debug.WriteLine(ex);
|
||||
ConsoleHelper.WriteError($"应用程序启动失败: {ex.Message}");
|
||||
|
||||
try
|
||||
{
|
||||
HandleException(ex);
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
Debug.WriteLine(ex2);
|
||||
ConsoleHelper.WriteError($"应用程序启动失败打印日志时又失败了: {ex2.Message}");
|
||||
}
|
||||
|
||||
if (Debugger.IsAttached)
|
||||
{
|
||||
Debugger.Break();
|
||||
@@ -253,12 +208,12 @@ public partial class App : Application
|
||||
base.OnExit(e);
|
||||
|
||||
ConsoleHelper.WriteLine("BetterGI 应用程序正在关闭...");
|
||||
|
||||
|
||||
TempManager.CleanUp();
|
||||
|
||||
await _host.StopAsync();
|
||||
_host.Dispose();
|
||||
|
||||
|
||||
// 释放控制台窗口
|
||||
ConsoleHelper.FreeConsoleWindow();
|
||||
}
|
||||
@@ -282,12 +237,6 @@ public partial class App : Application
|
||||
{
|
||||
try
|
||||
{
|
||||
// 忽略V8引擎释放后pending的Task回调抛出的异常
|
||||
if (IsV8EngineReleasedException(e.Exception))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
HandleException(e.Exception);
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -300,21 +249,6 @@ public partial class App : Application
|
||||
}
|
||||
}
|
||||
|
||||
private static bool IsV8EngineReleasedException(Exception? ex)
|
||||
{
|
||||
while (ex != null)
|
||||
{
|
||||
if (ex.Message?.Contains("V8 object has been released") == true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
ex = ex.InnerException;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//非UI线程未捕获异常处理事件(例如自己创建的一个子线程)
|
||||
private static void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs e)
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<Version>0.60.2-alpha.4</Version>
|
||||
<Version>0.53.2-alpha.1</Version>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
|
||||
@@ -43,9 +43,9 @@
|
||||
|
||||
|
||||
<PackageReference Include="BetterGI.VCRuntime" Version="14.44.35208" />
|
||||
<PackageReference Include="BetterGI.Assets.Map" Version="1.0.19" />
|
||||
<PackageReference Include="BetterGI.Assets.Model" Version="1.0.22" />
|
||||
<PackageReference Include="BetterGI.Assets.Other" Version="1.0.15" />
|
||||
<PackageReference Include="BetterGI.Assets.Map" Version="1.0.13" />
|
||||
<PackageReference Include="BetterGI.Assets.Model" Version="1.0.15" />
|
||||
<PackageReference Include="BetterGI.Assets.Other" Version="1.0.10" />
|
||||
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="DeviceId" Version="6.9.0" />
|
||||
@@ -53,11 +53,9 @@
|
||||
<PackageReference Include="DeviceId.Windows.Wmi" Version="6.9.0" />
|
||||
<PackageReference Include="Emoji.Wpf" Version="0.3.4" />
|
||||
<PackageReference Include="LibGit2Sharp" Version="0.31.0" />
|
||||
<PackageReference Include="LazyCache" Version="2.4.0" />
|
||||
<PackageReference Include="MailKit" Version="4.14.0" />
|
||||
<PackageReference Include="Meziantou.Framework.Win32.CredentialManager" Version="1.7.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.4" />
|
||||
@@ -67,7 +65,7 @@
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.21.0" />
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
|
||||
<PackageReference Include="MimeKit" Version="4.15.1" />
|
||||
<PackageReference Include="MimeKit" Version="4.14.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
|
||||
<PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.11.0.20250507" />
|
||||
@@ -84,18 +82,16 @@
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.RichTextBoxEx.Wpf" Version="1.1.0.1" />
|
||||
<!-- <PackageReference Include="supabase-csharp" Version="0.16.2" />-->
|
||||
<PackageReference Include="System.Drawing.Common" Version="10.0.7" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="9.0.5" />
|
||||
<PackageReference Include="System.IO.Hashing" Version="9.0.4" />
|
||||
<PackageReference Include="TorchSharp" Version="0.105.0" />
|
||||
<PackageReference Include="Vanara.PInvoke.NtDll" Version="4.1.3" />
|
||||
<PackageReference Include="Vanara.PInvoke.SHCore" Version="4.1.3" />
|
||||
<PackageReference Include="Vanara.PInvoke.User32" Version="4.1.3" />
|
||||
<PackageReference Include="XamlAnimatedGif" Version="2.3.1" />
|
||||
<PackageReference Include="WPF-UI" Version="4.3.0" />
|
||||
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.3.0" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="4.3.0" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="4.3.0.0" />
|
||||
<PackageReference Include="WPF-UI" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="4.0.2.3" />
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
|
||||
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
||||
<PackageReference Include="YoloSharp" Version="6.0.3" />
|
||||
@@ -129,9 +125,6 @@
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoLeyLineOutcrop\Assets\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\LogParse\Assets\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
@@ -198,12 +191,6 @@
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\in_domain.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoDomain\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\I18n\en.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -0,0 +1,588 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<AssemblyName>BetterGI</AssemblyName>
|
||||
<IntermediateOutputPath>obj\x64\Debug\</IntermediateOutputPath>
|
||||
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
|
||||
<MSBuildProjectExtensionsPath>D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\</MSBuildProjectExtensionsPath>
|
||||
<_TargetAssemblyProjectName>BetterGenshinImpact</_TargetAssemblyProjectName>
|
||||
<RootNamespace>BetterGenshinImpact</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
|
||||
<PropertyGroup>
|
||||
<Version>0.51.1-alpha.1</Version>
|
||||
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<UseWPF>true</UseWPF>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<LangVersion>12.0</LangVersion>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ApplicationIcon>Resources\Images\logo.ico</ApplicationIcon>
|
||||
<Platforms>x64</Platforms>
|
||||
<DebugType>embedded</DebugType>
|
||||
</PropertyGroup>
|
||||
<!-- <ItemGroup>
|
||||
<None Remove="Assets\Images\*.jpg" />
|
||||
<None Remove="Assets\Images\*" />
|
||||
<None Remove="Assets\Images\*.png" />
|
||||
<None Remove="Assets\Images\*.ico" />
|
||||
<None Remove="Assets\Fonts\*.ttf" />
|
||||
<None Remove="Assets\Highlighting\*.xshd" />
|
||||
<None Remove="Assets\Strings\*.html" />
|
||||
<None Remove="Assets\Strings\*.md" />
|
||||
<None Remove="Assets\Audios\*.mp3" />
|
||||
<None Update="Assets\Config\*"/>
|
||||
</ItemGroup>-->
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AvalonEdit" Version="6.3.1.120" />
|
||||
<PackageReference Include="BehaviourTree" Version="1.0.73" />
|
||||
<PackageReference Include="BetterGI.VCRuntime" Version="14.44.35208" />
|
||||
<PackageReference Include="BetterGI.Assets.Map" Version="1.0.12" />
|
||||
<PackageReference Include="BetterGI.Assets.Model" Version="1.0.12" />
|
||||
<PackageReference Include="BetterGI.Assets.Other" Version="1.0.9" />
|
||||
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||
<PackageReference Include="DeviceId" Version="6.9.0" />
|
||||
<PackageReference Include="DeviceId.Windows" Version="6.9.0" />
|
||||
<PackageReference Include="DeviceId.Windows.Wmi" Version="6.9.0" />
|
||||
<PackageReference Include="Emoji.Wpf" Version="0.3.4" />
|
||||
<PackageReference Include="LibGit2Sharp" Version="0.31.0" />
|
||||
<PackageReference Include="Meziantou.Framework.Win32.CredentialManager" Version="1.7.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Localization" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.4" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.DirectML" Version="1.21.0" />
|
||||
<!--排除掉cpu的runtime dll-->
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime" Version="1.21.0" IncludeAssets="none" />
|
||||
<PackageReference Include="Microsoft.ML.OnnxRuntime.Managed" Version="1.21.0" />
|
||||
<PackageReference Include="Microsoft.Toolkit.Uwp.Notifications" Version="7.1.3" />
|
||||
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2592.51" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||
<PackageReference Include="Ookii.Dialogs.Wpf" Version="5.0.1" />
|
||||
<PackageReference Include="OpenCvSharp4.WpfExtensions" Version="4.11.0.20250507" />
|
||||
<PackageReference Include="OpenCvSharp4.Extensions" Version="4.11.0.20250507" />
|
||||
<PackageReference Include="OpenCvSharp4.Windows" Version="4.11.0.20250507" />
|
||||
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.122" />
|
||||
<PackageReference Include="Microsoft.ClearScript.V8" Version="7.4.5" />
|
||||
<PackageReference Include="Microsoft.ClearScript.V8.Native.win-x64" Version="7.4.5" />
|
||||
<PackageReference Include="MouseKeyHook" Version="5.7.1" />
|
||||
<PackageReference Include="PresentMonFps" Version="2.0.5" />
|
||||
<PackageReference Include="Sdl.MultiSelectComboBox" Version="1.0.103" />
|
||||
<PackageReference Include="Semver" Version="3.0.0" />
|
||||
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.RichTextBoxEx.Wpf" Version="1.1.0.1" />
|
||||
<PackageReference Include="System.Drawing.Common" Version="9.0.5" />
|
||||
<PackageReference Include="System.IO.Hashing" Version="9.0.4" />
|
||||
<PackageReference Include="TorchSharp" Version="0.105.0" />
|
||||
<PackageReference Include="Vanara.PInvoke.NtDll" Version="4.1.3" />
|
||||
<PackageReference Include="Vanara.PInvoke.SHCore" Version="4.1.3" />
|
||||
<PackageReference Include="Vanara.PInvoke.User32" Version="4.1.3" />
|
||||
<PackageReference Include="WPF-UI" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.DependencyInjection" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.Tray" Version="4.0.2" />
|
||||
<PackageReference Include="WPF-UI.Violeta" Version="4.0.2.3" />
|
||||
<PackageReference Include="gong-wpf-dragdrop" Version="3.2.1" />
|
||||
<PackageReference Include="YamlDotNet" Version="16.3.0" />
|
||||
<PackageReference Include="YoloSharp" Version="6.0.3" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Configuration)' == 'Debug'">
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Fischless.GameCapture\Fischless.GameCapture.csproj" />
|
||||
<ProjectReference Include="..\Fischless.HotkeyCapture\Fischless.HotkeyCapture.csproj" />
|
||||
<ProjectReference Include="..\Fischless.WindowsInput\Fischless.WindowsInput.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="Assets\Map\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Model\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets\Config\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFight\Assets\combat_avatar.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoFishing\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\LogParse\Assets\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoGeniusInvokation\Assets\tcg_character_card.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoPick\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoSkip\Assets\hangout.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoTrackPath\Assets\tp.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\Json\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoWood\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoMusicGame\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\GameLoading\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickTeleport\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickSereniteaPot\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\AutoEat\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\QuickBuy\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\UseRedeemCode\Assets\1920x1080\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="User\**">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\LogParse\Assets\log.css">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\LogParse\Assets\log.js">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\GameLoading\Assets\1920x1080\enter_game.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="GameTask\Common\Element\Assets\1920x1080\in_domain.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="GameTask\OneDragon\" />
|
||||
<Folder Include="GameTask\UseRedeemCode\Assets\1920x1080\" />
|
||||
<Folder Include="Resources\" />
|
||||
<Folder Include="Service\Notification\Builder\" />
|
||||
<Folder Include="User\AutoPathing\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="View\Windows\WelcomeDialog.xaml.cs">
|
||||
<SubType>Code</SubType>
|
||||
<DependentUpon>WelcomeDialog.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<_DeploymentManifestIconFile Remove="Resources\Images\logo.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\Accessibility.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\behaviourtree\1.0.73\lib\netstandard1.0\BehaviourTree.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\bettergi.assets.map\1.0.12\lib\net8.0\BetterGI.Assets.Map.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\bettergi.assets.model\1.0.12\lib\net8.0\BetterGI.Assets.Model.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\bettergi.assets.other\1.0.9\lib\net8.0\BetterGI.Assets.Other.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\bettergi.vcruntime\14.44.35208\lib\net8.0\BetterGI.VCRuntime.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.clearscript.core\7.4.5\lib\net5.0\ClearScript.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.clearscript.v8\7.4.5\lib\net5.0\ClearScript.V8.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.clearscript.v8.icudata\7.4.5\lib\netstandard1.0\ClearScript.V8.ICUData.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\clipper2\1.4.0\lib\netstandard2.0\Clipper2Lib.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\communitytoolkit.mvvm\8.2.2\lib\net6.0\CommunityToolkit.Mvvm.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\deviceid\6.9.0\lib\net8.0\DeviceId.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\deviceid.windows\6.9.0\lib\net8.0-windows10.0.17763\DeviceId.Windows.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\deviceid.windows.wmi\6.9.0\lib\net8.0\DeviceId.Windows.Wmi.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.diagnostics.tracing.traceevent\3.1.13\lib\netstandard2.0\Dia2Lib.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\emoji.wpf\0.3.4\lib\netcoreapp3.1\Emoji.Wpf.dll" />
|
||||
<ReferencePath Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\Fischless.GameCapture\bin\x64\Debug\net8.0-windows10.0.22621.0\Fischless.GameCapture.dll" />
|
||||
<ReferencePath Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\Fischless.HotkeyCapture\bin\x64\Debug\net8.0-windows10.0.22621.0\Fischless.HotkeyCapture.dll" />
|
||||
<ReferencePath Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\Fischless.WindowsInput\bin\x64\Debug\netstandard2.0\Fischless.WindowsInput.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\mousekeyhook\5.7.1\lib\net7.0-windows7.0\Gma.System.MouseKeyHook.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\gong-wpf-dragdrop\3.2.1\lib\net6.0-windows7.0\GongSolutions.WPF.DragDrop.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\google.protobuf\3.21.9\lib\net5.0\Google.Protobuf.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\avalonedit\6.3.1.120\lib\net8.0-windows7.0\ICSharpCode.AvalonEdit.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpziplib\1.4.0\lib\net6.0\ICSharpCode.SharpZipLib.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\libgit2sharp\0.31.0\lib\net8.0\LibGit2Sharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\meziantou.framework.win32.credentialmanager\1.7.4\lib\net8.0\Meziantou.Framework.Win32.CredentialManager.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\Microsoft.CSharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.diagnostics.tracing.traceevent\3.1.13\lib\netstandard2.0\Microsoft.Diagnostics.FastSerialization.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.diagnostics.tracing.traceevent\3.1.13\lib\netstandard2.0\Microsoft.Diagnostics.Tracing.TraceEvent.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.binder\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.Binder.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.commandline\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.CommandLine.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.environmentvariables\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.EnvironmentVariables.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.fileextensions\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.FileExtensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.json\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.Json.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.configuration.usersecrets\9.0.4\lib\net8.0\Microsoft.Extensions.Configuration.UserSecrets.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.dependencyinjection.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.dependencyinjection\9.0.4\lib\net8.0\Microsoft.Extensions.DependencyInjection.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.diagnostics.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.Diagnostics.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.diagnostics\9.0.4\lib\net8.0\Microsoft.Extensions.Diagnostics.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.fileproviders.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.FileProviders.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.fileproviders.physical\9.0.4\lib\net8.0\Microsoft.Extensions.FileProviders.Physical.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.filesystemglobbing\9.0.4\lib\net8.0\Microsoft.Extensions.FileSystemGlobbing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.hosting.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.Hosting.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.hosting\9.0.4\lib\net8.0\Microsoft.Extensions.Hosting.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.localization.abstractions\9.0.4\lib\netstandard2.0\Microsoft.Extensions.Localization.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.localization\9.0.4\lib\netstandard2.0\Microsoft.Extensions.Localization.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.abstractions\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.configuration\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.Configuration.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.console\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.Console.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.debug\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.Debug.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.eventlog\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.EventLog.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.eventsource\9.0.4\lib\net8.0\Microsoft.Extensions.Logging.EventSource.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.options.configurationextensions\9.0.4\lib\net8.0\Microsoft.Extensions.Options.ConfigurationExtensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.options\9.0.4\lib\net8.0\Microsoft.Extensions.Options.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.extensions.primitives\9.0.4\lib\net8.0\Microsoft.Extensions.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.ml.onnxruntime.managed\1.21.0\lib\net8.0\Microsoft.ML.OnnxRuntime.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.toolkit.uwp.notifications\7.1.3\lib\net5.0-windows10.0.17763\Microsoft.Toolkit.Uwp.Notifications.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\Microsoft.VisualBasic.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\Microsoft.VisualBasic.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\Microsoft.VisualBasic.Forms.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.web.webview2\1.0.2592.51\lib\netcoreapp3.0\Microsoft.Web.WebView2.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.web.webview2\1.0.2592.51\lib\netcoreapp3.0\Microsoft.Web.WebView2.WinForms.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.web.webview2\1.0.2592.51\lib\netcoreapp3.0\Microsoft.Web.WebView2.Wpf.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\Microsoft.Win32.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\Microsoft.Win32.Registry.AccessControl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\Microsoft.Win32.Registry.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.win32.systemevents\9.0.5\lib\net8.0\Microsoft.Win32.SystemEvents.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windows.sdk.net.ref\10.0.22621.54\lib\net8.0\Microsoft.Windows.SDK.NET.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.xaml.behaviors.wpf\1.1.122\lib\net6.0-windows7.0\Microsoft.Xaml.Behaviors.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\mscorlib.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\netstandard.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\newtonsoft.json\13.0.3\lib\net6.0\Newtonsoft.Json.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\ookii.dialogs.wpf\5.0.1\lib\net6.0-windows7.0\Ookii.Dialogs.Wpf.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\opencvsharp4\4.11.0.20250507\lib\net6.0\OpenCvSharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\opencvsharp4.extensions\4.11.0.20250507\lib\net6.0\OpenCvSharp.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\opencvsharp4.wpfextensions\4.11.0.20250507\lib\net6.0\OpenCvSharp.WpfExtensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationCore.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.Aero.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.Aero2.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.AeroLite.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.Classic.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.Luna.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationFramework.Royale.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\PresentationUI.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\presentmonfps\2.0.5\lib\netstandard2.0\PresentMonFps.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\ReachFramework.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sdl.multiselectcombobox\1.0.103\lib\net6.0-windows7.0\Sdl.MultiSelectComboBox.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\semver\3.0.0\lib\net5.0\Semver.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\serilog\4.2.0\lib\net8.0\Serilog.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\serilog.extensions.logging\9.0.1\lib\net8.0\Serilog.Extensions.Logging.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\serilog.sinks.console\6.0.0\lib\net8.0\Serilog.Sinks.Console.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\serilog.sinks.file\6.0.0\lib\net8.0\Serilog.Sinks.File.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\serilog.sinks.richtextboxex.wpf\1.1.0.1\lib\net8.0-windows7.0\Serilog.Sinks.RichTextBoxEx.Wpf.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpdx.d3dcompiler\4.2.0\lib\netstandard1.1\SharpDX.D3DCompiler.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpdx.direct3d11\4.2.0\lib\netstandard1.1\SharpDX.Direct3D11.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpdx.directinput\4.2.0\lib\netstandard1.3\SharpDX.DirectInput.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpdx\4.2.0\lib\netstandard1.1\SharpDX.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sharpdx.dxgi\4.2.0\lib\netstandard1.1\SharpDX.DXGI.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sixlabors.fonts\2.0.8\lib\net6.0\SixLabors.Fonts.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sixlabors.imagesharp\3.1.7\lib\net6.0\SixLabors.ImageSharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\sixlabors.imagesharp.drawing\2.1.5\lib\net6.0\SixLabors.ImageSharp.Drawing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\skiasharp\2.88.6\lib\net6.0\SkiaSharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\stfu\0.1.1\lib\netcoreapp3.1\Stfu.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.AppContext.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Buffers.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.codedom\9.0.3\lib\net8.0\System.CodeDom.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Collections.Concurrent.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Collections.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Collections.Immutable.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Collections.NonGeneric.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Collections.Specialized.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.Annotations.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.DataAnnotations.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.EventBasedAsync.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ComponentModel.TypeConverter.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Configuration.ConfigurationManager.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Configuration.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Console.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Data.Common.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Data.DataSetExtensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Data.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Design.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.Contracts.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.Debug.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.diagnostics.diagnosticsource\9.0.4\lib\net8.0\System.Diagnostics.DiagnosticSource.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.diagnostics.eventlog\9.0.4\lib\net8.0\System.Diagnostics.EventLog.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.FileVersionInfo.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Diagnostics.PerformanceCounter.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.Process.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.StackTrace.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.TextWriterTraceListener.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.Tools.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.TraceSource.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Diagnostics.Tracing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.DirectoryServices.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.drawing.common\9.0.5\lib\net8.0\System.Drawing.Common.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Drawing.Design.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Drawing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Drawing.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Dynamic.Runtime.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Formats.Asn1.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Formats.Tar.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Globalization.Calendars.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Globalization.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Globalization.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Compression.Brotli.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Compression.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Compression.FileSystem.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Compression.ZipFile.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.FileSystem.AccessControl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.FileSystem.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.FileSystem.DriveInfo.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.FileSystem.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.FileSystem.Watcher.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.io.hashing\9.0.4\lib\net8.0\System.IO.Hashing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.IsolatedStorage.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.MemoryMappedFiles.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.IO.Packaging.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.io.pipelines\9.0.4\lib\net8.0\System.IO.Pipelines.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Pipes.AccessControl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.Pipes.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.IO.UnmanagedMemoryStream.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Linq.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Linq.Expressions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Linq.Parallel.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Linq.Queryable.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.management\9.0.3\lib\net8.0\System.Management.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Memory.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Http.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Http.Json.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.HttpListener.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Mail.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.NameResolution.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.NetworkInformation.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Ping.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Quic.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Requests.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Security.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.ServicePoint.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.Sockets.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.WebClient.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.WebHeaderCollection.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.WebProxy.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.WebSockets.Client.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Net.WebSockets.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Numerics.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.numerics.tensors\9.0.0\lib\net8.0\System.Numerics.Tensors.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Numerics.Vectors.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ObjectModel.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Printing.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.drawing.common\9.0.5\lib\net8.0\System.Private.Windows.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.DispatchProxy.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Emit.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Emit.ILGeneration.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Emit.Lightweight.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Metadata.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Reflection.TypeExtensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Resources.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Resources.Reader.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Resources.ResourceManager.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Resources.Writer.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.CompilerServices.Unsafe.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.CompilerServices.VisualC.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Handles.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.InteropServices.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.InteropServices.JavaScript.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.InteropServices.RuntimeInformation.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Intrinsics.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Loader.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Numerics.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Serialization.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Serialization.Formatters.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Serialization.Json.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Serialization.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Runtime.Serialization.Xml.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.AccessControl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Claims.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Algorithms.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Cng.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Csp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Encoding.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.OpenSsl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Pkcs.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.ProtectedData.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.X509Certificates.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Security.Cryptography.Xml.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Security.Permissions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Principal.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.Principal.Windows.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Security.SecureString.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ServiceModel.Web.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ServiceProcess.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Text.Encoding.CodePages.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Text.Encoding.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Text.Encoding.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.text.encodings.web\9.0.4\lib\net8.0\System.Text.Encodings.Web.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\system.text.json\9.0.4\lib\net8.0\System.Text.Json.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Text.RegularExpressions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Threading.AccessControl.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Channels.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Overlapped.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Tasks.Dataflow.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Tasks.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Tasks.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Tasks.Parallel.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Thread.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.ThreadPool.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Threading.Timer.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Transactions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Transactions.Local.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.ValueTuple.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Web.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Web.HttpUtility.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Controls.Ribbon.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Windows.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Forms.Design.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Forms.Design.Editors.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Forms.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Forms.Primitives.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Input.Manipulations.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Windows.Presentation.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\System.Xaml.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.Linq.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.ReaderWriter.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.Serialization.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.XDocument.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.XmlDocument.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.XmlSerializer.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.XPath.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\ref\net8.0\System.Xml.XPath.XDocument.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\torchsharp\0.105.0\lib\net6.0\TorchSharp.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.diagnostics.tracing.traceevent\3.1.13\lib\netstandard2.0\TraceReloggerLib.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\emoji.wpf\0.3.4\lib\netcoreapp3.1\Typography.GlyphLayout.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\emoji.wpf\0.3.4\lib\netcoreapp3.1\Typography.OpenFont.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\UIAutomationClient.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\UIAutomationClientSideProviders.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\UIAutomationProvider.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\UIAutomationTypes.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.core\4.1.3\lib\net8.0-windows7.0\Vanara.Core.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.dwmapi\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.DwmApi.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.gdi32\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.Gdi32.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.kernel32\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.Kernel32.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.ntdll\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.NtDll.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.shared\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.Shared.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.shcore\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.SHCore.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.pinvoke.user32\4.1.3\lib\net8.0-windows7.0\Vanara.PInvoke.User32.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\vanara.windows.extensions\4.1.3\lib\net8.0-windows7.0\Vanara.Windows.Extensions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\WindowsBase.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\ref\net8.0\WindowsFormsIntegration.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\microsoft.windows.sdk.net.ref\10.0.22621.54\lib\net8.0\WinRT.Runtime.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\wpf-ui.abstractions\4.0.2\lib\net8.0\Wpf.Ui.Abstractions.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\wpf-ui.dependencyinjection\4.0.2\lib\net8.0\Wpf.Ui.DependencyInjection.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\wpf-ui\4.0.2\lib\net8.0-windows7.0\Wpf.Ui.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\wpf-ui.tray\4.0.2\lib\net8.0-windows7.0\Wpf.Ui.Tray.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\wpf-ui.violeta\4.0.2.3\lib\net8.0-windows7.0\Wpf.Ui.Violeta.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\yamldotnet\16.3.0\lib\net8.0\YamlDotNet.dll" />
|
||||
<ReferencePath Include="E:\HuiSomething\NugetPackages\yolosharp\6.0.3\lib\net8.0\YoloSharp.dll" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\CaptureTestWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\MainWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\MaskWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\CommonSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\HomePage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\HotkeyPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\JsListPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\KeyBindingsSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\KeyMouseRecordPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\MacroSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\MapPathingPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\NotificationSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragonFlowPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\CraftPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\DailyCommissionPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\DailyRewardPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\DomainPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\ForgingPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\LeyLineBlossomPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\MailPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\SereniteaPotPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\OneDragon\TcgPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\ScriptControlPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\TaskSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\TriggerSettingsPage.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\View\HardwareAccelerationView.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\View\PathingConfigView.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Pages\View\ScriptGroupConfigView.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\PickerWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\AboutWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\CheckUpdateWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\Editable\ScriptGroupProjectEditor.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\JsonMonoDialog.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\KeyBindingsWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\MapPathingDevWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\MapViewer.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\OcrDialog.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\PromptDialog.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\ScriptRepoWindow.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\View\Windows\WelcomeDialog.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\App.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\BetterGI_Content.g.cs" />
|
||||
<Compile Include="D:\HuiPrograming\Projects\CSharp\MiHoYo\BetterGenshinImpact\BetterGenshinImpact\obj\x64\Debug\net8.0-windows10.0.22621.0\GeneratedInternalTypeHelper.g.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Analyzer Include="C:\Users\huiyadanli\.dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.CSharp.NetAnalyzers.dll" />
|
||||
<Analyzer Include="C:\Users\huiyadanli\.dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk\targets\..\analyzers\Microsoft.CodeAnalysis.NetAnalyzers.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\communitytoolkit.mvvm\8.2.2\analyzers\dotnet\roslyn4.3\cs\CommunityToolkit.Mvvm.CodeFixers.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\communitytoolkit.mvvm\8.2.2\analyzers\dotnet\roslyn4.3\cs\CommunityToolkit.Mvvm.SourceGenerators.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.extensions.logging.abstractions\9.0.4\analyzers\dotnet\roslyn4.4\cs\Microsoft.Extensions.Logging.Generators.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.extensions.options\9.0.4\analyzers\dotnet\roslyn4.4\cs\Microsoft.Extensions.Options.SourceGeneration.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\system.text.json\9.0.4\analyzers\dotnet\roslyn4.4\cs\System.Text.Json.SourceGeneration.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\analyzers/dotnet/cs/Microsoft.Interop.ComInterfaceGenerator.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\analyzers/dotnet/cs/Microsoft.Interop.JavaScript.JSImportGenerator.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\analyzers/dotnet/cs/Microsoft.Interop.LibraryImportGenerator.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\analyzers/dotnet/cs/Microsoft.Interop.SourceGeneration.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.netcore.app.ref\8.0.11\analyzers/dotnet/cs/System.Text.RegularExpressions.Generator.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\analyzers/dotnet/System.Windows.Forms.Analyzers.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.windowsdesktop.app.ref\8.0.11\analyzers/dotnet/cs/System.Windows.Forms.Analyzers.CSharp.dll" />
|
||||
<Analyzer Include="E:\HuiSomething\NugetPackages\microsoft.windows.sdk.net.ref\10.0.22621.54\analyzers/dotnet/cs/WinRT.SourceGenerator.dll" />
|
||||
</ItemGroup>
|
||||
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
|
||||
</Project>
|
||||
@@ -208,16 +208,4 @@ public class BvLocator
|
||||
RetryAction = action;
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 为 JavaScript 提供的动态参数重载
|
||||
/// 解决 ClearScript 无法将 JS 函数隐式转换为 Action 委托的问题
|
||||
/// </summary>
|
||||
/// <param name="action">JS 回调函数</param>
|
||||
/// <returns></returns>
|
||||
public BvLocator WithRetryAction(dynamic action)
|
||||
{
|
||||
RetryAction = (results) => action(results);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoCook;
|
||||
using BetterGenshinImpact.GameTask.AutoDomain;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using BetterGenshinImpact.GameTask.AutoFishing;
|
||||
@@ -21,10 +22,6 @@ using BetterGenshinImpact.GameTask.AutoArtifactSalvage;
|
||||
using BetterGenshinImpact.GameTask.AutoStygianOnslaught;
|
||||
using BetterGenshinImpact.GameTask.GetGridIcons;
|
||||
using BetterGenshinImpact.GameTask.AutoEat;
|
||||
using BetterGenshinImpact.GameTask.AutoLeyLineOutcrop;
|
||||
using BetterGenshinImpact.GameTask.AutoCook;
|
||||
using BetterGenshinImpact.GameTask.MapMask;
|
||||
using BetterGenshinImpact.GameTask.SkillCd;
|
||||
using BetterGenshinImpact.GameTask.UseRedeemCode;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
@@ -129,6 +126,11 @@ public partial class AllConfig : ObservableObject
|
||||
/// </summary>
|
||||
public QuickTeleportConfig QuickTeleportConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动烹饪配置
|
||||
/// </summary>
|
||||
public AutoCookConfig AutoCookConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动打牌配置
|
||||
/// </summary>
|
||||
@@ -169,24 +171,7 @@ public partial class AllConfig : ObservableObject
|
||||
/// 自动吃药配置
|
||||
/// </summary>
|
||||
public AutoEatConfig AutoEatConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动地脉花配置
|
||||
/// </summary>
|
||||
public AutoLeyLineOutcropConfig AutoLeyLineOutcropConfig { get; set; } = new();
|
||||
|
||||
public AutoCookConfig AutoCookConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 地图遮罩
|
||||
/// </summary>
|
||||
public MapMaskConfig MapMaskConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 技能 CD 提示
|
||||
/// </summary>
|
||||
public SkillCdConfig SkillCdConfig { get; set; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 自动使用
|
||||
/// </summary>
|
||||
@@ -266,6 +251,7 @@ public partial class AllConfig : ObservableObject
|
||||
AutoSkipConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoFishingConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
QuickTeleportConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoCookConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
MacroConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
HotKeyConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoWoodConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
@@ -275,16 +261,12 @@ public partial class AllConfig : ObservableObject
|
||||
AutoArtifactSalvageConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoRedeemCodeConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoEatConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoLeyLineOutcropConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoCookConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
MapMaskConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
AutoMusicGameConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
TpConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
ScriptConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
PathingConditionConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
DevConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
HardwareAccelerationConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
SkillCdConfig.PropertyChanged += OnAnyPropertyChanged;
|
||||
}
|
||||
|
||||
public void OnAnyPropertyChanged(object? sender, EventArgs args)
|
||||
@@ -297,4 +279,4 @@ public partial class AllConfig : ObservableObject
|
||||
{
|
||||
NotificationService.Instance().RefreshNotifiers();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Config;
|
||||
@@ -44,13 +44,4 @@ public partial class GenshinStartConfig : ObservableObject
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _recordGameTimeEnabled = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _startGameWithCmd = false;
|
||||
|
||||
/// <summary>
|
||||
/// 启动前自动关闭原神 HDR(删除原神 HDR 对应注册表键)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _autoDisableGenshinHdrEnabled = true;
|
||||
}
|
||||
@@ -14,10 +14,10 @@ public partial class HardwareAccelerationConfig : ObservableObject
|
||||
private InferenceDeviceType _inferenceDevice = InferenceDeviceType.Cpu;
|
||||
|
||||
/// <summary>
|
||||
/// 是否强制OCR使用CPU推理。在某些环境上使用GPU进行OCR推理会导致性能下降(比如很多使用DirectML推理的情况下)。默认开启。
|
||||
/// 是否强制OCR使用CPU推理。在某些环境上使用GPU进行OCR推理会导致性能下降(比如很多使用DirectML推理的情况下)。默认关闭。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _cpuOcr = true;
|
||||
private bool _cpuOcr = false;
|
||||
|
||||
#region 一般GPU加速设置
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BetterGenshinImpact.Model;
|
||||
using BetterGenshinImpact.Model;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
|
||||
@@ -100,13 +100,6 @@ public partial class HotKeyConfig : ObservableObject
|
||||
|
||||
[ObservableProperty]
|
||||
private string _quickTeleportTickHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 技能CD提示开关
|
||||
[ObservableProperty]
|
||||
private string _skillCdEnabledHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _skillCdEnabledHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 截图
|
||||
[ObservableProperty]
|
||||
@@ -163,13 +156,6 @@ public partial class HotKeyConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private string _autoFishingGameHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 自动烹饪开始/停止
|
||||
[ObservableProperty]
|
||||
private string _autoCookGameHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _autoCookGameHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 自动寻路
|
||||
[ObservableProperty]
|
||||
private string _autoTrackPathHotkey = "";
|
||||
@@ -251,11 +237,4 @@ public partial class HotKeyConfig : ObservableObject
|
||||
|
||||
[ObservableProperty]
|
||||
private string _onedragonHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
|
||||
// 地图遮罩开关
|
||||
[ObservableProperty]
|
||||
private string _mapMaskEnabledHotkey = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private string _mapMaskEnabledHotkeyType = HotKeyTypeEnum.KeyboardMonitor.ToString();
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
|
||||
@@ -63,36 +63,16 @@ public partial class MaskWindowConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private bool _showFps = false;
|
||||
|
||||
/// <summary>
|
||||
/// 作为原神子窗体
|
||||
/// 有些bug没解决
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _useSubform = false;
|
||||
|
||||
/// <summary>
|
||||
/// 遮罩文本透明度 (0.0-1.0)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private double _textOpacity = 1.0;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _overlayLayoutEditEnabled = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _logTextBoxLeftRatio = 20.0 / 1920;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _logTextBoxTopRatio = 822.0 / 1080;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _logTextBoxWidthRatio = 480.0 / 1920;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _logTextBoxHeightRatio = 188.0 / 1080;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _statusListLeftRatio = 20.0 / 1920;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _statusListTopRatio = 790.0 / 1080;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _statusListWidthRatio = 480.0 / 1920;
|
||||
|
||||
[ObservableProperty]
|
||||
private double _statusListHeightRatio = 24.0 / 1080;
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoLeyLineOutcrop;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
@@ -62,87 +61,6 @@ public partial class OneDragonFlowConfig : ObservableObject
|
||||
[ObservableProperty]
|
||||
private List<string> _secretTreasureObjects = new();
|
||||
|
||||
// 地脉花一条龙模式(跳过部分准备流程)
|
||||
[ObservableProperty]
|
||||
private bool _leyLineOneDragonMode = false;
|
||||
|
||||
// 地脉花运行日期设置
|
||||
[ObservableProperty]
|
||||
private bool _leyLineRunMonday = true;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _leyLineRunTuesday = true;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _leyLineRunWednesday = true;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _leyLineRunThursday = true;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _leyLineRunFriday = true;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _leyLineRunSaturday = true;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _leyLineRunSunday = true;
|
||||
|
||||
// 地脉花每日类型与国家配置(为空则使用独立任务配置)
|
||||
[ObservableProperty]
|
||||
private string _leyLineMondayType = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineMondayCountry = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineTuesdayType = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineTuesdayCountry = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineWednesdayType = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineWednesdayCountry = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineThursdayType = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineThursdayCountry = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineFridayType = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineFridayCountry = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineSaturdayType = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineSaturdayCountry = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineSundayType = string.Empty;
|
||||
|
||||
[ObservableProperty]
|
||||
private string _leyLineSundayCountry = string.Empty;
|
||||
|
||||
// 地脉花刷取次数(0 表示使用独立任务配置)
|
||||
[ObservableProperty]
|
||||
private int _leyLineRunCount = 0;
|
||||
|
||||
// 地脉花树脂耗尽模式
|
||||
[ObservableProperty]
|
||||
private bool _leyLineResinExhaustionMode = false;
|
||||
|
||||
// 地脉花刷取次数取小值(仅耗尽模式生效)
|
||||
[ObservableProperty]
|
||||
private bool _leyLineOpenModeCountMin = false;
|
||||
|
||||
#region 每周秘境配置
|
||||
|
||||
//周一
|
||||
@@ -224,62 +142,5 @@ public partial class OneDragonFlowConfig : ObservableObject
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShouldRunLeyLineToday()
|
||||
{
|
||||
if (!LeyLineRunMonday
|
||||
&& !LeyLineRunTuesday
|
||||
&& !LeyLineRunWednesday
|
||||
&& !LeyLineRunThursday
|
||||
&& !LeyLineRunFriday
|
||||
&& !LeyLineRunSaturday
|
||||
&& !LeyLineRunSunday)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
var serverTime = ServerTimeHelper.GetServerTimeNow();
|
||||
var dayOfWeek = (serverTime.Hour >= 4 ? serverTime : serverTime.AddDays(-1)).DayOfWeek;
|
||||
return dayOfWeek switch
|
||||
{
|
||||
DayOfWeek.Monday => LeyLineRunMonday,
|
||||
DayOfWeek.Tuesday => LeyLineRunTuesday,
|
||||
DayOfWeek.Wednesday => LeyLineRunWednesday,
|
||||
DayOfWeek.Thursday => LeyLineRunThursday,
|
||||
DayOfWeek.Friday => LeyLineRunFriday,
|
||||
DayOfWeek.Saturday => LeyLineRunSaturday,
|
||||
DayOfWeek.Sunday => LeyLineRunSunday,
|
||||
_ => true
|
||||
};
|
||||
}
|
||||
|
||||
public (string type, string country) GetLeyLineConfigForToday(AutoLeyLineOutcropConfig fallback)
|
||||
{
|
||||
var serverTime = ServerTimeHelper.GetServerTimeNow();
|
||||
var dayOfWeek = (serverTime.Hour >= 4 ? serverTime : serverTime.AddDays(-1)).DayOfWeek;
|
||||
var (type, country) = dayOfWeek switch
|
||||
{
|
||||
DayOfWeek.Monday => (LeyLineMondayType, LeyLineMondayCountry),
|
||||
DayOfWeek.Tuesday => (LeyLineTuesdayType, LeyLineTuesdayCountry),
|
||||
DayOfWeek.Wednesday => (LeyLineWednesdayType, LeyLineWednesdayCountry),
|
||||
DayOfWeek.Thursday => (LeyLineThursdayType, LeyLineThursdayCountry),
|
||||
DayOfWeek.Friday => (LeyLineFridayType, LeyLineFridayCountry),
|
||||
DayOfWeek.Saturday => (LeyLineSaturdayType, LeyLineSaturdayCountry),
|
||||
DayOfWeek.Sunday => (LeyLineSundayType, LeyLineSundayCountry),
|
||||
_ => (string.Empty, string.Empty)
|
||||
};
|
||||
|
||||
if (string.IsNullOrWhiteSpace(type))
|
||||
{
|
||||
type = fallback.LeyLineOutcropType;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(country))
|
||||
{
|
||||
country = fallback.Country;
|
||||
}
|
||||
|
||||
return (type, country);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.Model;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
@@ -121,4 +121,4 @@ public partial class OtherConfig : ObservableObject
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _uiCultureInfoName = "zh-Hans";
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public partial class PathingPartyConfig : ObservableObject
|
||||
{
|
||||
// 配置是否启用,不启用会使用地图追踪内的条件配置
|
||||
[ObservableProperty]
|
||||
private bool _enabled = true;
|
||||
private bool _enabled = false;
|
||||
|
||||
// 是否启用自动拾取
|
||||
[ObservableProperty]
|
||||
@@ -21,9 +21,6 @@ public partial class PathingPartyConfig : ObservableObject
|
||||
// 切换到队伍的名称
|
||||
[ObservableProperty]
|
||||
private string _partyName = string.Empty;
|
||||
|
||||
[JsonIgnore]
|
||||
public bool SkipPartySwitch { get; set; }
|
||||
|
||||
// 切换队伍前是否前往须弥七天神像
|
||||
[ObservableProperty]
|
||||
@@ -124,7 +121,7 @@ public partial class PathingPartyConfig : ObservableObject
|
||||
|
||||
//启用自动战斗配置
|
||||
[ObservableProperty]
|
||||
private bool _autoFightEnabled = true;
|
||||
private bool _autoFightEnabled = false;
|
||||
|
||||
[ObservableProperty]
|
||||
private AutoFightConfig _autoFightConfig = new();
|
||||
|
||||
@@ -47,13 +47,4 @@ public partial class ScriptConfig : ObservableObject
|
||||
|
||||
// 仓库页面是否最大化
|
||||
[ObservableProperty] private WindowState _webviewState = WindowState.Normal;
|
||||
|
||||
// 仓库新手教程是否已阅读
|
||||
[ObservableProperty] private bool _guideStatus = false;
|
||||
|
||||
// 是否在启动时自动更新已订阅的脚本
|
||||
[ObservableProperty] private bool _autoUpdateSubscribedScripts = false;
|
||||
|
||||
// 命令行启动时是否先自动更新已订阅脚本再执行命令
|
||||
[ObservableProperty] private bool _autoUpdateBeforeCommandLineRun = false;
|
||||
}
|
||||
@@ -6,18 +6,14 @@ using BetterGenshinImpact.Model;
|
||||
using Gma.System.MouseKeyHook;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Windows.Forms;
|
||||
using Vanara.PInvoke;
|
||||
using Timer = System.Timers.Timer;
|
||||
|
||||
// Wine 平台适配
|
||||
using BetterGenshinImpact.Platform.Wine;
|
||||
namespace BetterGenshinImpact.Core.Monitor;
|
||||
|
||||
public partial class MouseKeyMonitor
|
||||
public class MouseKeyMonitor
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 长按F变F连发
|
||||
/// </summary>
|
||||
@@ -45,41 +41,21 @@ public partial class MouseKeyMonitor
|
||||
/// </summary>
|
||||
private DateTime _firstSpaceKeyDownTime = DateTime.MaxValue;
|
||||
|
||||
private static IKeyboardMouseEvents? _globalHook;
|
||||
private static readonly object GlobalHookLock = new object();
|
||||
public static IKeyboardMouseEvents GlobalHook
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_globalHook == null)
|
||||
{
|
||||
lock (GlobalHookLock)
|
||||
{
|
||||
if (_globalHook == null)
|
||||
{
|
||||
_globalHook = Hook.GlobalEvents();
|
||||
}
|
||||
}
|
||||
}
|
||||
return _globalHook;
|
||||
}
|
||||
}
|
||||
private IKeyboardMouseEvents? _globalHook;
|
||||
private nint _hWnd;
|
||||
|
||||
public void Subscribe(nint gameHandle)
|
||||
{
|
||||
_hWnd = gameHandle;
|
||||
// Note: for the application hook, use the Hook.AppEvents() instead
|
||||
_globalHook = Hook.GlobalEvents();
|
||||
|
||||
if (!WinePlatformAddon.IsRunningOnWine) {
|
||||
GlobalHook.KeyDown += GlobalHookKeyDown;
|
||||
GlobalHook.KeyUp += GlobalHookKeyUp;
|
||||
GlobalHook.MouseDownExt += GlobalHookMouseDownExt;
|
||||
GlobalHook.MouseUpExt += GlobalHookMouseUpExt;
|
||||
GlobalHook.MouseMoveExt += GlobalHookMouseMoveExt;
|
||||
GlobalHook.MouseWheelExt += GlobalHookMouseWheelExt;
|
||||
}
|
||||
TrySubscribeWinePolling();
|
||||
_globalHook.KeyDown += GlobalHookKeyDown;
|
||||
_globalHook.KeyUp += GlobalHookKeyUp;
|
||||
_globalHook.MouseDownExt += GlobalHookMouseDownExt;
|
||||
_globalHook.MouseUpExt += GlobalHookMouseUpExt;
|
||||
_globalHook.MouseMoveExt += GlobalHookMouseMoveExt;
|
||||
_globalHook.MouseWheelExt += GlobalHookMouseWheelExt;
|
||||
//_globalHook.KeyPress += GlobalHookKeyPress;
|
||||
|
||||
_pickUpKey = TaskContext.Instance().Config.KeyBindingsConfig.PickUpOrInteract.ToWinFormKeys();
|
||||
@@ -102,11 +78,6 @@ public partial class MouseKeyMonitor
|
||||
// Debug.WriteLine("KeyDown: \t{0}", e.KeyCode);
|
||||
GlobalKeyMouseRecord.Instance.GlobalHookKeyDown(e, Kernel32.GetTickCount());
|
||||
|
||||
if (SystemControl.IsGenshinImpactActive())
|
||||
{
|
||||
ChatUiHotkeyGuard.PrimeFromChatKey(e.KeyCode);
|
||||
}
|
||||
|
||||
// 热键按下事件
|
||||
HotKeyDown(sender, e);
|
||||
|
||||
@@ -219,7 +190,7 @@ public partial class MouseKeyMonitor
|
||||
|
||||
public void Unsubscribe()
|
||||
{
|
||||
if (_globalHook != null && !WinePlatformAddon.IsRunningOnWine)
|
||||
if (_globalHook != null)
|
||||
{
|
||||
_globalHook.KeyDown -= GlobalHookKeyDown;
|
||||
_globalHook.KeyUp -= GlobalHookKeyUp;
|
||||
@@ -229,10 +200,6 @@ public partial class MouseKeyMonitor
|
||||
_globalHook.MouseWheelExt -= GlobalHookMouseWheelExt;
|
||||
//_globalHook.KeyPress -= GlobalHookKeyPress;
|
||||
_globalHook.Dispose();
|
||||
_globalHook = null;
|
||||
}
|
||||
if (WinePlatformAddon.IsRunningOnWine){
|
||||
DisposeWineAddon();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ using System.Linq;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Recognition.OCR.Engine;
|
||||
using BetterGenshinImpact.Core.Recognition.ONNX;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using OpenCvSharp;
|
||||
using OpenCvSharp.Extensions;
|
||||
using YamlDotNet.Core;
|
||||
@@ -247,7 +246,7 @@ public class PaddleOcrService : IOcrService, IDisposable
|
||||
_localRecModel = modelsRec;
|
||||
|
||||
// 预热模型
|
||||
using var preHeatImageMat = Bv.ImRead(modelType.PreHeatImagePath) ??
|
||||
using var preHeatImageMat = Cv2.ImRead(modelType.PreHeatImagePath) ??
|
||||
throw new FileNotFoundException($"预热图片未找到: {modelType.PreHeatImagePath}");
|
||||
// Debug输出结果
|
||||
var preHeatResult = RunAll(preHeatImageMat, 1);
|
||||
@@ -282,10 +281,8 @@ public class PaddleOcrService : IOcrService, IDisposable
|
||||
/// </summary>
|
||||
public string OcrWithoutDetector(Mat mat)
|
||||
{
|
||||
var startTime = Stopwatch.GetTimestamp();
|
||||
var str = _localRecModel.Run(mat).Text;
|
||||
var time = Stopwatch.GetElapsedTime(startTime);
|
||||
Debug.WriteLine($"PaddleOcrWithoutDetector 耗时 {time.TotalMilliseconds}ms 结果: {str}");
|
||||
Debug.WriteLine($"PaddleOcrWithoutDetector 结果: {str}");
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Buffers;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using BetterGenshinImpact.Core.Recognition.OCR.Engine;
|
||||
using BetterGenshinImpact.Core.Recognition.OCR.Engine.data;
|
||||
@@ -94,33 +95,21 @@ public class Rec(
|
||||
// .AsParallel()
|
||||
.Select(src =>
|
||||
{
|
||||
Mat? channel3 = default;
|
||||
try
|
||||
using var channel3 = src.Channels() switch
|
||||
{
|
||||
channel3 = src.Channels() switch
|
||||
{
|
||||
4 => src.CvtColor(ColorConversionCodes.BGRA2BGR),
|
||||
1 => src.CvtColor(ColorConversionCodes.GRAY2BGR),
|
||||
3 => src,
|
||||
var x => throw new Exception($"Unexpect src channel: {x}, allow: (1/3/4)")
|
||||
};
|
||||
var result = OcrUtils.ResizeNormImg(channel3, new OcrShape(3, maxWidth, modelHeight),
|
||||
out var owner);
|
||||
lock (owners)
|
||||
{
|
||||
owners.Add(owner);
|
||||
}
|
||||
4 => src.CvtColor(ColorConversionCodes.BGRA2BGR),
|
||||
1 => src.CvtColor(ColorConversionCodes.GRAY2BGR),
|
||||
3 => src,
|
||||
var x => throw new Exception($"Unexpect src channel: {x}, allow: (1/3/4)")
|
||||
};
|
||||
var result = OcrUtils.ResizeNormImg(channel3, new OcrShape(3, maxWidth, modelHeight),
|
||||
out var owner);
|
||||
lock (owners)
|
||||
{
|
||||
owners.Add(owner);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Only dispose Mats created in this scope
|
||||
if (channel3 != null && !ReferenceEquals(channel3, src))
|
||||
{
|
||||
channel3.Dispose();
|
||||
}
|
||||
}
|
||||
return result;
|
||||
})
|
||||
.Select(inputTensor =>
|
||||
{
|
||||
@@ -152,46 +141,46 @@ public class Rec(
|
||||
{
|
||||
var resultArray = resultTensor.Item2;
|
||||
var resultShape = resultTensor.Item1;
|
||||
var labelCount = resultShape[2];
|
||||
var charCount = resultShape[1];
|
||||
GCHandle dataHandle = default;
|
||||
try
|
||||
{
|
||||
dataHandle = GCHandle.Alloc(resultArray, GCHandleType.Pinned);
|
||||
var dataPtr = dataHandle.AddrOfPinnedObject();
|
||||
var labelCount = resultShape[2];
|
||||
var charCount = resultShape[1];
|
||||
|
||||
return Enumerable.Range(0, resultShape[0])
|
||||
.Select(i =>
|
||||
{
|
||||
StringBuilder sb = new();
|
||||
var lastIndex = 0;
|
||||
float score = 0;
|
||||
var batchOffset = i * charCount * labelCount;
|
||||
for (var n = 0; n < charCount; ++n)
|
||||
return Enumerable.Range(0, resultShape[0])
|
||||
.Select(i =>
|
||||
{
|
||||
var rowOffset = batchOffset + n * labelCount;
|
||||
var maxVal = float.MinValue;
|
||||
var maxIndex = 0;
|
||||
for (var c = 0; c < labelCount; c++)
|
||||
StringBuilder sb = new();
|
||||
var lastIndex = 0;
|
||||
float score = 0;
|
||||
for (var n = 0; n < charCount; ++n)
|
||||
{
|
||||
var value = resultArray[rowOffset + c];
|
||||
if (value > maxVal)
|
||||
using var mat = Mat.FromPixelData(1, labelCount, MatType.CV_32FC1,
|
||||
dataPtr + (n + i * charCount) * labelCount * sizeof(float));
|
||||
var maxIdx = new int[2];
|
||||
mat.MinMaxIdx(out _, out var maxVal, [], maxIdx);
|
||||
|
||||
if (maxIdx[1] > 0 && !(n > 0 && maxIdx[1] == lastIndex))
|
||||
{
|
||||
maxVal = value;
|
||||
maxIndex = c;
|
||||
score += (float)maxVal;
|
||||
sb.Append(OcrUtils.GetLabelByIndex(maxIdx[1], labels));
|
||||
}
|
||||
|
||||
lastIndex = maxIdx[1];
|
||||
}
|
||||
|
||||
if (maxIndex > 0 && !(n > 0 && maxIndex == lastIndex))
|
||||
{
|
||||
score += maxVal;
|
||||
sb.Append(OcrUtils.GetLabelByIndex(maxIndex, labels));
|
||||
}
|
||||
|
||||
lastIndex = maxIndex;
|
||||
}
|
||||
|
||||
var text = sb.ToString();
|
||||
return new OcrRecognizerResult(text, text.Length > 0 ? score / text.Length : 0);
|
||||
})
|
||||
.ToArray();
|
||||
return new OcrRecognizerResult(sb.ToString(), score / sb.Length);
|
||||
})
|
||||
.ToArray();
|
||||
}
|
||||
finally
|
||||
{
|
||||
dataHandle.Free();
|
||||
}
|
||||
}).ToArray();
|
||||
}
|
||||
|
||||
public string GetConfigName => config.Name;
|
||||
}
|
||||
}
|
||||
@@ -407,11 +407,6 @@ public class BgiOnnxFactory
|
||||
break;
|
||||
case ProviderType.Cpu:
|
||||
sessionOptions.AppendExecutionProvider_CPU();
|
||||
// if (model.Name.Contains("PpOcr") || model.Name.Contains("Yap"))
|
||||
// {
|
||||
// sessionOptions.IntraOpNumThreads = 2; // 限制算子内部并行线程数
|
||||
// sessionOptions.InterOpNumThreads = 1; // 限制算子间并行线程数(顺序执行)
|
||||
// }
|
||||
break;
|
||||
case ProviderType.Dnnl:
|
||||
sessionOptions.AppendExecutionProvider_Dnnl();
|
||||
|
||||
@@ -44,23 +44,12 @@ public class BgiOnnxModel
|
||||
/// </summary>
|
||||
public static readonly BgiOnnxModel BgiWorld = Register("BgiTree", @"Assets\Model\World\bgi_world.onnx");
|
||||
|
||||
/// <summary>
|
||||
/// 矿物识别模型
|
||||
/// </summary>
|
||||
public static readonly BgiOnnxModel BgiMine = Register("BgiMine", @"Assets\Model\Mine\bgi_mine.onnx");
|
||||
|
||||
/// <summary>
|
||||
/// 角色识别
|
||||
/// </summary>
|
||||
public static readonly BgiOnnxModel BgiAvatarSide =
|
||||
Register("BgiAvatarSide", @"Assets\Model\Common\avatar_side_classify_sim.onnx");
|
||||
|
||||
/// <summary>
|
||||
/// Q技能冷却分类模型
|
||||
/// </summary>
|
||||
public static readonly BgiOnnxModel BgiQClassify =
|
||||
Register("BgiQClassify", @"Assets\Model\Common\q_classify_sim.onnx");
|
||||
|
||||
/// <summary>
|
||||
/// paddleOCR V4 检测模型
|
||||
/// </summary>
|
||||
@@ -150,4 +139,4 @@ public class BgiOnnxModel
|
||||
RegisteredModels.Add(model);
|
||||
return model;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using Microsoft.ML.OnnxRuntime;
|
||||
using Microsoft.ML.OnnxRuntime.Tensors;
|
||||
using OpenCvSharp;
|
||||
@@ -8,9 +8,9 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using BetterGenshinImpact.Core.Recognition.OCR.Engine;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Recognition.ONNX.SVTR;
|
||||
|
||||
@@ -31,7 +31,7 @@ public class PickTextInference : ITextInference
|
||||
if (!File.Exists(wordJsonPath)) throw new FileNotFoundException("Yap字典文件不存在", wordJsonPath);
|
||||
|
||||
var json = File.ReadAllText(wordJsonPath);
|
||||
_wordDictionary = JsonConvert.DeserializeObject<Dictionary<int, string>>(json) ??
|
||||
_wordDictionary = JsonSerializer.Deserialize<Dictionary<int, string>>(json) ??
|
||||
throw new Exception("index_2_word.json deserialize failed");
|
||||
}
|
||||
|
||||
@@ -116,4 +116,4 @@ public class PickTextInference : ITextInference
|
||||
|
||||
return new DenseTensor<float>(memory, [1, 1, 32, 384]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,7 @@ namespace BetterGenshinImpact.Core.Recognition.ONNX.SVTR;
|
||||
|
||||
public class TextInferenceFactory
|
||||
{
|
||||
public static readonly Lazy<ITextInference> Pick = new(() => Create(OcrEngineTypes.YapModel));
|
||||
public static ITextInference Pick { get; } = Create(OcrEngineTypes.YapModel);
|
||||
|
||||
public static ITextInference Create(OcrEngineTypes type)
|
||||
{
|
||||
|
||||
@@ -87,24 +87,4 @@ public static class CommonExtension
|
||||
{
|
||||
return list.ConvertAll(ToPoint2d);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将矩形钳位到指定尺寸范围内(交集语义),防止 OpenCV ROI 越界
|
||||
/// </summary>
|
||||
public static Rect ClampTo(this Rect rect, int maxWidth, int maxHeight)
|
||||
{
|
||||
int x1 = Math.Clamp(rect.X, 0, maxWidth);
|
||||
int y1 = Math.Clamp(rect.Y, 0, maxHeight);
|
||||
int x2 = Math.Clamp(rect.X + rect.Width, 0, maxWidth);
|
||||
int y2 = Math.Clamp(rect.Y + rect.Height, 0, maxHeight);
|
||||
return new Rect(x1, y1, x2 - x1, y2 - y1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将矩形钳位到 Mat 范围内(交集语义),防止 OpenCV ROI 越界
|
||||
/// </summary>
|
||||
public static Rect ClampTo(this Rect rect, Mat mat)
|
||||
{
|
||||
return rect.ClampTo(mat.Cols, mat.Rows);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using OpenCvSharp;
|
||||
|
||||
@@ -25,7 +24,7 @@ public static class Feature2DExtensions
|
||||
public static void SaveFeatures(this Feature2D feature2D, string trainImagePath, string trainKeyPointsPath, string trainDescriptorsPath)
|
||||
{
|
||||
Mat trainDescriptors = new();
|
||||
var img = Bv.ImRead(trainImagePath, ImreadModes.Grayscale);
|
||||
var img = Cv2.ImRead(trainImagePath, ImreadModes.Grayscale);
|
||||
|
||||
feature2D.DetectAndCompute(img, null, out var trainKeyPoints, trainDescriptors);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv.Model;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv.Model;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -81,79 +81,6 @@ public class KeyPointFeatureBlockHelper
|
||||
return (cellRow, cellCol);
|
||||
}
|
||||
|
||||
public static (int RowStart, int RowEnd, int ColStart, int ColEnd) GetCellRange(Size originalImage, int rows, int cols, Rect rect)
|
||||
{
|
||||
int cellWidth = originalImage.Width / cols;
|
||||
int cellHeight = originalImage.Height / rows;
|
||||
|
||||
var rowStart = (int)(rect.Y / cellHeight);
|
||||
var rowEnd = (int)((rect.Y + rect.Height) / cellHeight);
|
||||
var colStart = (int)(rect.X / cellWidth);
|
||||
var colEnd = (int)((rect.X + rect.Width) / cellWidth);
|
||||
|
||||
rowStart = Math.Max(0, Math.Min(rowStart, rows - 1));
|
||||
rowEnd = Math.Max(0, Math.Min(rowEnd, rows - 1));
|
||||
colStart = Math.Max(0, Math.Min(colStart, cols - 1));
|
||||
colEnd = Math.Max(0, Math.Min(colEnd, cols - 1));
|
||||
|
||||
if (rowEnd < rowStart)
|
||||
{
|
||||
rowEnd = rowStart;
|
||||
}
|
||||
|
||||
if (colEnd < colStart)
|
||||
{
|
||||
colEnd = colStart;
|
||||
}
|
||||
|
||||
return (rowStart, rowEnd, colStart, colEnd);
|
||||
}
|
||||
|
||||
public static KeyPointFeatureBlock MergeFeaturesInRange(KeyPointFeatureBlock[][] splitKeyPoints, Mat matches, int rowStart, int rowEnd, int colStart, int colEnd)
|
||||
{
|
||||
var rows = splitKeyPoints.Length;
|
||||
if (rows == 0)
|
||||
{
|
||||
return new KeyPointFeatureBlock();
|
||||
}
|
||||
|
||||
var cols = splitKeyPoints[0].Length;
|
||||
|
||||
rowStart = Math.Max(0, Math.Min(rowStart, rows - 1));
|
||||
rowEnd = Math.Max(0, Math.Min(rowEnd, rows - 1));
|
||||
colStart = Math.Max(0, Math.Min(colStart, cols - 1));
|
||||
colEnd = Math.Max(0, Math.Min(colEnd, cols - 1));
|
||||
|
||||
var matchesCols = matches.Cols;
|
||||
var neighboringKeyPoints = new List<KeyPoint>();
|
||||
var neighboringKeyPointIndices = new List<int>();
|
||||
|
||||
for (int i = rowStart; i <= rowEnd; i++)
|
||||
{
|
||||
for (int j = colStart; j <= colEnd; j++)
|
||||
{
|
||||
if (splitKeyPoints[i][j] != null)
|
||||
{
|
||||
neighboringKeyPoints.AddRange(splitKeyPoints[i][j].KeyPointList);
|
||||
neighboringKeyPointIndices.AddRange(splitKeyPoints[i][j].KeyPointIndexList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var mergedKeyPointBlock = new KeyPointFeatureBlock
|
||||
{
|
||||
MergedCenterCellCol = (colStart + colEnd) / 2,
|
||||
MergedCenterCellRow = (rowStart + rowEnd) / 2,
|
||||
KeyPointList = neighboringKeyPoints,
|
||||
KeyPointIndexList = neighboringKeyPointIndices
|
||||
};
|
||||
|
||||
mergedKeyPointBlock.Descriptor = new Mat(mergedKeyPointBlock.KeyPointIndexList.Count, matchesCols, MatType.CV_32FC1);
|
||||
InitBlockMat(mergedKeyPointBlock.KeyPointIndexList, mergedKeyPointBlock.Descriptor, matches);
|
||||
|
||||
return mergedKeyPointBlock;
|
||||
}
|
||||
|
||||
public static KeyPointFeatureBlock MergeNeighboringFeatures(KeyPointFeatureBlock[][] splitKeyPoints, Mat matches, int cellRow, int cellCol)
|
||||
{
|
||||
var matchesCols = matches.Cols; // SURF 64 SIFT 128
|
||||
|
||||
@@ -14,79 +14,71 @@ public class ImageDifferenceDetector
|
||||
/// <returns>差异最大的图片索引(0-3),如果没有图片获得3票则返回-1</returns>
|
||||
public static int FindMostDifferentImage(Mat[] images)
|
||||
{
|
||||
try
|
||||
if (images is not { Length: 4 })
|
||||
{
|
||||
if (images is not { Length: 4 })
|
||||
throw new ArgumentException("必须提供4张图片");
|
||||
}
|
||||
|
||||
// 验证所有图片尺寸相同
|
||||
Size firstSize = images[0].Size();
|
||||
for (int i = 1; i < 4; i++)
|
||||
{
|
||||
if (images[i].Size() != firstSize)
|
||||
{
|
||||
throw new ArgumentException("必须提供4张图片");
|
||||
throw new ArgumentException("所有图片必须具有相同的尺寸");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证所有图片尺寸相同
|
||||
Size firstSize = images[0].Size();
|
||||
for (int i = 1; i < 4; i++)
|
||||
// 存储每张图片获得的投票数
|
||||
int[] votes = new int[4];
|
||||
|
||||
// 每张图片投票给与它差异最大的图片
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int maxDiffImageIndex = -1;
|
||||
double maxDifference = 0;
|
||||
|
||||
// 找出与图片i差异最大的图片
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
if (images[i].Size() != firstSize)
|
||||
if (i != j)
|
||||
{
|
||||
throw new ArgumentException("所有图片必须具有相同的尺寸");
|
||||
}
|
||||
}
|
||||
|
||||
// 存储每张图片获得的投票数
|
||||
int[] votes = new int[4];
|
||||
|
||||
// 每张图片投票给与它差异最大的图片
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
int maxDiffImageIndex = -1;
|
||||
double maxDifference = 0;
|
||||
|
||||
// 找出与图片i差异最大的图片
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
if (i != j)
|
||||
double difference = CalculateDifference(images[i], images[j]);
|
||||
Debug.WriteLine($"{i} vs {j} 差异像素数量: {difference}");
|
||||
|
||||
if (difference > maxDifference)
|
||||
{
|
||||
double difference = CalculateDifference(images[i], images[j]);
|
||||
Debug.WriteLine($"{i} vs {j} 差异像素数量: {difference}");
|
||||
|
||||
if (difference > maxDifference)
|
||||
{
|
||||
maxDifference = difference;
|
||||
maxDiffImageIndex = j;
|
||||
}
|
||||
maxDifference = difference;
|
||||
maxDiffImageIndex = j;
|
||||
}
|
||||
}
|
||||
|
||||
// 图片i投票给差异最大的图片
|
||||
if (maxDiffImageIndex != -1)
|
||||
{
|
||||
votes[maxDiffImageIndex]++;
|
||||
Debug.WriteLine($"图片 {i} 投票给图片 {maxDiffImageIndex} (差异值: {maxDifference:F2})");
|
||||
}
|
||||
}
|
||||
|
||||
// 输出投票结果
|
||||
Debug.WriteLine("\n投票结果:");
|
||||
for (int i = 0; i < 4; i++)
|
||||
// 图片i投票给差异最大的图片
|
||||
if (maxDiffImageIndex != -1)
|
||||
{
|
||||
Debug.WriteLine($"图片 {i}: {votes[i]} 票");
|
||||
votes[maxDiffImageIndex]++;
|
||||
Debug.WriteLine($"图片 {i} 投票给图片 {maxDiffImageIndex} (差异值: {maxDifference:F2})");
|
||||
}
|
||||
|
||||
// 检查是否有图片获得3票
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (votes[i] >= 3)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
// 输出投票结果
|
||||
Debug.WriteLine("\n投票结果:");
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
Debug.WriteLine($"FindMostDifferentImage 出错: {ex.Message}");
|
||||
return -1;
|
||||
Debug.WriteLine($"图片 {i}: {votes[i]} 票");
|
||||
}
|
||||
|
||||
// 检查是否有图片获得3票
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
if (votes[i] >= 3)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
|
||||
public class TemplateMatchStabilityDetector : IDisposable
|
||||
{
|
||||
private Mat previousFrame;
|
||||
private readonly double similarityThreshold = 0.98; // 相似度阈值(0-1)
|
||||
private readonly int stableFrameCount = 2;
|
||||
private int currentStableCount = 0;
|
||||
private double lastSimilarity = 0;
|
||||
|
||||
public bool IsStable(Mat currentFrame)
|
||||
{
|
||||
Mat processed = PreprocessFrame(currentFrame);
|
||||
|
||||
if (previousFrame == null)
|
||||
{
|
||||
previousFrame = processed;
|
||||
return false;
|
||||
}
|
||||
|
||||
// 使用归一化相关系数进行匹配
|
||||
double similarity = ComputeSimilarity(previousFrame, processed);
|
||||
lastSimilarity = similarity;
|
||||
|
||||
Debug.WriteLine("Similarity: " + similarity);
|
||||
if (similarity >= similarityThreshold)
|
||||
{
|
||||
currentStableCount++;
|
||||
if (currentStableCount >= stableFrameCount)
|
||||
{
|
||||
previousFrame?.Dispose();
|
||||
previousFrame = processed;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
processed.Dispose();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
currentStableCount = 0;
|
||||
previousFrame?.Dispose();
|
||||
previousFrame = processed;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private Mat PreprocessFrame(Mat frame)
|
||||
{
|
||||
Mat small = new Mat();
|
||||
|
||||
// 降采样加速
|
||||
Cv2.Resize(frame, small, new Size(320, 180), 0, 0, InterpolationFlags.Area);
|
||||
|
||||
return small;
|
||||
}
|
||||
|
||||
private double ComputeSimilarity(Mat template, Mat image)
|
||||
{
|
||||
// 确保两帧大小相同
|
||||
if (template.Size() != image.Size())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 使用归一化相关系数匹配
|
||||
Mat result = new Mat();
|
||||
Cv2.MatchTemplate(image, template, result, TemplateMatchModes.CCoeffNormed);
|
||||
|
||||
// 获取匹配结果(只有一个值)
|
||||
double minVal, maxVal;
|
||||
Point minLoc, maxLoc;
|
||||
Cv2.MinMaxLoc(result, out minVal, out maxVal, out minLoc, out maxLoc);
|
||||
|
||||
result.Dispose();
|
||||
|
||||
return maxVal; // 返回相关系数(-1 到 1,1 表示完全相同)
|
||||
}
|
||||
|
||||
public double GetLastSimilarity()
|
||||
{
|
||||
return lastSimilarity;
|
||||
}
|
||||
|
||||
public void Reset()
|
||||
{
|
||||
currentStableCount = 0;
|
||||
previousFrame?.Dispose();
|
||||
previousFrame = null;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
previousFrame?.Dispose();
|
||||
previousFrame = null;
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
@@ -1,99 +1,42 @@
|
||||
using System;
|
||||
using BetterGenshinImpact.Model;
|
||||
using BetterGenshinImpact.Model;
|
||||
using System.Threading;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script;
|
||||
|
||||
public class CancellationContext : Singleton<CancellationContext>
|
||||
{
|
||||
private readonly object _sync = new();
|
||||
public CancellationTokenSource Cts { get; private set; } = new();
|
||||
public CancellationTokenSource Cts { get; set; } = new();
|
||||
public bool IsManualStop { get; private set; }
|
||||
|
||||
public bool IsCancellationRequested
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
return !disposed && Cts.IsCancellationRequested;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private bool disposed;
|
||||
|
||||
public void Set()
|
||||
{
|
||||
lock (_sync)
|
||||
{
|
||||
Cts = new CancellationTokenSource();
|
||||
IsManualStop = false;
|
||||
disposed = false;
|
||||
}
|
||||
Cts = new CancellationTokenSource();
|
||||
IsManualStop = false;
|
||||
disposed = false;
|
||||
}
|
||||
|
||||
public void ManualCancel()
|
||||
{
|
||||
CancellationTokenSource cts;
|
||||
lock (_sync)
|
||||
if (!disposed)
|
||||
{
|
||||
if (disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IsManualStop = true;
|
||||
cts = Cts;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
cts.Cancel();
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
// 并发 Clear 可能已释放 CTS,这里视为已取消/已清理。
|
||||
Cts.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
public void Cancel()
|
||||
{
|
||||
CancellationTokenSource cts;
|
||||
lock (_sync)
|
||||
if (!disposed)
|
||||
{
|
||||
if (disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cts = Cts;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
cts.Cancel();
|
||||
}
|
||||
catch (ObjectDisposedException)
|
||||
{
|
||||
// 并发 Clear 可能已释放 CTS,这里视为已取消/已清理。
|
||||
Cts.Cancel();
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
CancellationTokenSource cts;
|
||||
lock (_sync)
|
||||
{
|
||||
if (disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cts = Cts;
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
cts.Dispose();
|
||||
Cts.Dispose();
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Model;
|
||||
using System.Threading.Tasks;
|
||||
@@ -12,13 +12,11 @@ public class AutoPathingScript
|
||||
{
|
||||
private object? _config = null;
|
||||
private string _rootPath;
|
||||
private readonly LimitedFile _autoPathingFile;
|
||||
|
||||
public AutoPathingScript(string rootPath, object? config)
|
||||
{
|
||||
_config = config;
|
||||
_rootPath = rootPath;
|
||||
_autoPathingFile = new LimitedFile(Global.Absolute(@"User\AutoPathing"));
|
||||
}
|
||||
|
||||
public async Task Run(string json)
|
||||
@@ -61,41 +59,7 @@ public class AutoPathingScript
|
||||
/// <param name="path">在 `\User\AutoPathing` 目录下获取文件</param>
|
||||
public async Task RunFileFromUser(string path)
|
||||
{
|
||||
var json = await AutoPathingFile.ReadText(path);
|
||||
var json = await new LimitedFile(Global.Absolute(@"User\AutoPathing")).ReadText(path);
|
||||
await Run(json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断 AutoPathing 目录下的路径是否存在
|
||||
/// </summary>
|
||||
/// <param name="subPath">相对于 User\AutoPathing 的路径</param>
|
||||
/// <returns>存在返回 true,否则返回 false</returns>
|
||||
public bool IsExists(string subPath) => AutoPathingFile.IsExists(subPath);
|
||||
|
||||
/// <summary>
|
||||
/// 判断 AutoPathing 目录下的路径是否为文件
|
||||
/// </summary>
|
||||
/// <param name="subPath">相对于 User\AutoPathing 的路径</param>
|
||||
/// <returns>是文件返回 true,否则返回 false</returns>
|
||||
public bool IsFile(string subPath) => AutoPathingFile.IsFile(subPath);
|
||||
|
||||
/// <summary>
|
||||
/// 判断 AutoPathing 目录下的路径是否为文件夹
|
||||
/// </summary>
|
||||
/// <param name="subPath">相对于 User\AutoPathing 的路径</param>
|
||||
/// <returns>是文件夹返回 true,否则返回 false</returns>
|
||||
public bool IsFolder(string subPath) => AutoPathingFile.IsFolder(subPath);
|
||||
|
||||
/// <summary>
|
||||
/// 读取 AutoPathing 目录下指定文件夹的内容(非递归方式)
|
||||
/// 目录不存在时返回空数组,不会自动创建目录
|
||||
/// </summary>
|
||||
/// <param name="subPath">相对于 User\AutoPathing 的子目录路径,默认为相对根目录</param>
|
||||
/// <returns>文件夹内所有文件和文件夹的相对路径数组,出错时返回空数组</returns>
|
||||
public string[] ReadPathSync(string subPath = "./") => AutoPathingFile.ReadPathSync(subPath);
|
||||
|
||||
/// <summary>
|
||||
/// LimitedFile 实例,用于操作 AutoPathing 目录
|
||||
/// </summary>
|
||||
private LimitedFile AutoPathingFile => _autoPathingFile;
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using Microsoft.ClearScript;
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
public class CustomHostFunctions : HostFunctions
|
||||
{
|
||||
/// <summary>
|
||||
/// 创建指定维度的交错数组变量
|
||||
/// </summary>
|
||||
/// <typeparam name="T">数组元素类型</typeparam>
|
||||
/// <param name="dimensions">数组维度</param>
|
||||
/// <returns>交错数组变量</returns>
|
||||
public object NewVarOfArr<T>(int dimensions)
|
||||
{
|
||||
try
|
||||
{
|
||||
Type arrayType = typeof(T);
|
||||
for (int i = 0; i < dimensions; i++)
|
||||
{
|
||||
arrayType = arrayType.MakeArrayType();
|
||||
}
|
||||
|
||||
MethodInfo newVarMethod = typeof(HostFunctions).GetMethod(nameof(newVar))!;
|
||||
MethodInfo genericMethod = newVarMethod.MakeGenericMethod(arrayType);
|
||||
return genericMethod.Invoke(this, new object?[] { null })!;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InvalidOperationException($"创建维度为 {dimensions} 的数组失败: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoDomain;
|
||||
using BetterGenshinImpact.GameTask.AutoEat;
|
||||
using BetterGenshinImpact.GameTask.AutoFishing;
|
||||
using BetterGenshinImpact.GameTask.AutoCook;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Handler;
|
||||
using BetterGenshinImpact.GameTask.AutoWood;
|
||||
@@ -20,8 +19,6 @@ using System.Dynamic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using BetterGenshinImpact.GameTask.AutoLeyLineOutcrop;
|
||||
using BetterGenshinImpact.GameTask.AutoStygianOnslaught;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
@@ -196,9 +193,6 @@ public class Dispatcher
|
||||
await new AutoFishingTask(AutoFishingTaskParam.BuildFromSoloTaskConfig(soloTask.Config)).Start(
|
||||
cancellationToken);
|
||||
return null;
|
||||
case "AutoCook":
|
||||
await new AutoCookTask().Start(cancellationToken);
|
||||
return null;
|
||||
case "AutoEat":
|
||||
{
|
||||
string? foodName = soloTask.Config == null ? null : ScriptObjectConverter.GetValue((ScriptObject)soloTask.Config, "foodName", (string?)null);
|
||||
@@ -345,39 +339,4 @@ public class Dispatcher
|
||||
CancellationToken cancellationToken = customCt ?? CancellationContext.Instance.Cts.Token;
|
||||
await new AutoFightTask(param).Start(cancellationToken);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 运行自动地脉花任务
|
||||
/// </summary>
|
||||
/// <param name="param">自动地脉花任务参数</param>
|
||||
/// <param name="customCt">自定义取消令牌</param>
|
||||
/// <returns></returns>
|
||||
public async Task RunAutoLeyLineOutcropTask(AutoLeyLineOutcropParam param, CancellationToken? customCt = null)
|
||||
{
|
||||
if (param == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(param), "自动地脉花任务参数不能为空");
|
||||
}
|
||||
|
||||
CancellationToken cancellationToken = customCt ?? CancellationContext.Instance.Cts.Token;
|
||||
await new AutoLeyLineOutcropTask(param).Start(cancellationToken);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 运行自动幽境危战任务
|
||||
/// </summary>
|
||||
/// <param name="param">自动幽境危战任务参数</param>
|
||||
/// <param name="customCt">自定义取消令牌</param>
|
||||
/// <returns></returns>
|
||||
public async Task RunAutoStygianOnslaughtTask(AutoStygianOnslaughtParam param, CancellationToken? customCt = null)
|
||||
{
|
||||
if (param == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(param), "自动幽境危战任务参数不能为空");
|
||||
}
|
||||
|
||||
CancellationToken cancellationToken = customCt ?? CancellationContext.Instance.Cts.Token;
|
||||
await new AutoStygianOnslaughtTask(param).Start(cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -43,15 +43,6 @@ public class Genshin
|
||||
/// </summary>
|
||||
public double ScreenDpiScale => TaskContext.Instance().DpiScale;
|
||||
|
||||
/// <summary>
|
||||
/// 通过 OCR 识别当前角色的 UID
|
||||
/// </summary>
|
||||
/// <returns>UID 数字,如果识别失败则返回 0</returns>
|
||||
public Task<int> Uid()
|
||||
{
|
||||
return Task.FromResult(Bv.Uid());
|
||||
}
|
||||
|
||||
public Lazy<NavigationInstance> LazyNavigationInstance { get; } = new(() =>
|
||||
{
|
||||
var matchingMethod = TaskContext.Instance().Config.PathingConditionConfig.MapMatchingMethod;
|
||||
@@ -191,7 +182,7 @@ public class Genshin
|
||||
/// 获取当前在大地图上的位置坐标
|
||||
/// </summary>
|
||||
/// <returns>包含X和Y坐标的Point2f结构体</returns>
|
||||
public Point2f? GetPositionFromBigMap()
|
||||
public Point2f GetPositionFromBigMap()
|
||||
{
|
||||
TpTask tpTask = new TpTask(CancellationContext.Instance.Cts.Token);
|
||||
return tpTask.GetPositionFromBigMap(MapTypes.Teyvat.ToString());
|
||||
@@ -202,7 +193,7 @@ public class Genshin
|
||||
/// </summary>
|
||||
/// <param name="mapName">大地图名称</param>
|
||||
/// <returns>包含X和Y坐标的Point2f结构体</returns>
|
||||
public Point2f? GetPositionFromBigMap(string mapName)
|
||||
public Point2f GetPositionFromBigMap(string mapName)
|
||||
{
|
||||
TpTask tpTask = new TpTask(CancellationContext.Instance.Cts.Token);
|
||||
return tpTask.GetPositionFromBigMap(mapName);
|
||||
@@ -212,15 +203,10 @@ public class Genshin
|
||||
/// 获取当前在小地图上的位置坐标
|
||||
/// </summary>
|
||||
/// <returns>包含X和Y坐标的Point2f结构体</returns>
|
||||
public Point2f? GetPositionFromMap()
|
||||
public Point2f GetPositionFromMap()
|
||||
{
|
||||
return GetPositionFromMap(MapTypes.Teyvat.ToString());
|
||||
}
|
||||
|
||||
public Point2f? GetPositionFromMapWithMatchingMethod(string matchingMethod)
|
||||
{
|
||||
return GetPositionFromMapWithMatchingMethod(nameof(MapTypes.Teyvat), matchingMethod);
|
||||
}
|
||||
|
||||
public float GetCameraOrientation()
|
||||
{
|
||||
@@ -234,19 +220,15 @@ public class Genshin
|
||||
/// <param name="mapName">大地图名称</param>
|
||||
/// <param name="cacheTimeMs">缓存时间,单位毫秒,默认900ms</param>
|
||||
/// <returns>包含X和Y坐标的Point2f结构体</returns>
|
||||
public Point2f? GetPositionFromMap(string mapName, int cacheTimeMs = 900)
|
||||
{
|
||||
var matchingMethod = TaskContext.Instance().Config.PathingConditionConfig.MapMatchingMethod;
|
||||
return GetPositionFromMapWithMatchingMethod(mapName,matchingMethod, cacheTimeMs);
|
||||
}
|
||||
|
||||
public Point2f? GetPositionFromMapWithMatchingMethod(string mapName, string matchingMethod, int cacheTimeMs = 900)
|
||||
public Point2f GetPositionFromMap(string mapName, int cacheTimeMs = 900)
|
||||
{
|
||||
var imageRegion = CaptureToRectArea();
|
||||
if (!Bv.IsInMainUi(imageRegion))
|
||||
{
|
||||
throw new InvalidOperationException("不在主界面,无法识别小地图坐标");
|
||||
}
|
||||
|
||||
var matchingMethod = TaskContext.Instance().Config.PathingConditionConfig.MapMatchingMethod;
|
||||
return MapManager.GetMap(mapName, matchingMethod)
|
||||
.ConvertImageCoordinatesToGenshinMapCoordinates(LazyNavigationInstance.Value
|
||||
.GetPositionStableByCache(imageRegion, mapName, matchingMethod, cacheTimeMs));
|
||||
@@ -259,7 +241,7 @@ public class Genshin
|
||||
/// <param name="x">世界坐标x</param>
|
||||
/// <param name="y">世界坐标y</param>
|
||||
/// <returns>包含X和Y坐标的Point2f结构体</returns>
|
||||
public Point2f? GetPositionFromMap(string mapName, float x, float y)
|
||||
public Point2f GetPositionFromMap(string mapName, float x, float y)
|
||||
{
|
||||
var imageRegion = CaptureToRectArea();
|
||||
if (!Bv.IsInMainUi(imageRegion))
|
||||
@@ -395,15 +377,6 @@ public class Genshin
|
||||
{
|
||||
await new ExitAndReloginJob().Start(CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 进出千星奇域
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task WonderlandCycle()
|
||||
{
|
||||
await new EnterAndExitWonderlandJob().Start(CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 调整时间
|
||||
@@ -436,17 +409,4 @@ public class Genshin
|
||||
throw new ArgumentException($"无效的分钟值: {minute},必须是 0-59 之间的整数字符", nameof(minute));
|
||||
await new SetTimeTask().Start(h, m, CancellationContext.Instance.Cts.Token, skip);
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 莉奈娅挖矿,调试使用,暂时注释
|
||||
// /// </summary>
|
||||
// /// <param name="mineCount">射箭次数,默认1</param>
|
||||
// /// <param name="scanRounds">大循环寻矿次数。不传则默认5;传单个数字时与射箭次数相同</param>
|
||||
// public async Task StartMining(int? mineCount = null, int? scanRounds = null)
|
||||
// {
|
||||
// var actualMine = mineCount ?? 1;
|
||||
// var actualScan = scanRounds ?? (mineCount ?? 5);
|
||||
// if (actualScan < actualMine) actualScan = actualMine;
|
||||
// await new LinneaMiningTask(actualScan, actualMine).Start(CancellationContext.Instance.Cts.Token);
|
||||
// }
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
@@ -24,11 +23,6 @@ public class GlobalMethod
|
||||
{
|
||||
await Task.Delay(millisecondsTimeout, CancellationContext.Instance.Cts.Token);
|
||||
}
|
||||
|
||||
public static string GetVersion()
|
||||
{
|
||||
return Global.Version;
|
||||
}
|
||||
|
||||
#region 键盘操作
|
||||
|
||||
|
||||
@@ -1,357 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Encodings.Web;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Script.Utils;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.View;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
/// <summary>
|
||||
/// HTML遮罩层 - JS脚本依赖类
|
||||
/// 提供窗口管理与消息通信功能
|
||||
/// </summary>
|
||||
public class HtmlMask : IDisposable
|
||||
{
|
||||
private static readonly JsonSerializerOptions _jsonOptions = new()
|
||||
{
|
||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
|
||||
WriteIndented = false
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// 通信消息结构
|
||||
/// </summary>
|
||||
public class Message
|
||||
{
|
||||
public string Url { get; set; } = "";
|
||||
public JsonElement? Data { get; set; }
|
||||
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
|
||||
public string? RequestId { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 脚本到HTML的待推送队列
|
||||
/// </summary>
|
||||
private static readonly ConcurrentDictionary<string, ConcurrentQueue<Message>> _toHtmlQueues = new();
|
||||
|
||||
/// <summary>
|
||||
/// HTML到脚本的消息队列
|
||||
/// </summary>
|
||||
private static readonly ConcurrentDictionary<string, ConcurrentQueue<Message>> _fromHtmlQueues = new();
|
||||
|
||||
/// <summary>
|
||||
/// JS到HTML请求的等待句柄,用于request-response匹配
|
||||
/// </summary>
|
||||
private static readonly ConcurrentDictionary<string, TaskCompletionSource<string>> _jsPendingRequests = new();
|
||||
|
||||
/// <summary>
|
||||
/// requestId到windowId的映射,用于窗口关闭时取消对应的pending请求
|
||||
/// </summary>
|
||||
private static readonly ConcurrentDictionary<string, string> _requestWindowMap = new();
|
||||
|
||||
private readonly string _workDir;
|
||||
private readonly List<string> _openedWindows = [];
|
||||
private readonly object _openedWindowsLock = new();
|
||||
private bool _disposed;
|
||||
|
||||
public HtmlMask(string workDir)
|
||||
{
|
||||
_workDir = workDir;
|
||||
}
|
||||
|
||||
#region 窗口管理
|
||||
|
||||
/// <summary>
|
||||
/// 显示HTML遮罩窗口
|
||||
/// </summary>
|
||||
public string Show(string url, string? id = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(url))
|
||||
throw new ArgumentException("URL不能为空");
|
||||
|
||||
string finalUrl;
|
||||
|
||||
if (url.StartsWith("http", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
finalUrl = url;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 禁止 file:// 绝对路径,仅允许脚本目录下的相对路径
|
||||
string absPath = ScriptUtils.NormalizePath(_workDir, url);
|
||||
finalUrl = new Uri(absPath).AbsoluteUri;
|
||||
}
|
||||
|
||||
string windowId = HtmlMaskWindow.Show(finalUrl, id, _workDir);
|
||||
|
||||
_toHtmlQueues[windowId] = new ConcurrentQueue<Message>();
|
||||
_fromHtmlQueues[windowId] = new ConcurrentQueue<Message>();
|
||||
lock (_openedWindowsLock) { _openedWindows.Add(windowId); }
|
||||
|
||||
return windowId;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskControl.Logger.LogError(ex, "打开HTML遮罩失败: {Url}", url);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭指定窗口
|
||||
/// </summary>
|
||||
public bool Close(string id)
|
||||
{
|
||||
lock (_openedWindowsLock) { _openedWindows.Remove(id); }
|
||||
CleanupQueues(id);
|
||||
return HtmlMaskWindow.Close(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭所有由本实例打开的窗口
|
||||
/// </summary>
|
||||
public void CloseAll()
|
||||
{
|
||||
List<string> windows;
|
||||
lock (_openedWindowsLock)
|
||||
{
|
||||
windows = [.. _openedWindows];
|
||||
_openedWindows.Clear();
|
||||
}
|
||||
foreach (var windowId in windows)
|
||||
{
|
||||
CleanupQueues(windowId);
|
||||
HtmlMaskWindow.Close(windowId);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有窗口ID
|
||||
/// </summary>
|
||||
public string[] GetWindowIds() => HtmlMaskWindow.GetWindowIds();
|
||||
|
||||
/// <summary>
|
||||
/// 窗口是否存在
|
||||
/// </summary>
|
||||
public bool Exists(string id) => HtmlMaskWindow.Exists(id);
|
||||
|
||||
#endregion
|
||||
|
||||
#region 消息通信
|
||||
|
||||
/// <summary>
|
||||
/// 发送消息到HTML(单向推送)
|
||||
/// </summary>
|
||||
public void Send(string windowId, string url, string jsonData)
|
||||
{
|
||||
if (!HtmlMaskWindow.Exists(windowId) || !_toHtmlQueues.TryGetValue(windowId, out var queue))
|
||||
throw new InvalidOperationException($"HTML遮罩窗口不存在或已关闭: {windowId}");
|
||||
|
||||
queue.Enqueue(new Message
|
||||
{
|
||||
Url = url,
|
||||
Data = ParseData(jsonData)
|
||||
});
|
||||
|
||||
HtmlMaskWindow.NotifyFlush(windowId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发送请求到HTML并等待响应
|
||||
/// </summary>
|
||||
/// <param name="windowId">目标窗口ID</param>
|
||||
/// <param name="url">接口路径</param>
|
||||
/// <param name="jsonData">JSON数据</param>
|
||||
/// <param name="timeoutMs">超时毫秒,0表示无限等待</param>
|
||||
public async Task<string?> Request(string windowId, string url, string jsonData, int timeoutMs = 0)
|
||||
{
|
||||
var requestId = Guid.NewGuid().ToString("N");
|
||||
var tcs = new TaskCompletionSource<string>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
_jsPendingRequests[requestId] = tcs;
|
||||
_requestWindowMap[requestId] = windowId;
|
||||
|
||||
try
|
||||
{
|
||||
if (!HtmlMaskWindow.Exists(windowId) || !_toHtmlQueues.TryGetValue(windowId, out var queue))
|
||||
throw new InvalidOperationException($"HTML遮罩窗口不存在或已关闭: {windowId}");
|
||||
|
||||
queue.Enqueue(new Message
|
||||
{
|
||||
Url = url,
|
||||
Data = ParseData(jsonData),
|
||||
RequestId = requestId
|
||||
});
|
||||
|
||||
HtmlMaskWindow.NotifyFlush(windowId);
|
||||
|
||||
if (timeoutMs > 0)
|
||||
{
|
||||
using var cts = new System.Threading.CancellationTokenSource(timeoutMs);
|
||||
await using var registration = cts.Token.Register(() =>
|
||||
{
|
||||
if (_jsPendingRequests.TryRemove(requestId, out var pending))
|
||||
pending.TrySetResult(null!);
|
||||
});
|
||||
return await tcs.Task;
|
||||
}
|
||||
|
||||
return await tcs.Task;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
_jsPendingRequests.TryRemove(requestId, out _);
|
||||
_requestWindowMap.TryRemove(requestId, out _);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 等待接收来自HTML的一条消息
|
||||
/// </summary>
|
||||
/// <param name="windowId">窗口ID</param>
|
||||
/// <param name="timeoutMs">超时毫秒,0表示无限等待</param>
|
||||
public async Task<string?> Receive(string windowId, int timeoutMs = 0)
|
||||
{
|
||||
if (!_fromHtmlQueues.TryGetValue(windowId, out var queue))
|
||||
return null;
|
||||
|
||||
var sw = System.Diagnostics.Stopwatch.StartNew();
|
||||
while (true)
|
||||
{
|
||||
if (queue.TryDequeue(out var message))
|
||||
return JsonSerializer.Serialize(message, _jsonOptions);
|
||||
|
||||
if (_disposed || !_fromHtmlQueues.ContainsKey(windowId) || !HtmlMaskWindow.Exists(windowId))
|
||||
return null;
|
||||
|
||||
if (timeoutMs > 0 && sw.ElapsedMilliseconds > timeoutMs)
|
||||
return null;
|
||||
|
||||
await Task.Delay(50);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 轮询来自HTML的消息(非阻塞)
|
||||
/// </summary>
|
||||
public string? Poll(string windowId)
|
||||
{
|
||||
if (_fromHtmlQueues.TryGetValue(windowId, out var queue) &&
|
||||
queue.TryDequeue(out var message))
|
||||
{
|
||||
return JsonSerializer.Serialize(message, _jsonOptions);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 批量获取来自HTML的所有消息
|
||||
/// </summary>
|
||||
public string PollAll(string windowId)
|
||||
{
|
||||
var messages = new List<Message>();
|
||||
if (_fromHtmlQueues.TryGetValue(windowId, out var queue))
|
||||
{
|
||||
while (queue.TryDequeue(out var message))
|
||||
{
|
||||
messages.Add(message);
|
||||
}
|
||||
}
|
||||
return JsonSerializer.Serialize(messages, _jsonOptions);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 内部方法
|
||||
|
||||
/// <summary>
|
||||
/// 将待推送队列中的消息通过回调逐一发出
|
||||
/// </summary>
|
||||
internal static void FlushPendingMessages(string windowId, Action<string> postAction)
|
||||
{
|
||||
if (_toHtmlQueues.TryGetValue(windowId, out var queue))
|
||||
{
|
||||
while (queue.TryDequeue(out var msg))
|
||||
{
|
||||
postAction(JsonSerializer.Serialize(msg, _jsonOptions));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// HTML端发来的消息入队,如果是JS请求的响应则直接resolve
|
||||
/// </summary>
|
||||
internal static void SendFromHtml(string windowId, string url, string data, string? requestId = null)
|
||||
{
|
||||
// 匹配JS端pending的request
|
||||
if (requestId != null && _jsPendingRequests.TryRemove(requestId, out var tcs))
|
||||
{
|
||||
var parsed = ParseData(data);
|
||||
tcs.TrySetResult(parsed != null ? parsed.Value.GetRawText() : "null");
|
||||
return;
|
||||
}
|
||||
|
||||
// 普通消息入队
|
||||
if (_fromHtmlQueues.TryGetValue(windowId, out var queue))
|
||||
{
|
||||
queue.Enqueue(new Message
|
||||
{
|
||||
Url = url,
|
||||
Data = ParseData(data),
|
||||
RequestId = requestId
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static JsonElement? ParseData(string? json)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(json)) return null;
|
||||
try
|
||||
{
|
||||
using var doc = JsonDocument.Parse(json);
|
||||
return doc.RootElement.Clone();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 不是合法JSON,作为纯文本包装
|
||||
return JsonSerializer.SerializeToElement(json, _jsonOptions);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CleanupQueues(string windowId)
|
||||
{
|
||||
_toHtmlQueues.TryRemove(windowId, out _);
|
||||
_fromHtmlQueues.TryRemove(windowId, out _);
|
||||
|
||||
// 取消该窗口关联的待响应请求
|
||||
foreach (var kvp in _requestWindowMap)
|
||||
{
|
||||
if (kvp.Value == windowId && _jsPendingRequests.TryRemove(kvp.Key, out var tcs))
|
||||
{
|
||||
tcs.TrySetCanceled();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
_disposed = true;
|
||||
CloseAll();
|
||||
}
|
||||
}
|
||||
@@ -1,504 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using BetterGenshinImpact.Core.Monitor;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using Gma.System.MouseKeyHook;
|
||||
using Microsoft.ClearScript;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
public class KeyMouseHook: IDisposable
|
||||
{
|
||||
private IKeyboardMouseEvents? _appEvents;
|
||||
private IKeyboardMouseEvents AppHook => _appEvents ??= MouseKeyMonitor.GlobalHook;
|
||||
|
||||
private readonly List<ScriptObject> _keyDownDataCallbacks = new();
|
||||
private readonly List<ScriptObject> _keyUpDataCallbacks = new();
|
||||
private readonly List<ScriptObject> _keyDownCodeCallbacks = new();
|
||||
private readonly List<ScriptObject> _keyUpCodeCallbacks = new();
|
||||
private readonly List<ScriptObject> _mouseDownCallbacks = new();
|
||||
private readonly List<ScriptObject> _mouseUpCallbacks = new();
|
||||
private readonly List<ScriptObject> _mouseMoveCallbacks = new();
|
||||
private readonly List<ScriptObject> _mouseWheelCallbacks = new();
|
||||
|
||||
/// <summary>
|
||||
/// 存储每个鼠标移动回调的间隔时间(毫秒)
|
||||
/// </summary>
|
||||
private readonly Dictionary<ScriptObject, int> _mouseMoveCallbackIntervals = new();
|
||||
|
||||
/// <summary>
|
||||
/// 存储每个鼠标移动回调的上次调用时间
|
||||
/// </summary>
|
||||
private readonly Dictionary<ScriptObject, DateTime> _lastMouseMoveCallbackTimes = new();
|
||||
|
||||
private KeyEventHandler? _keyDownHandler;
|
||||
private KeyEventHandler? _keyUpHandler;
|
||||
private EventHandler<MouseEventExtArgs>? _mouseDownExtHandler;
|
||||
private EventHandler<MouseEventExtArgs>? _mouseUpExtHandler;
|
||||
private EventHandler<MouseEventExtArgs>? _mouseMoveExtHandler;
|
||||
private EventHandler<MouseEventExtArgs>? _mouseWheelExtHandler;
|
||||
|
||||
private readonly object _mouseMoveLock = new();
|
||||
private DateTime _lastProcessMouseMoveTime = DateTime.MinValue;
|
||||
|
||||
private readonly ILogger<KeyMouseHook> _logger = App.GetLogger<KeyMouseHook>();
|
||||
|
||||
/// <summary>
|
||||
/// 统一处理回调函数执行过程中的异常
|
||||
/// </summary>
|
||||
/// <param name="ex">捕获到的异常</param>
|
||||
/// <param name="eventType">事件类型描述</param>
|
||||
private void HandleCallbackException(Exception ex, string eventType)
|
||||
{
|
||||
if (ex is ScriptEngineException scriptEx)
|
||||
{
|
||||
_logger.LogError("执行{eventType}JS回调时发生错误:{scriptEx.Message},清除所有回调",eventType, scriptEx.Message);
|
||||
_logger.LogDebug("{scriptEx}",scriptEx);
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogError("执行{eventType}回调时发生错误:{ex.Message},清除所有回调,如果此异常出现在JS脚本结束时,请在JS脚本结束前手动调用Dispose()方法",eventType,ex.Message);
|
||||
_logger.LogDebug("{ex}",ex);
|
||||
}
|
||||
|
||||
Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将全局屏幕坐标转换为游戏窗口局部坐标
|
||||
/// </summary>
|
||||
/// <param name="globalX">全局X坐标</param>
|
||||
/// <param name="globalY">全局Y坐标</param>
|
||||
/// <returns>游戏窗口局部坐标(X, Y),转换失败时返回(-1, -1)</returns>
|
||||
private (int X, int Y) ConvertToLocalCoordinates(int globalX, int globalY)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 检查TaskContext是否已初始化
|
||||
if (!TaskContext.Instance().IsInitialized)
|
||||
{
|
||||
_logger.LogError("TaskContext未初始化,无法获取游戏窗口信息");
|
||||
return (-1, -1);
|
||||
}
|
||||
|
||||
var gameHandle = TaskContext.Instance().GameHandle;
|
||||
if (gameHandle == IntPtr.Zero)
|
||||
{
|
||||
_logger.LogError("游戏窗口句柄无效,无法获取游戏窗口位置");
|
||||
return (-1, -1);
|
||||
}
|
||||
|
||||
// 获取游戏窗口捕获区域
|
||||
var captureRect = SystemControl.GetCaptureRect(gameHandle);
|
||||
|
||||
// 检查捕获区域是否有效
|
||||
if (captureRect.Width <= 0 || captureRect.Height <= 0)
|
||||
{
|
||||
_logger.LogError("获取的游戏窗口捕获区域无效,宽度或高度为0");
|
||||
return (-1, -1);
|
||||
}
|
||||
|
||||
// 计算局部坐标
|
||||
int localX = globalX - captureRect.Left;
|
||||
int localY = globalY - captureRect.Top;
|
||||
|
||||
return (localX, localY);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "转换鼠标坐标时发生错误");
|
||||
return (-1, -1);
|
||||
}
|
||||
}
|
||||
|
||||
private readonly System.Threading.Channels.Channel<Action> _eventChannel =
|
||||
System.Threading.Channels.Channel.CreateBounded<Action>(
|
||||
new System.Threading.Channels.BoundedChannelOptions(2048)
|
||||
{
|
||||
FullMode = System.Threading.Channels.BoundedChannelFullMode.Wait,
|
||||
SingleReader = true,
|
||||
SingleWriter = false
|
||||
});
|
||||
private readonly CancellationTokenSource _cts = new();
|
||||
|
||||
public KeyMouseHook()
|
||||
{
|
||||
// 启动后台事件处理器,确保不阻塞钩子线程
|
||||
_ = Task.Run(async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
var reader = _eventChannel.Reader;
|
||||
while (await reader.WaitToReadAsync(_cts.Token))
|
||||
{
|
||||
while (reader.TryRead(out var action))
|
||||
{
|
||||
try
|
||||
{
|
||||
action();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 内部错误已在 action 闭包中通过 HandleCallbackException 处理
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException) { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogError(ex, "键鼠钩子后台处理器发生异常");
|
||||
}
|
||||
});
|
||||
|
||||
// 初始化事件处理程序
|
||||
_keyDownHandler = (_, args) =>
|
||||
{
|
||||
if (_keyDownDataCallbacks.Count == 0 && _keyDownCodeCallbacks.Count == 0) return;
|
||||
|
||||
var keyDownDataCallbacksCopy = new List<ScriptObject>(_keyDownDataCallbacks);
|
||||
var keyDownCodeCallbacksCopy = new List<ScriptObject>(_keyDownCodeCallbacks);
|
||||
var keyDataStr = args.KeyData.ToString();
|
||||
var keyCodeStr = args.KeyCode.ToString();
|
||||
|
||||
if (!_eventChannel.Writer.TryWrite(() =>
|
||||
{
|
||||
// 调用KeyData回调
|
||||
foreach (var callback in keyDownDataCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(keyDataStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "键盘按下事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 调用KeyCode回调
|
||||
foreach (var callback in keyDownCodeCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(keyCodeStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "键盘按下事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}))
|
||||
{
|
||||
_logger.LogWarning("事件队列已满或已关闭,忽略键盘按下回调");
|
||||
}
|
||||
};
|
||||
|
||||
_keyUpHandler = (_, args) =>
|
||||
{
|
||||
if (_keyUpDataCallbacks.Count == 0 && _keyUpCodeCallbacks.Count == 0) return;
|
||||
|
||||
var keyUpDataCallbacksCopy = new List<ScriptObject>(_keyUpDataCallbacks);
|
||||
var keyUpCodeCallbacksCopy = new List<ScriptObject>(_keyUpCodeCallbacks);
|
||||
var keyDataStr = args.KeyData.ToString();
|
||||
var keyCodeStr = args.KeyCode.ToString();
|
||||
if (!_eventChannel.Writer.TryWrite(() =>
|
||||
{
|
||||
// 调用KeyData回调
|
||||
foreach (var callback in keyUpDataCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(keyDataStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "键盘释放事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 调用KeyCode回调
|
||||
foreach (var callback in keyUpCodeCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(keyCodeStr);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "键盘释放事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}))
|
||||
{
|
||||
_logger.LogWarning("事件队列已满或已关闭,忽略键盘释放回调");
|
||||
}
|
||||
};
|
||||
|
||||
_mouseDownExtHandler = (_, args) =>
|
||||
{
|
||||
if (_mouseDownCallbacks.Count == 0) return;
|
||||
|
||||
var mouseDownCallbacksCopy = new List<ScriptObject>(_mouseDownCallbacks);
|
||||
var (localX, localY) = ConvertToLocalCoordinates(args.X, args.Y);
|
||||
var buttonStr = args.Button.ToString();
|
||||
|
||||
if (!_eventChannel.Writer.TryWrite(() =>
|
||||
{
|
||||
foreach (var callback in mouseDownCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(buttonStr, localX, localY);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "鼠标按下事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}))
|
||||
{
|
||||
_logger.LogWarning("事件队列已满或已关闭,忽略鼠标按下回调");
|
||||
}
|
||||
};
|
||||
|
||||
_mouseUpExtHandler = (_, args) =>
|
||||
{
|
||||
if (_mouseUpCallbacks.Count == 0) return;
|
||||
|
||||
var mouseUpCallbacksCopy = new List<ScriptObject>(_mouseUpCallbacks);
|
||||
var (localX, localY) = ConvertToLocalCoordinates(args.X, args.Y);
|
||||
var buttonStr = args.Button.ToString();
|
||||
|
||||
if (!_eventChannel.Writer.TryWrite(() =>
|
||||
{
|
||||
foreach (var callback in mouseUpCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(buttonStr, localX, localY);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "鼠标释放事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}))
|
||||
{
|
||||
_logger.LogWarning("事件队列已满或已关闭,忽略鼠标释放回调");
|
||||
}
|
||||
};
|
||||
|
||||
_mouseMoveExtHandler = (_, args) =>
|
||||
{
|
||||
if (_mouseMoveCallbacks.Count == 0) return;
|
||||
|
||||
var now = DateTime.Now;
|
||||
if ((now - _lastProcessMouseMoveTime).TotalMilliseconds < 10) return;
|
||||
_lastProcessMouseMoveTime = now;
|
||||
|
||||
var mouseMoveCallbacksCopy = new List<ScriptObject>(_mouseMoveCallbacks);
|
||||
var (localX, localY) = ConvertToLocalCoordinates(args.X, args.Y);
|
||||
|
||||
if (!_eventChannel.Writer.TryWrite(() =>
|
||||
{
|
||||
foreach (var callback in mouseMoveCallbacksCopy)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
lock (_mouseMoveLock)
|
||||
{
|
||||
if (_mouseMoveCallbackIntervals.TryGetValue(callback, out var interval) &&
|
||||
_lastMouseMoveCallbackTimes.TryGetValue(callback, out var lastTime))
|
||||
{
|
||||
var timeSpan = now - lastTime;
|
||||
if (timeSpan.TotalMilliseconds >= interval)
|
||||
{
|
||||
callback.InvokeAsFunction(localX, localY);
|
||||
_lastMouseMoveCallbackTimes[callback] = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "鼠标移动事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}))
|
||||
{
|
||||
_logger.LogWarning("事件队列已满或已关闭,忽略鼠标移动回调");
|
||||
}
|
||||
};
|
||||
|
||||
_mouseWheelExtHandler = (_, args) =>
|
||||
{
|
||||
if (_mouseWheelCallbacks.Count == 0) return;
|
||||
|
||||
var mouseWheelCallbacksCopy = new List<ScriptObject>(_mouseWheelCallbacks);
|
||||
var (localX, localY) = ConvertToLocalCoordinates(args.X, args.Y);
|
||||
var delta = args.Delta;
|
||||
|
||||
if (!_eventChannel.Writer.TryWrite(() =>
|
||||
{
|
||||
foreach (var callback in mouseWheelCallbacksCopy)
|
||||
{
|
||||
try
|
||||
{
|
||||
callback.InvokeAsFunction(delta, localX, localY);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
HandleCallbackException(ex, "鼠标滚轮事件");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}))
|
||||
{
|
||||
_logger.LogWarning("事件队列已满或已关闭,忽略鼠标滚轮回调");
|
||||
}
|
||||
};
|
||||
|
||||
// 添加事件监听器
|
||||
AppHook.KeyDown += _keyDownHandler;
|
||||
AppHook.KeyUp += _keyUpHandler;
|
||||
AppHook.MouseDownExt += _mouseDownExtHandler;
|
||||
AppHook.MouseUpExt += _mouseUpExtHandler;
|
||||
AppHook.MouseMoveExt += _mouseMoveExtHandler;
|
||||
AppHook.MouseWheelExt += _mouseWheelExtHandler;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册键盘按下事件回调
|
||||
/// </summary>
|
||||
/// <param name="callback">回调函数</param>
|
||||
/// <param name="useCodeOnly">是否仅返回KeyCode,默认为true(仅返回KeyCode)</param>
|
||||
public void OnKeyDown(ScriptObject callback, bool useCodeOnly = true)
|
||||
{
|
||||
if (useCodeOnly)
|
||||
_keyDownCodeCallbacks.Add(callback);
|
||||
else
|
||||
_keyDownDataCallbacks.Add(callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册键盘释放事件回调
|
||||
/// </summary>
|
||||
/// <param name="callback">回调函数</param>
|
||||
/// <param name="useCodeOnly">是否仅返回KeyCode,默认为true(仅返回KeyCode)</param>
|
||||
public void OnKeyUp(ScriptObject callback, bool useCodeOnly = true)
|
||||
{
|
||||
if (useCodeOnly)
|
||||
_keyUpCodeCallbacks.Add(callback);
|
||||
else
|
||||
_keyUpDataCallbacks.Add(callback);
|
||||
}
|
||||
|
||||
public void OnMouseDown(ScriptObject callback)
|
||||
{
|
||||
_mouseDownCallbacks.Add(callback);
|
||||
}
|
||||
|
||||
public void OnMouseUp(ScriptObject callback)
|
||||
{
|
||||
_mouseUpCallbacks.Add(callback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 注册鼠标移动事件回调
|
||||
/// </summary>
|
||||
/// <param name="callback">回调函数</param>
|
||||
/// <param name="interval">回调间隔时间(毫秒),默认200ms</param>
|
||||
public void OnMouseMove(ScriptObject callback, int interval = 200)
|
||||
{
|
||||
_mouseMoveCallbacks.Add(callback);
|
||||
_mouseMoveCallbackIntervals[callback] = interval;
|
||||
_lastMouseMoveCallbackTimes[callback] = DateTime.MinValue;
|
||||
}
|
||||
|
||||
public void OnMouseWheel(ScriptObject callback)
|
||||
{
|
||||
_mouseWheelCallbacks.Add(callback);
|
||||
}
|
||||
|
||||
public void RemoveAllListeners()
|
||||
{
|
||||
_keyDownDataCallbacks.Clear();
|
||||
_keyUpDataCallbacks.Clear();
|
||||
_keyDownCodeCallbacks.Clear();
|
||||
_keyUpCodeCallbacks.Clear();
|
||||
_mouseDownCallbacks.Clear();
|
||||
_mouseUpCallbacks.Clear();
|
||||
_mouseMoveCallbacks.Clear();
|
||||
_mouseWheelCallbacks.Clear();
|
||||
|
||||
_mouseMoveCallbackIntervals.Clear();
|
||||
_lastMouseMoveCallbackTimes.Clear();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_cts.Cancel();
|
||||
_eventChannel.Writer.TryComplete();
|
||||
// 移除所有事件监听器
|
||||
if (_keyDownHandler != null)
|
||||
{
|
||||
AppHook.KeyDown -= _keyDownHandler;
|
||||
_keyDownHandler = null;
|
||||
}
|
||||
|
||||
if (_keyUpHandler != null)
|
||||
{
|
||||
AppHook.KeyUp -= _keyUpHandler;
|
||||
_keyUpHandler = null;
|
||||
}
|
||||
|
||||
if (_mouseDownExtHandler != null)
|
||||
{
|
||||
AppHook.MouseDownExt -= _mouseDownExtHandler;
|
||||
_mouseDownExtHandler = null;
|
||||
}
|
||||
|
||||
if (_mouseUpExtHandler != null)
|
||||
{
|
||||
AppHook.MouseUpExt -= _mouseUpExtHandler;
|
||||
_mouseUpExtHandler = null;
|
||||
}
|
||||
|
||||
if (_mouseMoveExtHandler != null)
|
||||
{
|
||||
AppHook.MouseMoveExt -= _mouseMoveExtHandler;
|
||||
_mouseMoveExtHandler = null;
|
||||
}
|
||||
|
||||
if (_mouseWheelExtHandler != null)
|
||||
{
|
||||
AppHook.MouseWheelExt -= _mouseWheelExtHandler;
|
||||
_mouseWheelExtHandler = null;
|
||||
}
|
||||
|
||||
// 清空回调列表
|
||||
RemoveAllListeners();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
using BetterGenshinImpact.Core.Script.Utils;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using OpenCvSharp;
|
||||
@@ -15,7 +13,6 @@ public class LimitedFile(string rootPath)
|
||||
{
|
||||
/// <summary>
|
||||
/// 读取指定文件夹内所有文件和文件夹的路径(非递归方式)。
|
||||
/// 目录不存在时返回空数组
|
||||
/// </summary>
|
||||
/// <param name="folderPath">文件夹路径(相对于根目录)</param>
|
||||
/// <returns>文件夹内所有文件和文件夹的路径数组</returns>
|
||||
@@ -24,19 +21,19 @@ public class LimitedFile(string rootPath)
|
||||
try
|
||||
{
|
||||
// 对传入的文件夹路径进行标准化
|
||||
string fullPath = NormalizePath(folderPath);
|
||||
string normalizedFolderPath = NormalizePath(folderPath);
|
||||
|
||||
if (!Directory.Exists(fullPath))
|
||||
// 确保目录存在
|
||||
if (!Directory.Exists(normalizedFolderPath))
|
||||
{
|
||||
TaskControl.Logger.LogError("ReadPathSync 目录不存在: {Path}", fullPath);
|
||||
return Array.Empty<string>();
|
||||
Directory.CreateDirectory(normalizedFolderPath);
|
||||
}
|
||||
|
||||
// 获取指定文件夹下的所有文件(非递归)
|
||||
string[] files = Directory.GetFiles(fullPath, "*", SearchOption.TopDirectoryOnly);
|
||||
string[] files = Directory.GetFiles(normalizedFolderPath, "*", SearchOption.TopDirectoryOnly);
|
||||
|
||||
// 获取指定文件夹下的所有子文件夹(非递归)
|
||||
string[] directories = Directory.GetDirectories(fullPath, "*", SearchOption.TopDirectoryOnly);
|
||||
string[] directories = Directory.GetDirectories(normalizedFolderPath, "*", SearchOption.TopDirectoryOnly);
|
||||
|
||||
// 合并文件和文件夹路径
|
||||
string[] combined = files.Concat(directories).ToArray();
|
||||
@@ -46,33 +43,12 @@ public class LimitedFile(string rootPath)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 记录异常并返回空数组
|
||||
TaskControl.Logger.LogError("ReadPathSync 异常: {Message}", ex.Message);
|
||||
return Array.Empty<string>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建指定路径的目录,如果已存在则跳过
|
||||
/// </summary>
|
||||
/// <param name="folderPath">文件夹路径(相对于根目录)</param>
|
||||
/// <returns>是否创建成功或目录已存在</returns>
|
||||
public bool CreateDirectory(string folderPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 对传入的文件夹路径进行标准化
|
||||
string fullPath = NormalizePath(folderPath);
|
||||
// 如果目录不存在,自动创建
|
||||
if (!Directory.Exists(fullPath)){Directory.CreateDirectory(fullPath);}
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskControl.Logger.LogError("CreateDir 异常: {Message}", ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断指定路径是否为文件夹。
|
||||
/// </summary>
|
||||
@@ -96,44 +72,6 @@ public class LimitedFile(string rootPath)
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断指定路径是否为文件
|
||||
/// </summary>
|
||||
/// <param name="path">文件路径(相对于根目录)</param>
|
||||
/// <returns>如果是文件则返回 true,否则返回 false</returns>
|
||||
public bool IsFile(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
string normalizedPath = NormalizePath(path);
|
||||
return File.Exists(normalizedPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskControl.Logger.LogError("IsFile 异常: {Message}", ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 判断指定的文件或目录是否存在
|
||||
/// </summary>
|
||||
/// <param name="path">文件或目录路径(相对于根目录)</param>
|
||||
/// <returns>如果存在返回 true,否则返回 false</returns>
|
||||
public bool IsExists(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
string normalizedPath = NormalizePath(path);
|
||||
return File.Exists(normalizedPath) || Directory.Exists(normalizedPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskControl.Logger.LogError("IsExists 异常: {Message}", ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Normalize and validate a path.
|
||||
/// </summary>
|
||||
@@ -509,51 +447,4 @@ public class LimitedFile(string rootPath)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重命名文件或文件夹(相对于根目录)
|
||||
/// </summary>
|
||||
/// <param name="oldPath">原路径</param>
|
||||
/// <param name="newPath">新路径</param>
|
||||
/// <returns>是否重命名成功</returns>
|
||||
public bool RenamePathSync(string oldPath, string newPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 标准化路径
|
||||
oldPath = NormalizePath(oldPath);
|
||||
newPath = NormalizePath(newPath);
|
||||
|
||||
// 检查原路径是否存在
|
||||
if (!File.Exists(oldPath) && !Directory.Exists(oldPath))
|
||||
{
|
||||
TaskControl.Logger.LogError("RenamePathSync 异常: 原路径不存在 {Path}", oldPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
//验证扩展名合法性
|
||||
if (File.Exists(oldPath) && !IsValid(newPath))
|
||||
{
|
||||
TaskControl.Logger.LogError("RenamePathSync 异常: 新文件路径不合法 {Path}", newPath);
|
||||
return false;
|
||||
}
|
||||
|
||||
// 确保目标目录存在
|
||||
string? directoryPath = Path.GetDirectoryName(newPath);
|
||||
if (!string.IsNullOrEmpty(directoryPath) && !Directory.Exists(directoryPath))
|
||||
{
|
||||
Directory.CreateDirectory(directoryPath);
|
||||
}
|
||||
|
||||
// 执行重命名
|
||||
Directory.Move(oldPath, newPath);
|
||||
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TaskControl.Logger.LogError("RenamePathSync 异常: {Message}", ex.Message);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using BetterGenshinImpact.Core.Script.Dependence.Model.TimerConfig;
|
||||
using BetterGenshinImpact.GameTask.AutoSkip;
|
||||
using BetterGenshinImpact.Core.Script.Dependence.Model.TimerConfig;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence.Model;
|
||||
@@ -42,16 +40,5 @@ public class RealtimeTimer
|
||||
{
|
||||
Config = ScriptObjectConverter.ConvertTo<AutoPickExternalConfig>(config);
|
||||
}
|
||||
else if (Name == "AutoSkip")
|
||||
{
|
||||
if (config is AutoSkipConfig)
|
||||
{
|
||||
Config = config;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ArgumentException("AutoSkip的配置参数需要为AutoSkipConfig类型");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Dependence;
|
||||
|
||||
/// <summary>
|
||||
/// 战斗策略文件访问类
|
||||
/// 提供JS脚本环境访问 User\AutoFight 目录下战斗策略文件的方法
|
||||
/// </summary>
|
||||
public class StrategyFile
|
||||
{
|
||||
private readonly LimitedFile _strategyFile = new(Global.Absolute(@"User\AutoFight"));
|
||||
|
||||
/// <summary>
|
||||
/// 判断 User\AutoFight 目录下的路径是否为文件夹
|
||||
/// </summary>
|
||||
/// <param name="subPath">相对于 User\AutoFight 的路径</param>
|
||||
/// <returns>是文件夹返回 true,否则返回 false</returns>
|
||||
public bool IsFolder(string subPath) => _strategyFile.IsFolder(subPath);
|
||||
|
||||
/// <summary>
|
||||
/// 判断 User\AutoFight 目录下的路径是否为文件
|
||||
/// </summary>
|
||||
/// <param name="subPath">相对于 User\AutoFight 的路径</param>
|
||||
/// <returns>是文件返回 true,否则返回 false</returns>
|
||||
public bool IsFile(string subPath) => _strategyFile.IsFile(subPath);
|
||||
|
||||
/// <summary>
|
||||
/// 判断 User\AutoFight 目录下的路径是否存在
|
||||
/// </summary>
|
||||
/// <param name="subPath">相对于 User\AutoFight 的路径</param>
|
||||
/// <returns>存在返回 true,否则返回 false</returns>
|
||||
public bool IsExists(string subPath) => _strategyFile.IsExists(subPath);
|
||||
|
||||
/// <summary>
|
||||
/// 读取 User\AutoFight 目录下指定文件夹的内容(非递归方式)
|
||||
/// 目录不存在时返回空数组,不会自动创建目录
|
||||
/// </summary>
|
||||
/// <param name="subPath">相对于 User\AutoFight 的子目录路径,默认为根目录</param>
|
||||
/// <returns>文件夹内所有文件和文件夹的相对路径数组,出错时返回空数组</returns>
|
||||
public string[] ReadPathSync(string subPath = "./") => _strategyFile.ReadPathSync(subPath);
|
||||
}
|
||||
@@ -1,21 +1,16 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using BetterGenshinImpact.Core.Script.Dependence;
|
||||
using BetterGenshinImpact.Core.Script.Dependence;
|
||||
using BetterGenshinImpact.Core.Script.Dependence.Model;
|
||||
using Microsoft.ClearScript;
|
||||
using System.Reflection;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.BgiVision;
|
||||
using OpenCvSharp;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.Core.Script.Utils;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask.AutoDomain;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoLeyLineOutcrop;
|
||||
using BetterGenshinImpact.GameTask.AutoSkip;
|
||||
using BetterGenshinImpact.GameTask.AutoStygianOnslaught;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script;
|
||||
|
||||
@@ -39,12 +34,11 @@ public class EngineExtend
|
||||
engine.AddHostObject("file", new LimitedFile(workDir)); // 限制文件访问
|
||||
engine.AddHostObject("http", new Http()); // 限制文件访问
|
||||
engine.AddHostObject("notification", new Notification());
|
||||
|
||||
|
||||
// 任务调度器
|
||||
engine.AddHostObject("dispatcher", new Dispatcher(config));
|
||||
engine.AddHostType("RealtimeTimer", typeof(RealtimeTimer));
|
||||
engine.AddHostType("SoloTask", typeof(SoloTask));
|
||||
engine.AddHostType("AutoSkipConfig", typeof(AutoSkipConfig));
|
||||
|
||||
// 添加取消令牌相关类型
|
||||
engine.AddHostType("CancellationTokenSource", typeof(CancellationTokenSource));
|
||||
@@ -75,48 +69,19 @@ public class EngineExtend
|
||||
|
||||
engine.AddHostType("AutoDomainParam", typeof(AutoDomainParam));
|
||||
engine.AddHostType("AutoFightParam", typeof(AutoFightParam));
|
||||
engine.AddHostType("AutoLeyLineOutcropParam", typeof(AutoLeyLineOutcropParam));
|
||||
engine.AddHostType("AutoStygianOnslaughtParam", typeof(AutoStygianOnslaughtParam));
|
||||
engine.AddHostObject("strategyFile", new StrategyFile());
|
||||
//鼠标回调
|
||||
engine.AddHostType("KeyMouseHook", typeof(KeyMouseHook));
|
||||
|
||||
|
||||
|
||||
// 添加C#的类型
|
||||
engine.AddHostType(typeof(Task));
|
||||
|
||||
// 新的BvPage类
|
||||
engine.AddHostType("BvPage", typeof(BvPage));
|
||||
engine.AddHostType("BvLocator", typeof(BvLocator));
|
||||
engine.AddHostType("BvImage", typeof(BvImage));
|
||||
|
||||
engine.AddHostObject("host", new CustomHostFunctions());
|
||||
|
||||
// HTML 遮罩
|
||||
engine.AddHostObject("htmlMask", new HtmlMask(workDir));
|
||||
|
||||
// 导入 JavaScript 模块
|
||||
// 导入 CommonJS 模块
|
||||
// https://microsoft.github.io/ClearScript/2023/01/24/module-interop.html
|
||||
// https://github.com/microsoft/ClearScript/blob/master/ClearScriptTest/V8ModuleTest.cs
|
||||
engine.DocumentSettings.AccessFlags = DocumentAccessFlags.EnableFileLoading | DocumentAccessFlags.AllowCategoryMismatch;
|
||||
if (searchPaths != null)
|
||||
{
|
||||
var normalizedPaths = new List<string>();
|
||||
foreach (var path in searchPaths)
|
||||
{
|
||||
try
|
||||
{
|
||||
var normalizedPath = ScriptUtils.NormalizePath(workDir, path);
|
||||
normalizedPaths.Add(normalizedPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception($"从 library 字段读取路径 '{path}' 失败: {ex.Message}", ex);
|
||||
}
|
||||
}
|
||||
|
||||
if (normalizedPaths.Count > 0)
|
||||
{
|
||||
engine.DocumentSettings.SearchPath = string.Join(';', normalizedPaths);
|
||||
}
|
||||
engine.DocumentSettings.SearchPath = string.Join(';', searchPaths);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -134,7 +99,6 @@ public class EngineExtend
|
||||
|
||||
#pragma warning disable CS8974 // Converting method group to non-delegate type
|
||||
engine.AddHostObject("sleep", GlobalMethod.Sleep);
|
||||
engine.AddHostObject("getVersion", GlobalMethod.GetVersion);
|
||||
engine.AddHostObject("keyDown", GlobalMethod.KeyDown);
|
||||
engine.AddHostObject("keyUp", GlobalMethod.KeyUp);
|
||||
engine.AddHostObject("keyPress", GlobalMethod.KeyPress);
|
||||
@@ -158,4 +122,4 @@ public class EngineExtend
|
||||
engine.AddHostObject("inputText", GlobalMethod.InputText);
|
||||
#pragma warning restore CS8974 // Converting method group to non-delegate type
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -216,9 +216,6 @@ public partial class ScriptGroupProject : ObservableObject
|
||||
}
|
||||
JsScriptSettingsObject ??= new ExpandoObject();
|
||||
|
||||
// 清理配置中的无效值
|
||||
CleanInvalidSettingsValues();
|
||||
|
||||
var pathingPartyConfig = GroupInfo?.Config.PathingConfig;
|
||||
await Project.ExecuteAsync(JsScriptSettingsObject, pathingPartyConfig);
|
||||
}
|
||||
@@ -339,67 +336,6 @@ public partial class ScriptGroupProject : ObservableObject
|
||||
{
|
||||
OnPropertyChanged(nameof(ScheduleDesc));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清理 JsScriptSettingsObject 中不在 settings.json 定义的 Options 列表中的无效值
|
||||
/// </summary>
|
||||
private void CleanInvalidSettingsValues()
|
||||
{
|
||||
if (Project == null || JsScriptSettingsObject == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
// 加载 settings.json 中定义的配置项
|
||||
var settingItems = Project.Manifest.LoadSettingItems(Project.ProjectPath);
|
||||
if (settingItems.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var settingsDict = JsScriptSettingsObject as IDictionary<string, object?>;
|
||||
if (settingsDict == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// 遍历所有 multi-checkbox 类型的配置项
|
||||
foreach (var item in settingItems.Where(i => i.Type == "multi-checkbox"))
|
||||
{
|
||||
if (!settingsDict.ContainsKey(item.Name))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// 获取当前保存的值
|
||||
var savedValue = settingsDict[item.Name];
|
||||
List<string>? checkedValues = null;
|
||||
|
||||
if (savedValue is List<string> stringList)
|
||||
{
|
||||
checkedValues = stringList;
|
||||
}
|
||||
else if (savedValue is List<object> objectList)
|
||||
{
|
||||
checkedValues = objectList.Select(i => (string)i).ToList();
|
||||
settingsDict[item.Name] = checkedValues;
|
||||
}
|
||||
|
||||
// 清理不在 Options 列表中的无效值
|
||||
if (checkedValues != null && item.Options != null)
|
||||
{
|
||||
checkedValues.RemoveAll(value => !item.Options.Contains(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// 清理失败不影响脚本执行,只记录日志
|
||||
TaskControl.Logger.LogDebug(ex, "清理JS脚本配置中的无效值时发生异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ScriptGroupProjectExtensions
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.ClearScript;
|
||||
using Microsoft.ClearScript.JavaScript;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script
|
||||
{
|
||||
public class PackageDocumentLoader : DocumentLoader
|
||||
{
|
||||
private readonly string _scriptRootPath;
|
||||
|
||||
public PackageDocumentLoader(string scriptRootPath)
|
||||
{
|
||||
_scriptRootPath = Path.GetFullPath(scriptRootPath);
|
||||
}
|
||||
|
||||
public override async Task<Document> LoadDocumentAsync(DocumentSettings settings, DocumentInfo? sourceInfo, string specifier, DocumentCategory category, DocumentContextCallback contextCallback)
|
||||
{
|
||||
string? targetPath = ResolvePhysicalPath(settings, sourceInfo, specifier);
|
||||
|
||||
if (targetPath == null || !File.Exists(targetPath))
|
||||
{
|
||||
return await Default.LoadDocumentAsync(settings, sourceInfo, specifier, category, contextCallback);
|
||||
}
|
||||
|
||||
// 处理 JS 文件的重写
|
||||
if (Path.GetExtension(targetPath).ToLower() == ".js")
|
||||
{
|
||||
string content = await File.ReadAllTextAsync(targetPath);
|
||||
string processedCode = RewriteScriptCode(content, targetPath);
|
||||
var documentInfo = new DocumentInfo(new Uri(targetPath)) { Category = ModuleCategory.Standard };
|
||||
return new StringDocument(documentInfo, processedCode);
|
||||
}
|
||||
|
||||
return await Default.LoadDocumentAsync(settings, sourceInfo, specifier, category, contextCallback);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// js重写
|
||||
/// </summary>
|
||||
public string RewriteScriptCode(string code, string currentFilePath)
|
||||
{
|
||||
if (string.IsNullOrEmpty(code)) return code;
|
||||
|
||||
string result = code.Replace("../../../packages", "packages");
|
||||
|
||||
// 拦截资源导入
|
||||
var resourceRegex = new Regex(@"import\s+([\w\d_*$]+|[\s\S]*?)\s+from\s+(['""])([^'""\n]+)(['""])");
|
||||
result = resourceRegex.Replace(result, match =>
|
||||
{
|
||||
string importPart = match.Groups[1].Value.Trim();
|
||||
string quote = match.Groups[2].Value;
|
||||
string rawPath = match.Groups[3].Value;
|
||||
|
||||
string path = rawPath.Replace("../../../packages", "packages");
|
||||
string? resourceFullPath = ResolvePathInternal(null, currentFilePath, path);
|
||||
|
||||
if (resourceFullPath != null && File.Exists(resourceFullPath))
|
||||
{
|
||||
string normalizedPath = Path.GetRelativePath(_scriptRootPath, resourceFullPath).Replace("\\", "/");
|
||||
bool isJs = resourceFullPath.EndsWith(".js", StringComparison.OrdinalIgnoreCase);
|
||||
bool isImage = IsImageFile(resourceFullPath);
|
||||
|
||||
// 图片 -> Mat
|
||||
if (isImage)
|
||||
{
|
||||
if (importPart.StartsWith("{")) return match.Value;
|
||||
return $"const {importPart} = file.ReadImageMatSync({quote}{normalizedPath}{quote});";
|
||||
}
|
||||
|
||||
// 非 JS 资源 -> 文本内容
|
||||
if (!isJs)
|
||||
{
|
||||
if (importPart.StartsWith("{")) return match.Value;
|
||||
return $"const {importPart} = file.ReadTextSync({quote}{normalizedPath}{quote});";
|
||||
}
|
||||
}
|
||||
|
||||
return match.Value;
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private string? ResolvePhysicalPath(DocumentSettings settings, DocumentInfo? sourceInfo, string specifier)
|
||||
{
|
||||
return ResolvePathInternal(settings.SearchPath, sourceInfo?.Name, specifier);
|
||||
}
|
||||
|
||||
private string? ResolvePathInternal(string? searchPath, string? referrer, string specifier)
|
||||
{
|
||||
if (specifier.StartsWith("packages/", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return ProbeFile(Path.Combine(_scriptRootPath, specifier));
|
||||
}
|
||||
|
||||
if (specifier.StartsWith("."))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(referrer))
|
||||
{
|
||||
string? dir = Path.GetDirectoryName(referrer);
|
||||
if (dir != null)
|
||||
{
|
||||
return ProbeFile(Path.GetFullPath(Path.Combine(dir, specifier)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(searchPath))
|
||||
{
|
||||
var paths = searchPath.Split(';', StringSplitOptions.RemoveEmptyEntries);
|
||||
foreach (var p in paths)
|
||||
{
|
||||
string combined = Path.Combine(p, specifier);
|
||||
string? found = ProbeFile(combined);
|
||||
if (found != null) return found;
|
||||
}
|
||||
}
|
||||
|
||||
return ProbeFile(Path.Combine(_scriptRootPath, specifier));
|
||||
}
|
||||
|
||||
private string? ProbeFile(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (File.Exists(path)) return path;
|
||||
if (File.Exists(path + ".js")) return path + ".js";
|
||||
}
|
||||
catch { }
|
||||
return null;
|
||||
}
|
||||
|
||||
private static bool IsImageFile(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) return false;
|
||||
string ext = Path.GetExtension(path).ToLower();
|
||||
string[] imageExtensions = { ".png", ".jpg", ".jpeg", ".bmp", ".tiff", ".webp" };
|
||||
return imageExtensions.Contains(ext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,18 +2,12 @@ using BetterGenshinImpact.Core.Config;
|
||||
using Microsoft.ClearScript;
|
||||
using Microsoft.ClearScript.V8;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using BetterGenshinImpact.Core.Script.Dependence;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.View;
|
||||
using Microsoft.ClearScript.JavaScript;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.Project;
|
||||
|
||||
@@ -34,7 +28,6 @@ public class ScriptProject
|
||||
{
|
||||
throw new DirectoryNotFoundException("脚本文件夹不存在:" + ProjectPath);
|
||||
}
|
||||
|
||||
ManifestFile = Path.GetFullPath(Path.Combine(ProjectPath, "manifest.json"));
|
||||
if (!File.Exists(ManifestFile))
|
||||
{
|
||||
@@ -52,7 +45,6 @@ public class ScriptProject
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var stackPanel = new StackPanel
|
||||
{
|
||||
Margin = new Thickness(0, 0, 20, 0) // 给右侧滚动条留出位置
|
||||
@@ -76,67 +68,28 @@ public class ScriptProject
|
||||
return scrollViewer;
|
||||
}
|
||||
|
||||
private IScriptEngine BuildScriptEngine(PathingPartyConfig? partyConfig)
|
||||
public IScriptEngine BuildScriptEngine(PathingPartyConfig? partyConfig = null)
|
||||
{
|
||||
V8ScriptEngine engine = new V8ScriptEngine(V8ScriptEngineFlags.UseCaseInsensitiveMemberBinding | V8ScriptEngineFlags.EnableTaskPromiseConversion);
|
||||
|
||||
// packages 依赖和资源重载
|
||||
var loader = new PackageDocumentLoader(ProjectPath);
|
||||
engine.DocumentSettings.Loader = loader;
|
||||
|
||||
// 添加 packages 到搜索路径
|
||||
var libraries = new HashSet<string>(Manifest.Library ?? Array.Empty<string>())
|
||||
{
|
||||
".",
|
||||
"./packages"
|
||||
};
|
||||
|
||||
var libraryList = libraries.ToList();
|
||||
|
||||
EngineExtend.InitHost(engine, ProjectPath, libraryList.ToArray(), partyConfig);
|
||||
IScriptEngine engine = new V8ScriptEngine(V8ScriptEngineFlags.UseCaseInsensitiveMemberBinding | V8ScriptEngineFlags.EnableTaskPromiseConversion);
|
||||
EngineExtend.InitHost(engine, ProjectPath, Manifest.Library,partyConfig);
|
||||
return engine;
|
||||
}
|
||||
|
||||
public async Task ExecuteAsync(dynamic? context = null, PathingPartyConfig? partyConfig = null)
|
||||
public async Task ExecuteAsync(dynamic? context = null, PathingPartyConfig? partyConfig=null)
|
||||
{
|
||||
// 默认值
|
||||
GlobalMethod.SetGameMetrics(1920, 1080);
|
||||
// 加载代码
|
||||
var code = await LoadCode();
|
||||
var engine = BuildScriptEngine(partyConfig);
|
||||
|
||||
// 使用自定义加载器解析脚本文件
|
||||
var loader = (PackageDocumentLoader)engine.DocumentSettings.Loader;
|
||||
|
||||
if (context != null)
|
||||
{
|
||||
// 写入配置的内容
|
||||
engine.AddHostObject("settings", context);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
bool useModule = Manifest.Library.Length != 0 ||
|
||||
code.Contains("import ", StringComparison.Ordinal) ||
|
||||
code.Contains("export ", StringComparison.Ordinal);
|
||||
|
||||
if (useModule)
|
||||
{
|
||||
// 清除Document缓存
|
||||
DocumentLoader.Default.DiscardCachedDocuments();
|
||||
|
||||
string mainScriptPath = Path.Combine(ProjectPath, Manifest.Main);
|
||||
string runtimeCode = loader.RewriteScriptCode(code, mainScriptPath);
|
||||
|
||||
var documentInfo = new DocumentInfo(new Uri(mainScriptPath)) { Category = ModuleCategory.Standard };
|
||||
var evaluation = engine.Evaluate(documentInfo, runtimeCode);
|
||||
if (evaluation is Task task) await task;
|
||||
}
|
||||
else
|
||||
{
|
||||
var evaluation = engine.Evaluate(code);
|
||||
if (evaluation is Task task) await task;
|
||||
}
|
||||
await (Task)engine.Evaluate(code);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@@ -145,16 +98,6 @@ public class ScriptProject
|
||||
}
|
||||
finally
|
||||
{
|
||||
// 终止代码执行
|
||||
try
|
||||
{
|
||||
engine.Interrupt();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
TaskControl.Logger.LogError(e, "中断脚本执行异常:" + e.Message);
|
||||
}
|
||||
|
||||
engine.Dispose();
|
||||
}
|
||||
}
|
||||
@@ -169,4 +112,4 @@ public class ScriptProject
|
||||
|
||||
return code;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public class FileAccessBridge
|
||||
// if (!string.IsNullOrEmpty(directory))
|
||||
// Directory.CreateDirectory(directory);
|
||||
|
||||
File.WriteAllText(fullPath, content, new UTF8Encoding(false));
|
||||
File.WriteAllText(fullPath, content, Encoding.UTF8);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Policy;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.Core.Config;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Model;
|
||||
using BetterGenshinImpact.Service;
|
||||
using Serilog.Core;
|
||||
using BetterGenshinImpact.ViewModel.Message;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Wpf.Ui.Violeta.Controls;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.WebView;
|
||||
|
||||
@@ -21,17 +23,4 @@ public class MapEditorWebBridge
|
||||
{
|
||||
TaskContext.Instance().Config.DevConfig.RecordMapName = mapName;
|
||||
}
|
||||
|
||||
public async Task RunPathing(string json)
|
||||
{
|
||||
await ScriptService.StartGameTask();
|
||||
SystemControl.ActivateWindow();
|
||||
await new TaskRunner().RunThreadAsync(async () =>
|
||||
{
|
||||
var task = PathingTask.BuildFromJson(json);
|
||||
var pathExecutor = new PathExecutor(CancellationContext.Instance.Cts.Token);
|
||||
pathExecutor.PartyConfig = new PathingPartyConfig { AutoFightEnabled = false };
|
||||
await pathExecutor.Pathing(task);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,6 @@ using BetterGenshinImpact.View.Windows;
|
||||
using BetterGenshinImpact.ViewModel.Message;
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Net;
|
||||
using BetterGenshinImpact.GameTask;
|
||||
|
||||
namespace BetterGenshinImpact.Core.Script.WebView;
|
||||
|
||||
@@ -27,12 +25,7 @@ public sealed class RepoWebBridge
|
||||
".vue", ".css", ".html", ".csv", ".xml",
|
||||
".yaml", ".yml", ".ini", ".config"
|
||||
};
|
||||
|
||||
private static readonly HashSet<string> AllowedImageExtensions = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
".png", ".jpg", ".jpeg", ".gif", ".webp", ".svg", ".bmp", ".ico"
|
||||
};
|
||||
|
||||
|
||||
public async Task<string> GetRepoJson()
|
||||
{
|
||||
try
|
||||
@@ -78,90 +71,29 @@ public sealed class RepoWebBridge
|
||||
return await File.ReadAllTextAsync(userConfigPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取当前仓库的已订阅脚本路径列表(JSON 数组)。
|
||||
/// 相比 GetUserConfigJson() 更轻量,仅返回当前仓库的订阅路径。
|
||||
/// </summary>
|
||||
public string GetSubscribedScriptPaths()
|
||||
public async Task<string> GetFile(string relPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var paths = ScriptRepoUpdater.GetSubscribedPathsForCurrentRepo();
|
||||
if (paths.Count > 0)
|
||||
{
|
||||
return Newtonsoft.Json.JsonConvert.SerializeObject(paths);
|
||||
}
|
||||
|
||||
return "[]";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "[]";
|
||||
}
|
||||
}
|
||||
|
||||
public Task<string> GetFile(string relPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
// URL 解码路径(处理中文文件名)
|
||||
relPath = WebUtility.UrlDecode(relPath);
|
||||
|
||||
string filePath = Path.Combine(ScriptRepoUpdater.CenterRepoPath, "repo", relPath)
|
||||
.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
|
||||
|
||||
// 验证解析后的路径在允许的目录范围内
|
||||
string normalizedBasePath = Path.GetFullPath(Path.Combine(ScriptRepoUpdater.CenterRepoPath, "repo"));
|
||||
string normalizedFilePath = Path.GetFullPath(filePath);
|
||||
if (!normalizedFilePath.StartsWith(normalizedBasePath, StringComparison.OrdinalIgnoreCase))
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
return Task.FromResult("404");
|
||||
return "404";
|
||||
}
|
||||
|
||||
string extension = Path.GetExtension(filePath).ToLower();
|
||||
|
||||
if (AllowedTextExtensions.Contains(extension))
|
||||
{
|
||||
// 读取文本文件
|
||||
string? content = ScriptRepoUpdater.Instance.ReadFileFromCenterRepo(relPath);
|
||||
return Task.FromResult(string.IsNullOrEmpty(content) ? "404" : content);
|
||||
}
|
||||
else if (AllowedImageExtensions.Contains(extension))
|
||||
{
|
||||
// 读取图片文件,返回 Base64 编码
|
||||
byte[]? bytes = ScriptRepoUpdater.Instance.ReadBinaryFileFromCenterRepo(relPath);
|
||||
if (bytes == null || bytes.Length == 0)
|
||||
{
|
||||
return Task.FromResult("404");
|
||||
}
|
||||
|
||||
string base64 = Convert.ToBase64String(bytes);
|
||||
return Task.FromResult(base64);
|
||||
}
|
||||
|
||||
return Task.FromResult("404");
|
||||
string extension = Path.GetExtension(filePath);
|
||||
return AllowedTextExtensions.Contains(extension)
|
||||
? await File.ReadAllTextAsync(filePath)
|
||||
: "404";
|
||||
}
|
||||
catch
|
||||
{
|
||||
return Task.FromResult("404");
|
||||
return "404";
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetMimeType(string extension)
|
||||
{
|
||||
return extension.ToLower() switch
|
||||
{
|
||||
".png" => "image/png",
|
||||
".jpg" or ".jpeg" => "image/jpeg",
|
||||
".gif" => "image/gif",
|
||||
".bmp" => "image/bmp",
|
||||
".webp" => "image/webp",
|
||||
".svg" => "image/svg+xml",
|
||||
".ico" => "image/x-icon",
|
||||
_ => "application/octet-stream"
|
||||
};
|
||||
}
|
||||
|
||||
public async Task<bool> UpdateSubscribed(string path)
|
||||
{
|
||||
try
|
||||
@@ -205,7 +137,7 @@ public sealed class RepoWebBridge
|
||||
throw new FileNotFoundException("找不到原始 repo.json 文件");
|
||||
}
|
||||
|
||||
string targetPath = ScriptRepoUpdater.RepoUpdatedJsonPath;
|
||||
string targetPath = Path.Combine(ScriptRepoUpdater.ReposPath, "repo_updated.json");
|
||||
|
||||
File.Copy(repoJsonPath, targetPath, overwrite: true);
|
||||
|
||||
@@ -218,39 +150,12 @@ public sealed class RepoWebBridge
|
||||
}
|
||||
}
|
||||
|
||||
// 设置新手引导标志位
|
||||
public bool SetGuideStatus(bool status)
|
||||
{
|
||||
try
|
||||
{
|
||||
var scriptConfig = TaskContext.Instance().Config.ScriptConfig;
|
||||
scriptConfig.GuideStatus = status;
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// 获取新手引导标志位
|
||||
public bool GetGuideStatus()
|
||||
{
|
||||
try
|
||||
{
|
||||
return TaskContext.Instance().Config.ScriptConfig.GuideStatus;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetRepoJsonPath()
|
||||
{
|
||||
string updatedRepoJsonPath = ScriptRepoUpdater.RepoUpdatedJsonPath;
|
||||
string updatedRepoJsonPath = Path.Combine(
|
||||
Path.GetDirectoryName(Path.Combine(ScriptRepoUpdater.ReposPath, "bettergi-scripts-list-git"))!,
|
||||
"repo_updated.json"
|
||||
);
|
||||
|
||||
if (File.Exists(updatedRepoJsonPath))
|
||||
{
|
||||
@@ -264,7 +169,7 @@ public sealed class RepoWebBridge
|
||||
return repoJson ?? throw new FileNotFoundException("repo.json 仓库索引文件不存在,请至少成功更新一次仓库!");
|
||||
}
|
||||
|
||||
internal static void ProcessPathRecursively(JArray array, string[] pathParts, int currentIndex)
|
||||
private static void ProcessPathRecursively(JArray array, string[] pathParts, int currentIndex)
|
||||
{
|
||||
foreach (JObject item in array.OfType<JObject>())
|
||||
{
|
||||
@@ -282,7 +187,7 @@ public sealed class RepoWebBridge
|
||||
}
|
||||
}
|
||||
|
||||
internal static void ResetHasUpdateFlag(JObject node)
|
||||
private static void ResetHasUpdateFlag(JObject node)
|
||||
{
|
||||
if (node["hasUpdate"] is { Type: JTokenType.Boolean } hasUpdate &&
|
||||
(bool)hasUpdate)
|
||||
|
||||
@@ -28,9 +28,6 @@ public class Simulation
|
||||
SendInput.Keyboard.KeyUp(key);
|
||||
}
|
||||
}
|
||||
SendInput.Mouse.LeftButtonUp();
|
||||
SendInput.Mouse.RightButtonUp();
|
||||
SendInput.Mouse.MiddleButtonUp();
|
||||
}
|
||||
|
||||
public static bool IsKeyDown(User32.VK key)
|
||||
|
||||
@@ -1,14 +1,17 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoCook;
|
||||
|
||||
/// <summary>
|
||||
///自动烹饪配置
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public partial class AutoCookConfig : ObservableObject
|
||||
{
|
||||
/// <summary>
|
||||
/// 触发器是否启用
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private int _checkIntervalMs = 10;
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _stopTaskWhenRecoverButtonDetected = true;
|
||||
private bool _enabled = false;
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
using BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using BetterGenshinImpact.GameTask.Common.BgiVision;
|
||||
using Vanara.PInvoke;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoCook;
|
||||
|
||||
public class AutoCookTask : ISoloTask
|
||||
{
|
||||
private readonly ILogger<AutoCookTask> _logger = App.GetLogger<AutoCookTask>();
|
||||
private const int UiCheckIntervalMs = 400;
|
||||
private const int PeakMinCount = 600; // 最小仙跳墙 700 多
|
||||
private const int PeakTolerance = 20;
|
||||
private const int PeakStableFrameCount = 3;
|
||||
private const int TriggerDropCount = 300; // 正常是 400多
|
||||
private static readonly Rect CookColorRect1080P = new(600, 660, 730, 190);
|
||||
private static readonly Scalar TargetCookColor = new(255, 192, 64);
|
||||
|
||||
public string Name => "自动烹饪";
|
||||
|
||||
public async Task Start(CancellationToken ct)
|
||||
{
|
||||
var assetScale = TaskContext.Instance().SystemInfo.AssetScale;
|
||||
var autoCookConfig = TaskContext.Instance().Config.AutoCookConfig;
|
||||
var checkIntervalMs = Math.Max(1, autoCookConfig.CheckIntervalMs);
|
||||
var stopTaskWhenRecoverButtonDetected = autoCookConfig.StopTaskWhenRecoverButtonDetected;
|
||||
var peakMinCount = (int)(PeakMinCount * assetScale);
|
||||
var triggerDropCount = (int)(TriggerDropCount * assetScale);
|
||||
var cookColorRect = ScaleRect(CookColorRect1080P, assetScale);
|
||||
_logger.LogInformation("自动烹饪任务启动");
|
||||
var lastUiCheckTime = DateTime.MinValue;
|
||||
var inCookUi = false;
|
||||
int? peakColorCount = null;
|
||||
int? peakCandidate = null;
|
||||
var peakCandidateStableFrames = 0;
|
||||
|
||||
while (!ct.IsCancellationRequested)
|
||||
{
|
||||
using var captureRegion = CaptureToRectArea();
|
||||
var now = DateTime.UtcNow;
|
||||
if (!inCookUi || (now - lastUiCheckTime).TotalMilliseconds >= UiCheckIntervalMs)
|
||||
{
|
||||
var currentInCookUi = IsInCookUi(captureRegion);
|
||||
if (currentInCookUi != inCookUi)
|
||||
{
|
||||
ResetPeakState(ref peakColorCount, ref peakCandidate, ref peakCandidateStableFrames);
|
||||
}
|
||||
|
||||
inCookUi = currentInCookUi;
|
||||
lastUiCheckTime = now;
|
||||
if (!inCookUi)
|
||||
{
|
||||
ResetPeakState(ref peakColorCount, ref peakCandidate, ref peakCandidateStableFrames);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stopTaskWhenRecoverButtonDetected)
|
||||
{
|
||||
var e = captureRegion.Find(ElementAssets.Instance.BtnWhiteRecover);
|
||||
if (e.IsExist())
|
||||
{
|
||||
_logger.LogInformation("自动烹饪:{Text}", "检测到自动烹饪按钮,结束任务");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (Bv.ClickWhiteConfirmButton(captureRegion))
|
||||
{
|
||||
ResetPeakState(ref peakColorCount, ref peakCandidate, ref peakCandidateStableFrames);
|
||||
_logger.LogInformation("自动烹饪:{Text}", "自动点击确认");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (inCookUi)
|
||||
{
|
||||
var currentColorCount = CountTargetColor(captureRegion, cookColorRect);
|
||||
if (peakColorCount.HasValue)
|
||||
{
|
||||
if (currentColorCount <= peakColorCount.Value - triggerDropCount)
|
||||
{
|
||||
Simulation.SendInput.Keyboard.KeyPress(User32.VK.VK_SPACE);
|
||||
_logger.LogInformation("自动烹饪:{Text}", $"烹饪条像素数量较峰值下降超过{triggerDropCount},按下空格。峰值:{peakColorCount.Value} 当前:{currentColorCount}");
|
||||
ResetPeakState(ref peakColorCount, ref peakCandidate, ref peakCandidateStableFrames);
|
||||
}
|
||||
}
|
||||
else if (TryBuildPeak(currentColorCount, peakMinCount, ref peakCandidate, ref peakCandidateStableFrames, out var builtPeak))
|
||||
{
|
||||
peakColorCount = builtPeak;
|
||||
_logger.LogInformation("自动烹饪:{Text}", $"识别到完美烹饪条峰值像素数:{builtPeak}");
|
||||
}
|
||||
}
|
||||
|
||||
await Delay(checkIntervalMs, ct);
|
||||
}
|
||||
}
|
||||
|
||||
private static void ResetPeakState(ref int? peakColorCount, ref int? peakCandidate, ref int peakCandidateStableFrames)
|
||||
{
|
||||
peakColorCount = null;
|
||||
peakCandidate = null;
|
||||
peakCandidateStableFrames = 0;
|
||||
}
|
||||
|
||||
private static bool TryBuildPeak(int currentColorCount, int peakMinCount, ref int? peakCandidate, ref int peakCandidateStableFrames, out int builtPeak)
|
||||
{
|
||||
builtPeak = 0;
|
||||
if (currentColorCount <= peakMinCount)
|
||||
{
|
||||
peakCandidate = null;
|
||||
peakCandidateStableFrames = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!peakCandidate.HasValue)
|
||||
{
|
||||
peakCandidate = currentColorCount;
|
||||
peakCandidateStableFrames = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Math.Abs(currentColorCount - peakCandidate.Value) <= PeakTolerance)
|
||||
{
|
||||
peakCandidate = Math.Max(peakCandidate.Value, currentColorCount);
|
||||
peakCandidateStableFrames++;
|
||||
if (peakCandidateStableFrames >= PeakStableFrameCount && peakCandidate.Value > peakMinCount)
|
||||
{
|
||||
builtPeak = peakCandidate.Value;
|
||||
peakCandidate = null;
|
||||
peakCandidateStableFrames = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
peakCandidate = currentColorCount;
|
||||
peakCandidateStableFrames = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
private static Rect ScaleRect(Rect rect, double scale)
|
||||
{
|
||||
return new Rect(
|
||||
(int)(rect.X * scale),
|
||||
(int)(rect.Y * scale),
|
||||
(int)(rect.Width * scale),
|
||||
(int)(rect.Height * scale));
|
||||
}
|
||||
|
||||
private bool IsInCookUi(ImageRegion captureRegion)
|
||||
{
|
||||
using var cookIcon = captureRegion.Find(ElementAssets.Instance.UiLeftTopCookIcon);
|
||||
return cookIcon.IsExist();
|
||||
}
|
||||
|
||||
private int CountTargetColor(ImageRegion captureRegion, Rect cookColorRect)
|
||||
{
|
||||
using var crop = captureRegion.DeriveCrop(cookColorRect);
|
||||
using var rgb = new Mat();
|
||||
using var mask = new Mat();
|
||||
Cv2.CvtColor(crop.SrcMat, rgb, ColorConversionCodes.BGR2RGB);
|
||||
Cv2.InRange(rgb, TargetCookColor, TargetCookColor, mask);
|
||||
return Cv2.CountNonZero(mask);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
using BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenCvSharp;
|
||||
using System.Linq;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoCook;
|
||||
|
||||
public class AutoCookTrigger : ITaskTrigger
|
||||
{
|
||||
private readonly ILogger<AutoCookTrigger> _logger = App.GetLogger<AutoCookTrigger>();
|
||||
|
||||
public string Name => "自动烹饪";
|
||||
public bool IsEnabled { get; set; }
|
||||
public int Priority => 50;
|
||||
public bool IsExclusive { get; set; }
|
||||
|
||||
public void Init()
|
||||
{
|
||||
IsEnabled = TaskContext.Instance().Config.AutoCookConfig.Enabled;
|
||||
IsExclusive = false;
|
||||
}
|
||||
|
||||
public void OnCapture(CaptureContent content)
|
||||
{
|
||||
// 判断是否处于烹饪界面
|
||||
IsExclusive = false;
|
||||
content.CaptureRectArea.Find(ElementAssets.Instance.UiLeftTopCookIcon, _ =>
|
||||
{
|
||||
IsExclusive = true;
|
||||
var captureRect = TaskContext.Instance().SystemInfo.ScaleMax1080PCaptureRect;
|
||||
using var region = content.CaptureRectArea.DeriveCrop(0, captureRect.Height / 2, captureRect.Width, captureRect.Height / 2);
|
||||
var perfectBarRects = ContoursHelper.FindSpecifyColorRects(region.SrcMat, new Scalar(255, 192, 64), 0, 8);
|
||||
if (perfectBarRects.Count >= 2)
|
||||
{
|
||||
// 点击烹饪按钮
|
||||
var btnList = ContoursHelper.FindSpecifyColorRects(region.SrcMat, new Scalar(255, 255, 192), 12, 12);
|
||||
if (btnList.Count >= 1)
|
||||
{
|
||||
if (btnList.Count > 1)
|
||||
{
|
||||
_logger.LogWarning("自动烹饪:{Text}", "识别到多个结束烹饪按钮");
|
||||
btnList = [.. btnList.OrderByDescending(r => r.Width)];
|
||||
}
|
||||
var btn = btnList[0];
|
||||
var x = btn.X + btn.Width / 2;
|
||||
var y = btn.Y + btn.Height / 2;
|
||||
region.ClickTo(x, y);
|
||||
_logger.LogInformation("自动烹饪:{Text}", "点击结束按钮");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 3.8 KiB |
|
Before Width: | Height: | Size: 2.7 KiB |
@@ -1,49 +0,0 @@
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.Model;
|
||||
using OpenCvSharp;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoDomain.Assets;
|
||||
|
||||
public class AutoDomainAssets : BaseAssets<AutoDomainAssets>
|
||||
{
|
||||
public RecognitionObject ResinSwitchBtnRo;
|
||||
public RecognitionObject ResinSwitchBtnNoActiveRo;
|
||||
|
||||
|
||||
private AutoDomainAssets() : base()
|
||||
{
|
||||
Initialization(this.systemInfo);
|
||||
}
|
||||
|
||||
protected AutoDomainAssets(ISystemInfo systemInfo) : base(systemInfo)
|
||||
{
|
||||
Initialization(systemInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void Initialization(ISystemInfo systemInfo)
|
||||
{
|
||||
// 可点击状态的树脂切换按钮
|
||||
ResinSwitchBtnRo = new RecognitionObject
|
||||
{
|
||||
Name = "ResinSwitchBtn",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoDomain", "resin_switch_btn.png", this.systemInfo),
|
||||
RegionOfInterest = new Rect((int)(960 * AssetScale), (int)(430 * AssetScale), (int)(400 * AssetScale), (int)(130 * AssetScale)),
|
||||
Threshold = 0.8,
|
||||
DrawOnWindow = false
|
||||
}.InitTemplate();
|
||||
|
||||
// 不可点击状态的树脂切换按钮
|
||||
ResinSwitchBtnNoActiveRo = new RecognitionObject
|
||||
{
|
||||
Name = "ResinSwitchBtnNoActive",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoDomain", "resin_switch_btn_no_active.png", this.systemInfo),
|
||||
RegionOfInterest = new Rect((int)(960 * AssetScale), (int)(430 * AssetScale), (int)(400 * AssetScale), (int)(130 * AssetScale)),
|
||||
Threshold = 0.8,
|
||||
DrawOnWindow = false
|
||||
}.InitTemplate();
|
||||
}
|
||||
}
|
||||
@@ -68,13 +68,6 @@ public partial class AutoDomainConfig : ObservableObject
|
||||
// 使用原粹树脂刷取副本次数
|
||||
[ObservableProperty]
|
||||
private int _originalResinUseCount = 0;
|
||||
// 使用原粹树脂(20)刷取副本次数
|
||||
[ObservableProperty]
|
||||
private int _originalResin20UseCount = 0;
|
||||
|
||||
// 使用原粹树脂(40)刷取副本次数
|
||||
[ObservableProperty]
|
||||
private int _originalResin40UseCount = 0;
|
||||
|
||||
//使用浓缩树脂刷取副本次数
|
||||
[ObservableProperty]
|
||||
|
||||
@@ -34,13 +34,9 @@ public class AutoDomainParam : BaseTaskParam<AutoDomainTask>
|
||||
"浓缩树脂",
|
||||
"原粹树脂"
|
||||
];
|
||||
|
||||
// 使用原粹树脂刷取副本次数
|
||||
public int OriginalResinUseCount { get; set; } = 0;
|
||||
// 使用原粹树脂(20)刷取副本次数
|
||||
public int OriginalResin20UseCount { get; set; } = 0;
|
||||
|
||||
// 使用原粹树脂(40)刷取副本次数
|
||||
public int OriginalResin40UseCount { get; set; } = 0;
|
||||
|
||||
// 使用浓缩树脂刷取副本次数
|
||||
public int CondensedResinUseCount { get; set; } = 0;
|
||||
@@ -77,8 +73,6 @@ public class AutoDomainParam : BaseTaskParam<AutoDomainTask>
|
||||
TransientResinUseCount = config.TransientResinUseCount;
|
||||
FragileResinUseCount = config.FragileResinUseCount;
|
||||
SpecifyResinUse = config.SpecifyResinUse;
|
||||
OriginalResin20UseCount = config.OriginalResin20UseCount;
|
||||
OriginalResin40UseCount = config.OriginalResin40UseCount;
|
||||
}
|
||||
|
||||
public AutoDomainParam(int domainRoundNum = 0) : base(null, null)
|
||||
|
||||
@@ -41,7 +41,6 @@ using BetterGenshinImpact.GameTask.Common;
|
||||
using Compunet.YoloSharp;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using BetterGenshinImpact.GameTask.AutoFight;
|
||||
using BetterGenshinImpact.GameTask.AutoDomain.Assets;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoDomain;
|
||||
|
||||
@@ -95,7 +94,7 @@ public class AutoDomainTask : ISoloTask
|
||||
this.clickanywheretocloseLocalizedString = stringLocalizer.WithCultureGet(cultureInfo, "点击任意位置关闭");
|
||||
this.matchingChallengeString = stringLocalizer.WithCultureGet(cultureInfo, "匹配挑战");
|
||||
this.rapidformationString = stringLocalizer.WithCultureGet(cultureInfo, "快速编队");
|
||||
this.limitedFullyString = stringLocalizer.WithCultureGet(cultureInfo, "限时全部开放");
|
||||
this.limitedFullyString = stringLocalizer.WithCultureGet(cultureInfo, "限时全开");
|
||||
this.limitedFullyAllString = stringLocalizer.WithCultureGet(cultureInfo, "限时开放");
|
||||
}
|
||||
|
||||
@@ -208,6 +207,8 @@ public class AutoDomainTask : ISoloTask
|
||||
Logger.LogInformation("体力耗尽或者设置轮次已达标,结束自动秘境");
|
||||
break;
|
||||
}
|
||||
|
||||
Notify.Event(NotificationEvent.DomainReward).Success("自动秘境奖励领取");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,7 +381,7 @@ public class AutoDomainTask : ISoloTask
|
||||
using var limitedFullyStringRa = CaptureToRectArea();
|
||||
var limitedFullyStringRaocrList =
|
||||
limitedFullyStringRa.FindMulti(RecognitionObject.Ocr(0, 0, limitedFullyStringRa.Width * 0.5,
|
||||
limitedFullyStringRa.Height * 0.5));
|
||||
limitedFullyStringRa.Height));
|
||||
var limitedFullyStringRaocrListdone = limitedFullyStringRaocrList.LastOrDefault(t =>
|
||||
Regex.IsMatch(t.Text, this.limitedFullyString) || Regex.IsMatch(t.Text, this.limitedFullyAllString));
|
||||
// 检测是否为限时全开秘境
|
||||
@@ -455,7 +456,7 @@ public class AutoDomainTask : ISoloTask
|
||||
// 点击单人挑战确认并等待队伍界面--使用图像模版匹配的方法,也可以使用文字OCR的方法识别“单人挑战”直到消失
|
||||
await NewRetry.WaitForElementAppear(
|
||||
ElementAssets.Instance.PartyBtnChooseView,
|
||||
() =>
|
||||
async void () =>
|
||||
{
|
||||
using var ra = CaptureToRectArea();
|
||||
var ra2 = ra.Find(fightAssets.ConfirmRa);
|
||||
@@ -1150,26 +1151,6 @@ public class AutoDomainTask : ISoloTask
|
||||
{
|
||||
if (record.RemainCount > 0)
|
||||
{
|
||||
if (record.Name == "原粹树脂20" || record.Name == "原粹树脂40")
|
||||
{
|
||||
int expectedNum = record.Name == "原粹树脂20" ? 20 : 40;
|
||||
bool switched;
|
||||
try
|
||||
{
|
||||
switched = SwitchOriginalResinType(expectedNum, _ct);
|
||||
}
|
||||
catch (RetryException)
|
||||
{
|
||||
Logger.LogWarning("自动秘境:切换原粹树脂类型重试超时,跳过 {Name}", record.Name);
|
||||
switched = false;
|
||||
}
|
||||
|
||||
if (!switched)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var (success, _) = PressUseResin(textListInPrompt2, record.Name);
|
||||
if (success)
|
||||
{
|
||||
@@ -1202,8 +1183,6 @@ public class AutoDomainTask : ISoloTask
|
||||
// 如果没有选择树脂的提示,说明只有原粹树脂
|
||||
// 继续向下执行
|
||||
}
|
||||
|
||||
Notify.Event(NotificationEvent.DomainReward).Success("自动秘境奖励领取");
|
||||
|
||||
Sleep(1000, _ct);
|
||||
|
||||
@@ -1271,19 +1250,14 @@ public class AutoDomainTask : ISoloTask
|
||||
Bv.ClickBlackConfirmButton(CaptureToRectArea());
|
||||
}
|
||||
|
||||
public static (bool, int) PressUseResin(ImageRegion ra, string resinName, string logPrefix = "自动秘境")
|
||||
public static (bool, int) PressUseResin(ImageRegion ra, string resinName)
|
||||
{
|
||||
var regionList = ra.FindMulti(RecognitionObject.Ocr(ra.Width * 0.25, ra.Height * 0.2, ra.Width * 0.5, ra.Height * 0.6));
|
||||
return PressUseResin(regionList, resinName, logPrefix);
|
||||
return PressUseResin(regionList, resinName);
|
||||
}
|
||||
|
||||
public static (bool, int) PressUseResin(List<Region> regionList, string resinName, string logPrefix = "自动秘境")
|
||||
public static (bool, int) PressUseResin(List<Region> regionList, string resinName)
|
||||
{
|
||||
if (resinName == "原粹树脂20" || resinName == "原粹树脂40")
|
||||
{
|
||||
resinName = "原粹树脂";
|
||||
}
|
||||
|
||||
var resinKey = regionList.FirstOrDefault(t => t.Text.Contains(resinName));
|
||||
if (resinKey != null)
|
||||
{
|
||||
@@ -1301,65 +1275,25 @@ public class AutoDomainTask : ISoloTask
|
||||
// 解决水龙王按下左键后没松开,然后后续点击按下就没反应了。使用双击
|
||||
Sleep(60);
|
||||
useKey.Click();
|
||||
var num = GetResinNum(resinKey, resinName, logPrefix);
|
||||
Logger.LogInformation("{LogPrefix}:使用 {ResinName}, 数量:{Num}", logPrefix, resinName, num);
|
||||
var num = GetResinNum(resinKey, resinName);
|
||||
Logger.LogInformation("自动秘境:使用 {ResinName}, 数量:{Num}", resinName, num);
|
||||
return (true, num);
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning("{LogPrefix}:未找到 {ResinName} 的使用按键", logPrefix, resinName);
|
||||
Logger.LogWarning("自动秘境:未找到 {ResinName} 的使用按键", resinName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning("{LogPrefix}:未找到 {ResinName} 的使用按键", logPrefix, resinName);
|
||||
Logger.LogWarning("自动秘境:未找到 {ResinName} 的使用按键", resinName);
|
||||
}
|
||||
}
|
||||
|
||||
return (false, 0);
|
||||
}
|
||||
|
||||
private bool SwitchOriginalResinType(int expectedNum, CancellationToken ct)
|
||||
{
|
||||
return NewRetry.Do(() =>
|
||||
{
|
||||
using var ra0 = CaptureToRectArea();
|
||||
var regionList = ra0.FindMulti(RecognitionObject.Ocr(ra0.Width * 0.25, ra0.Height * 0.2, ra0.Width * 0.5, ra0.Height * 0.6));
|
||||
var has20 = regionList.Any(t => t.Text.Contains("20"));
|
||||
var has40 = regionList.Any(t => t.Text.Contains("40"));
|
||||
if (expectedNum == 20 && has20)
|
||||
{
|
||||
Logger.LogInformation("自动秘境:已切换到使用20原粹树脂");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (expectedNum == 40 && has40)
|
||||
{
|
||||
Logger.LogInformation("自动秘境:已切换到使用40原粹树脂");
|
||||
return true;
|
||||
}
|
||||
|
||||
//切换20/40原粹树脂的按钮是亮的
|
||||
var clickable = ra0.Find(AutoDomainAssets.Instance.ResinSwitchBtnRo);
|
||||
if (clickable.IsExist())
|
||||
{
|
||||
Logger.LogDebug("自动秘境:切换原粹树脂使用数量");
|
||||
clickable.Click();
|
||||
}
|
||||
|
||||
//切换20/40原粹树脂的按钮是暗的
|
||||
var disabled = ra0.Find(AutoDomainAssets.Instance.ResinSwitchBtnNoActiveRo);
|
||||
if (disabled.IsExist())
|
||||
{
|
||||
Logger.LogWarning("自动秘境:切换原粹树脂的使用数量失败,可能是体力不足,当前目标:{Num}", expectedNum);
|
||||
return false; // 不可点击
|
||||
}
|
||||
|
||||
throw new RetryException("未检测到按钮"); // 继续重试
|
||||
}, TimeSpan.FromMilliseconds(500), 10);
|
||||
}
|
||||
|
||||
private static int GetResinNum(Region region, string resinName, string logPrefix)
|
||||
private static int GetResinNum(Region region, string resinName)
|
||||
{
|
||||
if (resinName == "原粹树脂")
|
||||
{
|
||||
@@ -1373,7 +1307,7 @@ public class AutoDomainTask : ISoloTask
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.LogWarning("{LogPrefix}:未识别到原粹树脂消耗体力数量,默认按20计算", logPrefix);
|
||||
Logger.LogWarning("自动秘境:未识别到原粹树脂消耗体力数量,默认按20计算");
|
||||
return 20;
|
||||
}
|
||||
}
|
||||
@@ -1401,7 +1335,7 @@ public class AutoDomainTask : ISoloTask
|
||||
return (region1Top <= region2Bottom && region1Bottom >= region2Top);
|
||||
}
|
||||
|
||||
private async Task ArtifactSalvage()
|
||||
private async Task ArtifactSalvage()
|
||||
{
|
||||
if (!_taskParam.AutoArtifactSalvage)
|
||||
{
|
||||
@@ -1415,4 +1349,4 @@ public class AutoDomainTask : ISoloTask
|
||||
|
||||
await new AutoArtifactSalvageTask(new AutoArtifactSalvageTaskParam(star, javaScript: null, artifactSetFilter: null, maxNumToCheck: null, recognitionFailurePolicy: null)).Start(_ct);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,14 +32,6 @@ public class ResinUseRecord
|
||||
{
|
||||
list.Add(new ResinUseRecord("浓缩树脂", taskParam.CondensedResinUseCount));
|
||||
}
|
||||
if (taskParam.OriginalResin40UseCount > 0)
|
||||
{
|
||||
list.Add(new ResinUseRecord("原粹树脂40", taskParam.OriginalResin40UseCount));
|
||||
}
|
||||
if (taskParam.OriginalResin20UseCount > 0)
|
||||
{
|
||||
list.Add(new ResinUseRecord("原粹树脂20", taskParam.OriginalResin20UseCount));
|
||||
}
|
||||
if (taskParam.OriginalResinUseCount > 0)
|
||||
{
|
||||
list.Add(new ResinUseRecord("原粹树脂", taskParam.OriginalResinUseCount));
|
||||
@@ -62,7 +54,7 @@ public class ResinUseRecord
|
||||
return list;
|
||||
}
|
||||
|
||||
public static List<ResinUseRecord> BuildFromDomainParam(AutoStygianOnslaughtParam taskParam)
|
||||
public static List<ResinUseRecord> BuildFromDomainParam(AutoStygianOnslaughtConfig taskParam)
|
||||
{
|
||||
List<ResinUseRecord> list = [];
|
||||
if (taskParam.SpecifyResinUse)
|
||||
|
||||
@@ -9,7 +9,6 @@ using BetterGenshinImpact.GameTask.GetGridIcons;
|
||||
using BetterGenshinImpact.GameTask.Model;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using BetterGenshinImpact.GameTask.Model.GameUI;
|
||||
using BetterGenshinImpact.Helpers;
|
||||
using BetterGenshinImpact.View.Drawable;
|
||||
using Fischless.WindowsInput;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@@ -105,8 +104,7 @@ public class AutoEatTask : BaseIndependentTask, ISoloTask<int?>
|
||||
itemRegion.Click();
|
||||
|
||||
#region 识别数量
|
||||
string ocrText = itemRegion.SrcMat.GetGridItemIconText(OcrFactory.Paddle);
|
||||
string numStr = StringUtils.ConvertFullWidthNumToHalfWidth(ocrText);
|
||||
string numStr = itemRegion.SrcMat.GetGridItemIconText(OcrFactory.Paddle);
|
||||
if (int.TryParse(numStr, out int num))
|
||||
{
|
||||
count = num - 1; // 算上吃掉的1个
|
||||
|
||||
@@ -9,12 +9,13 @@ using BetterGenshinImpact.Service.Notification.Model.Enum;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System;
|
||||
using static BetterGenshinImpact.GameTask.Common.TaskControl;
|
||||
using static Vanara.PInvoke.User32;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoEat;
|
||||
|
||||
/// <summary>
|
||||
/// 自动吃药触发器
|
||||
/// 检测红血状态时自动使用Recovery.png,检测到Resurrection.png时按快捷使用小道具键复活
|
||||
/// 检测红血状态时自动使用Recovery.png,检测到Resurrection.png时按z复活
|
||||
/// </summary>
|
||||
public class AutoEatTrigger : ITaskTrigger
|
||||
{
|
||||
@@ -93,8 +94,8 @@ public class AutoEatTrigger : ITaskTrigger
|
||||
// 检查复活CD(2秒)
|
||||
if ((now - _lastResurrectionTime).TotalSeconds >= 2)
|
||||
{
|
||||
// 走原神动作映射,跟随“快捷使用小道具”键位配置
|
||||
Simulation.SendInput.SimulateAction(GIActions.QuickUseGadget);
|
||||
// 按z键复活
|
||||
Simulation.SendInput.Keyboard.KeyPress(VK.VK_Z);
|
||||
_lastResurrectionTime = now;
|
||||
_logger.LogInformation("检测到复活图标,自动复活");
|
||||
}
|
||||
@@ -139,4 +140,4 @@ public class AutoEatTrigger : ITaskTrigger
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 607 B |
@@ -1,12 +1,8 @@
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.Model;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Model;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight.Assets;
|
||||
@@ -22,7 +18,6 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
|
||||
public Rect ERect;
|
||||
public Rect ECooldownRect;
|
||||
public Rect QRect;
|
||||
public Rect QRectForClassify;
|
||||
public Rect ZCooldownRect;
|
||||
public Rect EndTipsUpperRect; // 挑战达成提示
|
||||
public Rect EndTipsRect;
|
||||
@@ -50,11 +45,6 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
|
||||
|
||||
public RecognitionObject AbnormalIconRa;
|
||||
|
||||
/// <summary>
|
||||
/// 经验值模板识别对象列表,用于检测怪物死亡时掉落的经验值数字图标
|
||||
/// </summary>
|
||||
public IReadOnlyList<RecognitionObject> ExperienceRecognitionObjects { get; private set; } = Array.Empty<RecognitionObject>();
|
||||
|
||||
#pragma warning disable CS8618 // 在退出构造函数时,不可为 null 的字段必须包含非 null 值。请考虑添加 "required" 修饰符或声明为可为 null。
|
||||
private AutoFightAssets() : base()
|
||||
{
|
||||
@@ -79,8 +69,6 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
|
||||
(int)(41 * AssetScale), (int)(18 * AssetScale));
|
||||
QRect = new Rect(CaptureRect.Width - (int)(157 * AssetScale), CaptureRect.Height - (int)(165 * AssetScale),
|
||||
(int)(110 * AssetScale), (int)(110 * AssetScale));
|
||||
QRectForClassify = new Rect(CaptureRect.Width - (int)(172 * AssetScale), CaptureRect.Height - (int)(166 * AssetScale),
|
||||
(int)(137 * AssetScale), (int)(137 * AssetScale));
|
||||
ZCooldownRect = new Rect(CaptureRect.Width - (int)(130 * AssetScale), (int)(814 * AssetScale),
|
||||
(int)(60 * AssetScale), (int)(24 * AssetScale));
|
||||
// 小道具位置 1920-133,800,60,50
|
||||
@@ -276,56 +264,5 @@ public class AutoFightAssets : BaseAssets<AutoFightAssets>
|
||||
RegionOfInterest = new Rect(0, (int)(CaptureRect.Height * 0.08), (int)(CaptureRect.Width * 0.04), (int)(CaptureRect.Height * 0.07)),
|
||||
DrawOnWindow = false
|
||||
}.InitTemplate();
|
||||
|
||||
// 加载经验值模板图片(用于检测精英怪死亡时的经验值数字图标)
|
||||
try
|
||||
{
|
||||
LoadExperienceRecognitionObjects();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// 经验值模板加载失败不应阻止 AutoFightAssets 初始化
|
||||
ExperienceRecognitionObjects = Array.Empty<RecognitionObject>();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载经验值模板图片,文件缺失时跳过,不影响其他功能
|
||||
/// </summary>
|
||||
private void LoadExperienceRecognitionObjects()
|
||||
{
|
||||
var experienceValues = new[] { 57, 58, 60 };
|
||||
var threshold = CaptureRect.Width > 1920 ? 0.6 : 0.9;
|
||||
var roi = new Rect(
|
||||
(int)(CaptureRect.Width * 0.145),
|
||||
(int)(CaptureRect.Height * 0.5),
|
||||
(int)(CaptureRect.Width * 0.02),
|
||||
(int)(CaptureRect.Height * 0.22));
|
||||
|
||||
var list = new List<RecognitionObject>();
|
||||
foreach (var exp in experienceValues)
|
||||
{
|
||||
var fileName = $"experience_{exp}.png";
|
||||
try
|
||||
{
|
||||
var ro = new RecognitionObject
|
||||
{
|
||||
Name = $"Experience_{exp}",
|
||||
RecognitionType = RecognitionTypes.TemplateMatch,
|
||||
TemplateImageMat = GameTaskManager.LoadAssetImage("AutoFight", fileName, this.systemInfo),
|
||||
RegionOfInterest = roi,
|
||||
UseMask = true,
|
||||
Threshold = threshold,
|
||||
DrawOnWindow = true,
|
||||
}.InitTemplate();
|
||||
list.Add(ro);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// 构造阶段 Logger 可能不可用,静默跳过缺失的模板
|
||||
}
|
||||
}
|
||||
|
||||
ExperienceRecognitionObjects = list.AsReadOnly();
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@
|
||||
"奇偶(男)",
|
||||
"MannequinBoy"
|
||||
],
|
||||
"id": "10000117",
|
||||
"id": "20000001",
|
||||
"name": "奇偶(男)",
|
||||
"nameEn": "MannequinBoy",
|
||||
"weapon": "1"
|
||||
@@ -62,7 +62,7 @@
|
||||
"奇偶(女)",
|
||||
"MannequinGirl"
|
||||
],
|
||||
"id": "10000118",
|
||||
"id": "20000002",
|
||||
"name": "奇偶(女)",
|
||||
"nameEn": "MannequinGirl",
|
||||
"weapon": "1"
|
||||
@@ -1981,99 +1981,5 @@
|
||||
"nameEn": "Nefer",
|
||||
"skillCD": 9,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"杜林",
|
||||
"Durin"
|
||||
],
|
||||
"burstCD": 18,
|
||||
"id": "10000123",
|
||||
"name": "杜林",
|
||||
"nameEn": "Durin",
|
||||
"skillCD": 12,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"雅珂达",
|
||||
"Jahoda"
|
||||
],
|
||||
"burstCD": 18,
|
||||
"id": "10000124",
|
||||
"name": "雅珂达",
|
||||
"nameEn": "Jahoda",
|
||||
"skillCD": 15,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"哥伦比娅",
|
||||
"Columbina",
|
||||
"少女",
|
||||
"库塔尔",
|
||||
"月神",
|
||||
"月之少女"
|
||||
],
|
||||
"burstCD": 15,
|
||||
"id": "10000125",
|
||||
"name": "哥伦比娅",
|
||||
"nameEn": "Columbina",
|
||||
"skillCD": 17,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"兹白",
|
||||
"Zibai",
|
||||
"白马仙人",
|
||||
"白马"
|
||||
],
|
||||
"burstCD": 15,
|
||||
"id": "10000126",
|
||||
"name": "兹白",
|
||||
"nameEn": "Zibai",
|
||||
"skillCD": 18,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"叶洛亚",
|
||||
"Illuga",
|
||||
"少爷",
|
||||
"小少爷"
|
||||
],
|
||||
"burstCD": 15,
|
||||
"id": "10000127",
|
||||
"name": "叶洛亚",
|
||||
"nameEn": "Illuga",
|
||||
"skillCD": 15,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"法尔伽",
|
||||
"Varka",
|
||||
"团长",
|
||||
"法尔加"
|
||||
],
|
||||
"burstCD": 16,
|
||||
"id": "10000128",
|
||||
"name": "法尔伽",
|
||||
"nameEn": "Varka",
|
||||
"skillCD": 16,
|
||||
"weapon": "10"
|
||||
},
|
||||
{
|
||||
"alias": [
|
||||
"莉奈娅",
|
||||
"Linnea"
|
||||
],
|
||||
"burstCD": 15,
|
||||
"id": "10000130",
|
||||
"name": "莉奈娅",
|
||||
"nameEn": "Linnea",
|
||||
"skillCD": 18,
|
||||
"weapon": "10"
|
||||
}
|
||||
]
|
||||
@@ -13,7 +13,7 @@ namespace BetterGenshinImpact.GameTask.AutoFight;
|
||||
[Serializable]
|
||||
public partial class AutoFightConfig : ObservableObject
|
||||
{
|
||||
[ObservableProperty] private string _strategyName = "根据队伍自动选择";
|
||||
[ObservableProperty] private string _strategyName = "";
|
||||
|
||||
/// <summary>
|
||||
/// 英文逗号分割 强制指定队伍角色
|
||||
@@ -76,19 +76,19 @@ public partial class AutoFightConfig : ObservableObject
|
||||
/// 检查战斗结束的延时,即角色,默认为1.5秒。也可以指定特定角色之后延时多少时间检查。格式如:2.5;白术,1.5;钟离,1.0;
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _checkEndDelay = "0.4;钟离,1.4;";
|
||||
private string _checkEndDelay = "";
|
||||
|
||||
/// <summary>
|
||||
/// 按下切换队伍后去检查屏幕色块的延迟,默认为0.45秒。若频繁误判可以适当提高这个值。确保这个延迟不会真的把队伍配置界面切出来。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private string _beforeDetectDelay = "0.4";
|
||||
private string _beforeDetectDelay = "";
|
||||
|
||||
/// <summary>
|
||||
/// 旋转寻找敌人位置的旋转因子,默认为12(范围1-13),越大越快。
|
||||
/// 旋转寻找敌人位置的旋转因子,默认为5,越大越快。
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private int _rotaryFactor = 12;
|
||||
private int _rotaryFactor = 10;
|
||||
|
||||
/// <summary>
|
||||
/// 是否是第一次检查和面敌。
|
||||
@@ -155,13 +155,7 @@ public partial class AutoFightConfig : ObservableObject
|
||||
private string _kazuhaPartyName = "";
|
||||
|
||||
[ObservableProperty]
|
||||
private bool _swimmingEnabled = true;
|
||||
|
||||
/// <summary>
|
||||
/// 基于经验值判断是否执行战后拾取(检测到精英怪经验值图标时才拾取)
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _expBasedPickupEnabled = false;
|
||||
private bool _swimmingEnabled = false;
|
||||
|
||||
/// <summary>
|
||||
/// 战斗超时,单位秒
|
||||
|
||||
@@ -56,7 +56,6 @@ public class AutoFightParam : BaseTaskParam<AutoFightTask>
|
||||
RotaryFactor = autoFightConfig.FinishDetectConfig.RotaryFactor;
|
||||
QinDoublePickUp = autoFightConfig.QinDoublePickUp;
|
||||
SwimmingEnabled = autoFightConfig.SwimmingEnabled;
|
||||
ExpBasedPickupEnabled = autoFightConfig.ExpBasedPickupEnabled;
|
||||
}
|
||||
|
||||
public FightFinishDetectConfig FinishDetectConfig { get; set; } = new();
|
||||
@@ -85,11 +84,6 @@ public class AutoFightParam : BaseTaskParam<AutoFightTask>
|
||||
public bool QinDoublePickUp { get; set; } = false;
|
||||
public static bool SwimmingEnabled { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 基于经验值判断是否执行战后拾取
|
||||
/// </summary>
|
||||
public bool ExpBasedPickupEnabled { get; set; } = false;
|
||||
|
||||
public AutoFightParam(string? strategyName = null) : base(null, null)
|
||||
{
|
||||
SetCombatStrategyPath(strategyName);
|
||||
@@ -146,6 +140,5 @@ public class AutoFightParam : BaseTaskParam<AutoFightTask>
|
||||
GuardianAvatarHold = autoFightConfig.GuardianAvatarHold;
|
||||
SwimmingEnabled = autoFightConfig.SwimmingEnabled;
|
||||
QinDoublePickUp = autoFightConfig.QinDoublePickUp;
|
||||
ExpBasedPickupEnabled = autoFightConfig.ExpBasedPickupEnabled;
|
||||
}
|
||||
}
|
||||
@@ -320,8 +320,7 @@ namespace BetterGenshinImpact.GameTask.AutoFight
|
||||
if (retryCount == 0)
|
||||
{
|
||||
await Delay(delayTime,ct);
|
||||
// Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
|
||||
Logger.LogInformation("打开编队界面检查战斗是否结束");
|
||||
Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
|
||||
Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen);
|
||||
await Delay(detectDelayTime, ct);
|
||||
var ra3 = CaptureToRectArea();
|
||||
@@ -461,7 +460,7 @@ namespace BetterGenshinImpact.GameTask.AutoFight
|
||||
{
|
||||
while (attempt < retryCount)
|
||||
{
|
||||
if (guardianAvatar.TrySwitch(10))
|
||||
if (guardianAvatar.TrySwitch(10, false))
|
||||
{
|
||||
guardianAvatar.ManualSkillCd = -1;
|
||||
if (await AvatarSkillAsync(Logger, guardianAvatar, false, 1, ct))
|
||||
@@ -550,7 +549,7 @@ namespace BetterGenshinImpact.GameTask.AutoFight
|
||||
Logger.LogInformation("优先第 {text} 盾奶位 {GuardianAvatar} 元素爆发状态:{attempt},尝试释放",
|
||||
guardianAvatarName, guardianAvatar.Name, "就绪");
|
||||
|
||||
if (guardianAvatar.TrySwitch(8))
|
||||
if (guardianAvatar.TrySwitch(8, false))
|
||||
{
|
||||
Simulation.SendInput.SimulateAction(GIActions.ElementalBurst);
|
||||
Sleep(500, ct);
|
||||
|
||||
@@ -22,10 +22,6 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Handler;
|
||||
using BetterGenshinImpact.GameTask.AutoPick.Assets;
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.Common.Element.Assets;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.GameTask.AutoFight.Assets;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight;
|
||||
|
||||
@@ -48,10 +44,6 @@ public class AutoFightTask : ISoloTask
|
||||
public static bool FightStatusFlag { get; set; } = false;
|
||||
|
||||
private static readonly object PickLock = new object();
|
||||
|
||||
private readonly double _assetScale = TaskContext.Instance().SystemInfo.AssetScale;
|
||||
|
||||
private readonly ReturnMainUiTask _returnMainUiTask = new();
|
||||
|
||||
// 战斗点位
|
||||
public static WaypointForTrack? FightWaypoint {get; set;} = null;
|
||||
@@ -300,16 +292,6 @@ public class AutoFightTask : ISoloTask
|
||||
|
||||
AutoFightSeek.RotationCount= 0; // 重置旋转次数
|
||||
|
||||
// 基于经验值的战后拾取检测:在战斗过程中异步检测精英怪经验值图标
|
||||
// 仅在万叶拾取总开关开启时才启动经验值检测
|
||||
ExperienceDetector? expDetector = null;
|
||||
if (_taskParam.KazuhaPickupEnabled && _taskParam.ExpBasedPickupEnabled)
|
||||
{
|
||||
var expRos = AutoFightAssets.Instance.ExperienceRecognitionObjects;
|
||||
expDetector = new ExperienceDetector(expRos, cts2.Token);
|
||||
expDetector.Start();
|
||||
}
|
||||
|
||||
// 战斗操作
|
||||
var fightTask = Task.Run(async () =>
|
||||
{
|
||||
@@ -429,7 +411,7 @@ public class AutoFightTask : ISoloTask
|
||||
fightEndFlag = await CheckFightFinish(delayTime, detectDelayTime);
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
command.Execute(combatScenes, lastCommand);
|
||||
//统计战斗人次
|
||||
if (i == combatCommands.Count - 1 || command.Name != combatCommands[i + 1].Name)
|
||||
@@ -437,13 +419,6 @@ public class AutoFightTask : ISoloTask
|
||||
countFight++;
|
||||
}
|
||||
|
||||
#region check动作触发战斗结束检测
|
||||
if (command.Method == Method.Check && _taskParam.FightFinishDetectEnabled)
|
||||
{
|
||||
fightEndFlag = await CheckFightFinish(delayTime, detectDelayTime);
|
||||
}
|
||||
#endregion
|
||||
|
||||
lastFightName = command.Name;
|
||||
if (!fightEndFlag && _taskParam is { FightFinishDetectEnabled: true })
|
||||
{
|
||||
@@ -462,7 +437,7 @@ public class AutoFightTask : ISoloTask
|
||||
if (_finishDetectConfig.DelayTimes.TryGetValue(command.Name, out var time))
|
||||
{
|
||||
delayTime = time;
|
||||
// Logger.LogInformation($"{command.Name}结束后,延时检查为{delayTime}毫秒");
|
||||
Logger.LogInformation($"{command.Name}结束后,延时检查为{delayTime}毫秒");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -500,50 +475,6 @@ public class AutoFightTask : ISoloTask
|
||||
}, cts2.Token);
|
||||
|
||||
await fightTask;
|
||||
|
||||
try
|
||||
{
|
||||
// 基于经验值检测结果的拾取判断
|
||||
if (_taskParam.KazuhaPickupEnabled && _taskParam.ExpBasedPickupEnabled && expDetector != null)
|
||||
{
|
||||
// 战斗结束与怪物死亡可能几乎同时发生,检测器可能还没来得及捕获经验值图标
|
||||
// 保持检测器运行,每 100ms 轮询一次结果,最多等待 1.1 秒
|
||||
if (!expDetector.HasDetectedExperience)
|
||||
{
|
||||
Logger.LogInformation("基于经验值判断:等待经验值检测结果");
|
||||
var waitMs = 1100;
|
||||
while (!expDetector.HasDetectedExperience && waitMs > 0)
|
||||
{
|
||||
await Delay(100, ct);
|
||||
waitMs -= 100;
|
||||
}
|
||||
}
|
||||
|
||||
await expDetector.StopAsync();
|
||||
var shouldPickup = expDetector.HasDetectedExperience;
|
||||
Logger.LogInformation("基于经验值判断:{Result} 战后拾取", shouldPickup ? "执行" : "不执行");
|
||||
|
||||
if (!shouldPickup)
|
||||
{
|
||||
// 经验值检测未通过,跳过拾取(但仍执行扫描拾取逻辑)
|
||||
if (_taskParam is { PickDropsAfterFightEnabled: true })
|
||||
{
|
||||
await new ScanPickTask().Start(ct);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
// 确保检测器在任何路径(异常/取消/正常)都被停止和释放
|
||||
if (expDetector != null)
|
||||
{
|
||||
await expDetector.StopAsync();
|
||||
expDetector.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
if (_taskParam.BattleThresholdForLoot>=2 && countFight < _taskParam.BattleThresholdForLoot)
|
||||
{
|
||||
Logger.LogInformation($"战斗人次({countFight})低于配置人次({_taskParam.BattleThresholdForLoot}),跳过此次拾取!");
|
||||
@@ -555,91 +486,7 @@ public class AutoFightTask : ISoloTask
|
||||
// 队伍中存在万叶的时候使用一次长E
|
||||
var picker = combatScenes.SelectAvatar("枫原万叶") ?? combatScenes.SelectAvatar("琴");
|
||||
|
||||
string? oldPartyName = null;
|
||||
if (RunnerContext.Instance.PartyName is not null)
|
||||
{
|
||||
oldPartyName = RunnerContext.Instance.PartyName;
|
||||
}
|
||||
else if(picker is null && !string.IsNullOrEmpty(_taskParam.KazuhaPartyName))
|
||||
{
|
||||
Logger.LogWarning("换队拾取:当前队伍名称为空,尝试读取!");
|
||||
await Delay(1000, ct);
|
||||
await _returnMainUiTask.Start(ct);
|
||||
|
||||
for (int attempt = 0; attempt < 6; attempt++)
|
||||
{
|
||||
Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen);
|
||||
var enterGameAppear = await NewRetry.WaitForElementAppear(
|
||||
ElementAssets.Instance.PartyBtnChooseView,
|
||||
() => { },
|
||||
ct,
|
||||
15,
|
||||
500
|
||||
);
|
||||
if(attempt == 5 && !enterGameAppear)
|
||||
{
|
||||
Logger.LogWarning("换队拾取:读取队伍名称失败,跳过换队拾取步骤");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(_taskParam.KazuhaPartyName)){
|
||||
await Delay(1000, ct);
|
||||
|
||||
//等待寻找2秒队伍按钮出现
|
||||
var timeWaitStart = 0;
|
||||
while(timeWaitStart < 6000)
|
||||
{
|
||||
using var ra = CaptureToRectArea();
|
||||
var partyViewBtn = ra.Find(ElementAssets.Instance.PartyBtnChooseView);
|
||||
if (partyViewBtn.IsExist())
|
||||
{
|
||||
// OCR 当前队伍名称(无法单字,中间禁止空格)
|
||||
// 读取OCR原始识别文本
|
||||
var rawPartyName = ra.Find(new RecognitionObject
|
||||
{
|
||||
RecognitionType = RecognitionTypes.Ocr,
|
||||
RegionOfInterest = new Rect(partyViewBtn.Right, partyViewBtn.Top, (int)(350 * _assetScale),
|
||||
partyViewBtn.Height)
|
||||
}).Text;
|
||||
|
||||
// 核心处理逻辑:1.空值兜底 2.去首尾空白 3.移除末尾的“口”字(仅最后一个是口才删)
|
||||
if (string.IsNullOrWhiteSpace(rawPartyName))
|
||||
{
|
||||
oldPartyName = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
//有概率把编辑图标识别为字符,并且含有空格或换行符,需要过滤
|
||||
var tempName = rawPartyName
|
||||
.Replace("\"", "") // 移除所有双引号(核心新增,解决日志里的""问题)
|
||||
.Replace("\r\n", "") // 清理Windows换行符
|
||||
.Replace("\r", ""); // 先清理所有双引号,避免引号干扰后续处理
|
||||
|
||||
// 核心逻辑:找到第一个换行符(\n)的位置,截断并删除换行+后面所有字符
|
||||
int firstNewLineIndex = tempName.IndexOf('\n');
|
||||
if (firstNewLineIndex != -1) // 存在换行符,截取到换行符前
|
||||
{
|
||||
tempName = tempName.Substring(0, firstNewLineIndex);
|
||||
}
|
||||
|
||||
// 最后统一去首尾所有空白(空格、制表符、回车符\r等),得到纯净队伍名
|
||||
oldPartyName = tempName.Trim();
|
||||
}
|
||||
|
||||
// 后续原有逻辑不变
|
||||
Logger.LogInformation("换队拾取:当前队伍名称读取为:{oldPartyName}", oldPartyName);
|
||||
// 加在rawPartyName赋值后,打印原始文本的“原始形态”(转义符会显示)
|
||||
Logger.LogDebug("OCR原始识别文本(含转义):{rawPartyName}", rawPartyName);
|
||||
RunnerContext.Instance.PartyName = oldPartyName;
|
||||
// await _returnMainUiTask.Start(ct);
|
||||
break;
|
||||
}
|
||||
await Delay(200, ct);
|
||||
timeWaitStart += 200;
|
||||
}
|
||||
}
|
||||
|
||||
var oldPartyName = RunnerContext.Instance.PartyName;
|
||||
var switchPartyFlag = false;
|
||||
if (picker == null && !timeOutFlag &&!string.IsNullOrEmpty(_taskParam.KazuhaPartyName) && oldPartyName != _taskParam.KazuhaPartyName)
|
||||
{
|
||||
@@ -669,32 +516,17 @@ public class AutoFightTask : ISoloTask
|
||||
if (picker.Name == "枫原万叶")
|
||||
{
|
||||
var time = TimeSpan.FromSeconds(picker.GetSkillCdSeconds());
|
||||
|
||||
// 如果配置了二次拾取,或者不满足跳过条件(上次是万叶且冷却时间>3秒),则执行拾取
|
||||
bool shouldSkip = lastFightName == picker.Name && time.TotalSeconds > 3;
|
||||
bool forcePickup = _taskParam.QinDoublePickUp;
|
||||
|
||||
if (forcePickup || !shouldSkip)
|
||||
if (!(lastFightName == picker.Name && time.TotalSeconds > 3))
|
||||
{
|
||||
Logger.LogInformation("使用 枫原万叶-长E 拾取掉落物");
|
||||
await Delay(200, ct);
|
||||
if (picker.TrySwitch(10))
|
||||
{
|
||||
// 等待元素战技 CD 就绪
|
||||
await picker.WaitSkillCd(ct);
|
||||
|
||||
// 调用统一的辅助方法,模拟万叶长按 E 的输入序列:
|
||||
// 包含释放鼠标左键前摇防卡键 -> E 键 KeyDown -> 延时 800ms -> E 键 KeyUp -> 延时 50ms
|
||||
await SimulateHoldElementalSkillAsync(800, ct);
|
||||
|
||||
// 调用统一的辅助方法,模拟 6 次鼠标左键连续点击:
|
||||
// 配合万叶长 E 的滞空特性执行下落攻击,内部包含 try/finally 以保证取消任务时安全释放左键
|
||||
await SimulateMouseLeftClickLoopAsync(6, ct);
|
||||
|
||||
// 等待下落攻击和聚怪拾取动作彻底结束
|
||||
picker.UseSkill(true);
|
||||
await Delay(50, ct);
|
||||
Simulation.SendInput.SimulateAction(GIActions.NormalAttack);
|
||||
await Delay(1500, ct);
|
||||
// 截图并更新技能最新冷却时间
|
||||
picker.AfterUseSkill();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -801,7 +633,7 @@ public class AutoFightTask : ISoloTask
|
||||
|
||||
if (_taskParam is { PickDropsAfterFightEnabled: true } )
|
||||
{
|
||||
// 执行扫描掉落物光柱并靠近的功能
|
||||
// 执行自动拾取掉落物的功能
|
||||
await new ScanPickTask().Start(ct);
|
||||
}
|
||||
}
|
||||
@@ -845,8 +677,7 @@ public class AutoFightTask : ISoloTask
|
||||
|
||||
if (!_finishDetectConfig.RotateFindEnemyEnabled)await Delay(delayTime, _ct);
|
||||
|
||||
// Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
|
||||
Logger.LogInformation("打开编队界面检查战斗是否结束");
|
||||
Logger.LogInformation("打开编队界面检查战斗是否结束,延时{detectDelayTime}毫秒检查", detectDelayTime);
|
||||
// 最终方案确认战斗结束
|
||||
Simulation.SendInput.SimulateAction(GIActions.OpenPartySetupScreen);
|
||||
await Delay(detectDelayTime, _ct);
|
||||
@@ -869,9 +700,8 @@ public class AutoFightTask : ISoloTask
|
||||
return true;
|
||||
}
|
||||
|
||||
// Logger.LogInformation($"未识别到战斗结束yellow{b3.Item0},{b3.Item1},{b3.Item2}");
|
||||
// Logger.LogInformation($"未识别到战斗结束white{whiteTile.Item0},{whiteTile.Item1},{whiteTile.Item2}");
|
||||
Logger.LogInformation($"未识别到战斗结束: yellow{b3.Item0},{b3.Item1},{b3.Item2};white{whiteTile.Item0},{whiteTile.Item1},{whiteTile.Item2}");
|
||||
Logger.LogInformation($"未识别到战斗结束yellow{b3.Item0},{b3.Item1},{b3.Item2}");
|
||||
Logger.LogInformation($"未识别到战斗结束white{whiteTile.Item0},{whiteTile.Item1},{whiteTile.Item2}");
|
||||
|
||||
if (_finishDetectConfig.RotateFindEnemyEnabled)
|
||||
{
|
||||
|
||||
@@ -1,165 +0,0 @@
|
||||
using BetterGenshinImpact.Core.Recognition;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using BetterGenshinImpact.GameTask.Model.Area;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using OpenCvSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight;
|
||||
|
||||
/// <summary>
|
||||
/// 经验值检测器:在战斗过程中异步检测屏幕上怪物死亡时掉落的经验值数字图标,
|
||||
/// 用于判断是否有精英怪被击杀,从而决定战后是否执行拾取。
|
||||
/// </summary>
|
||||
public sealed class ExperienceDetector : IDisposable
|
||||
{
|
||||
private static readonly ILogger Logger = TaskControl.Logger;
|
||||
|
||||
/// <summary>
|
||||
/// 经验值图标左侧特征像素的水平偏移量(相对于模板匹配位置)
|
||||
/// </summary>
|
||||
private const int ExpIconPixelOffsetX = -147;
|
||||
|
||||
/// <summary>
|
||||
/// 经验值图标特征颜色 BGR 范围(用于二次验证模板匹配结果)
|
||||
/// </summary>
|
||||
private static readonly Vec3b ExpColorMin = new(200, 200, 150);
|
||||
private static readonly Vec3b ExpColorMax = new(255, 255, 200);
|
||||
|
||||
/// <summary>
|
||||
/// 检测循环间隔(毫秒)
|
||||
/// </summary>
|
||||
private const int DetectionIntervalMs = 100;
|
||||
|
||||
private readonly IReadOnlyList<RecognitionObject> _experienceRos;
|
||||
private readonly CancellationTokenSource _linkedCts;
|
||||
private readonly TaskCompletionSource<bool> _resultTcs;
|
||||
private Task? _detectionTask;
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>
|
||||
/// 获取检测结果:是否检测到经验值图标
|
||||
/// </summary>
|
||||
public bool HasDetectedExperience =>
|
||||
_resultTcs.Task.IsCompletedSuccessfully && _resultTcs.Task.Result;
|
||||
|
||||
public ExperienceDetector(
|
||||
IReadOnlyList<RecognitionObject> experienceRos,
|
||||
CancellationToken externalToken)
|
||||
{
|
||||
_experienceRos = experienceRos ?? throw new ArgumentNullException(nameof(experienceRos));
|
||||
_linkedCts = CancellationTokenSource.CreateLinkedTokenSource(externalToken);
|
||||
_resultTcs = new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 启动后台经验值检测循环
|
||||
/// </summary>
|
||||
public void
|
||||
Start()
|
||||
{
|
||||
if (_experienceRos.Count == 0)
|
||||
{
|
||||
Logger.LogWarning("经验值检测:无可用模板,跳过检测");
|
||||
return;
|
||||
}
|
||||
|
||||
_detectionTask = Task.Run(() => DetectionLoop(_linkedCts.Token), _linkedCts.Token);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 停止检测并等待后台任务结束
|
||||
/// </summary>
|
||||
public async Task StopAsync()
|
||||
{
|
||||
_linkedCts.Cancel();
|
||||
if (_detectionTask != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
await _detectionTask.ConfigureAwait(false);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// 正常取消,忽略
|
||||
}
|
||||
}
|
||||
|
||||
// 确保结果有值(未检测到时设为 false)
|
||||
_resultTcs.TrySetResult(false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 后台检测循环:截屏 → 模板匹配 → 像素颜色验证
|
||||
/// </summary>
|
||||
private void DetectionLoop(CancellationToken ct)
|
||||
{
|
||||
while (!ct.IsCancellationRequested)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var capture = TaskControl.CaptureToRectArea();
|
||||
|
||||
foreach (var ro in _experienceRos)
|
||||
{
|
||||
ct.ThrowIfCancellationRequested();
|
||||
|
||||
var matchResult = capture.Find(ro);
|
||||
if (!matchResult.IsExist())
|
||||
continue;
|
||||
|
||||
// 模板匹配成功,执行像素颜色二次验证
|
||||
if (ValidateExpPixelColor(capture, matchResult))
|
||||
{
|
||||
Logger.LogInformation("基于经验值判断:检测到 {Name} 经验值图标,启用战后拾取", ro.Name.Replace("Experience_", ""));
|
||||
_resultTcs.TrySetResult(true);
|
||||
return; // 检测到后退出循环
|
||||
}
|
||||
}
|
||||
|
||||
// 短暂等待后继续下一轮检测
|
||||
Thread.Sleep(DetectionIntervalMs);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
break;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "经验值检测循环中发生异常,继续下一轮");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 像素颜色验证:检查匹配位置左侧偏移处的像素是否符合经验值图标特征色
|
||||
/// </summary>
|
||||
private static bool ValidateExpPixelColor(ImageRegion capture, Region matchResult)
|
||||
{
|
||||
var checkX = matchResult.X + ExpIconPixelOffsetX;
|
||||
var checkY = matchResult.Y;
|
||||
|
||||
// 边界检查
|
||||
if (checkX < 0 || checkX >= capture.SrcMat.Cols || checkY < 0 || checkY >= capture.SrcMat.Rows)
|
||||
return false;
|
||||
|
||||
var pixel = capture.SrcMat.At<Vec3b>(checkY, checkX);
|
||||
return pixel[0] >= ExpColorMin[0] && pixel[0] <= ExpColorMax[0] // B
|
||||
&& pixel[1] >= ExpColorMin[1] && pixel[1] <= ExpColorMax[1] // G
|
||||
&& pixel[2] >= ExpColorMin[2] && pixel[2] <= ExpColorMax[2]; // R
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
_disposed = true;
|
||||
|
||||
_linkedCts.Cancel();
|
||||
_linkedCts.Dispose();
|
||||
_resultTcs.TrySetResult(false);
|
||||
_detectionTask = null;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
using BetterGenshinImpact.Core.Recognition.OCR;
|
||||
using BetterGenshinImpact.Core.Recognition.OCR;
|
||||
using BetterGenshinImpact.Core.Recognition.OpenCv;
|
||||
using BetterGenshinImpact.Core.Script.Dependence;
|
||||
using BetterGenshinImpact.Core.Simulator;
|
||||
@@ -24,11 +24,6 @@ using BetterGenshinImpact.GameTask.AutoGeniusInvokation.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Model;
|
||||
using BetterGenshinImpact.GameTask.AutoPathing.Model.Enum;
|
||||
using BetterGenshinImpact.Core.Recognition.ONNX;
|
||||
using BetterGenshinImpact.GameTask.Common;
|
||||
using Compunet.YoloSharp;
|
||||
using Compunet.YoloSharp.Data;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
|
||||
@@ -91,23 +86,7 @@ public class Avatar
|
||||
/// 战斗场景
|
||||
/// </summary>
|
||||
public CombatScenes CombatScenes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 脱困方向数组(前/后/左/右)
|
||||
/// </summary>
|
||||
private static readonly GIActions[] UnstuckDirections =
|
||||
{
|
||||
GIActions.MoveForward,
|
||||
GIActions.MoveBackward,
|
||||
GIActions.MoveLeft,
|
||||
GIActions.MoveRight
|
||||
};
|
||||
|
||||
private static readonly Random UnstuckRandom = new();
|
||||
|
||||
private static readonly Lazy<BgiYoloPredictor> QBurstClassifierLazy = new(() =>
|
||||
App.ServiceProvider.GetRequiredService<BgiOnnxFactory>().CreateYoloPredictor(BgiOnnxModel.BgiQClassify));
|
||||
|
||||
|
||||
|
||||
public Avatar(CombatScenes combatScenes, string name, int index, Rect nameRect, double manualSkillCd = -1)
|
||||
{
|
||||
@@ -142,61 +121,32 @@ public class Avatar
|
||||
{
|
||||
if (AutoFightTask.FightWaypoint is not null)
|
||||
{
|
||||
// 二次确认:延迟 800ms 后重新截屏,避免同帧误判
|
||||
Sleep(800, ct);
|
||||
using var ra = CaptureToRectArea();
|
||||
if (!SwimmingConfirm(ra))
|
||||
if (!SwimmingConfirm(ra)) //二次确认
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Logger.LogInformation("游泳检测:尝试回到战斗地点");
|
||||
|
||||
// 保存原始 MoveMode,用于 finally 还原
|
||||
var originalMoveMode = AutoFightTask.FightWaypoint.MoveMode;
|
||||
// 链接外部取消令牌,确保外部取消时能及时响应;using 确保自动 Dispose
|
||||
using var cts = CancellationTokenSource.CreateLinkedTokenSource(ct);
|
||||
|
||||
var pathExecutor = new PathExecutor(ct);
|
||||
try
|
||||
{
|
||||
var pathExecutor = new PathExecutor(cts.Token);
|
||||
|
||||
// FaceTo 朝向战斗点,超时 2 秒
|
||||
cts.CancelAfter(2000);
|
||||
pathExecutor.FaceTo(AutoFightTask.FightWaypoint).GetAwaiter().GetResult();
|
||||
|
||||
// 重置超时,MoveTo 超时 15 秒
|
||||
cts.CancelAfter(15000);
|
||||
// 使用 Climb 模式:MoveTo 内部对 Climb 模式跳过卡死脱困检测,避免水中 TrapEscaper 死循环
|
||||
AutoFightTask.FightWaypoint.MoveMode = MoveModeEnum.Climb.Code;
|
||||
pathExecutor.FaceTo(AutoFightTask.FightWaypoint).Wait(2000, ct);
|
||||
AutoFightTask.FightWaypoint.MoveMode = MoveModeEnum.Fly.Code;//改为跳飞
|
||||
Simulation.SendInput.Mouse.RightButtonDown();
|
||||
pathExecutor.MoveTo(AutoFightTask.FightWaypoint).GetAwaiter().GetResult();
|
||||
Logger.LogInformation("游泳检测:移动结束");
|
||||
}
|
||||
catch (OperationCanceledException) when (ct.IsCancellationRequested)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
Logger.LogWarning("游泳检测:回到战斗地点超时");
|
||||
pathExecutor.MoveTo(AutoFightTask.FightWaypoint).Wait(15000, ct);
|
||||
AutoFightTask.FightWaypoint = null;//执行后清空,即每次战斗只执行一次,第二次直接去七天神像
|
||||
Simulation.SendInput.Mouse.RightButtonUp();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError(ex, "游泳检测:回到战斗地点异常");
|
||||
}
|
||||
finally
|
||||
{
|
||||
// 确保所有资源和状态在任何路径都被正确清理
|
||||
cts.Cancel(); // 终止 PathExecutor 内部截屏循环
|
||||
AutoFightTask.FightWaypoint.MoveMode = originalMoveMode;
|
||||
AutoFightTask.FightWaypoint = null;
|
||||
Simulation.SendInput.Mouse.RightButtonUp();
|
||||
Simulation.ReleaseAllKey();
|
||||
Logger.LogWarning(ex, "游泳检测:回到战斗地点异常");
|
||||
}
|
||||
|
||||
using var bitmap2 = CaptureToRectArea();
|
||||
if (!SwimmingConfirm(bitmap2))
|
||||
Simulation.ReleaseAllKey();
|
||||
|
||||
using var ra2 = CaptureToRectArea();
|
||||
if (!SwimmingConfirm(ra2))
|
||||
{
|
||||
Logger.LogInformation("游泳检测:游泳脱困成功");
|
||||
return;
|
||||
@@ -216,9 +166,8 @@ public class Avatar
|
||||
/// </summary>
|
||||
private static bool SwimmingConfirm(Region region)
|
||||
{
|
||||
using var imageRegion = region.ToImageRegion();
|
||||
using var cropped = imageRegion.DeriveCrop(1819, 1025, 9, 11);
|
||||
using var mask = OpenCvCommonHelper.Threshold(cropped.SrcMat, new Scalar(242, 223, 39), new Scalar(255, 233, 44));
|
||||
using var mask = OpenCvCommonHelper.Threshold(region.ToImageRegion().DeriveCrop(1819, 1025, 9, 11).SrcMat,
|
||||
new Scalar(242, 223, 39),new Scalar(255, 233, 44));
|
||||
using var labels = new Mat();
|
||||
using var stats = new Mat();
|
||||
using var centroids = new Mat();
|
||||
@@ -270,13 +219,6 @@ public class Avatar
|
||||
SimulateSwitchAction(Index);
|
||||
// Debug.WriteLine($"切换到{Index}号位");
|
||||
// Cv2.ImWrite($"log/切换.png", region.SrcMat);
|
||||
|
||||
// 第10次重试时,战斗状态下执行脱困动作
|
||||
if (i == 10 && AutoFightTask.FightStatusFlag)
|
||||
{
|
||||
PerformUnstuckAction(Ct);
|
||||
}
|
||||
|
||||
Sleep(250, Ct);
|
||||
}
|
||||
}
|
||||
@@ -287,7 +229,7 @@ public class Avatar
|
||||
/// <param name="tryTimes"></param>
|
||||
/// <param name="needLog"></param>
|
||||
/// <returns></returns>
|
||||
public bool TrySwitch(int tryTimes = 4)
|
||||
public bool TrySwitch(int tryTimes = 4, bool needLog = true)
|
||||
{
|
||||
var context = new AvatarActiveCheckContext();
|
||||
for (var i = 0; i < tryTimes; i++)
|
||||
@@ -303,30 +245,19 @@ public class Avatar
|
||||
// 切换成功
|
||||
if (CombatScenes.GetActiveAvatarIndex(region, context) == Index)
|
||||
{
|
||||
if (needLog && i > 0)
|
||||
{
|
||||
Logger.LogInformation("成功切换角色:{Name}", Name);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (i == tryTimes - 1 && tryTimes == 4) //默认状态,没有特意设置重试次数的情况下,最后一次重试失败才输出日志
|
||||
{
|
||||
Logger.LogWarning("切换角色失败,最后一次尝试,当前角色编号:{CurrentIndex},期望角色编号:{ExpectedIndex}", CombatScenes.GetActiveAvatarIndex(region, context), Index);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 特意需要脱困情形下,会设置重试次数激活脱困检测,第10次重试时(2.5秒切换失败,超过角色的大招动画时间),如在盾奶位功能中次数会到第十次。
|
||||
if (i == 9 && AutoFightTask.FightStatusFlag)
|
||||
{
|
||||
PerformUnstuckAction(Ct);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SimulateSwitchAction(Index);
|
||||
|
||||
Sleep(250, Ct);
|
||||
}
|
||||
|
||||
Logger.LogWarning("切换角色失败:{Name}", Name);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -356,23 +287,6 @@ public class Avatar
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 战斗中切换角色卡住时的脱困动作:跳跃 → 随机方向移动+切换 → 攻击 → 释放按键
|
||||
/// </summary>
|
||||
private void PerformUnstuckAction(CancellationToken ct)
|
||||
{
|
||||
var direction = UnstuckDirections[UnstuckRandom.Next(4)];
|
||||
Logger.LogWarning("切换角色卡住,执行脱困(方向:{Dir})", direction);
|
||||
|
||||
Simulation.SendInput.SimulateAction(GIActions.Jump);
|
||||
Sleep(200, ct);
|
||||
Simulation.SendInput.SimulateAction(direction, KeyType.KeyDown);
|
||||
SimulateSwitchAction(Index);
|
||||
Sleep(1000, ct);
|
||||
Simulation.SendInput.SimulateAction(GIActions.NormalAttack);
|
||||
Simulation.ReleaseAllKey();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 切换到本角色
|
||||
/// 切换cd是1秒,如果切换失败,会尝试再次切换,最多尝试5次
|
||||
@@ -549,8 +463,8 @@ public class Avatar
|
||||
var cd = AfterUseSkill(region);
|
||||
if (cd > 0)
|
||||
{
|
||||
// Logger.LogInformation(hold ? "{Name} 长按元素战技,cd:{Cd} 秒" : "{Name} 点按元素战技,cd:{Cd} 秒", Name,
|
||||
// Math.Round(cd, 2));
|
||||
Logger.LogInformation(hold ? "{Name} 长按元素战技,cd:{Cd} 秒" : "{Name} 点按元素战技,cd:{Cd} 秒", Name,
|
||||
Math.Round(cd, 2));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -599,14 +513,6 @@ public class Avatar
|
||||
/// </summary>
|
||||
public void UseBurst()
|
||||
{
|
||||
// CD 中立即返回,其余场景尝试释放
|
||||
using var region1 = CaptureToRectArea();
|
||||
if (IsBurstReadyByClassify(region1) != BurstReadyState.Ready)
|
||||
{
|
||||
// Logger.LogInformation("Q在CD,跳过");
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i = 0; i < 10; i++)
|
||||
{
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
@@ -614,7 +520,6 @@ public class Avatar
|
||||
return;
|
||||
}
|
||||
|
||||
// Logger.LogInformation("释放Q");
|
||||
Simulation.SendInput.SimulateAction(GIActions.ElementalBurst);
|
||||
Sleep(200, Ct);
|
||||
|
||||
@@ -627,47 +532,9 @@ public class Avatar
|
||||
Sleep(1500, Ct);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
// 找到编号块判断是否进入了CD,四星角色没有大招动画
|
||||
if (IsBurstReadyByClassify(region) != BurstReadyState.Ready)
|
||||
{
|
||||
// Logger.LogInformation("释放Q后检查到CD");
|
||||
Sleep(1500, Ct);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static BurstReadyState IsBurstReadyByClassify(ImageRegion imageRegion)
|
||||
{
|
||||
using var qRa = imageRegion.DeriveCrop(AutoFightAssets.Instance.QRectForClassify);
|
||||
var result = QBurstClassifierLazy.Value.Predictor.Classify(qRa.CacheImage);
|
||||
var topClass = result.GetTopClass();
|
||||
var topClassName = topClass.Name.Name;
|
||||
// Logger.LogInformation("Q技能冷却分类:{ClassName},置信度:{Confidence:F2}", topClassName, topClass.Confidence);
|
||||
|
||||
// 置信度不足时,直接返回未知,避免误判导致漏放/乱放
|
||||
if (topClass.Confidence <= 0.7)
|
||||
{
|
||||
// Logger.LogInformation("Q技能冷却分类置信度不足:{Confidence:F2},类别:{ClassName}", topClass.Confidence, topClassName);
|
||||
return BurstReadyState.Unknown;
|
||||
}
|
||||
|
||||
if (topClassName.Contains("cd 1", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return BurstReadyState.Cooldown;
|
||||
}
|
||||
|
||||
if (topClassName.Contains("energy 1 cd 0", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return BurstReadyState.Ready;
|
||||
}
|
||||
|
||||
return BurstReadyState.Unknown;
|
||||
}
|
||||
|
||||
// /// <summary>
|
||||
// /// 元素爆发是否正在CD中
|
||||
// /// 右下 157x165
|
||||
@@ -753,32 +620,6 @@ public class Avatar
|
||||
{
|
||||
Sleep(ms); // 由于存在宏操作,等待不应被cts取消
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 等待完成
|
||||
/// </summary>
|
||||
public void Ready()
|
||||
{
|
||||
Sleep(10, Ct);
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
if (Ct is { IsCancellationRequested: true })
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
using var region = CaptureToRectArea();
|
||||
// 等待角色编号块出现
|
||||
if (PartyAvatarSideIndexHelper.HasAnyIndexRect(region))
|
||||
{
|
||||
region.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
Sleep(150, Ct);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
@@ -1016,11 +857,6 @@ public class Avatar
|
||||
GlobalMethod.MoveMouseBy(x, y);
|
||||
}
|
||||
|
||||
public void Scroll(int scrollAmountInClicks)
|
||||
{
|
||||
Simulation.SendInput.Mouse.VerticalScroll(scrollAmountInClicks);
|
||||
}
|
||||
|
||||
public void KeyDown(string key)
|
||||
{
|
||||
var vk = KeyBindingsSettingsPageViewModel.MappingKey(User32Helper.ToVk(key));
|
||||
@@ -1153,4 +989,4 @@ public class Avatar
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
namespace BetterGenshinImpact.GameTask.AutoFight.Model;
|
||||
|
||||
public enum BurstReadyState
|
||||
{
|
||||
Ready,
|
||||
Cooldown,
|
||||
Unknown
|
||||
}
|
||||
|
||||
@@ -177,48 +177,6 @@ public class CombatScenes : IDisposable
|
||||
return this;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 静默模式下的队伍识别(用于后台挂件)
|
||||
/// </summary>
|
||||
public CombatScenes InitializeTeamSilent(ImageRegion imageRegion, AutoFightConfig? autoFightConfig = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (autoFightConfig == null)
|
||||
{
|
||||
autoFightConfig = TaskContext.Instance().Config.AutoFightConfig;
|
||||
}
|
||||
|
||||
// 优先取配置
|
||||
if (!string.IsNullOrEmpty(autoFightConfig.TeamNames))
|
||||
{
|
||||
InitializeTeamFromConfig(autoFightConfig.TeamNames, autoFightConfig);
|
||||
return this;
|
||||
}
|
||||
|
||||
// 使用 NullLogger 彻底屏蔽底层工具类的日志输出
|
||||
var nullLogger = Microsoft.Extensions.Logging.Abstractions.NullLogger.Instance;
|
||||
|
||||
CurrentMultiGameStatus = PartyAvatarSideIndexHelper.DetectedMultiGameStatus(imageRegion, _autoFightAssets, nullLogger);
|
||||
var (avatarIndexRectList, avatarSideIconRectList) = PartyAvatarSideIndexHelper.GetAllIndexRects(imageRegion, CurrentMultiGameStatus, nullLogger, _elementAssets, _systemInfo);
|
||||
ExpectedTeamAvatarNum = avatarIndexRectList.Count;
|
||||
|
||||
var names = new string[avatarSideIconRectList.Count];
|
||||
for (var i = 0; i < avatarSideIconRectList.Count; i++)
|
||||
{
|
||||
using var ra = imageRegion.DeriveCrop(avatarSideIconRectList[i]);
|
||||
var pair = ClassifyAvatarCnName(ra.CacheImage, i + 1);
|
||||
names[i] = pair.Item1;
|
||||
}
|
||||
Avatars = BuildAvatars([.. names], null, avatarIndexRectList, autoFightConfig);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 静默模式下完全不抛出、不记录异常
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 这个个方法主要用于在切人判断有误的情况下,且能够找到预期数量的角色编号框。此时只有两种情况
|
||||
@@ -508,7 +466,7 @@ public class CombatScenes : IDisposable
|
||||
if (PartyAvatarSideIndexHelper.CountIndexRect(imageRegion) == Avatars.Length)
|
||||
{
|
||||
bool res = RefreshTeamAvatarIndexRectList(imageRegion);
|
||||
_logger.LogWarning("多次识别出战角色失败,尝试刷新角色编号位置,刷新结果:{Result}", res ? "成功" : "失败");
|
||||
_logger.LogWarning("多次识别出战角色失败,尝试刷新角色编号位置(处理草露问题),刷新结果:{Result}", res ? "成功" : "失败");
|
||||
imageRegion.SrcMat.SaveImage(Global.Absolute("log\\refresh_avatar_index_rect.png"));
|
||||
if (res)
|
||||
{
|
||||
|
||||
@@ -35,12 +35,10 @@ public class PartyAvatarSideIndexHelper
|
||||
{
|
||||
autoFightAssets = AutoFightAssets.Instance;
|
||||
}
|
||||
|
||||
if (logger == null)
|
||||
{
|
||||
logger = TaskControl.Logger;
|
||||
}
|
||||
|
||||
var status = new MultiGameStatus();
|
||||
// 判断当前联机人数
|
||||
var pRaList = imageRegion.FindMulti(autoFightAssets.PRa);
|
||||
@@ -248,7 +246,7 @@ public class PartyAvatarSideIndexHelper
|
||||
|
||||
public static List<Rect> GetAvatarSideIconRectFromIndexRect(List<Rect> indexRect, ISystemInfo systemInfo)
|
||||
{
|
||||
return indexRect.Select(r => GetAvatarSideIconRectFromIndexRect(r, systemInfo)).ToList();
|
||||
return indexRect.Select(r=> GetAvatarSideIconRectFromIndexRect(r, systemInfo)).ToList();
|
||||
}
|
||||
|
||||
public static bool IsIntersecting(double y1, double h1, double y2, double h2)
|
||||
@@ -375,7 +373,8 @@ public class PartyAvatarSideIndexHelper
|
||||
Mat[] mats = new Mat[rectArray.Length];
|
||||
try
|
||||
{
|
||||
int whiteCount = 0, notWhiteRectNum = 0;
|
||||
var whiteCount = 0;
|
||||
var notWhiteRectNum = 0;
|
||||
var mat = imageRegion.CacheGreyMat;
|
||||
for (int i = 0; i < rectArray.Length; i++)
|
||||
{
|
||||
@@ -397,23 +396,8 @@ public class PartyAvatarSideIndexHelper
|
||||
}
|
||||
else
|
||||
{
|
||||
// 方法2:边缘像素白色比例
|
||||
int m2 = FindActiveIndexRectByEdgeColor(mats);
|
||||
if (m2 > 0)
|
||||
{
|
||||
return m2;
|
||||
}
|
||||
|
||||
// 方法3:使用更加靠谱的差值识别(-1是未识别),但是不支持非满队
|
||||
if (mats.Length == 4)
|
||||
{
|
||||
var result = ImageDifferenceDetector.FindMostDifferentImage(mats);
|
||||
return result >= 0 ? result + 1 : -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
// 使用更加靠谱的差值识别(-1是未识别)
|
||||
return ImageDifferenceDetector.FindMostDifferentImage(mats);
|
||||
}
|
||||
}
|
||||
finally
|
||||
@@ -423,13 +407,15 @@ public class PartyAvatarSideIndexHelper
|
||||
mat?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static bool IsWhiteRect(Mat indexMat)
|
||||
{
|
||||
|
||||
var count1 = OpenCvCommonHelper.CountGrayMatColor(indexMat, 251, 255); // 白
|
||||
var count2 = OpenCvCommonHelper.CountGrayMatColor(indexMat, 50, 54); // 黑色文字
|
||||
if ((count1 + count2) * 1.0 / (indexMat.Width * indexMat.Height) > 0.35)
|
||||
if ((count1 + count2) * 1.0 / (indexMat.Width * indexMat.Height) > 0.4)
|
||||
{
|
||||
// Debug.WriteLine($"白色矩形占比{(count1 + count2) * 1.0 / (indexMat.Width * indexMat.Height)}");
|
||||
return true;
|
||||
@@ -457,7 +443,7 @@ public class PartyAvatarSideIndexHelper
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i < rectArray.Length; i++)
|
||||
{
|
||||
if (IsIntersecting(curr.Y, curr.Height, rectArray[i].Y, rectArray[i].Height))
|
||||
@@ -468,121 +454,4 @@ public class PartyAvatarSideIndexHelper
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 通过边缘像素颜色识别出战角色编号
|
||||
/// </summary>
|
||||
/// <param name="mats"></param>
|
||||
/// <returns></returns>
|
||||
public static int FindActiveIndexRectByEdgeColor(Mat[] mats)
|
||||
{
|
||||
try
|
||||
{
|
||||
int whiteCount = 0, notWhiteRectNum = 0;
|
||||
for (int i = 0; i < mats.Length; i++)
|
||||
{
|
||||
if (CalculateWhiteEdgePixelsRatio(mats[i]) > 0.5)
|
||||
{
|
||||
whiteCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
notWhiteRectNum = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (whiteCount == mats.Length - 1)
|
||||
{
|
||||
return notWhiteRectNum;
|
||||
}
|
||||
else if (whiteCount == mats.Length)
|
||||
{
|
||||
// 如果四个都是白色,那就找内部有没有黑色
|
||||
int blackCount = 0, notBlackRectNum = -1;
|
||||
for (int i = 0; i < mats.Length; i++)
|
||||
{
|
||||
var count = OpenCvCommonHelper.CountGrayMatColorC1(mats[i], 50, 50); // 黑字
|
||||
if (count > 0)
|
||||
{
|
||||
blackCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
notBlackRectNum = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (notBlackRectNum >= 1)
|
||||
{
|
||||
TaskControl.Logger.LogDebug("当前所有编号边缘均为白色(背景过白),通过内部黑色像素识别出战编号为{Index},存在黑色数字的角色编号有{C1}个,总角色数量{C2}", notBlackRectNum, blackCount, mats.Length);
|
||||
return notBlackRectNum;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.WriteLine(e);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算灰度图最边缘一圈中纯白色(255)像素的占比
|
||||
/// </summary>
|
||||
/// <returns>返回纯白像素占比 (0.0 到 1.0)</returns>
|
||||
public static double CalculateWhiteEdgePixelsRatio(Mat image)
|
||||
{
|
||||
int whiteCount = 0;
|
||||
int height = image.Height;
|
||||
int width = image.Width;
|
||||
|
||||
// 如果图片太小,无法获取边缘
|
||||
if (height < 1 || width < 1)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
// 计算总边缘像素数
|
||||
int totalCount = 2 * (width + height - 2);
|
||||
|
||||
// 顶边和底边
|
||||
for (int x = 0; x < width; x++)
|
||||
{
|
||||
// 顶边
|
||||
if (image.At<byte>(0, x) == 255)
|
||||
{
|
||||
whiteCount++;
|
||||
}
|
||||
|
||||
// 底边(避免只有一行时重复计数)
|
||||
if (height > 1 && image.At<byte>(height - 1, x) == 255)
|
||||
{
|
||||
whiteCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// 左边和右边(不包括四个角,因为已经在顶边和底边中计算过)
|
||||
for (int y = 1; y < height - 1; y++)
|
||||
{
|
||||
// 左边
|
||||
if (image.At<byte>(y, 0) == 255)
|
||||
{
|
||||
whiteCount++;
|
||||
}
|
||||
|
||||
// 右边(避免只有一列时重复计数)
|
||||
if (width > 1 && image.At<byte>(y, width - 1) == 255)
|
||||
{
|
||||
whiteCount++;
|
||||
}
|
||||
}
|
||||
|
||||
// 计算并返回占比
|
||||
return totalCount > 0 ? (double)whiteCount / totalCount : 0.0;
|
||||
}
|
||||
}
|
||||
@@ -167,10 +167,9 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
{
|
||||
return new Task(() =>
|
||||
{
|
||||
var round = 1;
|
||||
Logger.LogInformation("→ {Name}执行宏", activeAvatar.Name);
|
||||
while (!ct.IsCancellationRequested && IsEnabled())
|
||||
{
|
||||
Logger.LogInformation("→ {Name}执行宏 (第{Round}轮)", activeAvatar.Name, round);
|
||||
if (IsHoldOnMode() && !_isKeyDown)
|
||||
{
|
||||
break;
|
||||
@@ -179,14 +178,8 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
// 通用化战斗策略
|
||||
foreach (var command in combatCommands)
|
||||
{
|
||||
if (command.ActivatingRound != null && command.ActivatingRound.Count > 0 && !command.ActivatingRound.Contains(round))
|
||||
{
|
||||
// 跳过强制首轮指令
|
||||
continue;
|
||||
}
|
||||
command.Execute(activeAvatar);
|
||||
}
|
||||
round++;
|
||||
}
|
||||
|
||||
Logger.LogInformation("→ {Name}停止宏", activeAvatar.Name);
|
||||
@@ -201,7 +194,7 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
|
||||
public Dictionary<string, List<CombatCommand>> LoadAvatarMacros()
|
||||
{
|
||||
var jsonPath = GetAvatarMacroJsonPath();
|
||||
var jsonPath = Global.Absolute("User/avatar_macro.json");
|
||||
var json = File.ReadAllText(jsonPath);
|
||||
_lastUpdateTime = File.GetLastWriteTime(jsonPath);
|
||||
var avatarMacros = JsonSerializer.Deserialize<List<AvatarMacro>>(json, ConfigService.JsonOptions);
|
||||
@@ -226,20 +219,10 @@ public class OneKeyFightTask : Singleton<OneKeyFightTask>
|
||||
public bool IsAvatarMacrosEdited()
|
||||
{
|
||||
// 通过修改时间判断是否编辑过
|
||||
var jsonPath = GetAvatarMacroJsonPath();
|
||||
var jsonPath = Global.Absolute("User/avatar_macro.json");
|
||||
var lastWriteTime = File.GetLastWriteTime(jsonPath);
|
||||
return lastWriteTime > _lastUpdateTime;
|
||||
}
|
||||
|
||||
public static string GetAvatarMacroJsonPath()
|
||||
{
|
||||
var path = Global.Absolute("User/avatar_macro.json");
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
File.Copy(Global.Absolute("User/avatar_macro_default.json"), path);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
public static bool IsEnabled()
|
||||
{
|
||||
|
||||
@@ -14,8 +14,6 @@ public class CombatCommand
|
||||
|
||||
public List<string>? Args { get; set; }
|
||||
|
||||
public List<int> ActivatingRound { get; set; }
|
||||
|
||||
public CombatCommand(string name, string command)
|
||||
{
|
||||
Name = name.Trim();
|
||||
@@ -64,16 +62,6 @@ public class CombatCommand
|
||||
throw new ArgumentException($"{Method.Alias[0]}方法的入参必须是VirtualKeyCodes枚举中的值,当前入参 {Args[0]} 不合法");
|
||||
}
|
||||
}
|
||||
else if (Method == Method.Scroll)
|
||||
{
|
||||
AssertUtils.IsTrue(Args.Count == 1, "scroll方法必须有一个入参,代表滚动格数。例:scroll(1) 或 scroll(-1)");
|
||||
AssertUtils.IsTrue(int.TryParse(Args[0], out _), "滚动格数必须是整数");
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return $"<CombatCommand {Name}, {Method}({Args}) (rounds {ActivatingRound})>";
|
||||
}
|
||||
|
||||
public void Execute(CombatScenes combatScenes, CombatCommand? lastCommand = null)
|
||||
@@ -107,9 +95,7 @@ public class CombatCommand
|
||||
&& Method != Method.MoveBy
|
||||
&& Method != Method.KeyDown
|
||||
&& Method != Method.KeyUp
|
||||
&& Method != Method.KeyPress
|
||||
&& Method != Method.Scroll
|
||||
&& Method != Method.Ready)
|
||||
&& Method != Method.KeyPress)
|
||||
{
|
||||
avatar.Switch();
|
||||
}
|
||||
@@ -199,14 +185,6 @@ public class CombatCommand
|
||||
var s = double.Parse(Args![0]);
|
||||
avatar.Wait((int)TimeSpan.FromSeconds(s).TotalMilliseconds);
|
||||
}
|
||||
else if (Method == Method.Ready)
|
||||
{
|
||||
avatar.Ready();
|
||||
}
|
||||
else if (Method == Method.Check)
|
||||
{
|
||||
// check动作在AutoFightTask主循环中处理,此处不做任何操作
|
||||
}
|
||||
else if (Method == Method.Aim)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -286,14 +264,6 @@ public class CombatCommand
|
||||
{
|
||||
avatar.KeyPress(Args![0]);
|
||||
}
|
||||
else if (Method == Method.Scroll)
|
||||
{
|
||||
avatar.Scroll(int.Parse(Args![0]));
|
||||
}
|
||||
else if (Method == Method.Round)
|
||||
{
|
||||
// 作为回合标记使用,不做任何操作
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
@@ -28,9 +28,7 @@ public class CombatScriptBag(List<CombatScript> combatScripts)
|
||||
}
|
||||
|
||||
if (matchCount != avatars.Count) continue;
|
||||
// Logger.LogInformation("匹配到战斗脚本:{Name},共{Cnt}条指令,涉及角色:{Str}",
|
||||
// combatScript.Name, combatScript.CombatCommands.Count, string.Join(",", combatScript.AvatarNames));
|
||||
Logger.LogInformation("匹配到战斗脚本:{Name}", combatScript.Name);
|
||||
Logger.LogInformation("匹配到战斗脚本:{Name}", combatScript.Name);
|
||||
return combatScript.CombatCommands;
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class CombatScriptParser
|
||||
}
|
||||
|
||||
var names = string.Join(",", combatAvatarNames);
|
||||
// Logger.LogDebug("战斗脚本解析完成,共{Cnt}条指令,涉及角色:{Str}", combatCommands.Count, names);
|
||||
Logger.LogDebug("战斗脚本解析完成,共{Cnt}条指令,涉及角色:{Str}", combatCommands.Count, names);
|
||||
|
||||
return new CombatScript(combatAvatarNames, combatCommands);
|
||||
}
|
||||
@@ -131,70 +131,7 @@ public class CombatScriptParser
|
||||
return oneLineCombatCommands;
|
||||
}
|
||||
|
||||
public static List<int> ParseRoundCommand(CombatCommand roundCommand) {
|
||||
// 解析round命令的入参,返回一个整数列表,代表在哪些回合执行后续指令
|
||||
// 支持Round(1)、Round(1,3,5)、Round(2-4)、Round(1,3-5)等格式
|
||||
var activatingRounds = new List<int>();
|
||||
if (roundCommand.Args == null || roundCommand.Args.Count == 0) {
|
||||
Logger.LogError("round方法必须有入参,代表在哪些回合执行后续指令,例:round(1)、round(1,3-5)");
|
||||
throw new ArgumentException("round方法必须有入参,代表在哪些回合执行后续指令,例:round(1)、round(1,3-5)");
|
||||
}
|
||||
foreach (var arg in roundCommand.Args) {
|
||||
if (arg.Contains('-')) {
|
||||
// 范围
|
||||
var parts = arg.Split('-', StringSplitOptions.TrimEntries);
|
||||
if (parts.Length != 2) {
|
||||
Logger.LogError("round方法的入参格式错误,例:round(1-3)");
|
||||
throw new ArgumentException("round方法的入参格式错误,例:round(1-3)");
|
||||
}
|
||||
var start = int.Parse(parts[0]);
|
||||
var end = int.Parse(parts[1]);
|
||||
if (start > end || start <= 0) {
|
||||
Logger.LogError("round方法的入参格式错误,起始回合必须小于等于结束回合且大于0,例:round(1-3)");
|
||||
throw new ArgumentException("round方法的入参格式错误,起始回合必须小于等于结束回合且大于0,例:round(1-3)");
|
||||
}
|
||||
for (int i = start; i <= end; i++) {
|
||||
activatingRounds.Add(i);
|
||||
}
|
||||
} else {
|
||||
// 单个回合
|
||||
var round = int.Parse(arg);
|
||||
if (round <= 0) {
|
||||
Logger.LogError("round方法的入参格式错误,回合数必须大于0,例:round(1)");
|
||||
throw new ArgumentException("round方法的入参格式错误,回合数必须大于0,例:round(1)");
|
||||
}
|
||||
activatingRounds.Add(round);
|
||||
}
|
||||
}
|
||||
return activatingRounds;
|
||||
}
|
||||
|
||||
public static List<CombatCommand> ParseLineCommands(string lineWithoutAvatar, string avatarName) {
|
||||
var parts = lineWithoutAvatar.Split("|", StringSplitOptions.RemoveEmptyEntries);
|
||||
var fullCombatCommands = new List<CombatCommand>();
|
||||
foreach (var part in parts)
|
||||
{
|
||||
var combatCommands = ParseLinePart(part, avatarName);
|
||||
if (combatCommands.Count > 0 && combatCommands[0].Method == Method.Round) {
|
||||
// 遇到round指令,作为回合分隔符使用,不加入最终指令列表
|
||||
var roundCommand = combatCommands[0];
|
||||
var activatingRounds = ParseRoundCommand(roundCommand);
|
||||
combatCommands.RemoveAt(0);
|
||||
foreach (var combatCommand in combatCommands) {
|
||||
|
||||
combatCommand.ActivatingRound = activatingRounds;
|
||||
}
|
||||
}
|
||||
fullCombatCommands.AddRange(combatCommands);
|
||||
}
|
||||
// foreach (var combatCommand in fullCombatCommands)
|
||||
// {
|
||||
// Logger.LogDebug("解析战斗脚本命令:{cmd}", combatCommand.ToString());
|
||||
// }
|
||||
return fullCombatCommands;
|
||||
}
|
||||
|
||||
public static List<CombatCommand> ParseLinePart(string lineWithoutAvatar, string avatarName)
|
||||
public static List<CombatCommand> ParseLineCommands(string lineWithoutAvatar, string avatarName)
|
||||
{
|
||||
var oneLineCombatCommands = new List<CombatCommand>();
|
||||
var commandArray = lineWithoutAvatar.Split(",", StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
@@ -12,8 +12,6 @@ public class Method
|
||||
public static readonly Method Attack = new(["attack", "普攻", "普通攻击"]);
|
||||
public static readonly Method Charge = new(["charge", "重击"]);
|
||||
public static readonly Method Wait = new(["wait", "after", "等待"]);
|
||||
public static readonly Method Ready = new(["ready", "完成"]);
|
||||
public static readonly Method Check = new(["check", "检测"]);
|
||||
|
||||
public static readonly Method Walk = new(["walk", "行走"]);
|
||||
public static readonly Method W = new(["w"]);
|
||||
@@ -33,8 +31,6 @@ public class Method
|
||||
public static readonly Method KeyDown = new(["keydown"]);
|
||||
public static readonly Method KeyUp = new(["keyup"]);
|
||||
public static readonly Method KeyPress = new(["keypress"]);
|
||||
public static readonly Method Scroll = new(["scroll", "verticalscroll"]);
|
||||
public static readonly Method Round = new(["round"]);
|
||||
|
||||
public static IEnumerable<Method> Values
|
||||
{
|
||||
@@ -45,8 +41,6 @@ public class Method
|
||||
yield return Attack;
|
||||
yield return Charge;
|
||||
yield return Wait;
|
||||
yield return Ready;
|
||||
yield return Check;
|
||||
|
||||
yield return Walk;
|
||||
yield return W;
|
||||
@@ -66,8 +60,6 @@ public class Method
|
||||
yield return KeyDown;
|
||||
yield return KeyUp;
|
||||
yield return KeyPress;
|
||||
yield return Scroll;
|
||||
yield return Round;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,8 +138,7 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
|
||||
{
|
||||
if (!SystemControl.IsGenshinImpactActiveByProcess())
|
||||
{
|
||||
var name = SystemControl.GetActiveByProcess();
|
||||
_logger.LogWarning($"当前获取焦点的窗口为: {name},不是原神,停止执行");
|
||||
_logger.LogInformation("当前获取焦点的窗口不是原神,停止执行");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -391,9 +390,6 @@ namespace BetterGenshinImpact.GameTask.AutoFishing
|
||||
clickWhiteConfirmButtonWaitEndTime < timeProvider.GetLocalNow()) &&
|
||||
Bv.ClickWhiteConfirmButton(imageRegion))
|
||||
{
|
||||
// 截取鱼饵图标区域(正方形,宽高均取 6.5% 的屏幕宽度)
|
||||
// 最后一个参数有意用 Width 而非 Height,目的是保持正方形裁剪
|
||||
// 经验算在 16:9 常见分辨率(720p/1080p/1440p)下 Y+H 不会超出图像高度,暂不加钳位
|
||||
using Mat subMat = imageRegion.SrcMat.SubMat(new Rect((int)(0.824 * imageRegion.Width), (int)(0.669 * imageRegion.Height), (int)(0.065 * imageRegion.Width), (int)(0.065 * imageRegion.Width)));
|
||||
using Mat resized = subMat.Resize(new Size(125, 125));
|
||||
(string predName, _) = GridIconsAccuracyTestTask.Infer(resized, this.session, this.prototypes);
|
||||
|
||||