Skip to content

refactor: 拆分逻辑到不同程序集并优化加载顺序 (v1.8.0)#5

Merged
BAKAOLC merged 2 commits into
mainfrom
refactor/mod-loader-wrapper
Nov 16, 2025
Merged

refactor: 拆分逻辑到不同程序集并优化加载顺序 (v1.8.0)#5
BAKAOLC merged 2 commits into
mainfrom
refactor/mod-loader-wrapper

Conversation

@BAKAOLC

@BAKAOLC BAKAOLC commented Nov 16, 2025

Copy link
Copy Markdown
Collaborator
  • 拆分了部分逻辑到不同程序集,以便于之后的 SDK 开发
  • 调整了加载逻辑,增加了额外的 Mod 加载包装器,以减少因为 Harmony 加载顺序导致的问题
  • 现在在工作正常的情况下,应当不再需要考虑本 mod 是否在 Harmony 前被加载了

- 拆分了部分逻辑到不同程序集,以便于之后的 SDK 开发

- 调整了加载逻辑,增加了额外的 Mod 加载包装器,以减少因为 Harmony 加载顺序导致的问题

- 现在在工作正常的情况下,应当不再需要考虑本 mod 是否在 Harmony 前被加载了
Copilot AI review requested due to automatic review settings November 16, 2025 05:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors the mod architecture by splitting logic into three separate assemblies (Core, ModLoader, and GameModules) to facilitate future SDK development and resolve Harmony loading order issues. The version is updated to 1.8.0.

Key Changes

  • Introduced a new DuckovCustomModel.ModLoader assembly that wraps mod initialization and handles Harmony loading order dependency
  • Extracted shared data types and utilities into a new DuckovCustomModel.Core assembly
  • Refactored ModBehaviour from an instance-based MonoBehaviour to a static ModEntry class with explicit Initialize/Uninitialize methods

Reviewed Changes

Copilot reviewed 50 out of 70 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
DuckovCustomModel.ModLoader/* New ModLoader assembly that handles Harmony loading order and delegates to the main game modules
DuckovCustomModel.Core/* New Core assembly containing shared data types, utilities, and JSON settings
DuckovCustomModel/ModEntry.cs Refactored from ModBehaviour to static class with Initialize/Uninitialize pattern
DuckovCustomModel/ModLogger.cs Changed visibility from public to internal
DuckovCustomModel/Utils/CharacterModelSocketUtils.cs Dictionary key-value order swapped from <FieldInfo, string> to <string, FieldInfo> for better semantics
DuckovCustomModel/Configs/*.cs Updated to use JsonSettings.Default from Core assembly
DuckovCustomModel/UI/*.cs Updated references from ModBehaviour.Instance to static ModEntry properties
DuckovCustomModel/MonoBehaviours/*.cs Updated namespace imports and ModEntry references
DuckovCustomModel/HarmonyPatches/*.cs Updated namespace imports from DuckovCustomModel.Data to DuckovCustomModel.Core.Data
DuckovCustomModel/Managers/*.cs Updated namespace imports and ModEntry references
DuckovCustomModel.Core/Data/*.cs Moved data classes from main assembly, updated namespaces, made AICharacters static
DuckovCustomModel/DuckovCustomModel.csproj Added Core project reference, build targets for ModLoader, updated assembly name
DuckovCustomModel.sln Added Core and ModLoader projects to solution
DuckovCustomModel/Constant.cs Version bumped to 1.8.0
CHANGELOG*.md Added v1.8.0 release notes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread DuckovCustomModel.ModLoader/HarmonyLoader.cs Outdated
Comment thread DuckovCustomModel.ModLoader/ModBehaviour.cs
Comment thread DuckovCustomModel.ModLoader/ModBehaviour.cs
Comment thread DuckovCustomModel.ModLoader/HarmonyLoader.cs
Comment thread DuckovCustomModel.ModLoader/HarmonyLoader.cs
Comment thread DuckovCustomModel.ModLoader/HarmonyLoader.cs
Comment thread DuckovCustomModel.ModLoader/ModLoader.cs
Comment thread DuckovCustomModel.ModLoader/ModLoader.cs
Comment thread DuckovCustomModel.ModLoader/ModLoader.cs
- 更新 dependabot.yml 添加 GitHub token 配置

- 优化 HarmonyLoader 的卸载逻辑注释

- 添加 ModBehaviour 重复实例检测
@BAKAOLC BAKAOLC merged commit be4c442 into main Nov 16, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants