VPet-Simulator.Unified
1.0.1
dotnet add package VPet-Simulator.Unified --version 1.0.1
NuGet\Install-Package VPet-Simulator.Unified -Version 1.0.1
<PackageReference Include="VPet-Simulator.Unified" Version="1.0.1" />
<PackageVersion Include="VPet-Simulator.Unified" Version="1.0.1" />
<PackageReference Include="VPet-Simulator.Unified" />
paket add VPet-Simulator.Unified --version 1.0.1
#r "nuget: VPet-Simulator.Unified, 1.0.1"
#:package VPet-Simulator.Unified@1.0.1
#addin nuget:?package=VPet-Simulator.Unified&version=1.0.1
#tool nuget:?package=VPet-Simulator.Unified&version=1.0.1
VPet-Simulator.Unified · 虚拟桌宠模拟器 MOD 开发包

虚拟桌宠模拟器(VPet)是一款支持互动、投喂和 Steam 创意工坊的开源桌宠。使用这个开发包编写代码 MOD,只需编译一份 DLL,就能在支持 Unified 的 Windows 本体和 Avalonia 跨平台版加载。VPet 项目主页 · 在 Steam 获取游戏
写一个查看等级的插件
创建名为 PetLevel 的 .NET 8 类库,使用默认的 AnyCPU 平台。在项目目录安装开发包。
dotnet add package VPet-Simulator.Unified --version 1.0.1
入口类直接继承 UnifiedPlugin,通过公开构造函数接收 IPetHost。游戏每次重建「自定」菜单都会调用 LoadDIY()。示例在这里添加「查看等级」按钮,玩家点击时才读取当前桌宠的等级。
using VPet_Simulator.Unified.Interface;
public class PetLevelPlugin : UnifiedPlugin
{
public PetLevelPlugin(IPetHost host) : base(host) { }
public override string PluginName => "PetLevel";
public override void LoadDIY()
{
Host.AddMenuButton(PetMenuType.DIY, "查看等级",
() => Host.ShowMessage($"当前等级为 {Host.Save.Level}"));
}
}
运行 dotnet build -c Release,把生成的 PetLevel.dll 放入游戏的 MOD 目录。游戏提供 VPet-Simulator.Unified.dll,MOD 只需分发插件及其自带依赖。
mod/
└── PetLevel/
├── info.lps
└── plugin/
└── PetLevel.dll
info.lps 的 vupmod 填写与 PluginName 相同的名称。将 YourName 换成作者名,gamever 填写测试插件时使用的游戏版本整数。
vupmod#PetLevel:|author#YourName:|gamever#11075:|ver#10000:|
intro#在自定菜单中查看当前桌宠的等级:|
插件可以访问什么
- 用
Host.Save读取等级和金钱,用Host.Statistics读写统计。插件自己的数据写入Host.SaveData。 - 用
Host.Items注册物品使用行为,调用Host.AddMenuButton添加菜单按钮,通过Host.Pet与桌宠互动。 - 订阅
Host.MutiPlayerHandle取得当前访客表的IMPHost。插件可以查看成员、接收自定义消息,也可以向好友发送消息或向房间广播。
原有 Windows 代码 MOD 可继续使用 MainPlugin 和 Windows.Interface。需要 WPF 或 Avalonia 原生控件的视图由相应平台实现。Windows 插件包 · Windows 插件示例 · 反馈问题
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- LinePutScript (>= 1.11.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.