Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
You are viewing a potentially older version of this package.
View all versions.
| Date uploaded | a day ago |
| Version | 2.5.2 |
| Download link | nickklmao-MenuLib-2.5.2.zip |
| Downloads | 58049 |
| Dependency string | nickklmao-MenuLib-2.5.2 |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2100README
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 clicked!"), parent: scrollView, localPosition: Vector2.zero);
var scrollViewElement = repoButton.repoScrollViewElement;
//Sets space above this element when positioned
scrollViewElement.topPadding = 50;
//Sets space below this element when positioned, typically for the next element
scrollViewElement.bottomPadding = 50;
//To dynamically hide/show elements, you need to toggle this field
scrollViewElement.visibility = false;
});
CHANGELOG
v2.5.3
- Fixed an issue related to pages
v2.5.2
- Updated for R.E.P.O. v0.4.0 - The Cosmetic Update
v2.5.1
- Updated for R.E.P.O. v0.3.0 - The Monster Update
- Removed
MenuScrollBox.UpdateIL hook
v2.5.0
- Updated for R.E.P.O. v0.2.0 - The Museum Update
- Added
MenuAPI.AddElementToRegionSelectionMenu - Added
MenuAPI.AddElementToServerListMenu
v2.4.1
- Updated
REPOInputFieldandREPOSliderto allow lowercases characters by default
v2.4.0
- Added
REPOPopupPage.onEscapePressed (bool ShouldCloseMenuDelegate)- If true is returned then the menu will be closed, otherwise the menu remains open
- If this field is null, the menu closes by default
- Added
REPOInputStringSystemwhich provides necessary functionality for handling input- The biggest downside is a lack of caret position (arrow keys) and highlighting
- CTRL + C copies the current text to your clipboard
- CTRL + X copies the current text to your clipboard and clears the text field
- CTRL + V pastes your clipboard to the end of the text field
- Added
REPOInputField- Uses
REPOInputStringSystemto create an input field element that has a label
- Uses
- Fixed scrollbar scrolling, there's no longer a weird deadzone when scrolling from the top
- Fixed W/S keys from scrolling extremely quickly
v2.3.0
- Added
REPOPopupPage.closeMenuOnEscape(defaults totrue)- When
falsethe menu won't close when the escape key is pressed
- When
- Added
REPOAvatarPreview.previewSizeto modify the mask size - Added
REPOObjectPreview- A custom version of the
REPOAvatarPreviewbut for GameObjects
- A custom version of the
v2.2.0
- Added
MenuAPI.AddElementToSettingsMenu - Added
MenuAPI.AddElementToColorMenu - Fixed README having inaccurate comments
v2.1.3
- Added
REPOScrollView.scrollSpeed(Can be null)- If null, the scrolling acts as normal, interpolated between local positions
- If non-null value, the scrolling will be at a constant rate
- Added
REPOScrollView.SetScrollPosition(float normalizedPosition)- This will set the scroll view & scroll bar to a specific position
- This value is normalized, 0 represents the top of the page while 1 represents the bottom
- Fixed
REPOAvatarPreview.OnDestroyfrom throwing a null reference exception (again)
v2.1.2
- Fixed
REPOAvatarPreview.OnDestroyfrom throwing a null reference exception - Fixed
REPOScrollViewfrom not updating when setting thespacingproperty post-creation - Added
REPOPopupPage.pageDimmerOpacity(Range: 0f - 1f) - Scroll views now update when you're not hovering over them
- This resolved some weird issues with dynamically adding items
REPOScrollViewElement.OnRectTransformDimensionsChangewill now update the parentREPOScrollViewlayout- This should fix issues with custom TMP rich text sizes
v2.1.1
- Fixed REPOPopupPage parameters (they were backwards)
- Fixed an issue causing custom REPOPopupPage sizes to break cached pages
- Updated REPOTextScroller to fetch a TMP component if its missing one
- It only checks the object it was added to
- Added
overrideButtonSizeto REPOButton- This will force a custom size rather than using the label size
v2.1.0
- Scrollbar positions get updated when setting a page's mask padding
- Added cached pages
- This prevents you from having to regenerate your menu constantly
- You can only set this via the
MenuAPI.CreateREPOPagemethod
- You can only set this via the
- This prevents you from having to regenerate your menu constantly
- Added 'Action onClick' to REPOButton
- Added 'REPOAvatarPreview'
- Pressing escape goes back one page now
v2.0.0 - THE REWRITE
- You can now add buttons to the menu lobby
- Upgraded scroll boxes
- Elements out of view will be disabled automatically to reduce lag
- Fixed scroll boxes from not scrolling down all the way
- Removed rebinding UI for keybinds (This could return later)
- You can still change the keybind, it'll just be an option slider instead
- Switched to all custom monobehaviours
- Introduces REPOLabel, REPOButton, & REPOSpacer
- This gives you almost full control over your elements
- Plus a lot more
v1.0.5
- Added new method
SetBarStateto REPOSlider- Changes the behavior of the background bar (UpdateWithValue, StaticMinimum, StaticMaximum)
- This would typically be used for
Enumtypes
v1.0.4
- Changed slider increment buttons to only increment by 1
- This depends on how precise your slider is
v1.0.3
- Added keybind support (UnityEngine.InputSystem.Key)
- Made slider descriptions scroll
- Migrated OpenDialog from the
REPOButtonto theMenuAPI
v1.0.2
- Fixed label size for toggles
v1.0.1
- Added option support to sliders
- Rather than displaying a number, words can be displayed
v1.0.0 🔥
- Initial release