Add community links to menu

This commit is contained in:
Flashfyre 2024-02-13 11:53:09 -05:00
parent e72ede26d8
commit c231886d5f
1 changed files with 31 additions and 0 deletions

View File

@ -15,9 +15,13 @@ export enum MenuOptions {
EGG_LIST, EGG_LIST,
EGG_GACHA, EGG_GACHA,
MANAGE_DATA, MANAGE_DATA,
COMMUNITY,
LOG_OUT LOG_OUT
} }
const discordUrl = 'https://discord.gg/uWpTfdKG49';
const githubUrl = 'https://github.com/Flashfyre/pokerogue';
export default class MenuUiHandler extends MessageUiHandler { export default class MenuUiHandler extends MessageUiHandler {
private menuContainer: Phaser.GameObjects.Container; private menuContainer: Phaser.GameObjects.Container;
private menuMessageBoxContainer: Phaser.GameObjects.Container; private menuMessageBoxContainer: Phaser.GameObjects.Container;
@ -31,6 +35,7 @@ export default class MenuUiHandler extends MessageUiHandler {
protected menuOptions: MenuOptions[]; protected menuOptions: MenuOptions[];
protected manageDataConfig: OptionSelectConfig; protected manageDataConfig: OptionSelectConfig;
protected communityConfig: OptionSelectConfig;
constructor(scene: BattleScene, mode?: Mode) { constructor(scene: BattleScene, mode?: Mode) {
super(scene, mode); super(scene, mode);
@ -111,6 +116,28 @@ export default class MenuUiHandler extends MessageUiHandler {
options: manageDataOptions 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.setCursor(0);
this.menuContainer.setVisible(false); this.menuContainer.setVisible(false);
@ -179,6 +206,10 @@ export default class MenuUiHandler extends MessageUiHandler {
ui.setOverlayMode(Mode.OPTION_SELECT, this.manageDataConfig); ui.setOverlayMode(Mode.OPTION_SELECT, this.manageDataConfig);
success = true; success = true;
break; break;
case MenuOptions.COMMUNITY:
ui.setOverlayMode(Mode.OPTION_SELECT, this.communityConfig);
success = true;
break;
case MenuOptions.LOG_OUT: case MenuOptions.LOG_OUT:
success = true; success = true;
const doLogout = () => { const doLogout = () => {