ZUIExampleMod

版本 v1.1.0·更新於 2026-01-18

An example mod to test with ZUI.

模組介紹 作者原文

ZUI Example Mod for VRising

A comprehensive example mod demonstrating how to use the ZUI API for VRising mods, including both legacy button integration and custom UI window creation.

Purpose: This mod showcases two different approaches to using ZUI - adding buttons to the main menu and creating fully custom UI windows.

Features

This example mod demonstrates:

  • Legacy Button Registration - Adding buttons to ZUI's main menu
  • Custom UI Windows - Creating your own standalone UI windows with custom layouts
  • UI Customization - Positioning elements, adding images, colored text, and more
  • Reflection-based API calls - Safe integration with ZUI as a soft dependency

Requirements

  • VRising game installed
  • BepInEx 6.0.0-be.733 (IL2CPP version)
  • ZUI Core Mod (REQUIRED for this showcase)

-.NET 6.0 SDK for building

Setup Instructions

  • Build the Project

dotnet build

  • Deploy

Copy the compiled ZUIExampleMod.dll to your VRising BepInEx plugins folder:

/BepInEx/plugins/

  • Add Your Custom Image (Optional)

If you want to test the image functionality:

  • Create a PNG image file
  • Rename it to match what's in the code (or update the code to match your filename)
  • Place it in the appropriate ZUI images directory

💡 What This Does

When you load the game with ZUI installed, this mod creates two different UI demonstrations:

Part 1: 🔘 Legacy Buttons (Main Menu Integration)

Adds a "Simple Stuff" category to ZUI's main menu with two buttons:

  • Hello World - Executes.say Hello command
  • Kill Self - Executes.kill command

Part 2: 🎨 Custom UI Window

Creates a completely custom 500x350 pixel window named "YourWindowName" featuring:

  • Custom title with colored text
  • Multiple text elements positioned manually
  • Categories for organization (README and COMMANDS sections)
  • Buttons at specific positions
  • Image display capability

🔧 The Core Code

The plugin uses reflection to safely call ZUI methods, making it work as a soft dependency:

private void Call(string name, params object args)

{

if (_zui == null) return;

var method = _zui.GetMethods(BindingFlags.Public | BindingFlags.Static).FirstOrDefault(m => m.Name == name && m.GetParameters().Length == args.Length);

if (method!= null) method.Invoke(null, args);

else LogInstance.LogError($"Could not find ZUI method '{name}' with {args.Length} parameters.");

}

Creating Custom Windows

private void CreateCustomUI()

{

Call("SetPlugin", "YourPluginName");

Call("SetTargetWindow", "YourWindowName");

Call("SetUI", 500, 350); // Width x Height

Call("SetTitle", "ZUIExampleMod");

Call("AddText", "Custom text here", 15f, 210f);

Call("AddButton", "Test", ".ignorethis", 320f, 220f);

Call("AddCategory", "README:", 15f, 190f);

Call("AddImage", "CHANGENAME.png", 20f, 40f, 460f, 150f);

}

📁 Project Structure

ZUIExampleMod/

├── Plugin.cs # Main plugin - creates UI elements

├── MyPluginInfo.cs # Plugin metadata

└── ZUIExampleMod.csproj # Project configuration

🎯 How to Adapt This for Your Mod

Approach 1: Simple Menu Buttons

Perfect for basic functionality that just needs a few buttons:

Call("SetPlugin", "MyMod");

Call("SetTargetWindow", "Main");

Call("AddCategory", "My Features");

Call("AddButton", "Do Something", ".mycommand");

Approach 2: Custom UI Windows

For complex UIs with custom layouts:

Call("SetPlugin", "MyMod");

Call("SetTargetWindow", "MyCustomWindow");

Call("SetUI", 600, 400); // Set window size

// Position elements exactly where you want

Call("AddText", "Welcome!", 10f, 10f);

Call("AddButton", "Click Me", ".command", 10f, 50f, 200f, 30f);

Call("AddImage", "logo.png", 10f, 100f, 580f, 200f);

📚 ZUI API Methods Demonstrated

| Method | Description | Usage |

|--------|-------------|-------|

| SetPlugin(string) | Sets the plugin identifier | Call("SetPlugin", "MyMod"); |

| SetTargetWindow(string) | Targets "Main" menu or a custom window name | Call("SetTargetWindow", "Main"); |

| SetUI(int, int) | Creates custom window with width × height dimensions | Call("SetUI", 500, 350); |

| SetT

安裝與使用 安裝:BepInEx 外掛

  1. 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
  2. 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
  3. 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
  4. 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。

帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

BepInEx-BepInExPack_V_RisingZanakinz-ZUI

檔案與校驗

檔案名稱
ZUIExampleMod-1.1.0.zip
檔案大小
152.8 KiB