old clotheshop
This commit is contained in:
@@ -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;
|
||||
});
|
||||
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user