You've already forked Nitro_Render_V3
mirror of
https://github.com/duckietm/Nitro_Render_V3.git
synced 2026-06-19 23:16:20 +00:00
Move to Renderer V2
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { GenericErrorEnum, IConnection, IRoomHandlerListener } from '@nitrots/api';
|
||||
import { GenericErrorEvent } from '@nitrots/communication';
|
||||
import { GetEventDispatcher, RoomSessionErrorMessageEvent } from '@nitrots/events';
|
||||
import { BaseHandler } from './BaseHandler';
|
||||
|
||||
export class GenericErrorHandler extends BaseHandler
|
||||
{
|
||||
constructor(connection: IConnection, listener: IRoomHandlerListener)
|
||||
{
|
||||
super(connection, listener);
|
||||
|
||||
connection.addMessageEvent(new GenericErrorEvent(this.onRoomGenericError.bind(this)));
|
||||
}
|
||||
|
||||
private onRoomGenericError(event: GenericErrorEvent): void
|
||||
{
|
||||
if(!(event instanceof GenericErrorEvent)) return;
|
||||
|
||||
const parser = event.getParser();
|
||||
|
||||
if(!parser) return;
|
||||
|
||||
const roomSession = this.listener.getSession(this.roomId);
|
||||
|
||||
if(!roomSession) return;
|
||||
|
||||
let type: string = '';
|
||||
|
||||
switch(parser.errorCode)
|
||||
{
|
||||
case GenericErrorEnum.KICKED_OUT_OF_ROOM:
|
||||
type = RoomSessionErrorMessageEvent.RSEME_KICKED;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
if(!type || type.length == 0) return;
|
||||
|
||||
GetEventDispatcher().dispatchEvent(new RoomSessionErrorMessageEvent(type, roomSession));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user