Change Nametag
Clothes test
This commit is contained in:
@@ -53,7 +53,11 @@ export default function clotheShopList(globalData: IGlobalData) {
|
||||
var myVar;
|
||||
|
||||
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
|
||||
@@ -148,7 +152,6 @@ export default function clotheShopList(globalData: IGlobalData) {
|
||||
}
|
||||
|
||||
function addClothingItems(type, bannerSprite, key, value, gender) {
|
||||
var categoryMenu;
|
||||
var cloth = [];
|
||||
var tx = [];
|
||||
|
||||
@@ -172,7 +175,7 @@ export default function clotheShopList(globalData: IGlobalData) {
|
||||
mainMenu.Item
|
||||
|
||||
// Fill it
|
||||
let clotheUpperMenu;
|
||||
let clotheSubMenu;
|
||||
for (const item of value) {
|
||||
if (item.ComponentId == key) {
|
||||
|
||||
@@ -183,8 +186,8 @@ export default function clotheShopList(globalData: IGlobalData) {
|
||||
|
||||
if (txData != undefined && txData.length > 0) {
|
||||
categoryMenu.AddItem(new UIMenuItem(mp.game.ui.getLabelText(txData[0].data[0].GXT), ""));
|
||||
clotheUpperMenu = new UIMenu(" ", mp.game.ui.getLabelText(txData[0].data[0].GXT), new Point(0, 0), bannerSprite.library, bannerSprite.texture);
|
||||
clotheUpperMenu.Visible = false;
|
||||
clotheSubMenu = new UIMenu(" ", mp.game.ui.getLabelText(txData[0].data[0].GXT), new Point(0, 0), bannerSprite.library, bannerSprite.texture);
|
||||
clotheSubMenu.Visible = false;
|
||||
|
||||
}
|
||||
|
||||
@@ -199,7 +202,7 @@ export default function clotheShopList(globalData: IGlobalData) {
|
||||
|
||||
tempItem.SetRightLabel(`${item.Price > 0 ? `$${item.Price}` : "KOSTENLOS"}`);
|
||||
|
||||
clotheUpperMenu.AddItem(tempItem);
|
||||
clotheSubMenu.AddItem(tempItem);
|
||||
|
||||
cloth.push(item);
|
||||
tx.push(x);
|
||||
@@ -214,6 +217,13 @@ export default function clotheShopList(globalData: IGlobalData) {
|
||||
item: cloth,
|
||||
texture: tx
|
||||
});
|
||||
clotheMenus.push({
|
||||
menu: clotheSubMenu,
|
||||
type: type,
|
||||
slotIdx: Number(key),
|
||||
item: cloth,
|
||||
texture: tx
|
||||
});
|
||||
}
|
||||
|
||||
function submenuItemChangeHandler(newIndex) {
|
||||
@@ -407,6 +417,35 @@ export default function clotheShopList(globalData: IGlobalData) {
|
||||
currentMenuIdx = -1;
|
||||
lastClothing = null;
|
||||
});
|
||||
|
||||
// Sub menu events
|
||||
categoryMenu.ItemSelect.on((selectedItem, itemIndex) => {
|
||||
const nextMenu = clotheMenus[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.menu.Visible = true;
|
||||
menuTransition = true;
|
||||
|
||||
submenuItemChangeHandler(nextMenu.menu.CurrentSelection);
|
||||
});
|
||||
|
||||
categoryMenu.MenuClose.on(() => {
|
||||
currentMenuIdx = -1;
|
||||
mainMenu.Visible = true;
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user