Continue refactor

This commit is contained in:
billsonnn 2024-03-20 22:37:27 -04:00
parent 815f1cd6c9
commit df3bd5bf52
23 changed files with 101 additions and 89 deletions

View File

@ -1,4 +1,4 @@
import { Container, Point, Sprite, Texture } from 'pixi.js'; import { Container, Point, Texture } from 'pixi.js';
import { IRoomGeometry } from '../IRoomGeometry'; import { IRoomGeometry } from '../IRoomGeometry';
import { RoomObjectSpriteData } from '../RoomObjectSpriteData'; import { RoomObjectSpriteData } from '../RoomObjectSpriteData';
import { ISortableSprite } from '../object'; import { ISortableSprite } from '../object';
@ -25,7 +25,7 @@ export interface IRoomRenderingCanvas
moveDown(): void; moveDown(): void;
id: number; id: number;
geometry: IRoomGeometry; geometry: IRoomGeometry;
master: Sprite; master: Container;
display: Container; display: Container;
screenOffsetX: number; screenOffsetX: number;
screenOffsetY: number; screenOffsetY: number;

View File

@ -23,21 +23,26 @@ export class GraphicAssetPalette implements IGraphicAssetPalette
const pixelOutput = TextureUtils.getPixels(texture); const pixelOutput = TextureUtils.getPixels(texture);
const pixels = pixelOutput?.pixels; const pixels = pixelOutput?.pixels;
if(pixels) if(!pixels) return texture;
{
const canvas = document.createElement('canvas');
const ctx = canvas.getContext('2d');
const imageData = ctx.createImageData(texture.width, texture.height);
for(let i = 0; i < pixels.length; i += 4) for(let i = 0; i < pixels.length; i += 4)
{ {
let paletteColor = this._palette[pixels[i + 1]]; let paletteColor = this._palette[pixels[i + 1]];
if(paletteColor === undefined) paletteColor = [0, 0, 0]; if(paletteColor === undefined) paletteColor = [0, 0, 0];
pixels[i] = paletteColor[0]; imageData.data[i] = paletteColor[0];
pixels[i + 1] = paletteColor[1]; imageData.data[i + 1] = paletteColor[1];
pixels[i + 2] = paletteColor[2]; imageData.data[i + 2] = paletteColor[2];
}
} }
return Texture.from(pixelOutput); ctx.putImageData(imageData, 0, 0);
return Texture.from(canvas);
} }
public get primaryColor(): number public get primaryColor(): number

View File

@ -0,0 +1,5 @@
import { RoomCameraWidgetManager } from './RoomCameraWidgetManager';
const roomCameraWidgetManager = new RoomCameraWidgetManager();
export const GetRoomCameraWidgetManager = () => roomCameraWidgetManager;

View File

@ -1,3 +1,4 @@
export * from './GetRoomCameraWidgetManager';
export * from './RoomCameraWidgetEffect'; export * from './RoomCameraWidgetEffect';
export * from './RoomCameraWidgetManager'; export * from './RoomCameraWidgetManager';
export * from './RoomCameraWidgetSelectedEffect'; export * from './RoomCameraWidgetSelectedEffect';

View File

@ -1,4 +1,5 @@
import { IConfigurationManager } from './IConfigurationManager'; import { NitroLogger } from '@nitrots/utils';
import { IConfigurationManager } from './IConfigurationManager';
export class ConfigurationManager implements IConfigurationManager export class ConfigurationManager implements IConfigurationManager
{ {
@ -76,7 +77,7 @@ export class ConfigurationManager implements IConfigurationManager
catch (e) catch (e)
{ {
console.error(e.stack); NitroLogger.error(e.stack);
return false; return false;
} }
@ -116,7 +117,7 @@ export class ConfigurationManager implements IConfigurationManager
this._missingKeys.push(key); this._missingKeys.push(key);
console.warn(`Missing configuration key: ${key}`); NitroLogger.warn(`Missing configuration key: ${key}`);
existing = value; existing = value;
} }

View File

@ -40,7 +40,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
private _sessionDataManager: ISessionDataManager = GetSessionDataManager(); private _sessionDataManager: ISessionDataManager = GetSessionDataManager();
private _roomManager: IRoomManager = GetRoomManager(); private _roomManager: IRoomManager = GetRoomManager();
private _roomObjectEventHandler: RoomObjectEventHandler = new RoomObjectEventHandler(); private _roomObjectEventHandler: RoomObjectEventHandler = new RoomObjectEventHandler(this);
private _imageObjectIdBank: NumberBank = new NumberBank(1000); private _imageObjectIdBank: NumberBank = new NumberBank(1000);
private _imageCallbacks: Map<string, IGetImageListener[]> = new Map(); private _imageCallbacks: Map<string, IGetImageListener[]> = new Map();
private _thumbnailObjectIdBank: NumberBank = new NumberBank(1000); private _thumbnailObjectIdBank: NumberBank = new NumberBank(1000);
@ -345,11 +345,11 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
canvas.geometry.setDisplacement(vector, direction); canvas.geometry.setDisplacement(vector, direction);
const displayObject = (canvas.master as Container); const displayObject = canvas.master;
if(displayObject) if(displayObject)
{ {
const overlay = new Sprite(Texture.EMPTY); const overlay = new Container();
overlay.label = RoomEngine.OVERLAY; overlay.label = RoomEngine.OVERLAY;
@ -2474,21 +2474,21 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
this._roomObjectEventHandler.cancelRoomObjectInsert(this._activeRoomId); this._roomObjectEventHandler.cancelRoomObjectInsert(this._activeRoomId);
} }
private addOverlayIconSprite(k: Sprite, _arg_2: string, _arg_3: Texture, scale: number = 1): Sprite private addOverlayIconSprite(container: Container, label: string, texture: Texture, scale: number = 1): Sprite
{ {
if(!k || !_arg_3) return; if(!container || !texture) return;
let sprite = this.getOverlayIconSprite(k, _arg_2); let sprite = this.getOverlayIconSprite(container, label);
if(sprite) return null; if(sprite) return null;
sprite = new Sprite(_arg_3); sprite = new Sprite(texture);
sprite.label = _arg_2; sprite.label = label;
sprite.scale.set(scale); sprite.scale.set(scale);
k.addChild(sprite); container.addChild(sprite);
return sprite; return sprite;
} }
@ -3006,37 +3006,37 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
if(!canvas) return; if(!canvas) return;
const sprite = this.getRenderingCanvasOverlay(canvas); const overlayContainer = this.getRenderingCanvasOverlay(canvas);
this.removeOverlayIconSprite(sprite, RoomEngine.OBJECT_ICON_SPRITE); this.removeOverlayIconSprite(overlayContainer, RoomEngine.OBJECT_ICON_SPRITE);
} }
private getRenderingCanvasOverlay(k: IRoomRenderingCanvas): Sprite private getRenderingCanvasOverlay(canvas: IRoomRenderingCanvas): Container
{ {
if(!k) return null; if(!canvas) return null;
const displayObject = (k.master as Container); const displayObject = canvas.master;
if(!displayObject) return null; if(!displayObject) return null;
return ((displayObject.getChildByName(RoomEngine.OVERLAY) as Sprite) || null); return displayObject.getChildByName(RoomEngine.OVERLAY) ?? null;
} }
private removeOverlayIconSprite(k: Sprite, _arg_2: string): boolean private removeOverlayIconSprite(container: Container, label: string): boolean
{ {
if(!k) return false; if(!container) return false;
let index = (k.children.length - 1); let index = (container.children.length - 1);
while(index >= 0) while(index >= 0)
{ {
const child = (k.getChildAt(index) as Sprite); const child = (container.getChildAt(index) as Sprite);
if(child) if(child)
{ {
if(child.label === _arg_2) if(child.label === label)
{ {
k.removeChildAt(index); container.removeChildAt(index);
if(child.children.length) if(child.children.length)
{ {
@ -3057,19 +3057,19 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
return false; return false;
} }
private getOverlayIconSprite(k: Sprite, _arg_2: string): Sprite private getOverlayIconSprite(container: Container, label: string): Sprite
{ {
if(!k) return null; if(!container) return null;
let index = (k.children.length - 1); let index = (container.children.length - 1);
while(index >= 0) while(index >= 0)
{ {
const child = (k.getChildAt(index) as Sprite); const child = (container.getChildAt(index) as Sprite);
if(child) if(child)
{ {
if(child.label === _arg_2) return child; if(child.label === label) return child;
} }
index--; index--;

View File

@ -18,6 +18,11 @@ export class RoomManager implements IRoomManager, IRoomInstanceContainer
private _pendingContentTypes: string[] = []; private _pendingContentTypes: string[] = [];
private _skipContentProcessing: boolean = false; private _skipContentProcessing: boolean = false;
constructor()
{
this.onRoomContentLoadedEvent = this.onRoomContentLoadedEvent.bind(this);
}
public async init(listener: IRoomManagerListener): Promise<void> public async init(listener: IRoomManagerListener): Promise<void>
{ {
this._listener = listener; this._listener = listener;

View File

@ -5,14 +5,11 @@ import { GetEventDispatcher, RoomEngineDimmerStateEvent, RoomEngineObjectEvent,
import { GetRoomSessionManager, GetSessionDataManager } from '@nitrots/session'; import { GetRoomSessionManager, GetSessionDataManager } from '@nitrots/session';
import { CreateLinkEvent, NitroLogger, RoomId, Vector3d } from '@nitrots/utils'; import { CreateLinkEvent, NitroLogger, RoomId, Vector3d } from '@nitrots/utils';
import { RoomEnterEffect, RoomObjectUpdateMessage } from '../../room'; import { RoomEnterEffect, RoomObjectUpdateMessage } from '../../room';
import { GetRoomEngine } from './GetRoomEngine';
import { ObjectAvatarSelectedMessage, ObjectDataUpdateMessage, ObjectSelectedMessage, ObjectTileCursorUpdateMessage, ObjectVisibilityUpdateMessage } from './messages'; import { ObjectAvatarSelectedMessage, ObjectDataUpdateMessage, ObjectSelectedMessage, ObjectTileCursorUpdateMessage, ObjectVisibilityUpdateMessage } from './messages';
import { SelectedRoomObjectData } from './utils'; import { SelectedRoomObjectData } from './utils';
export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomObjectEventManager export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomObjectEventManager
{ {
private _roomEngine: IRoomEngineServices = GetRoomEngine();
private _eventIds: Map<number, Map<string, string>> = new Map(); private _eventIds: Map<number, Map<string, string>> = new Map();
private _selectedAvatarId: number = -1; private _selectedAvatarId: number = -1;
@ -21,7 +18,8 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
private _whereYouClickIsWhereYouGo: boolean = true; private _whereYouClickIsWhereYouGo: boolean = true;
private _objectPlacementSource: string = null; private _objectPlacementSource: string = null;
constructor() constructor(
private readonly _roomEngine: IRoomEngineServices)
{ {
GetEventDispatcher().addEventListener<RoomEngineObjectEvent>(RoomEngineObjectEvent.ADDED, event => this.onRoomEngineObjectEvent(event)); GetEventDispatcher().addEventListener<RoomEngineObjectEvent>(RoomEngineObjectEvent.ADDED, event => this.onRoomEngineObjectEvent(event));
} }

View File

@ -491,8 +491,10 @@ export class RoomPreviewer
return this._addViewOffset; return this._addViewOffset;
} }
public updatePreviewObjectBoundingRectangle(point: Point): void public updatePreviewObjectBoundingRectangle(point: Point = null): void
{ {
if(!point) point = new Point(0, 0);
const objectBounds = this._roomEngine.getRoomObjectBoundingRectangle(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory, RoomPreviewer.PREVIEW_CANVAS_ID); const objectBounds = this._roomEngine.getRoomObjectBoundingRectangle(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory, RoomPreviewer.PREVIEW_CANVAS_ID);
if(objectBounds && point) if(objectBounds && point)

View File

@ -1,4 +1,7 @@
export * from './GetRoomContentLoader';
export * from './GetRoomEngine'; export * from './GetRoomEngine';
export * from './GetRoomManager';
export * from './GetRoomMessageHandler';
export * from './GetRoomObjectLogicFactory'; export * from './GetRoomObjectLogicFactory';
export * from './GetRoomObjectVisualizationFactory'; export * from './GetRoomObjectVisualizationFactory';
export * from './ImageResult'; export * from './ImageResult';

View File

@ -1,37 +1,27 @@
import { AvatarScaleType, IAssetData, IAvatarEffectListener, IAvatarImage, IAvatarImageListener, IAvatarRenderManager, IObjectVisualizationData } from '@nitrots/api'; import { AvatarScaleType, IAssetData, IAvatarEffectListener, IAvatarImage, IAvatarImageListener, IObjectVisualizationData } from '@nitrots/api';
import { GetAvatarRenderManager } from '@nitrots/avatar'; import { GetAvatarRenderManager } from '@nitrots/avatar';
export class AvatarVisualizationData implements IObjectVisualizationData export class AvatarVisualizationData implements IObjectVisualizationData
{ {
private _avatarRenderer: IAvatarRenderManager;
public initialize(asset: IAssetData): boolean public initialize(asset: IAssetData): boolean
{ {
this._avatarRenderer = GetAvatarRenderManager();
return true; return true;
} }
public dispose(): void public dispose(): void
{ {
this._avatarRenderer = null;
} }
public createAvatarImage(figure: string, size: number, gender: string = null, avatarListener: IAvatarImageListener = null, effectListener: IAvatarEffectListener = null): IAvatarImage public createAvatarImage(figure: string, size: number, gender: string = null, avatarListener: IAvatarImageListener = null, effectListener: IAvatarEffectListener = null): IAvatarImage
{ {
let avatarImage: IAvatarImage = null; let avatarImage: IAvatarImage = null;
if(size > 48) avatarImage = this._avatarRenderer.createAvatarImage(figure, AvatarScaleType.LARGE, gender, avatarListener, effectListener); if(size > 48) avatarImage = GetAvatarRenderManager().createAvatarImage(figure, AvatarScaleType.LARGE, gender, avatarListener, effectListener);
else avatarImage = this._avatarRenderer.createAvatarImage(figure, AvatarScaleType.SMALL, gender, avatarListener, effectListener); else avatarImage = GetAvatarRenderManager().createAvatarImage(figure, AvatarScaleType.SMALL, gender, avatarListener, effectListener);
return avatarImage; return avatarImage;
} }
public get avatarManager(): IAvatarRenderManager
{
return this._avatarRenderer;
}
public get layerCount(): number public get layerCount(): number
{ {
return 0; return 0;

View File

@ -24,6 +24,8 @@ export class LayerData
{ {
if(!layer) return; if(!layer) return;
console.log(layer.ink);
this._tag = layer.tag; this._tag = layer.tag;
this._ink = layer.ink; this._ink = layer.ink;
this._alpha = layer.alpha; this._alpha = layer.alpha;

View File

@ -145,7 +145,7 @@ export class SizeData
if(layerId < 0 || (layerId >= this._layerCount)) return false; if(layerId < 0 || (layerId >= this._layerCount)) return false;
// TODO: check the .nitro files for inks // TODO: check the .nitro files for inks
if(layer.ink !== undefined) directionData.setLayerInk(layerId, (layer.ink as BLEND_MODES)); if(layer.ink !== undefined) directionData.setLayerInk(layerId, (layer.ink?.toLowerCase() as BLEND_MODES));
if(layer.tag !== undefined) directionData.setLayerTag(layerId, layer.tag); if(layer.tag !== undefined) directionData.setLayerTag(layerId, layer.tag);

View File

@ -1,4 +1,4 @@
import { SCALE_MODES, Texture } from 'pixi.js'; import { Texture } from 'pixi.js';
import { IsometricImageFurniVisualization } from './IsometricImageFurniVisualization'; import { IsometricImageFurniVisualization } from './IsometricImageFurniVisualization';
export class FurnitureDynamicThumbnailVisualization extends IsometricImageFurniVisualization export class FurnitureDynamicThumbnailVisualization extends IsometricImageFurniVisualization
@ -34,7 +34,7 @@ export class FurnitureDynamicThumbnailVisualization extends IsometricImageFurniV
{ {
const texture = Texture.from(image); const texture = Texture.from(image);
texture.baseTexture.scaleMode = SCALE_MODES.LINEAR; texture.source.scaleMode = 'linear';
this.setThumbnailImages(texture); this.setThumbnailImages(texture);
}; };

View File

@ -1,7 +1,7 @@
import { IAssetPlane, IAssetPlaneVisualizationAnimatedLayer, IAssetPlaneVisualizationLayer, IVector3D } from '@nitrots/api'; import { IAssetPlane, IAssetPlaneVisualizationAnimatedLayer, IAssetPlaneVisualizationLayer, IVector3D } from '@nitrots/api';
import { GetConfiguration } from '@nitrots/configuration'; import { GetConfiguration } from '@nitrots/configuration';
import { TextureUtils } from '@nitrots/utils'; import { TextureUtils } from '@nitrots/utils';
import { RenderTexture } from 'pixi.js'; import { RenderTexture, Sprite } from 'pixi.js';
import { PlaneBitmapData, Randomizer } from '../../utils'; import { PlaneBitmapData, Randomizer } from '../../utils';
import { PlaneMaterial, PlaneRasterizer, PlaneVisualizationLayer } from '../basic'; import { PlaneMaterial, PlaneRasterizer, PlaneVisualizationLayer } from '../basic';
import { LandscapePlane } from './LandscapePlane'; import { LandscapePlane } from './LandscapePlane';
@ -206,7 +206,7 @@ export class LandscapeRasterizer extends PlaneRasterizer
if(graphic && (graphic !== canvas)) if(graphic && (graphic !== canvas))
{ {
graphic = new RenderTexture(graphic.baseTexture); graphic = TextureUtils.generateTexture(new Sprite(graphic.source));
if(!graphic) return null; if(!graphic) return null;
} }

View File

@ -152,7 +152,7 @@ export class PlaneMaterialCellMatrix
{ {
if(this._cachedBitmapData) if(this._cachedBitmapData)
{ {
if(this._cachedBitmapData.baseTexture && (this._cachedBitmapData.width === width) && (this._cachedBitmapData.height === height) && Vector3d.isEqual(this._cachedBitmapNormal, normal)) if(this._cachedBitmapData.source && (this._cachedBitmapData.width === width) && (this._cachedBitmapData.height === height) && Vector3d.isEqual(this._cachedBitmapNormal, normal))
{ {
if(canvas) if(canvas)
{ {

View File

@ -2,7 +2,7 @@ import { IRoomCanvasMouseListener, IRoomGeometry, IRoomObject, IRoomObjectSprite
import { GetConfiguration } from '@nitrots/configuration'; import { GetConfiguration } from '@nitrots/configuration';
import { RoomSpriteMouseEvent } from '@nitrots/events'; import { RoomSpriteMouseEvent } from '@nitrots/events';
import { GetTicker, TextureUtils, Vector3d } from '@nitrots/utils'; import { GetTicker, TextureUtils, Vector3d } from '@nitrots/utils';
import { Container, Graphics, Matrix, Point, Rectangle, Sprite, Texture } from 'pixi.js'; import { Container, Graphics, Matrix, Point, Rectangle, Texture } from 'pixi.js';
import { RoomEnterEffect, RoomGeometry, RoomRotatingEffect, RoomShakingEffect } from '../utils'; import { RoomEnterEffect, RoomGeometry, RoomRotatingEffect, RoomShakingEffect } from '../utils';
import { RoomObjectCache, RoomObjectCacheItem } from './cache'; import { RoomObjectCache, RoomObjectCacheItem } from './cache';
import { ExtendedSprite, ObjectMouseData, SortableSprite } from './utils'; import { ExtendedSprite, ObjectMouseData, SortableSprite } from './utils';
@ -18,7 +18,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
private _totalTimeRunning: number; private _totalTimeRunning: number;
private _lastFrame: number; private _lastFrame: number;
private _master: Sprite; private _master: Container;
private _display: Container; private _display: Container;
private _mask: Graphics; private _mask: Graphics;
@ -115,10 +115,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
private setupCanvas(): void private setupCanvas(): void
{ {
if(!this._master) if(!this._master) this._master = new Container();
{
this._master = new Sprite();
}
if(!this._display) if(!this._display)
{ {
@ -206,9 +203,8 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
if(!this._mask) if(!this._mask)
{ {
this._mask = new Graphics() this._mask = new Graphics()
.beginFill(0xFF0000) .rect(0, 0, width, height)
.drawRect(0, 0, width, height) .fill(0xFF0000);
.endFill();
if(this._master) if(this._master)
{ {
@ -221,9 +217,8 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
{ {
this._mask this._mask
.clear() .clear()
.beginFill(0xFF0000) .rect(0, 0, width, height)
.drawRect(0, 0, width, height) .fill(0xFF0000);
.endFill();
} }
} }
@ -461,7 +456,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
if(!sprite || !sprite.visible) continue; if(!sprite || !sprite.visible) continue;
const texture = sprite.texture; const texture = sprite.texture;
const baseTexture = texture && texture.baseTexture; const baseTexture = texture && texture.source;
if(!texture || !baseTexture) continue; if(!texture || !baseTexture) continue;
@ -631,7 +626,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
if(this._spritePool.length > 0) extendedSprite = this._spritePool.pop(); if(this._spritePool.length > 0) extendedSprite = this._spritePool.pop();
if(!extendedSprite) extendedSprite = new ExtendedSprite(); if(!extendedSprite) extendedSprite = new ExtendedSprite({});
if(extendedSprite.children.length) extendedSprite.removeChildren(); if(extendedSprite.children.length) extendedSprite.removeChildren();
@ -1164,7 +1159,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
return this._geometry; return this._geometry;
} }
public get master(): Sprite public get master(): Container
{ {
return this._master; return this._master;
} }

View File

@ -1,6 +1,6 @@
import { AlphaTolerance } from '@nitrots/api'; import { AlphaTolerance } from '@nitrots/api';
import { TextureUtils } from '@nitrots/utils'; import { TextureUtils } from '@nitrots/utils';
import { Point, Sprite, Texture, TextureSource } from 'pixi.js'; import { Point, Sprite, SpriteOptions, Texture, TextureSource } from 'pixi.js';
export class ExtendedSprite extends Sprite export class ExtendedSprite extends Sprite
{ {
@ -14,9 +14,9 @@ export class ExtendedSprite extends Sprite
private _updateId1: number = -1; private _updateId1: number = -1;
private _updateId2: number = -1; private _updateId2: number = -1;
constructor(texture: Texture = null) constructor(options?: SpriteOptions | Texture)
{ {
super(texture); super(options);
this._offsetX = 0; this._offsetX = 0;
this._offsetY = 0; this._offsetY = 0;

View File

@ -56,6 +56,7 @@ export class SessionDataManager implements ISessionDataManager
public async init(): Promise<void> public async init(): Promise<void>
{ {
console.log('do this')
await this._furnitureData.init(); await this._furnitureData.init();
await this._productData.init(); await this._productData.init();

View File

@ -1,4 +1,4 @@
import { IAdvancedMap, IMessageEvent, IMusicController, IPlaylistController, ISongInfo } from '@nitrots/api'; import { IAdvancedMap, IMusicController, IPlaylistController, ISongInfo } from '@nitrots/api';
import { GetCommunication, GetNowPlayingMessageComposer, GetSongInfoMessageComposer, GetUserSongDisksMessageComposer, TraxSongInfoMessageEvent, UserSongDisksInventoryMessageEvent } from '@nitrots/communication'; import { GetCommunication, GetNowPlayingMessageComposer, GetSongInfoMessageComposer, GetUserSongDisksMessageComposer, TraxSongInfoMessageEvent, UserSongDisksInventoryMessageEvent } from '@nitrots/communication';
import { GetConfiguration } from '@nitrots/configuration'; import { GetConfiguration } from '@nitrots/configuration';
import { GetEventDispatcher, NotifyPlayedSongEvent, NowPlayingEvent, RoomObjectSoundMachineEvent, SongDiskInventoryReceivedEvent, SongInfoReceivedEvent, SoundManagerEvent } from '@nitrots/events'; import { GetEventDispatcher, NotifyPlayedSongEvent, NowPlayingEvent, RoomObjectSoundMachineEvent, SongDiskInventoryReceivedEvent, SongInfoReceivedEvent, SoundManagerEvent } from '@nitrots/events';
@ -25,7 +25,6 @@ export class MusicController implements IMusicController
private _songDiskInventory: IAdvancedMap<number, number> = new AdvancedMap(); private _songDiskInventory: IAdvancedMap<number, number> = new AdvancedMap();
private _priorityPlaying: number = -1; private _priorityPlaying: number = -1;
private _requestNumberPlaying: number = -1; private _requestNumberPlaying: number = -1;
private _messageEvents: IMessageEvent[];
private _roomItemPlaylist: IPlaylistController; private _roomItemPlaylist: IPlaylistController;
private _musicPlayer: MusicPlayer; private _musicPlayer: MusicPlayer;
@ -51,8 +50,6 @@ export class MusicController implements IMusicController
this._timerInstance = window.setInterval(this.onTick.bind(this), 1000); this._timerInstance = window.setInterval(this.onTick.bind(this), 1000);
this._musicPlayer = new MusicPlayer(GetConfiguration().getValue<string>('external.samples.url')); this._musicPlayer = new MusicPlayer(GetConfiguration().getValue<string>('external.samples.url'));
this._messageEvents.forEach(event => GetCommunication().registerMessageEvent(event));
GetEventDispatcher().addEventListener(RoomObjectSoundMachineEvent.JUKEBOX_INIT, this.onJukeboxInit); GetEventDispatcher().addEventListener(RoomObjectSoundMachineEvent.JUKEBOX_INIT, this.onJukeboxInit);
GetEventDispatcher().addEventListener(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, this.onJukeboxDispose); GetEventDispatcher().addEventListener(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, this.onJukeboxDispose);
GetEventDispatcher().addEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, this.onSoundMachineInit); GetEventDispatcher().addEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, this.onSoundMachineInit);
@ -159,8 +156,6 @@ export class MusicController implements IMusicController
this._timerInstance = undefined; this._timerInstance = undefined;
} }
this._messageEvents.forEach(event => GetCommunication().removeMessageEvent(event));
GetEventDispatcher().removeEventListener(RoomObjectSoundMachineEvent.JUKEBOX_INIT, this.onJukeboxInit); GetEventDispatcher().removeEventListener(RoomObjectSoundMachineEvent.JUKEBOX_INIT, this.onJukeboxInit);
GetEventDispatcher().removeEventListener(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, this.onJukeboxDispose); GetEventDispatcher().removeEventListener(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, this.onJukeboxDispose);
GetEventDispatcher().removeEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, this.onSoundMachineInit); GetEventDispatcher().removeEventListener(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, this.onSoundMachineInit);

View File

@ -0,0 +1,4 @@
import { AdjustmentFilter } from 'pixi-filters';
export class NitroAdjustmentFilter extends AdjustmentFilter
{}

View File

@ -0,0 +1,3 @@
import { Ticker } from 'pixi.js';
export type NitroTicker = Ticker;

View File

@ -1,3 +1,4 @@
export * from './NitroAdjustmentFilter';
export * from './NitroAlphaFilter'; export * from './NitroAlphaFilter';
export * from './NitroContainer'; export * from './NitroContainer';
export * from './NitroFilter'; export * from './NitroFilter';
@ -5,3 +6,4 @@ export * from './NitroRectangle';
export * from './NitroRenderTexture'; export * from './NitroRenderTexture';
export * from './NitroSprite'; export * from './NitroSprite';
export * from './NitroTexture'; export * from './NitroTexture';
export * from './NitroTicker';