File tree Expand file tree Collapse file tree 3 files changed +12
-0
lines changed
Expand file tree Collapse file tree 3 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import { GamePieces } from './gamePieces';
22import { controls } from './controls' ;
33import { Game } from '../advclient' ;
44import viewport from './viewport' ;
5+ import { gameEventBus } from '@/gameEventsBus' ;
56
67export const pauseManager = {
78 togglePause ( ) {
@@ -67,3 +68,11 @@ export const pauseManager = {
6768 Game . properties . requestId = window . requestAnimationFrame ( Game . update ) ;
6869 } ,
6970} ;
71+
72+ gameEventBus . subscribe ( 'GUIDE_OPEN' , ( ) => {
73+ pauseManager . pauseGame ( ) ;
74+ } ) ;
75+
76+ gameEventBus . subscribe ( 'GUIDE_CLOSED' , ( ) => {
77+ pauseManager . resumeGame ( ) ;
78+ } ) ;
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import type { GuideIdentifier } from '@/types/Guide';
55export type GameEventMap = {
66 PLAYER_HEALTH_UPDATE : { health : number } ;
77 PLAYER_HUNTED_UPDATE : { isHunted : boolean } ;
8+ GUIDE_CLOSED : null ;
89 GUIDE_OPEN : { guide : GuideIdentifier } ;
910} & InputHandlerEvents &
1011 GameLoggerEvents &
@@ -26,6 +27,7 @@ class GameEventBus {
2627 PLAYER_HEALTH_UPDATE : [ ] ,
2728 PLAYER_HUNTED_UPDATE : [ ] ,
2829 GUIDE_OPEN : [ ] ,
30+ GUIDE_CLOSED : [ ] ,
2931 GAMELOGGER_MESSAGE_LOGGED : [ ] ,
3032 CHANGED_LOCATION : [ ] ,
3133 } ;
Original file line number Diff line number Diff line change @@ -164,6 +164,7 @@ const openGuide = async (identifier: GuideIdentifier): Promise<void> => {
164164const close = (): void => {
165165 isOpen .value = false ;
166166 selectedGuide .value = null ;
167+ gameEventBus .emit (' GUIDE_CLOSED' , null );
167168};
168169
169170defineExpose ({
You can’t perform that action at this time.
0 commit comments