新增自动启用DLC插件功能

This commit is contained in:
ZouJin 2023-12-07 16:31:20 +08:00
parent a8107a6ea8
commit 537d5ad543
4 changed files with 22 additions and 6 deletions

3
.gitignore vendored
View File

@ -352,4 +352,5 @@ MigrationBackup/
*.zip *.zip
*.rar *.rar
*_PDLC_* *_PDLC_*
*_DLC_* *_DLC_*
VPet-Simulator.Windows/mod/1111_ChatGPTPlus

View File

@ -16,6 +16,11 @@ namespace VPet_Simulator.Windows
{ {
public class CoreMOD public class CoreMOD
{ {
/// <summary>
/// 自动启用MOD名称
/// </summary>
public static readonly string[] OnModDefList = new string[] { "Core", "PCat", "ModMaker" };
public static HashSet<string> LoadedDLL { get; } = new HashSet<string>() public static HashSet<string> LoadedDLL { get; } = new HashSet<string>()
{ {
"Panuon.WPF.dll","steam_api.dll","Panuon.WPF.UI.dll","steam_api64.dll", "Panuon.WPF.dll","steam_api.dll","Panuon.WPF.UI.dll","steam_api64.dll",
@ -264,7 +269,7 @@ namespace VPet_Simulator.Windows
} }
catch (Exception e) catch (Exception e)
{ {
ErrorMessage = e.Message; ErrorMessage = e.Message;
SuccessLoad = false; SuccessLoad = false;
} }
} }
@ -274,7 +279,7 @@ namespace VPet_Simulator.Windows
} }
} }
} }
catch(Exception e) catch (Exception e)
{ {
ErrorMessage = e.Message; ErrorMessage = e.Message;
Tag.Add("该模组已损坏"); Tag.Add("该模组已损坏");
@ -338,7 +343,7 @@ namespace VPet_Simulator.Windows
} }
public static bool IsOnMod(this Setting t, string ModName) public static bool IsOnMod(this Setting t, string ModName)
{ {
if (ModName == "Core") if (CoreMOD.OnModDefList.Contains(ModName))
return true; return true;
var line = t.FindLine("onmod"); var line = t.FindLine("onmod");
if (line == null) if (line == null)

View File

@ -547,11 +547,13 @@ namespace VPet_Simulator.Windows
private void ButtonDisEnable_MouseDown(object sender, MouseButtonEventArgs e) private void ButtonDisEnable_MouseDown(object sender, MouseButtonEventArgs e)
{ {
if (mod.Name.ToLower() == "core") if (mod.Name == "Core")
{ {
MessageBoxX.Show("模组 Core 为<虚拟桌宠模拟器>核心文件,无法停用".Translate(), "停用失败".Translate()); MessageBoxX.Show("模组 Core 为<虚拟桌宠模拟器>核心文件,无法停用".Translate(), "停用失败".Translate());
return; return;
} }
else if (CoreMOD.OnModDefList.Contains(mod.Name))
return;
mw.Set.OnModRemove(mod.Name); mw.Set.OnModRemove(mod.Name);
ShowMod(mod.Name); ShowMod(mod.Name);
ButtonRestart.Visibility = Visibility.Visible; ButtonRestart.Visibility = Visibility.Visible;
@ -577,7 +579,7 @@ namespace VPet_Simulator.Windows
MessageBoxX.Show("请先登录Steam后才能上传文件".Translate(), "上传MOD需要Steam登录".Translate(), MessageBoxIcon.Warning); MessageBoxX.Show("请先登录Steam后才能上传文件".Translate(), "上传MOD需要Steam登录".Translate(), MessageBoxIcon.Warning);
return; return;
} }
if (mods.Name.ToLower() == "core") if (CoreMOD.OnModDefList.Contains(mods.Name))
{ {
MessageBoxX.Show("模组 Core 为<虚拟桌宠模拟器>核心文件,无法发布\n如需发布自定义内容,请复制并更改名称".Translate(), "MOD上传失败".Translate(), MessageBoxIcon.Error); MessageBoxX.Show("模组 Core 为<虚拟桌宠模拟器>核心文件,无法发布\n如需发布自定义内容,请复制并更改名称".Translate(), "MOD上传失败".Translate(), MessageBoxIcon.Error);
return; return;

View File

@ -1,9 +1,17 @@
chcp 65001
mklink /d "%~dp0\bin\x64\Debug\net462\mod" "%~dp0\mod" mklink /d "%~dp0\bin\x64\Debug\net462\mod" "%~dp0\mod"
echo ^"以下是其他相关MOD的自动链接生成, 若提示错误为正常现象,无需理会"
echo "The following is the automatic link generation for other related MODs. If an error is prompted, it is a normal phenomenon and should not be ignored"
mklink /d "%~dp0\bin\x64\Release\net462\mod" "%~dp0\mod" mklink /d "%~dp0\bin\x64\Release\net462\mod" "%~dp0\mod"
mklink /d "%~dp0\mod\0001_ModMaker" "%~dp0\..\..\VPet.ModMaker\0001_ModMaker" mklink /d "%~dp0\mod\0001_ModMaker" "%~dp0\..\..\VPet.ModMaker\0001_ModMaker"
mklink /d "%~dp0\mod\1100_DemoClock" "%~dp0\..\..\VPet.Plugin.Demo\VPet.Plugin.DemoClock\1100_DemoClock" mklink /d "%~dp0\mod\1100_DemoClock" "%~dp0\..\..\VPet.Plugin.Demo\VPet.Plugin.DemoClock\1100_DemoClock"
mklink /d "%~dp0\mod\1111_ChatGPTPlus" "%~dp0\..\..\VPet.Plugin.ChatGPTPlus\VPet.Plugin.ChatGPTPlus\1111_ChatGPTPlus"
mklink /d "%~dp0\mod\1101_EdgeTTS" "%~dp0\..\..\VPet.Plugin.Demo\VPet.Plugin.EdgeTTS\1101_EdgeTTS" mklink /d "%~dp0\mod\1101_EdgeTTS" "%~dp0\..\..\VPet.Plugin.Demo\VPet.Plugin.EdgeTTS\1101_EdgeTTS"
mklink /d "%~dp0\mod\1110_ChatGPT" "%~dp0\..\..\VPet.Plugin.Demo\VPet.Plugin.ChatGPT\1110_ChatGPT" mklink /d "%~dp0\mod\1110_ChatGPT" "%~dp0\..\..\VPet.Plugin.Demo\VPet.Plugin.ChatGPT\1110_ChatGPT"
pause pause