mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-12-03 12:16:28 +01:00
Merge branch 'main' into @update/widgets
This commit is contained in:
commit
8638892e56
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@nitrots/nitro-renderer",
|
||||
"description": "Javascript library for rendering Nitro in the browser using PixiJS",
|
||||
"version": "1.2.4",
|
||||
"version": "1.2.5",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
@ -1,5 +1,5 @@
|
||||
export class NitroVersion
|
||||
{
|
||||
public static RENDERER_VERSION: string = '1.2.4';
|
||||
public static RENDERER_VERSION: string = '1.2.5';
|
||||
public static UI_VERSION: string = '';
|
||||
}
|
||||
|
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 './RoomSessionPropertyUpdateEvent';
|
||||
export * from './RoomSessionQueueEvent';
|
||||
export * from './RoomSessionSpectatorModeEvent';
|
||||
export * from './RoomSessionUserBadgesEvent';
|
||||
export * from './RoomSessionUserDataUpdateEvent';
|
||||
export * from './RoomSessionUserFigureUpdateEvent';
|
||||
|
@ -4,9 +4,11 @@ import { RoomDoorbellAcceptedEvent } from '../../communication/messages/incoming
|
||||
import { RoomDoorbellRejectedEvent } from '../../communication/messages/incoming/room/access/doorbell/RoomDoorbellRejectedEvent';
|
||||
import { RoomEnterEvent } from '../../communication/messages/incoming/room/access/RoomEnterEvent';
|
||||
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 { RoomSessionDoorbellEvent } from '../events/RoomSessionDoorbellEvent';
|
||||
import { IRoomHandlerListener } from '../IRoomHandlerListener';
|
||||
import { RoomSessionSpectatorModeEvent } from './../events/RoomSessionSpectatorModeEvent';
|
||||
import { BaseHandler } from './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 RoomDoorbellAcceptedEvent(this.onRoomDoorbellAcceptedEvent.bind(this)));
|
||||
connection.addMessageEvent(new RoomDoorbellRejectedEvent(this.onRoomDoorbellRejectedEvent.bind(this)));
|
||||
connection.addMessageEvent(new YouAreSpectatorMessageEvent(this.onYouAreSpectatorMessageEvent.bind(this)));
|
||||
}
|
||||
|
||||
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