clothe shop test, Report Error Msg

This commit is contained in:
kookroach
2021-04-04 17:55:39 +02:00
parent 58dd14b816
commit 11646f1e2a
2 changed files with 13 additions and 18 deletions

View File

@@ -55,9 +55,9 @@ export default function clotheShopList(globalData: IGlobalData) {
let mainMenu = null;
let categoryMenu = null;
let categoryMenus = [];
let clotheMenus = [];
let clothingData = [];
let currentMenuIdx = -1;
let menuTransition = false; // workaround for ItemSelect event being called twice between menu transitions
@@ -155,9 +155,9 @@ export default function clotheShopList(globalData: IGlobalData) {
var cloth = [];
var tx = [];
if (Object.keys(categoryMenus).length > 0) {
for (var i = 0; i < categoryMenus.length; i++) {
if (categoryMenus[i].slotIdx == key) {
if (Object.keys(clotheMenus).length > 0) {
for (var i = 0; i < clotheMenus.length; i++) {
if (clotheMenus[i].slotIdx == key) {
return;
}
}
@@ -210,13 +210,6 @@ export default function clotheShopList(globalData: IGlobalData) {
}
}
categoryMenus.push({
menu: categoryMenu,
type: type,
slotIdx: Number(key),
item: cloth,
texture: tx
});
clotheMenus.push({
menu: clotheSubMenu,
type: type,
@@ -224,10 +217,11 @@ export default function clotheShopList(globalData: IGlobalData) {
item: cloth,
texture: tx
});
}
function submenuItemChangeHandler(newIndex) {
const currentMenu = categoryMenus[currentMenuIdx];
const currentMenu = clotheMenus[currentMenuIdx];
const currentItem = currentMenu.item[newIndex];
const currentTexture = currentMenu.texture[newIndex].id;
//const currentItem = clothingData[currentMenu.type][currentMenu.slotIdx][newIndex];
@@ -284,7 +278,7 @@ export default function clotheShopList(globalData: IGlobalData) {
if (dist > 3) {
clearInterval(myVar);
resetPreview();
if (currentMenuIdx !== -1) categoryMenus[currentMenuIdx].menu.Close();
if (currentMenuIdx !== -1) clotheMenus[currentMenuIdx].menu.Close();
if (mainMenu && mainMenu.Visible) mainMenu.Close();
}
}
@@ -323,7 +317,7 @@ export default function clotheShopList(globalData: IGlobalData) {
mp.gui.chat.show(false);
// Reset some variables
categoryMenus = [];
clotheMenus = [];
currentMenuIdx = -1;
menuTransition = false;
lastClothing = null;
@@ -346,7 +340,7 @@ export default function clotheShopList(globalData: IGlobalData) {
// for (const [key, value] of Object.entries(clothingData.props)) addClothingItems("props", bannerSprite, key, value);
// Submenu events
for (const item of categoryMenus) {
for (const item of clotheMenus) {
// Preview hovering item
item.menu.IndexChange.on(submenuItemChangeHandler);
@@ -357,7 +351,7 @@ export default function clotheShopList(globalData: IGlobalData) {
return;
}
const currentMenu = categoryMenus[currentMenuIdx];
const currentMenu = clotheMenus[currentMenuIdx];
const currentItem = currentMenu.item[itemIndex];
const currentTexture = currentMenu.texture[itemIndex].id;
if (currentMenu.slotIdx == 11) {
@@ -390,7 +384,7 @@ export default function clotheShopList(globalData: IGlobalData) {
// Main menu events
mainMenu.ItemSelect.on((selectedItem, itemIndex) => {
const nextMenu = categoryMenus[itemIndex];
const nextMenu = clotheMenus[itemIndex];
const slot = Number(nextMenu.slotIdx);
lastClothing = {
@@ -460,7 +454,7 @@ export default function clotheShopList(globalData: IGlobalData) {
});
mp.events.add("clothesMenu:close", () => {
if (currentMenuIdx !== -1) categoryMenus[currentMenuIdx].menu.Close();
if (currentMenuIdx !== -1) clotheMenus[currentMenuIdx].menu.Close();
if (mainMenu && mainMenu.Visible) mainMenu.Close();
});

View File

@@ -35,6 +35,7 @@ namespace ReallifeGamemode.Server.Report
if (listReports.Count == 0)
{
ChatService.ErrorMessage(client, "Im Moment gibt es keine Tickets.");
return;
}
User user = client.GetUser();