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) {
factionItem.SetRightLabel(faction);
menu.AddItem(factionItem);
menu.BindMenuToItem(getFactionMenu(faction), factionItem);
menu.BindMenuToItem(getFactionMenu(faction, menu), factionItem);
}
if (group) {
@@ -43,14 +43,23 @@ export default function (globalData: GlobalData) {
var items: Array<string> = new Array<string>();
if (factionInvite) items.push("Fraktion");
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;
mp.gui.chat.show(false);
globalData.Interaction = true;
menu.ItemSelect.on((item, index) => {
if (item === acceptItem) {
mp.events.callRemote("CLIENT:InteractionMenu_AcceptInvite", acceptItem.SelectedValue);
}
});
menu.MenuClose.on(() => {
globalData.Interaction = false;
mp.gui.chat.show(true);
@@ -92,7 +101,7 @@ export default function (globalData: GlobalData) {
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);
factionMenu.AddItem(new UIMenuItem("Spieler einladen"));
factionMenu.AddItem(new UIMenuItem("Spieler rauswerfen"));
@@ -104,6 +113,7 @@ export default function (globalData: GlobalData) {
input.show();
input.getValue(name => {
mp.events.callRemote("CLIENT:InteractionMenu_InviteFaction", name);
parentMenu.Close();
});
} else if (index === 1) { // Uninviten
}

View File

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

View File

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