Skip to content

Commit 2e6d5d5

Browse files
committed
Add tab argument to modmanager.openModOptionsMenu
1 parent e0863b8 commit 2e6d5d5

2 files changed

Lines changed: 6 additions & 5 deletions

File tree

src/gui/options/mod-options-menu.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { LocalMods } from '../../local-mods'
44

55
declare global {
66
namespace modmanager {
7-
function openModOptionsMenu(modId: string): void
7+
function openModOptionsMenu(modId: string, tab?: number): void
88
}
99
namespace modmanager.gui {
1010
interface OptionsMenu extends sc.BaseMenu, sc.Model.Observer {
@@ -42,7 +42,7 @@ declare global {
4242
}
4343
}
4444

45-
modmanager.openModOptionsMenu = (modId: string) => {
45+
modmanager.openModOptionsMenu = (modId: string, tab?: number) => {
4646
const record = LocalMods.getAllRecord()
4747
const mod = record[modId]
4848
if (!mod) throw new Error(`Mod: "${modId}" does not have options menu!`)
@@ -53,6 +53,7 @@ modmanager.openModOptionsMenu = (modId: string) => {
5353
sc.menu.pushMenu(sc.MENU_SUBMENU.MOD_OPTIONS)
5454
}
5555
modmanager.gui.optionsMenu.updateEntries(mod)
56+
if (tab) modmanager.gui.optionsMenu.listBox.setCurrentTab(tab, true)
5657
}
5758

5859
modmanager.gui.OptionsMenu = sc.BaseMenu.extend({

src/gui/options/tabbox.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ declare global {
5656

5757
onButtonTraversal(this: this): void
5858
_resetButtons(this: this, tabButton?: modmanager.gui.OptionsTabBox.TabButton, unfocus?: boolean): void
59-
setCurrentTab(this: this, tabIndex: number): void
59+
setCurrentTab(this: this, tabIndex: number, noSound?: boolean): void
6060

6161
addObservers(this: this): void
6262
removeObservers(this: this): void
@@ -321,10 +321,10 @@ modmanager.gui.OptionsTabBox = ig.GuiElementBase.extend({
321321
if (unfocus) tab.focus = false
322322
}
323323
},
324-
setCurrentTab(tabIndex) {
324+
setCurrentTab(tabIndex, noSound) {
325325
const button = this.tabArray[tabIndex]
326326
if (this.prevPressed != button) {
327-
sc.BUTTON_SOUND.submit.play()
327+
if (!noSound) sc.BUTTON_SOUND.submit.play()
328328
this.prevPressed = button!
329329
button.setPressed(true)
330330

0 commit comments

Comments
 (0)