From c231886d5f84def80605110805d4d21c77ecf853 Mon Sep 17 00:00:00 2001 From: Flashfyre Date: Tue, 13 Feb 2024 11:53:09 -0500 Subject: [PATCH] Add community links to menu --- src/ui/menu-ui-handler.ts | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/src/ui/menu-ui-handler.ts b/src/ui/menu-ui-handler.ts index da831cdfa..f1a9084a7 100644 --- a/src/ui/menu-ui-handler.ts +++ b/src/ui/menu-ui-handler.ts @@ -15,9 +15,13 @@ export enum MenuOptions { EGG_LIST, EGG_GACHA, MANAGE_DATA, + COMMUNITY, LOG_OUT } +const discordUrl = 'https://discord.gg/uWpTfdKG49'; +const githubUrl = 'https://github.com/Flashfyre/pokerogue'; + export default class MenuUiHandler extends MessageUiHandler { private menuContainer: Phaser.GameObjects.Container; private menuMessageBoxContainer: Phaser.GameObjects.Container; @@ -31,6 +35,7 @@ export default class MenuUiHandler extends MessageUiHandler { protected menuOptions: MenuOptions[]; protected manageDataConfig: OptionSelectConfig; + protected communityConfig: OptionSelectConfig; constructor(scene: BattleScene, mode?: Mode) { super(scene, mode); @@ -111,6 +116,28 @@ export default class MenuUiHandler extends MessageUiHandler { options: manageDataOptions }; + const communityOptions = [ + { + label: 'Discord', + handler: () => window.open(discordUrl, '_blank').focus(), + keepOpen: true + }, + { + label: 'GitHub', + handler: () => window.open(githubUrl, '_blank').focus(), + keepOpen: true + }, + { + label: 'Cancel', + handler: () => this.scene.ui.revertMode() + } + ]; + + this.communityConfig = { + xOffset: 98, + options: communityOptions + }; + this.setCursor(0); this.menuContainer.setVisible(false); @@ -179,6 +206,10 @@ export default class MenuUiHandler extends MessageUiHandler { ui.setOverlayMode(Mode.OPTION_SELECT, this.manageDataConfig); success = true; break; + case MenuOptions.COMMUNITY: + ui.setOverlayMode(Mode.OPTION_SELECT, this.communityConfig); + success = true; + break; case MenuOptions.LOG_OUT: success = true; const doLogout = () => {