MenuLib

版本 v2.5.4·更新於 2026-05-28

A library for creating UI!

模組介紹 作者原文

Menu Lib

A library for creating UI!

As REPOConfig gets updated, so will this library.

For Developers - VERSION 2.x.x

You can reference the REPOConfig GitHub.

Official documentation will come later (sorry), but here's a super quick code snippet:

MenuAPI.AddElementToMainMenu(parent =>

{

//parent in this scenario represents the MainMenu

//Buttons

var repoButton = MenuAPI.CreateREPOButton("A Button", () => Debug.Log("I was clicked!"), parent, localPosition: Vector2.zero);

//Labels

var repoLabel = MenuAPI.CreateREPOLabel("A Label", parent, localPosition: new Vector2(48.3f, 55.5f));

//Toggles

var repoToggle = MenuAPI.CreateREPOToggle("A Toggle", b => Debug.Log($"I was switched to: {b}"), parent, Vector2.zero, "Left Button Text", "Right Button Text", defaultValue: true);

//Avatar Previews

var repoAvatarPreview = MenuAPI.CreateREPOAvatarPreview(parent, new Vector2(48.3f, 55.5f), enableBackgroundImage: true, backgroundImageColor: Color.white);

//Sliders

//The precision argument/field is the number of decimals you want (0 = integers, 1 = 0.1, 2 = 0.01, etc.)

//The bar behavior argument/field is for the background bar visual, it doesn't affect functionality

//The rest should be self-explanatory

//Float Slider

var repoFloatSlider = MenuAPI.CreateREPOSlider("Float Slider", "Description", f => Debug.Log($"New Float Value: {f}"), parent, localPosition: Vector2.zero, min: -100f, max: 100f, precision: 2, defaultValue: 50f, "prefix-", "-postfix", REPOSlider.BarBehavior.UpdateWithValue);

//Int Slider (No precision argument)

var repoIntSliderSlider = MenuAPI.CreateREPOSlider("Int Slider", "Description", i => Debug.Log($"New Int Value: {i}"), parent, localPosition: Vector2.zero, min: -100, max: 100, defaultValue: 50, "prefix-", "-postfix", REPOSlider.BarBehavior.UpdateWithValue);

//String Option Slider - Alternatively, you can use an int delegate -----------------> (int i) => Debug.Log($"New String Index Value: {i}")

var repoStringSlider = MenuAPI.CreateREPOSlider("String Option Slider", "Description", (string s) => Debug.Log($"New String Value: {s}"), parent, stringOptions: ["Option A", "Option B", "Option C"], defaultOption: "a", localPosition: Vector2.zero, "prefix-", "-postfix", REPOSlider.BarBehavior.UpdateWithValue);

//Popup Page

//If caching is disabled then the page should be created on a button's press

//If caching is enabled then you should assign it to a field and only create the page if the fields null, otherwise menus will duplicate over time

var repoPage = MenuAPI.CreateREPOPopupPage("Page Header", REPOPopupPage.PresetSide.Left, shouldCachePage: false, pageDimmerVisibility: true, spacing: 1.5f);

//Popup Page Custom Position

var repoPage = MenuAPI.CreateREPOPopupPage("Page Header", shouldCachePage: false, pageDimmerVisibility: true, spacing: 1.5f, localPosition: Vector2.zero);

//Opens the page

//openOnTop:

//If true, the previous page will not be set to inactive

//If false, the previous page will be set to inactive

repoPage.OpenPage(openOnTop: false);

//Closes this page

//closePagesAddedOnTop:

//If true, all pages added on top will close too

//If false, only this page will close

repoPage.ClosePage(closePagesAddedOnTop: false);

//Sets the padding for the scroll box mask

repoPage.maskPadding = new Padding(left: 0, top: 0, right: 0, bottom: 0);

//Adds an element to the page

repoPage.AddElement(parent =>

{

//Create element, parent it using parent

});

//Adds an element to the page's scroll box

repoPage.AddElementToScrollView(scrollView =>

{

//Create element, parent it using scrollView

//Setting the Y position of an element in here is useless, it will be overwritten

//Additionally, this delegate requires a RectTransform to be returned:

//return newlyCreatedElement.rectTransform;

});

//Each element has access to its scroll view element, it will be null if it wasn't parented to a scroll box

var repoButton = MenuAPI.CreateREPOButton("A Button", () => Debug.Log("I was clicke

安裝與使用 安裝:BepInEx 外掛

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

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

前置依賴

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

BepInEx-BepInExPack

檔案與校驗

檔案名稱
MenuLib-2.5.4.zip
檔案大小
86.8 KiB
SHA-256
f95959da68c380945ebd620923116dce61806fc347658cd4b10ceed43df94142
入庫時間
2026-10-06 19:13