feat: 场景

This commit is contained in:
m0_75251201
2025-11-04 17:05:34 +08:00
parent 0206a83f56
commit 5d69efbc3f
84 changed files with 1406 additions and 21 deletions

46
.github/copilot-instructions.md vendored Normal file
View File

@@ -0,0 +1,46 @@
## DuckovMods — agent 快速上手说明
目标:为 AI 编码代理提供立即可用的、本仓库可执行的上下文和约定,便于快速完成修改、补丁与功能实现。
- 仓库概览
- 顶层为多个独立 mod 项目文件夹(例如 `HideCharacter/`, `HitFeedback/`, `SceneSnapshot/`, `Theme/`, `UIFrame/`)。每个模块通常包含一个 `*.csproj``ModBehaviour.cs` 与若干源文件。
- 解决方案文件:`DuckovMods.sln`。README 位于根目录,简短说明了仓库目的。
- 关键约定(必须遵循)
- 每个 mod 通过类 `ModBehaviour` 实现,且继承自 `Duckov.Modding.ModBehaviour`(示例:`Theme/ModBehaviour.cs`)。常用生命周期钩子:`OnAfterSetup()``OnBeforeDeactivate()`
- 模块间互操作通常通过反射和“安全 API 包装器”完成(示例:`HideCharacter/Api/ModConfigApi.cs`)。这些包装器:
- 在运行时用 `AppDomain.CurrentDomain.GetAssemblies()` 扫描目标程序集并反射所需类型/方法;
- 做好异常捕获并返回布尔成功标志或默认值;
- 约定配置键名为 `${modName}_${key}`(见 `SafeLoad`/`SafeSave` 用法)。
- 配置与版本兼容:一些 API 会检查目标 mod 的静态 `VERSION` 字段(例中 `ModConfig.ModBehaviour.VERSION`)。在交互前请优先调用包装器的 `Initialize()`
- 日志使用 UnityEngine 的 `Debug.Log` / `Debug.LogWarning` / `Debug.LogError`
- 构建 / 调试工作流
- 这是一个 .NET 多项目解决方案。常规命令PowerShell
- 构建(调试):`dotnet build d:\vs_project\DuckovMods\DuckovMods.sln`
- 构建(发布):`dotnet build d:\vs_project\DuckovMods\DuckovMods.sln -c Release`
- 注意:部分项目输出见 `bin/Debug/netstandard2.1/``bin/Release/net9.0/`,在修改目标框架或依赖时,请检查对应 `*.csproj``<TargetFramework>`
- 仓库内未发现独立的单元测试项目 —— 若需要添加测试,请在顶层新建 `tests/` 并使用常见测试框架xUnit/NUnit
- 常见开发任务与示例
- 添加新 mod在仓库根添加新文件夹并创建 `YourMod.csproj``ModBehaviour.cs`(继承 `Duckov.Modding.ModBehaviour`),在解决方案中加入 csproj。
- 与 ModConfig 交互:参考 `HideCharacter/Api/ModConfigApi.cs` 的模式,优先编写“安全静态封装”以免反射调用抛出未捕获异常。
- 读取/保存配置:使用 `SafeLoad<T>(modName, key, default)``SafeSave<T>(modName, key, value)`,键名需按 `${modName}_${key}` 规则。
- 代码风格与约定(可自动化检查)
- 命名:模块文件夹以 PascalCase类名以 PascalCase。
- 公共跨 mod API 放在各模块的 `Api/` 子目录(例如 `HideCharacter/Api/`),以降低命名冲突。
- 反射查找尽量包含日志输出以便定位加载顺序问题(本仓库中已有此类日志用法)。
- 易出错点agent 在修改时应特别留意)
- 直接调用其他 mod 的内部类型/方法会因加载顺序或版本不兼容而失败——请优先使用或添加“安全包装器”。
- 修改 TargetFramework 可能导致与 Unity 或已有二进制不兼容。先在本地构建并检查 `bin/` 输出。
- 不要假设存在单元测试;对行为敏感修改请手动验证或添加小型验证脚本。
- 推荐起始文件(优先阅读)
- `Theme/ModBehaviour.cs`mod 生命周期示例)
- `HideCharacter/Api/ModConfigApi.cs`(反射 + 安全包装器范例)
- `UIFrame/UIFrameAPI.cs`(公共 API 占位)
- `DuckovMods.sln` 与根 `README.md`
如果上面有遗漏或需要更详细的“如何运行/调试某个 mod”步骤请指出具体目标例如“在 Unity 中热重载某 mod”或“为 HideCharacter 添加新的 ModConfig 项”),我会把说明扩展成更精确的操作步骤。

View File

@@ -11,6 +11,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HitFeedback", "HitFeedback\
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIFrame", "UIFrame\UIFrame.csproj", "{78BAF98F-64B2-41EB-BA04-2381E1D37AC8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UIFrame", "UIFrame\UIFrame.csproj", "{78BAF98F-64B2-41EB-BA04-2381E1D37AC8}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Theme", "Theme\Theme.csproj", "{7CCF2612-AF15-42F0-B472-8C8F8CAB9B20}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@@ -33,6 +35,10 @@ Global
{78BAF98F-64B2-41EB-BA04-2381E1D37AC8}.Debug|Any CPU.Build.0 = Debug|Any CPU {78BAF98F-64B2-41EB-BA04-2381E1D37AC8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{78BAF98F-64B2-41EB-BA04-2381E1D37AC8}.Release|Any CPU.ActiveCfg = Release|Any CPU {78BAF98F-64B2-41EB-BA04-2381E1D37AC8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{78BAF98F-64B2-41EB-BA04-2381E1D37AC8}.Release|Any CPU.Build.0 = Release|Any CPU {78BAF98F-64B2-41EB-BA04-2381E1D37AC8}.Release|Any CPU.Build.0 = Release|Any CPU
{7CCF2612-AF15-42F0-B472-8C8F8CAB9B20}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7CCF2612-AF15-42F0-B472-8C8F8CAB9B20}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CCF2612-AF15-42F0-B472-8C8F8CAB9B20}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CCF2612-AF15-42F0-B472-8C8F8CAB9B20}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@@ -1,5 +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"> <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/AddReferences/RecentPaths/=D_003A_005Csteam_005Csteamapps_005Ccommon_005CEscape_0020from_0020Duckov_005CDuckov_005FData_005CManaged_005CFMODUnity_002Edll/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/AddReferences/RecentPaths/=D_003A_005Csteam_005Csteamapps_005Ccommon_005CEscape_0020from_0020Duckov_005CDuckov_005FData_005CManaged_005CFMODUnity_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=D_003A_005Csteam_005Csteamapps_005Cworkshop_005Ccontent_005C3167020_005C3589088839_005CHarmonyLoadMod_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=D_003A_005Csteam_005Csteamapps_005Cworkshop_005Ccontent_005C3167020_005C3591672666_005Cqingye_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/AddReferences/RecentPaths/=D_003A_005Csteam_005Csteamapps_005Cworkshop_005Ccontent_005C3167020_005C3596659565_005CCustomQuack_002Edll/@EntryIndexedValue">True</s:Boolean> <s:Boolean x:Key="/Default/AddReferences/RecentPaths/=D_003A_005Csteam_005Csteamapps_005Cworkshop_005Ccontent_005C3167020_005C3596659565_005CCustomQuack_002Edll/@EntryIndexedValue">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAimTargetFinder_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F492b6cef9eac4cd497c1ffcbfcb9161f197200_003Fa9_003F4ac92f25_003FAimTargetFinder_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAimTargetFinder_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F492b6cef9eac4cd497c1ffcbfcb9161f197200_003Fa9_003F4ac92f25_003FAimTargetFinder_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAudioManager_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003F95_003F5092a809_003FAudioManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAudioManager_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003F95_003F5092a809_003FAudioManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
@@ -25,14 +27,18 @@
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMainCharacterStatValueDisplay_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003F08_003Fd04928fd_003FMainCharacterStatValueDisplay_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMainCharacterStatValueDisplay_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003F08_003Fd04928fd_003FMainCharacterStatValueDisplay_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModBehaviour_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F15eaac0daac842bca117926c0c9be2781a00_003F37_003Fa09d99b2_003FModBehaviour_002Ecs_002Fz_003A4_002D3/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModBehaviour_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F15eaac0daac842bca117926c0c9be2781a00_003F37_003Fa09d99b2_003FModBehaviour_002Ecs_002Fz_003A4_002D3/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModBehaviour_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003Ff3_003Ff5f2b19a_003FModBehaviour_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModBehaviour_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003Ff3_003Ff5f2b19a_003FModBehaviour_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModBehaviour_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Faf3c3aa7ce14487c914dade28d96504e70a00_003F26_003Fe998e749_003FModBehaviour_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModBehaviour_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fe495fb8cdd21493497febf8ce397a8d71400_003F4a_003F0c719bc6_003FModBehaviour_002Ecs_002Fz_003A2_002D1/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModInfo_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003F3c_003F9c6fe4cd_003FModInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModInfo_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003F3c_003F9c6fe4cd_003FModInfo_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModManager_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003Fe5_003Ff729e34a_003FModManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AModManager_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003Fe5_003Ff729e34a_003FModManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMonoBehaviour_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc39a522eee05469b8171a6cfeb646c591543b0_003F02_003F65608a5e_003FMonoBehaviour_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AMonoBehaviour_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fc39a522eee05469b8171a6cfeb646c591543b0_003F02_003F65608a5e_003FMonoBehaviour_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AOcclusionFadeChecker_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F492b6cef9eac4cd497c1ffcbfcb9161f197200_003F05_003F7aa60d94_003FOcclusionFadeChecker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AOcclusionFadeChecker_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F492b6cef9eac4cd497c1ffcbfcb9161f197200_003F05_003F7aa60d94_003FOcclusionFadeChecker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AOcclusionFadeChecker_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003Fa8_003Fd12e1cf7_003FOcclusionFadeChecker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AOcclusionFadeChecker_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003Fa8_003Fd12e1cf7_003FOcclusionFadeChecker_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AOcclusionFadeManager_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F492b6cef9eac4cd497c1ffcbfcb9161f197200_003F70_003F6aba3c97_003FOcclusionFadeManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AOcclusionFadeManager_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F492b6cef9eac4cd497c1ffcbfcb9161f197200_003F70_003F6aba3c97_003FOcclusionFadeManager_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AOptionsPanel_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fae7b55f2e79e4a30b19151f53aa9af29197600_003Fe1_003Fac8e1feb_003FOptionsPanel_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AVolumeComponent_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb02e352b027d497b8571da05e536c2f682000_003F36_003F74cee2c4_003FVolumeComponent_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AVolumeComponent_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb02e352b027d497b8571da05e536c2f682000_003F36_003F74cee2c4_003FVolumeComponent_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AVolume_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb02e352b027d497b8571da05e536c2f682000_003Ffa_003F02e0206c_003FVolume_002Ecs/@EntryIndexedValue">ForceIncluded</s:String> <s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AVolume_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Fb02e352b027d497b8571da05e536c2f682000_003Ffa_003F02e0206c_003FVolume_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003A_005F003CModule_005F003E_002Ecs_002Fl_003AC_0021_003FUsers_003FLenovo_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Faf3c3aa7ce14487c914dade28d96504e70a00_003F9c_003Ff3cdecda_003F_005F003CModule_005F003E_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
<s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer&gt;&#xD; <s:String x:Key="/Default/Environment/AssemblyExplorer/XmlDocument/@EntryValue">&lt;AssemblyExplorer&gt;&#xD;
&lt;Assembly Path="D:\steam\steamapps\common\Escape from Duckov\Duckov_Data\Managed\ItemStatsSystem.dll" /&gt;&#xD; &lt;Assembly Path="D:\steam\steamapps\common\Escape from Duckov\Duckov_Data\Managed\ItemStatsSystem.dll" /&gt;&#xD;
&lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary> &lt;/AssemblyExplorer&gt;</s:String></wpf:ResourceDictionary>

View File

@@ -0,0 +1,488 @@
using System;
using System.Linq;
using System.Reflection;
using UnityEngine;
//替换为你的mod命名空间, 防止多个同名ModConfigAPI冲突
namespace HideCharacter.Api {
/// <summary>
/// ModConfig 安全接口封装类 - 提供不抛异常的静态接口
/// ModConfig Safe API Wrapper Class - Provides non-throwing static interfaces
/// </summary>
public static class ModConfigAPI
{
public static string ModConfigName = "ModConfig";
//Ensure this match the number of ModConfig.ModBehaviour.VERSION
//这里确保版本号与ModConfig.ModBehaviour.VERSION匹配
private const int ModConfigVersion = 1;
private static string TAG = $"ModConfig_v{ModConfigVersion}";
private static Type modBehaviourType;
private static Type optionsManagerType;
public static bool isInitialized = false;
private static bool versionChecked = false;
private static bool isVersionCompatible = false;
/// <summary>
/// 检查版本兼容性
/// Check version compatibility
/// </summary>
private static bool CheckVersionCompatibility()
{
if (versionChecked)
return isVersionCompatible;
try
{
// 尝试获取 ModConfig 的版本号
// Try to get ModConfig version number
FieldInfo versionField = modBehaviourType.GetField("VERSION", BindingFlags.Public | BindingFlags.Static);
if (versionField != null && versionField.FieldType == typeof(int))
{
int modConfigVersion = (int)versionField.GetValue(null);
isVersionCompatible = (modConfigVersion == ModConfigVersion);
if (!isVersionCompatible)
{
Debug.LogError($"[{TAG}] 版本不匹配API版本: {ModConfigVersion}, ModConfig版本: {modConfigVersion}");
return false;
}
Debug.Log($"[{TAG}] 版本检查通过: {ModConfigVersion}");
versionChecked = true;
return true;
}
else
{
// 如果找不到版本字段,发出警告但继续运行(向后兼容)
// If version field not found, warn but continue (backward compatibility)
Debug.LogWarning($"[{TAG}] 未找到版本信息字段,跳过版本检查");
isVersionCompatible = true;
versionChecked = true;
return true;
}
}
catch (Exception ex)
{
Debug.LogError($"[{TAG}] 版本检查失败: {ex.Message}");
isVersionCompatible = false;
versionChecked = true;
return false;
}
}
/// <summary>
/// 初始化 ModConfigAPI检查必要的函数是否存在
/// Initialize ModConfigAPI, check if necessary functions exist
/// </summary>
public static bool Initialize()
{
try
{
if (isInitialized)
return true;
// 获取 ModBehaviour 类型
// Get ModBehaviour type
modBehaviourType = FindTypeInAssemblies("ModConfig.ModBehaviour");
if (modBehaviourType == null)
{
Debug.LogWarning($"[{TAG}] ModConfig.ModBehaviour 类型未找到ModConfig 可能未加载");
return false;
}
// 获取 OptionsManager_Mod 类型
// Get OptionsManager_Mod type
optionsManagerType = FindTypeInAssemblies("ModConfig.OptionsManager_Mod");
if (optionsManagerType == null)
{
Debug.LogWarning($"[{TAG}] ModConfig.OptionsManager_Mod 类型未找到");
return false;
}
// 检查版本兼容性
// Check version compatibility
if (!CheckVersionCompatibility())
{
Debug.LogWarning($"[{TAG}] ModConfig version mismatch!!!");
return false;
}
// 检查必要的静态方法是否存在
// Check if necessary static methods exist
string[] requiredMethods = {
"AddDropdownList",
"AddInputWithSlider",
"AddBoolDropdownList",
"AddOnOptionsChangedDelegate",
"RemoveOnOptionsChangedDelegate",
};
foreach (string methodName in requiredMethods)
{
MethodInfo method = modBehaviourType.GetMethod(methodName, BindingFlags.Public | BindingFlags.Static);
if (method == null)
{
Debug.LogError($"[{TAG}] 必要方法 {methodName} 未找到");
return false;
}
}
isInitialized = true;
Debug.Log($"[{TAG}] ModConfigAPI 初始化成功");
return true;
}
catch (Exception ex)
{
Debug.LogError($"[{TAG}] 初始化失败: {ex.Message}");
return false;
}
}
/// <summary>
/// 在所有已加载的程序集中查找类型
/// </summary>
private static Type FindTypeInAssemblies(string typeName)
{
try
{
// 获取当前域中的所有程序集
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
try
{
// 检查程序集名称是否包含 ModConfig
if (assembly.FullName.Contains("ModConfig"))
{
Debug.Log($"[{TAG}] 找到 ModConfig 相关程序集: {assembly.FullName}");
}
// 尝试在该程序集中查找类型
Type type = assembly.GetType(typeName);
if (type != null)
{
Debug.Log($"[{TAG}] 在程序集 {assembly.FullName} 中找到类型 {typeName}");
return type;
}
}
catch (Exception ex)
{
// 忽略单个程序集的查找错误
continue;
}
}
// 记录所有已加载的程序集用于调试
Debug.LogWarning($"[{TAG}] 在所有程序集中未找到类型 {typeName},已加载程序集数量: {assemblies.Length}");
foreach (var assembly in assemblies.Where(a => a.FullName.Contains("ModConfig")))
{
Debug.Log($"[{TAG}] ModConfig 相关程序集: {assembly.FullName}");
}
return null;
}
catch (Exception ex)
{
Debug.LogError($"[{TAG}] 程序集扫描失败: {ex.Message}");
return null;
}
}
/// <summary>
/// 安全地添加选项变更事件委托
/// Safely add options changed event delegate
/// </summary>
/// <param name="action">事件处理委托,参数为变更的选项键名</param>
/// <returns>是否成功添加</returns>
public static bool SafeAddOnOptionsChangedDelegate(Action<string> action)
{
if (!Initialize())
return false;
if (action == null)
{
Debug.LogWarning($"[{TAG}] 不能添加空的事件委托");
return false;
}
try
{
MethodInfo method = modBehaviourType.GetMethod("AddOnOptionsChangedDelegate", BindingFlags.Public | BindingFlags.Static);
method.Invoke(null, new object[] { action });
Debug.Log($"[{TAG}] 成功添加选项变更事件委托");
return true;
}
catch (Exception ex)
{
Debug.LogError($"[{TAG}] 添加选项变更事件委托失败: {ex.Message}");
return false;
}
}
/// <summary>
/// 安全地移除选项变更事件委托
/// Safely remove options changed event delegate
/// </summary>
/// <param name="action">要移除的事件处理委托</param>
/// <returns>是否成功移除</returns>
public static bool SafeRemoveOnOptionsChangedDelegate(Action<string> action)
{
if (!Initialize())
return false;
if (action == null)
{
Debug.LogWarning($"[{TAG}] 不能移除空的事件委托");
return false;
}
try
{
MethodInfo method = modBehaviourType.GetMethod("RemoveOnOptionsChangedDelegate", BindingFlags.Public | BindingFlags.Static);
method.Invoke(null, new object[] { action });
Debug.Log($"[{TAG}] 成功移除选项变更事件委托");
return true;
}
catch (Exception ex)
{
Debug.LogError($"[{TAG}] 移除选项变更事件委托失败: {ex.Message}");
return false;
}
}
/// <summary>
/// 安全地添加下拉列表配置项
/// Safely add dropdown list configuration item
/// </summary>
public static bool SafeAddDropdownList(string modName, string key, string description, System.Collections.Generic.SortedDictionary<string, object> options, Type valueType, object defaultValue)
{
key = $"{modName}_{key}";
if (!Initialize())
return false;
try
{
MethodInfo method = modBehaviourType.GetMethod("AddDropdownList", BindingFlags.Public | BindingFlags.Static);
method.Invoke(null, new object[] { modName, key, description, options, valueType, defaultValue });
Debug.Log($"[{TAG}] 成功添加下拉列表: {modName}.{key}");
return true;
}
catch (Exception ex)
{
Debug.LogError($"[{TAG}] 添加下拉列表失败 {modName}.{key}: {ex.Message}");
return false;
}
}
/// <summary>
/// 安全地添加带滑条的输入框配置项
/// Safely add input box with slider configuration item
/// </summary>
public static bool SafeAddInputWithSlider(string modName, string key, string description, Type valueType, object defaultValue, UnityEngine.Vector2? sliderRange = null)
{
key = $"{modName}_{key}";
if (!Initialize())
return false;
try
{
MethodInfo method = modBehaviourType.GetMethod("AddInputWithSlider", BindingFlags.Public | BindingFlags.Static);
// 处理可空参数
// Handle nullable parameters
object[] parameters = sliderRange.HasValue ?
new object[] { modName, key, description, valueType, defaultValue, sliderRange.Value } :
new object[] { modName, key, description, valueType, defaultValue, null };
method.Invoke(null, parameters);
Debug.Log($"[{TAG}] 成功添加滑条输入框: {modName}.{key}");
return true;
}
catch (Exception ex)
{
Debug.LogError($"[{TAG}] 添加滑条输入框失败 {modName}.{key}: {ex.Message}");
return false;
}
}
/// <summary>
/// 安全地添加布尔下拉列表配置项
/// Safely add boolean dropdown list configuration item
/// </summary>
public static bool SafeAddBoolDropdownList(string modName, string key, string description, bool defaultValue)
{
key = $"{modName}_{key}";
if (!Initialize())
return false;
try
{
MethodInfo method = modBehaviourType.GetMethod("AddBoolDropdownList", BindingFlags.Public | BindingFlags.Static);
method.Invoke(null, new object[] { modName, key, description, defaultValue });
Debug.Log($"[{TAG}] 成功添加布尔下拉列表: {modName}.{key}");
return true;
}
catch (Exception ex)
{
Debug.LogError($"[{TAG}] 添加布尔下拉列表失败 {modName}.{key}: {ex.Message}");
return false;
}
}
/// <summary>
/// 安全地加载配置值
/// Safely load configuration value
/// </summary>
/// <typeparam name="T">值的类型</typeparam>
/// <param name="key">配置键</param>
/// <param name="defaultValue">默认值</param>
/// <returns>加载的值或默认值</returns>
public static T SafeLoad<T>(string mod_name, string key, T defaultValue = default(T))
{
key = $"{mod_name}_{key}";
if (!Initialize())
return defaultValue;
if (string.IsNullOrEmpty(key))
{
Debug.LogWarning($"[{TAG}] 配置键不能为空");
return defaultValue;
}
try
{
MethodInfo loadMethod = optionsManagerType.GetMethod("Load", BindingFlags.Public | BindingFlags.Static);
if (loadMethod == null)
{
Debug.LogError($"[{TAG}] 未找到 OptionsManager_Mod.Load 方法");
return defaultValue;
}
// 获取泛型方法
MethodInfo genericLoadMethod = loadMethod.MakeGenericMethod(typeof(T));
object result = genericLoadMethod.Invoke(null, new object[] { key, defaultValue });
Debug.Log($"[{TAG}] 成功加载配置: {key} = {result}");
return (T)result;
}
catch (Exception ex)
{
Debug.LogError($"[{TAG}] 加载配置失败 {key}: {ex.Message}");
return defaultValue;
}
}
/// <summary>
/// 安全地保存配置值
/// Safely save configuration value
/// </summary>
/// <typeparam name="T">值的类型</typeparam>
/// <param name="key">配置键</param>
/// <param name="value">要保存的值</param>
/// <returns>是否保存成功</returns>
public static bool SafeSave<T>(string mod_name, string key, T value)
{
key = $"{mod_name}_{key}";
if (!Initialize())
return false;
if (string.IsNullOrEmpty(key))
{
Debug.LogWarning($"[{TAG}] 配置键不能为空");
return false;
}
try
{
MethodInfo saveMethod = optionsManagerType.GetMethod("Save", BindingFlags.Public | BindingFlags.Static);
if (saveMethod == null)
{
Debug.LogError($"[{TAG}] 未找到 OptionsManager_Mod.Save 方法");
return false;
}
// 获取泛型方法
MethodInfo genericSaveMethod = saveMethod.MakeGenericMethod(typeof(T));
genericSaveMethod.Invoke(null, new object[] { key, value });
Debug.Log($"[{TAG}] 成功保存配置: {key} = {value}");
return true;
}
catch (Exception ex)
{
Debug.LogError($"[{TAG}] 保存配置失败 {key}: {ex.Message}");
return false;
}
}
/// <summary>
/// 检查 ModConfig 是否可用
/// Check if ModConfig is available
/// </summary>
public static bool IsAvailable()
{
return Initialize();
}
/// <summary>
/// 获取 ModConfig 版本信息(如果存在)
/// Get ModConfig version information (if exists)
/// </summary>
public static string GetVersionInfo()
{
if (!Initialize())
return "ModConfig 未加载 | ModConfig not loaded";
try
{
// 尝试获取版本信息(如果 ModBehaviour 有相关字段或属性)
// Try to get version information (if ModBehaviour has related fields or properties)
FieldInfo versionField = modBehaviourType.GetField("VERSION", BindingFlags.Public | BindingFlags.Static);
if (versionField != null && versionField.FieldType == typeof(int))
{
int modConfigVersion = (int)versionField.GetValue(null);
string compatibility = (modConfigVersion == ModConfigVersion) ? "兼容" : "不兼容";
return $"ModConfig v{modConfigVersion} (API v{ModConfigVersion}, {compatibility})";
}
PropertyInfo versionProperty = modBehaviourType.GetProperty("VERSION", BindingFlags.Public | BindingFlags.Static);
if (versionProperty != null)
{
object versionValue = versionProperty.GetValue(null);
return versionValue?.ToString() ?? "未知版本 | Unknown version";
}
return "ModConfig 已加载(版本信息不可用) | ModConfig loaded (version info unavailable)";
}
catch
{
return "ModConfig 已加载(版本检查失败) | ModConfig loaded (version check failed)";
}
}
/// <summary>
/// 检查版本兼容性
/// Check version compatibility
/// </summary>
public static bool IsVersionCompatible()
{
if (!Initialize())
return false;
return isVersionCompatible;
}
}
}

View File

@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("折纸的小箱子")] [assembly: System.Reflection.AssemblyCompanyAttribute("折纸的小箱子")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.1")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.1")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.1+2af09007f967b42ac04776167f814297d14582e3")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.1+0206a83f56b5a794fe2f173b4a047cc4f0d4cd90")]
[assembly: System.Reflection.AssemblyProductAttribute("HideCharacter")] [assembly: System.Reflection.AssemblyProductAttribute("HideCharacter")]
[assembly: System.Reflection.AssemblyTitleAttribute("HideCharacter")] [assembly: System.Reflection.AssemblyTitleAttribute("HideCharacter")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.1")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.1")]

View File

@@ -1 +1 @@
7182d425771de7b27f8f319b51a9341c4aa1ff6099af2487fa0a697a586e5ebb 87960f6ca296aa48c51c30197c7d764ab1cc8c1b2d2ae919555af9f2602b2fa1

View File

@@ -1,6 +1,6 @@
is_global = true is_global = true
build_property.RootNamespace = HideCharacter build_property.RootNamespace = HideCharacter
build_property.ProjectDir = d:\vs_project\DuckovMods\HideCharacter\ build_property.ProjectDir = D:\vs_project\DuckovMods\HideCharacter\
build_property.EnableComHosting = build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop = build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.CsWinRTUseWindowsUIXamlProjections = false build_property.CsWinRTUseWindowsUIXamlProjections = false

View File

@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("折纸的小箱子")] [assembly: System.Reflection.AssemblyCompanyAttribute("折纸的小箱子")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.1")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.1")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.1+2b7943339c8fff4147e07028e81b3fff19ff0d80")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.1+0206a83f56b5a794fe2f173b4a047cc4f0d4cd90")]
[assembly: System.Reflection.AssemblyProductAttribute("HideCharacter")] [assembly: System.Reflection.AssemblyProductAttribute("HideCharacter")]
[assembly: System.Reflection.AssemblyTitleAttribute("HideCharacter")] [assembly: System.Reflection.AssemblyTitleAttribute("HideCharacter")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.1")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.1")]

View File

@@ -1 +1 @@
881e0b84476729ea6e67f155d7d840fd64b730af85f17eb2df102486efe4db4b 0c41c29df034d7303af5a922ba9d31f37af5b0419be39221c78f9e624f5d890a

View File

@@ -1,9 +1,129 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using UnityEngine; // 假设在Unity环境中使用Debug.LogError
namespace HitFeedback namespace HitFeedback
{ {
public class Config public class Config
{ {
public KeyCode hotKey = KeyCode.F8;
public Dictionary<string, float> probability = new Dictionary<string, float>(); public Dictionary<string, float> probability = new Dictionary<string, float>();
public void LoadConfig(string filename)
{
if (!File.Exists(filename))
{
Debug.LogError($"Config file not found: {filename}");
return; // 如果文件不存在,就没必要继续了
}
// 清空旧的概率数据,确保每次加载都是从新开始
probability.Clear();
try
{
using (var sr = new StreamReader(filename))
{
string line;
var lineNumber = 0; // 用于错误报告
while ((line = sr.ReadLine()) != null)
{
lineNumber++;
line = line.Trim(); // 移除行首尾的空白字符
// 忽略空行和注释行
if (string.IsNullOrEmpty(line) || line.StartsWith(";") || line.StartsWith("#"))
{
continue;
}
// 查找等号
var separatorIndex = line.IndexOf('=');
if (separatorIndex == -1)
{
Debug.LogWarning($"Skipping malformed line in config file '{filename}' at line {lineNumber}: No '=' found. Line: '{line}'");
continue;
}
var key = line.Substring(0, separatorIndex).Trim();
var valueStr = line.Substring(separatorIndex + 1).Trim();
// 解析 hotKey
if (key.Equals("hotKey", System.StringComparison.OrdinalIgnoreCase))
{
try
{
hotKey = (KeyCode)System.Enum.Parse(typeof(KeyCode), valueStr, true);
}
catch (System.ArgumentException)
{
Debug.LogError($"Invalid KeyCode '{valueStr}' in config file '{filename}' at line {lineNumber}. Using default F8.");
hotKey = KeyCode.F8; // 设置为默认值或保持不变
}
}
// 解析 probability 字典项
else
{
if (float.TryParse(valueStr, out var probValue))
{
probability[key] = probValue;
}
else
{
Debug.LogWarning($"Invalid float value '{valueStr}' for key '{key}' in config file '{filename}' at line {lineNumber}. Skipping entry.");
}
}
}
}
}
catch (System.Exception ex)
{
Debug.LogError($"Error reading config file '{filename}': {ex.Message}");
}
}
/// <summary>
/// 将当前配置存储到指定INI文件。
/// </summary>
/// <param name="filename">要保存的INI文件的路径。</param>
public void SaveConfig(string filename)
{
try
{
// 确保目录存在
var directory = Path.GetDirectoryName(filename);
if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
using (var sw = new StreamWriter(filename))
{
sw.WriteLine("; HitFeedback Configuration File");
sw.WriteLine("; Generated by HitFeedback.Config class");
sw.WriteLine(); // 空行
sw.WriteLine("[General]");
sw.WriteLine($"hotKey = {hotKey.ToString()}");
sw.WriteLine();
if (probability.Count > 0)
{
sw.WriteLine("[Probabilities]");
foreach (var kvp in probability)
{
// 使用 InvariantCulture 确保浮点数的格式在不同区域设置下都一致
sw.WriteLine($"{kvp.Key} = {kvp.Value.ToString(System.Globalization.CultureInfo.InvariantCulture)}");
}
}
else
{
sw.WriteLine("; No probabilities currently configured.");
}
sw.WriteLine();
}
Debug.Log($"Config saved to: {filename}");
}
catch (System.Exception ex)
{
Debug.LogError($"Error saving config file '{filename}': {ex.Message}");
}
}
} }
} }

View File

@@ -14,14 +14,18 @@ namespace HitFeedback
public class ModBehaviour:Duckov.Modding.ModBehaviour public class ModBehaviour:Duckov.Modding.ModBehaviour
{ {
public const string AudioFolderName = "audio"; public const string AudioFolderName = "audio";
public const string ConfigFileName = "config.ini";
public string audioFolderPath; public string audioFolderPath;
public string configFilePath;
public List<string> audioFilePath = new List<string>(); public Dictionary<string,float> audioFilePath = new Dictionary<string,float>();
public Health health; public Health health;
public Config config=new Config(); public Config config=new Config();
public float totalWeight;
private void Update() private void Update()
{ {
if (Input.GetKeyDown(KeyCode.F8)) if (Input.GetKeyDown(KeyCode.F8))
@@ -34,12 +38,46 @@ namespace HitFeedback
{ {
LevelManager.OnLevelInitialized += OnSceneLoaded; LevelManager.OnLevelInitialized += OnSceneLoaded;
audioFolderPath=Path.Combine(info.path,AudioFolderName); audioFolderPath=Path.Combine(info.path,AudioFolderName);
configFilePath=Path.Combine(info.path, ConfigFileName);
FindWavFiles(); FindWavFiles();
config.LoadConfig(configFilePath);
ApplyConfig();
foreach (var f in audioFilePath)
{
totalWeight+=f.Value;
}
} }
protected override void OnBeforeDeactivate() protected override void OnBeforeDeactivate()
{ {
LevelManager.OnLevelInitialized -= OnSceneLoaded; LevelManager.OnLevelInitialized -= OnSceneLoaded;
SaveConfig();
}
private void OnDestroy()
{
SaveConfig();
}
private void ApplyConfig()
{
foreach (var f in config.probability)
{
if (audioFilePath.ContainsKey(f.Key))
{
audioFilePath[f.Key] = f.Value;
}
}
}
private void SaveConfig()
{
config.probability.Clear();
foreach (var f in audioFilePath)
{
config.probability.Add(f.Key, f.Value);
}
config.SaveConfig(configFilePath);
} }
private void FindWavFiles() private void FindWavFiles()
{ {
@@ -55,7 +93,7 @@ namespace HitFeedback
{ {
foreach (string filePath in files) foreach (string filePath in files)
{ {
audioFilePath.Add(filePath); audioFilePath.Add(Path.GetFileName(filePath), 1);
} }
} }
} }
@@ -101,16 +139,21 @@ namespace HitFeedback
{ {
if (audioFilePath.Count > 0) if (audioFilePath.Count > 0)
{ {
var randomIndex = Random.Range(0, audioFilePath.Count); var randomIndex = Random.Range(0, totalWeight);
var filePath = audioFilePath[randomIndex]; foreach (var f in audioFilePath)
AudioManager.PostCustomSFX(filePath); {
randomIndex -= f.Value;
if (randomIndex <= 0)
{
AudioManager.PostCustomSFX(Path.Combine(audioFolderPath, f.Key));
return;
}
}
} }
else else
{ {
Debug.LogWarning("Mod Feedback: No audio clips loaded to play."); Debug.LogWarning("Mod Feedback: No audio clips loaded to play.");
} }
} }
} }
} }

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("HitFeedback")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0206a83f56b5a794fe2f173b4a047cc4f0d4cd90")]
[assembly: System.Reflection.AssemblyProductAttribute("HitFeedback")]
[assembly: System.Reflection.AssemblyTitleAttribute("HitFeedback")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。

View File

@@ -0,0 +1 @@
0e8871f70d957c8690d2d7e899b7c26cc6fec6a1db85ba1988bdbe458697eb11

View File

@@ -0,0 +1,8 @@
is_global = true
build_property.RootNamespace = HitFeedback
build_property.ProjectDir = D:\vs_project\DuckovMods\HitFeedback\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.CsWinRTUseWindowsUIXamlProjections = false
build_property.EffectiveAnalysisLevelStyle =
build_property.EnableCodeStyleSeverity =

Binary file not shown.

View File

@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("HitFeedback")] [assembly: System.Reflection.AssemblyCompanyAttribute("HitFeedback")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2b7943339c8fff4147e07028e81b3fff19ff0d80")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0206a83f56b5a794fe2f173b4a047cc4f0d4cd90")]
[assembly: System.Reflection.AssemblyProductAttribute("HitFeedback")] [assembly: System.Reflection.AssemblyProductAttribute("HitFeedback")]
[assembly: System.Reflection.AssemblyTitleAttribute("HitFeedback")] [assembly: System.Reflection.AssemblyTitleAttribute("HitFeedback")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@@ -1 +1 @@
1ef47fdca68bb8ba079c984a562e35f7d221eeaabc5c5290fb8b33cc52111227 044e9b3ac36cbf242c64f55f40a9077d40727cb97e540d335e1e29dbc7dccff1

View File

@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("折纸的小箱子")] [assembly: System.Reflection.AssemblyCompanyAttribute("折纸的小箱子")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2af09007f967b42ac04776167f814297d14582e3")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0206a83f56b5a794fe2f173b4a047cc4f0d4cd90")]
[assembly: System.Reflection.AssemblyProductAttribute("SceneSnapshot")] [assembly: System.Reflection.AssemblyProductAttribute("SceneSnapshot")]
[assembly: System.Reflection.AssemblyTitleAttribute("SceneSnapshot")] [assembly: System.Reflection.AssemblyTitleAttribute("SceneSnapshot")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0")]

View File

@@ -1 +1 @@
6db670cc723431582928e8b99ce9debac67aa7935e1b8f3b8518bcd6a23d4ca5 76527c0524d74c181c8c103eb804bb9ea72920abff0b6da2de1250e7811cd906

View File

@@ -1,6 +1,6 @@
is_global = true is_global = true
build_property.RootNamespace = SceneSnapshot build_property.RootNamespace = SceneSnapshot
build_property.ProjectDir = d:\vs_project\DuckovMods\SceneSnapshot\ build_property.ProjectDir = D:\vs_project\DuckovMods\SceneSnapshot\
build_property.EnableComHosting = build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop = build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.CsWinRTUseWindowsUIXamlProjections = false build_property.CsWinRTUseWindowsUIXamlProjections = false

View File

@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("折纸的小箱子")] [assembly: System.Reflection.AssemblyCompanyAttribute("折纸的小箱子")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2b7943339c8fff4147e07028e81b3fff19ff0d80")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0206a83f56b5a794fe2f173b4a047cc4f0d4cd90")]
[assembly: System.Reflection.AssemblyProductAttribute("SceneSnapshot")] [assembly: System.Reflection.AssemblyProductAttribute("SceneSnapshot")]
[assembly: System.Reflection.AssemblyTitleAttribute("SceneSnapshot")] [assembly: System.Reflection.AssemblyTitleAttribute("SceneSnapshot")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0")]

View File

@@ -1 +1 @@
2f140dae1dc23271ae8c394fe95f090beff12b9a0cf8188ff19a7e6d42bca22f 532b9b8318b6010ae03f608127d55a2c59d0b50d9243b633f698b5d460668837

16
Theme/ModBehaviour.cs Normal file
View File

@@ -0,0 +1,16 @@
using System;
namespace Theme
{
public class ModBehaviour:Duckov.Modding.ModBehaviour
{
protected override void OnAfterSetup()
{
base.OnAfterSetup();
}
protected override void OnBeforeDeactivate()
{
base.OnBeforeDeactivate();
}
}
}

22
Theme/Theme.csproj Normal file
View File

@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<DuckovPath>D:\steam\steamapps\common\Escape from Duckov</DuckovPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>D:\steam\steamapps\common\Escape from Duckov\Duckov_Data\Mods\Theme</OutputPath>
<GenerateDependencyFile>false</GenerateDependencyFile>
<DebugType>none</DebugType>
</PropertyGroup>
<ItemGroup>
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\TeamSoda.*" Private="False" />
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\ItemStatsSystem.dll" Private="False" />
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\Unity*" Private="False" />
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\FMODUnity.dll" Private="False" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Theme")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0206a83f56b5a794fe2f173b4a047cc4f0d4cd90")]
[assembly: System.Reflection.AssemblyProductAttribute("Theme")]
[assembly: System.Reflection.AssemblyTitleAttribute("Theme")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。

View File

@@ -0,0 +1 @@
4effd31a0421ad5d63bf5819743524c1e96899884e3dc10e49ff75f0c7981933

View File

@@ -0,0 +1,8 @@
is_global = true
build_property.RootNamespace = Theme
build_property.ProjectDir = D:\vs_project\DuckovMods\Theme\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.CsWinRTUseWindowsUIXamlProjections = false
build_property.EffectiveAnalysisLevelStyle =
build_property.EnableCodeStyleSeverity =

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Theme")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0206a83f56b5a794fe2f173b4a047cc4f0d4cd90")]
[assembly: System.Reflection.AssemblyProductAttribute("Theme")]
[assembly: System.Reflection.AssemblyTitleAttribute("Theme")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。

View File

@@ -0,0 +1 @@
9389535ab653bc716c7ef81ccb8542bee3753b2c1f4be9c952401b4ec0aa9c5d

View File

@@ -0,0 +1,8 @@
is_global = true
build_property.RootNamespace = Theme
build_property.ProjectDir = D:\vs_project\DuckovMods\Theme\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.CsWinRTUseWindowsUIXamlProjections = false
build_property.EffectiveAnalysisLevelStyle =
build_property.EnableCodeStyleSeverity =

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Theme")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0206a83f56b5a794fe2f173b4a047cc4f0d4cd90")]
[assembly: System.Reflection.AssemblyProductAttribute("Theme")]
[assembly: System.Reflection.AssemblyTitleAttribute("Theme")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。

View File

@@ -0,0 +1 @@
9389535ab653bc716c7ef81ccb8542bee3753b2c1f4be9c952401b4ec0aa9c5d

View File

@@ -0,0 +1,8 @@
is_global = true
build_property.RootNamespace = Theme
build_property.ProjectDir = D:\vs_project\DuckovMods\Theme\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.CsWinRTUseWindowsUIXamlProjections = false
build_property.EffectiveAnalysisLevelStyle =
build_property.EnableCodeStyleSeverity =

Binary file not shown.

View File

@@ -0,0 +1,73 @@
{
"format": 1,
"restore": {
"D:\\vs_project\\DuckovMods\\Theme\\Theme.csproj": {}
},
"projects": {
"D:\\vs_project\\DuckovMods\\Theme\\Theme.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\vs_project\\DuckovMods\\Theme\\Theme.csproj",
"projectName": "Theme",
"projectPath": "D:\\vs_project\\DuckovMods\\Theme\\Theme.csproj",
"packagesPath": "C:\\Users\\Lenovo\\.nuget\\packages\\",
"outputPath": "D:\\vs_project\\DuckovMods\\Theme\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"D:\\vsShare\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\Lenovo\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netstandard2.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.300"
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"NETStandard.Library": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.306\\RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Lenovo\.nuget\packages\;D:\vsShare\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Lenovo\.nuget\packages\" />
<SourceRoot Include="D:\vsShare\NuGetPackages\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@@ -0,0 +1,79 @@
{
"version": 3,
"targets": {
".NETStandard,Version=v2.1": {}
},
"libraries": {},
"projectFileDependencyGroups": {
".NETStandard,Version=v2.1": []
},
"packageFolders": {
"C:\\Users\\Lenovo\\.nuget\\packages\\": {},
"D:\\vsShare\\NuGetPackages": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\vs_project\\DuckovMods\\Theme\\Theme.csproj",
"projectName": "Theme",
"projectPath": "D:\\vs_project\\DuckovMods\\Theme\\Theme.csproj",
"packagesPath": "C:\\Users\\Lenovo\\.nuget\\packages\\",
"outputPath": "D:\\vs_project\\DuckovMods\\Theme\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"D:\\vsShare\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\Lenovo\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netstandard2.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.300"
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"NETStandard.Library": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.306\\RuntimeIdentifierGraph.json"
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "N+YeLnamjSg=",
"success": true,
"projectFilePath": "D:\\vs_project\\DuckovMods\\Theme\\Theme.csproj",
"expectedPackageFiles": [],
"logs": []
}

View File

@@ -0,0 +1 @@
"restore":{"projectUniqueName":"D:\\vs_project\\DuckovMods\\Theme\\Theme.csproj","projectName":"Theme","projectPath":"D:\\vs_project\\DuckovMods\\Theme\\Theme.csproj","outputPath":"D:\\vs_project\\DuckovMods\\Theme\\obj\\","projectStyle":"PackageReference","fallbackFolders":["D:\\vsShare\\NuGetPackages"],"originalTargetFrameworks":["netstandard2.1"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"netstandard2.1":{"targetAlias":"netstandard2.1","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"},"SdkAnalysisLevel":"9.0.300"}"frameworks":{"netstandard2.1":{"targetAlias":"netstandard2.1","imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"NETStandard.Library":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\9.0.306\\RuntimeIdentifierGraph.json"}}

View File

@@ -0,0 +1 @@
17622424783469959

View File

@@ -1,3 +1,4 @@
using Duckov.Options.UI;
using UnityEngine; using UnityEngine;
namespace UIFrame namespace UIFrame
@@ -7,6 +8,7 @@ namespace UIFrame
protected override void OnAfterSetup() protected override void OnAfterSetup()
{ {
Debug.Log("OnAfterSetup"); Debug.Log("OnAfterSetup");
} }
protected override void OnBeforeDeactivate() protected override void OnBeforeDeactivate()

22
UIFrame/UIFrame.csproj Normal file
View File

@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
<DuckovPath>D:\steam\steamapps\common\Escape from Duckov</DuckovPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<OutputPath>D:\steam\steamapps\common\Escape from Duckov\Duckov_Data\Mods\UIFrame</OutputPath>
<GenerateDependencyFile>false</GenerateDependencyFile>
<DebugType>none</DebugType>
</PropertyGroup>
<ItemGroup>
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\TeamSoda.*" Private="False" />
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\ItemStatsSystem.dll" Private="False" />
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\Unity*" Private="False" />
<Reference Include="$(DuckovPath)\Duckov_Data\Managed\FMODUnity.dll" Private="False" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("UIFrame")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0206a83f56b5a794fe2f173b4a047cc4f0d4cd90")]
[assembly: System.Reflection.AssemblyProductAttribute("UIFrame")]
[assembly: System.Reflection.AssemblyTitleAttribute("UIFrame")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。

View File

@@ -0,0 +1 @@
befe5a7453194406b1676f68d219a8c86bdf2f4cea49adddbaad5a1bb5006b5d

View File

@@ -0,0 +1,8 @@
is_global = true
build_property.RootNamespace = UIFrame
build_property.ProjectDir = D:\vs_project\DuckovMods\UIFrame\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.CsWinRTUseWindowsUIXamlProjections = false
build_property.EffectiveAnalysisLevelStyle =
build_property.EnableCodeStyleSeverity =

Binary file not shown.

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("UIFrame")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+0206a83f56b5a794fe2f173b4a047cc4f0d4cd90")]
[assembly: System.Reflection.AssemblyProductAttribute("UIFrame")]
[assembly: System.Reflection.AssemblyTitleAttribute("UIFrame")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。

View File

@@ -0,0 +1 @@
eb1c4a5bd10a6004eb2efc2bf4354383e0389ddf5e8c9585686a601d75e8a73a

View File

@@ -0,0 +1,8 @@
is_global = true
build_property.RootNamespace = UIFrame
build_property.ProjectDir = D:\vs_project\DuckovMods\UIFrame\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.CsWinRTUseWindowsUIXamlProjections = false
build_property.EffectiveAnalysisLevelStyle =
build_property.EnableCodeStyleSeverity =

Binary file not shown.

View File

@@ -0,0 +1 @@
26cd918e8bf85dee638761fbef4e2117b1734f804498932e0dc10264a1740877

View File

@@ -0,0 +1,7 @@
D:\steam\steamapps\common\Escape from Duckov\Duckov_Data\Mods\UIFrame\UIFrame.dll
D:\vs_project\DuckovMods\UIFrame\obj\Release\UIFrame.csproj.AssemblyReference.cache
D:\vs_project\DuckovMods\UIFrame\obj\Release\UIFrame.GeneratedMSBuildEditorConfig.editorconfig
D:\vs_project\DuckovMods\UIFrame\obj\Release\UIFrame.AssemblyInfoInputs.cache
D:\vs_project\DuckovMods\UIFrame\obj\Release\UIFrame.AssemblyInfo.cs
D:\vs_project\DuckovMods\UIFrame\obj\Release\UIFrame.csproj.CoreCompileInputs.cache
D:\vs_project\DuckovMods\UIFrame\obj\Release\UIFrame.dll

Binary file not shown.

View File

@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]

View File

@@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("UIFrame")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Release")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+2b7943339c8fff4147e07028e81b3fff19ff0d80")]
[assembly: System.Reflection.AssemblyProductAttribute("UIFrame")]
[assembly: System.Reflection.AssemblyTitleAttribute("UIFrame")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// 由 MSBuild WriteCodeFragment 类生成。

View File

@@ -0,0 +1 @@
182413bb99359ea7c161b45b2bb18fe3237278db1602606b22aaa2562bc9943e

View File

@@ -0,0 +1,8 @@
is_global = true
build_property.RootNamespace = UIFrame
build_property.ProjectDir = D:\vs_project\DuckovMods\UIFrame\
build_property.EnableComHosting =
build_property.EnableGeneratedComInterfaceComImportInterop =
build_property.CsWinRTUseWindowsUIXamlProjections = false
build_property.EffectiveAnalysisLevelStyle =
build_property.EnableCodeStyleSeverity =

View File

@@ -0,0 +1,73 @@
{
"format": 1,
"restore": {
"D:\\vs_project\\DuckovMods\\UIFrame\\UIFrame.csproj": {}
},
"projects": {
"D:\\vs_project\\DuckovMods\\UIFrame\\UIFrame.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\vs_project\\DuckovMods\\UIFrame\\UIFrame.csproj",
"projectName": "UIFrame",
"projectPath": "D:\\vs_project\\DuckovMods\\UIFrame\\UIFrame.csproj",
"packagesPath": "C:\\Users\\Lenovo\\.nuget\\packages\\",
"outputPath": "D:\\vs_project\\DuckovMods\\UIFrame\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"D:\\vsShare\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\Lenovo\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netstandard2.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.300"
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"NETStandard.Library": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.306\\RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\Lenovo\.nuget\packages\;D:\vsShare\NuGetPackages</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.14.0</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="C:\Users\Lenovo\.nuget\packages\" />
<SourceRoot Include="D:\vsShare\NuGetPackages\" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@@ -0,0 +1,79 @@
{
"version": 3,
"targets": {
".NETStandard,Version=v2.1": {}
},
"libraries": {},
"projectFileDependencyGroups": {
".NETStandard,Version=v2.1": []
},
"packageFolders": {
"C:\\Users\\Lenovo\\.nuget\\packages\\": {},
"D:\\vsShare\\NuGetPackages": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "D:\\vs_project\\DuckovMods\\UIFrame\\UIFrame.csproj",
"projectName": "UIFrame",
"projectPath": "D:\\vs_project\\DuckovMods\\UIFrame\\UIFrame.csproj",
"packagesPath": "C:\\Users\\Lenovo\\.nuget\\packages\\",
"outputPath": "D:\\vs_project\\DuckovMods\\UIFrame\\obj\\",
"projectStyle": "PackageReference",
"fallbackFolders": [
"D:\\vsShare\\NuGetPackages"
],
"configFilePaths": [
"C:\\Users\\Lenovo\\AppData\\Roaming\\NuGet\\NuGet.Config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.FallbackLocation.config",
"C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config"
],
"originalTargetFrameworks": [
"netstandard2.1"
],
"sources": {
"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
},
"restoreAuditProperties": {
"enableAudit": "true",
"auditLevel": "low",
"auditMode": "direct"
},
"SdkAnalysisLevel": "9.0.300"
},
"frameworks": {
"netstandard2.1": {
"targetAlias": "netstandard2.1",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48",
"net481"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"NETStandard.Library": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\9.0.306\\RuntimeIdentifierGraph.json"
}
}
}
}

View File

@@ -0,0 +1,8 @@
{
"version": 2,
"dgSpecHash": "A4ZumVBkozg=",
"success": true,
"projectFilePath": "D:\\vs_project\\DuckovMods\\UIFrame\\UIFrame.csproj",
"expectedPackageFiles": [],
"logs": []
}

View File

@@ -0,0 +1 @@
"restore":{"projectUniqueName":"D:\\vs_project\\DuckovMods\\UIFrame\\UIFrame.csproj","projectName":"UIFrame","projectPath":"D:\\vs_project\\DuckovMods\\UIFrame\\UIFrame.csproj","outputPath":"D:\\vs_project\\DuckovMods\\UIFrame\\obj\\","projectStyle":"PackageReference","fallbackFolders":["D:\\vsShare\\NuGetPackages"],"originalTargetFrameworks":["netstandard2.1"],"sources":{"C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\":{},"https://api.nuget.org/v3/index.json":{}},"frameworks":{"netstandard2.1":{"targetAlias":"netstandard2.1","projectReferences":{}}},"warningProperties":{"warnAsError":["NU1605"]},"restoreAuditProperties":{"enableAudit":"true","auditLevel":"low","auditMode":"direct"},"SdkAnalysisLevel":"9.0.300"}"frameworks":{"netstandard2.1":{"targetAlias":"netstandard2.1","imports":["net461","net462","net47","net471","net472","net48","net481"],"assetTargetFallback":true,"warn":true,"frameworkReferences":{"NETStandard.Library":{"privateAssets":"all"}},"runtimeIdentifierGraphPath":"C:\\Program Files\\dotnet\\sdk\\9.0.306\\RuntimeIdentifierGraph.json"}}

View File

@@ -0,0 +1 @@
17620796287866771

View File

@@ -0,0 +1 @@
17620796287866771