v3.1.0
Added
-
Context Menu. A new mouse driven menu with clickable options, sub menus and back navigation, registered once under an id and opened as often as you like. Options support icons, descriptions, images, progress bars, hover metadata,
disabledandreadOnlyrows, and can either run a callback, trigger a client or server event, or navigate into another registered menu. While a context menu is open the NUI takes mouse focus, so the player stands still, which is what you want when the mouse is needed. See Context Menu (client) and Context Menu (server).MSK.RegisterContext,MSK.ShowContext,MSK.UpdateContext,MSK.HideContext,MSK.GetOpenContext- Server side:
MSK.ShowContext(playerId, ...)andMSK.HideContext(playerId)
-
Menu. A new keyboard navigated list menu in the style of a classic NativeUI menu, with a highlighted row, side scroll values, checkboxes and progress bars. It deliberately does not take NUI focus: the arrow keys are read through the game controls and only those navigation controls are disabled, so the player can keep walking, driving and doing everything else while the menu is on screen. The whole state lives in Lua, so
onSelected,onSideScroll,onCheckandonClosealways receive the authoritative values. See Menu (client) and Menu (server).MSK.RegisterMenu,MSK.ShowMenu,MSK.UpdateMenu,MSK.HideMenu,MSK.GetOpenMenu- Server side:
MSK.ShowMenu(playerId, ...)andMSK.HideMenu(playerId)
-
Live updates for both menus.
MSK.UpdateContext(contextId, dataId, updatedData)andMSK.UpdateMenu(menuId, dataId, updatedData)address a single option through itsidand merge the given fields into it, so you only pass what actually changes. If exactly that menu is currently open, the UI refreshes live. This is the clean way to move a progress bar, relabel a row or disable an option without rebuilding and reopening the whole menu.
Both menus are written from scratch for msk_core and use the MSK design language (dark panel, green accent, bundled FontAwesome icons), matching the rest of the NUI.
Fixed
- A missing text could take down the whole NUI. The color code parser called
String.sliceon whatever it was handed, so a single call with aniltext, for exampleMSK.Notification('some text')where the second parameter is the message and was left out, threw inside React. Because the NUI has no error boundary, that one throw unmounted every component at once: notifications, input, numpad, progressbar, textui and the new menus all disappeared until the resource was restarted. The parser now returns an empty result forniland converts numbers to strings, so a bad call degrades to an empty label instead of killing the interface.
The NUI was rebuilt for this release, so make sure you replace the whole web/dist folder together with the Lua files.
Changed files
fxmanifest.lua
init/client.lua
init/server.lua
modules/Context/client.lua
modules/Context/server.lua
modules/Menu/client.lua
modules/Menu/server.lua
web/src/App.tsx
web/src/types.ts
web/src/index.css
web/src/lib/colorCodes.tsx
web/src/components/ContextMenu.tsx
web/src/components/ListMenu.tsx
web/src/components/menu/frame.tsx
web/src/dev/DevPanel.tsx
web/dist/index.html
web/dist/assets/index.js
web/dist/assets/index.css