From 0988b3247439e239343f5c590914c33b32dfa482 Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 9 Nov 2022 17:55:03 -0500 Subject: [PATCH] Update AssetManager --- src/api/INitroCore.ts | 2 - src/{core => api}/asset/AssetManager.ts | 24 ++++---- src/api/asset/GetAssetManager.ts | 3 + src/{core => api}/asset/GraphicAsset.ts | 2 +- .../asset/GraphicAssetCollection.ts | 6 +- .../asset/GraphicAssetGifCollection.ts | 0 .../asset/GraphicAssetPalette.ts | 0 src/api/asset/IAssetManager.ts | 1 - src/api/asset/index.ts | 6 ++ src/api/communication/ICodec.ts | 2 +- src/api/communication/IMessageDataWrapper.ts | 2 +- src/api/communication/index.ts | 2 - src/api/index.ts | 3 +- src/api/nitro/avatar/structure/IPalette.ts | 2 +- src/api/nitro/avatar/structure/ISetType.ts | 2 +- src/api/nitro/sound/IMusicController.ts | 36 +++++------ src/api/room/IRoomObjectManager.ts | 2 +- .../room/object/IRoomObjectModelController.ts | 2 +- src/{core => api}/utils/AdvancedMap.ts | 2 +- .../utils/ArrayBufferToBase64.ts | 0 src/{core => api}/utils/BinaryReader.ts | 2 +- src/{core => api}/utils/BinaryWriter.ts | 2 +- src/api/{ => utils}/IAdvancedMap.ts | 2 +- .../{communication => utils}/IBinaryReader.ts | 0 .../{communication => utils}/IBinaryWriter.ts | 0 src/{core/asset => api/utils}/NitroBundle.ts | 3 +- src/{core => api}/utils/index.ts | 5 +- src/core/NitroCore.ts | 21 +------ src/core/NitroVersion.ts | 27 ++++++++- src/core/asset/index.ts | 6 -- .../codec/evawire/EvaWireFormat.ts | 3 +- src/core/index.ts | 2 - src/core/utils/SayHello.ts | 26 -------- src/nitro/avatar/AvatarImage.ts | 3 +- src/nitro/avatar/AvatarRenderManager.ts | 13 ++-- src/nitro/avatar/structure/figure/Palette.ts | 3 +- src/nitro/avatar/structure/figure/SetType.ts | 3 +- .../parser/inventory/badges/BadgesParser.ts | 3 +- .../parser/notifications/UnseenItemsParser.ts | 3 +- .../sound/JukeboxSongDisksMessageParser.ts | 3 +- .../UserSongDisksInventoryMessageParser.ts | 3 +- .../RelationshipStatusInfoMessageParser.ts | 3 +- src/nitro/room/RoomContentLoader.ts | 6 +- .../furniture/FurnitureRentableSpaceLogic.ts | 3 +- .../furniture/FurnitureRoomBrandingLogic.ts | 4 +- .../avatar/AvatarVisualization.ts | 3 +- .../FurnitureBrandedImageVisualization.ts | 7 +-- .../FurnitureFireworksVisualization.ts | 3 +- ...rnitureGuildIsometricBadgeVisualization.ts | 55 +++++++++++++++++ .../FurnitureIsometricBBVisualization.ts | 5 +- .../furniture/FurnitureParticleSystem.ts | 3 +- .../IsometricImageFurniVisualization.ts | 2 +- .../visualization/pet/PetVisualization.ts | 5 +- .../visualization/room/RoomVisualization.ts | 3 +- src/nitro/session/SessionDataManager.ts | 4 +- src/nitro/sound/SoundManager.ts | 4 +- src/nitro/sound/music/MusicController.ts | 60 +++++++++---------- src/room/RoomObjectManager.ts | 3 +- 58 files changed, 211 insertions(+), 194 deletions(-) rename src/{core => api}/asset/AssetManager.ts (91%) create mode 100644 src/api/asset/GetAssetManager.ts rename src/{core => api}/asset/GraphicAsset.ts (98%) rename src/{core => api}/asset/GraphicAssetCollection.ts (97%) rename src/{core => api}/asset/GraphicAssetGifCollection.ts (100%) rename src/{core => api}/asset/GraphicAssetPalette.ts (100%) rename src/{core => api}/utils/AdvancedMap.ts (98%) rename src/{core => api}/utils/ArrayBufferToBase64.ts (100%) rename src/{core => api}/utils/BinaryReader.ts (97%) rename src/{core => api}/utils/BinaryWriter.ts (97%) rename src/api/{ => utils}/IAdvancedMap.ts (93%) rename src/api/{communication => utils}/IBinaryReader.ts (100%) rename src/api/{communication => utils}/IBinaryWriter.ts (100%) rename src/{core/asset => api/utils}/NitroBundle.ts (93%) rename src/{core => api}/utils/index.ts (50%) delete mode 100644 src/core/asset/index.ts delete mode 100644 src/core/utils/SayHello.ts diff --git a/src/api/INitroCore.ts b/src/api/INitroCore.ts index 646074c9..a63afc45 100644 --- a/src/api/INitroCore.ts +++ b/src/api/INitroCore.ts @@ -1,4 +1,3 @@ -import { IAssetManager } from './asset'; import { IDisposable } from './common'; import { ICommunicationManager } from './communication'; import { IConfigurationManager } from './configuration'; @@ -6,6 +5,5 @@ import { IConfigurationManager } from './configuration'; export interface INitroCore extends IDisposable { configuration: IConfigurationManager; - asset: IAssetManager; communication: ICommunicationManager; } diff --git a/src/core/asset/AssetManager.ts b/src/api/asset/AssetManager.ts similarity index 91% rename from src/core/asset/AssetManager.ts rename to src/api/asset/AssetManager.ts index 7fcb8072..99335753 100644 --- a/src/core/asset/AssetManager.ts +++ b/src/api/asset/AssetManager.ts @@ -1,24 +1,20 @@ import { BaseTexture, Resource, Texture } from '@pixi/core'; import { Loader, LoaderResource } from '@pixi/loaders'; import { Spritesheet } from '@pixi/spritesheet'; -import { IAssetData, IAssetManager, IGraphicAsset, IGraphicAssetCollection, NitroLogger } from '../../api'; -import { Disposable } from '../common'; -import { ArrayBufferToBase64 } from '../utils'; +import { NitroLogger } from '../common'; +import { ArrayBufferToBase64, NitroBundle } from '../utils'; import { GraphicAssetCollection } from './GraphicAssetCollection'; -import { NitroBundle } from './NitroBundle'; +import { IAssetData } from './IAssetData'; +import { IAssetManager } from './IAssetManager'; +import { IGraphicAsset } from './IGraphicAsset'; +import { IGraphicAssetCollection } from './IGraphicAssetCollection'; -export class AssetManager extends Disposable implements IAssetManager +export class AssetManager implements IAssetManager { - private _textures: Map>; - private _collections: Map; + public static _INSTANCE: IAssetManager = new AssetManager(); - constructor() - { - super(); - - this._textures = new Map(); - this._collections = new Map(); - } + private _textures: Map> = new Map(); + private _collections: Map = new Map(); public getTexture(name: string): Texture { diff --git a/src/api/asset/GetAssetManager.ts b/src/api/asset/GetAssetManager.ts new file mode 100644 index 00000000..e17c720a --- /dev/null +++ b/src/api/asset/GetAssetManager.ts @@ -0,0 +1,3 @@ +import { AssetManager } from './AssetManager'; + +export const GetAssetManager = () => AssetManager._INSTANCE; diff --git a/src/core/asset/GraphicAsset.ts b/src/api/asset/GraphicAsset.ts similarity index 98% rename from src/core/asset/GraphicAsset.ts rename to src/api/asset/GraphicAsset.ts index d5c116fe..7b717978 100644 --- a/src/core/asset/GraphicAsset.ts +++ b/src/api/asset/GraphicAsset.ts @@ -1,6 +1,6 @@ import { Resource, Texture } from '@pixi/core'; import { Rectangle } from '@pixi/math'; -import { IGraphicAsset } from '../../api'; +import { IGraphicAsset } from './IGraphicAsset'; export class GraphicAsset implements IGraphicAsset { diff --git a/src/core/asset/GraphicAssetCollection.ts b/src/api/asset/GraphicAssetCollection.ts similarity index 97% rename from src/core/asset/GraphicAssetCollection.ts rename to src/api/asset/GraphicAssetCollection.ts index ccb35e51..990b78c3 100644 --- a/src/core/asset/GraphicAssetCollection.ts +++ b/src/api/asset/GraphicAssetCollection.ts @@ -1,10 +1,14 @@ import { BaseTexture, Resource, Texture } from '@pixi/core'; import { Spritesheet } from '@pixi/spritesheet'; import { Dict } from '@pixi/utils'; -import { IAsset, IAssetData, IAssetPalette, IGraphicAsset, IGraphicAssetCollection } from '../../api'; import { GetTickerTime } from '../../pixi-proxy'; import { GraphicAsset } from './GraphicAsset'; import { GraphicAssetPalette } from './GraphicAssetPalette'; +import { IAsset } from './IAsset'; +import { IAssetData } from './IAssetData'; +import { IAssetPalette } from './IAssetPalette'; +import { IGraphicAsset } from './IGraphicAsset'; +import { IGraphicAssetCollection } from './IGraphicAssetCollection'; export class GraphicAssetCollection implements IGraphicAssetCollection { diff --git a/src/core/asset/GraphicAssetGifCollection.ts b/src/api/asset/GraphicAssetGifCollection.ts similarity index 100% rename from src/core/asset/GraphicAssetGifCollection.ts rename to src/api/asset/GraphicAssetGifCollection.ts diff --git a/src/core/asset/GraphicAssetPalette.ts b/src/api/asset/GraphicAssetPalette.ts similarity index 100% rename from src/core/asset/GraphicAssetPalette.ts rename to src/api/asset/GraphicAssetPalette.ts diff --git a/src/api/asset/IAssetManager.ts b/src/api/asset/IAssetManager.ts index 0474c71c..7b2d0d18 100644 --- a/src/api/asset/IAssetManager.ts +++ b/src/api/asset/IAssetManager.ts @@ -7,7 +7,6 @@ import { IGraphicAssetCollection } from './IGraphicAssetCollection'; export interface IAssetManager { - dispose(): void; getTexture(name: string): Texture; setTexture(name: string, texture: Texture): void; getAsset(name: string): IGraphicAsset; diff --git a/src/api/asset/index.ts b/src/api/asset/index.ts index 3aacc2e1..2154d708 100644 --- a/src/api/asset/index.ts +++ b/src/api/asset/index.ts @@ -1,4 +1,10 @@ export * from './animation'; +export * from './AssetManager'; +export * from './GetAssetManager'; +export * from './GraphicAsset'; +export * from './GraphicAssetCollection'; +export * from './GraphicAssetGifCollection'; +export * from './GraphicAssetPalette'; export * from './IAsset'; export * from './IAssetAlias'; export * from './IAssetData'; diff --git a/src/api/communication/ICodec.ts b/src/api/communication/ICodec.ts index 5d13f24c..39c4b29d 100644 --- a/src/api/communication/ICodec.ts +++ b/src/api/communication/ICodec.ts @@ -1,4 +1,4 @@ -import { IBinaryWriter } from './IBinaryWriter'; +import { IBinaryWriter } from '../utils'; import { IConnection } from './IConnection'; import { IMessageDataWrapper } from './IMessageDataWrapper'; diff --git a/src/api/communication/IMessageDataWrapper.ts b/src/api/communication/IMessageDataWrapper.ts index 407106aa..0f1c39f7 100644 --- a/src/api/communication/IMessageDataWrapper.ts +++ b/src/api/communication/IMessageDataWrapper.ts @@ -1,4 +1,4 @@ -import { IBinaryReader } from './IBinaryReader'; +import { IBinaryReader } from '../utils'; export interface IMessageDataWrapper { diff --git a/src/api/communication/index.ts b/src/api/communication/index.ts index a92f6edf..779143d5 100644 --- a/src/api/communication/index.ts +++ b/src/api/communication/index.ts @@ -1,6 +1,4 @@ export * from './enums'; -export * from './IBinaryReader'; -export * from './IBinaryWriter'; export * from './ICodec'; export * from './ICommunicationManager'; export * from './IConnection'; diff --git a/src/api/index.ts b/src/api/index.ts index 832fe6ba..808803e0 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -13,7 +13,6 @@ export * from './common'; export * from './communication'; export * from './communication/enums'; export * from './configuration'; -export * from './IAdvancedMap'; export * from './INitroCore'; export * from './nitro'; export * from './nitro/avatar'; @@ -36,6 +35,7 @@ export * from './nitro/room/utils'; export * from './nitro/session'; export * from './nitro/session/enum'; export * from './nitro/sound'; +export * from './nitro/sound/common'; export * from './room'; export * from './room/object'; export * from './room/object/enum'; @@ -45,3 +45,4 @@ export * from './room/renderer'; export * from './ui'; export * from './ui/widget'; export * from './ui/widget/enums'; +export * from './utils'; diff --git a/src/api/nitro/avatar/structure/IPalette.ts b/src/api/nitro/avatar/structure/IPalette.ts index cbd5e9ca..8c5c0e27 100644 --- a/src/api/nitro/avatar/structure/IPalette.ts +++ b/src/api/nitro/avatar/structure/IPalette.ts @@ -1,4 +1,4 @@ -import { IAdvancedMap } from '../../../IAdvancedMap'; +import { IAdvancedMap } from '../../../utils'; import { IPartColor } from './IPartColor'; export interface IPalette diff --git a/src/api/nitro/avatar/structure/ISetType.ts b/src/api/nitro/avatar/structure/ISetType.ts index 89ceb548..9277a479 100644 --- a/src/api/nitro/avatar/structure/ISetType.ts +++ b/src/api/nitro/avatar/structure/ISetType.ts @@ -1,4 +1,4 @@ -import { IAdvancedMap } from '../../../IAdvancedMap'; +import { IAdvancedMap } from '../../../utils'; import { IFigurePartSet } from './IFigurePartSet'; export interface ISetType diff --git a/src/api/nitro/sound/IMusicController.ts b/src/api/nitro/sound/IMusicController.ts index 026109ff..ec3c1095 100644 --- a/src/api/nitro/sound/IMusicController.ts +++ b/src/api/nitro/sound/IMusicController.ts @@ -1,25 +1,25 @@ -import { IAdvancedMap } from '../../IAdvancedMap'; -import { ISongInfo } from './common/ISongInfo'; +import { IAdvancedMap } from '../../utils'; +import { ISongInfo } from './common'; import { IPlaylistController } from './IPlaylistController'; export interface IMusicController { - getRoomItemPlaylist(_arg_1?:number):IPlaylistController; - getSongDiskInventorySize():number; - getSongDiskInventoryDiskId(_arg_1:number):number; - getSongDiskInventorySongId(_arg_1:number):number; - getSongInfo(_arg_1:number):ISongInfo; - getSongIdPlayingAtPriority(_arg_1:number):number; - playSong(songId:number, priority:number, startPos?:number, playLength?:number, fadeInSeconds?:number, fadeOutSeconds?:number):boolean; - stop(priority:number):void; - addSongInfoRequest(_arg_1:number):void; - requestSongInfoWithoutSamples(_arg_1:number):void; - requestUserSongDisks():void; - onSongLoaded(_arg_1:number):void; - updateVolume(_arg_1:number):void; - samplesUnloaded(_arg_1:number[]):void; - get samplesIdsInUse():number[]; + getRoomItemPlaylist(_arg_1?: number): IPlaylistController; + getSongDiskInventorySize(): number; + getSongDiskInventoryDiskId(_arg_1: number): number; + getSongDiskInventorySongId(_arg_1: number): number; + getSongInfo(_arg_1: number): ISongInfo; + getSongIdPlayingAtPriority(_arg_1: number): number; + playSong(songId: number, priority: number, startPos?: number, playLength?: number, fadeInSeconds?: number, fadeOutSeconds?: number): boolean; + stop(priority: number): void; + addSongInfoRequest(_arg_1: number): void; + requestSongInfoWithoutSamples(_arg_1: number): void; + requestUserSongDisks(): void; + onSongLoaded(_arg_1: number): void; + updateVolume(_arg_1: number): void; + samplesUnloaded(_arg_1: number[]): void; + get samplesIdsInUse(): number[]; get songDiskInventory(): IAdvancedMap init(): void; - dispose():void; + dispose(): void; } diff --git a/src/api/room/IRoomObjectManager.ts b/src/api/room/IRoomObjectManager.ts index c47cd173..9e0ea3b8 100644 --- a/src/api/room/IRoomObjectManager.ts +++ b/src/api/room/IRoomObjectManager.ts @@ -1,4 +1,4 @@ -import { IAdvancedMap } from '../IAdvancedMap'; +import { IAdvancedMap } from '../utils'; import { IRoomObjectController } from './object'; export interface IRoomObjectManager diff --git a/src/api/room/object/IRoomObjectModelController.ts b/src/api/room/object/IRoomObjectModelController.ts index 7a27d498..2dc6fbc7 100644 --- a/src/api/room/object/IRoomObjectModelController.ts +++ b/src/api/room/object/IRoomObjectModelController.ts @@ -1,4 +1,4 @@ -import { IAdvancedMap } from '../../IAdvancedMap'; +import { IAdvancedMap } from '../../utils'; import { IRoomObjectModel } from './IRoomObjectModel'; export interface IRoomObjectModelController extends IRoomObjectModel diff --git a/src/core/utils/AdvancedMap.ts b/src/api/utils/AdvancedMap.ts similarity index 98% rename from src/core/utils/AdvancedMap.ts rename to src/api/utils/AdvancedMap.ts index e231a1f4..1bea641e 100644 --- a/src/core/utils/AdvancedMap.ts +++ b/src/api/utils/AdvancedMap.ts @@ -1,4 +1,4 @@ -import { IAdvancedMap } from '../../api'; +import { IAdvancedMap } from './IAdvancedMap'; export class AdvancedMap implements IAdvancedMap { diff --git a/src/core/utils/ArrayBufferToBase64.ts b/src/api/utils/ArrayBufferToBase64.ts similarity index 100% rename from src/core/utils/ArrayBufferToBase64.ts rename to src/api/utils/ArrayBufferToBase64.ts diff --git a/src/core/utils/BinaryReader.ts b/src/api/utils/BinaryReader.ts similarity index 97% rename from src/core/utils/BinaryReader.ts rename to src/api/utils/BinaryReader.ts index 51e12f3e..e25ddb1a 100644 --- a/src/core/utils/BinaryReader.ts +++ b/src/api/utils/BinaryReader.ts @@ -1,4 +1,4 @@ -import { IBinaryReader } from '../../api'; +import { IBinaryReader } from './IBinaryReader'; export class BinaryReader implements IBinaryReader { diff --git a/src/core/utils/BinaryWriter.ts b/src/api/utils/BinaryWriter.ts similarity index 97% rename from src/core/utils/BinaryWriter.ts rename to src/api/utils/BinaryWriter.ts index 44dfee88..1bcae196 100644 --- a/src/core/utils/BinaryWriter.ts +++ b/src/api/utils/BinaryWriter.ts @@ -1,4 +1,4 @@ -import { IBinaryWriter } from '../../api'; +import { IBinaryWriter } from './IBinaryWriter'; export class BinaryWriter implements IBinaryWriter { diff --git a/src/api/IAdvancedMap.ts b/src/api/utils/IAdvancedMap.ts similarity index 93% rename from src/api/IAdvancedMap.ts rename to src/api/utils/IAdvancedMap.ts index 6d310969..f10c5704 100644 --- a/src/api/IAdvancedMap.ts +++ b/src/api/utils/IAdvancedMap.ts @@ -1,4 +1,4 @@ -import { IDisposable } from './common'; +import { IDisposable } from '../common'; export interface IAdvancedMap extends IDisposable { diff --git a/src/api/communication/IBinaryReader.ts b/src/api/utils/IBinaryReader.ts similarity index 100% rename from src/api/communication/IBinaryReader.ts rename to src/api/utils/IBinaryReader.ts diff --git a/src/api/communication/IBinaryWriter.ts b/src/api/utils/IBinaryWriter.ts similarity index 100% rename from src/api/communication/IBinaryWriter.ts rename to src/api/utils/IBinaryWriter.ts diff --git a/src/core/asset/NitroBundle.ts b/src/api/utils/NitroBundle.ts similarity index 93% rename from src/core/asset/NitroBundle.ts rename to src/api/utils/NitroBundle.ts index 9152f335..37e4992e 100644 --- a/src/core/asset/NitroBundle.ts +++ b/src/api/utils/NitroBundle.ts @@ -1,6 +1,7 @@ import { BaseTexture } from '@pixi/core'; import { Data, inflate } from 'pako'; -import { ArrayBufferToBase64, BinaryReader } from '../utils'; +import { ArrayBufferToBase64 } from './ArrayBufferToBase64'; +import { BinaryReader } from './BinaryReader'; export class NitroBundle { diff --git a/src/core/utils/index.ts b/src/api/utils/index.ts similarity index 50% rename from src/core/utils/index.ts rename to src/api/utils/index.ts index 57269512..07d750be 100644 --- a/src/core/utils/index.ts +++ b/src/api/utils/index.ts @@ -2,4 +2,7 @@ export * from './AdvancedMap'; export * from './ArrayBufferToBase64'; export * from './BinaryReader'; export * from './BinaryWriter'; -export * from './SayHello'; +export * from './IAdvancedMap'; +export * from './IBinaryReader'; +export * from './IBinaryWriter'; +export * from './NitroBundle'; diff --git a/src/core/NitroCore.ts b/src/core/NitroCore.ts index 16785aa4..6f4e4fbb 100644 --- a/src/core/NitroCore.ts +++ b/src/core/NitroCore.ts @@ -1,36 +1,26 @@ -import { IAssetManager, ICommunicationManager, IConfigurationManager, INitroCore } from '../api'; -import { AssetManager } from './asset'; +import { ICommunicationManager, IConfigurationManager, INitroCore } from '../api'; import { Disposable } from './common'; import { CommunicationManager } from './communication'; import { ConfigurationManager } from './configuration'; -import { SayHello } from './utils'; +import { NitroVersion } from './NitroVersion'; export class NitroCore extends Disposable implements INitroCore { private _configuration: IConfigurationManager; private _communication: ICommunicationManager; - private _asset: IAssetManager; constructor() { super(); - SayHello(); + NitroVersion.sayHello(); this._configuration = new ConfigurationManager(); this._communication = new CommunicationManager(); - this._asset = new AssetManager(); } protected onDispose(): void { - if(this._asset) - { - this._asset.dispose(); - - this._asset = null; - } - if(this._communication) { this._communication.dispose(); @@ -48,9 +38,4 @@ export class NitroCore extends Disposable implements INitroCore { return this._communication; } - - public get asset(): IAssetManager - { - return this._asset; - } } diff --git a/src/core/NitroVersion.ts b/src/core/NitroVersion.ts index 03a1e19d..c6b65bca 100644 --- a/src/core/NitroVersion.ts +++ b/src/core/NitroVersion.ts @@ -1,5 +1,30 @@ export class NitroVersion { - public static RENDERER_VERSION: string = '1.4.4'; + public static RENDERER_VERSION: string = '1.4.2'; public static UI_VERSION: string = ''; + + public static sayHello(): void + { + if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1) + { + const args = [ + `\n %c %c %c Nitro ${NitroVersion.UI_VERSION} - Renderer ${NitroVersion.RENDERER_VERSION} %c %c %c https://discord.nitrodev.co %c %c \n\n`, + 'background: #ffffff; padding:5px 0;', + 'background: #ffffff; padding:5px 0;', + 'color: #ffffff; background: #000000; padding:5px 0;', + 'background: #ffffff; padding:5px 0;', + 'background: #ffffff; padding:5px 0;', + 'background: #000000; padding:5px 0;', + 'background: #ffffff; padding:5px 0;', + 'background: #ffffff; padding:5px 0;' + ]; + + self.console.log(...args); + } + + else if(self.console) + { + self.console.log(`Nitro ${NitroVersion.UI_VERSION} - Renderer ${NitroVersion.RENDERER_VERSION} `); + } + } } diff --git a/src/core/asset/index.ts b/src/core/asset/index.ts deleted file mode 100644 index b318a445..00000000 --- a/src/core/asset/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export * from './AssetManager'; -export * from './GraphicAsset'; -export * from './GraphicAssetCollection'; -export * from './GraphicAssetGifCollection'; -export * from './GraphicAssetPalette'; -export * from './NitroBundle'; diff --git a/src/core/communication/codec/evawire/EvaWireFormat.ts b/src/core/communication/codec/evawire/EvaWireFormat.ts index 758f6c8b..0acbff8e 100644 --- a/src/core/communication/codec/evawire/EvaWireFormat.ts +++ b/src/core/communication/codec/evawire/EvaWireFormat.ts @@ -1,5 +1,4 @@ -import { IBinaryWriter, ICodec, IConnection, IMessageDataWrapper } from '../../../../api'; -import { BinaryReader, BinaryWriter } from '../../../utils'; +import { BinaryReader, BinaryWriter, IBinaryWriter, ICodec, IConnection, IMessageDataWrapper } from '../../../../api'; import { Byte } from '../Byte'; import { Short } from '../Short'; import { EvaWireDataWrapper } from './EvaWireDataWrapper'; diff --git a/src/core/index.ts b/src/core/index.ts index 58f92bbf..67ca0555 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -1,4 +1,3 @@ -export * from './asset'; export * from './common'; export * from './communication'; export * from './communication/codec'; @@ -7,4 +6,3 @@ export * from './communication/messages'; export * from './configuration'; export * from './NitroCore'; export * from './NitroVersion'; -export * from './utils'; diff --git a/src/core/utils/SayHello.ts b/src/core/utils/SayHello.ts deleted file mode 100644 index 05bb5ade..00000000 --- a/src/core/utils/SayHello.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { NitroVersion } from '../NitroVersion'; - -export const SayHello = () => -{ - if(navigator.userAgent.toLowerCase().indexOf('chrome') > -1) - { - const args = [ - `\n %c %c %c Nitro ${NitroVersion.UI_VERSION} - Renderer ${NitroVersion.RENDERER_VERSION} %c %c %c https://discord.nitrodev.co %c %c \n\n`, - 'background: #ffffff; padding:5px 0;', - 'background: #ffffff; padding:5px 0;', - 'color: #ffffff; background: #000000; padding:5px 0;', - 'background: #ffffff; padding:5px 0;', - 'background: #ffffff; padding:5px 0;', - 'background: #000000; padding:5px 0;', - 'background: #ffffff; padding:5px 0;', - 'background: #ffffff; padding:5px 0;' - ]; - - self.console.log(...args); - } - - else if(self.console) - { - self.console.log(`Nitro ${NitroVersion.UI_VERSION} - Renderer ${NitroVersion.RENDERER_VERSION} `); - } -}; diff --git a/src/nitro/avatar/AvatarImage.ts b/src/nitro/avatar/AvatarImage.ts index 95ef1fdb..b8fae307 100644 --- a/src/nitro/avatar/AvatarImage.ts +++ b/src/nitro/avatar/AvatarImage.ts @@ -3,8 +3,7 @@ import { Container } from '@pixi/display'; import { ColorMatrixFilter } from '@pixi/filter-color-matrix'; import { Rectangle } from '@pixi/math'; import { Sprite } from '@pixi/sprite'; -import { AvatarAction, AvatarDirectionAngle, AvatarScaleType, AvatarSetType, IActionDefinition, IActiveActionData, IAdvancedMap, IAnimationLayerData, IAvatarDataContainer, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IGraphicAsset, IPartColor, ISpriteDataContainer } from '../../api'; -import { AdvancedMap } from '../../core'; +import { AdvancedMap, AvatarAction, AvatarDirectionAngle, AvatarScaleType, AvatarSetType, IActionDefinition, IActiveActionData, IAdvancedMap, IAnimationLayerData, IAvatarDataContainer, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IGraphicAsset, IPartColor, ISpriteDataContainer } from '../../api'; import { GetTickerTime, NitroContainer, NitroSprite, PaletteMapFilter, PixiApplicationProxy, TextureUtils } from '../../pixi-proxy'; import { ActiveActionData } from './actions'; import { AssetAliasCollection } from './alias'; diff --git a/src/nitro/avatar/AvatarRenderManager.ts b/src/nitro/avatar/AvatarRenderManager.ts index 536f1d6f..8249966a 100644 --- a/src/nitro/avatar/AvatarRenderManager.ts +++ b/src/nitro/avatar/AvatarRenderManager.ts @@ -1,7 +1,6 @@ -import { AvatarSetType, IAssetManager, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IAvatarImageListener, IAvatarRenderManager, IFigureData, IFigurePartSet, IFigureSetData, IGraphicAsset, INitroEvent, IStructureData, NitroConfiguration, NitroLogger } from '../../api'; +import { AvatarSetType, GetAssetManager, IAssetManager, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IAvatarImageListener, IAvatarRenderManager, IFigureData, IFigurePartSet, IFigureSetData, IGraphicAsset, INitroEvent, IStructureData, NitroConfiguration, NitroLogger } from '../../api'; import { NitroManager } from '../../core'; import { AvatarRenderEvent, NitroEvent } from '../../events'; -import { Nitro } from '../Nitro'; import { FigureDataContainer } from '../utils'; import { AssetAliasCollection } from './alias'; import { AvatarAssetDownloadManager } from './AvatarAssetDownloadManager'; @@ -70,13 +69,13 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa this.loadAnimations(); this.loadFigureData(); - this._aliasCollection = new AssetAliasCollection(this, Nitro.instance.core.asset); + this._aliasCollection = new AssetAliasCollection(this, GetAssetManager()); this._aliasCollection.init(); if(!this._avatarAssetDownloadManager) { - this._avatarAssetDownloadManager = new AvatarAssetDownloadManager(Nitro.instance.core.asset, this._structure); + this._avatarAssetDownloadManager = new AvatarAssetDownloadManager(GetAssetManager(), this._structure); this._avatarAssetDownloadManager.addEventListener(AvatarAssetDownloadManager.DOWNLOADER_READY, this.onAvatarAssetDownloaderReady); this._avatarAssetDownloadManager.addEventListener(AvatarAssetDownloadManager.LIBRARY_LOADED, this.onAvatarAssetDownloaded); @@ -84,7 +83,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa if(!this._effectAssetDownloadManager) { - this._effectAssetDownloadManager = new EffectAssetDownloadManager(Nitro.instance.core.asset, this._structure); + this._effectAssetDownloadManager = new EffectAssetDownloadManager(GetAssetManager(), this._structure); this._effectAssetDownloadManager.addEventListener(EffectAssetDownloadManager.DOWNLOADER_READY, this.onEffectAssetDownloaderReady); this._effectAssetDownloadManager.addEventListener(EffectAssetDownloadManager.LIBRARY_LOADED, this.onEffectAssetDownloaded); @@ -136,7 +135,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa { const defaultActions = NitroConfiguration.getValue('avatar.default.actions'); - if(defaultActions) this._structure.initActions(Nitro.instance.core.asset, defaultActions); + if(defaultActions) this._structure.initActions(GetAssetManager(), defaultActions); const request = new XMLHttpRequest(); @@ -442,7 +441,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa public get assets(): IAssetManager { - return Nitro.instance.core.asset; + return GetAssetManager(); } public get isReady(): boolean diff --git a/src/nitro/avatar/structure/figure/Palette.ts b/src/nitro/avatar/structure/figure/Palette.ts index e83ec225..cf179db2 100644 --- a/src/nitro/avatar/structure/figure/Palette.ts +++ b/src/nitro/avatar/structure/figure/Palette.ts @@ -1,5 +1,4 @@ -import { IAdvancedMap, IFigureDataPalette, IPalette, IPartColor } from '../../../../api'; -import { AdvancedMap } from '../../../../core'; +import { AdvancedMap, IAdvancedMap, IFigureDataPalette, IPalette, IPartColor } from '../../../../api'; import { PartColor } from './PartColor'; export class Palette implements IPalette diff --git a/src/nitro/avatar/structure/figure/SetType.ts b/src/nitro/avatar/structure/figure/SetType.ts index a7a809f5..9a87d6de 100644 --- a/src/nitro/avatar/structure/figure/SetType.ts +++ b/src/nitro/avatar/structure/figure/SetType.ts @@ -1,5 +1,4 @@ -import { IAdvancedMap, IFigureDataSetType, IFigurePartSet, ISetType } from '../../../../api'; -import { AdvancedMap } from '../../../../core'; +import { AdvancedMap, IAdvancedMap, IFigureDataSetType, IFigurePartSet, ISetType } from '../../../../api'; import { FigurePartSet } from './FigurePartSet'; export class SetType implements ISetType diff --git a/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts b/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts index 9785e777..5b1f48c6 100644 --- a/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts +++ b/src/nitro/communication/messages/parser/inventory/badges/BadgesParser.ts @@ -1,5 +1,4 @@ -import { IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../../api'; -import { AdvancedMap } from '../../../../../../core'; +import { AdvancedMap, IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../../api'; export class BadgesParser implements IMessageParser { diff --git a/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts b/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts index 96e1b9b0..9d4b8d5c 100644 --- a/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts +++ b/src/nitro/communication/messages/parser/notifications/UnseenItemsParser.ts @@ -1,5 +1,4 @@ -import { IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../api'; -import { AdvancedMap } from '../../../../../core'; +import { AdvancedMap, IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../api'; export class UnseenItemsParser implements IMessageParser { diff --git a/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts b/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts index 5212ca8d..ef00a213 100644 --- a/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts +++ b/src/nitro/communication/messages/parser/sound/JukeboxSongDisksMessageParser.ts @@ -1,5 +1,4 @@ -import { IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../api'; -import { AdvancedMap } from '../../../../../core'; +import { AdvancedMap, IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../api'; export class JukeboxSongDisksMessageParser implements IMessageParser { diff --git a/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts b/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts index b764acbe..7af73aaa 100644 --- a/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts +++ b/src/nitro/communication/messages/parser/sound/UserSongDisksInventoryMessageParser.ts @@ -1,5 +1,4 @@ -import { IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../api'; -import { AdvancedMap } from '../../../../../core'; +import { AdvancedMap, IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../api'; export class UserSongDisksInventoryMessageParser implements IMessageParser { diff --git a/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts b/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts index fff64271..912fade7 100644 --- a/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts +++ b/src/nitro/communication/messages/parser/user/data/RelationshipStatusInfoMessageParser.ts @@ -1,5 +1,4 @@ -import { IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../../api'; -import { AdvancedMap } from '../../../../../../core'; +import { AdvancedMap, IAdvancedMap, IMessageDataWrapper, IMessageParser } from '../../../../../../api'; import { RelationshipStatusInfo } from './RelationshipStatusInfo'; export class RelationshipStatusInfoMessageParser implements IMessageParser diff --git a/src/nitro/room/RoomContentLoader.ts b/src/nitro/room/RoomContentLoader.ts index 5facf8a8..a3f96a74 100644 --- a/src/nitro/room/RoomContentLoader.ts +++ b/src/nitro/room/RoomContentLoader.ts @@ -1,11 +1,9 @@ import { BaseTexture, Resource, Texture } from '@pixi/core'; import { Loader, LoaderResource } from '@pixi/loaders'; import { Spritesheet } from '@pixi/spritesheet'; -import { FurnitureType, IAssetData, IEventDispatcher, IFurnitureData, IFurnitureDataListener, IGraphicAssetCollection, IGraphicAssetGifCollection, IPetColorResult, IRoomContentListener, IRoomContentLoader, IRoomObject, ISessionDataManager, NitroConfiguration, NitroLogger, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, RoomObjectVisualizationType } from '../../api'; -import { GraphicAssetCollection, GraphicAssetGifCollection, NitroBundle } from '../../core'; +import { FurnitureType, GetAssetManager, GraphicAssetCollection, GraphicAssetGifCollection, IAssetData, IEventDispatcher, IFurnitureData, IFurnitureDataListener, IGraphicAssetCollection, IGraphicAssetGifCollection, IPetColorResult, IRoomContentListener, IRoomContentLoader, IRoomObject, ISessionDataManager, NitroBundle, NitroConfiguration, NitroLogger, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, RoomObjectVisualizationType } from '../../api'; import { NitroEvent } from '../../events'; import { RoomContentLoadedEvent } from '../../room/events/RoomContentLoadedEvent'; -import { Nitro } from '../Nitro'; import { PetColorResult } from './PetColorResult'; export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLoader @@ -282,7 +280,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo if(!existing) { - const globalCollection = Nitro.instance.core.asset.getCollection(name); + const globalCollection = GetAssetManager().getCollection(name); if(globalCollection) { diff --git a/src/nitro/room/object/logic/furniture/FurnitureRentableSpaceLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRentableSpaceLogic.ts index b97ffa80..8ac4a587 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRentableSpaceLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRentableSpaceLogic.ts @@ -1,5 +1,4 @@ -import { RoomObjectVariable, RoomWidgetEnum } from '../../../../../api'; -import { AdvancedMap } from '../../../../../core'; +import { AdvancedMap, RoomObjectVariable, RoomWidgetEnum } from '../../../../../api'; import { RoomObjectDataRequestEvent } from '../../../../../events'; import { FurnitureLogic } from './FurnitureLogic'; diff --git a/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts index a77ade0a..1279c16c 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureRoomBrandingLogic.ts @@ -1,6 +1,6 @@ import { BaseTexture, Texture } from '@pixi/core'; import { decompressFrames, parseGIF } from 'gifuct-js'; -import { IAssetData, IRoomGeometry, MapDataType, MouseEventType, RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api'; +import { GetAssetManager, IAssetData, IRoomGeometry, MapDataType, MouseEventType, RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api'; import { RoomObjectRoomAdEvent } from '../../../../../events'; import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room'; import { Nitro } from '../../../../Nitro'; @@ -208,7 +208,7 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic } else { - const asset = Nitro.instance.core && Nitro.instance.core.asset; + const asset = GetAssetManager(); if(!asset) return; diff --git a/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts b/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts index 26d5718e..83f1712c 100644 --- a/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts +++ b/src/nitro/room/object/visualization/avatar/AvatarVisualization.ts @@ -1,7 +1,6 @@ import { BLEND_MODES } from '@pixi/constants'; import { Resource, Texture } from '@pixi/core'; -import { AlphaTolerance, AvatarAction, AvatarGuideStatus, AvatarSetType, IAdvancedMap, IAvatarEffectListener, IAvatarImage, IAvatarImageListener, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObject, IRoomObjectModel, RoomObjectSpriteType, RoomObjectVariable } from '../../../../../api'; -import { AdvancedMap } from '../../../../../core'; +import { AdvancedMap, AlphaTolerance, AvatarAction, AvatarGuideStatus, AvatarSetType, IAdvancedMap, IAvatarEffectListener, IAvatarImage, IAvatarImageListener, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObject, IRoomObjectModel, RoomObjectSpriteType, RoomObjectVariable } from '../../../../../api'; import { RoomObjectSpriteVisualization } from '../../../../../room'; import { ExpressionAdditionFactory, FloatingIdleZAddition, GameClickTargetAddition, GuideStatusBubbleAddition, IAvatarAddition, MutedBubbleAddition, NumberBubbleAddition, TypingBubbleAddition } from './additions'; import { AvatarVisualizationData } from './AvatarVisualizationData'; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureBrandedImageVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureBrandedImageVisualization.ts index 129a02b8..a449b287 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureBrandedImageVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureBrandedImageVisualization.ts @@ -1,6 +1,5 @@ import { Resource, Texture } from '@pixi/core'; -import { RoomObjectVariable } from '../../../../../api'; -import { GraphicAssetGifCollection } from '../../../../../core'; +import { GetAssetManager, GraphicAssetGifCollection, RoomObjectVariable } from '../../../../../api'; import { Nitro } from '../../../../Nitro'; import { FurnitureVisualization } from './FurnitureVisualization'; @@ -147,7 +146,7 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization } else { - texture = Nitro.instance.core.asset.getTexture(imageUrl); + texture = GetAssetManager().getTexture(imageUrl); } if(!texture) return false; @@ -183,7 +182,7 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization if(!this._imageUrl) return; - const texture = Nitro.instance.core.asset.getTexture(this._imageUrl); + const texture = GetAssetManager().getTexture(this._imageUrl); if(!texture) return; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts index 36d18db7..93cc2d2a 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureFireworksVisualization.ts @@ -1,5 +1,4 @@ -import { IAdvancedMap, IParticleSystem, NitroLogger, RoomObjectVariable } from '../../../../../api'; -import { AdvancedMap } from '../../../../../core'; +import { AdvancedMap, IAdvancedMap, IParticleSystem, NitroLogger, RoomObjectVariable } from '../../../../../api'; import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; import { FurnitureParticleSystem } from './FurnitureParticleSystem'; diff --git a/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts index b6434c66..fae9e893 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureGuildIsometricBadgeVisualization.ts @@ -1,4 +1,7 @@ +import { RenderTexture, Resource, Texture } from '@pixi/core'; +import { Matrix } from '@pixi/math'; import { IGraphicAsset, IRoomObjectSprite, RoomObjectVariable } from '../../../../../api'; +import { NitroSprite, PixiApplicationProxy } from '../../../../../pixi-proxy'; import { IsometricImageFurniVisualization } from './IsometricImageFurniVisualization'; export class FurnitureGuildIsometricBadgeVisualization extends IsometricImageFurniVisualization @@ -33,6 +36,58 @@ export class FurnitureGuildIsometricBadgeVisualization extends IsometricImageFur return flag; } + protected generateTransformedThumbnail(texture: Texture, asset: IGraphicAsset): Texture + { + const scale = 1.1; + const matrix = new Matrix(); + const difference = (asset.width / texture.width); + + console.log(((0.5 * difference) * texture.width)); + + switch(this.direction) + { + case 2: + matrix.a = difference; + matrix.b = (-0.5 * difference); + matrix.c = 0; + matrix.d = (difference * scale); + matrix.tx = 0; + matrix.ty = 20; + break; + case 0: + case 4: + matrix.a = difference; + matrix.b = (0.5 * difference); + matrix.c = 0; + matrix.d = (difference * scale); + matrix.tx = 0; + matrix.ty = 0; + break; + default: + matrix.a = difference; + matrix.b = 0; + matrix.c = 0; + matrix.d = difference; + matrix.tx = 0; + matrix.ty = 0; + } + + const sprite = new NitroSprite(texture); + + const renderTexture = RenderTexture.create({ + width: (asset.width + matrix.tx), + height: (asset.height + matrix.ty) + }); + + PixiApplicationProxy.instance.renderer.render(sprite, { + renderTexture, + clear: true, + transform: matrix + }); + + return renderTexture; + } + protected getLayerColor(scale: number, layerId: number, colorId: number): number { const tag = this.getLayerTag(scale, this._direction, layerId); diff --git a/src/nitro/room/object/visualization/furniture/FurnitureIsometricBBVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureIsometricBBVisualization.ts index 3396e1ee..36908e4c 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureIsometricBBVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureIsometricBBVisualization.ts @@ -1,8 +1,7 @@ import { RenderTexture, Resource, Texture } from '@pixi/core'; import { Matrix } from '@pixi/math'; -import { IGraphicAsset } from '../../../../../api'; +import { GetAssetManager, IGraphicAsset } from '../../../../../api'; import { NitroSprite, PixiApplicationProxy } from '../../../../../pixi-proxy'; -import { Nitro } from '../../../../Nitro'; import { FurnitureBBVisualization } from './FurnitureBBVisualization'; import { FurnitureBrandedImageVisualization } from './FurnitureBrandedImageVisualization'; @@ -154,7 +153,7 @@ export class FurnitureIsometricBBVisualization extends FurnitureBBVisualization } else { - this.generateTransformedImage(Nitro.instance.core.asset.getTexture(this._imageUrl), this.getAsset(super.getSpriteAssetName(scale, layerId))); + this.generateTransformedImage(GetAssetManager().getTexture(this._imageUrl), this.getAsset(super.getSpriteAssetName(scale, layerId))); } } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts index 5605ccb8..1b1ef4bc 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureParticleSystem.ts @@ -2,8 +2,7 @@ import { RenderTexture, Texture } from '@pixi/core'; import { AlphaFilter } from '@pixi/filter-alpha'; import { Graphics } from '@pixi/graphics'; import { Matrix } from '@pixi/math'; -import { IAdvancedMap, IGraphicAsset, IParticleSystem, IRoomObjectSprite } from '../../../../../api'; -import { AdvancedMap } from '../../../../../core'; +import { AdvancedMap, IAdvancedMap, IGraphicAsset, IParticleSystem, IRoomObjectSprite } from '../../../../../api'; import { NitroPoint, NitroSprite, PixiApplicationProxy } from '../../../../../pixi-proxy'; import { Vector3D } from '../../../../avatar'; import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; diff --git a/src/nitro/room/object/visualization/furniture/IsometricImageFurniVisualization.ts b/src/nitro/room/object/visualization/furniture/IsometricImageFurniVisualization.ts index 016526e6..1c0a0ced 100644 --- a/src/nitro/room/object/visualization/furniture/IsometricImageFurniVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/IsometricImageFurniVisualization.ts @@ -91,7 +91,7 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza } } - private generateTransformedThumbnail(texture: Texture, asset: IGraphicAsset): Texture + protected generateTransformedThumbnail(texture: Texture, asset: IGraphicAsset): Texture { if(this._hasOutline) { diff --git a/src/nitro/room/object/visualization/pet/PetVisualization.ts b/src/nitro/room/object/visualization/pet/PetVisualization.ts index 70cd187e..e484f622 100644 --- a/src/nitro/room/object/visualization/pet/PetVisualization.ts +++ b/src/nitro/room/object/visualization/pet/PetVisualization.ts @@ -1,6 +1,5 @@ import { Resource, Texture } from '@pixi/core'; -import { IGraphicAsset, IObjectVisualizationData, IRoomGeometry, RoomObjectVariable, RoomObjectVisualizationType } from '../../../../../api'; -import { Nitro } from '../../../../Nitro'; +import { GetAssetManager, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, RoomObjectVariable, RoomObjectVisualizationType } from '../../../../../api'; import { AnimationData, AnimationStateData, DirectionData, LayerData } from '../data'; import { FurnitureAnimatedVisualization, FurnitureVisualizationData } from '../furniture'; import { ExperienceData } from './ExperienceData'; @@ -594,6 +593,6 @@ export class PetVisualization extends FurnitureAnimatedVisualization public getPetAdditionAsset(name: string): Texture { - return Nitro.instance.core.asset.getTexture(name); + return GetAssetManager().getTexture(name); } } diff --git a/src/nitro/room/object/visualization/room/RoomVisualization.ts b/src/nitro/room/object/visualization/room/RoomVisualization.ts index 51d7d497..daf0093d 100644 --- a/src/nitro/room/object/visualization/room/RoomVisualization.ts +++ b/src/nitro/room/object/visualization/room/RoomVisualization.ts @@ -1,7 +1,6 @@ import { RenderTexture, Resource, Texture } from '@pixi/core'; import { Rectangle } from '@pixi/math'; -import { AlphaTolerance, IObjectVisualizationData, IPlaneVisualization, IRoomGeometry, IRoomObjectModel, IRoomObjectSprite, IRoomPlane, RoomObjectSpriteType, RoomObjectVariable, Vector3d } from '../../../../../api'; -import { AdvancedMap } from '../../../../../core'; +import { AdvancedMap, AlphaTolerance, IObjectVisualizationData, IPlaneVisualization, IRoomGeometry, IRoomObjectModel, IRoomObjectSprite, IRoomPlane, RoomObjectSpriteType, RoomObjectVariable, Vector3d } from '../../../../../api'; import { RoomObjectSpriteVisualization } from '../../../../../room'; import { RoomMapData } from '../../RoomMapData'; import { RoomMapMaskData } from '../../RoomMapMaskData'; diff --git a/src/nitro/session/SessionDataManager.ts b/src/nitro/session/SessionDataManager.ts index 8107802f..126e3ea5 100644 --- a/src/nitro/session/SessionDataManager.ts +++ b/src/nitro/session/SessionDataManager.ts @@ -1,5 +1,5 @@ import { Resource, Texture } from '@pixi/core'; -import { IFurnitureData, IFurnitureDataListener, IGroupInformationManager, IMessageComposer, INitroCommunicationManager, INitroEvent, IProductData, IProductDataListener, ISessionDataManager, NitroConfiguration, NoobnessLevelEnum, SecurityLevel } from '../../api'; +import { GetAssetManager, IFurnitureData, IFurnitureDataListener, IGroupInformationManager, IMessageComposer, INitroCommunicationManager, INitroEvent, IProductData, IProductDataListener, ISessionDataManager, NitroConfiguration, NoobnessLevelEnum, SecurityLevel } from '../../api'; import { NitroManager } from '../../core'; import { MysteryBoxKeysUpdateEvent, NitroSettingsEvent, SessionDataPreferencesEvent, UserNameUpdateEvent } from '../../events'; import { AvailabilityStatusMessageEvent, ChangeUserNameResultMessageEvent, FigureUpdateEvent, InClientLinkEvent, MysteryBoxKeysEvent, NoobnessLevelMessageEvent, PetRespectComposer, RoomReadyMessageEvent, RoomUnitChatComposer, UserInfoEvent, UserNameChangeMessageEvent, UserPermissionsEvent, UserRespectComposer } from '../communication'; @@ -175,7 +175,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana { if(this._badgeImageManager) return; - this._badgeImageManager = new BadgeImageManager(Nitro.instance.core.asset, this); + this._badgeImageManager = new BadgeImageManager(GetAssetManager(), this); this._badgeImageManager.init(); } diff --git a/src/nitro/sound/SoundManager.ts b/src/nitro/sound/SoundManager.ts index 375f8b5d..1b4464ff 100644 --- a/src/nitro/sound/SoundManager.ts +++ b/src/nitro/sound/SoundManager.ts @@ -1,5 +1,5 @@ -import { IAdvancedMap, IMusicController, INitroEvent, ISoundManager, NitroConfiguration } from '../../api'; -import { AdvancedMap, NitroManager } from '../../core'; +import { AdvancedMap, IAdvancedMap, IMusicController, INitroEvent, ISoundManager, NitroConfiguration } from '../../api'; +import { NitroManager } from '../../core'; import { NitroSettingsEvent, NitroSoundEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomEngineSamplePlaybackEvent } from '../../events'; import { Nitro } from '../Nitro'; import { MusicController } from './music/MusicController'; diff --git a/src/nitro/sound/music/MusicController.ts b/src/nitro/sound/music/MusicController.ts index 8fde79eb..31ca98e2 100644 --- a/src/nitro/sound/music/MusicController.ts +++ b/src/nitro/sound/music/MusicController.ts @@ -1,6 +1,4 @@ -import { IAdvancedMap, IMessageEvent, IMusicController, IPlaylistController } from '../../../api'; -import { ISongInfo } from '../../../api/nitro/sound/common/ISongInfo'; -import { AdvancedMap } from '../../../core'; +import { AdvancedMap, IAdvancedMap, IMessageEvent, IMusicController, IPlaylistController, ISongInfo } from '../../../api'; import { RoomObjectSoundMachineEvent } from '../../../events'; import { GetNowPlayingMessageComposer, GetSongInfoMessageComposer, GetUserSongDisksMessageComposer, TraxSongInfoMessageEvent, UserSongDisksInventoryMessageEvent } from '../../communication'; import { Nitro } from '../../Nitro'; @@ -22,10 +20,10 @@ export class MusicController implements IMusicController private _requestedSongs: Map; private _availableSongs: Map; private _songRequestsPerPriority: SongStartRequestData[]; - private _songRequestCountsPerPriority:number[]; + private _songRequestCountsPerPriority: number[]; private _diskInventoryMissingData: number[]; private _songDiskInventory: IAdvancedMap; - private _priorityPlaying:number = -1; + private _priorityPlaying: number = -1; private _requestNumberPlaying: number = -1; private _messageEvents: IMessageEvent[]; private _roomItemPlaylist: IPlaylistController; @@ -112,7 +110,7 @@ export class MusicController implements IMusicController public getSongInfo(k: number): ISongInfo { - const _local_2:SongDataEntry = this.getSongDataEntry(k); + const _local_2: SongDataEntry = this.getSongDataEntry(k); if(!_local_2) { this.requestSongInfoWithoutSamples(k); @@ -187,8 +185,8 @@ export class MusicController implements IMusicController public get samplesIdsInUse(): number[] { - let _local_3:SongStartRequestData; - let _local_4:SongDataEntry; + let _local_3: SongStartRequestData; + let _local_4: SongDataEntry; let k = []; for(let i = 0; i < this._songRequestsPerPriority.length; i++) { @@ -229,7 +227,7 @@ export class MusicController implements IMusicController throw new Error('Method not implemented.'); } - protected onTraxSongComplete(k:SoundManagerEvent):void + protected onTraxSongComplete(k: SoundManagerEvent): void { console.log((('Song ' + k.id) + ' finished playing')); if(this.getSongIdPlayingAtPriority(this._priorityPlaying) == k.id) @@ -329,7 +327,7 @@ export class MusicController implements IMusicController } } - private areSamplesRequested(k:number):boolean + private areSamplesRequested(k: number): boolean { if(!this._requestedSongs.get(k)) { @@ -338,9 +336,9 @@ export class MusicController implements IMusicController return this._requestedSongs.get(k); } - private processSongEntryForPlaying(k:number, _arg_2:boolean=true):boolean + private processSongEntryForPlaying(k: number, _arg_2: boolean = true): boolean { - const songData:SongDataEntry = this.getSongDataEntry(k); + const songData: SongDataEntry = this.getSongDataEntry(k); if(!songData) { this.addSongInfoRequest(k); @@ -380,7 +378,7 @@ export class MusicController implements IMusicController return true; } - private playSongObject(priority:number, songId:number):boolean + private playSongObject(priority: number, songId: number): boolean { if((((songId == -1) || (priority < 0)) || (priority >= MusicPriorities.PRIORITY_COUNT))) { @@ -391,7 +389,7 @@ export class MusicController implements IMusicController { _local_3 = true; } - const songData:SongDataEntry = this.getSongDataEntry(songId); + const songData: SongDataEntry = this.getSongDataEntry(songId); if(!songData) { console.log((('WARNING: Unable to find song entry id ' + songId) + ' that was supposed to be loaded.')); @@ -408,7 +406,7 @@ export class MusicController implements IMusicController let fadeInSeconds = 2; let fadeOutSeconds = 1; - const songRequestData:SongStartRequestData = this.getSongStartRequest(priority); + const songRequestData: SongStartRequestData = this.getSongStartRequest(priority); console.log(songRequestData); @@ -453,7 +451,7 @@ export class MusicController implements IMusicController return true; } - private notifySongPlaying(k:SongDataEntry):void + private notifySongPlaying(k: SongDataEntry): void { const _local_2 = 8000; const timeNow = Date.now(); @@ -465,7 +463,7 @@ export class MusicController implements IMusicController } } - private addSongStartRequest(priority:number, songId:number, startPos:number, playLength:number, fadeInSeconds:number, fadeOutSeconds:number):boolean + private addSongStartRequest(priority: number, songId: number, startPos: number, playLength: number, fadeInSeconds: number, fadeOutSeconds: number): boolean { if(((priority < 0) || (priority >= MusicPriorities.PRIORITY_COUNT))) { @@ -477,9 +475,9 @@ export class MusicController implements IMusicController return true; } - private getSongDataEntry(k:number):SongDataEntry + private getSongDataEntry(k: number): SongDataEntry { - let entry:SongDataEntry; + let entry: SongDataEntry; if(this._availableSongs) { entry = (this._availableSongs.get(k)); @@ -487,7 +485,7 @@ export class MusicController implements IMusicController return entry; } - private getSongStartRequest(k:number):SongStartRequestData + private getSongStartRequest(k: number): SongStartRequestData { return this._songRequestsPerPriority[k]; } @@ -506,7 +504,7 @@ export class MusicController implements IMusicController return this._songRequestsPerPriority[priorityIndex].songId; } - private getSongRequestCountAtPriority(k:number):number + private getSongRequestCountAtPriority(k: number): number { if(((k < 0) || (k >= MusicPriorities.PRIORITY_COUNT))) { @@ -515,9 +513,9 @@ export class MusicController implements IMusicController return this._songRequestCountsPerPriority[k]; } - private playSongWithHighestPriority():void + private playSongWithHighestPriority(): void { - let _local_3:number; + let _local_3: number; this._priorityPlaying = -1; this._songIdPlaying = -1; this._requestNumberPlaying = -1; @@ -534,7 +532,7 @@ export class MusicController implements IMusicController } } - private resetSongStartRequest(priority:number):void + private resetSongStartRequest(priority: number): void { if(((priority >= 0) && (priority < MusicPriorities.PRIORITY_COUNT))) { @@ -542,12 +540,12 @@ export class MusicController implements IMusicController } } - private reRequestSongAtPriority(k:number):void + private reRequestSongAtPriority(k: number): void { this._songRequestCountsPerPriority[k] = (this._songRequestCountsPerPriority[k] + 1); } - private stopSongAtPriority(priority:number):boolean + private stopSongAtPriority(priority: number): boolean { if(((priority == this._priorityPlaying) && (this._priorityPlaying >= 0))) { @@ -565,18 +563,18 @@ export class MusicController implements IMusicController return false; } - private onSoundMachineInit(k:Event):void + private onSoundMachineInit(k: Event): void { this.disposeRoomPlaylist(); //this._roomItemPlaylist = (new SoundMachinePlayListController(this._soundManager, this, this._events) as IPlaylistController); } - private onSoundMachineDispose(k:Event):void + private onSoundMachineDispose(k: Event): void { this.disposeRoomPlaylist(); } - private onJukeboxInit(k:Event):void + private onJukeboxInit(k: Event): void { this.disposeRoomPlaylist(); this._roomItemPlaylist = (new JukeboxPlaylistController() as IPlaylistController); @@ -584,12 +582,12 @@ export class MusicController implements IMusicController Nitro.instance.communication.connection.send(new GetNowPlayingMessageComposer()); } - private onJukeboxDispose(k:Event):void + private onJukeboxDispose(k: Event): void { this.disposeRoomPlaylist(); } - private disposeRoomPlaylist():void + private disposeRoomPlaylist(): void { if(this._roomItemPlaylist) { diff --git a/src/room/RoomObjectManager.ts b/src/room/RoomObjectManager.ts index be195920..147379b2 100644 --- a/src/room/RoomObjectManager.ts +++ b/src/room/RoomObjectManager.ts @@ -1,5 +1,4 @@ -import { IAdvancedMap, IRoomObjectController, IRoomObjectManager } from '../api'; -import { AdvancedMap } from '../core'; +import { AdvancedMap, IAdvancedMap, IRoomObjectController, IRoomObjectManager } from '../api'; import { RoomObject } from './object'; export class RoomObjectManager implements IRoomObjectManager