update NativeUI, close interaction menu when submitting input field

This commit is contained in:
hydrant
2019-05-08 17:33:38 +02:00
parent 07a7f25730
commit e28003ea39
3 changed files with 31 additions and 32 deletions

View File

@@ -31,7 +31,7 @@ export default function (globalData: GlobalData) {
if (faction) { if (faction) {
factionItem.SetRightLabel(faction); factionItem.SetRightLabel(faction);
menu.AddItem(factionItem); menu.AddItem(factionItem);
menu.BindMenuToItem(getFactionMenu(faction), factionItem); menu.BindMenuToItem(getFactionMenu(faction, menu), factionItem);
} }
if (group) { if (group) {
@@ -43,14 +43,23 @@ export default function (globalData: GlobalData) {
var items: Array<string> = new Array<string>(); var items: Array<string> = new Array<string>();
if (factionInvite) items.push("Fraktion"); if (factionInvite) items.push("Fraktion");
if (groupInvite) items.push("Gruppe"); if (groupInvite) items.push("Gruppe");
var acceptItem = new UIMenuListItem("Einladung annehmen", "", new ItemsCollection(items)); var acceptItem: NativeUI.UIMenuListItem;
if (items.length !== 0) menu.AddItem(acceptItem); if (items.length !== 0) {
acceptItem = new UIMenuListItem("Einladung annehmen", "", new ItemsCollection(items));
menu.AddItem(acceptItem);
}
menu.Visible = true; menu.Visible = true;
mp.gui.chat.show(false); mp.gui.chat.show(false);
globalData.Interaction = true; globalData.Interaction = true;
menu.ItemSelect.on((item, index) => {
if (item === acceptItem) {
mp.events.callRemote("CLIENT:InteractionMenu_AcceptInvite", acceptItem.SelectedValue);
}
});
menu.MenuClose.on(() => { menu.MenuClose.on(() => {
globalData.Interaction = false; globalData.Interaction = false;
mp.gui.chat.show(true); mp.gui.chat.show(true);
@@ -92,7 +101,7 @@ export default function (globalData: GlobalData) {
return accountMenu; return accountMenu;
} }
function getFactionMenu(faction: string): NativeUI.Menu { function getFactionMenu(faction: string, parentMenu: NativeUI.Menu): NativeUI.Menu {
var factionMenu = new NativeUI.Menu("Fraktion", faction, new Point(50, 50), null, null); var factionMenu = new NativeUI.Menu("Fraktion", faction, new Point(50, 50), null, null);
factionMenu.AddItem(new UIMenuItem("Spieler einladen")); factionMenu.AddItem(new UIMenuItem("Spieler einladen"));
factionMenu.AddItem(new UIMenuItem("Spieler rauswerfen")); factionMenu.AddItem(new UIMenuItem("Spieler rauswerfen"));
@@ -104,6 +113,7 @@ export default function (globalData: GlobalData) {
input.show(); input.show();
input.getValue(name => { input.getValue(name => {
mp.events.callRemote("CLIENT:InteractionMenu_InviteFaction", name); mp.events.callRemote("CLIENT:InteractionMenu_InviteFaction", name);
parentMenu.Close();
}); });
} else if (index === 1) { // Uninviten } else if (index === 1) { // Uninviten
} }

View File

@@ -349,8 +349,9 @@
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==" "integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ=="
}, },
"NativeUI": { "NativeUI": {
"version": "git+https://github.com/sprayzcs/RageMP-NativeUI.git#0ca40b56d9124056ceb9ca016d209aa4e3ecfeb3", "version": "https://github.com/sprayzcs/RageMP-NativeUI/tarball/master",
"from": "git+https://github.com/sprayzcs/RageMP-NativeUI.git#master" "integrity": "sha512-iG7Cym2lnzuiwNBY6ATvSoaQ5Pfs4p8hW0s2EYL7MhPYrCpVhr/5zZOvQHijTV4gv5bipPtnuT0c1k4pkrlFZA==",
"dev": true
}, },
"acorn": { "acorn": {
"version": "6.1.1", "version": "6.1.1",
@@ -1565,13 +1566,11 @@
}, },
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@@ -1584,18 +1583,15 @@
}, },
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@@ -1698,8 +1694,7 @@
}, },
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@@ -1709,7 +1704,6 @@
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@@ -1722,20 +1716,17 @@
"minimatch": { "minimatch": {
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
}, },
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.3.5", "version": "2.3.5",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@@ -1752,7 +1743,6 @@
"mkdirp": { "mkdirp": {
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@@ -1825,8 +1815,7 @@
}, },
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@@ -1836,7 +1825,6 @@
"once": { "once": {
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@@ -1942,7 +1930,6 @@
"string-width": { "string-width": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",

View File

@@ -3,13 +3,11 @@
"version": "1.0.0", "version": "1.0.0",
"devDependencies": { "devDependencies": {
"@types/ragemp-c": "git+https://github.com/sprayzcs/types-ragemp-c.git#master", "@types/ragemp-c": "git+https://github.com/sprayzcs/types-ragemp-c.git#master",
"NativeUI": "https://github.com/sprayzcs/RageMP-NativeUI/tarball/master",
"copy-webpack-plugin": "^5.0.1", "copy-webpack-plugin": "^5.0.1",
"uglifyjs-webpack-plugin": "^2.1.2" "uglifyjs-webpack-plugin": "^2.1.2",
},
"dependencies": {
"@babel/core": "^7.3.4", "@babel/core": "^7.3.4",
"@types/node": "^11.9.5", "@types/node": "^11.9.5",
"NativeUI": "git+https://github.com/sprayzcs/RageMP-NativeUI.git#master",
"babel-loader": "^8.0.5", "babel-loader": "^8.0.5",
"ts-loader": "^5.3.3", "ts-loader": "^5.3.3",
"typescript": "^3.3.3333", "typescript": "^3.3.3333",
@@ -19,6 +17,10 @@
"scripts": { "scripts": {
"watch": "webpack --watch --config webpack.config.development.js", "watch": "webpack --watch --config webpack.config.development.js",
"build:server": "webpack --config webpack.config.build.js" "build:server": "webpack --config webpack.config.build.js"
},
"-vs-binding": {
"ProjectOpened": [
"watch"
]
} }
, "-vs-binding":{"ProjectOpened":["watch"]}
} }