Skip to content

Commit

Permalink
新增自动启用DLC插件功能
Browse files Browse the repository at this point in the history
  • Loading branch information
LorisYounger committed Dec 7, 2023
1 parent a8107a6 commit 537d5ad
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -352,4 +352,5 @@ MigrationBackup/
*.zip
*.rar
*_PDLC_*
*_DLC_*
*_DLC_*
VPet-Simulator.Windows/mod/1111_ChatGPTPlus
11 changes: 8 additions & 3 deletions VPet-Simulator.Windows/Function/CoreMOD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ namespace VPet_Simulator.Windows
{
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>()
{
"Panuon.WPF.dll","steam_api.dll","Panuon.WPF.UI.dll","steam_api64.dll",
Expand Down Expand Up @@ -264,7 +269,7 @@ public CoreMOD(DirectoryInfo directory, MainWindow mw)
}
catch (Exception e)
{
ErrorMessage = e.Message;
ErrorMessage = e.Message;
SuccessLoad = false;
}
}
Expand All @@ -274,7 +279,7 @@ public CoreMOD(DirectoryInfo directory, MainWindow mw)
}
}
}
catch(Exception e)
catch (Exception e)
{
ErrorMessage = e.Message;
Tag.Add("该模组已损坏");
Expand Down Expand Up @@ -338,7 +343,7 @@ public static void EatFood(this GameSave save, IFood food, double buff)
}
public static bool IsOnMod(this Setting t, string ModName)
{
if (ModName == "Core")
if (CoreMOD.OnModDefList.Contains(ModName))
return true;
var line = t.FindLine("onmod");
if (line == null)
Expand Down
6 changes: 4 additions & 2 deletions VPet-Simulator.Windows/WinDesign/winGameSetting.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,13 @@ private void ButtonEnable_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());
return;
}
else if (CoreMOD.OnModDefList.Contains(mod.Name))
return;
mw.Set.OnModRemove(mod.Name);
ShowMod(mod.Name);
ButtonRestart.Visibility = Visibility.Visible;
Expand All @@ -577,7 +579,7 @@ private async void ButtonPublish_MouseDown(object sender, MouseButtonEventArgs e
MessageBoxX.Show("请先登录Steam后才能上传文件".Translate(), "上传MOD需要Steam登录".Translate(), MessageBoxIcon.Warning);
return;
}
if (mods.Name.ToLower() == "core")
if (CoreMOD.OnModDefList.Contains(mods.Name))
{
MessageBoxX.Show("模组 Core 为<虚拟桌宠模拟器>核心文件,无法发布\n如需发布自定义内容,请复制并更改名称".Translate(), "MOD上传失败".Translate(), MessageBoxIcon.Error);
return;
Expand Down
8 changes: 8 additions & 0 deletions VPet-Simulator.Windows/mklink.bat
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
chcp 65001

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\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\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\1110_ChatGPT" "%~dp0\..\..\VPet.Plugin.Demo\VPet.Plugin.ChatGPT\1110_ChatGPT"


pause

0 comments on commit 537d5ad

Please sign in to comment.