Move communication interfaces

This commit is contained in:
Bill 2022-10-29 22:59:33 -04:00
parent d8fca7188f
commit e24ed2eb3b
1329 changed files with 4230 additions and 4283 deletions

View File

@ -1,6 +1,6 @@
import { IEventDispatcher } from '../events/IEventDispatcher'; import { IEventDispatcher } from '../events';
import { IDisposable } from './disposable/IDisposable'; import { IDisposable } from './IDisposable';
import { INitroLogger } from './logger/INitroLogger'; import { INitroLogger } from './INitroLogger';
export interface INitroManager extends IDisposable export interface INitroManager extends IDisposable
{ {
@ -9,4 +9,4 @@ export interface INitroManager extends IDisposable
events: IEventDispatcher; events: IEventDispatcher;
isLoaded: boolean; isLoaded: boolean;
isLoading: boolean; isLoading: boolean;
} }

View File

@ -1,6 +1,6 @@
import { IDisposable } from './disposable/IDisposable'; import { IDisposable } from './IDisposable';
export interface IUpdateReceiver extends IDisposable export interface IUpdateReceiver extends IDisposable
{ {
update(time: number): void; update(time: number): void;
} }

4
src/api/common/index.ts Normal file
View File

@ -0,0 +1,4 @@
export * from './IDisposable';
export * from './INitroLogger';
export * from './INitroManager';
export * from './IUpdateReceiver';

View File

@ -0,0 +1,12 @@
export interface IBinaryReader
{
readBytes(length: number): IBinaryReader;
readByte(): number;
readShort(): number;
readInt(): number;
readFloat(): number;
readDouble(): number;
remaining(): number;
toString(encoding?: string): string;
toArrayBuffer(): ArrayBuffer;
}

View File

@ -0,0 +1,11 @@
export interface IBinaryWriter
{
writeByte(byte: number): IBinaryWriter;
writeBytes(bytes: ArrayBuffer | number[]): IBinaryWriter;
writeShort(short: number): IBinaryWriter;
writeInt(integer: number): IBinaryWriter;
writeString(string: string, includeLength?: boolean): IBinaryWriter;
getBuffer(): ArrayBuffer;
position: number;
toString(encoding?: string): string;
}

View File

@ -0,0 +1,9 @@
import { IBinaryWriter } from './IBinaryWriter';
import { IConnection } from './IConnection';
import { IMessageDataWrapper } from './IMessageDataWrapper';
export interface ICodec
{
encode(header: number, messages: any[]): IBinaryWriter;
decode(connection: IConnection): IMessageDataWrapper[];
}

View File

@ -0,0 +1,8 @@
import { IDisposable } from '../common';
import { IConnection } from './IConnection';
import { IConnectionStateListener } from './IConnectionStateListener';
export interface ICommunicationManager extends IDisposable
{
createConnection(stateListener?: IConnectionStateListener): IConnection;
}

View File

@ -1,7 +1,7 @@
import { IEventDispatcher } from '../../events/IEventDispatcher'; import { IEventDispatcher } from '../events';
import { IMessageComposer } from '../messages/IMessageComposer'; import { IMessageComposer } from './IMessageComposer';
import { IMessageConfiguration } from '../messages/IMessageConfiguration'; import { IMessageConfiguration } from './IMessageConfiguration';
import { IMessageEvent } from '../messages/IMessageEvent'; import { IMessageEvent } from './IMessageEvent';
export interface IConnection extends IEventDispatcher export interface IConnection extends IEventDispatcher
{ {
@ -16,4 +16,4 @@ export interface IConnection extends IEventDispatcher
removeMessageEvent(event: IMessageEvent): void; removeMessageEvent(event: IMessageEvent): void;
isAuthenticated: boolean; isAuthenticated: boolean;
dataBuffer: ArrayBuffer; dataBuffer: ArrayBuffer;
} }

View File

@ -1,9 +1,9 @@
import { BinaryReader } from '../codec/BinaryReader'; import { IBinaryReader } from './IBinaryReader';
export interface IMessageDataWrapper export interface IMessageDataWrapper
{ {
readByte(): number; readByte(): number;
readBytes(length: number): BinaryReader; readBytes(length: number): IBinaryReader;
readBoolean(): boolean; readBoolean(): boolean;
readShort(): number; readShort(): number;
readInt(): number; readInt(): number;

View File

@ -1,4 +1,4 @@
import { IConnection } from '../connections/IConnection'; import { IConnection } from './IConnection';
import { IMessageParser } from './IMessageParser'; import { IMessageParser } from './IMessageParser';
export interface IMessageEvent export interface IMessageEvent
@ -8,4 +8,4 @@ export interface IMessageEvent
parserClass: Function; parserClass: Function;
parser: IMessageParser; parser: IMessageParser;
connection: IConnection; connection: IConnection;
} }

View File

@ -0,0 +1,12 @@
export * from './enums';
export * from './IBinaryReader';
export * from './IBinaryWriter';
export * from './ICodec';
export * from './ICommunicationManager';
export * from './IConnection';
export * from './IConnectionStateListener';
export * from './IMessageComposer';
export * from './IMessageConfiguration';
export * from './IMessageDataWrapper';
export * from './IMessageEvent';
export * from './IMessageParser';

View File

@ -1,12 +1,11 @@
import { INitroLogger } from '../common'; import { IDisposable, INitroLogger } from '../common';
import { IDisposable } from '../common/disposable/IDisposable'; import { INitroEvent } from './INitroEvent';
import { NitroEvent } from './NitroEvent';
export interface IEventDispatcher extends IDisposable export interface IEventDispatcher extends IDisposable
{ {
addEventListener(type: string, callback: Function): void addEventListener(type: string, callback: Function): void
removeEventListener(type: string, callback: Function): void; removeEventListener(type: string, callback: Function): void;
removeAllListeners(): void; removeAllListeners(): void;
dispatchEvent(event: NitroEvent): boolean; dispatchEvent(event: INitroEvent): boolean;
logger: INitroLogger; logger: INitroLogger;
} }

View File

@ -0,0 +1,4 @@
export interface INitroEvent
{
type: string;
}

4
src/api/events/index.ts Normal file
View File

@ -0,0 +1,4 @@
export * from './IEventDispatcher';
export * from './ILinkEventTracker';
export * from './INitroEvent';
export * from './IWorkerEventTracker';

View File

@ -9,3 +9,6 @@ export * from './asset/visualization/animation';
export * from './asset/visualization/color'; export * from './asset/visualization/color';
export * from './asset/visualization/gestures'; export * from './asset/visualization/gestures';
export * from './asset/visualization/postures'; export * from './asset/visualization/postures';
export * from './common';
export * from './communication';
export * from './events';

View File

@ -1,6 +1,4 @@
import { IAssetManager } from '../api'; import { IAssetManager, ICommunicationManager, IDisposable } from '../api';
import { IDisposable } from './common/disposable/IDisposable';
import { ICommunicationManager } from './communication/ICommunicationManager';
import { IConfigurationManager } from './configuration/IConfigurationManager'; import { IConfigurationManager } from './configuration/IConfigurationManager';
export interface INitroCore extends IDisposable export interface INitroCore extends IDisposable

View File

@ -1,8 +1,7 @@
import { IAssetManager } from '../api'; import { IAssetManager, ICommunicationManager } from '../api';
import { AssetManager } from './asset/AssetManager'; import { AssetManager } from './asset/AssetManager';
import { Disposable } from './common/disposable/Disposable'; import { Disposable } from './common/Disposable';
import { CommunicationManager } from './communication/CommunicationManager'; import { CommunicationManager } from './communication/CommunicationManager';
import { ICommunicationManager } from './communication/ICommunicationManager';
import { ConfigurationManager } from './configuration/ConfigurationManager'; import { ConfigurationManager } from './configuration/ConfigurationManager';
import { IConfigurationManager } from './configuration/IConfigurationManager'; import { IConfigurationManager } from './configuration/IConfigurationManager';
import { INitroCore } from './INitroCore'; import { INitroCore } from './INitroCore';

View File

@ -1,11 +1,10 @@
import { BaseTexture, Resource, Texture } from '@pixi/core'; import { BaseTexture, Resource, Texture } from '@pixi/core';
import { Loader, LoaderResource } from '@pixi/loaders'; import { Loader, LoaderResource } from '@pixi/loaders';
import { Spritesheet } from '@pixi/spritesheet'; import { Spritesheet } from '@pixi/spritesheet';
import { IAssetData, IAssetManager, IGraphicAsset, IGraphicAssetCollection } from '../../api'; import { IAssetData, IAssetManager, IGraphicAsset, IGraphicAssetCollection, INitroLogger } from '../../api';
import { GraphicAssetCollection } from '../../room/object/visualization/utils/GraphicAssetCollection'; import { GraphicAssetCollection } from '../../room/object/visualization/utils/GraphicAssetCollection';
import { Disposable } from '../common/disposable/Disposable'; import { Disposable } from '../common/Disposable';
import { INitroLogger } from '../common/logger/INitroLogger'; import { NitroLogger } from '../common/NitroLogger';
import { NitroLogger } from '../common/logger/NitroLogger';
import { ArrayBufferToBase64 } from '../utils'; import { ArrayBufferToBase64 } from '../utils';
import { NitroBundle } from './NitroBundle'; import { NitroBundle } from './NitroBundle';

View File

@ -1,4 +1,4 @@
import { IDisposable } from './IDisposable'; import { IDisposable } from '../../api';
export class Disposable implements IDisposable export class Disposable implements IDisposable
{ {
@ -13,7 +13,7 @@ export class Disposable implements IDisposable
public dispose(): void public dispose(): void
{ {
if(this._isDisposed || this._isDisposing) return; if (this._isDisposed || this._isDisposing) return;
this._isDisposing = true; this._isDisposing = true;
@ -37,4 +37,4 @@ export class Disposable implements IDisposable
{ {
return this._isDisposing; return this._isDisposing;
} }
} }

View File

@ -1,4 +1,4 @@
import { INitroLogger } from './INitroLogger'; import { INitroLogger } from '../../api';
export class NitroLogger implements INitroLogger export class NitroLogger implements INitroLogger
{ {
@ -30,7 +30,7 @@ export class NitroLogger implements INitroLogger
public printMessage(modus: string, ...message: any[]): void public printMessage(modus: string, ...message: any[]): void
{ {
if(!this._print) return; if (!this._print) return;
NitroLogger.log(this._name, modus, ...message); NitroLogger.log(this._name, modus, ...message);
} }
@ -39,7 +39,7 @@ export class NitroLogger implements INitroLogger
{ {
const logPrefix = `[Nitro] [${name}]`; const logPrefix = `[Nitro] [${name}]`;
switch(modus) switch (modus)
{ {
case 'error': case 'error':
console.error(logPrefix, ...message); console.error(logPrefix, ...message);

View File

@ -1,9 +1,7 @@
import { IEventDispatcher, INitroLogger, INitroManager } from '../../api';
import { EventDispatcher } from '../events/EventDispatcher'; import { EventDispatcher } from '../events/EventDispatcher';
import { IEventDispatcher } from '../events/IEventDispatcher'; import { Disposable } from './Disposable';
import { Disposable } from './disposable/Disposable'; import { NitroLogger } from './NitroLogger';
import { INitroManager } from './INitroManager';
import { INitroLogger } from './logger/INitroLogger';
import { NitroLogger } from './logger/NitroLogger';
export class NitroManager extends Disposable implements INitroManager export class NitroManager extends Disposable implements INitroManager
{ {
@ -28,7 +26,7 @@ export class NitroManager extends Disposable implements INitroManager
public init(): void public init(): void
{ {
if(this._isLoaded || this._isLoading || this.isDisposing) return; if (this._isLoaded || this._isLoading || this.isDisposing) return;
this._isLoading = true; this._isLoading = true;
@ -45,7 +43,7 @@ export class NitroManager extends Disposable implements INitroManager
protected onDispose(): void protected onDispose(): void
{ {
if(this._events) this._events.dispose(); if (this._events) this._events.dispose();
super.onDispose(); super.onDispose();
} }
@ -75,4 +73,4 @@ export class NitroManager extends Disposable implements INitroManager
{ {
return this._isLoading; return this._isLoading;
} }
} }

View File

@ -1,2 +0,0 @@
export * from './Disposable';
export * from './IDisposable';

View File

@ -1,5 +1,3 @@
export * from './disposable'; export * from './Disposable';
export * from './INitroManager'; export * from './NitroLogger';
export * from './IUpdateReceiver';
export * from './logger';
export * from './NitroManager'; export * from './NitroManager';

View File

@ -1,2 +0,0 @@
export * from './INitroLogger';
export * from './NitroLogger';

View File

@ -1,9 +1,6 @@
import { Disposable } from '../common/disposable/Disposable'; import { ICommunicationManager, IConnection, IConnectionStateListener, IUpdateReceiver } from '../../api';
import { IUpdateReceiver } from '../common/IUpdateReceiver'; import { Disposable } from '../common/Disposable';
import { IConnection } from './connections/IConnection';
import { IConnectionStateListener } from './connections/IConnectionStateListener';
import { SocketConnection } from './connections/SocketConnection'; import { SocketConnection } from './connections/SocketConnection';
import { ICommunicationManager } from './ICommunicationManager';
export class CommunicationManager extends Disposable implements ICommunicationManager, IUpdateReceiver export class CommunicationManager extends Disposable implements ICommunicationManager, IUpdateReceiver
{ {
@ -18,16 +15,16 @@ export class CommunicationManager extends Disposable implements ICommunicationMa
protected onDispose(): void protected onDispose(): void
{ {
if(!this._connections || !this._connections.length) return; if (!this._connections || !this._connections.length) return;
for(const connection of this._connections.values()) connection && connection.dispose(); for (const connection of this._connections.values()) connection && connection.dispose();
} }
public createConnection(stateListener: IConnectionStateListener = null): IConnection public createConnection(stateListener: IConnectionStateListener = null): IConnection
{ {
const connection = new SocketConnection(this, stateListener); const connection = new SocketConnection(this, stateListener);
if(!connection) return; if (!connection) return;
this._connections.push(connection); this._connections.push(connection);
@ -38,16 +35,16 @@ export class CommunicationManager extends Disposable implements ICommunicationMa
{ {
let index = 0; let index = 0;
while(index < this._connections.length) while (index < this._connections.length)
{ {
const connection = this._connections[index]; const connection = this._connections[index];
connection.processReceivedData(); connection.processReceivedData();
if(this.disposed) return; if (this.disposed) return;
if(connection.disposed) this._connections.splice(index, 1); if (connection.disposed) this._connections.splice(index, 1);
else index++; else index++;
} }
} }
} }

View File

@ -1,8 +0,0 @@
import { IDisposable } from '../common/disposable/IDisposable';
import { IConnection } from './connections/IConnection';
import { IConnectionStateListener } from './connections/IConnectionStateListener';
export interface ICommunicationManager extends IDisposable
{
createConnection(stateListener?: IConnectionStateListener): IConnection;
}

View File

@ -1,9 +0,0 @@
import { BinaryWriter } from './BinaryWriter';
import { IConnection } from '../connections/IConnection';
import { IMessageDataWrapper } from '../messages/IMessageDataWrapper';
export interface ICodec
{
encode(header: number, messages: any[]): BinaryWriter;
decode(connection: IConnection): IMessageDataWrapper[];
}

View File

@ -1,27 +1,26 @@
import { IMessageDataWrapper } from '../../messages/IMessageDataWrapper'; import { IBinaryReader, IMessageDataWrapper } from '../../../../api';
import { BinaryReader } from '../BinaryReader';
export class EvaWireDataWrapper implements IMessageDataWrapper export class EvaWireDataWrapper implements IMessageDataWrapper
{ {
private _header: number; private _header: number;
private _buffer: BinaryReader; private _buffer: IBinaryReader;
constructor(header: number, buffer: BinaryReader) constructor(header: number, buffer: IBinaryReader)
{ {
this._header = header; this._header = header;
this._buffer = buffer; this._buffer = buffer;
} }
public readBytes(length: number): BinaryReader public readBytes(length: number): IBinaryReader
{ {
if(!this._buffer) return null; if (!this._buffer) return null;
return this._buffer.readBytes(length); return this._buffer.readBytes(length);
} }
public readByte(): number public readByte(): number
{ {
if(!this._buffer) return -1; if (!this._buffer) return -1;
return this._buffer.readByte(); return this._buffer.readByte();
} }
@ -33,28 +32,28 @@ export class EvaWireDataWrapper implements IMessageDataWrapper
public readShort(): number public readShort(): number
{ {
if(!this._buffer) return -1; if (!this._buffer) return -1;
return this._buffer.readShort(); return this._buffer.readShort();
} }
public readInt(): number public readInt(): number
{ {
if(!this._buffer) return -1; if (!this._buffer) return -1;
return this._buffer.readInt(); return this._buffer.readInt();
} }
public readFloat(): number public readFloat(): number
{ {
if(!this._buffer) return -1; if (!this._buffer) return -1;
return this._buffer.readFloat(); return this._buffer.readFloat();
} }
public readDouble(): number public readDouble(): number
{ {
if(!this._buffer) return -1; if (!this._buffer) return -1;
return this._buffer.readDouble(); return this._buffer.readDouble();
} }

View File

@ -1,33 +1,31 @@
import { IConnection } from '../../connections/IConnection'; import { IBinaryWriter, ICodec, IConnection, IMessageDataWrapper } from '../../../../api';
import { IMessageDataWrapper } from '../../messages/IMessageDataWrapper';
import { BinaryReader } from '../BinaryReader'; import { BinaryReader } from '../BinaryReader';
import { BinaryWriter } from '../BinaryWriter'; import { BinaryWriter } from '../BinaryWriter';
import { Byte } from '../Byte'; import { Byte } from '../Byte';
import { ICodec } from '../ICodec';
import { Short } from '../Short'; import { Short } from '../Short';
import { EvaWireDataWrapper } from './EvaWireDataWrapper'; import { EvaWireDataWrapper } from './EvaWireDataWrapper';
export class EvaWireFormat implements ICodec export class EvaWireFormat implements ICodec
{ {
public encode(header: number, messages: any[]): BinaryWriter public encode(header: number, messages: any[]): IBinaryWriter
{ {
const writer = new BinaryWriter(); const writer = new BinaryWriter();
writer.writeShort(header); writer.writeShort(header);
for(const value of messages) for (const value of messages)
{ {
let type: string = typeof value; let type: string = typeof value;
if(type === 'object') if (type === 'object')
{ {
if(value === null) type = 'null'; if (value === null) type = 'null';
else if(value instanceof Byte) type = 'byte'; else if (value instanceof Byte) type = 'byte';
else if(value instanceof Short) type = 'short'; else if (value instanceof Short) type = 'short';
else if(value instanceof ArrayBuffer) type = 'arraybuffer'; else if (value instanceof ArrayBuffer) type = 'arraybuffer';
} }
switch(type) switch (type)
{ {
case 'undefined': case 'undefined':
case 'null': case 'null':
@ -46,7 +44,7 @@ export class EvaWireFormat implements ICodec
writer.writeByte(value ? 1 : 0); writer.writeByte(value ? 1 : 0);
break; break;
case 'string': case 'string':
if(!value) writer.writeShort(0); if (!value) writer.writeShort(0);
else else
{ {
writer.writeString(value, true); writer.writeString(value, true);
@ -60,25 +58,25 @@ export class EvaWireFormat implements ICodec
const buffer = writer.getBuffer(); const buffer = writer.getBuffer();
if(!buffer) return null; if (!buffer) return null;
return new BinaryWriter().writeInt(buffer.byteLength).writeBytes(buffer); return new BinaryWriter().writeInt(buffer.byteLength).writeBytes(buffer);
} }
public decode(connection: IConnection): IMessageDataWrapper[] public decode(connection: IConnection): IMessageDataWrapper[]
{ {
if(!connection || !connection.dataBuffer || !connection.dataBuffer.byteLength) return null; if (!connection || !connection.dataBuffer || !connection.dataBuffer.byteLength) return null;
const wrappers: IMessageDataWrapper[] = []; const wrappers: IMessageDataWrapper[] = [];
while(connection.dataBuffer.byteLength) while (connection.dataBuffer.byteLength)
{ {
if(connection.dataBuffer.byteLength < 4) break; if (connection.dataBuffer.byteLength < 4) break;
const container = new BinaryReader(connection.dataBuffer); const container = new BinaryReader(connection.dataBuffer);
const length = container.readInt(); const length = container.readInt();
if(length > (connection.dataBuffer.byteLength - 4)) break; if (length > (connection.dataBuffer.byteLength - 4)) break;
const extracted = container.readBytes(length); const extracted = container.readBytes(length);

View File

@ -2,5 +2,4 @@ export * from './BinaryReader';
export * from './BinaryWriter'; export * from './BinaryWriter';
export * from './Byte'; export * from './Byte';
export * from './evawire'; export * from './evawire';
export * from './ICodec';
export * from './Short'; export * from './Short';

View File

@ -1,17 +1,9 @@
import { ICodec, ICommunicationManager, IConnection, IConnectionStateListener, IMessageComposer, IMessageConfiguration, IMessageDataWrapper, IMessageEvent, WebSocketEventEnum } from '../../../api';
import { Nitro } from '../../../nitro/Nitro'; import { Nitro } from '../../../nitro/Nitro';
import { EventDispatcher } from '../../events/EventDispatcher'; import { EventDispatcher } from '../../events/EventDispatcher';
import { EvaWireFormat } from '../codec/evawire/EvaWireFormat'; import { EvaWireFormat } from '../codec/evawire/EvaWireFormat';
import { ICodec } from '../codec/ICodec';
import { SocketConnectionEvent } from '../events/SocketConnectionEvent'; import { SocketConnectionEvent } from '../events/SocketConnectionEvent';
import { ICommunicationManager } from '../ICommunicationManager';
import { IMessageComposer } from '../messages/IMessageComposer';
import { IMessageConfiguration } from '../messages/IMessageConfiguration';
import { IMessageDataWrapper } from '../messages/IMessageDataWrapper';
import { IMessageEvent } from '../messages/IMessageEvent';
import { MessageClassManager } from '../messages/MessageClassManager'; import { MessageClassManager } from '../messages/MessageClassManager';
import { WebSocketEventEnum } from './enums/WebSocketEventEnum';
import { IConnection } from './IConnection';
import { IConnectionStateListener } from './IConnectionStateListener';
export class SocketConnection extends EventDispatcher implements IConnection export class SocketConnection extends EventDispatcher implements IConnection
{ {
@ -53,7 +45,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
public init(socketUrl: string): void public init(socketUrl: string): void
{ {
if(this._stateListener) if (this._stateListener)
{ {
this._stateListener.connectionInit(socketUrl); this._stateListener.connectionInit(socketUrl);
} }
@ -76,13 +68,13 @@ export class SocketConnection extends EventDispatcher implements IConnection
public onReady(): void public onReady(): void
{ {
if(this._isReady) return; if (this._isReady) return;
this._isReady = true; this._isReady = true;
if(this._pendingServerMessages && this._pendingServerMessages.length) this.processWrappers(...this._pendingServerMessages); if (this._pendingServerMessages && this._pendingServerMessages.length) this.processWrappers(...this._pendingServerMessages);
if(this._pendingClientMessages && this._pendingClientMessages.length) this.send(...this._pendingClientMessages); if (this._pendingClientMessages && this._pendingClientMessages.length) this.send(...this._pendingClientMessages);
this._pendingServerMessages = []; this._pendingServerMessages = [];
this._pendingClientMessages = []; this._pendingClientMessages = [];
@ -90,7 +82,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
private createSocket(socketUrl: string): void private createSocket(socketUrl: string): void
{ {
if(!socketUrl) return; if (!socketUrl) return;
this.destroySocket(); this.destroySocket();
@ -105,14 +97,14 @@ export class SocketConnection extends EventDispatcher implements IConnection
private destroySocket(): void private destroySocket(): void
{ {
if(!this._socket) return; if (!this._socket) return;
this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_OPENED, this.onOpen); this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_OPENED, this.onOpen);
this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_CLOSED, this.onClose); this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_CLOSED, this.onClose);
this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_ERROR, this.onError); this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_ERROR, this.onError);
this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_MESSAGE, this.onMessage); this._socket.removeEventListener(WebSocketEventEnum.CONNECTION_MESSAGE, this.onMessage);
if(this._socket.readyState === WebSocket.OPEN) this._socket.close(); if (this._socket.readyState === WebSocket.OPEN) this._socket.close();
this._socket = null; this._socket = null;
} }
@ -134,7 +126,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
private onMessage(event: MessageEvent): void private onMessage(event: MessageEvent): void
{ {
if(!event) return; if (!event) return;
//this.dispatchConnectionEvent(SocketConnectionEvent.CONNECTION_MESSAGE, event); //this.dispatchConnectionEvent(SocketConnectionEvent.CONNECTION_MESSAGE, event);
@ -162,28 +154,28 @@ export class SocketConnection extends EventDispatcher implements IConnection
public send(...composers: IMessageComposer<unknown[]>[]): boolean public send(...composers: IMessageComposer<unknown[]>[]): boolean
{ {
if(this.disposed || !composers) return false; if (this.disposed || !composers) return false;
composers = [...composers]; composers = [...composers];
if(this._isAuthenticated && !this._isReady) if (this._isAuthenticated && !this._isReady)
{ {
if(!this._pendingClientMessages) this._pendingClientMessages = []; if (!this._pendingClientMessages) this._pendingClientMessages = [];
this._pendingClientMessages.push(...composers); this._pendingClientMessages.push(...composers);
return false; return false;
} }
for(const composer of composers) for (const composer of composers)
{ {
if(!composer) continue; if (!composer) continue;
const header = this._messages.getComposerId(composer); const header = this._messages.getComposerId(composer);
if(header === -1) if (header === -1)
{ {
if(Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log(`Unknown Composer: ${composer.constructor.name}`); if (Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log(`Unknown Composer: ${composer.constructor.name}`);
continue; continue;
} }
@ -191,14 +183,14 @@ export class SocketConnection extends EventDispatcher implements IConnection
const message = composer.getMessageArray(); const message = composer.getMessageArray();
const encoded = this._codec.encode(header, message); const encoded = this._codec.encode(header, message);
if(!encoded) if (!encoded)
{ {
if(Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log('Encoding Failed', composer.constructor.name); if (Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log('Encoding Failed', composer.constructor.name);
continue; continue;
} }
if(Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log('OutgoingComposer', header, composer.constructor.name, message); if (Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log('OutgoingComposer', header, composer.constructor.name, message);
this.write(encoded.getBuffer()); this.write(encoded.getBuffer());
} }
@ -208,7 +200,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
private write(buffer: ArrayBuffer): void private write(buffer: ArrayBuffer): void
{ {
if(this._socket.readyState !== WebSocket.OPEN) return; if (this._socket.readyState !== WebSocket.OPEN) return;
this._socket.send(buffer); this._socket.send(buffer);
} }
@ -230,11 +222,11 @@ export class SocketConnection extends EventDispatcher implements IConnection
{ {
const wrappers = this.splitReceivedMessages(); const wrappers = this.splitReceivedMessages();
if(!wrappers || !wrappers.length) return; if (!wrappers || !wrappers.length) return;
if(this._isAuthenticated && !this._isReady) if (this._isAuthenticated && !this._isReady)
{ {
if(!this._pendingServerMessages) this._pendingServerMessages = []; if (!this._pendingServerMessages) this._pendingServerMessages = [];
this._pendingServerMessages.push(...wrappers); this._pendingServerMessages.push(...wrappers);
@ -246,17 +238,17 @@ export class SocketConnection extends EventDispatcher implements IConnection
private processWrappers(...wrappers: IMessageDataWrapper[]): void private processWrappers(...wrappers: IMessageDataWrapper[]): void
{ {
if(!wrappers || !wrappers.length) return; if (!wrappers || !wrappers.length) return;
for(const wrapper of wrappers) for (const wrapper of wrappers)
{ {
if(!wrapper) continue; if (!wrapper) continue;
const messages = this.getMessagesForWrapper(wrapper); const messages = this.getMessagesForWrapper(wrapper);
if(!messages || !messages.length) continue; if (!messages || !messages.length) continue;
if(Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log('IncomingMessage', wrapper.header, messages[0].constructor.name, messages[0].parser); if (Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log('IncomingMessage', wrapper.header, messages[0].constructor.name, messages[0].parser);
this.handleMessages(...messages); this.handleMessages(...messages);
} }
@ -264,7 +256,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
private splitReceivedMessages(): IMessageDataWrapper[] private splitReceivedMessages(): IMessageDataWrapper[]
{ {
if(!this._dataBuffer || !this._dataBuffer.byteLength) return null; if (!this._dataBuffer || !this._dataBuffer.byteLength) return null;
return this._codec.decode(this); return this._codec.decode(this);
} }
@ -281,13 +273,13 @@ export class SocketConnection extends EventDispatcher implements IConnection
private getMessagesForWrapper(wrapper: IMessageDataWrapper): IMessageEvent[] private getMessagesForWrapper(wrapper: IMessageDataWrapper): IMessageEvent[]
{ {
if(!wrapper) return null; if (!wrapper) return null;
const events = this._messages.getEvents(wrapper.header); const events = this._messages.getEvents(wrapper.header);
if(!events || !events.length) if (!events || !events.length)
{ {
if(Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log('IncomingMessage', wrapper.header, 'UNREGISTERED', wrapper); if (Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log('IncomingMessage', wrapper.header, 'UNREGISTERED', wrapper);
return; return;
} }
@ -297,9 +289,9 @@ export class SocketConnection extends EventDispatcher implements IConnection
//@ts-ignore //@ts-ignore
const parser = new events[0].parserClass(); const parser = new events[0].parserClass();
if(!parser || !parser.flush() || !parser.parse(wrapper)) return null; if (!parser || !parser.flush() || !parser.parse(wrapper)) return null;
for(const event of events) (event.parser = parser); for (const event of events) (event.parser = parser);
} }
catch (e) catch (e)
@ -316,33 +308,33 @@ export class SocketConnection extends EventDispatcher implements IConnection
{ {
messages = [...messages]; messages = [...messages];
for(const message of messages) for (const message of messages)
{ {
if(!message) continue; if (!message) continue;
message.connection = this; message.connection = this;
if(message.callBack) message.callBack(message); if (message.callBack) message.callBack(message);
} }
} }
public registerMessages(configuration: IMessageConfiguration): void public registerMessages(configuration: IMessageConfiguration): void
{ {
if(!configuration) return; if (!configuration) return;
this._messages.registerMessages(configuration); this._messages.registerMessages(configuration);
} }
public addMessageEvent(event: IMessageEvent): void public addMessageEvent(event: IMessageEvent): void
{ {
if(!event || !this._messages) return; if (!event || !this._messages) return;
this._messages.registerMessageEvent(event); this._messages.registerMessageEvent(event);
} }
public removeMessageEvent(event: IMessageEvent): void public removeMessageEvent(event: IMessageEvent): void
{ {
if(!event || !this._messages) return; if (!event || !this._messages) return;
this._messages.removeMessageEvent(event); this._messages.removeMessageEvent(event);
} }

View File

@ -1,4 +1 @@
export * from './enums';
export * from './IConnection';
export * from './IConnectionStateListener';
export * from './SocketConnection'; export * from './SocketConnection';

View File

@ -1,5 +1,5 @@
import { IConnection } from '../../../api';
import { NitroEvent } from '../../events/NitroEvent'; import { NitroEvent } from '../../events/NitroEvent';
import { IConnection } from '../connections/IConnection';
export class SocketConnectionEvent extends NitroEvent export class SocketConnectionEvent extends NitroEvent
{ {
@ -28,4 +28,4 @@ export class SocketConnectionEvent extends NitroEvent
{ {
return this._originalEvent; return this._originalEvent;
} }
} }

View File

@ -2,5 +2,4 @@ export * from './codec';
export * from './CommunicationManager'; export * from './CommunicationManager';
export * from './connections'; export * from './connections';
export * from './events'; export * from './events';
export * from './ICommunicationManager';
export * from './messages'; export * from './messages';

View File

@ -1,6 +1,4 @@
import { IMessageComposer } from './IMessageComposer'; import { IMessageComposer, IMessageConfiguration, IMessageEvent } from '../../../api';
import { IMessageConfiguration } from './IMessageConfiguration';
import { IMessageEvent } from './IMessageEvent';
import { MessageEvent } from './MessageEvent'; import { MessageEvent } from './MessageEvent';
export class MessageClassManager export class MessageClassManager
@ -25,36 +23,36 @@ export class MessageClassManager
public registerMessages(configuration: IMessageConfiguration): void public registerMessages(configuration: IMessageConfiguration): void
{ {
for(const [ header, handler ] of configuration.events) this.registerMessageEventClass(header, handler); for (const [header, handler] of configuration.events) this.registerMessageEventClass(header, handler);
for(const [ header, handler ] of configuration.composers) this.registerMessageComposerClass(header, handler); for (const [header, handler] of configuration.composers) this.registerMessageComposerClass(header, handler);
} }
private registerMessageEventClass(header: number, handler: Function): void private registerMessageEventClass(header: number, handler: Function): void
{ {
if(!header || !handler) return; if (!header || !handler) return;
this._messageIdByEvent.set(handler, header); this._messageIdByEvent.set(handler, header);
} }
private registerMessageComposerClass(header: number, handler: Function): void private registerMessageComposerClass(header: number, handler: Function): void
{ {
if(!header || !handler) return; if (!header || !handler) return;
this._messageIdByComposer.set(handler, header); this._messageIdByComposer.set(handler, header);
} }
public registerMessageEvent(event: IMessageEvent): void public registerMessageEvent(event: IMessageEvent): void
{ {
if(!event) return; if (!event) return;
const header = this.getEventId(event); const header = this.getEventId(event);
if(!header) return; if (!header) return;
let existing = this._messageInstancesById.get(header); let existing = this._messageInstancesById.get(header);
if(!existing || !existing.length) if (!existing || !existing.length)
{ {
existing = []; existing = [];
@ -66,25 +64,25 @@ export class MessageClassManager
public removeMessageEvent(event: IMessageEvent): void public removeMessageEvent(event: IMessageEvent): void
{ {
if(!event) return; if (!event) return;
const header = this.getEventId(event); const header = this.getEventId(event);
if(!header) return; if (!header) return;
const existing = this._messageInstancesById.get(header); const existing = this._messageInstancesById.get(header);
if(!existing) return; if (!existing) return;
for(const [ index, message ] of existing.entries()) for (const [index, message] of existing.entries())
{ {
if(!message) continue; if (!message) continue;
if(message !== event) continue; if (message !== event) continue;
existing.splice(index, 1); existing.splice(index, 1);
if(existing.length === 0) this._messageInstancesById.delete(header); if (existing.length === 0) this._messageInstancesById.delete(header);
message.dispose(); message.dispose();
@ -94,36 +92,36 @@ export class MessageClassManager
public getEvents(header: number): IMessageEvent[] public getEvents(header: number): IMessageEvent[]
{ {
if(!header) return; if (!header) return;
const existing = this._messageInstancesById.get(header); const existing = this._messageInstancesById.get(header);
if(!existing) return; if (!existing) return;
return existing; return existing;
} }
public getEventId(event: IMessageEvent): number public getEventId(event: IMessageEvent): number
{ {
if(!event) return -1; if (!event) return -1;
//@ts-ignore //@ts-ignore
const name = (event instanceof MessageEvent ? event.constructor : event) as Function; const name = (event instanceof MessageEvent ? event.constructor : event) as Function;
const existing = this._messageIdByEvent.get(name); const existing = this._messageIdByEvent.get(name);
if(!existing) return -1; if (!existing) return -1;
return existing; return existing;
} }
public getComposerId(composer: IMessageComposer<unknown[]>): number public getComposerId(composer: IMessageComposer<unknown[]>): number
{ {
if(!composer) return -1; if (!composer) return -1;
const existing = this._messageIdByComposer.get(composer.constructor); const existing = this._messageIdByComposer.get(composer.constructor);
if(!existing) return -1; if (!existing) return -1;
return existing; return existing;
} }

View File

@ -1,6 +1,4 @@
import { IConnection } from '../connections/IConnection'; import { IConnection, IMessageEvent, IMessageParser } from '../../../api';
import { IMessageEvent } from './IMessageEvent';
import { IMessageParser } from './IMessageParser';
export class MessageEvent implements IMessageEvent export class MessageEvent implements IMessageEvent
{ {
@ -54,4 +52,4 @@ export class MessageEvent implements IMessageEvent
{ {
this._connection = connection; this._connection = connection;
} }
} }

View File

@ -1,7 +1,2 @@
export * from './IMessageComposer';
export * from './IMessageConfiguration';
export * from './IMessageDataWrapper';
export * from './IMessageEvent';
export * from './IMessageParser';
export * from './MessageClassManager'; export * from './MessageClassManager';
export * from './MessageEvent'; export * from './MessageEvent';

View File

@ -5,6 +5,7 @@ import { IConfigurationManager } from './IConfigurationManager';
export class ConfigurationManager extends NitroManager implements IConfigurationManager export class ConfigurationManager extends NitroManager implements IConfigurationManager
{ {
private _definitions: Map<string, unknown>; private _definitions: Map<string, unknown>;
private _config: any;
private _pendingUrls: string[]; private _pendingUrls: string[];
private _missingKeys: string[]; private _missingKeys: string[];
@ -13,6 +14,7 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
super(); super();
this._definitions = new Map(); this._definitions = new Map();
this._config = [];
this._pendingUrls = []; this._pendingUrls = [];
this._missingKeys = []; this._missingKeys = [];
@ -30,7 +32,7 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
private loadNextConfiguration(): void private loadNextConfiguration(): void
{ {
if(!this._pendingUrls.length) if (!this._pendingUrls.length)
{ {
this.dispatchConfigurationEvent(ConfigurationEvent.LOADED); this.dispatchConfigurationEvent(ConfigurationEvent.LOADED);
@ -42,7 +44,7 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
public loadConfigurationFromUrl(url: string): void public loadConfigurationFromUrl(url: string): void
{ {
if(!url || (url === '')) if (!url || (url === ''))
{ {
this.dispatchConfigurationEvent(ConfigurationEvent.FAILED); this.dispatchConfigurationEvent(ConfigurationEvent.FAILED);
@ -57,13 +59,13 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
private onConfigurationLoaded(data: { [index: string]: any }, url: string): void private onConfigurationLoaded(data: { [index: string]: any }, url: string): void
{ {
if(!data) return; if (!data) return;
if(this.parseConfiguration(data)) if (this.parseConfiguration(data))
{ {
const index = this._pendingUrls.indexOf(url); const index = this._pendingUrls.indexOf(url);
if(index >= 0) this._pendingUrls.splice(index, 1); if (index >= 0) this._pendingUrls.splice(index, 1);
this.loadNextConfiguration(); this.loadNextConfiguration();
@ -85,21 +87,21 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
private parseConfiguration(data: { [index: string]: any }, overrides: boolean = false): boolean private parseConfiguration(data: { [index: string]: any }, overrides: boolean = false): boolean
{ {
if(!data) return false; if (!data) return false;
try try
{ {
const regex = new RegExp(/\${(.*?)}/g); const regex = new RegExp(/\${(.*?)}/g);
for(const key in data) for (const key in data)
{ {
let value = data[key]; let value = data[key];
if(typeof value === 'string') value = this.interpolate((value as string), regex); if (typeof value === 'string') value = this.interpolate((value as string), regex);
if(this._definitions.has(key)) if (this._definitions.has(key))
{ {
if(overrides) this.setValue(key, value); if (overrides) this.setValue(key, value);
} }
else else
{ {
@ -120,17 +122,17 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
public interpolate(value: string, regex: RegExp = null): string public interpolate(value: string, regex: RegExp = null): string
{ {
if(!regex) regex = new RegExp(/\${(.*?)}/g); if (!regex) regex = new RegExp(/\${(.*?)}/g);
const pieces = value.match(regex); const pieces = value.match(regex);
if(pieces && pieces.length) if (pieces && pieces.length)
{ {
for(const piece of pieces) for (const piece of pieces)
{ {
const existing = (this._definitions.get(this.removeInterpolateKey(piece)) as string); const existing = (this._definitions.get(this.removeInterpolateKey(piece)) as string);
if(existing) (value = value.replace(piece, existing)); if (existing) (value = value.replace(piece, existing));
} }
} }
@ -146,12 +148,12 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
{ {
let existing = this._definitions.get(key); let existing = this._definitions.get(key);
if(existing === undefined) if (existing === undefined)
{ {
if(this._missingKeys.indexOf(key) >= 0) return value; if (this._missingKeys.indexOf(key) >= 0) return value;
this._missingKeys.push(key); this._missingKeys.push(key);
this.logger.warn(`Missing configuration key: ${ key }`); this.logger.warn(`Missing configuration key: ${key}`);
existing = value; existing = value;
} }
@ -161,6 +163,26 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
public setValue<T>(key: string, value: T): void public setValue<T>(key: string, value: T): void
{ {
const parts = key.split('.');
let last = this._config;
for (let i = 0; i < parts.length; i++)
{
const part = parts[i].toString();
if (i !== (parts.length - 1))
{
if (!last[part]) last[part] = {};
last = last[part];
continue;
}
last[part] = value;
}
this._definitions.set(key, value); this._definitions.set(key, value);
} }

View File

@ -1,4 +1,4 @@
import { INitroManager } from '../common/INitroManager'; import { INitroManager } from '../../api';
export interface IConfigurationManager extends INitroManager export interface IConfigurationManager extends INitroManager
{ {

View File

@ -1,9 +1,7 @@
import { IDisposable, IEventDispatcher, INitroLogger } from '../../api';
import { Nitro } from '../../nitro/Nitro'; import { Nitro } from '../../nitro/Nitro';
import { Disposable } from '../common/disposable/Disposable'; import { Disposable } from '../common/Disposable';
import { IDisposable } from '../common/disposable/IDisposable'; import { NitroLogger } from '../common/NitroLogger';
import { INitroLogger } from '../common/logger/INitroLogger';
import { NitroLogger } from '../common/logger/NitroLogger';
import { IEventDispatcher } from './IEventDispatcher';
import { NitroEvent } from './NitroEvent'; import { NitroEvent } from './NitroEvent';
export class EventDispatcher extends Disposable implements IEventDispatcher, IDisposable export class EventDispatcher extends Disposable implements IEventDispatcher, IDisposable
@ -28,11 +26,11 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi
public addEventListener(type: string, callback: Function): void public addEventListener(type: string, callback: Function): void
{ {
if(!type || !callback) return; if (!type || !callback) return;
const existing = this._listeners.get(type); const existing = this._listeners.get(type);
if(!existing) if (!existing)
{ {
this._listeners.set(type, [callback]); this._listeners.set(type, [callback]);
@ -44,19 +42,19 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi
public removeEventListener(type: string, callback: any): void public removeEventListener(type: string, callback: any): void
{ {
if(!type || !callback) return; if (!type || !callback) return;
const existing = this._listeners.get(type); const existing = this._listeners.get(type);
if(!existing || !existing.length) return; if (!existing || !existing.length) return;
for(const [i, cb] of existing.entries()) for (const [i, cb] of existing.entries())
{ {
if(!cb || (cb !== callback)) continue; if (!cb || (cb !== callback)) continue;
existing.splice(i, 1); existing.splice(i, 1);
if(!existing.length) this._listeners.delete(type); if (!existing.length) this._listeners.delete(type);
return; return;
} }
@ -64,9 +62,9 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi
public dispatchEvent(event: NitroEvent): boolean public dispatchEvent(event: NitroEvent): boolean
{ {
if(!event) return false; if (!event) return false;
if(Nitro.instance.getConfiguration<boolean>('system.dispatcher.log')) this._logger.log('Dispatched Event', event.type); if (Nitro.instance.getConfiguration<boolean>('system.dispatcher.log')) this._logger.log('Dispatched Event', event.type);
this.processEvent(event); this.processEvent(event);
@ -77,18 +75,18 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi
{ {
const existing = this._listeners.get(event.type); const existing = this._listeners.get(event.type);
if(!existing || !existing.length) return; if (!existing || !existing.length) return;
const callbacks = []; const callbacks = [];
for(const callback of existing) for (const callback of existing)
{ {
if(!callback) continue; if (!callback) continue;
callbacks.push(callback); callbacks.push(callback);
} }
while(callbacks.length) while (callbacks.length)
{ {
const callback = callbacks.shift(); const callback = callbacks.shift();

View File

@ -1,5 +1,2 @@
export * from './EventDispatcher'; export * from './EventDispatcher';
export * from './IEventDispatcher';
export * from './ILinkEventTracker';
export * from './IWorkerEventTracker';
export * from './NitroEvent'; export * from './NitroEvent';

View File

@ -1,4 +1,4 @@
import { IDisposable } from '../common/disposable/IDisposable'; import { IDisposable } from '../../api';
export class AdvancedMap<T, U> implements IDisposable export class AdvancedMap<T, U> implements IDisposable
{ {
@ -14,7 +14,7 @@ export class AdvancedMap<T, U> implements IDisposable
this._array = []; this._array = [];
this._keys = []; this._keys = [];
if(map) for(const [ key, value ] of map.entries()) this.add(key, value); if (map) for (const [key, value] of map.entries()) this.add(key, value);
} }
public get length(): number public get length(): number
@ -29,9 +29,9 @@ export class AdvancedMap<T, U> implements IDisposable
public dispose(): void public dispose(): void
{ {
if(!this._dictionary) if (!this._dictionary)
{ {
for(const key of this._dictionary.keys()) this._dictionary.delete(key); for (const key of this._dictionary.keys()) this._dictionary.delete(key);
this._dictionary = null; this._dictionary = null;
} }
@ -43,7 +43,7 @@ export class AdvancedMap<T, U> implements IDisposable
public reset(): void public reset(): void
{ {
for(const key of this._dictionary.keys()) this._dictionary.delete(key); for (const key of this._dictionary.keys()) this._dictionary.delete(key);
this._length = 0; this._length = 0;
this._array = []; this._array = [];
@ -52,7 +52,7 @@ export class AdvancedMap<T, U> implements IDisposable
public unshift(key: T, value: U): boolean public unshift(key: T, value: U): boolean
{ {
if(this._dictionary.get(key) !== null) return false; if (this._dictionary.get(key) !== null) return false;
this._dictionary.set(key, value); this._dictionary.set(key, value);
@ -66,7 +66,7 @@ export class AdvancedMap<T, U> implements IDisposable
public add(key: T, value: U): boolean public add(key: T, value: U): boolean
{ {
if(this._dictionary.get(key) !== undefined) return false; if (this._dictionary.get(key) !== undefined) return false;
this._dictionary.set(key, value); this._dictionary.set(key, value);
@ -82,11 +82,11 @@ export class AdvancedMap<T, U> implements IDisposable
{ {
const value = this._dictionary.get(key); const value = this._dictionary.get(key);
if(!value) return null; if (!value) return null;
const index = this._array.indexOf(value); const index = this._array.indexOf(value);
if(index >= 0) if (index >= 0)
{ {
this._array.splice(index, 1); this._array.splice(index, 1);
this._keys.splice(index, 1); this._keys.splice(index, 1);
@ -101,14 +101,14 @@ export class AdvancedMap<T, U> implements IDisposable
public getWithIndex(index: number): U public getWithIndex(index: number): U
{ {
if((index < 0) || (index >= this._length)) return null; if ((index < 0) || (index >= this._length)) return null;
return this._array[index]; return this._array[index];
} }
public getKey(index: number): T public getKey(index: number): T
{ {
if((index < 0) || (index >= this._length)) return null; if ((index < 0) || (index >= this._length)) return null;
return this._keys[index]; return this._keys[index];
} }
@ -145,7 +145,7 @@ export class AdvancedMap<T, U> implements IDisposable
public concatenate(newValues: AdvancedMap<T, U>): void public concatenate(newValues: AdvancedMap<T, U>): void
{ {
for(const k of newValues._keys) this.add(k, newValues.getValue(k)); for (const k of newValues._keys) this.add(k, newValues.getValue(k));
} }
public clone(): AdvancedMap<T, U> public clone(): AdvancedMap<T, U>

View File

@ -1,8 +1,6 @@
import { Application } from '@pixi/app'; import { Application } from '@pixi/app';
import { Ticker } from '@pixi/ticker'; import { Ticker } from '@pixi/ticker';
import { IEventDispatcher } from '../core/events/IEventDispatcher'; import { IEventDispatcher, ILinkEventTracker, IWorkerEventTracker } from '../api';
import { ILinkEventTracker } from '../core/events/ILinkEventTracker';
import { IWorkerEventTracker } from '../core/events/IWorkerEventTracker';
import { INitroCore } from '../core/INitroCore'; import { INitroCore } from '../core/INitroCore';
import { NitroTimer } from '../core/utils/NitroTimer'; import { NitroTimer } from '../core/utils/NitroTimer';
import { IRoomManager } from '../room/IRoomManager'; import { IRoomManager } from '../room/IRoomManager';

View File

@ -2,11 +2,9 @@ import { Application, IApplicationOptions } from '@pixi/app';
import { SCALE_MODES } from '@pixi/constants'; import { SCALE_MODES } from '@pixi/constants';
import { settings } from '@pixi/settings'; import { settings } from '@pixi/settings';
import { Ticker } from '@pixi/ticker'; import { Ticker } from '@pixi/ticker';
import { IEventDispatcher, ILinkEventTracker, IWorkerEventTracker } from '../api';
import { ConfigurationEvent } from '../core/configuration/ConfigurationEvent'; import { ConfigurationEvent } from '../core/configuration/ConfigurationEvent';
import { EventDispatcher } from '../core/events/EventDispatcher'; import { EventDispatcher } from '../core/events/EventDispatcher';
import { IEventDispatcher } from '../core/events/IEventDispatcher';
import { ILinkEventTracker } from '../core/events/ILinkEventTracker';
import { IWorkerEventTracker } from '../core/events/IWorkerEventTracker';
import { NitroEvent } from '../core/events/NitroEvent'; import { NitroEvent } from '../core/events/NitroEvent';
import { INitroCore } from '../core/INitroCore'; import { INitroCore } from '../core/INitroCore';
import { NitroCore } from '../core/NitroCore'; import { NitroCore } from '../core/NitroCore';
@ -72,7 +70,7 @@ export class Nitro extends Application implements INitro
{ {
super(options); super(options);
if(!Nitro.INSTANCE) Nitro.INSTANCE = this; if (!Nitro.INSTANCE) Nitro.INSTANCE = this;
this._nitroTimer = new NitroTimer(); this._nitroTimer = new NitroTimer();
this._worker = null; this._worker = null;
@ -96,12 +94,12 @@ export class Nitro extends Application implements INitro
this._core.configuration.events.addEventListener(ConfigurationEvent.LOADED, this.onConfigurationLoadedEvent.bind(this)); this._core.configuration.events.addEventListener(ConfigurationEvent.LOADED, this.onConfigurationLoadedEvent.bind(this));
this._roomEngine.events.addEventListener(RoomEngineEvent.ENGINE_INITIALIZED, this.onRoomEngineReady.bind(this)); this._roomEngine.events.addEventListener(RoomEngineEvent.ENGINE_INITIALIZED, this.onRoomEngineReady.bind(this));
if(this._worker) this._worker.onmessage = this.createWorkerEvent.bind(this); if (this._worker) this._worker.onmessage = this.createWorkerEvent.bind(this);
} }
public static bootstrap(): void public static bootstrap(): void
{ {
if(Nitro.INSTANCE) if (Nitro.INSTANCE)
{ {
Nitro.INSTANCE.dispose(); Nitro.INSTANCE.dispose();
@ -123,25 +121,25 @@ export class Nitro extends Application implements INitro
public init(): void public init(): void
{ {
if(this._isReady || this._isDisposed) return; if (this._isReady || this._isDisposed) return;
if(this._avatar) this._avatar.init(); if (this._avatar) this._avatar.init();
if(this._soundManager) this._soundManager.init(); if (this._soundManager) this._soundManager.init();
if(this._roomEngine) if (this._roomEngine)
{ {
this._roomEngine.sessionDataManager = this._sessionDataManager; this._roomEngine.sessionDataManager = this._sessionDataManager;
this._roomEngine.roomSessionManager = this._roomSessionManager; this._roomEngine.roomSessionManager = this._roomSessionManager;
this._roomEngine.roomManager = this._roomManager; this._roomEngine.roomManager = this._roomManager;
if(this._sessionDataManager) this._sessionDataManager.init(); if (this._sessionDataManager) this._sessionDataManager.init();
if(this._roomSessionManager) this._roomSessionManager.init(); if (this._roomSessionManager) this._roomSessionManager.init();
this._roomEngine.init(); this._roomEngine.init();
} }
if(!this._communication.connection) if (!this._communication.connection)
{ {
throw new Error('No connection found'); throw new Error('No connection found');
} }
@ -153,51 +151,51 @@ export class Nitro extends Application implements INitro
public dispose(): void public dispose(): void
{ {
if(this._isDisposed) return; if (this._isDisposed) return;
if(this._roomManager) if (this._roomManager)
{ {
this._roomManager.dispose(); this._roomManager.dispose();
this._roomManager = null; this._roomManager = null;
} }
if(this._roomSessionManager) if (this._roomSessionManager)
{ {
this._roomSessionManager.dispose(); this._roomSessionManager.dispose();
this._roomSessionManager = null; this._roomSessionManager = null;
} }
if(this._sessionDataManager) if (this._sessionDataManager)
{ {
this._sessionDataManager.dispose(); this._sessionDataManager.dispose();
this._sessionDataManager = null; this._sessionDataManager = null;
} }
if(this._roomEngine) if (this._roomEngine)
{ {
this._roomEngine.dispose(); this._roomEngine.dispose();
this._roomEngine = null; this._roomEngine = null;
} }
if(this._avatar) if (this._avatar)
{ {
this._avatar.dispose(); this._avatar.dispose();
this._avatar = null; this._avatar = null;
} }
if(this._soundManager) if (this._soundManager)
{ {
this._soundManager.dispose(); this._soundManager.dispose();
this._soundManager = null; this._soundManager = null;
} }
if(this._communication) if (this._communication)
{ {
this._communication.dispose(); this._communication.dispose();
@ -215,7 +213,7 @@ export class Nitro extends Application implements INitro
const animationFPS = this.getConfiguration<number>('system.animation.fps', 24); const animationFPS = this.getConfiguration<number>('system.animation.fps', 24);
const limitsFPS = this.getConfiguration<boolean>('system.limits.fps', true); const limitsFPS = this.getConfiguration<boolean>('system.limits.fps', true);
if(limitsFPS) Nitro.instance.ticker.maxFPS = animationFPS; if (limitsFPS) Nitro.instance.ticker.maxFPS = animationFPS;
} }
private onRoomEngineReady(event: RoomEngineEvent): void private onRoomEngineReady(event: RoomEngineEvent): void
@ -245,7 +243,7 @@ export class Nitro extends Application implements INitro
public addWorkerEventTracker(tracker: IWorkerEventTracker): void public addWorkerEventTracker(tracker: IWorkerEventTracker): void
{ {
if(this._workerTrackers.indexOf(tracker) >= 0) return; if (this._workerTrackers.indexOf(tracker) >= 0) return;
this._workerTrackers.push(tracker); this._workerTrackers.push(tracker);
} }
@ -254,20 +252,20 @@ export class Nitro extends Application implements INitro
{ {
const index = this._workerTrackers.indexOf(tracker); const index = this._workerTrackers.indexOf(tracker);
if(index === -1) return; if (index === -1) return;
this._workerTrackers.splice(index, 1); this._workerTrackers.splice(index, 1);
} }
public createWorkerEvent(message: MessageEvent): void public createWorkerEvent(message: MessageEvent): void
{ {
if(!message) return; if (!message) return;
const data: { [index: string]: any } = message.data; const data: { [index: string]: any } = message.data;
for(const tracker of this._workerTrackers) for (const tracker of this._workerTrackers)
{ {
if(!tracker) continue; if (!tracker) continue;
tracker.workerMessageReceived(data); tracker.workerMessageReceived(data);
} }
@ -275,14 +273,14 @@ export class Nitro extends Application implements INitro
public sendWorkerEvent(message: { [index: string]: any }): void public sendWorkerEvent(message: { [index: string]: any }): void
{ {
if(!message || !this._worker) return; if (!message || !this._worker) return;
this._worker.postMessage(message); this._worker.postMessage(message);
} }
public addLinkEventTracker(tracker: ILinkEventTracker): void public addLinkEventTracker(tracker: ILinkEventTracker): void
{ {
if(this._linkTrackers.indexOf(tracker) >= 0) return; if (this._linkTrackers.indexOf(tracker) >= 0) return;
this._linkTrackers.push(tracker); this._linkTrackers.push(tracker);
} }
@ -291,24 +289,24 @@ export class Nitro extends Application implements INitro
{ {
const index = this._linkTrackers.indexOf(tracker); const index = this._linkTrackers.indexOf(tracker);
if(index === -1) return; if (index === -1) return;
this._linkTrackers.splice(index, 1); this._linkTrackers.splice(index, 1);
} }
public createLinkEvent(link: string): void public createLinkEvent(link: string): void
{ {
if(!link || (link === '')) return; if (!link || (link === '')) return;
for(const tracker of this._linkTrackers) for (const tracker of this._linkTrackers)
{ {
if(!tracker) continue; if (!tracker) continue;
const prefix = tracker.eventUrlPrefix; const prefix = tracker.eventUrlPrefix;
if(prefix.length > 0) if (prefix.length > 0)
{ {
if(link.substr(0, prefix.length) === prefix) tracker.linkReceived(link); if (link.substr(0, prefix.length) === prefix) tracker.linkReceived(link);
} }
else else
{ {

View File

@ -1,6 +1,6 @@
import { IDisposable } from '../../core/common/disposable/IDisposable'; import { IDisposable } from '../../api';
export interface IAvatarEffectListener extends IDisposable export interface IAvatarEffectListener extends IDisposable
{ {
resetEffect(effect: number): void; resetEffect(effect: number): void;
} }

View File

@ -1,7 +1,6 @@
import { RenderTexture } from '@pixi/core'; import { RenderTexture } from '@pixi/core';
import { Sprite } from '@pixi/sprite'; import { Sprite } from '@pixi/sprite';
import { IGraphicAsset } from '../../api'; import { IDisposable, IGraphicAsset } from '../../api';
import { IDisposable } from '../../core/common/disposable/IDisposable';
import { IAnimationLayerData } from './animation/IAnimationLayerData'; import { IAnimationLayerData } from './animation/IAnimationLayerData';
import { IAvatarDataContainer } from './animation/IAvatarDataContainer'; import { IAvatarDataContainer } from './animation/IAvatarDataContainer';
import { ISpriteDataContainer } from './animation/ISpriteDataContainer'; import { ISpriteDataContainer } from './animation/ISpriteDataContainer';

View File

@ -1,4 +1,4 @@
import { IDisposable } from '../../core/common/disposable/IDisposable'; import { IDisposable } from '../../api';
export interface IAvatarImageListener extends IDisposable export interface IAvatarImageListener extends IDisposable
{ {

View File

@ -1,5 +1,4 @@
import { IAssetManager, IGraphicAsset } from '../../api'; import { IAssetManager, IGraphicAsset, INitroManager } from '../../api';
import { INitroManager } from '../../core/common/INitroManager';
import { AvatarAssetDownloadManager } from './AvatarAssetDownloadManager'; import { AvatarAssetDownloadManager } from './AvatarAssetDownloadManager';
import { AvatarStructure } from './AvatarStructure'; import { AvatarStructure } from './AvatarStructure';
import { IAvatarEffectListener } from './IAvatarEffectListener'; import { IAvatarEffectListener } from './IAvatarEffectListener';

View File

@ -1,5 +1,5 @@
import { Resource, Texture } from '@pixi/core'; import { Resource, Texture } from '@pixi/core';
import { IEventDispatcher } from '../../core'; import { IEventDispatcher } from '../../api';
import { IRoomCameraWidgetEffect } from './IRoomCameraWidgetEffect'; import { IRoomCameraWidgetEffect } from './IRoomCameraWidgetEffect';
import { IRoomCameraWidgetSelectedEffect } from './IRoomCameraWidgetSelectedEffect'; import { IRoomCameraWidgetSelectedEffect } from './IRoomCameraWidgetSelectedEffect';

View File

@ -1,6 +1,7 @@
import { Texture } from '@pixi/core'; import { Texture } from '@pixi/core';
import { ColorMatrix, ColorMatrixFilter } from '@pixi/filter-color-matrix'; import { ColorMatrix, ColorMatrixFilter } from '@pixi/filter-color-matrix';
import { EventDispatcher, IEventDispatcher, NitroContainer, NitroSprite } from '../../core'; import { IEventDispatcher } from '../../api';
import { EventDispatcher, NitroContainer, NitroSprite } from '../../core';
import { TextureUtils } from '../../room'; import { TextureUtils } from '../../room';
import { Nitro } from '../Nitro'; import { Nitro } from '../Nitro';
import { RoomCameraWidgetManagerEvent } from './events/RoomCameraWidgetManagerEvent'; import { RoomCameraWidgetManagerEvent } from './events/RoomCameraWidgetManagerEvent';

View File

@ -1,6 +1,4 @@
import { IMessageEvent } from '../../core'; import { IConnection, IMessageEvent, INitroManager } from '../../api';
import { INitroManager } from '../../core/common/INitroManager';
import { IConnection } from '../../core/communication/connections/IConnection';
import { NitroCommunicationDemo } from './demo/NitroCommunicationDemo'; import { NitroCommunicationDemo } from './demo/NitroCommunicationDemo';
export interface INitroCommunicationManager extends INitroManager export interface INitroCommunicationManager extends INitroManager

View File

@ -1,10 +1,6 @@
import { IMessageEvent } from '../../core'; import { ICommunicationManager, IConnection, IConnectionStateListener, IMessageConfiguration, IMessageEvent } from '../../api';
import { NitroManager } from '../../core/common/NitroManager'; import { NitroManager } from '../../core/common/NitroManager';
import { IConnection } from '../../core/communication/connections/IConnection';
import { IConnectionStateListener } from '../../core/communication/connections/IConnectionStateListener';
import { SocketConnectionEvent } from '../../core/communication/events/SocketConnectionEvent'; import { SocketConnectionEvent } from '../../core/communication/events/SocketConnectionEvent';
import { ICommunicationManager } from '../../core/communication/ICommunicationManager';
import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration';
import { NitroEvent } from '../../core/events/NitroEvent'; import { NitroEvent } from '../../core/events/NitroEvent';
import { Nitro } from '../Nitro'; import { Nitro } from '../Nitro';
import { NitroCommunicationDemo } from './demo/NitroCommunicationDemo'; import { NitroCommunicationDemo } from './demo/NitroCommunicationDemo';
@ -38,7 +34,7 @@ export class NitroCommunicationManager extends NitroManager implements INitroCom
protected onInit(): void protected onInit(): void
{ {
if(this._connection) return; if (this._connection) return;
Nitro.instance.events.addEventListener(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, this.onConnectionAuthenticatedEvent); Nitro.instance.events.addEventListener(NitroCommunicationDemoEvent.CONNECTION_AUTHENTICATED, this.onConnectionAuthenticatedEvent);
@ -50,16 +46,16 @@ export class NitroCommunicationManager extends NitroManager implements INitroCom
this._connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); this._connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent);
this._connection.addEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent); this._connection.addEventListener(SocketConnectionEvent.CONNECTION_ERROR, this.onConnectionErrorEvent);
if(this._demo) this._demo.init(); if (this._demo) this._demo.init();
this._connection.init(Nitro.instance.getConfiguration<string>('socket.url')); this._connection.init(Nitro.instance.getConfiguration<string>('socket.url'));
} }
protected onDispose(): void protected onDispose(): void
{ {
if(this._demo) this._demo.dispose(); if (this._demo) this._demo.dispose();
if(this._connection) if (this._connection)
{ {
this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent);
this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); this._connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent);
@ -90,24 +86,24 @@ export class NitroCommunicationManager extends NitroManager implements INitroCom
{ {
this.logger.log('Connection Authenticated'); this.logger.log('Connection Authenticated');
if(this._connection) this._connection.authenticated(); if (this._connection) this._connection.authenticated();
} }
public connectionInit(socketUrl: string): void public connectionInit(socketUrl: string): void
{ {
this.logger.log(`Initializing Connection: ${ socketUrl }`); this.logger.log(`Initializing Connection: ${socketUrl}`);
} }
public registerMessageEvent(event: IMessageEvent): IMessageEvent public registerMessageEvent(event: IMessageEvent): IMessageEvent
{ {
if(this._connection) this._connection.addMessageEvent(event); if (this._connection) this._connection.addMessageEvent(event);
return event; return event;
} }
public removeMessageEvent(event: IMessageEvent): void public removeMessageEvent(event: IMessageEvent): void
{ {
if(!this._connection) return; if (!this._connection) return;
this._connection.removeMessageEvent(event); this._connection.removeMessageEvent(event);
} }

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
import { IConnection } from '../../../api';
import { NitroManager } from '../../../core/common/NitroManager'; import { NitroManager } from '../../../core/common/NitroManager';
import { IConnection } from '../../../core/communication/connections/IConnection';
import { SocketConnectionEvent } from '../../../core/communication/events/SocketConnectionEvent'; import { SocketConnectionEvent } from '../../../core/communication/events/SocketConnectionEvent';
import { Nitro } from '../../Nitro'; import { Nitro } from '../../Nitro';
import { INitroCommunicationManager } from '../INitroCommunicationManager'; import { INitroCommunicationManager } from '../INitroCommunicationManager';
@ -41,7 +41,7 @@ export class NitroCommunicationDemo extends NitroManager
{ {
const connection = this._communication.connection; const connection = this._communication.connection;
if(connection) if (connection)
{ {
connection.addEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); connection.addEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent);
connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); connection.addEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent);
@ -56,7 +56,7 @@ export class NitroCommunicationDemo extends NitroManager
{ {
const connection = this._communication.connection; const connection = this._communication.connection;
if(connection) if (connection)
{ {
connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent); connection.removeEventListener(SocketConnectionEvent.CONNECTION_OPENED, this.onConnectionOpenedEvent);
connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent); connection.removeEventListener(SocketConnectionEvent.CONNECTION_CLOSED, this.onConnectionClosedEvent);
@ -74,13 +74,13 @@ export class NitroCommunicationDemo extends NitroManager
{ {
const connection = this._communication.connection; const connection = this._communication.connection;
if(!connection) return; if (!connection) return;
this._didConnect = true; this._didConnect = true;
this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_ESTABLISHED, connection); this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_ESTABLISHED, connection);
if(Nitro.instance.getConfiguration<boolean>('system.pong.manually', false)) this.startPonging(); if (Nitro.instance.getConfiguration<boolean>('system.pong.manually', false)) this.startPonging();
this.startHandshake(connection); this.startHandshake(connection);
@ -93,18 +93,18 @@ export class NitroCommunicationDemo extends NitroManager
{ {
const connection = this._communication.connection; const connection = this._communication.connection;
if(!connection) return; if (!connection) return;
this.stopPonging(); this.stopPonging();
if(this._didConnect) this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, connection); if (this._didConnect) this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_CLOSED, connection);
} }
private onConnectionErrorEvent(event: CloseEvent): void private onConnectionErrorEvent(event: CloseEvent): void
{ {
const connection = this._communication.connection; const connection = this._communication.connection;
if(!connection) return; if (!connection) return;
this.stopPonging(); this.stopPonging();
@ -113,9 +113,9 @@ export class NitroCommunicationDemo extends NitroManager
private tryAuthentication(connection: IConnection): void private tryAuthentication(connection: IConnection): void
{ {
if(!connection || !this.getSSO()) if (!connection || !this.getSSO())
{ {
if(!this.getSSO()) if (!this.getSSO())
{ {
this.logger.error('Login without an SSO ticket is not supported'); this.logger.error('Login without an SSO ticket is not supported');
} }
@ -130,14 +130,14 @@ export class NitroCommunicationDemo extends NitroManager
private onClientPingEvent(event: ClientPingEvent): void private onClientPingEvent(event: ClientPingEvent): void
{ {
if(!event || !event.connection) return; if (!event || !event.connection) return;
this.sendPong(event.connection); this.sendPong(event.connection);
} }
private onAuthenticatedEvent(event: AuthenticatedEvent): void private onAuthenticatedEvent(event: AuthenticatedEvent): void
{ {
if(!event || !event.connection) return; if (!event || !event.connection) return;
this.completeHandshake(event.connection); this.completeHandshake(event.connection);
@ -169,7 +169,7 @@ export class NitroCommunicationDemo extends NitroManager
private stopPonging(): void private stopPonging(): void
{ {
if(!this._pongInterval) return; if (!this._pongInterval) return;
clearInterval(this._pongInterval); clearInterval(this._pongInterval);
@ -180,7 +180,7 @@ export class NitroCommunicationDemo extends NitroManager
{ {
connection = ((connection || this._communication.connection) || null); connection = ((connection || this._communication.connection) || null);
if(!connection) return; if (!connection) return;
connection.send(new PongMessageComposer()); connection.send(new PongMessageComposer());
} }

View File

@ -1,4 +1,4 @@
import { IConnection } from '../../../core/communication/connections/IConnection'; import { IConnection } from '../../../api';
import { NitroEvent } from '../../../core/events/NitroEvent'; import { NitroEvent } from '../../../core/events/NitroEvent';
export class NitroCommunicationDemoEvent extends NitroEvent export class NitroCommunicationDemoEvent extends NitroEvent
@ -24,4 +24,4 @@ export class NitroCommunicationDemoEvent extends NitroEvent
{ {
return this._connection; return this._connection;
} }
} }

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { InterstitialMessageParser } from '../../parser'; import { InterstitialMessageParser } from '../../parser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { RoomAdErrorMessageParser } from '../../parser'; import { RoomAdErrorMessageParser } from '../../parser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { AvailabilityStatusMessageParser } from '../../parser/availability/AvailabilityStatusMessageParser'; import { AvailabilityStatusMessageParser } from '../../parser/availability/AvailabilityStatusMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { AvailabilityTimeMessageParser } from '../../parser'; import { AvailabilityTimeMessageParser } from '../../parser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { HotelClosedAndOpensMessageParser } from '../../parser'; import { HotelClosedAndOpensMessageParser } from '../../parser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { HotelClosesAndWillOpenAtMessageParser } from '../../parser'; import { HotelClosesAndWillOpenAtMessageParser } from '../../parser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { HotelWillCloseInMinutesMessageParser } from '../../parser'; import { HotelWillCloseInMinutesMessageParser } from '../../parser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { MaintenanceStatusMessageParser } from '../../parser'; import { MaintenanceStatusMessageParser } from '../../parser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { ChangeUserNameResultMessageParser } from '../../parser/avatar/ChangeUserNameResultMessageParser'; import { ChangeUserNameResultMessageParser } from '../../parser/avatar/ChangeUserNameResultMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CheckUserNameResultMessageParser } from '../../parser/avatar/CheckUserNameResultMessageParser'; import { CheckUserNameResultMessageParser } from '../../parser/avatar/CheckUserNameResultMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { FigureUpdateParser } from '../../parser'; import { FigureUpdateParser } from '../../parser';

View File

@ -1,4 +1,4 @@
import { IMessageDataWrapper } from '../../../../../core'; import { IMessageDataWrapper } from '../../../../../api';
export class OutfitData export class OutfitData
{ {

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { WardrobeMessageParser } from '../../parser'; import { WardrobeMessageParser } from '../../parser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { BotAddedToInventoryParser } from '../../parser/bots/BotAddedToInventoryParser'; import { BotAddedToInventoryParser } from '../../parser/bots/BotAddedToInventoryParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { BotInventoryMessageParser } from '../../parser/bots/BotInventoryMessageParser'; import { BotInventoryMessageParser } from '../../parser/bots/BotInventoryMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { BotReceivedMessageParser } from '../../parser/bots/BotReceivedMessageParser'; import { BotReceivedMessageParser } from '../../parser/bots/BotReceivedMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { BotRemovedFromInventoryParser } from '../../parser/bots/BotRemovedFromInventoryParser'; import { BotRemovedFromInventoryParser } from '../../parser/bots/BotRemovedFromInventoryParser';

View File

@ -1,4 +1,4 @@
import { IDisposable, IMessageDataWrapper } from '../../../../../core'; import { IDisposable, IMessageDataWrapper } from '../../../../../api';
import { INamed } from '../moderation'; import { INamed } from '../moderation';
import { CallForHelpTopicData } from './CallForHelpTopicData'; import { CallForHelpTopicData } from './CallForHelpTopicData';
@ -15,7 +15,7 @@ export class CallForHelpCategoryData implements INamed, IDisposable
let count = wrapper.readInt(); let count = wrapper.readInt();
while(count > 0) while (count > 0)
{ {
this._topics.push(new CallForHelpTopicData(wrapper)); this._topics.push(new CallForHelpTopicData(wrapper));
@ -25,7 +25,7 @@ export class CallForHelpCategoryData implements INamed, IDisposable
public dispose(): void public dispose(): void
{ {
if(this._disposed) return; if (this._disposed) return;
this._disposed = true; this._disposed = true;
this._topics = null; this._topics = null;

View File

@ -1,4 +1,4 @@
import { IMessageDataWrapper } from '../../../../../core'; import { IMessageDataWrapper } from '../../../../../api';
import { INamed } from '../moderation'; import { INamed } from '../moderation';
export class CallForHelpTopicData implements INamed export class CallForHelpTopicData implements INamed

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CfhSanctionMessageParser } from '../../parser/callforhelp/CfhSanctionMessageParser'; import { CfhSanctionMessageParser } from '../../parser/callforhelp/CfhSanctionMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageDataWrapper } from '../../../../../core'; import { IMessageDataWrapper } from '../../../../../api';
import { INamed } from '../moderation'; import { INamed } from '../moderation';
export class CfhSanctionTypeData implements INamed export class CfhSanctionTypeData implements INamed
@ -17,9 +17,9 @@ export class CfhSanctionTypeData implements INamed
this._probationDays = wrapper.readInt(); this._probationDays = wrapper.readInt();
this._avatarOnly = wrapper.readBoolean(); this._avatarOnly = wrapper.readBoolean();
if(wrapper.bytesAvailable) this._tradeLockInfo = wrapper.readString(); if (wrapper.bytesAvailable) this._tradeLockInfo = wrapper.readString();
if(wrapper.bytesAvailable) this._machineBanInfo = wrapper.readString(); if (wrapper.bytesAvailable) this._machineBanInfo = wrapper.readString();
} }
public get name(): string public get name(): string

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CfhTopicsInitMessageParser } from '../../parser/callforhelp/CfhTopicsInitMessageParser'; import { CfhTopicsInitMessageParser } from '../../parser/callforhelp/CfhTopicsInitMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { SanctionStatusMessageParser } from '../../parser/callforhelp'; import { SanctionStatusMessageParser } from '../../parser/callforhelp';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CameraPublishStatusMessageParser } from '../../parser/camera/CameraPublishStatusMessageParser'; import { CameraPublishStatusMessageParser } from '../../parser/camera/CameraPublishStatusMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CameraPurchaseOKMessageParser } from '../../parser/camera/CameraPurchaseOKMessageParser'; import { CameraPurchaseOKMessageParser } from '../../parser/camera/CameraPurchaseOKMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CameraStorageUrlMessageParser } from '../../parser/camera/CameraStorageUrlMessageParser'; import { CameraStorageUrlMessageParser } from '../../parser/camera/CameraStorageUrlMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CompetitionStatusMessageParser } from '../../parser/camera/CompetitionStatusMessageParser'; import { CompetitionStatusMessageParser } from '../../parser/camera/CompetitionStatusMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { InitCameraMessageParser } from '../../parser/camera/InitCameraMessageParser'; import { InitCameraMessageParser } from '../../parser/camera/InitCameraMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { ThumbnailStatusMessageParser } from '../../parser/camera/ThumbnailStatusMessageParser'; import { ThumbnailStatusMessageParser } from '../../parser/camera/ThumbnailStatusMessageParser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CampaignCalendarDataMessageParser } from '../../parser/campaign'; import { CampaignCalendarDataMessageParser } from '../../parser/campaign';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { CampaignCalendarDoorOpenedMessageParser } from '../../parser/campaign'; import { CampaignCalendarDoorOpenedMessageParser } from '../../parser/campaign';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { BonusRareInfoMessageParser } from '../../parser'; import { BonusRareInfoMessageParser } from '../../parser';

View File

@ -1,4 +1,4 @@
import { IMessageEvent } from '../../../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../../../api';
import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent'; import { MessageEvent } from '../../../../../core/communication/messages/MessageEvent';
import { BuildersClubFurniCountMessageParser } from '../../parser'; import { BuildersClubFurniCountMessageParser } from '../../parser';

Some files were not shown because too many files have changed in this diff Show More