From 0aacfdd818d75e7a2f371f3b744c077e99a39fba Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 17 Oct 2022 15:53:40 -0500 Subject: [PATCH] GUI fixes --- scripts/client/gui.js | 48 ++++++++++++++++++++++++ scripts/client/gui/games/5-card-poker.js | 9 ----- scripts/client/gui/games/5cardpoker.js | 40 ++++++++++++++++++++ scripts/client/gui/games/blackjack.js | 4 +- scripts/client/gui/inventory.js | 45 ++++++++++++++++++++++ scripts/client/gui/inventorybulk.js | 45 ++++++++++++++++++++++ scripts/client/gui/localechooser.js | 5 +-- 7 files changed, 181 insertions(+), 15 deletions(-) delete mode 100644 scripts/client/gui/games/5-card-poker.js create mode 100644 scripts/client/gui/games/5cardpoker.js create mode 100644 scripts/client/gui/inventory.js create mode 100644 scripts/client/gui/inventorybulk.js diff --git a/scripts/client/gui.js b/scripts/client/gui.js index 2093a6d6..f5c4b549 100644 --- a/scripts/client/gui.js +++ b/scripts/client/gui.js @@ -62,6 +62,14 @@ function initGUI() { initResetPasswordGUI(); initChangePasswordGUI(); initLocaleChooserGUI(); + initInventoryGUI(); + initInventoryBulkGUI(); + //initClanManagerGUI(); + //initBusinessManagerGUI(); + //initHouseManagerGUI(); + initFiveCardPokerGUI(); + initBettingGUI(); + initBlackJackGUI(); closeAllWindows(); guiReady = true; @@ -87,6 +95,14 @@ function closeAllWindows() { passwordReset.window.shown = false; passwordChange.window.shown = false; localeChooser.window.shown = false; + //houseManager.window.shown = false; + //businessManager.window.shown = false; + //clanManager.window.shown = false; + inventoryGUI.window.shown = false; + inventoryBulkGUI.window.shown = false; + bettingGUI.window.shown = false; + blackJackGUI.window.shown = false; + fiveCardPokerGUI.window.shown = false; mexui.setInput(false); mexui.focusedControl = false; @@ -155,6 +171,38 @@ function isAnyGUIActive() { return true; } + //if (clanManager.window.shown == true) { + // return true; + //} + + //if (businessManager.window.shown == true) { + // return true; + //} + + //if (houseManager.window.shown == true) { + // return true; + //} + + if (inventorGUI.window.shown == true) { + return true; + } + + if (inventoryBulkGUI.window.shown == true) { + return true; + } + + if (bettingGUI.window.shown == true) { + return true; + } + + if (blackJackGUI.window.shown == true) { + return true; + } + + if (fiveCardPokerGUI.window.shown == true) { + return true; + } + return false; } diff --git a/scripts/client/gui/games/5-card-poker.js b/scripts/client/gui/games/5-card-poker.js deleted file mode 100644 index d254829b..00000000 --- a/scripts/client/gui/games/5-card-poker.js +++ /dev/null @@ -1,9 +0,0 @@ -// =========================================================================== -// Asshat Gaming Roleplay -// https://github.com/VortrexFTW/agrp_main -// (c) 2022 Asshat Gaming -// =========================================================================== -// FILE: 5cardpoker.js -// DESC: Provides 5-card poker games GUI -// TYPE: Client (JavaScript) -// =========================================================================== \ No newline at end of file diff --git a/scripts/client/gui/games/5cardpoker.js b/scripts/client/gui/games/5cardpoker.js new file mode 100644 index 00000000..47ecbfa0 --- /dev/null +++ b/scripts/client/gui/games/5cardpoker.js @@ -0,0 +1,40 @@ +// =========================================================================== +// Asshat Gaming Roleplay +// https://github.com/VortrexFTW/agrp_main +// (c) 2022 Asshat Gaming +// =========================================================================== +// FILE: 5cardpoker.js +// DESC: Provides 5-card poker games GUI +// TYPE: Client (JavaScript) +// =========================================================================== + +let fiveCardPokerGUI = { + window: null, +} + +function initFiveCardPokerGUI() { + // Render a five card poker game in MexUI + //logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating five-card poker GUI ...`); + fiveCardPokerGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Five Card Poker', { + main: { + backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0), + }, + title: { + textSize: 11.0, + textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255), + backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha), + }, + icon: { + textSize: 0.0, + textColour: toColour(0, 0, 0, 0), + backgroundColour: toColour(0, 0, 0, 0), + }, + }); + fiveCardPokerGUI.window.titleBarShown = false; + + fiveCardPokerGUI.window.shown = false; + + logToConsole(LOG_DEBUG, `[AGRP.GUI] Created five card poker GUI`); +} + +// =========================================================================== \ No newline at end of file diff --git a/scripts/client/gui/games/blackjack.js b/scripts/client/gui/games/blackjack.js index ee0e7ad3..5d65747a 100644 --- a/scripts/client/gui/games/blackjack.js +++ b/scripts/client/gui/games/blackjack.js @@ -23,7 +23,7 @@ let dealerCards = []; function initBlackJackGUI() { // Render a blackjack game in MexUI - //logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating blackjack GUI ...`); + logToConsole(LOG_DEBUG, `[AGRP.GUI] Creating blackjack GUI ...`); blackJackGUI.window = mexui.window(game.width / 2 - 200, game.height - 150, 400, 400, 'Blackjack', { main: { backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], 0), @@ -43,7 +43,7 @@ function initBlackJackGUI() { blackJackGUI.window.shown = false; - //logToConsole(LOG_DEBUG, `[AGRP.GUI] Created blackjack GUI`); + logToConsole(LOG_DEBUG, `[AGRP.GUI] Created blackjack GUI`); } // =========================================================================== \ No newline at end of file diff --git a/scripts/client/gui/inventory.js b/scripts/client/gui/inventory.js new file mode 100644 index 00000000..fcfd1a45 --- /dev/null +++ b/scripts/client/gui/inventory.js @@ -0,0 +1,45 @@ +// =========================================================================== +// Asshat Gaming Roleplay +// https://github.com/VortrexFTW/agrp_main +// (c) 2022 Asshat Gaming +// =========================================================================== +// FILE: inventory.js +// DESC: Provides inventory dialog box GUI +// TYPE: Client (JavaScript) +// =========================================================================== + +let inventoryGUI = [ + { + window: null, + }, + { + window: null, + }, +]; + +// =========================================================================== + +function initInventoryGUI() { + +} + +// =========================================================================== + +function closeAllInventoryGUI() { + logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all inventory GUI`); + for (let i in inventoryGUI) { + inventoryGUI[i].window.shown = false; + } + mexui.setInput(false); +} + +// =========================================================================== + +function showInventoryGUI(inventoryIndex, items) { + closeAllWindows(); + logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing inventory window. Index: ${inventoryIndex}`); + inventoryGUI[inventoryIndex].window.shown = true; + mexui.setInput(true); +} + +// =========================================================================== \ No newline at end of file diff --git a/scripts/client/gui/inventorybulk.js b/scripts/client/gui/inventorybulk.js new file mode 100644 index 00000000..d311a5d9 --- /dev/null +++ b/scripts/client/gui/inventorybulk.js @@ -0,0 +1,45 @@ +// =========================================================================== +// Asshat Gaming Roleplay +// https://github.com/VortrexFTW/agrp_main +// (c) 2022 Asshat Gaming +// =========================================================================== +// FILE: inventorybulk.js +// DESC: Provides bulk inventory box GUI +// TYPE: Client (JavaScript) +// =========================================================================== + +let inventoryBulkGUI = [ + { + window: null, + }, + { + window: null, + }, +]; + +// =========================================================================== + +function initInventoryBulkGUI() { + +} + +// =========================================================================== + +function closeAllInventoryBulkGUI() { + logToConsole(LOG_DEBUG, `[AGRP.GUI] Closing all bulk inventory GUI`); + for (let i in inventoryBulkGUI) { + inventoryBulkGUI[i].window.shown = false; + } + mexui.setInput(false); +} + +// =========================================================================== + +function showInventoryBulkGUI(inventoryIndex, items) { + closeAllWindows(); + logToConsole(LOG_DEBUG, `[AGRP.GUI] Showing bulk inventory window. Index: ${inventoryIndex}`); + inventoryBulkGUI[inventoryIndex].window.shown = true; + mexui.setInput(true); +} + +// =========================================================================== \ No newline at end of file diff --git a/scripts/client/gui/localechooser.js b/scripts/client/gui/localechooser.js index dc7dcdb5..db3b26e1 100644 --- a/scripts/client/gui/localechooser.js +++ b/scripts/client/gui/localechooser.js @@ -57,9 +57,6 @@ function closeLocaleChooserGUI() { // =========================================================================== function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) { - // Disabled for now until image loading crash can be fixed - //return false; - if (position.x != 0.0 && position.y != 0.0) { localeChooser.window.position = position; } else { @@ -79,7 +76,7 @@ function showLocaleChooserGUI(position = toVector2(0.0, 0.0)) { // =========================================================================== function toggleLocaleChooserGUI() { - if (localeChooser.window.shown) { + if (localeChooser.window.shown == true) { closeLocaleChooserGUI(); } else { showLocaleChooserGUI();