old clotheshop

This commit is contained in:
kookroach
2021-04-04 19:37:15 +02:00
parent 8008139bc8
commit f7423b24fc

View File

@@ -56,7 +56,6 @@ export default function clotheShopList(globalData: IGlobalData) {
let categoryMenu = null; let categoryMenu = null;
let clotheMenus = []; let clotheMenus = [];
let categorysMenus = [];
@@ -177,22 +176,12 @@ export default function clotheShopList(globalData: IGlobalData) {
mainMenu.Item mainMenu.Item
// Fill it // Fill it
let clotheSubMenu;
for (const item of value) { for (const item of value) {
if (item.ComponentId == key) { if (item.ComponentId == key) {
var txData = getClothingName(key, item.ClotheId, gender); 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) { for (const x of txData) {
var itemDescription = (key === 11 ? mp.game.ui.getLabelText(x.undershirt[1].GXT) : " "); var itemDescription = (key === 11 ? mp.game.ui.getLabelText(x.undershirt[1].GXT) : " ");
//var itemDescription = (key === 11 ? x.undershirt[1].GXT + " - " + x.id: "Clothing item."); //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"}`); tempItem.SetRightLabel(`${item.Price > 0 ? `$${item.Price}` : "KOSTENLOS"}`);
clotheSubMenu.AddItem(tempItem); categoryMenu.AddItem(tempItem);
cloth.push(item); cloth.push(item);
tx.push(x); tx.push(x);
@@ -212,7 +201,7 @@ export default function clotheShopList(globalData: IGlobalData) {
} }
} }
clotheMenus.push({ clotheMenus.push({
menu: clotheSubMenu, menu: categoryMenu,
type: type, type: type,
slotIdx: Number(key), slotIdx: Number(key),
item: cloth, item: cloth,
@@ -320,13 +309,12 @@ export default function clotheShopList(globalData: IGlobalData) {
// Reset some variables // Reset some variables
clotheMenus = []; clotheMenus = [];
categorysMenus = [];
currentMenuIdx = -1; currentMenuIdx = -1;
menuTransition = false; menuTransition = false;
lastClothing = null; lastClothing = null;
// Create a new main menu // 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; mainMenu.Visible = true;
// Update clothingData // 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 // Main menu events
mainMenu.ItemSelect.on((selectedItem, itemIndex) => { 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 nextMenu = clotheMenus[itemIndex];
const slot = Number(nextMenu.slotIdx); const slot = Number(nextMenu.slotIdx);
@@ -443,19 +389,23 @@ export default function clotheShopList(globalData: IGlobalData) {
}; };
currentMenuIdx = itemIndex; currentMenuIdx = itemIndex;
categoryMenu.Visible = false; mainMenu.Visible = false;
nextMenu.menu.Visible = true; nextMenu.menu.Visible = true;
menuTransition = 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; currentMenuIdx = -1;
mainMenu.Visible = true; lastClothing = null;
}); });
} }
}); });