-
-
Notifications
You must be signed in to change notification settings - Fork 42
Upgrading from NativeUI
Please note that this guide only applies to developers. If you are a user, this guide is not going to help you. Feel free to send the link of this page to the mod author so other mods can adopt LemonUI.
Right now, you can only use LemonUI with programming languages that use the Common Language Runtime (CLR) like C#, VB.net and F#. The Lua and C++ versions are still work in progress.
Upgrading from NativeUI to LemonUI is pretty straight forward. Most of the classes present on NativeUI are implemented on LemonUI with slight variations.
If a feature that you use in NativeUI is missing on LemonUI, create a new issue to take a more in depth look.
NativeUI Classes | LemonUI Class | Additional Info |
---|---|---|
NativeUI.MenuPool | LemonUI.ObjectPool | Object Pools support any class that implements LemonUI.IProcessable. |
NativeUI.TimerBarPool | LemonUI.TimerBarCollection | N/A |
NativeUI.UIMenu | LemonUI.Menus.NativeMenu | N/A |
NativeUI.InstructionalButton | LemonUI.Scaleform.InstructionalButton | N/A |
NativeUI.BigMessageHandler | LemonUI.Scaleform.BigMessage | LemonUI.Scaleform.BigMessage needs to be created with specific parameters for the message that you want to use. |
NativeUI.Elements.NativeElement | LemonUI.Elements.BaseElement | LemonUI.Elements.BaseElement is an abstract class, unlike NativeUI.Elements.NativeElement. |
NativeUI.Elements.NativeRectangle | LemonUI.Elements.ScaledRectangle | N/A |
NativeUI.Elements.NativeSprite | LemonUI.Elements.ScaledTexture | N/A |
NativeUI.Elements.NativeText | LemonUI.Elements.ScaledText | N/A |
NativeUI.Elements.TextAlignment | LemonUI.Alignment (SHVDN 2 Only) | Use CitizenFX.Core.UI.Alignment on FiveM and GTA.UI.Alignment on SHVDN3. |
NativeUI.IListItem | LemonUI.Menus.ISlidableItem | Completely different interface fields, but provides the same features overall. |
NativeUI.UIMenuItem NativeUI.UIMenuColoredItem |
LemonUI.Menus.NativeItem | N/A |
NativeUI.UIMenuCheckboxItem | LemonUI.Menus.NativeCheckboxItem | N/A |
NativeUI.UIMenuListItem | LemonUI.Menus.NativeListItem | You need to specify the type of object that the menu item will store (NativeListItem<T>). The name is fetched from the T.ToString() function. |
NativeUI.UIMenuDynamicListItem | LemonUI.Menus.NativeDynamicItem | You need to specify the type of object that the menu item will store (NativeDynamicItem<T>). The name is fetched from the T.ToString() function. |
NativeUI.UIMenuSliderItem | LemonUI.Menus.NativeSliderItem | N/A |
NativeUI.UIMenuDynamicListItem.ChangeDirection | LemonUI.Menus.Direction | N/A |
RAGENativeUI.TextFont | LemonUI.Elements.Font (RagePluginHook Only) | Only in RagePluginHook, where the Font enum is not implemented. |
System.ComponentModel.CancelEventHandler | LemonUI.CancelEventHandler (FiveM Only) | Only in FiveM, where System.ComponentModel.CancelEventHandler is not implemented, see https://forum.cfx.re/t/1415267/2 for more information. |
System.ComponentModel.CancelEventArgs | LemonUI.CancelEventArgs (FiveM Only) | Only in FiveM, where System.ComponentModel.CancelEventArgs is not implemented, see https://forum.cfx.re/t/1415267/2 for more information. |
All of the NativeUI Pools have been replaced by LemonUI.ObjectPool. They behave almost the same and support any item that implements LemonUI.IProcessable.
The only difference is that you can't access the menu related options on the Pool, unless you use LemonUI.ObjectPool.With<NativeMenu>.
MenuPool Field/Property/Function | LemonUI Replacement |
---|---|
MouseEdgeEnabled | NativeMenu.RotateCamera |
ControlDisablingEnabled | None |
ResetCursorOnOpen | NativeMenu.ResetCursorWhenOpened |
FormatDescriptions | None (Descriptions are formatted automatically) |
AUDIO_LIBRARY | See the other AUDIO_* Properties below |
AUDIO_UPDOWN | NativeMenu.SoundUpDown |
AUDIO_UPDOWN | NativeMenu.SoundUpDown |
AUDIO_SELECT | NativeMenu.SoundActivated |
AUDIO_BACK | NativeMenu.SoundClose |
AUDIO_ERROR | NativeMenu.SoundDisabled |
WidthOffset | NativeMenu.Offset.Width |
CounterPretext | None |
DisableInstructionalButtons | NativeMenu.InstructionalButtons.Enabled |
BannerInheritance | None |
OffsetInheritance | None |
AddSubMenu(UIMenu, string) AddSubMenu(UIMenu, string, Point) AddSubMenu(UIMenu, string, string) AddSubMenu(UIMenu, string, string, Point) |
NativeMenu.AddSubMenu(NativeMenu) |
RefreshIndex() | None (Index Refreshing is done automatically) |
ToList() | None |
ProcessControl() ProcessKey(Keys) ProcessMouse(Keys) |
None (Control Processing is done on the IProcessable.Process() implementation of each item) |
Draw() | None (Drawing is done on the IProcessable.Process() implementation of each item) |
IsAnyMenuOpen() | ObjectPool.AreAnyVisible |
ProcessMenus() | NativeMenu.Process() |
CloseAllMenus() | ObjectPool.HideAll() |
SetBannerType(NativeSprite) SetBannerType(IRectangle) SetBannerType(string) |
NativeMenu.Banner |
SetKey(MenuControls, Control) SetKey(MenuControls, Control, int) SetKey(MenuControls, Keys) |
None |
ResetKey(MenuControls) | None |
UIMenu Field/Property/Function | LemonUI Replacement |
---|---|
AUDIO_LIBRARY | See the other AUDIO_* Properties below |
AUDIO_UPDOWN | NativeMenu.SoundUpDown |
AUDIO_LEFTRIGHT | NativeMenu.SoundLeftRight |
AUDIO_SELECT | NativeMenu.SoundActivated |
AUDIO_BACK | NativeMenu.SoundClose |
AUDIO_ERROR | NativeMenu.SoundDisable |
MenuItems | NativeMenu.Items (get only) |
MouseEdgeEnabled | NativeMenu.RotateCamera |
ControlDisablingEnabled | None |
ResetCursorOnOpen | NativeMenu.ResetCursorWhenOpened |
FormatDescriptions | None (Descriptions are formatted automatically) |
MouseControlsEnabled | NativeMenu.UseMouse |
ScaleWithSafezone | NativeMenu.SafeZoneAware |
Offset | NativeMenu.Offset |
BannerSprite BannerRectangle BannerTexture |
NativeMenu.Banner |
OnIndexChange | NativeMenu.SelectedIndexChanged |
OnListChange | NativeListItem.ItemChanged |
OnCheckboxChange | NativeCheckboxItem.CheckboxChanged |
OnItemSelect | NativeItem.SelectedItem or NativeItem.SelectedItem |
OnSliderChange | NativeSliderItem.ValueChanged |
OnMenuOpen | NativeMenu.Shown |
OnMenuClose | NativeMenu.Closing (before) |
NativeMenu.Closed (after) | |
OnMenuChange | None |
SetMenuWidthOffset(int) | NativeMenu.Width |
DisableInstructionalButtons(bool) | NativeMenu.InstructionalButtons.Visible |
SetBannerType(ISprite) SetBannerType(Sprite) SetBannerType(IRectangle) SetBannerType(string) |
NativeMenu.Banner |
AddItem(UIMenuItem) | NativeMenu.Add(NativeItem) |
RemoveItemAt(int) | NativeMenu.Remove(NativeMenu.Items[NativeMenu.Index]) |
RefreshIndex() | None (Index Refreshing is done automatically) |
Clear() | NativeMenu.Clear() |
Remove(Func<UIMenuItem, bool>) | NativeMenu.Remove(Func<NativeItem, bool>) |
DrawCalculations() | None |
GoUpOverflow() | |
GoUp() | NativeMenu.Previous() |
GoDownOverflow() | |
GoDown() | NativeMenu.Next() |
GoLeft() | ISlidableItem.GoLeft() |
GoRight() | ISlidableItem.GoRight() |
SelectItem() | None |
GoBack() | NativeMenu.Back() |
BindMenuToItem(UIMenu, UIMenuItem) | NativeMenu.AddSubMenu(NativeMenu) (returns NativeItem with the menu info) |
ReleaseMenuFromItem(UIMenuItem) | None |
SetKey(MenuControls, Keys) SetKey(MenuControls, Control) SetKey(MenuControls, Control, int) |
None |
ResetKey(MenuControls) | None |
HasControlJustBeenPressed(MenuControls, Keys) | None |
HasControlJustBeenReleaseed(MenuControls, Keys) | None |
IsControlBeingPressed(MenuControls, Keys) | None |
AddInstructionalButton(InstructionalButton) | NativeMenu.Buttons.Add(InstructionalButton) |
RemoveInstructionalButton(InstructionalButton) | NativeMenu.Buttons.Remove(InstructionalButton) |
Draw() | NativeMenu.Process() |
ProcessMouse() | None (Done in NativeMenu.Process()) |
ProcessControl(Keys) | None |
ProcessKey(Keys) | None |
UpdateScaleform() | NativeMenu.Buttons.Refresh() |
Visible | NativeMenu.Visible |
CurrentSelection | NativeMenu.SelectedIndex |
IsUsingController |
Game.CurrentInputMode == InputMode.GamePad on FiveM and SHVDN2, Game.LastInputMethod == GamePad on SHVDN3 |
Size | NativeMenu.Items.Count |
Title | Text |
Subtitle | None (NativeMenu.Subtitle can be used to get the string but not the NativeText object) |
CounterPretext | None |
ParentMenu | NativeMenu.Parent |
ParentItem | None |
Children | None |
WidthOffset | NativeMenu.Offset.Width |
UIMenuItem Field/Property/Function | LemonUI Replacement |
---|---|
Activated | NativeItem.Activated |
Selected | NativeMenu.SelectedItem == NativeItem |
Hovered | None |
Description | NativeItem.Description |
Enabled | NativeItem.Enabled |
Position(int) | None |
Draw() | NativeItem.Draw() |
Offset | NativeMenu.Offset |
Text | NativeItem.Title |
SetLeftBadge(BadgeStyle) | NativeItem.LeftBadge |
SetRightBadge(BadgeStyle) | NativeItem.RightBadge |
SetRightLabel(string) | NativeItem.AltTitle |
RightLabel | NativeItem.AltTitle |
LeftBadge | NativeItem.LeftBadge |
RightBadge | NativeItem.RightBadge |
Parent | None |
UIMenuCheckboxItem Field/Property/Function | LemonUI Replacement |
---|---|
CheckboxEvent | NativeCheckboxItem.CheckboxChanged |
Checked | NativeCheckboxItem.Checked |
Position(int) | None |
Draw() | NativeCheckboxItem.Draw() |
CheckboxEventTrigger() | None |
SetRightBadge(BadgeStyle) | NativeCheckboxItem.RightBadge |
SetRightLabel(string) | NativeCheckboxItem.AltTitle |
The main difference between UIMenuListItem and NativeListItem is that you need to specify the type of objects stored in the list, for example:
NativeListItem<string> strings = new NativeListItem<string>("List of Strings");
NativeListItem<int> ints = new NativeListItem<int>("List of Ints");
UIMenuListItem Field/Property/Function | LemonUI Replacement |
---|---|
OnListChanged | NativeListItem.ItemChanged |
Index | NativeListItem.SelectedIndex |
Items | NativeListItem.Items |
Position(int) | None |
ItemToIndex(object) | NativeListItem.Items.IndexOf(T) |
IndexToItem(int) | NativeListItem.Items[int] |
Draw() | NativeListItem.Draw() |
SetRightBadge(BadgeStyle) | NativeListItem.RightBadge |
SetRightLabel(string) | NativeListItem.AltText |
CurrentItem() | NativeListItem.SelectedItem |
Just like List Items, you need to specify the type of item:
NativeDynamicItem<string> strings = new NativeDynamicItem<string>("Dynamic Strings");
NativeDynamicItem<int> ints = new NativeDynamicItem<int>("Dynamic Ints");
UIMenuDynamicListItem Field/Property/Function | LemonUI Replacement |
---|---|
DynamicListItemChangeCallback | ItemChangedEventHandler |
CurrentListItem | NativeDynamicItem.SelectedItem |
DynamicListItemChangeCallback | NativeDynamicItem.ItemChanged |
Position | None |
Draw() | NativeDynamicItem.Draw() |
CurrentItem() | NativeDynamicItem.SelectedItem |
UIMenuSliderItem Field/Property/Function | LemonUI Replacement |
---|---|
OnSliderChanged | NativeSliderItem.ValueChanged |
Maximum | NativeSliderItem.Maximum |
Value | NativeSliderItem.Value |
Multiplier | NativeSliderItem.Multiplier |
Position(int) | None |
Draw() | NativeSliderItem.Draw() |
Timer Bars are the little bars with gradients shown at specific times in the game on the bottom right section of the screen.
TimerBarPool Field/Property/Function | LemonUI Replacement |
---|---|
Add(TimerBarBase) | TimerBarCollection.Add(TimerBar) |
Draw() | TimerBarCollection.Process() |
Remove(TimerBarBase) | TimerBarCollection.Remove(TimerBar) |
ToList() | TimerBarCollection.TimerBars |
Both are replaced by LemonUI's TimerBar class.
BaseTimerBar Field/Property/Function | LemonUI Replacement |
---|---|
Draw(int) | TimerBar.Draw() |
Label | TimerBar.Title |
TextTimerBar Field/Property/Function | LemonUI Replacement |
---|---|
Text | TimerBar.Info |
BarTimerBar Field/Property/Function | LemonUI Replacement |
---|---|
Percentage | TimerBarProgress.Percentage |
BackgroundColor | TimerBarProgress.BackgroundColor |
ForegroundColor | TimerBarProgress.ForegroundColor |
Please note that unlike BigMessageHandler in NativeUI, BigMessage of LemonUI is not a static class. Instead, you need to create, draw and dispose it just like any other class.
BigMessageHandler Field/Property/Function | LemonUI Replacement |
---|---|
Load() | None (creating the class will automatically load the Scaleform) |
Dispose() | BigMessage.Dispose() |
ShowMissionPassedMessage(string, int) | new BigMessage("TITLE", "SUBTITLE", MessageType.MissionPassedOldGen) |
ShowColoredShard(string, string, HudColor, HudColor, int) | new BigMessage("TITLE", "SUBTITLE", 0, 1) (Zero is the first color, One is the second color) |
ShowOldMessage(string, int) | new BigMessage("TITLE", "SUBTITLE", MessageType.MissionPassedOldGen) |
ShowSimpleShard(string, string, int) | new BigMessage("TITLE", "SUBTITLE", MessageType.RankUp) |
ShowRankupMessage(string, string, int, int) | new BigMessage("TITLE", "SUBTITLE", "LEVEL", MessageType.CopsAndCrooks) (The level doesn't need to be an int) |
ShowWeaponPurchasedMessage(string, string, WeaponHash, int) | new BigMessage("TITLE", "SUBTITLE", WeaponHash.Unarmed) (WeaponHash.Unarmed is an example, you can use anything from the enum as far as I know) |
ShowMpMessageLarge(string, int) | new BigMessage("TITLE", MessageType.CenteredLarge) |
ShowCustomShard(string, params object[]) | None |