Merge branch 'main' into @update/widgets

This commit is contained in:
Bill 2022-05-21 18:43:16 -04:00
commit 8638892e56
6 changed files with 32 additions and 3 deletions

View File

@ -1,7 +1,7 @@
{ {
"name": "@nitrots/nitro-renderer", "name": "@nitrots/nitro-renderer",
"description": "Javascript library for rendering Nitro in the browser using PixiJS", "description": "Javascript library for rendering Nitro in the browser using PixiJS",
"version": "1.2.4", "version": "1.2.5",
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },

View File

@ -1,5 +1,5 @@
export class NitroVersion export class NitroVersion
{ {
public static RENDERER_VERSION: string = '1.2.4'; public static RENDERER_VERSION: string = '1.2.5';
public static UI_VERSION: string = ''; public static UI_VERSION: string = '';
} }

View File

@ -124,4 +124,4 @@ export class AvatarAction
return 'std'; return 'std';
} }
} }

View 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);
}
}

View File

@ -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';

View File

@ -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));
}
}
} }