clothe shop test, Report Error Msg
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user