mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-19 06:46:28 +01:00
Add Spectator stuff
This commit is contained in:
parent
e2507d4dcd
commit
cfc5ccf9e3
12
src/nitro/session/events/RoomSessionSpectatorModeEvent.ts
Normal file
12
src/nitro/session/events/RoomSessionSpectatorModeEvent.ts
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
import { IRoomSession } from '../IRoomSession';
|
||||||
|
import { RoomSessionEvent } from './RoomSessionEvent';
|
||||||
|
|
||||||
|
export class RoomSessionSpectatorModeEvent extends RoomSessionEvent
|
||||||
|
{
|
||||||
|
public static SPECTATOR_MODE: string = 'RSSME_SPECTATOR_MODE';
|
||||||
|
|
||||||
|
constructor(type: string, session: IRoomSession)
|
||||||
|
{
|
||||||
|
super(type, session);
|
||||||
|
}
|
||||||
|
}
|
@ -25,6 +25,7 @@ export * from './RoomSessionPollEvent';
|
|||||||
export * from './RoomSessionPresentEvent';
|
export * from './RoomSessionPresentEvent';
|
||||||
export * from './RoomSessionPropertyUpdateEvent';
|
export * from './RoomSessionPropertyUpdateEvent';
|
||||||
export * from './RoomSessionQueueEvent';
|
export * from './RoomSessionQueueEvent';
|
||||||
|
export * from './RoomSessionSpectatorModeEvent';
|
||||||
export * from './RoomSessionUserBadgesEvent';
|
export * from './RoomSessionUserBadgesEvent';
|
||||||
export * from './RoomSessionUserDataUpdateEvent';
|
export * from './RoomSessionUserDataUpdateEvent';
|
||||||
export * from './RoomSessionUserFigureUpdateEvent';
|
export * from './RoomSessionUserFigureUpdateEvent';
|
||||||
|
@ -4,9 +4,11 @@ import { RoomDoorbellAcceptedEvent } from '../../communication/messages/incoming
|
|||||||
import { RoomDoorbellRejectedEvent } from '../../communication/messages/incoming/room/access/doorbell/RoomDoorbellRejectedEvent';
|
import { RoomDoorbellRejectedEvent } from '../../communication/messages/incoming/room/access/doorbell/RoomDoorbellRejectedEvent';
|
||||||
import { RoomEnterEvent } from '../../communication/messages/incoming/room/access/RoomEnterEvent';
|
import { RoomEnterEvent } from '../../communication/messages/incoming/room/access/RoomEnterEvent';
|
||||||
import { RoomReadyMessageEvent } from '../../communication/messages/incoming/room/mapping/RoomReadyMessageEvent';
|
import { RoomReadyMessageEvent } from '../../communication/messages/incoming/room/mapping/RoomReadyMessageEvent';
|
||||||
|
import { YouAreSpectatorMessageEvent } from '../../communication/messages/incoming/room/session/YouAreSpectatorMessageEvent';
|
||||||
import { GoToFlatMessageComposer } from '../../communication/messages/outgoing/room/session/GoToFlatMessageComposer';
|
import { GoToFlatMessageComposer } from '../../communication/messages/outgoing/room/session/GoToFlatMessageComposer';
|
||||||
import { RoomSessionDoorbellEvent } from '../events/RoomSessionDoorbellEvent';
|
import { RoomSessionDoorbellEvent } from '../events/RoomSessionDoorbellEvent';
|
||||||
import { IRoomHandlerListener } from '../IRoomHandlerListener';
|
import { IRoomHandlerListener } from '../IRoomHandlerListener';
|
||||||
|
import { RoomSessionSpectatorModeEvent } from './../events/RoomSessionSpectatorModeEvent';
|
||||||
import { BaseHandler } from './BaseHandler';
|
import { BaseHandler } from './BaseHandler';
|
||||||
|
|
||||||
export class RoomSessionHandler extends BaseHandler
|
export class RoomSessionHandler extends BaseHandler
|
||||||
@ -24,6 +26,7 @@ export class RoomSessionHandler extends BaseHandler
|
|||||||
connection.addMessageEvent(new DesktopViewEvent(this.onDesktopViewEvent.bind(this)));
|
connection.addMessageEvent(new DesktopViewEvent(this.onDesktopViewEvent.bind(this)));
|
||||||
connection.addMessageEvent(new RoomDoorbellAcceptedEvent(this.onRoomDoorbellAcceptedEvent.bind(this)));
|
connection.addMessageEvent(new RoomDoorbellAcceptedEvent(this.onRoomDoorbellAcceptedEvent.bind(this)));
|
||||||
connection.addMessageEvent(new RoomDoorbellRejectedEvent(this.onRoomDoorbellRejectedEvent.bind(this)));
|
connection.addMessageEvent(new RoomDoorbellRejectedEvent(this.onRoomDoorbellRejectedEvent.bind(this)));
|
||||||
|
connection.addMessageEvent(new YouAreSpectatorMessageEvent(this.onYouAreSpectatorMessageEvent.bind(this)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private onRoomEnterEvent(event: RoomEnterEvent): void
|
private onRoomEnterEvent(event: RoomEnterEvent): void
|
||||||
@ -107,4 +110,17 @@ export class RoomSessionHandler extends BaseHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onYouAreSpectatorMessageEvent(event: YouAreSpectatorMessageEvent): void
|
||||||
|
{
|
||||||
|
if(this.listener)
|
||||||
|
{
|
||||||
|
const session = this.listener.getSession(this.roomId);
|
||||||
|
|
||||||
|
if(!session) return;
|
||||||
|
|
||||||
|
session.isSpectator = true;
|
||||||
|
this.listener.events.dispatchEvent(new RoomSessionSpectatorModeEvent(RoomSessionSpectatorModeEvent.SPECTATOR_MODE, session));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user