RockUI

版本 v1.1.0·更新於 2026-05-29

A handy dependency for making ingame UI

截圖 共 1 張

模組介紹 作者原文

Rock UI

Ever dreaded making UI for your mods? Well, say goodbye to slightly adjusting positions and copying RUMBLE objects, because RockUI solves it all!

Thats all it does though this mod is just a dependency

For Users

Just drag the mod into your mods folder and start up RUMBLE!

For Mod Developers

Be warned this is my first time making a mod like this so if you see some horrible way of doing something please lmk.

The Basics

RockUI is made up of 2 main parts: UIElements and the UIBuilder.

UIElements are the building blocks of UI. There are a few types currently:

  • RockPanel
  • RockButton
  • RockText
  • RockSlider
  • RockLever

Creating one of these is very simple:

RockPanel panel = new RockPanel()

Then you can set properties easily:

panel.size = new Vector2(10,10)

I will go further into the properties of each UIElement further down.

The UI works off of a parent-child system. You can add any UIElement as a child of another like so:

RockPanel panel = new RockPanel()

RockButton button = new RockButton()

panel.AddChildUI(button)

When an element is a child of another it will be placed at the same position as its parent. Alternatively, if the parent node is a panel, you can set the object to be positioned at one of 9 anchor points on the panel with anchor:

  • TopLeft
  • TopRight
  • BottomLeft
  • BottomRight
  • LeftMiddle
  • RightMiddle
  • TopMiddle
  • BottomMiddle
  • Center

You can offset the element from its parent/anchor using anchorOffset

Once you have created your UIElements and applied them as children you are ready to build the UI.

All you have to do is write RockUI.CreateFinalisedUI(-Your Topmost UIElement-). The UIElement you pass in should be the topmost element (has no parent element). You can also pass in either true or false to make the UI follow the player around. The UIBuilder will then create that element and all of it's children and return it as a GameObject.

List of All UIElements

UIElement

Default UIElement. All other types inherit this.

Properties:

  • anchor: Defines what anchor the element snaps to if child of a RockPanel
  • anchorOffset: Defines the position offset from the anchor or the parent element

Methods:

  • AddChildUI(UIElement): Adds another element as a child of this element

RockPanel

A plain slab of rock for placing UI on. I recommend using this as your topmost UIElement.

UIElements as children of it can choose one of 9 Anchors on it to be anchored to.

Properties:

  • size: Vector2 that defines the size of the panel.

RockButton

A button that calls a method when pressed.

Properties:

  • pressAction: The method that is called when the button is pressed. Must have no parameters

RockText

A text label.

Properties:

  • text: The text of the label
  • fontColor: The color of the label
  • fontSize: The size of the text (Honestly doesnt need to be higher than 1 most of the time)

RockSlider

RUMBLE's built in slider object. Can be stepped or a smooth slider.

Properties:

  • useSteps: Whether or not the slider has steps. If true, the slider stops at certain points based on stepCount
  • stepCount: The amount of steps the slider stops at
  • valueChangedAction: The method that is called when the value of the slider changes. Must have a float parameter, which is the value of the slider, from 0 to 1
  • stepReachedAction: The method that is called when a step in the slider is reached. Must have an int parameter, which is the step that was reached, starting at 0

RockLever

RUMBLE's built in lever/switch object. Can be on or off.

Properties:

  • leverToggledAction: Method that is called when the lever is toggled. Must have an integer parameter. Outputs 1 for toggled on and 0 for toggled off

Example UI Setup

public override void OnLateInitializeMelon()

{

RumbleModdingAPI.RMAPI.Actions.onMapInitialized += debug;

}

private float a = 0.0f;

private string t = "";

private void debug()

{

RockPanel mainpanel = new RockPanel();

mainpanel.size = new Vector2(10, 15);

RockButton debugbutton = new RockButton();

debugbutt

安裝與使用 安裝:按包內說明操作

  1. 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
  2. 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
  3. 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
  4. 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。

不同模組的安裝位置差異較大,包內說明是最可靠的依據。

前置依賴

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

UlvakSkillz-RumbleModdingAPI

檔案與校驗

檔案名稱
RockUI-1.1.0.zip
檔案大小
64.2 KiB