xmgamingmaster / ragemp-nativeui Goto Github PK
View Code? Open in Web Editor NEWNativeUI for RageMP written in Javascript
License: Apache License 2.0
NativeUI for RageMP written in Javascript
License: Apache License 2.0
i cant do pull requests so..
Here is my wiki if u can implement it to this git ^^
https://i.gyazo.com/8c3aeb7d9d7248703cff35c72eb394bd.mp4
Now, this is happening with binded menus.
The selected menu, seems to not be reset, but the active item goes to the top.
How I fixed it? By putting this.ParentMenu.RefreshIndex()
in GoBack()
.
Can u do if there is no desc then dont show the desc Window
categoryMenu.ItemSelect.on((item, index) => {
if(index == subCategoryTitles[i].length) {
categoryMenu.Close();
}
});
https://i.gyazo.com/000ca766e60be827a0270cc1acc50dfb.mp4
I use .Close() and not .Visible = false. If I close a menu the activeItem should reset... yes?
My fix:
Line 347 in df944ca
Add this.RefreshIndex();
after that, before .emit()
.
Come to think of it, it would be nice to have this optional.
Let's say you have a main menu and it has a child and a grandchild menus;
First, go to grandchild and then go back to main menu.
After that if you try to use the menuitem which is bound to child, it redirects you to grandchild instead of child menu
Line 678 in 9fda7f7
If I have a menu that opens another menu under menu.ItemSelect.on
, this issue causes SelectItem to be called twice. Thus selecting the item in the new menu also. This issue is also WORSE in conjunction with #6.
How I fixed it?
Create a variable, this._justSelected
. and toggle it to true when you just selected an item (also checkbox) (not needed under children menu changing), then check for it in ProcessControl
just like what you did with _justPressed
.
it didnt work
let ui = new Menu("Menu Admin", "Menu Adminitration", new Point(50, 50));
ui.Visible = false;
let ply = new Menu("Player", "Player Actions", new Point(50, 50));
ply.Visible = false;
let vehicle = new Menu("Vehicle", "Vehicle Actions", new Point(50, 50));
vehicle.Visible = false;
var PlyMenu = ui.AddItem(new UIMenuItem(
"Player",
"Catégorie Joueur"
));
var VehMenu = ui.AddItem(new UIMenuItem(
"Vehicle",
"Catégorie Vehicle"
));
ui.BindMenuToItem(ply, PlyMenu);
ui.BindMenuToItem(vehicle, VehMenu);```
^ why?
Is there a way to update subtitle of the menu other than recreating it?
menu.subtitle = "text"
doesn't work for a reason, because ResText elements are rendered only once.
or can you show me how can i re-render a menu in a proper way?
Got 99 errors after used tsc index.ts on nbativeui folder:
K:\Jogos\RAGEMP\server-files\app\client\nativeui>tsc index.ts index.ts:43:19 - error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the
lib` compiler option to es2015 or later.
43 public Children: Map<string, NativeUI>; // (UUIDV4, NativeUI)
~~~
index.ts:73:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
73 get CurrentSelection() {
~~~~~~~~~~~~~~~~
index.ts:76:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
76 set CurrentSelection(v) {
~~~~~~~~~~~~~~~~
index.ts:122:23 - error TS2583: Cannot find name 'Map'. Do you need to change your target library? Try changing the lib
compiler option to es2015 or later.
122 this.Children = new Map();
~~~
index.ts:165:22 - error TS2339: Property 'startsWith' does not exist on type 'string'.
165 if (this.subtitle.startsWith("~")) {
~~~~~~~~~~
index.ts:247:3 - error TS2304: Cannot find name 'mp'.
247 mp.events.add("render", this.render.bind(this));
~~
index.ts:355:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
355 set Subtitle(text: string) {
~~~~~~~~
index.ts:434:18 - error TS2304: Cannot find name 'mp'.
434 const cursor = mp.gui.cursor.position;
~~
index.ts:465:3 - error TS2304: Cannot find name 'mp'.
465 mp.game.invoke("0x54ce8ac98e120cab".toUpperCase(), "jamyfafi");
~~
index.ts:466:3 - error TS2304: Cannot find name 'mp'.
466 mp.game.ui.addTextComponentSubstringPlayerName(item.Text);
~~
index.ts:474:4 - error TS2304: Cannot find name 'mp'.
474 mp.game.invoke("0x85f061da64ed2f67".toUpperCase(), 0) * width * 0.35;
~~
index.ts:503:8 - error TS2304: Cannot find name 'mp'.
503 if (!mp.gui.cursor.visible) mp.gui.cursor.visible = true;
~~
index.ts:503:31 - error TS2304: Cannot find name 'mp'.
503 if (!mp.gui.cursor.visible) mp.gui.cursor.visible = true;
~~
index.ts:513:4 - error TS2304: Cannot find name 'mp'.
513 mp.game.cam.setGameplayCamRelativeHeading(
~~
index.ts:514:5 - error TS2304: Cannot find name 'mp'.
514 mp.game.cam.getGameplayCamRelativeHeading() + 5.0
~~
index.ts:516:4 - error TS2304: Cannot find name 'mp'.
516 mp.game.ui.setCursorSprite(6);
~~
index.ts:524:4 - error TS2304: Cannot find name 'mp'.
524 mp.game.cam.setGameplayCamRelativeHeading(
~~
index.ts:525:5 - error TS2304: Cannot find name 'mp'.
525 mp.game.cam.getGameplayCamRelativeHeading() - 5.0
~~
index.ts:527:4 - error TS2304: Cannot find name 'mp'.
527 mp.game.ui.setCursorSprite(7);
~~
index.ts:529:4 - error TS2304: Cannot find name 'mp'.
529 mp.game.ui.setCursorSprite(1);
~~
index.ts:541:6 - error TS2304: Cannot find name 'mp'.
541 mp.game.controls.isControlJustPressed(0, 24) ||
~~
index.ts:542:6 - error TS2304: Cannot find name 'mp'.
542 mp.game.controls.isDisabledControlJustPressed(0, 24)
~~
index.ts:607:5 - error TS2304: Cannot find name 'mp'.
607 mp.game.controls.isControlJustPressed(0, 24) ||
~~
index.ts:608:5 - error TS2304: Cannot find name 'mp'.
608 mp.game.controls.isDisabledControlJustPressed(0, 24)
~~
index.ts:624:5 - error TS2304: Cannot find name 'mp'.
624 mp.game.controls.isControlJustPressed(0, 24) ||
~~
index.ts:625:5 - error TS2304: Cannot find name 'mp'.
625 mp.game.controls.isDisabledControlJustPressed(0, 24)
~~
index.ts:641:7 - error TS2304: Cannot find name 'mp'.
641 if (mp.game.controls.isControlJustReleased(0, 177)) {
~~
index.ts:647:4 - error TS2304: Cannot find name 'mp'.
647 mp.game.controls.isControlPressed(0, 172) &&
~~
index.ts:656:14 - error TS2304: Cannot find name 'mp'.
656 } else if (mp.game.controls.isControlJustReleased(0, 172)) {
~~
index.ts:659:4 - error TS2304: Cannot find name 'mp'.
659 mp.game.controls.isControlPressed(0, 173) &&
~~
index.ts:668:14 - error TS2304: Cannot find name 'mp'.
668 } else if (mp.game.controls.isControlJustReleased(0, 173)) {
~~
index.ts:671:4 - error TS2304: Cannot find name 'mp'.
671 mp.game.controls.isControlPressed(0, 174) &&
~~
index.ts:677:14 - error TS2304: Cannot find name 'mp'.
677 } else if (mp.game.controls.isControlJustReleased(0, 174)) {
~~
index.ts:680:4 - error TS2304: Cannot find name 'mp'.
680 mp.game.controls.isControlPressed(0, 175) &&
~~
index.ts:686:14 - error TS2304: Cannot find name 'mp'.
686 } else if (mp.game.controls.isControlJustReleased(0, 175)) {
~~
index.ts:688:14 - error TS2304: Cannot find name 'mp'.
688 } else if (mp.game.controls.isControlJustPressed(0, 201)) {
~~
index.ts:928:1 - error TS2304: Cannot find name 'exports'.
928 exports.Menu = NativeUI;
~~~~~~~
index.ts:929:1 - error TS2304: Cannot find name 'exports'.
929 exports.UIMenuItem = UIMenuItem;
~~~~~~~
index.ts:930:1 - error TS2304: Cannot find name 'exports'.
930 exports.UIMenuListItem = UIMenuListItem;
~~~~~~~
index.ts:931:1 - error TS2304: Cannot find name 'exports'.
931 exports.UIMenuCheckboxItem = UIMenuCheckboxItem;
~~~~~~~
index.ts:932:1 - error TS2304: Cannot find name 'exports'.
932 exports.UIMenuSliderItem = UIMenuSliderItem;
~~~~~~~
index.ts:933:1 - error TS2304: Cannot find name 'exports'.
933 exports.BadgeStyle = BadgeStyle;
~~~~~~~
index.ts:934:1 - error TS2304: Cannot find name 'exports'.
934 exports.Point = Point;
~~~~~~~
index.ts:935:1 - error TS2304: Cannot find name 'exports'.
935 exports.Size = Size;
~~~~~~~
index.ts:936:1 - error TS2304: Cannot find name 'exports'.
936 exports.Color = Color;
~~~~~~~
index.ts:937:1 - error TS2304: Cannot find name 'exports'.
937 exports.Font = Font;
~~~~~~~
index.ts:938:1 - error TS2304: Cannot find name 'exports'.
938 exports.ItemsCollection = ItemsCollection;
~~~~~~~
index.ts:939:1 - error TS2304: Cannot find name 'exports'.
939 exports.ListItem = ListItem;
~~~~~~~
items/UIMenuCheckboxItem.ts:14:13 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
14 public get CheckedChanged() {
~~~~~~~~~~~~~~
items/UIMenuItem.ts:45:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
45 get Text() {
~~~~
items/UIMenuItem.ts:48:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
48 set Text(v) {
~~~~
items/UIMenuItem.ts:129:4 - error TS2304: Cannot find name 'mp'.
129 mp.events.call(this._event.event, this, ...this._event.args);
~~
items/UIMenuListItem.ts:26:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
26 get Collection() {
~~~~~~~~~~
items/UIMenuListItem.ts:29:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
29 set Collection(v) {
~~~~~~~~~~
items/UIMenuListItem.ts:34:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
34 set SelectedItem(v: ListItem) {
~~~~~~~~~~~~
items/UIMenuListItem.ts:35:31 - error TS2339: Property 'findIndex' does not exist on type 'ListItem[]'.
35 const idx = this.Collection.findIndex(li => li.Id === v.Id);
~~~~~~~~~
items/UIMenuListItem.ts:40:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
40 get SelectedItem() {
~~~~~~~~~~~~
items/UIMenuListItem.ts:44:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
44 get SelectedValue() {
~~~~~~~~~~~~~
items/UIMenuListItem.ts:58:13 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
58 public get ListChanged() {
~~~~~~~~~~~
items/UIMenuListItem.ts:64:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
64 get Index() {
~~~~~
items/UIMenuListItem.ts:70:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
70 set Index(value) {
~~~~~
items/UIMenuSliderItem.ts:21:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
21 get Index() {
~~~~~
items/UIMenuSliderItem.ts:24:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
24 set Index(value) {
~~~~~
modules/Container.ts:30:3 - error TS2304: Cannot find name 'mp'.
30 mp.game.graphics.drawRect(
~~
modules/Rectangle.ts:30:3 - error TS2304: Cannot find name 'mp'.
30 mp.game.graphics.drawRect(x, y, w, h, color.R, color.G, color.B, color.A);
~~
modules/ResRectangle.ts:34:3 - error TS2304: Cannot find name 'mp'.
34 mp.game.graphics.drawRect(x, y, w, h, color.R, color.G, color.B, color.A);
~~
modules/ResText.ts:77:3 - error TS2304: Cannot find name 'mp'.
77 mp.game.ui.setTextFont(parseInt(font));
~~
modules/ResText.ts:78:3 - error TS2304: Cannot find name 'mp'.
78 mp.game.ui.setTextScale(1.0, scale);
~~
modules/ResText.ts:79:3 - error TS2304: Cannot find name 'mp'.
79 mp.game.ui.setTextColour(color.R, color.G, color.B, color.A);
~~
modules/ResText.ts:82:4 - error TS2304: Cannot find name 'mp'.
82 mp.game.ui.setTextCentre(centered);
~~
modules/ResText.ts:84:20 - error TS2304: Cannot find name 'mp'.
84 if (dropShadow) mp.game.ui.setTextDropshadow(2, 0, 0, 0, 0);
~~
modules/ResText.ts:90:6 - error TS2304: Cannot find name 'mp'.
90 mp.game.ui.setTextCentre(true);
~~
modules/ResText.ts:93:6 - error TS2304: Cannot find name 'mp'.
93 mp.game.ui.setTextRightJustify(true);
~~
modules/ResText.ts:94:6 - error TS2304: Cannot find name 'mp'.
94 mp.game.ui.setTextWrap(0.0, x);
~~
modules/ResText.ts:100:5 - error TS2304: Cannot find name 'mp'.
100 mp.game.ui.setTextWrap(x, xsize);
~~
modules/ResText.ts:104:3 - error TS2304: Cannot find name 'mp'.
104 mp.game.ui.setTextEntry("STRING");
~~
modules/ResText.ts:106:3 - error TS2304: Cannot find name 'mp'.
106 mp.game.ui.drawText(x, y);
~~
modules/ResText.ts:113:4 - error TS2304: Cannot find name 'mp'.
113 mp.game.ui.addTextComponentSubstringPlayerName(substr);
~~
modules/Sprite.ts:33:3 - error TS2304: Cannot find name 'mp'.
33 mp.game.graphics.requestStreamedTextureDict(this._textureDict, true);
~~
modules/Sprite.ts:40:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
40 set TextureDict(v) {
~~~~~~~~~~~
modules/Sprite.ts:44:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
44 get TextureDict(): string {
~~~~~~~~~~~
modules/Sprite.ts:48:6 - error TS1056: Accessors are only available when targeting ECMAScript 5 and higher.
48 get IsTextureDictionaryLoaded() {
~~~~~~~~~~~~~~~~~~~~~~~~~
modules/Sprite.ts:49:10 - error TS2304: Cannot find name 'mp'.
49 return mp.game.graphics.hasStreamedTextureDictLoaded(this._textureDict);
~~
modules/Sprite.ts:70:9 - error TS2304: Cannot find name 'mp'.
70 if (!mp.game.graphics.hasStreamedTextureDictLoaded(textureDictionary))
~~
modules/Sprite.ts:71:5 - error TS2304: Cannot find name 'mp'.
71 mp.game.graphics.requestStreamedTextureDict(textureDictionary, true);
~~
modules/Sprite.ts:85:3 - error TS2304: Cannot find name 'mp'.
85 mp.game.graphics.drawSprite(
~~
modules/StringMeasurer.ts:6:3 - error TS2304: Cannot find name 'mp'.
6 mp.game.ui.setTextEntryForWidth("STRING");
~~
modules/StringMeasurer.ts:8:3 - error TS2304: Cannot find name 'mp'.
8 mp.game.ui.setTextFont(0);
~~
modules/StringMeasurer.ts:9:3 - error TS2304: Cannot find name 'mp'.
9 mp.game.ui.setTextScale(0.35, 0.35);
~~
modules/StringMeasurer.ts:10:10 - error TS2304: Cannot find name 'mp'.
10 return mp.game.ui.getTextScreenWidth(false);
~~
modules/Text.ts:34:3 - error TS2304: Cannot find name 'mp'.
34 mp.game.ui.setTextFont(parseInt(font));
~~
modules/Text.ts:35:3 - error TS2304: Cannot find name 'mp'.
35 mp.game.ui.setTextScale(scale, scale);
~~
modules/Text.ts:36:3 - error TS2304: Cannot find name 'mp'.
36 mp.game.ui.setTextColour(color.R, color.G, color.B, color.A);
~~
modules/Text.ts:37:3 - error TS2304: Cannot find name 'mp'.
37 mp.game.ui.setTextCentre(centered);
~~
modules/Text.ts:38:3 - error TS2304: Cannot find name 'mp'.
38 mp.game.ui.setTextEntry("STRING");
~~
modules/Text.ts:40:3 - error TS2304: Cannot find name 'mp'.
40 mp.game.ui.drawText(x, y);
~~
modules/Text.ts:44:1 - error TS2304: Cannot find name 'exports'.
44 exports = Text;
utils/Common.ts:3:3 - error TS2304: Cannot find name 'mp'.
3 mp.game.audio.playSound(-1, audioName, audioRef, false, 0, true);
~~
utils/Screen.ts:1:20 - error TS2304: Cannot find name 'mp'.
1 const gameScreen = mp.game.graphics.getScreenActiveResolution(0, 0);
~~
Found 99 errors.`
My folder structure is:
- server-files
-- app
--- client
---- nativeui
I imported on the file:
server-files/app/client/Script\index.js :
`const NativeUI = require("../nativeui/index.js");`
Go to cmd with adm permission and used:
server-files/app/client/nativeui> tsc indes.ts
And after:
server-files> npm run build
The menu just don't shows up.
How fix it, please?
Thank you!!!
I think it will be a good feature.
Hi, here's an example of a basic menu with a list item.
var menu = new Menu("Menu", "", new Point(50, 50));
var list = new ItemsCollection(["0", "1", "2", "3", "4", "5"]);
var item = new UIMenuListItem("Item:", "", list, 0);
SubMenu.AddItem(item);
It doesn't update the ui when i try to change the selected item with examples below;
item.SelectedItem = item.Collection[3];
item.SelectedValue = "3";
Can you add a function to update selected item for UIMenuListItem?
Hey there. I want my UIMenuItem to have a right label of the christian cross, but I can't get it to work. It always displays as tofu ingame (the outlined box for when there's an issue with the character)
I already tried both charItem.SetRightLabel("✝");
and charItem.SetRightLabel("\u271d");
(I don't know why GitHub replaced that symbol with an emoji, I didn't use an emoji obviously)
Here's a test script to see what's wrong
https://pastebin.com/7tx3ghsv (press H to open Menu)
But if you create the child menu before the parent, it works fine.
Hello I need an answer and I can not find in which folder I should install the Libraries NativeUI on my server I thank you in advance.
Line 843 in df944ca
It just throws an error with that line.. maybe something else can be done instead?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.