From 11646f1e2a3e686de3b3687702e9a86252aafd2e Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sun, 4 Apr 2021 17:55:39 +0200 Subject: [PATCH] clothe shop test, Report Error Msg --- .../Interaction/clothes/ClotheShop.ts | 30 ++++++++----------- ReallifeGamemode.Server/Report/Report.cs | 1 + 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts index 5f02e815..c56dca23 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts +++ b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts @@ -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(); }); diff --git a/ReallifeGamemode.Server/Report/Report.cs b/ReallifeGamemode.Server/Report/Report.cs index d2e17181..7d42f5ea 100644 --- a/ReallifeGamemode.Server/Report/Report.cs +++ b/ReallifeGamemode.Server/Report/Report.cs @@ -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();