A library for creating UI!
As REPOConfig gets updated, so will this library.
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//ButtonsvarrepoButton=MenuAPI.CreateREPOButton("A Button",()=>Debug.Log("I was clicked!"),parent,localPosition:Vector2.zero);//LabelsvarrepoLabel=MenuAPI.CreateREPOLabel("A Label",parent,localPosition:newVector2(48.3f,55.5f));//TogglesvarrepoToggle=MenuAPI.CreateREPOToggle("A Toggle", b =>Debug.Log($"I was switched to: {b}"),parent,Vector2.zero,"Left Button Text","Right Button Text",defaultValue:true);//Avatar PreviewsvarrepoAvatarPreview=MenuAPI.CreateREPOAvatarPreview(parent,newVector2(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 SlidervarrepoFloatSlider=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)varrepoIntSliderSlider=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}")varrepoStringSlider=MenuAPI.CreateREPOSlider("String Option Slider","Description",(strings)=>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 timevarrepoPage=MenuAPI.CreateREPOPopupPage("Page Header",REPOPopupPage.PresetSide.Left,shouldCachePage:false,pageDimmerVisibility:true,spacing:1.5f);//Popup Page Custom PositionvarrepoPage=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 inactiverepoPage.OpenPage(openOnTop:false);//Closes this page//closePagesAddedOnTop://If true, all pages added on top will close too//If false, only this page will closerepoPage.ClosePage(closePagesAddedOnTop:false);//Sets the padding for the scroll box maskrepoPage.maskPadding=newPadding(left:0,top:0,right:0,bottom:0);//Adds an element to the pagerepoPage.AddElement(parent =>{//Create element, parent it using `parent`});//Adds an element to the page's scroll boxrepoPage.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 boxvarrepoButton=MenuAPI.CreateREPOButton("A Button",()=>Debug.Log("I was clicked!"),parent:scrollView,localPosition:Vector2.zero);varscrollViewElement=repoButton.repoScrollViewElement;//Sets space above this element when positionedscrollViewElement.topPadding=50;//Sets space below this element when positioned, typically for the next elementscrollViewElement.bottomPadding=50;//To dynamically hide/show elements, you need to toggle this fieldscrollViewElement.visibility=false;});