From 066c47d209778ec3f4f4abf0ba8e167c80bacd6a Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sun, 4 Apr 2021 19:12:55 +0200 Subject: [PATCH 1/3] fix --- ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts index 4aef566b..a34b8665 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts +++ b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts @@ -183,8 +183,7 @@ export default function clotheShopList(globalData: IGlobalData) { var txData = getClothingName(key, item.ClotheId, gender); - mp.gui.chat.push('Key ' + key); - mp.gui.chat.push(item); + if (txData != undefined && txData.length > 0) { categoryMenu.AddItem(new UIMenuItem(mp.game.ui.getLabelText(txData[0].data[0].GXT), "")); @@ -419,7 +418,7 @@ export default function clotheShopList(globalData: IGlobalData) { nextMenu.Visible = true; menuTransition = true; - submenuItemChangeHandler(nextMenu.menu.CurrentSelection); + // submenuItemChangeHandler(nextMenu.menu.CurrentSelection); }); mainMenu.MenuClose.on(() => { @@ -449,7 +448,7 @@ export default function clotheShopList(globalData: IGlobalData) { nextMenu.menu.Visible = true; menuTransition = true; - //submenuItemChangeHandler(nextMenu.menu.CurrentSelection); + submenuItemChangeHandler(nextMenu.menu.CurrentSelection); }); categoryMenu.MenuClose.on(() => { From 8008139bc8f227ee3a60be17793eaed7b275ea4d Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sun, 4 Apr 2021 19:18:41 +0200 Subject: [PATCH 2/3] try fix --- .../Interaction/clothes/ClotheShop.ts | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts index a34b8665..260767f2 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts +++ b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts @@ -209,16 +209,15 @@ export default function clotheShopList(globalData: IGlobalData) { cloth.push(item); tx.push(x); } - clotheMenus.push({ - menu: clotheSubMenu, - type: type, - slotIdx: Number(key), - item: cloth, - texture: tx - }); } } - + clotheMenus.push({ + menu: clotheSubMenu, + type: type, + slotIdx: Number(key), + item: cloth, + texture: tx + }); } From f7423b24fc6037048d2eaf65ba94de30faa96e39 Mon Sep 17 00:00:00 2001 From: kookroach <62265045+kookroach@users.noreply.github.com> Date: Sun, 4 Apr 2021 19:37:15 +0200 Subject: [PATCH 3/3] old clotheshop --- .../Interaction/clothes/ClotheShop.ts | 72 +++---------------- 1 file changed, 11 insertions(+), 61 deletions(-) diff --git a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts index 260767f2..9ad6898c 100644 --- a/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts +++ b/ReallifeGamemode.Client/Interaction/clothes/ClotheShop.ts @@ -56,7 +56,6 @@ export default function clotheShopList(globalData: IGlobalData) { let categoryMenu = null; let clotheMenus = []; - let categorysMenus = []; @@ -177,22 +176,12 @@ export default function clotheShopList(globalData: IGlobalData) { mainMenu.Item // Fill it - let clotheSubMenu; for (const item of value) { if (item.ComponentId == key) { var txData = getClothingName(key, item.ClotheId, gender); - - if (txData != undefined && txData.length > 0) { - categoryMenu.AddItem(new UIMenuItem(mp.game.ui.getLabelText(txData[0].data[0].GXT), "")); - clotheSubMenu = new UIMenu(" ", mp.game.ui.getLabelText(txData[0].data[0].GXT), new Point(0, 0), bannerSprite.library, bannerSprite.texture); - clotheSubMenu.Visible = false; - categorysMenus.push(categoryMenu); - - } - for (const x of txData) { var itemDescription = (key === 11 ? mp.game.ui.getLabelText(x.undershirt[1].GXT) : " "); //var itemDescription = (key === 11 ? x.undershirt[1].GXT + " - " + x.id: "Clothing item."); @@ -204,7 +193,7 @@ export default function clotheShopList(globalData: IGlobalData) { tempItem.SetRightLabel(`${item.Price > 0 ? `$${item.Price}` : "KOSTENLOS"}`); - clotheSubMenu.AddItem(tempItem); + categoryMenu.AddItem(tempItem); cloth.push(item); tx.push(x); @@ -212,7 +201,7 @@ export default function clotheShopList(globalData: IGlobalData) { } } clotheMenus.push({ - menu: clotheSubMenu, + menu: categoryMenu, type: type, slotIdx: Number(key), item: cloth, @@ -320,13 +309,12 @@ export default function clotheShopList(globalData: IGlobalData) { // Reset some variables clotheMenus = []; - categorysMenus = []; currentMenuIdx = -1; menuTransition = false; lastClothing = null; // Create a new main menu - mainMenu = new UIMenu("", "SELECT A CATEGORY", new Point(0, 0), bannerSprite.library, bannerSprite.texture); + mainMenu = new UIMenu("", "Wählen Sie eine Kategorie", new Point(0, 0), bannerSprite.library, bannerSprite.texture); mainMenu.Visible = true; // Update clothingData @@ -385,51 +373,9 @@ export default function clotheShopList(globalData: IGlobalData) { }); } - for (const item of categorysMenus) { - // Preview hovering item - //item.menu.IndexChange.on(submenuItemChangeHandler); - - // Reset preview when player backs out of category menu - item.MenuClose.on(() => { - resetPreview(); - - currentMenuIdx = -1; - mainMenu.Visible = true; - }); - } // Main menu events mainMenu.ItemSelect.on((selectedItem, itemIndex) => { - const nextMenu = categorysMenus[itemIndex]; - const slot = Number(nextMenu.slotIdx); - - lastClothing = { - type: nextMenu.type, - slotIdx: slot, - drawable: (nextMenu.type === "props" ? localPlayer.getPropIndex(slot) : localPlayer.getDrawableVariation(slot)), - texture: (nextMenu.type === "props" ? localPlayer.getPropTextureIndex(slot) : localPlayer.getTextureVariation(slot)), - undershirt: [localPlayer.getDrawableVariation(8), localPlayer.getTextureVariation(8)], - torso: localPlayer.getDrawableVariation(3) - }; - - currentMenuIdx = itemIndex; - mainMenu.Visible = false; - nextMenu.Visible = true; - menuTransition = true; - - // submenuItemChangeHandler(nextMenu.menu.CurrentSelection); - }); - - mainMenu.MenuClose.on(() => { - globalData.InMenu = false; - mp.gui.chat.show(true); - - currentMenuIdx = -1; - lastClothing = null; - }); - - // Sub menu events - categoryMenu.ItemSelect.on((selectedItem, itemIndex) => { const nextMenu = clotheMenus[itemIndex]; const slot = Number(nextMenu.slotIdx); @@ -443,19 +389,23 @@ export default function clotheShopList(globalData: IGlobalData) { }; currentMenuIdx = itemIndex; - categoryMenu.Visible = false; + mainMenu.Visible = false; nextMenu.menu.Visible = true; menuTransition = true; - submenuItemChangeHandler(nextMenu.menu.CurrentSelection); + submenuItemChangeHandler(nextMenu.menu.CurrentSelection); }); - categoryMenu.MenuClose.on(() => { + mainMenu.MenuClose.on(() => { + globalData.InMenu = false; + mp.gui.chat.show(true); + currentMenuIdx = -1; - mainMenu.Visible = true; + lastClothing = null; }); + } });