diff --git a/lang/en.json b/lang/en.json index 123cd53..b43200a 100644 --- a/lang/en.json +++ b/lang/en.json @@ -12,6 +12,20 @@ "system": "System {name}" } }, + "keybinds": { + "open": { + "name": "Open Party Overview", + "hint": "Opens the Party Overview window." + }, + "close": { + "name": "Close Party Overview", + "hint": "Closes the Party Overview window." + }, + "toggle": { + "name": "Toggle Party Overview", + "hint": "Opens or closes the Party Overview window." + } + }, "GENERAL": "General", "LIMIT": "Limit", "NAME": "Name", diff --git a/lang/es.json b/lang/es.json index 335945d..782a17c 100644 --- a/lang/es.json +++ b/lang/es.json @@ -1,8 +1,22 @@ { - "party-overview": { - "EnablePlayerAccess": { - "Name": "¿Permitir a jugadores una visión general del grupo?", - "Hint": "Permite a los jugadores para acceder la ventana del Grupo." - } - } + "party-overview": { + "EnablePlayerAccess": { + "Name": "¿Permitir a jugadores una visión general del grupo?", + "Hint": "Permite a los jugadores para acceder la ventana del Grupo." + }, + "keybinds": { + "open": { + "name": "Abrir el Party Overview", + "hint": "Abre la ventana de el Party Overview." + }, + "close": { + "name": "Cierrar Party Overview", + "hint": "Cierra la ventana de el Party Overview." + }, + "toggle": { + "name": "Alternar el Party Overview", + "hint": "Abre o cierra la ventana de el Party Overview." + } + } + } } diff --git a/lang/pt-BR.json b/lang/pt-BR.json index e577f15..a9f0ee6 100644 --- a/lang/pt-BR.json +++ b/lang/pt-BR.json @@ -12,6 +12,20 @@ "system": "Sistema {name}" } }, + "keybinds": { + "open": { + "name": "Abrir o Party Overview", + "hint": "Abre a janela do Party Overview." + }, + "close": { + "name": "Fechar Party Overview", + "hint": "Fecha a janela do Party Overview." + }, + "toggle": { + "name": "Alternar o Party Overview", + "hint": "Abre ou fecha a janela do Party Overview." + } + }, "GENERAL": "Geral", "LIMIT": "Limite", "NAME": "Nome", diff --git a/module/logic.js b/module/logic.js index b584d5a..4179abf 100644 --- a/module/logic.js +++ b/module/logic.js @@ -14,6 +14,7 @@ class PartyOverviewApp extends Application { this.state = {}; this.displayMode = DISPLAY_MODE.SHOW_VISIBLE; this.activeTab = "general"; + this.rendering = false; } update() { @@ -122,6 +123,16 @@ class PartyOverviewApp extends Application { super.activateListeners(html); } + + render(force, options) { + this.rendering = true; + super.render(force, options); + } + + close() { + this.rendering = false; + super.close(); + } } export default PartyOverviewApp; diff --git a/party-overview.js b/party-overview.js index 6f5b461..c5422c7 100644 --- a/party-overview.js +++ b/party-overview.js @@ -10,6 +10,34 @@ Hooks.once("init", () => { registerApiSettings(); partyOverview = new PartyOverviewApp(); + game.keybindings.register("party-overview", "openPartyOverview", { + name: game.i18n.localize("party-overview.keybinds.open.name"), + hint: game.i18n.localize("party-overview.keybinds.open.hint"), + onDown: () => { + partyOverview.render(true); + }, + onUp: () => {}, + precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL, + }); + game.keybindings.register("party-overview", "closePartyOverview", { + name: game.i18n.localize("party-overview.keybinds.close.name"), + hint: game.i18n.localize("party-overview.keybinds.close.hint"), + onDown: () => { + partyOverview.close(); + }, + onUp: () => {}, + precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL, + }); + game.keybindings.register("party-overview", "togglePartyOverview", { + name: game.i18n.localize("party-overview.keybinds.toggle.name"), + hint: game.i18n.localize("party-overview.keybinds.toggle.hint"), + onDown: () => { + if (!partyOverview.rendering) partyOverview.render(true); + else partyOverview.close(); + }, + onUp: () => {}, + precedence: CONST.KEYBINDING_PRECEDENCE.NORMAL, + }); return loadTemplates([ "modules/party-overview/templates/parts/Tabs.html", "modules/party-overview/templates/parts/FilterButton.html",