refactor: 拆分逻辑到不同程序集并优化加载顺序 (v1.8.0)#5
Merged
Conversation
BAKAOLC
commented
Nov 16, 2025
Collaborator
- 拆分了部分逻辑到不同程序集,以便于之后的 SDK 开发
- 调整了加载逻辑,增加了额外的 Mod 加载包装器,以减少因为 Harmony 加载顺序导致的问题
- 现在在工作正常的情况下,应当不再需要考虑本 mod 是否在 Harmony 前被加载了
- 拆分了部分逻辑到不同程序集,以便于之后的 SDK 开发 - 调整了加载逻辑,增加了额外的 Mod 加载包装器,以减少因为 Harmony 加载顺序导致的问题 - 现在在工作正常的情况下,应当不再需要考虑本 mod 是否在 Harmony 前被加载了
There was a problem hiding this comment.
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.ModLoaderassembly that wraps mod initialization and handles Harmony loading order dependency - Extracted shared data types and utilities into a new
DuckovCustomModel.Coreassembly - Refactored
ModBehaviourfrom an instance-based MonoBehaviour to a staticModEntryclass with explicitInitialize/Uninitializemethods
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.
- 更新 dependabot.yml 添加 GitHub token 配置 - 优化 HarmonyLoader 的卸载逻辑注释 - 添加 ModBehaviour 重复实例检测
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.