mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-02-17 02:22:36 +01:00
Update Config & Logger
This commit is contained in:
parent
175e706b51
commit
5f84307227
@ -1,4 +1,4 @@
|
||||
import { INitroLogger } from '../../api';
|
||||
import { INitroLogger } from './INitroLogger';
|
||||
|
||||
export class NitroLogger implements INitroLogger
|
||||
{
|
||||
@ -30,38 +30,29 @@ export class NitroLogger implements INitroLogger
|
||||
|
||||
public printMessage(modus: string, ...message: any[]): void
|
||||
{
|
||||
if(!this._print) return;
|
||||
if (!this._print) return;
|
||||
|
||||
NitroLogger.log(this._name, modus, ...message);
|
||||
}
|
||||
|
||||
public static log(name: string = 'Nitro', modus: string = null, ...message: any[]): void
|
||||
private static logPrefix(): string
|
||||
{
|
||||
const logPrefix = `[Nitro] [${name}]`;
|
||||
|
||||
switch(modus)
|
||||
{
|
||||
case 'error':
|
||||
console.error(logPrefix, ...message);
|
||||
break;
|
||||
case 'warn':
|
||||
console.warn(logPrefix, ...message);
|
||||
break;
|
||||
case 'log':
|
||||
default:
|
||||
console.log(logPrefix, ...message);
|
||||
break;
|
||||
}
|
||||
return '[Nitro]';
|
||||
}
|
||||
|
||||
public static error(name: string = 'Nitro', ...message: any[]): void
|
||||
public static log(...messages: any[]): void
|
||||
{
|
||||
return this.log(name, 'error', ...message);
|
||||
console.log(this.logPrefix(), ...messages);
|
||||
}
|
||||
|
||||
public static warn(name: string = 'Nitro', ...message: any[]): void
|
||||
public static error(...messages: any[]): void
|
||||
{
|
||||
return this.log(name, 'warn', ...message);
|
||||
console.error(this.logPrefix(), ...messages);
|
||||
}
|
||||
|
||||
public static warn(...messages: any[]): void
|
||||
{
|
||||
console.warn(this.logPrefix(), ...messages);
|
||||
}
|
||||
|
||||
public get description(): string | number
|
@ -6,3 +6,4 @@ export * from './INitroLogger';
|
||||
export * from './INitroManager';
|
||||
export * from './IUpdateReceiver';
|
||||
export * from './IWorkerEventTracker';
|
||||
export * from './NitroLogger';
|
||||
|
@ -2,8 +2,4 @@
|
||||
|
||||
export interface IConfigurationManager extends INitroManager
|
||||
{
|
||||
interpolate(value: string, regex?: RegExp): string;
|
||||
getValue<T>(key: string, value?: T): T;
|
||||
setValue<T>(key: string, value: T): void;
|
||||
definitions: Map<string, unknown>;
|
||||
}
|
||||
|
114
src/api/configuration/NitroConfiguration.ts
Normal file
114
src/api/configuration/NitroConfiguration.ts
Normal file
@ -0,0 +1,114 @@
|
||||
import { NitroLogger } from '../common';
|
||||
|
||||
export class NitroConfiguration
|
||||
{
|
||||
private static _definitions: Map<string, unknown> = new Map();
|
||||
private static _config: any = {};
|
||||
private static _missingKeys: string[] = [];
|
||||
|
||||
public static parseConfiguration(data: { [index: string]: any }, overrides: boolean = false): boolean
|
||||
{
|
||||
if (!data) return false;
|
||||
|
||||
try
|
||||
{
|
||||
const regex = new RegExp(/\${(.*?)}/g);
|
||||
|
||||
for (const key in data)
|
||||
{
|
||||
let value = data[key];
|
||||
|
||||
if (typeof value === 'string') value = this.interpolate((value as string), regex);
|
||||
|
||||
if (this._definitions.has(key))
|
||||
{
|
||||
if (overrides) this.setValue(key, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setValue(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
catch (e)
|
||||
{
|
||||
NitroLogger.error(e.stack);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static interpolate(value: string, regex: RegExp = null): string
|
||||
{
|
||||
if (!regex) regex = new RegExp(/\${(.*?)}/g);
|
||||
|
||||
const pieces = value.match(regex);
|
||||
|
||||
if (pieces && pieces.length)
|
||||
{
|
||||
for (const piece of pieces)
|
||||
{
|
||||
const existing = (this._definitions.get(this.removeInterpolateKey(piece)) as string);
|
||||
|
||||
if (existing) (value = value.replace(piece, existing));
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private static removeInterpolateKey(value: string): string
|
||||
{
|
||||
return value.replace('${', '').replace('}', '');
|
||||
}
|
||||
|
||||
public static getValue<T>(key: string, value: T = null): T
|
||||
{
|
||||
let existing = this._definitions.get(key);
|
||||
|
||||
if (existing === undefined)
|
||||
{
|
||||
if (this._missingKeys.indexOf(key) >= 0) return value;
|
||||
|
||||
this._missingKeys.push(key);
|
||||
NitroLogger.warn(`Missing configuration key: ${key}`);
|
||||
|
||||
existing = value;
|
||||
}
|
||||
|
||||
return (existing as T);
|
||||
}
|
||||
|
||||
public static 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);
|
||||
}
|
||||
|
||||
public static get definitions(): Map<string, unknown>
|
||||
{
|
||||
return this._definitions;
|
||||
}
|
||||
}
|
@ -1 +1,2 @@
|
||||
export * from './IConfigurationManager';
|
||||
export * from './NitroConfiguration';
|
||||
|
@ -16,9 +16,32 @@ export * from './configuration';
|
||||
export * from './IAdvancedMap';
|
||||
export * from './INitroCore';
|
||||
export * from './nitro';
|
||||
export * from './nitro/avatar';
|
||||
export * from './nitro/avatar/actions';
|
||||
export * from './nitro/avatar/animation';
|
||||
export * from './nitro/avatar/enum';
|
||||
export * from './nitro/avatar/figuredata';
|
||||
export * from './nitro/avatar/pet';
|
||||
export * from './nitro/avatar/structure';
|
||||
export * from './nitro/camera';
|
||||
export * from './nitro/communication';
|
||||
export * from './nitro/enums';
|
||||
export * from './nitro/localization';
|
||||
export * from './nitro/room';
|
||||
export * from './nitro/room/enums';
|
||||
export * from './nitro/room/object';
|
||||
export * from './nitro/room/object/data';
|
||||
export * from './nitro/room/object/data/type';
|
||||
export * from './nitro/room/utils';
|
||||
export * from './nitro/session';
|
||||
export * from './nitro/session/enum';
|
||||
export * from './nitro/sound';
|
||||
export * from './room';
|
||||
export * from './room/object';
|
||||
export * from './room/object/enum';
|
||||
export * from './room/object/logic';
|
||||
export * from './room/object/visualization';
|
||||
export * from './room/renderer';
|
||||
export * from './ui';
|
||||
export * from './ui/widget';
|
||||
export * from './ui/widget/enums';
|
||||
|
@ -1,3 +1,4 @@
|
||||
export * from './MouseEventType';
|
||||
export * from './TouchEventType';
|
||||
export * from './widget';
|
||||
export * from './widget/enums';
|
@ -1,15 +1,14 @@
|
||||
import { BaseTexture, Resource, Texture } from '@pixi/core';
|
||||
import { Loader, LoaderResource } from '@pixi/loaders';
|
||||
import { Spritesheet } from '@pixi/spritesheet';
|
||||
import { IAssetData, IAssetManager, IGraphicAsset, IGraphicAssetCollection, INitroLogger } from '../../api';
|
||||
import { Disposable, NitroLogger } from '../common';
|
||||
import { IAssetData, IAssetManager, IGraphicAsset, IGraphicAssetCollection, NitroLogger } from '../../api';
|
||||
import { Disposable } from '../common';
|
||||
import { ArrayBufferToBase64 } from '../utils';
|
||||
import { GraphicAssetCollection } from './GraphicAssetCollection';
|
||||
import { NitroBundle } from './NitroBundle';
|
||||
|
||||
export class AssetManager extends Disposable implements IAssetManager
|
||||
{
|
||||
private _logger: INitroLogger;
|
||||
private _textures: Map<string, Texture<Resource>>;
|
||||
private _collections: Map<string, IGraphicAssetCollection>;
|
||||
|
||||
@ -17,40 +16,39 @@ export class AssetManager extends Disposable implements IAssetManager
|
||||
{
|
||||
super();
|
||||
|
||||
this._logger = new NitroLogger(this.constructor.name);
|
||||
this._textures = new Map();
|
||||
this._collections = new Map();
|
||||
}
|
||||
|
||||
public getTexture(name: string): Texture<Resource>
|
||||
{
|
||||
if(!name) return null;
|
||||
if (!name) return null;
|
||||
|
||||
const existing = this._textures.get(name);
|
||||
|
||||
if(!existing) return null;
|
||||
if (!existing) return null;
|
||||
|
||||
return existing;
|
||||
}
|
||||
|
||||
public setTexture(name: string, texture: Texture<Resource>): void
|
||||
{
|
||||
if(!name || !texture) return;
|
||||
if (!name || !texture) return;
|
||||
|
||||
this._textures.set(name, texture);
|
||||
}
|
||||
|
||||
public getAsset(name: string): IGraphicAsset
|
||||
{
|
||||
if(!name) return null;
|
||||
if (!name) return null;
|
||||
|
||||
for(const collection of this._collections.values())
|
||||
for (const collection of this._collections.values())
|
||||
{
|
||||
if(!collection) continue;
|
||||
if (!collection) continue;
|
||||
|
||||
const existing = collection.getAsset(name);
|
||||
|
||||
if(!existing) continue;
|
||||
if (!existing) continue;
|
||||
|
||||
return existing;
|
||||
}
|
||||
@ -60,24 +58,24 @@ export class AssetManager extends Disposable implements IAssetManager
|
||||
|
||||
public getCollection(name: string): IGraphicAssetCollection
|
||||
{
|
||||
if(!name) return null;
|
||||
if (!name) return null;
|
||||
|
||||
const existing = this._collections.get(name);
|
||||
|
||||
if(!existing) return null;
|
||||
if (!existing) return null;
|
||||
|
||||
return existing;
|
||||
}
|
||||
|
||||
public createCollection(data: IAssetData, spritesheet: Spritesheet): IGraphicAssetCollection
|
||||
{
|
||||
if(!data) return null;
|
||||
if (!data) return null;
|
||||
|
||||
const collection = new GraphicAssetCollection(data, spritesheet);
|
||||
|
||||
if(collection)
|
||||
if (collection)
|
||||
{
|
||||
for(const [name, texture] of collection.textures.entries()) this.setTexture(name, texture);
|
||||
for (const [name, texture] of collection.textures.entries()) this.setTexture(name, texture);
|
||||
|
||||
this._collections.set(collection.name, collection);
|
||||
}
|
||||
@ -92,7 +90,7 @@ export class AssetManager extends Disposable implements IAssetManager
|
||||
|
||||
public downloadAssets(assetUrls: string[], cb: (status: boolean) => void): void
|
||||
{
|
||||
if(!assetUrls || !assetUrls.length)
|
||||
if (!assetUrls || !assetUrls.length)
|
||||
{
|
||||
cb(true);
|
||||
|
||||
@ -101,9 +99,9 @@ export class AssetManager extends Disposable implements IAssetManager
|
||||
|
||||
const loader = new Loader();
|
||||
|
||||
for(const url of assetUrls)
|
||||
for (const url of assetUrls)
|
||||
{
|
||||
if(!url) continue;
|
||||
if (!url) continue;
|
||||
|
||||
loader
|
||||
.add({
|
||||
@ -118,9 +116,9 @@ export class AssetManager extends Disposable implements IAssetManager
|
||||
|
||||
const onDownloaded = (status: boolean, url: string) =>
|
||||
{
|
||||
if(!status)
|
||||
if (!status)
|
||||
{
|
||||
this._logger.error('Failed to download asset', url);
|
||||
NitroLogger.error('Failed to download asset', url);
|
||||
|
||||
loader.destroy();
|
||||
|
||||
@ -131,7 +129,7 @@ export class AssetManager extends Disposable implements IAssetManager
|
||||
|
||||
remaining--;
|
||||
|
||||
if(!remaining)
|
||||
if (!remaining)
|
||||
{
|
||||
loader.destroy();
|
||||
|
||||
@ -143,11 +141,11 @@ export class AssetManager extends Disposable implements IAssetManager
|
||||
|
||||
loader.load((loader, resources) =>
|
||||
{
|
||||
for(const key in resources)
|
||||
for (const key in resources)
|
||||
{
|
||||
const resource = resources[key];
|
||||
|
||||
if(!resource || resource.error || !resource.xhr)
|
||||
if (!resource || resource.error || !resource.xhr)
|
||||
{
|
||||
onDownloaded(false, resource.url);
|
||||
|
||||
@ -156,7 +154,7 @@ export class AssetManager extends Disposable implements IAssetManager
|
||||
|
||||
const resourceType = (resource.xhr.getResponseHeader('Content-Type') || 'application/octet-stream');
|
||||
|
||||
if(resourceType === 'application/octet-stream')
|
||||
if (resourceType === 'application/octet-stream')
|
||||
{
|
||||
const nitroBundle = new NitroBundle(resource.data);
|
||||
|
||||
@ -168,12 +166,12 @@ export class AssetManager extends Disposable implements IAssetManager
|
||||
continue;
|
||||
}
|
||||
|
||||
if((resourceType === 'image/png') || (resourceType === 'image/jpeg') || (resourceType === 'image/gif'))
|
||||
if ((resourceType === 'image/png') || (resourceType === 'image/jpeg') || (resourceType === 'image/gif'))
|
||||
{
|
||||
const base64 = ArrayBufferToBase64(resource.data);
|
||||
const baseTexture = new BaseTexture(`data:${resourceType};base64,${base64}`);
|
||||
|
||||
if(baseTexture.valid)
|
||||
if (baseTexture.valid)
|
||||
{
|
||||
const texture = new Texture(baseTexture);
|
||||
|
||||
@ -205,7 +203,7 @@ export class AssetManager extends Disposable implements IAssetManager
|
||||
{
|
||||
const spritesheetData = data.spritesheet;
|
||||
|
||||
if(!baseTexture || !spritesheetData || !Object.keys(spritesheetData).length)
|
||||
if (!baseTexture || !spritesheetData || !Object.keys(spritesheetData).length)
|
||||
{
|
||||
this.createCollection(data, null);
|
||||
|
||||
@ -226,7 +224,7 @@ export class AssetManager extends Disposable implements IAssetManager
|
||||
});
|
||||
};
|
||||
|
||||
if(baseTexture.valid)
|
||||
if (baseTexture.valid)
|
||||
{
|
||||
createAsset();
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { IDisposable, IEventDispatcher, INitroEvent, INitroLogger } from '../../api';
|
||||
import { IDisposable, IEventDispatcher, INitroEvent, INitroLogger, NitroConfiguration, NitroLogger } from '../../api';
|
||||
import { Disposable } from './Disposable';
|
||||
import { NitroLogger } from './NitroLogger';
|
||||
|
||||
export class EventDispatcher extends Disposable implements IEventDispatcher, IDisposable
|
||||
{
|
||||
@ -62,7 +61,7 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi
|
||||
{
|
||||
if (!event) return false;
|
||||
|
||||
//if (Nitro.instance.getConfiguration<boolean>('system.dispatcher.log')) this._logger.log('Dispatched Event', event.type);
|
||||
if (NitroConfiguration.getValue<boolean>('system.dispatcher.log')) this._logger.log('Dispatched Event', event.type);
|
||||
|
||||
this.processEvent(event);
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IEventDispatcher, INitroLogger, INitroManager } from '../../api';
|
||||
import { IEventDispatcher, INitroLogger, INitroManager, NitroLogger } from '../../api';
|
||||
import { Disposable } from './Disposable';
|
||||
import { EventDispatcher } from './EventDispatcher';
|
||||
import { NitroLogger } from './NitroLogger';
|
||||
|
||||
export class NitroManager extends Disposable implements INitroManager
|
||||
{
|
||||
@ -26,7 +25,7 @@ export class NitroManager extends Disposable implements INitroManager
|
||||
|
||||
public init(): void
|
||||
{
|
||||
if(this._isLoaded || this._isLoading || this.isDisposing) return;
|
||||
if (this._isLoaded || this._isLoading || this.isDisposing) return;
|
||||
|
||||
this._isLoading = true;
|
||||
|
||||
@ -43,7 +42,7 @@ export class NitroManager extends Disposable implements INitroManager
|
||||
|
||||
protected onDispose(): void
|
||||
{
|
||||
if(this._events) this._events.dispose();
|
||||
if (this._events) this._events.dispose();
|
||||
|
||||
super.onDispose();
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
export * from './Disposable';
|
||||
export * from './EventDispatcher';
|
||||
export * from './NitroLogger';
|
||||
export * from './NitroManager';
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ICodec, ICommunicationManager, IConnection, IConnectionStateListener, IMessageComposer, IMessageConfiguration, IMessageDataWrapper, IMessageEvent, WebSocketEventEnum } from '../../api';
|
||||
import { ICodec, ICommunicationManager, IConnection, IConnectionStateListener, IMessageComposer, IMessageConfiguration, IMessageDataWrapper, IMessageEvent, NitroConfiguration, NitroLogger, WebSocketEventEnum } from '../../api';
|
||||
import { SocketConnectionEvent } from '../../events';
|
||||
import { EventDispatcher } from '../common';
|
||||
import { EvaWireFormat } from './codec';
|
||||
@ -174,7 +174,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
|
||||
|
||||
if (header === -1)
|
||||
{
|
||||
//if (Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log(`Unknown Composer: ${composer.constructor.name}`);
|
||||
if (NitroConfiguration.getValue<boolean>('system.packet.log')) NitroLogger.log('Unknown Composer', composer.constructor.name);
|
||||
|
||||
continue;
|
||||
}
|
||||
@ -184,12 +184,12 @@ export class SocketConnection extends EventDispatcher implements IConnection
|
||||
|
||||
if (!encoded)
|
||||
{
|
||||
//if (Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log('Encoding Failed', composer.constructor.name);
|
||||
if (NitroConfiguration.getValue<boolean>('system.packet.log')) NitroLogger.log('Encoding Failed', composer.constructor.name);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
//if (Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log('OutgoingComposer', header, composer.constructor.name, message);
|
||||
if (NitroConfiguration.getValue<boolean>('system.packet.log')) NitroLogger.log('OutgoingComposer', header, composer.constructor.name, message);
|
||||
|
||||
this.write(encoded.getBuffer());
|
||||
}
|
||||
@ -213,7 +213,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
|
||||
|
||||
catch (err)
|
||||
{
|
||||
this.logger.error(err);
|
||||
NitroLogger.error(err);
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,7 +247,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
|
||||
|
||||
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 (NitroConfiguration.getValue<boolean>('system.packet.log')) NitroLogger.log('IncomingMessage', wrapper.header, messages[0].constructor.name, messages[0].parser);
|
||||
|
||||
this.handleMessages(...messages);
|
||||
}
|
||||
@ -278,7 +278,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
|
||||
|
||||
if (!events || !events.length)
|
||||
{
|
||||
//if (Nitro.instance.getConfiguration<boolean>('system.packet.log')) this.logger.log('IncomingMessage', wrapper.header, 'UNREGISTERED', wrapper);
|
||||
if (NitroConfiguration.getValue<boolean>('system.packet.log')) NitroLogger.log('IncomingMessage', wrapper.header, 'UNREGISTERED', wrapper);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -295,7 +295,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
|
||||
|
||||
catch (e)
|
||||
{
|
||||
this.logger.error('Error parsing message', e, events[0].constructor.name);
|
||||
NitroLogger.error('Error parsing message', e, events[0].constructor.name);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { IConfigurationManager } from '../../api';
|
||||
import { IConfigurationManager, NitroConfiguration } from '../../api';
|
||||
import { NitroManager } from '../common';
|
||||
import { ConfigurationEvent } from './ConfigurationEvent';
|
||||
|
||||
@ -23,16 +23,16 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
|
||||
|
||||
protected onInit(): void
|
||||
{
|
||||
this.parseConfiguration(this.getDefaultConfig(), true);
|
||||
NitroConfiguration.parseConfiguration(this.getDefaultConfig(), true);
|
||||
|
||||
this._pendingUrls = this.getValue<string[]>('config.urls').slice();
|
||||
this._pendingUrls = NitroConfiguration.getValue<string[]>('config.urls').slice();
|
||||
|
||||
this.loadNextConfiguration();
|
||||
}
|
||||
|
||||
private loadNextConfiguration(): void
|
||||
{
|
||||
if(!this._pendingUrls.length)
|
||||
if (!this._pendingUrls.length)
|
||||
{
|
||||
this.dispatchConfigurationEvent(ConfigurationEvent.LOADED);
|
||||
|
||||
@ -44,7 +44,7 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
|
||||
|
||||
public loadConfigurationFromUrl(url: string): void
|
||||
{
|
||||
if(!url || (url === ''))
|
||||
if (!url || (url === ''))
|
||||
{
|
||||
this.dispatchConfigurationEvent(ConfigurationEvent.FAILED);
|
||||
|
||||
@ -59,13 +59,13 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
|
||||
|
||||
private onConfigurationLoaded(data: { [index: string]: any }, url: string): void
|
||||
{
|
||||
if(!data) return;
|
||||
if (!data) return;
|
||||
|
||||
if(this.parseConfiguration(data))
|
||||
if (NitroConfiguration.parseConfiguration(data))
|
||||
{
|
||||
const index = this._pendingUrls.indexOf(url);
|
||||
|
||||
if(index >= 0) this._pendingUrls.splice(index, 1);
|
||||
if (index >= 0) this._pendingUrls.splice(index, 1);
|
||||
|
||||
this.loadNextConfiguration();
|
||||
|
||||
@ -85,115 +85,9 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
|
||||
this.events && this.events.dispatchEvent(new ConfigurationEvent(type));
|
||||
}
|
||||
|
||||
private parseConfiguration(data: { [index: string]: any }, overrides: boolean = false): boolean
|
||||
{
|
||||
if(!data) return false;
|
||||
|
||||
try
|
||||
{
|
||||
const regex = new RegExp(/\${(.*?)}/g);
|
||||
|
||||
for(const key in data)
|
||||
{
|
||||
let value = data[key];
|
||||
|
||||
if(typeof value === 'string') value = this.interpolate((value as string), regex);
|
||||
|
||||
if(this._definitions.has(key))
|
||||
{
|
||||
if(overrides) this.setValue(key, value);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setValue(key, value);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
catch (e)
|
||||
{
|
||||
this.logger.error(e.stack);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public interpolate(value: string, regex: RegExp = null): string
|
||||
{
|
||||
if(!regex) regex = new RegExp(/\${(.*?)}/g);
|
||||
|
||||
const pieces = value.match(regex);
|
||||
|
||||
if(pieces && pieces.length)
|
||||
{
|
||||
for(const piece of pieces)
|
||||
{
|
||||
const existing = (this._definitions.get(this.removeInterpolateKey(piece)) as string);
|
||||
|
||||
if(existing) (value = value.replace(piece, existing));
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
private removeInterpolateKey(value: string): string
|
||||
{
|
||||
return value.replace('${', '').replace('}', '');
|
||||
}
|
||||
|
||||
public getValue<T>(key: string, value: T = null): T
|
||||
{
|
||||
let existing = this._definitions.get(key);
|
||||
|
||||
if(existing === undefined)
|
||||
{
|
||||
if(this._missingKeys.indexOf(key) >= 0) return value;
|
||||
|
||||
this._missingKeys.push(key);
|
||||
this.logger.warn(`Missing configuration key: ${key}`);
|
||||
|
||||
existing = value;
|
||||
}
|
||||
|
||||
return (existing as T);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
public getDefaultConfig(): { [index: string]: any }
|
||||
{
|
||||
//@ts-ignore
|
||||
return NitroConfig as { [index: string]: any };
|
||||
}
|
||||
|
||||
public get definitions(): Map<string, unknown>
|
||||
{
|
||||
return this._definitions;
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ import { Application, IApplicationOptions } from '@pixi/app';
|
||||
import { SCALE_MODES } from '@pixi/constants';
|
||||
import { settings } from '@pixi/settings';
|
||||
import { Ticker } from '@pixi/ticker';
|
||||
import { IAvatarRenderManager, IEventDispatcher, ILinkEventTracker, INitroCommunicationManager, INitroCore, INitroLocalizationManager, IRoomCameraWidgetManager, IRoomEngine, IRoomManager, IRoomSessionManager, ISessionDataManager, ISoundManager, IWorkerEventTracker } from '../api';
|
||||
import { IAvatarRenderManager, IEventDispatcher, ILinkEventTracker, INitroCommunicationManager, INitroCore, INitroLocalizationManager, IRoomCameraWidgetManager, IRoomEngine, IRoomManager, IRoomSessionManager, ISessionDataManager, ISoundManager, IWorkerEventTracker, NitroConfiguration } from '../api';
|
||||
import { ConfigurationEvent, EventDispatcher, NitroCore } from '../core';
|
||||
import { NitroEvent, RoomEngineEvent } from '../events';
|
||||
import { PixiApplicationProxy } from '../pixi-proxy';
|
||||
@ -199,8 +199,8 @@ export class Nitro implements INitro
|
||||
|
||||
private onConfigurationLoadedEvent(event: ConfigurationEvent): void
|
||||
{
|
||||
const animationFPS = this.getConfiguration<number>('system.animation.fps', 24);
|
||||
const limitsFPS = this.getConfiguration<boolean>('system.limits.fps', true);
|
||||
const animationFPS = NitroConfiguration.getValue<number>('system.animation.fps', 24);
|
||||
const limitsFPS = NitroConfiguration.getValue<boolean>('system.limits.fps', true);
|
||||
|
||||
if (limitsFPS) Nitro.instance.ticker.maxFPS = animationFPS;
|
||||
}
|
||||
@ -212,7 +212,7 @@ export class Nitro implements INitro
|
||||
|
||||
public getConfiguration<T>(key: string, value: T = null): T
|
||||
{
|
||||
return this._core.configuration.getValue<T>(key, value);
|
||||
return NitroConfiguration.getValue<T>(key, value);
|
||||
}
|
||||
|
||||
public getLocalization(key: string): string
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IAssetManager, IAvatarFigureContainer, IAvatarImageListener, INitroEvent } from '../../api';
|
||||
import { IAssetManager, IAvatarFigureContainer, IAvatarImageListener, INitroEvent, NitroConfiguration, NitroLogger } from '../../api';
|
||||
import { EventDispatcher } from '../../core';
|
||||
import { AvatarRenderEvent, AvatarRenderLibraryEvent, NitroEvent } from '../../events';
|
||||
import { Nitro } from '../Nitro';
|
||||
import { AvatarAssetDownloadLibrary } from './AvatarAssetDownloadLibrary';
|
||||
import { AvatarStructure } from './AvatarStructure';
|
||||
|
||||
@ -32,7 +31,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher
|
||||
this._assets = assets;
|
||||
this._structure = structure;
|
||||
|
||||
this._missingMandatoryLibs = Nitro.instance.getConfiguration<string[]>('avatar.mandatory.libraries');
|
||||
this._missingMandatoryLibs = NitroConfiguration.getValue<string[]>('avatar.mandatory.libraries');
|
||||
this._figureMap = new Map();
|
||||
this._pendingContainers = [];
|
||||
this._figureListeners = new Map();
|
||||
@ -56,7 +55,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher
|
||||
|
||||
try
|
||||
{
|
||||
request.open('GET', Nitro.instance.getConfiguration<string>('avatar.figuremap.url'));
|
||||
request.open('GET', NitroConfiguration.getValue<string>('avatar.figuremap.url'));
|
||||
|
||||
request.send();
|
||||
|
||||
@ -84,7 +83,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher
|
||||
|
||||
catch (e)
|
||||
{
|
||||
this.logger.error(e);
|
||||
NitroLogger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +102,7 @@ export class AvatarAssetDownloadManager extends EventDispatcher
|
||||
|
||||
this._libraryNames.push(id);
|
||||
|
||||
const downloadLibrary = new AvatarAssetDownloadLibrary(id, revision, this._assets, Nitro.instance.getConfiguration<string>('avatar.asset.url'));
|
||||
const downloadLibrary = new AvatarAssetDownloadLibrary(id, revision, this._assets, NitroConfiguration.getValue<string>('avatar.asset.url'));
|
||||
|
||||
downloadLibrary.addEventListener(AvatarRenderLibraryEvent.DOWNLOAD_COMPLETE, this.onLibraryLoaded);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { AvatarSetType, IAssetManager, IAvatarEffectListener, IAvatarFigureContainer, IAvatarImage, IAvatarImageListener, IAvatarRenderManager, IFigureData, IFigurePartSet, IFigureSetData, IGraphicAsset, INitroEvent, IStructureData } from '../../api';
|
||||
import { AvatarSetType, 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';
|
||||
@ -134,7 +134,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
|
||||
|
||||
private loadActions(): void
|
||||
{
|
||||
const defaultActions = Nitro.instance.getConfiguration<string>('avatar.default.actions');
|
||||
const defaultActions = NitroConfiguration.getValue<string>('avatar.default.actions');
|
||||
|
||||
if (defaultActions) this._structure.initActions(Nitro.instance.core.asset, defaultActions);
|
||||
|
||||
@ -142,7 +142,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
|
||||
|
||||
try
|
||||
{
|
||||
request.open('GET', Nitro.instance.getConfiguration<string>('avatar.actions.url'));
|
||||
request.open('GET', NitroConfiguration.getValue<string>('avatar.actions.url'));
|
||||
|
||||
request.send();
|
||||
|
||||
@ -165,7 +165,7 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
|
||||
|
||||
catch (e)
|
||||
{
|
||||
this.logger.error(e);
|
||||
NitroLogger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -182,18 +182,18 @@ export class AvatarRenderManager extends NitroManager implements IAvatarRenderMa
|
||||
|
||||
private loadFigureData(): void
|
||||
{
|
||||
const defaultFigureData = Nitro.instance.getConfiguration<IFigureData>('avatar.default.figuredata');
|
||||
const defaultFigureData = NitroConfiguration.getValue<IFigureData>('avatar.default.figuredata');
|
||||
|
||||
if (!defaultFigureData || (typeof defaultFigureData === 'string'))
|
||||
{
|
||||
this.logger.error('XML figuredata is no longer supported');
|
||||
NitroLogger.error('XML figuredata is no longer supported');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._structure) this._structure.initFigureData(defaultFigureData);
|
||||
|
||||
const structureDownloader = new AvatarStructureDownload(Nitro.instance.getConfiguration<string>('avatar.figuredata.url'), (this._structure.figureData as IFigureSetData));
|
||||
const structureDownloader = new AvatarStructureDownload(NitroConfiguration.getValue<string>('avatar.figuredata.url'), (this._structure.figureData as IFigureSetData));
|
||||
|
||||
structureDownloader.addEventListener(AvatarStructureDownload.AVATAR_STRUCTURE_DONE, this.onAvatarStructureDownloadDone);
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IAssetManager, IAvatarEffectListener, INitroEvent } from '../../api';
|
||||
import { IAssetManager, IAvatarEffectListener, INitroEvent, NitroConfiguration, NitroLogger } from '../../api';
|
||||
import { EventDispatcher } from '../../core';
|
||||
import { AvatarRenderEffectLibraryEvent, AvatarRenderEvent, NitroEvent } from '../../events';
|
||||
import { Nitro } from '../Nitro';
|
||||
import { AvatarStructure } from './AvatarStructure';
|
||||
import { EffectAssetDownloadLibrary } from './EffectAssetDownloadLibrary';
|
||||
|
||||
@ -32,7 +31,7 @@ export class EffectAssetDownloadManager extends EventDispatcher
|
||||
this._assets = assets;
|
||||
this._structure = structure;
|
||||
|
||||
this._missingMandatoryLibs = Nitro.instance.getConfiguration<string[]>('avatar.mandatory.effect.libraries');
|
||||
this._missingMandatoryLibs = NitroConfiguration.getValue<string[]>('avatar.mandatory.effect.libraries');
|
||||
this._effectMap = new Map();
|
||||
this._effectListeners = new Map();
|
||||
this._incompleteEffects = new Map();
|
||||
@ -56,7 +55,7 @@ export class EffectAssetDownloadManager extends EventDispatcher
|
||||
|
||||
try
|
||||
{
|
||||
request.open('GET', Nitro.instance.getConfiguration<string>('avatar.effectmap.url'));
|
||||
request.open('GET', NitroConfiguration.getValue<string>('avatar.effectmap.url'));
|
||||
|
||||
request.send();
|
||||
|
||||
@ -84,7 +83,7 @@ export class EffectAssetDownloadManager extends EventDispatcher
|
||||
|
||||
catch (e)
|
||||
{
|
||||
this.logger.error(e);
|
||||
NitroLogger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +103,7 @@ export class EffectAssetDownloadManager extends EventDispatcher
|
||||
|
||||
this._libraryNames.push(lib);
|
||||
|
||||
const downloadLibrary = new EffectAssetDownloadLibrary(lib, revision, this._assets, Nitro.instance.getConfiguration<string>('avatar.asset.effect.url'));
|
||||
const downloadLibrary = new EffectAssetDownloadLibrary(lib, revision, this._assets, NitroConfiguration.getValue<string>('avatar.asset.effect.url'));
|
||||
|
||||
downloadLibrary.addEventListener(AvatarRenderEffectLibraryEvent.DOWNLOAD_COMPLETE, this.onLibraryLoaded);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { IFigureSetData } from '../../../api';
|
||||
import { IFigureSetData, NitroLogger } from '../../../api';
|
||||
import { EventDispatcher } from '../../../core';
|
||||
import { NitroEvent } from '../../../events';
|
||||
|
||||
@ -46,7 +46,7 @@ export class AvatarStructureDownload extends EventDispatcher
|
||||
|
||||
catch (e)
|
||||
{
|
||||
this.logger.error(e);
|
||||
NitroLogger.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { Texture } from '@pixi/core';
|
||||
import { ColorMatrix, ColorMatrixFilter } from '@pixi/filter-color-matrix';
|
||||
import { IEventDispatcher, IRoomCameraWidgetEffect, IRoomCameraWidgetManager, IRoomCameraWidgetSelectedEffect } from '../../api';
|
||||
import { IEventDispatcher, IRoomCameraWidgetEffect, IRoomCameraWidgetManager, IRoomCameraWidgetSelectedEffect, NitroConfiguration } from '../../api';
|
||||
import { EventDispatcher } from '../../core';
|
||||
import { RoomCameraWidgetManagerEvent } from '../../events';
|
||||
import { NitroContainer, NitroSprite, TextureUtils } from '../../pixi-proxy';
|
||||
import { Nitro } from '../Nitro';
|
||||
import { RoomCameraWidgetEffect } from './RoomCameraWidgetEffect';
|
||||
|
||||
export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
||||
@ -26,8 +25,8 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
||||
|
||||
this._isLoaded = true;
|
||||
|
||||
const imagesUrl = Nitro.instance.getConfiguration<string>('image.library.url') + 'Habbo-Stories/';
|
||||
const effects = Nitro.instance.getConfiguration<{ name: string, colorMatrix?: ColorMatrix, minLevel: number, blendMode?: number, enabled: boolean }[]>('camera.available.effects');
|
||||
const imagesUrl = NitroConfiguration.getValue<string>('image.library.url') + 'Habbo-Stories/';
|
||||
const effects = NitroConfiguration.getValue<{ name: string, colorMatrix?: ColorMatrix, minLevel: number, blendMode?: number, enabled: boolean }[]>('camera.available.effects');
|
||||
|
||||
for (const effect of effects)
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { IConnection, INitroCommunicationDemo, INitroCommunicationManager } from '../../api';
|
||||
import { IConnection, INitroCommunicationDemo, INitroCommunicationManager, NitroConfiguration, NitroLogger } from '../../api';
|
||||
import { NitroManager } from '../../core';
|
||||
import { NitroCommunicationDemoEvent, SocketConnectionEvent } from '../../events';
|
||||
import { GetTickerTime } from '../../pixi-proxy';
|
||||
@ -74,7 +74,7 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
|
||||
|
||||
this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_ESTABLISHED, connection);
|
||||
|
||||
if (Nitro.instance.getConfiguration<boolean>('system.pong.manually', false)) this.startPonging();
|
||||
if (NitroConfiguration.getValue<boolean>('system.pong.manually', false)) this.startPonging();
|
||||
|
||||
this.startHandshake(connection);
|
||||
|
||||
@ -111,7 +111,7 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
|
||||
{
|
||||
if (!this.getSSO())
|
||||
{
|
||||
this.logger.error('Login without an SSO ticket is not supported');
|
||||
NitroLogger.error('Login without an SSO ticket is not supported');
|
||||
}
|
||||
|
||||
this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_HANDSHAKE_FAILED, connection);
|
||||
@ -158,7 +158,7 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
|
||||
{
|
||||
this.stopPonging();
|
||||
|
||||
this._pongInterval = setInterval(this.sendPong, Nitro.instance.getConfiguration<number>('system.pong.interval.ms', 20000));
|
||||
this._pongInterval = setInterval(this.sendPong, NitroConfiguration.getValue<number>('system.pong.interval.ms', 20000));
|
||||
}
|
||||
|
||||
private stopPonging(): void
|
||||
@ -186,6 +186,6 @@ export class NitroCommunicationDemo extends NitroManager implements INitroCommun
|
||||
|
||||
private getSSO(): string
|
||||
{
|
||||
return Nitro.instance.getConfiguration('sso.ticket', null);
|
||||
return NitroConfiguration.getValue('sso.ticket', null);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ICommunicationManager, IConnection, IConnectionStateListener, IMessageConfiguration, IMessageEvent, INitroCommunicationDemo, INitroCommunicationManager, INitroEvent } from '../../api';
|
||||
import { ICommunicationManager, IConnection, IConnectionStateListener, IMessageConfiguration, IMessageEvent, INitroCommunicationDemo, INitroCommunicationManager, INitroEvent, NitroConfiguration, NitroLogger } from '../../api';
|
||||
import { NitroManager } from '../../core';
|
||||
import { NitroCommunicationDemoEvent, SocketConnectionEvent } from '../../events';
|
||||
import { Nitro } from '../Nitro';
|
||||
@ -45,7 +45,7 @@ export class NitroCommunicationManager extends NitroManager implements INitroCom
|
||||
|
||||
if (this._demo) this._demo.init();
|
||||
|
||||
this._connection.init(Nitro.instance.getConfiguration<string>('socket.url'));
|
||||
this._connection.init(NitroConfiguration.getValue<string>('socket.url'));
|
||||
}
|
||||
|
||||
protected onDispose(): void
|
||||
@ -66,29 +66,29 @@ export class NitroCommunicationManager extends NitroManager implements INitroCom
|
||||
|
||||
private onConnectionOpenedEvent(event: Event): void
|
||||
{
|
||||
this.logger.log('Connection Initialized');
|
||||
NitroLogger.log('Connection Initialized');
|
||||
}
|
||||
|
||||
private onConnectionClosedEvent(event: CloseEvent): void
|
||||
{
|
||||
this.logger.log('Connection Closed');
|
||||
NitroLogger.log('Connection Closed');
|
||||
}
|
||||
|
||||
private onConnectionErrorEvent(event: Event): void
|
||||
{
|
||||
this.logger.log('Connection Error');
|
||||
NitroLogger.log('Connection Error');
|
||||
}
|
||||
|
||||
private onConnectionAuthenticatedEvent(event: INitroEvent): void
|
||||
{
|
||||
this.logger.log('Connection Authenticated');
|
||||
NitroLogger.log('Connection Authenticated');
|
||||
|
||||
if (this._connection) this._connection.authenticated();
|
||||
}
|
||||
|
||||
public connectionInit(socketUrl: string): void
|
||||
{
|
||||
this.logger.log(`Initializing Connection: ${socketUrl}`);
|
||||
NitroLogger.log('Initializing Connection', socketUrl);
|
||||
}
|
||||
|
||||
public registerMessageEvent(event: IMessageEvent): IMessageEvent
|
||||
|
@ -8,6 +8,5 @@ export * from './localization';
|
||||
export * from './Nitro';
|
||||
export * from './room';
|
||||
export * from './session';
|
||||
export * from './ui';
|
||||
export * from './utils';
|
||||
export * from './window';
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { INitroCommunicationManager, INitroLocalizationManager } from '../../api';
|
||||
import { INitroCommunicationManager, INitroLocalizationManager, NitroConfiguration } from '../../api';
|
||||
import { NitroManager } from '../../core';
|
||||
import { NitroLocalizationEvent } from '../../events';
|
||||
import { BadgePointLimitsEvent } from '../communication';
|
||||
import { Nitro } from '../Nitro';
|
||||
import { BadgeBaseAndLevel } from './BadgeBaseAndLevel';
|
||||
|
||||
export class NitroLocalizationManager extends NitroManager implements INitroLocalizationManager
|
||||
@ -30,14 +29,14 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca
|
||||
{
|
||||
this._communication.registerMessageEvent(new BadgePointLimitsEvent(this.onBadgePointLimitsEvent.bind(this)));
|
||||
|
||||
let urls: string[] = Nitro.instance.getConfiguration<string[]>('external.texts.url');
|
||||
let urls: string[] = NitroConfiguration.getValue<string[]>('external.texts.url');
|
||||
|
||||
if (!Array.isArray(urls))
|
||||
{
|
||||
urls = [Nitro.instance.getConfiguration<string>('external.texts.url')];
|
||||
urls = [NitroConfiguration.getValue<string>('external.texts.url')];
|
||||
}
|
||||
|
||||
for (let i = 0; i < urls.length; i++) urls[i] = Nitro.instance.core.configuration.interpolate(urls[i]);
|
||||
for (let i = 0; i < urls.length; i++) urls[i] = NitroConfiguration.interpolate(urls[i]);
|
||||
|
||||
this._pendingUrls = urls;
|
||||
|
||||
@ -142,7 +141,7 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca
|
||||
|
||||
if (!value)
|
||||
{
|
||||
value = (Nitro.instance.core.configuration.definitions.get(key) as any);
|
||||
value = (NitroConfiguration.definitions.get(key) as any);
|
||||
|
||||
if (value) return value;
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
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, INitroLogger, IPetColorResult, IRoomContentListener, IRoomContentLoader, IRoomObject, ISessionDataManager, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, RoomObjectVisualizationType } from '../../api';
|
||||
import { GraphicAssetCollection, GraphicAssetGifCollection, NitroBundle, NitroLogger } from '../../core';
|
||||
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 { NitroEvent } from '../../events';
|
||||
import { RoomContentLoadedEvent } from '../../room/events/RoomContentLoadedEvent';
|
||||
import { Nitro } from '../Nitro';
|
||||
@ -21,7 +21,6 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
public static LOADER_READY: string = 'RCL_LOADER_READY';
|
||||
public static MANDATORY_LIBRARIES: string[] = [RoomContentLoader.PLACE_HOLDER, RoomContentLoader.PLACE_HOLDER_WALL, RoomContentLoader.PLACE_HOLDER_PET, RoomContentLoader.ROOM, RoomContentLoader.TILE_CURSOR, RoomContentLoader.SELECTION_ARROW];
|
||||
|
||||
private _logger: INitroLogger;
|
||||
private _stateEvents: IEventDispatcher;
|
||||
private _sessionDataManager: ISessionDataManager;
|
||||
private _waitingForSessionDataManager: boolean;
|
||||
@ -49,7 +48,6 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
constructor()
|
||||
{
|
||||
this._logger = new NitroLogger(this.constructor.name);
|
||||
this._stateEvents = null;
|
||||
this._sessionDataManager = null;
|
||||
this._waitingForSessionDataManager = false;
|
||||
@ -82,7 +80,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
this.setFurnitureData();
|
||||
|
||||
for (const [index, name] of Nitro.instance.getConfiguration<string[]>('pet.types').entries()) this._pets[name] = index;
|
||||
for (const [index, name] of NitroConfiguration.getValue<string[]>('pet.types').entries()) this._pets[name] = index;
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
@ -421,7 +419,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
public getPetNameForType(type: number): string
|
||||
{
|
||||
return Nitro.instance.getConfiguration<string[]>('pet.types')[type] || null;
|
||||
return NitroConfiguration.getValue<string[]>('pet.types')[type] || null;
|
||||
}
|
||||
|
||||
public isLoaderType(type: string): boolean
|
||||
@ -474,7 +472,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
image.onload = null;
|
||||
|
||||
this._logger.error('Failed to download asset', url);
|
||||
NitroLogger.error('Failed to download asset', url);
|
||||
|
||||
this._iconListener.onRoomContentLoaded(id, [type, param].join('_'), false);
|
||||
};
|
||||
@ -517,7 +515,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
if (!status)
|
||||
{
|
||||
this._logger.error('Failed to download asset', url);
|
||||
NitroLogger.error('Failed to download asset', url);
|
||||
|
||||
loader.destroy();
|
||||
|
||||
@ -704,22 +702,22 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
private getAssetUrlWithGenericBase(assetName: string): string
|
||||
{
|
||||
return (Nitro.instance.getConfiguration<string>('generic.asset.url').replace(/%libname%/gi, assetName));
|
||||
return (NitroConfiguration.getValue<string>('generic.asset.url').replace(/%libname%/gi, assetName));
|
||||
}
|
||||
|
||||
public getAssetUrlWithFurniBase(assetName: string): string
|
||||
{
|
||||
return (Nitro.instance.getConfiguration<string>('furni.asset.url').replace(/%libname%/gi, assetName));
|
||||
return (NitroConfiguration.getValue<string>('furni.asset.url').replace(/%libname%/gi, assetName));
|
||||
}
|
||||
|
||||
public getAssetUrlWithFurniIconBase(assetName: string): string
|
||||
{
|
||||
return (Nitro.instance.getConfiguration<string>('furni.asset.icon.url').replace(/%libname%/gi, assetName));
|
||||
return (NitroConfiguration.getValue<string>('furni.asset.icon.url').replace(/%libname%/gi, assetName));
|
||||
}
|
||||
|
||||
public getAssetUrlWithPetBase(assetName: string): string
|
||||
{
|
||||
return (Nitro.instance.getConfiguration<string>('pet.asset.url').replace(/%libname%/gi, assetName));
|
||||
return (NitroConfiguration.getValue<string>('pet.asset.url').replace(/%libname%/gi, assetName));
|
||||
}
|
||||
|
||||
public setRoomObjectRoomId(object: IRoomObject, roomId: string): void
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { RenderTexture, Resource, Texture } from '@pixi/core';
|
||||
import { Container, DisplayObject } from '@pixi/display';
|
||||
import { Matrix, Point, Rectangle } from '@pixi/math';
|
||||
import { IConnection, IDisposable, IFurnitureStackingHeightMap, IGetImageListener, IImageResult, ILegacyWallGeometry, IMessageComposer, INitroCommunicationManager, INitroEvent, IObjectData, IPetColorResult, IPetCustomPart, IRoomContentListener, IRoomContentLoader, IRoomCreator, IRoomEngine, IRoomEngineServices, IRoomGeometry, IRoomInstance, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectVisualizationFactory, IRoomRenderer, IRoomRendererFactory, IRoomRenderingCanvas, IRoomSessionManager, ISelectedRoomObjectData, ISessionDataManager, ITileObjectMap, IUpdateReceiver, IVector3D, LegacyDataType, ObjectDataFactory, RoomControllerLevel, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, ToolbarIconEnum, Vector3d } from '../../api';
|
||||
import { IConnection, IDisposable, IFurnitureStackingHeightMap, IGetImageListener, IImageResult, ILegacyWallGeometry, IMessageComposer, INitroCommunicationManager, INitroEvent, IObjectData, IPetColorResult, IPetCustomPart, IRoomContentListener, IRoomContentLoader, IRoomCreator, IRoomEngine, IRoomEngineServices, IRoomGeometry, IRoomInstance, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectVisualizationFactory, IRoomRenderer, IRoomRendererFactory, IRoomRenderingCanvas, IRoomSessionManager, ISelectedRoomObjectData, ISessionDataManager, ITileObjectMap, IUpdateReceiver, IVector3D, LegacyDataType, MouseEventType, NitroConfiguration, NitroLogger, ObjectDataFactory, RoomControllerLevel, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, ToolbarIconEnum, Vector3d } from '../../api';
|
||||
import { NitroManager } from '../../core';
|
||||
import { BadgeImageReadyEvent, NitroToolbarAnimateIconEvent, RoomBackgroundColorEvent, RoomDragEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomObjectFurnitureActionEvent, RoomSessionEvent, RoomToObjectOwnAvatarMoveEvent } from '../../events';
|
||||
import { GetTickerTime, NitroSprite, TextureUtils } from '../../pixi-proxy';
|
||||
@ -9,7 +9,6 @@ import { NumberBank, RoomEnterEffect, RoomGeometry, RoomInstance, RoomObjectEven
|
||||
import { PetFigureData } from '../avatar';
|
||||
import { RenderRoomMessageComposer, RenderRoomThumbnailMessageComposer } from '../communication';
|
||||
import { Nitro } from '../Nitro';
|
||||
import { MouseEventType } from '../ui';
|
||||
import { FurniId } from '../utils';
|
||||
import { ImageResult } from './ImageResult';
|
||||
import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, ObjectAvatarDanceUpdateMessage, ObjectAvatarEffectUpdateMessage, ObjectAvatarExperienceUpdateMessage, ObjectAvatarExpressionUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarFlatControlUpdateMessage, ObjectAvatarGestureUpdateMessage, ObjectAvatarGuideStatusUpdateMessage, ObjectAvatarMutedUpdateMessage, ObjectAvatarOwnMessage, ObjectAvatarPetGestureUpdateMessage, ObjectAvatarPlayerValueUpdateMessage, ObjectAvatarPlayingGameUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSignUpdateMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarTypingUpdateMessage, ObjectAvatarUpdateMessage, ObjectAvatarUseObjectUpdateMessage, ObjectDataUpdateMessage, ObjectGroupBadgeUpdateMessage, ObjectHeightUpdateMessage, ObjectItemDataUpdateMessage, ObjectModelDataUpdateMessage, ObjectMoveUpdateMessage, ObjectRoomColorUpdateMessage, ObjectRoomFloorHoleUpdateMessage, ObjectRoomMaskUpdateMessage, ObjectRoomPlanePropertyUpdateMessage, ObjectRoomPlaneVisibilityUpdateMessage, ObjectRoomUpdateMessage, ObjectStateUpdateMessage } from './messages';
|
||||
@ -276,14 +275,14 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
|
||||
this._roomDatas.set(roomId, data);
|
||||
|
||||
this.logger.warn('Room Engine not initilized yet, can not create room. Room data stored for later initialization.');
|
||||
NitroLogger.warn('Room Engine not initilized yet, can not create room. Room data stored for later initialization.');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!roomMap)
|
||||
{
|
||||
this.logger.warn('Room property messages');
|
||||
NitroLogger.warn('Room property messages');
|
||||
|
||||
return;
|
||||
}
|
||||
@ -427,7 +426,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
}
|
||||
|
||||
instance.createRoomObjectAndInitalize(RoomEngine.CURSOR_OBJECT_ID, RoomEngine.CURSOR_OBJECT_TYPE, RoomObjectCategory.CURSOR);
|
||||
if (Nitro.instance.getConfiguration('enable.avatar.arrow', false)) instance.createRoomObjectAndInitalize(RoomEngine.ARROW_OBJECT_ID, RoomEngine.ARROW_OBJECT_TYPE, RoomObjectCategory.CURSOR);
|
||||
if (NitroConfiguration.getValue('enable.avatar.arrow', false)) instance.createRoomObjectAndInitalize(RoomEngine.ARROW_OBJECT_ID, RoomEngine.ARROW_OBJECT_TYPE, RoomObjectCategory.CURSOR);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { IFurnitureStackingHeightMap, ILegacyWallGeometry, IObjectData, IRoomCanvasMouseListener, IRoomEngineServices, IRoomGeometry, IRoomObject, IRoomObjectController, IRoomObjectEventManager, ISelectedRoomObjectData, IVector3D, RoomObjectCategory, RoomObjectOperationType, RoomObjectPlacementSource, RoomObjectType, RoomObjectUserType, RoomObjectVariable, Vector3d } from '../../api';
|
||||
import { Disposable, NitroLogger } from '../../core';
|
||||
import { IFurnitureStackingHeightMap, ILegacyWallGeometry, IObjectData, IRoomCanvasMouseListener, IRoomEngineServices, IRoomGeometry, IRoomObject, IRoomObjectController, IRoomObjectEventManager, ISelectedRoomObjectData, IVector3D, MouseEventType, NitroConfiguration, NitroLogger, RoomObjectCategory, RoomObjectOperationType, RoomObjectPlacementSource, RoomObjectType, RoomObjectUserType, RoomObjectVariable, Vector3d } from '../../api';
|
||||
import { Disposable } from '../../core';
|
||||
import { RoomEngineDimmerStateEvent, RoomEngineObjectEvent, RoomEngineObjectPlacedEvent, RoomEngineObjectPlacedOnUserEvent, RoomEngineObjectPlaySoundEvent, RoomEngineRoomAdEvent, RoomEngineSamplePlaybackEvent, RoomEngineTriggerWidgetEvent, RoomEngineUseProductEvent, RoomObjectBadgeAssetEvent, RoomObjectDataRequestEvent, RoomObjectDimmerStateUpdateEvent, RoomObjectFloorHoleEvent, RoomObjectFurnitureActionEvent, RoomObjectHSLColorEnabledEvent, RoomObjectHSLColorEnableEvent, RoomObjectMoveEvent, RoomObjectPlaySoundIdEvent, RoomObjectRoomAdEvent, RoomObjectSamplePlaybackEvent, RoomObjectSoundMachineEvent, RoomObjectStateChangedEvent, RoomObjectTileMouseEvent, RoomObjectWallMouseEvent, RoomObjectWidgetRequestEvent } from '../../events';
|
||||
import { RoomEnterEffect, RoomId, RoomObjectEvent, RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../room';
|
||||
import { BotPlaceComposer, FurnitureColorWheelComposer, FurnitureDiceActivateComposer, FurnitureDiceDeactivateComposer, FurnitureFloorUpdateComposer, FurnitureGroupInfoComposer, FurnitureMultiStateComposer, FurnitureOneWayDoorComposer, FurniturePickupComposer, FurniturePlaceComposer, FurniturePostItPlaceComposer, FurnitureRandomStateComposer, FurnitureWallMultiStateComposer, FurnitureWallUpdateComposer, GetItemDataComposer, GetResolutionAchievementsMessageComposer, PetMoveComposer, PetPlaceComposer, RemoveWallItemComposer, RoomUnitLookComposer, RoomUnitWalkComposer, SetItemDataMessageComposer, SetObjectDataMessageComposer } from '../communication';
|
||||
import { Nitro } from '../Nitro';
|
||||
import { MouseEventType } from '../ui';
|
||||
import { ObjectAvatarSelectedMessage, ObjectDataUpdateMessage, ObjectSelectedMessage, ObjectTileCursorUpdateMessage, ObjectVisibilityUpdateMessage } from './messages';
|
||||
import { SelectedRoomObjectData } from './utils';
|
||||
|
||||
@ -1030,7 +1029,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
||||
event.object.model.setValue(RoomObjectVariable.SESSION_CURRENT_USER_ID, this._roomEngine.sessionDataManager.userId);
|
||||
return;
|
||||
case RoomObjectDataRequestEvent.RODRE_URL_PREFIX:
|
||||
event.object.model.setValue(RoomObjectVariable.SESSION_URL_PREFIX, Nitro.instance.getConfiguration('url.prefix'));
|
||||
event.object.model.setValue(RoomObjectVariable.SESSION_URL_PREFIX, NitroConfiguration.getValue('url.prefix'));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IEventDispatcher, IRoomObjectEventHandler, IRoomObjectLogicFactory, RoomObjectLogicType } from '../../api';
|
||||
import { EventDispatcher, NitroLogger } from '../../core';
|
||||
import { IEventDispatcher, IRoomObjectEventHandler, IRoomObjectLogicFactory, NitroLogger, RoomObjectLogicType } from '../../api';
|
||||
import { EventDispatcher } from '../../core';
|
||||
import { RoomObjectLogicBase } from '../../room';
|
||||
import { AvatarLogic, FurnitureAchievementResolutionLogic, FurnitureBadgeDisplayLogic, FurnitureChangeStateWhenStepOnLogic, FurnitureClothingChangeLogic, FurnitureCounterClockLogic, FurnitureCrackableLogic, FurnitureCraftingGizmoLogic, FurnitureCreditLogic, FurnitureCuckooClockLogic, FurnitureCustomStackHeightLogic, FurnitureDiceLogic, FurnitureEcotronBoxLogic, FurnitureEditableInternalLinkLogic, FurnitureEditableRoomLinkLogic, FurnitureEffectBoxLogic, FurnitureExternalImageLogic, FurnitureFireworksLogic, FurnitureFloorHoleLogic, FurnitureGroupForumTerminalLogic, FurnitureGuildCustomizedLogic, FurnitureHabboWheelLogic, FurnitureHighScoreLogic, FurnitureHockeyScoreLogic, FurnitureHweenLovelockLogic, FurnitureIceStormLogic, FurnitureInternalLinkLogic, FurnitureJukeboxLogic, FurnitureLogic, FurnitureLoveLockLogic, FurnitureMannequinLogic, FurnitureMonsterplantSeedLogic, FurnitureMultiHeightLogic, FurnitureMultiStateLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurnitureOneWayDoorLogic, FurniturePetCustomizationLogic, FurniturePlaceholderLogic, FurniturePlanetSystemLogic, FurniturePresentLogic, FurniturePurchaseableClothingLogic, FurniturePushableLogic, FurnitureRandomStateLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic, FurnitureRoomBackgroundColorLogic, FurnitureRoomBackgroundLogic, FurnitureRoomBillboardLogic, FurnitureRoomDimmerLogic, FurnitureScoreLogic, FurnitureSongDiskLogic, FurnitureSoundBlockLogic, FurnitureSoundMachineLogic, FurnitureStickieLogic, FurnitureTrophyLogic, FurnitureVoteCounterLogic, FurnitureVoteMajorityLogic, FurnitureWelcomeGiftLogic, FurnitureWindowLogic, FurnitureYoutubeLogic, PetLogic, RoomLogic, SelectionArrowLogic, TileCursorLogic } from './object';
|
||||
|
||||
@ -24,23 +24,23 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
|
||||
{
|
||||
const logic = this.getLogicType(type);
|
||||
|
||||
if(!logic) return null;
|
||||
if (!logic) return null;
|
||||
|
||||
const instance = (new logic() as IRoomObjectEventHandler);
|
||||
|
||||
if(!instance) return null;
|
||||
if (!instance) return null;
|
||||
|
||||
instance.eventDispatcher = this._events;
|
||||
|
||||
if(!this._cachedEvents.get(type))
|
||||
if (!this._cachedEvents.get(type))
|
||||
{
|
||||
this._cachedEvents.set(type, true);
|
||||
|
||||
const eventTypes = instance.getEventTypes();
|
||||
|
||||
for(const eventType of eventTypes)
|
||||
for (const eventType of eventTypes)
|
||||
{
|
||||
if(!eventType) continue;
|
||||
if (!eventType) continue;
|
||||
|
||||
this.registerEventType(eventType);
|
||||
}
|
||||
@ -51,13 +51,13 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
|
||||
|
||||
private registerEventType(type: string): void
|
||||
{
|
||||
if(this._registeredEvents.get(type)) return;
|
||||
if (this._registeredEvents.get(type)) return;
|
||||
|
||||
this._registeredEvents.set(type, true);
|
||||
|
||||
for(const func of this._functions)
|
||||
for (const func of this._functions)
|
||||
{
|
||||
if(!func) continue;
|
||||
if (!func) continue;
|
||||
|
||||
this._events.addEventListener(type, func);
|
||||
}
|
||||
@ -65,15 +65,15 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
|
||||
|
||||
public registerEventFunction(func: Function): void
|
||||
{
|
||||
if(!func) return;
|
||||
if (!func) return;
|
||||
|
||||
if(this._functions.indexOf(func) >= 0) return;
|
||||
if (this._functions.indexOf(func) >= 0) return;
|
||||
|
||||
this._functions.push(func);
|
||||
|
||||
for(const eventType of this._registeredEvents.keys())
|
||||
for (const eventType of this._registeredEvents.keys())
|
||||
{
|
||||
if(!eventType) continue;
|
||||
if (!eventType) continue;
|
||||
|
||||
this._events.addEventListener(eventType, func);
|
||||
}
|
||||
@ -81,17 +81,17 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
|
||||
|
||||
public removeEventFunction(func: Function): void
|
||||
{
|
||||
if(!func) return;
|
||||
if (!func) return;
|
||||
|
||||
const index = this._functions.indexOf(func);
|
||||
|
||||
if(index === -1) return;
|
||||
if (index === -1) return;
|
||||
|
||||
this._functions.splice(index, 1);
|
||||
|
||||
for(const event of this._registeredEvents.keys())
|
||||
for (const event of this._registeredEvents.keys())
|
||||
{
|
||||
if(!event) continue;
|
||||
if (!event) continue;
|
||||
|
||||
this._events.removeEventListener(event, func);
|
||||
}
|
||||
@ -99,11 +99,11 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
|
||||
|
||||
public getLogicType(type: string): typeof RoomObjectLogicBase
|
||||
{
|
||||
if(!type) return null;
|
||||
if (!type) return null;
|
||||
|
||||
let logic: typeof RoomObjectLogicBase = null;
|
||||
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case RoomObjectLogicType.ROOM:
|
||||
logic = RoomLogic;
|
||||
@ -307,7 +307,7 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
|
||||
break;
|
||||
}
|
||||
|
||||
if(!logic)
|
||||
if (!logic)
|
||||
{
|
||||
NitroLogger.warn('Unknown Logic', type);
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { IAssetData, IObjectVisualizationData, IRoomObjectGraphicVisualization, IRoomObjectVisualizationFactory, RoomObjectVisualizationType } from '../../../api';
|
||||
import { NitroLogger } from '../../../core';
|
||||
import { IAssetData, IObjectVisualizationData, IRoomObjectGraphicVisualization, IRoomObjectVisualizationFactory, NitroLogger, RoomObjectVisualizationType } from '../../../api';
|
||||
import { RoomObjectSpriteVisualization } from '../../../room';
|
||||
import { Nitro } from '../../Nitro';
|
||||
import { AvatarVisualization, AvatarVisualizationData, FurnitureAnimatedVisualization, FurnitureAnimatedVisualizationData, FurnitureBadgeDisplayVisualization, FurnitureBBVisualization, FurnitureBottleVisualization, FurnitureBuilderPlaceholderVisualization, FurnitureCounterClockVisualization, FurnitureCuboidVisualization, FurnitureExternalImageVisualization, FurnitureFireworksVisualization, FurnitureGiftWrappedFireworksVisualization, FurnitureGiftWrappedVisualization, FurnitureGuildCustomizedVisualization, FurnitureGuildIsometricBadgeVisualization, FurnitureHabboWheelVisualization, FurnitureIsometricBBVisualization, FurnitureMannequinVisualization, FurnitureMannequinVisualizationData, FurniturePartyBeamerVisualization, FurniturePlanetSystemVisualization, FurniturePosterVisualization, FurnitureQueueTileVisualization, FurnitureResettingAnimatedVisualization, FurnitureRoomBackgroundVisualization, FurnitureScoreBoardVisualization, FurnitureSoundBlockVisualization, FurnitureStickieVisualization, FurnitureValRandomizerVisualization, FurnitureVisualization, FurnitureVisualizationData, FurnitureVoteCounterVisualization, FurnitureVoteMajorityVisualization, FurnitureWaterAreaVisualization, FurnitureYoutubeVisualization, PetVisualization, PetVisualizationData, RoomVisualization, RoomVisualizationData, TileCursorVisualization } from './visualization';
|
||||
@ -19,18 +18,18 @@ export class RoomObjectVisualizationFactory implements IRoomObjectVisualizationF
|
||||
{
|
||||
const visualization = this.getVisualizationType(type);
|
||||
|
||||
if(!visualization) return null;
|
||||
if (!visualization) return null;
|
||||
|
||||
return new visualization();
|
||||
}
|
||||
|
||||
public getVisualizationType(type: string): typeof RoomObjectSpriteVisualization
|
||||
{
|
||||
if(!type) return null;
|
||||
if (!type) return null;
|
||||
|
||||
let visualization: typeof RoomObjectSpriteVisualization = null;
|
||||
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case RoomObjectVisualizationType.ROOM:
|
||||
visualization = RoomVisualization;
|
||||
@ -141,7 +140,7 @@ export class RoomObjectVisualizationFactory implements IRoomObjectVisualizationF
|
||||
break;
|
||||
}
|
||||
|
||||
if(!visualization)
|
||||
if (!visualization)
|
||||
{
|
||||
NitroLogger.log('Unknown Visualization', type);
|
||||
|
||||
@ -155,11 +154,11 @@ export class RoomObjectVisualizationFactory implements IRoomObjectVisualizationF
|
||||
{
|
||||
const existing = this._visualizationDatas.get(type);
|
||||
|
||||
if(existing) return existing;
|
||||
if (existing) return existing;
|
||||
|
||||
let visualizationData: IObjectVisualizationData = null;
|
||||
|
||||
switch(visualization)
|
||||
switch (visualization)
|
||||
{
|
||||
case RoomObjectVisualizationType.FURNITURE_STATIC:
|
||||
case RoomObjectVisualizationType.FURNITURE_GIFT_WRAPPED:
|
||||
@ -211,21 +210,21 @@ export class RoomObjectVisualizationFactory implements IRoomObjectVisualizationF
|
||||
break;
|
||||
}
|
||||
|
||||
if(!visualizationData) return null;
|
||||
if (!visualizationData) return null;
|
||||
|
||||
if(!visualizationData.initialize(asset))
|
||||
if (!visualizationData.initialize(asset))
|
||||
{
|
||||
visualizationData.dispose();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
if((visualizationData instanceof AvatarVisualizationData) || (visualizationData instanceof FurnitureMannequinVisualizationData))
|
||||
if ((visualizationData instanceof AvatarVisualizationData) || (visualizationData instanceof FurnitureMannequinVisualizationData))
|
||||
{
|
||||
visualizationData.avatarManager = Nitro.instance.avatar;
|
||||
}
|
||||
|
||||
if(RoomObjectVisualizationFactory.CACHING_ENABLED) this._visualizationDatas.set(type, visualizationData);
|
||||
if (RoomObjectVisualizationFactory.CACHING_ENABLED) this._visualizationDatas.set(type, visualizationData);
|
||||
|
||||
return visualizationData;
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
|
||||
import { AvatarAction, IRoomGeometry, IRoomObjectModel, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { AvatarAction, IRoomGeometry, IRoomObjectModel, MouseEventType, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { RoomObjectFurnitureActionEvent, RoomObjectMoveEvent } from '../../../../../events';
|
||||
import { GetTickerTime } from '../../../../../pixi-proxy';
|
||||
import { RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, ObjectAvatarDanceUpdateMessage, ObjectAvatarEffectUpdateMessage, ObjectAvatarExpressionUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarFlatControlUpdateMessage, ObjectAvatarGestureUpdateMessage, ObjectAvatarMutedUpdateMessage, ObjectAvatarOwnMessage, ObjectAvatarPlayerValueUpdateMessage, ObjectAvatarPlayingGameUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSelectedMessage, ObjectAvatarSignUpdateMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarTypingUpdateMessage, ObjectAvatarUpdateMessage, ObjectAvatarUseObjectUpdateMessage } from '../../../messages';
|
||||
import { MovingObjectLogic } from '../MovingObjectLogic';
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IRoomGeometry } from '../../../../../api';
|
||||
import { IRoomGeometry, MouseEventType } from '../../../../../api';
|
||||
import { RoomObjectStateChangedEvent } from '../../../../../events';
|
||||
import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureCounterClockLogic extends FurnitureLogic
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureCrackableLogic extends FurnitureLogic
|
||||
@ -9,9 +8,9 @@ export class FurnitureCrackableLogic extends FurnitureLogic
|
||||
{
|
||||
super.processUpdateMessage(message);
|
||||
|
||||
if(!this.object) return;
|
||||
if (!this.object) return;
|
||||
|
||||
if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1)
|
||||
if (this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1)
|
||||
{
|
||||
this.object.model.setValue(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.CRACKABLE_FURNI);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { RoomWidgetEnum } from '../../../../ui';
|
||||
import { RoomWidgetEnum } from '../../../../../api';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureCraftingGizmoLogic extends FurnitureLogic
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IRoomGeometry } from '../../../../../api';
|
||||
import { IRoomGeometry, MouseEventType } from '../../../../../api';
|
||||
import { RoomObjectFurnitureActionEvent } from '../../../../../events';
|
||||
import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureDiceLogic extends FurnitureLogic
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IAssetData, IRoomGeometry, RoomObjectVariable } from '../../../../../api';
|
||||
import { IAssetData, IRoomGeometry, MouseEventType, RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureEditableInternalLinkLogic extends FurnitureLogic
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ContextMenuEnum } from '../../../../../api';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { ContextMenuEnum } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureEffectBoxLogic extends FurnitureLogic
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IAssetData, IParticleSystem, IRoomGeometry, RoomObjectVariable } from '../../../../../api';
|
||||
import { IAssetData, IParticleSystem, IRoomGeometry, MouseEventType, RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectStateChangedEvent } from '../../../../../events';
|
||||
import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureFireworksLogic extends FurnitureLogic
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IAssetData, RoomObjectVariable, StringDataType } from '../../../../../api';
|
||||
import { ContextMenuEnum, IAssetData, RoomObjectVariable, StringDataType } from '../../../../../api';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { ContextMenuEnum } from '../../../../ui';
|
||||
import { ObjectDataUpdateMessage } from '../../../messages';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { IRoomGeometry, RoomObjectVariable, StringDataType } from '../../../../../api';
|
||||
import { IRoomGeometry, MouseEventType, RoomObjectVariable, StringDataType } from '../../../../../api';
|
||||
import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { GetTickerTime } from '../../../../../pixi-proxy';
|
||||
import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { ObjectDataUpdateMessage, ObjectGroupBadgeUpdateMessage, ObjectSelectedMessage } from '../../../messages';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IRoomGeometry } from '../../../../../api';
|
||||
import { IRoomGeometry, MouseEventType } from '../../../../../api';
|
||||
import { RoomObjectStateChangedEvent } from '../../../../../events';
|
||||
import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureHockeyScoreLogic extends FurnitureLogic
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IAssetData, IRoomGeometry, RoomObjectVariable } from '../../../../../api';
|
||||
import { IAssetData, IRoomGeometry, MouseEventType, RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureInternalLinkLogic extends FurnitureLogic
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api';
|
||||
import { RoomObjectFurnitureActionEvent, RoomObjectStateChangedEvent, RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui';
|
||||
import { ObjectDataUpdateMessage } from '../../../messages';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { IAssetData, IRoomGeometry, IRoomObjectController, IRoomObjectModel, IVector3D, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { IAssetData, IRoomGeometry, IRoomObjectController, IRoomObjectModel, IVector3D, MouseEventType, NitroConfiguration, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { RoomObjectRoomAdEvent, RoomObjectStateChangedEvent, RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { Nitro } from '../../../../Nitro';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { ObjectDataUpdateMessage, ObjectHeightUpdateMessage, ObjectItemDataUpdateMessage, ObjectMoveUpdateMessage, ObjectSelectedMessage } from '../../../messages';
|
||||
import { MovingObjectLogic } from '../MovingObjectLogic';
|
||||
|
||||
@ -49,12 +47,12 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
|
||||
if (FurnitureLogic.BOUNCING_STEPS === -1)
|
||||
{
|
||||
FurnitureLogic.BOUNCING_STEPS = Nitro.instance.getConfiguration<number>('furni.rotation.bounce.steps', 8);
|
||||
FurnitureLogic.BOUNCING_STEPS = NitroConfiguration.getValue<number>('furni.rotation.bounce.steps', 8);
|
||||
}
|
||||
|
||||
if (FurnitureLogic.BOUNCING_Z === -1)
|
||||
{
|
||||
FurnitureLogic.BOUNCING_Z = Nitro.instance.getConfiguration<number>('furni.rotation.bounce.height', 0.0625);
|
||||
FurnitureLogic.BOUNCING_Z = NitroConfiguration.getValue<number>('furni.rotation.bounce.height', 0.0625);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ContextMenuEnum } from '../../../../../api';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { ContextMenuEnum } from '../../../../ui';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
export class FurnitureMonsterplantSeedLogic extends FurnitureMultiStateLogic
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IRoomGeometry } from '../../../../../api';
|
||||
import { IRoomGeometry, MouseEventType } from '../../../../../api';
|
||||
import { RoomObjectFurnitureActionEvent } from '../../../../../events';
|
||||
import { RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureMultiStateLogic extends FurnitureLogic
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ContextMenuEnum } from '../../../../../api';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { ContextMenuEnum } from '../../../../ui';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
export class FurnitureMysteryBoxLogic extends FurnitureMultiStateLogic
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ContextMenuEnum } from '../../../../../api';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { ContextMenuEnum } from '../../../../ui';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
export class FurnitureMysteryTrophyLogic extends FurnitureMultiStateLogic
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurniturePetCustomizationLogic extends FurnitureLogic
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IAssetData, IParticleSystem, IRoomGeometry, MapDataType, RoomObjectVariable } from '../../../../../api';
|
||||
import { IAssetData, IParticleSystem, IRoomGeometry, MapDataType, MouseEventType, RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectFurnitureActionEvent, RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { ObjectDataUpdateMessage, ObjectModelDataUpdateMessage } from '../../../messages';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { ContextMenuEnum } from '../../../../../api';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { ContextMenuEnum } from '../../../../ui';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
export class FurniturePurchaseableClothingLogic extends FurnitureMultiStateLogic
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { ContextMenuEnum } from '../../../../ui';
|
||||
import { ContextMenuEnum } from '../../../../../api';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
export class FurnitureRandomTeleportLogic extends FurnitureMultiStateLogic
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectVariable, RoomWidgetEnum } from '../../../../../api';
|
||||
import { AdvancedMap } from '../../../../../core';
|
||||
import { RoomObjectDataRequestEvent } from '../../../../../events';
|
||||
import { RoomWidgetEnum } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureRentableSpaceLogic extends FurnitureLogic
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IRoomGeometry, NumberDataType, RoomObjectVariable } from '../../../../../api';
|
||||
import { IRoomGeometry, MouseEventType, NumberDataType, RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectHSLColorEnableEvent, RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { ObjectDataUpdateMessage } from '../../../messages';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
|
@ -1,10 +1,9 @@
|
||||
import { BaseTexture, Texture } from '@pixi/core';
|
||||
import { decompressFrames, parseGIF } from 'gifuct-js';
|
||||
import { IAssetData, IRoomGeometry, MapDataType, RoomObjectVariable } from '../../../../../api';
|
||||
import { IAssetData, IRoomGeometry, MapDataType, MouseEventType, RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api';
|
||||
import { RoomObjectRoomAdEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { Nitro } from '../../../../Nitro';
|
||||
import { MouseEventType, RoomWidgetEnumItemExtradataParameter } from '../../../../ui';
|
||||
import { ObjectAdUpdateMessage, ObjectDataUpdateMessage } from '../../../messages';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureSongDiskLogic extends FurnitureLogic
|
||||
@ -9,7 +8,7 @@ export class FurnitureSongDiskLogic extends FurnitureLogic
|
||||
{
|
||||
super.processUpdateMessage(message);
|
||||
|
||||
if(this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1)
|
||||
if (this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1)
|
||||
{
|
||||
const extras = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_EXTRAS);
|
||||
const diskId = parseInt(extras);
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api';
|
||||
import { RoomObjectFurnitureActionEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui';
|
||||
import { ObjectDataUpdateMessage } from '../../../messages';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IRoomGeometry } from '../../../../../api';
|
||||
import { IRoomGeometry, MouseEventType } from '../../../../../api';
|
||||
import { RoomObjectStateChangedEvent } from '../../../../../events';
|
||||
import { RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
export class FurnitureWelcomeGiftLogic extends FurnitureMultiStateLogic
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { IAssetData, IRoomGeometry, IRoomObjectModel, PetType, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { IAssetData, IRoomGeometry, IRoomObjectModel, MouseEventType, PetType, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { RoomObjectMoveEvent } from '../../../../../events';
|
||||
import { RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { PetFigureData } from '../../../../avatar';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { ObjectAvatarChatUpdateMessage, ObjectAvatarExperienceUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarPetGestureUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSelectedMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarUpdateMessage } from '../../../messages';
|
||||
import { MovingObjectLogic } from '../MovingObjectLogic';
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
import { Point } from '@pixi/math';
|
||||
import { IRoomGeometry, IRoomObjectModel, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { IRoomGeometry, IRoomObjectModel, MouseEventType, NitroConfiguration, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { RoomObjectTileMouseEvent, RoomObjectWallMouseEvent } from '../../../../../events';
|
||||
import { ColorConverter, RoomObjectEvent, RoomObjectLogicBase, RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { Nitro } from '../../../../Nitro';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { ObjectRoomColorUpdateMessage, ObjectRoomFloorHoleUpdateMessage, ObjectRoomMapUpdateMessage, ObjectRoomMaskUpdateMessage, ObjectRoomPlanePropertyUpdateMessage, ObjectRoomPlaneVisibilityUpdateMessage, ObjectRoomUpdateMessage } from '../../../messages';
|
||||
import { RoomMapData } from '../../RoomMapData';
|
||||
import { RoomPlaneBitmapMaskData } from '../../RoomPlaneBitmapMaskData';
|
||||
@ -86,7 +84,7 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_WALL_VISIBILITY, 1);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_LANDSCAPE_VISIBILITY, 1);
|
||||
|
||||
this._skipColorTransition = (Nitro.instance.getConfiguration<boolean>('room.color.skip.transition') === true);
|
||||
this._skipColorTransition = (NitroConfiguration.getValue<boolean>('room.color.skip.transition') === true);
|
||||
}
|
||||
|
||||
public update(time: number): void
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IAdvancedMap, IParticleSystem, RoomObjectVariable } from '../../../../../api';
|
||||
import { AdvancedMap, NitroLogger } from '../../../../../core';
|
||||
import { IAdvancedMap, IParticleSystem, NitroLogger, RoomObjectVariable } from '../../../../../api';
|
||||
import { AdvancedMap } from '../../../../../core';
|
||||
import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization';
|
||||
import { FurnitureParticleSystem } from './FurnitureParticleSystem';
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { Graphics } from '@pixi/graphics';
|
||||
import { IVector3D } from '../../../../../../../api';
|
||||
import { Nitro } from '../../../../../../Nitro';
|
||||
import { IVector3D, NitroConfiguration } from '../../../../../../../api';
|
||||
import { PlaneBitmapData, Randomizer } from '../../utils';
|
||||
import { PlaneMaterial, PlaneRasterizer, PlaneVisualizationLayer } from '../basic';
|
||||
import { LandscapePlane } from './LandscapePlane';
|
||||
@ -14,9 +13,9 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
||||
|
||||
public initializeDimensions(k: number, _arg_2: number): boolean
|
||||
{
|
||||
if(k < 0) k = 0;
|
||||
if (k < 0) k = 0;
|
||||
|
||||
if(_arg_2 < 0) _arg_2 = 0;
|
||||
if (_arg_2 < 0) _arg_2 = 0;
|
||||
|
||||
this._landscapeWidth = k;
|
||||
this._landscapeHeight = _arg_2;
|
||||
@ -26,41 +25,41 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
||||
|
||||
protected initializePlanes(): void
|
||||
{
|
||||
if(!this.data) return;
|
||||
if (!this.data) return;
|
||||
|
||||
const landscapes = this.data.landscapes;
|
||||
|
||||
if(landscapes && landscapes.length) this.parseLandscapes(landscapes);
|
||||
if (landscapes && landscapes.length) this.parseLandscapes(landscapes);
|
||||
}
|
||||
|
||||
private parseLandscapes(k: any): void
|
||||
{
|
||||
if(!k) return;
|
||||
if (!k) return;
|
||||
|
||||
const randomNumber = Math.trunc((Math.random() * 654321));
|
||||
|
||||
for(const landscapeIndex in k)
|
||||
for (const landscapeIndex in k)
|
||||
{
|
||||
const landscape = k[landscapeIndex];
|
||||
|
||||
if(!landscape) continue;
|
||||
if (!landscape) continue;
|
||||
|
||||
const id = landscape.id;
|
||||
const visualizations = landscape.animatedVisualizations;
|
||||
|
||||
const plane = new LandscapePlane();
|
||||
|
||||
for(const visualization of visualizations)
|
||||
for (const visualization of visualizations)
|
||||
{
|
||||
if(!visualization) continue;
|
||||
if (!visualization) continue;
|
||||
|
||||
const size = visualization.size;
|
||||
|
||||
let horizontalAngle = LandscapePlane.HORIZONTAL_ANGLE_DEFAULT;
|
||||
let verticalAngle = LandscapePlane.VERTICAL_ANGLE_DEFAULT;
|
||||
|
||||
if(visualization.horizontalAngle) horizontalAngle = visualization.horizontalAngle;
|
||||
if(visualization.verticalAngle) verticalAngle = visualization.verticalAngle;
|
||||
if (visualization.horizontalAngle) horizontalAngle = visualization.horizontalAngle;
|
||||
if (visualization.verticalAngle) verticalAngle = visualization.verticalAngle;
|
||||
|
||||
const basicLayers = visualization.layers;
|
||||
const animatedLayers = visualization.animationLayers;
|
||||
@ -70,39 +69,39 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
||||
|
||||
const planeVisualization = plane.createPlaneVisualization(size, (totalLayers || 0), this.getGeometry(size, horizontalAngle, verticalAngle));
|
||||
|
||||
if(planeVisualization)
|
||||
if (planeVisualization)
|
||||
{
|
||||
Randomizer.setSeed(randomNumber);
|
||||
|
||||
let layerId = 0;
|
||||
|
||||
if(totalBasicLayers)
|
||||
if (totalBasicLayers)
|
||||
{
|
||||
while(layerId < basicLayers.length)
|
||||
while (layerId < basicLayers.length)
|
||||
{
|
||||
const layer = basicLayers[layerId];
|
||||
|
||||
if(layer)
|
||||
if (layer)
|
||||
{
|
||||
let material: PlaneMaterial = null;
|
||||
let align: number = PlaneVisualizationLayer.ALIGN_DEFAULT;
|
||||
let color: number = LandscapePlane.DEFAULT_COLOR;
|
||||
let offset: number = PlaneVisualizationLayer.DEFAULT_OFFSET;
|
||||
|
||||
if(layer.materialId) material = this.getMaterial(layer.materialId);
|
||||
if (layer.materialId) material = this.getMaterial(layer.materialId);
|
||||
|
||||
if(layer.color) color = layer.color;
|
||||
if (layer.color) color = layer.color;
|
||||
|
||||
if(layer.offset) offset = layer.offset;
|
||||
if (layer.offset) offset = layer.offset;
|
||||
|
||||
if(layer.align)
|
||||
if (layer.align)
|
||||
{
|
||||
if(layer.align === 'bottom')
|
||||
if (layer.align === 'bottom')
|
||||
{
|
||||
align = PlaneVisualizationLayer.ALIGN_BOTTOM;
|
||||
}
|
||||
|
||||
else if(layer.align === 'top') align = PlaneVisualizationLayer.ALIGN_TOP;
|
||||
else if (layer.align === 'top') align = PlaneVisualizationLayer.ALIGN_TOP;
|
||||
}
|
||||
|
||||
planeVisualization.setLayer(layerId, material, color, align, offset);
|
||||
@ -114,30 +113,30 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
||||
|
||||
layerId = 0;
|
||||
|
||||
if(totalAnimatedLayers)
|
||||
if (totalAnimatedLayers)
|
||||
{
|
||||
const animationItems: {}[] = [];
|
||||
|
||||
while(layerId < animatedLayers.length)
|
||||
while (layerId < animatedLayers.length)
|
||||
{
|
||||
const layer = animatedLayers[layerId];
|
||||
|
||||
if(layer)
|
||||
if (layer)
|
||||
{
|
||||
const items = layer.animationItems;
|
||||
|
||||
if(items && items.length)
|
||||
if (items && items.length)
|
||||
{
|
||||
for(const item of items)
|
||||
for (const item of items)
|
||||
{
|
||||
if(item)
|
||||
if (item)
|
||||
{
|
||||
const id = item.id;
|
||||
const assetId = item.assetId;
|
||||
const x = this.getCoordinateValue(item.x || '', item.randomX || '');
|
||||
const y = this.getCoordinateValue(item.y || '', item.randomY || '');
|
||||
const speedX = item.speedX ? item.speedX / Nitro.instance.getConfiguration<number>('system.animation.fps') : 0;
|
||||
const speedY = item.speedY ? item.speedY / Nitro.instance.getConfiguration<number>('system.animation.fps') : 0;
|
||||
const speedX = item.speedX ? item.speedX / NitroConfiguration.getValue<number>('system.animation.fps') : 0;
|
||||
const speedY = item.speedY ? item.speedY / NitroConfiguration.getValue<number>('system.animation.fps') : 0;
|
||||
|
||||
animationItems.push({
|
||||
asset: assetId,
|
||||
@ -159,7 +158,7 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
||||
}
|
||||
}
|
||||
|
||||
if(!this.addPlane(id, plane)) plane.dispose();
|
||||
if (!this.addPlane(id, plane)) plane.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,9 +166,9 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
||||
{
|
||||
let _local_3 = 0;
|
||||
|
||||
if((k.length > 0))
|
||||
if ((k.length > 0))
|
||||
{
|
||||
if(k.charAt((k.length - 1)) === '%')
|
||||
if (k.charAt((k.length - 1)) === '%')
|
||||
{
|
||||
k = k.substr(0, (k.length - 1));
|
||||
|
||||
@ -177,13 +176,13 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
||||
}
|
||||
}
|
||||
|
||||
if((_arg_2.length > 0))
|
||||
if ((_arg_2.length > 0))
|
||||
{
|
||||
const _local_4 = 10000;
|
||||
const _local_5 = Randomizer.getValues(1, 0, _local_4);
|
||||
const _local_6 = (_local_5[0] / _local_4);
|
||||
|
||||
if(_arg_2.charAt((_arg_2.length - 1)) === '%')
|
||||
if (_arg_2.charAt((_arg_2.length - 1)) === '%')
|
||||
{
|
||||
_arg_2 = _arg_2.substr(0, (_arg_2.length - 1));
|
||||
|
||||
@ -198,27 +197,27 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
||||
{
|
||||
let plane = this.getPlane(id) as LandscapePlane;
|
||||
|
||||
if(!plane) plane = this.getPlane(LandscapeRasterizer.DEFAULT) as LandscapePlane;
|
||||
if (!plane) plane = this.getPlane(LandscapeRasterizer.DEFAULT) as LandscapePlane;
|
||||
|
||||
if(!plane) return null;
|
||||
if (!plane) return null;
|
||||
|
||||
if(canvas)
|
||||
if (canvas)
|
||||
{
|
||||
canvas.clear();
|
||||
}
|
||||
|
||||
let graphic = plane.render(canvas, width, height, scale, normal, useTexture, offsetX, offsetY, maxX, maxY, timeSinceStartMs);
|
||||
|
||||
if(graphic && (graphic !== canvas))
|
||||
if (graphic && (graphic !== canvas))
|
||||
{
|
||||
graphic = graphic.clone();
|
||||
|
||||
if(!graphic) return null;
|
||||
if (!graphic) return null;
|
||||
}
|
||||
|
||||
let planeBitmapData: PlaneBitmapData = null;
|
||||
|
||||
if(!plane.isStatic(scale) && (LandscapeRasterizer.UPDATE_INTERVAL > 0))
|
||||
if (!plane.isStatic(scale) && (LandscapeRasterizer.UPDATE_INTERVAL > 0))
|
||||
{
|
||||
planeBitmapData = new PlaneBitmapData(graphic, ((Math.round((timeSinceStartMs / LandscapeRasterizer.UPDATE_INTERVAL)) * LandscapeRasterizer.UPDATE_INTERVAL) + LandscapeRasterizer.UPDATE_INTERVAL));
|
||||
}
|
||||
@ -232,9 +231,9 @@ export class LandscapeRasterizer extends PlaneRasterizer
|
||||
|
||||
public getTextureIdentifier(k: number, _arg_2: IVector3D): string
|
||||
{
|
||||
if(_arg_2)
|
||||
if (_arg_2)
|
||||
{
|
||||
if(_arg_2.x < 0) return (k + '_0');
|
||||
if (_arg_2.x < 0) return (k + '_0');
|
||||
|
||||
return (k + '_1');
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { IRoomObject, ITileObjectMap, RoomObjectVariable } from '../../../api';
|
||||
import { NitroLogger } from '../../../core';
|
||||
import { IRoomObject, ITileObjectMap, NitroLogger, RoomObjectVariable } from '../../../api';
|
||||
|
||||
export class TileObjectMap implements ITileObjectMap
|
||||
{
|
||||
@ -13,7 +12,7 @@ export class TileObjectMap implements ITileObjectMap
|
||||
|
||||
let index = 0;
|
||||
|
||||
while(index < _arg_2)
|
||||
while (index < _arg_2)
|
||||
{
|
||||
this._tileObjectMap.set(index, new Map());
|
||||
|
||||
@ -26,9 +25,9 @@ export class TileObjectMap implements ITileObjectMap
|
||||
|
||||
public clear(): void
|
||||
{
|
||||
for(const k of this._tileObjectMap.values())
|
||||
for (const k of this._tileObjectMap.values())
|
||||
{
|
||||
if(!k) continue;
|
||||
if (!k) continue;
|
||||
|
||||
k.clear();
|
||||
}
|
||||
@ -40,7 +39,7 @@ export class TileObjectMap implements ITileObjectMap
|
||||
{
|
||||
this.clear();
|
||||
|
||||
for(const _local_2 of k) this.addRoomObject(_local_2);
|
||||
for (const _local_2 of k) this.addRoomObject(_local_2);
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
@ -52,11 +51,11 @@ export class TileObjectMap implements ITileObjectMap
|
||||
|
||||
public getObjectIntTile(k: number, _arg_2: number): IRoomObject
|
||||
{
|
||||
if((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height))
|
||||
if ((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height))
|
||||
{
|
||||
const existing = this._tileObjectMap.get(_arg_2);
|
||||
|
||||
if(existing) return existing.get(k);
|
||||
if (existing) return existing.get(k);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -64,51 +63,51 @@ export class TileObjectMap implements ITileObjectMap
|
||||
|
||||
public setObjectInTile(k: number, _arg_2: number, _arg_3: IRoomObject): void
|
||||
{
|
||||
if(!_arg_3.isReady)
|
||||
if (!_arg_3.isReady)
|
||||
{
|
||||
NitroLogger.log('Assigning non initialized object to tile object map!');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height))
|
||||
if ((((k >= 0) && (k < this._width)) && (_arg_2 >= 0)) && (_arg_2 < this._height))
|
||||
{
|
||||
const existing = this._tileObjectMap.get(_arg_2);
|
||||
|
||||
if(existing) existing.set(k, _arg_3);
|
||||
if (existing) existing.set(k, _arg_3);
|
||||
}
|
||||
}
|
||||
|
||||
public addRoomObject(k: IRoomObject): void
|
||||
{
|
||||
if(!k || !k.model || !k.isReady) return;
|
||||
if (!k || !k.model || !k.isReady) return;
|
||||
|
||||
const location = k.getLocation();
|
||||
const direction = k.getDirection();
|
||||
|
||||
if(!location || !direction) return;
|
||||
if (!location || !direction) return;
|
||||
|
||||
let sizeX = k.model.getValue<number>(RoomObjectVariable.FURNITURE_SIZE_X);
|
||||
let sizeY = k.model.getValue<number>(RoomObjectVariable.FURNITURE_SIZE_Y);
|
||||
|
||||
if(sizeX < 1) sizeX = 1;
|
||||
if(sizeY < 1) sizeY = 1;
|
||||
if (sizeX < 1) sizeX = 1;
|
||||
if (sizeY < 1) sizeY = 1;
|
||||
|
||||
const directionNumber = ((Math.trunc((direction.x + 45)) % 360) / 90);
|
||||
|
||||
if((directionNumber === 1) || (directionNumber === 3)) [sizeX, sizeY] = [sizeY, sizeX];
|
||||
if ((directionNumber === 1) || (directionNumber === 3)) [sizeX, sizeY] = [sizeY, sizeX];
|
||||
|
||||
let y = location.y;
|
||||
|
||||
while(y < (location.y + sizeY))
|
||||
while (y < (location.y + sizeY))
|
||||
{
|
||||
let x = location.x;
|
||||
|
||||
while(x < (location.x + sizeX))
|
||||
while (x < (location.x + sizeX))
|
||||
{
|
||||
const roomObject = this.getObjectIntTile(x, y);
|
||||
|
||||
if((!(roomObject)) || ((!(roomObject === k)) && (roomObject.getLocation().z <= location.z)))
|
||||
if ((!(roomObject)) || ((!(roomObject === k)) && (roomObject.getLocation().z <= location.z)))
|
||||
{
|
||||
this.setObjectInTile(x, y, k);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Resource, Texture } from '@pixi/core';
|
||||
import { IFurnitureData, IFurnitureDataListener, IGroupInformationManager, IMessageComposer, INitroCommunicationManager, INitroEvent, IProductData, IProductDataListener, ISessionDataManager, NoobnessLevelEnum, SecurityLevel } from '../../api';
|
||||
import { 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';
|
||||
@ -157,7 +157,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
|
||||
|
||||
this._furnitureData.addEventListener(FurnitureDataLoader.FURNITURE_DATA_READY, this.onFurnitureDataReadyEvent);
|
||||
|
||||
this._furnitureData.loadFurnitureData(Nitro.instance.getConfiguration<string>('furnidata.url'));
|
||||
this._furnitureData.loadFurnitureData(NitroConfiguration.getValue<string>('furnidata.url'));
|
||||
}
|
||||
|
||||
private loadProductData(): void
|
||||
@ -168,7 +168,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
|
||||
|
||||
this._productData.addEventListener(ProductDataLoader.PDP_PRODUCT_DATA_READY, this.onProductDataReadyEvent);
|
||||
|
||||
this._productData.loadProductData(Nitro.instance.getConfiguration<string>('productdata.url'));
|
||||
this._productData.loadProductData(NitroConfiguration.getValue<string>('productdata.url'));
|
||||
}
|
||||
|
||||
private loadBadgeImageManager(): void
|
||||
@ -382,7 +382,7 @@ export class SessionDataManager extends NitroManager implements ISessionDataMana
|
||||
|
||||
if (this._noobnessLevel !== NoobnessLevelEnum.OLD_IDENTITY)
|
||||
{
|
||||
Nitro.instance.core.configuration.setValue<number>('new.identity', 1);
|
||||
NitroConfiguration.setValue<number>('new.identity', 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,8 @@
|
||||
import { Resource, Texture } from '@pixi/core';
|
||||
import { IAssetManager, IDisposable, IMessageEvent } from '../../../api';
|
||||
import { IAssetManager, IDisposable, IMessageEvent, NitroConfiguration } from '../../../api';
|
||||
import { BadgeImageReadyEvent } from '../../../events';
|
||||
import { NitroContainer, NitroSprite, NitroTexture, TextureUtils } from '../../../pixi-proxy';
|
||||
import { GroupBadgePartsEvent } from '../../communication';
|
||||
import { Nitro } from '../../Nitro';
|
||||
import { SessionDataManager } from './../SessionDataManager';
|
||||
import { BadgeInfo } from './BadgeInfo';
|
||||
import { GroupBadge } from './GroupBadge';
|
||||
@ -134,7 +133,7 @@ export class BadgeImageManager implements IDisposable
|
||||
|
||||
private getBadgePlaceholder(): Texture<Resource>
|
||||
{
|
||||
const url = (Nitro.instance.getConfiguration<string>('images.url') + '/loading_icon.png');
|
||||
const url = (NitroConfiguration.getValue<string>('images.url') + '/loading_icon.png');
|
||||
const existing = this._assets.getTexture(url);
|
||||
|
||||
if (!existing) return null;
|
||||
@ -149,7 +148,7 @@ export class BadgeImageManager implements IDisposable
|
||||
switch (type)
|
||||
{
|
||||
case BadgeImageManager.NORMAL_BADGE:
|
||||
url = (Nitro.instance.getConfiguration<string>('badge.asset.url')).replace('%badgename%', badge);
|
||||
url = (NitroConfiguration.getValue<string>('badge.asset.url')).replace('%badgename%', badge);
|
||||
break;
|
||||
case BadgeImageManager.GROUP_BADGE:
|
||||
url = badge;
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { FurnitureType, IFurnitureData, INitroLocalizationManager } from '../../../api';
|
||||
import { EventDispatcher, NitroLogger } from '../../../core';
|
||||
import { FurnitureType, IFurnitureData, INitroLocalizationManager, NitroLogger } from '../../../api';
|
||||
import { EventDispatcher } from '../../../core';
|
||||
import { NitroEvent } from '../../../events';
|
||||
import { FurnitureData } from './FurnitureData';
|
||||
|
||||
@ -11,7 +11,6 @@ export class FurnitureDataLoader extends EventDispatcher
|
||||
private _floorItems: Map<number, IFurnitureData>;
|
||||
private _wallItems: Map<number, IFurnitureData>;
|
||||
private _localization: INitroLocalizationManager;
|
||||
private _nitroLogger: NitroLogger;
|
||||
|
||||
constructor(floorItems: Map<number, IFurnitureData>, wallItems: Map<number, IFurnitureData>, localization: INitroLocalizationManager)
|
||||
{
|
||||
@ -20,7 +19,6 @@ export class FurnitureDataLoader extends EventDispatcher
|
||||
this._floorItems = floorItems;
|
||||
this._wallItems = wallItems;
|
||||
this._localization = localization;
|
||||
this._nitroLogger = new NitroLogger(this.constructor.name);
|
||||
}
|
||||
|
||||
public loadFurnitureData(url: string): void
|
||||
@ -37,7 +35,7 @@ export class FurnitureDataLoader extends EventDispatcher
|
||||
{
|
||||
if (!data) return;
|
||||
|
||||
if ((typeof data.roomitemtypes == 'undefined') || (typeof data.wallitemtypes == 'undefined')) this._nitroLogger.warn('Could not find `roomitemtypes` or `wallitemtypes` in furnidata.');
|
||||
if ((typeof data.roomitemtypes == 'undefined') || (typeof data.wallitemtypes == 'undefined')) NitroLogger.warn('Could not find `roomitemtypes` or `wallitemtypes` in furnidata.');
|
||||
|
||||
if (data.roomitemtypes) this.parseFloorItems(data.roomitemtypes);
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IConnection, IRoomHandlerListener } from '../../../api';
|
||||
import { IConnection, IRoomHandlerListener, SystemChatStyleEnum } from '../../../api';
|
||||
import { RoomSessionChatEvent } from '../../../events';
|
||||
import { FloodControlEvent, PetRespectNoficationEvent, PetSupplementedNotificationEvent, PetSupplementTypeEnum, RemainingMuteEvent, RespectReceivedEvent, RoomUnitChatEvent, RoomUnitChatShoutEvent, RoomUnitChatWhisperEvent, RoomUnitHandItemReceivedEvent } from '../../communication';
|
||||
import { SystemChatStyleEnum } from '../../ui/widget/enums/SystemChatStyleEnum';
|
||||
import { BaseHandler } from './BaseHandler';
|
||||
|
||||
export class RoomChatHandler extends BaseHandler
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { IAdvancedMap, IMusicManager, INitroEvent, ISoundManager } from '../../api';
|
||||
import { IAdvancedMap, IMusicManager, INitroEvent, ISoundManager, NitroConfiguration } from '../../api';
|
||||
import { AdvancedMap, NitroManager } from '../../core';
|
||||
import { NitroSettingsEvent, NitroSoundEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomEngineSamplePlaybackEvent } from '../../events';
|
||||
import { Nitro } from '../Nitro';
|
||||
@ -124,7 +124,7 @@ export class SoundManager extends NitroManager implements ISoundManager
|
||||
|
||||
if (!sample)
|
||||
{
|
||||
const sampleUrl = Nitro.instance.getConfiguration<string>('sounds.url');
|
||||
const sampleUrl = NitroConfiguration.getValue<string>('sounds.url');
|
||||
|
||||
sample = new Audio(sampleUrl.replace('%sample%', code));
|
||||
this._internalSamples.add(code, sample);
|
||||
@ -139,7 +139,7 @@ export class SoundManager extends NitroManager implements ISoundManager
|
||||
|
||||
if (!sample)
|
||||
{
|
||||
const sampleUrl = Nitro.instance.getConfiguration<string>('external.samples.url');
|
||||
const sampleUrl = NitroConfiguration.getValue<string>('external.samples.url');
|
||||
|
||||
sample = new Audio(sampleUrl.replace('%sample%', code.toString()));
|
||||
this._furniSamples.add(code, sample);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { NitroLogger } from '../../core';
|
||||
import { NitroLogger } from '../../api';
|
||||
import { LegacyExternalInterface } from '../externalInterface/LegacyExternalInterface';
|
||||
|
||||
export class HabboWebTools
|
||||
@ -11,7 +11,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('logEventLog', data);
|
||||
}
|
||||
@ -27,7 +27,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('openPage', pageUrl);
|
||||
}
|
||||
@ -39,7 +39,7 @@ export class HabboWebTools
|
||||
|
||||
catch (e)
|
||||
{
|
||||
NitroLogger.log(('Failed to open web page ' + pageUrl));
|
||||
NitroLogger.log('Failed to open web page', pageUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,7 +52,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('heartBeat');
|
||||
}
|
||||
@ -68,7 +68,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
HabboWebTools.openPage(pageUrl);
|
||||
}
|
||||
@ -76,7 +76,7 @@ export class HabboWebTools
|
||||
|
||||
catch (e)
|
||||
{
|
||||
NitroLogger.log(('Failed to open web page ' + pageUrl));
|
||||
NitroLogger.log('Failed to open web page', pageUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,7 +84,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('closeWebPageAndRestoreClient');
|
||||
}
|
||||
@ -100,7 +100,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('openHabblet', name, param);
|
||||
}
|
||||
@ -108,7 +108,7 @@ export class HabboWebTools
|
||||
|
||||
catch (e)
|
||||
{
|
||||
NitroLogger.log(('Failed to open Habblet ' + name));
|
||||
NitroLogger.log('Failed to open Habblet', name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('closeHabblet', name, param);
|
||||
}
|
||||
@ -124,7 +124,7 @@ export class HabboWebTools
|
||||
|
||||
catch (e)
|
||||
{
|
||||
NitroLogger.log(('Failed to close Habblet ' + name));
|
||||
NitroLogger.log('Failed to close Habblet', name);
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,7 +132,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('disconnect', reasonCode, reasonString);
|
||||
}
|
||||
@ -148,7 +148,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.callGame('showGame', gameUrl);
|
||||
}
|
||||
@ -156,7 +156,7 @@ export class HabboWebTools
|
||||
|
||||
catch (e)
|
||||
{
|
||||
NitroLogger.log(('Failed to open game: ' + e));
|
||||
NitroLogger.log('Failed to open game', e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.callGame('hideGame');
|
||||
}
|
||||
@ -180,7 +180,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('openExternalLink', escape(url));
|
||||
}
|
||||
@ -200,7 +200,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('roomVisited', roomId);
|
||||
}
|
||||
@ -220,7 +220,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('openMinimail', target);
|
||||
}
|
||||
@ -240,7 +240,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('openNews');
|
||||
}
|
||||
@ -260,7 +260,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('closeNews');
|
||||
}
|
||||
@ -280,7 +280,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('openAvatars');
|
||||
}
|
||||
@ -300,7 +300,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('openRoomEnterAd');
|
||||
}
|
||||
@ -320,7 +320,7 @@ export class HabboWebTools
|
||||
{
|
||||
try
|
||||
{
|
||||
if(LegacyExternalInterface.available)
|
||||
if (LegacyExternalInterface.available)
|
||||
{
|
||||
LegacyExternalInterface.call('updateFigure', figure);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { IGraphicAssetCollection, IRoomContentLoader, IRoomInstance, IRoomInstanceContainer, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectManager, IRoomObjectVisualizationFactory } from '../api';
|
||||
import { IGraphicAssetCollection, IRoomContentLoader, IRoomInstance, IRoomInstanceContainer, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectManager, IRoomObjectVisualizationFactory, NitroLogger } from '../api';
|
||||
import { NitroManager } from '../core';
|
||||
import { RoomContentLoader } from '../nitro/room/RoomContentLoader';
|
||||
import { RoomContentLoadedEvent } from './events';
|
||||
@ -57,15 +57,15 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
public onInit(): void
|
||||
{
|
||||
if(this._state >= RoomManager.ROOM_MANAGER_INITIALIZING || !this._contentLoader) return;
|
||||
if (this._state >= RoomManager.ROOM_MANAGER_INITIALIZING || !this._contentLoader) return;
|
||||
|
||||
const mandatoryLibraries = RoomContentLoader.MANDATORY_LIBRARIES;
|
||||
|
||||
for(const library of mandatoryLibraries)
|
||||
for (const library of mandatoryLibraries)
|
||||
{
|
||||
if(!library) continue;
|
||||
if (!library) continue;
|
||||
|
||||
if(this._initialLoadList.indexOf(library) === -1)
|
||||
if (this._initialLoadList.indexOf(library) === -1)
|
||||
{
|
||||
this._contentLoader.downloadAsset(library, this.events);
|
||||
|
||||
@ -80,22 +80,22 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
const existing = this._rooms.get(roomId);
|
||||
|
||||
if(!existing) return null;
|
||||
if (!existing) return null;
|
||||
|
||||
return existing;
|
||||
}
|
||||
|
||||
public createRoomInstance(roomId: string): IRoomInstance
|
||||
{
|
||||
if(this._rooms.get(roomId)) return null;
|
||||
if (this._rooms.get(roomId)) return null;
|
||||
|
||||
const instance = new RoomInstance(roomId, this);
|
||||
|
||||
this._rooms.set(instance.id, instance);
|
||||
|
||||
if(this._updateCategories.length)
|
||||
if (this._updateCategories.length)
|
||||
{
|
||||
for(const category of this._updateCategories)
|
||||
for (const category of this._updateCategories)
|
||||
{
|
||||
instance.addUpdateCategory(category);
|
||||
}
|
||||
@ -108,7 +108,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
const existing = this._rooms.get(roomId);
|
||||
|
||||
if(!existing) return false;
|
||||
if (!existing) return false;
|
||||
|
||||
this._rooms.delete(roomId);
|
||||
|
||||
@ -121,7 +121,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
const instance = this.getRoomInstance(roomId);
|
||||
|
||||
if(!instance) return null;
|
||||
if (!instance) return null;
|
||||
|
||||
let visualization = type;
|
||||
let logic = type;
|
||||
@ -129,11 +129,11 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
let asset: IGraphicAssetCollection = null;
|
||||
let isLoading = false;
|
||||
|
||||
if(this._contentLoader.isLoaderType(type))
|
||||
if (this._contentLoader.isLoaderType(type))
|
||||
{
|
||||
asset = this._contentLoader.getCollection(type);
|
||||
|
||||
if(!asset)
|
||||
if (!asset)
|
||||
{
|
||||
isLoading = true;
|
||||
|
||||
@ -142,7 +142,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
assetName = this._contentLoader.getPlaceholderName(type);
|
||||
asset = this._contentLoader.getCollection(assetName);
|
||||
|
||||
if(!asset) return null;
|
||||
if (!asset) return null;
|
||||
}
|
||||
|
||||
visualization = asset.data.visualizationType;
|
||||
@ -151,13 +151,13 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
const object = (instance.createRoomObject(objectId, 1, type, category) as IRoomObjectController);
|
||||
|
||||
if(!object) return null;
|
||||
if (!object) return null;
|
||||
|
||||
if(this._visualizationFactory)
|
||||
if (this._visualizationFactory)
|
||||
{
|
||||
const visualizationInstance = this._visualizationFactory.getVisualization(visualization);
|
||||
|
||||
if(!visualizationInstance)
|
||||
if (!visualizationInstance)
|
||||
{
|
||||
instance.removeRoomObject(objectId, category);
|
||||
|
||||
@ -168,7 +168,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
const visualizationData = this._visualizationFactory.getVisualizationData(assetName, visualization, ((asset && asset.data) || null));
|
||||
|
||||
if(!visualizationData || !visualizationInstance.initialize(visualizationData))
|
||||
if (!visualizationData || !visualizationInstance.initialize(visualizationData))
|
||||
{
|
||||
instance.removeRoomObject(objectId, category);
|
||||
|
||||
@ -178,19 +178,19 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
object.setVisualization(visualizationInstance);
|
||||
}
|
||||
|
||||
if(this._logicFactory)
|
||||
if (this._logicFactory)
|
||||
{
|
||||
const logicInstance = this._logicFactory.getLogic(logic);
|
||||
|
||||
object.setLogic(logicInstance);
|
||||
|
||||
if(logicInstance)
|
||||
if (logicInstance)
|
||||
{
|
||||
logicInstance.initialize((asset && asset.data) || null);
|
||||
}
|
||||
}
|
||||
|
||||
if(!isLoading) object.isReady = true;
|
||||
if (!isLoading) object.isReady = true;
|
||||
|
||||
this._contentLoader.setRoomObjectRoomId(object, roomId);
|
||||
|
||||
@ -199,35 +199,35 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
private reinitializeRoomObjectsByType(type: string): void
|
||||
{
|
||||
if(!type || !this._contentLoader || !this._visualizationFactory || !this._logicFactory) return;
|
||||
if (!type || !this._contentLoader || !this._visualizationFactory || !this._logicFactory) return;
|
||||
|
||||
const asset = this._contentLoader.getCollection(type);
|
||||
|
||||
if(!asset) return;
|
||||
if (!asset) return;
|
||||
|
||||
const visualization = asset.data.visualizationType;
|
||||
const logic = asset.data.logicType;
|
||||
const visualizationData = this._visualizationFactory.getVisualizationData(type, visualization, asset.data);
|
||||
|
||||
for(const room of this._rooms.values())
|
||||
for (const room of this._rooms.values())
|
||||
{
|
||||
if(!room) continue;
|
||||
if (!room) continue;
|
||||
|
||||
for(const [category, manager] of room.managers.entries())
|
||||
for (const [category, manager] of room.managers.entries())
|
||||
{
|
||||
if(!manager) continue;
|
||||
if (!manager) continue;
|
||||
|
||||
for(const object of manager.objects.getValues())
|
||||
for (const object of manager.objects.getValues())
|
||||
{
|
||||
if(!object || object.type !== type) continue;
|
||||
if (!object || object.type !== type) continue;
|
||||
|
||||
const visualizationInstance = this._visualizationFactory.getVisualization(visualization);
|
||||
|
||||
if(visualizationInstance)
|
||||
if (visualizationInstance)
|
||||
{
|
||||
visualizationInstance.asset = asset;
|
||||
|
||||
if(!visualizationData || !visualizationInstance.initialize(visualizationData))
|
||||
if (!visualizationData || !visualizationInstance.initialize(visualizationData))
|
||||
{
|
||||
manager.removeObject(object.id);
|
||||
}
|
||||
@ -239,14 +239,14 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
object.setLogic(logicInstance);
|
||||
|
||||
if(logicInstance)
|
||||
if (logicInstance)
|
||||
{
|
||||
logicInstance.initialize(asset.data);
|
||||
}
|
||||
|
||||
object.isReady = true;
|
||||
|
||||
if(this._listener) this._listener.objectInitialized(room.id, object.id, category);
|
||||
if (this._listener) this._listener.objectInitialized(room.id, object.id, category);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -262,15 +262,15 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
const index = this._updateCategories.indexOf(category);
|
||||
|
||||
if(index >= 0) return;
|
||||
if (index >= 0) return;
|
||||
|
||||
this._updateCategories.push(category);
|
||||
|
||||
if(!this._rooms.size) return;
|
||||
if (!this._rooms.size) return;
|
||||
|
||||
for(const room of this._rooms.values())
|
||||
for (const room of this._rooms.values())
|
||||
{
|
||||
if(!room) continue;
|
||||
if (!room) continue;
|
||||
|
||||
room.addUpdateCategory(category);
|
||||
}
|
||||
@ -280,15 +280,15 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
const index = this._updateCategories.indexOf(category);
|
||||
|
||||
if(index === -1) return;
|
||||
if (index === -1) return;
|
||||
|
||||
this._updateCategories.splice(index, 1);
|
||||
|
||||
if(!this._rooms.size) return;
|
||||
if (!this._rooms.size) return;
|
||||
|
||||
for(const room of this._rooms.values())
|
||||
for (const room of this._rooms.values())
|
||||
{
|
||||
if(!room) continue;
|
||||
if (!room) continue;
|
||||
|
||||
room.removeUpdateCategory(category);
|
||||
}
|
||||
@ -296,63 +296,63 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
public setContentLoader(loader: IRoomContentLoader): void
|
||||
{
|
||||
if(this._contentLoader) this._contentLoader.dispose();
|
||||
if (this._contentLoader) this._contentLoader.dispose();
|
||||
|
||||
this._contentLoader = loader;
|
||||
}
|
||||
|
||||
private processPendingContentTypes(time: number): void
|
||||
{
|
||||
if(this._skipContentProcessing)
|
||||
if (this._skipContentProcessing)
|
||||
{
|
||||
this._skipContentProcessing = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
while(this._pendingContentTypes.length)
|
||||
while (this._pendingContentTypes.length)
|
||||
{
|
||||
const type = this._pendingContentTypes.shift();
|
||||
|
||||
const collection = this._contentLoader.getCollection(type);
|
||||
|
||||
if(!collection)
|
||||
if (!collection)
|
||||
{
|
||||
if(this._listener)
|
||||
if (this._listener)
|
||||
{
|
||||
this._listener.initalizeTemporaryObjectsByType(type, false);
|
||||
}
|
||||
|
||||
this.logger.log(`Invalid Collection: ${type}`);
|
||||
NitroLogger.log('Invalid Collection', type);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
this.reinitializeRoomObjectsByType(type);
|
||||
|
||||
if(this._listener) this._listener.initalizeTemporaryObjectsByType(type, true);
|
||||
if (this._listener) this._listener.initalizeTemporaryObjectsByType(type, true);
|
||||
|
||||
if(this._initialLoadList.length > 0) this.removeFromInitialLoad(type);
|
||||
if (this._initialLoadList.length > 0) this.removeFromInitialLoad(type);
|
||||
}
|
||||
}
|
||||
|
||||
private removeFromInitialLoad(type: string): void
|
||||
{
|
||||
if(!type || this._state === RoomManager.ROOM_MANAGER_ERROR) return;
|
||||
if (!type || this._state === RoomManager.ROOM_MANAGER_ERROR) return;
|
||||
|
||||
if(!this._contentLoader) this._state = RoomManager.ROOM_MANAGER_ERROR;
|
||||
if (!this._contentLoader) this._state = RoomManager.ROOM_MANAGER_ERROR;
|
||||
|
||||
if(this._contentLoader.getCollection(type))
|
||||
if (this._contentLoader.getCollection(type))
|
||||
{
|
||||
const i = this._initialLoadList.indexOf(type);
|
||||
|
||||
if(i >= 0) this._initialLoadList.splice(i, 1);
|
||||
if (i >= 0) this._initialLoadList.splice(i, 1);
|
||||
|
||||
if(!this._initialLoadList.length)
|
||||
if (!this._initialLoadList.length)
|
||||
{
|
||||
this._state = RoomManager.ROOM_MANAGER_INITIALIZED;
|
||||
|
||||
if(this._listener)
|
||||
if (this._listener)
|
||||
{
|
||||
this._listener.onRoomEngineInitalized(true);
|
||||
}
|
||||
@ -362,17 +362,17 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
this._state = RoomManager.ROOM_MANAGER_ERROR;
|
||||
|
||||
if(this._listener) this._listener.onRoomEngineInitalized(false);
|
||||
if (this._listener) this._listener.onRoomEngineInitalized(false);
|
||||
}
|
||||
}
|
||||
|
||||
private onRoomContentLoadedEvent(event: RoomContentLoadedEvent): void
|
||||
{
|
||||
if(!this._contentLoader) return;
|
||||
if (!this._contentLoader) return;
|
||||
|
||||
const contentType = event.contentType;
|
||||
|
||||
if(this._pendingContentTypes.indexOf(contentType) >= 0) return;
|
||||
if (this._pendingContentTypes.indexOf(contentType) >= 0) return;
|
||||
|
||||
this._pendingContentTypes.push(contentType);
|
||||
}
|
||||
@ -381,9 +381,9 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
this.processPendingContentTypes(time);
|
||||
|
||||
if(!this._rooms.size) return;
|
||||
if (!this._rooms.size) return;
|
||||
|
||||
for(const room of this._rooms.values()) room && room.update(time, update);
|
||||
for (const room of this._rooms.values()) room && room.update(time, update);
|
||||
}
|
||||
|
||||
public createRoomObjectManager(category: number): IRoomObjectManager
|
||||
|
@ -3,9 +3,8 @@ import { Container, DisplayObject } from '@pixi/display';
|
||||
import { Graphics } from '@pixi/graphics';
|
||||
import { Matrix, Point, Rectangle } from '@pixi/math';
|
||||
import { Sprite } from '@pixi/sprite';
|
||||
import { IRoomCanvasMouseListener, IRoomGeometry, IRoomObject, IRoomObjectSprite, IRoomObjectSpriteVisualization, IRoomRenderingCanvas, IRoomSpriteCanvasContainer, IRoomSpriteMouseEvent, RoomObjectSpriteData, RoomObjectSpriteType, Vector3d } from '../../api';
|
||||
import { IRoomCanvasMouseListener, IRoomGeometry, IRoomObject, IRoomObjectSprite, IRoomObjectSpriteVisualization, IRoomRenderingCanvas, IRoomSpriteCanvasContainer, IRoomSpriteMouseEvent, MouseEventType, RoomObjectSpriteData, RoomObjectSpriteType, Vector3d } from '../../api';
|
||||
import { Nitro } from '../../nitro/Nitro';
|
||||
import { MouseEventType } from '../../nitro/ui/MouseEventType';
|
||||
import { NitroContainer, NitroSprite, PixiApplicationProxy } from '../../pixi-proxy';
|
||||
import { RoomSpriteMouseEvent } from '../events';
|
||||
import { RoomEnterEffect, RoomGeometry, RoomRotatingEffect, RoomShakingEffect } from '../utils';
|
||||
@ -122,14 +121,14 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private setupCanvas(): void
|
||||
{
|
||||
if(!this._master)
|
||||
if (!this._master)
|
||||
{
|
||||
this._master = new NitroSprite();
|
||||
|
||||
this._master.interactiveChildren = false;
|
||||
}
|
||||
|
||||
if(!this._display)
|
||||
if (!this._display)
|
||||
{
|
||||
const display = new NitroContainer();
|
||||
|
||||
@ -143,32 +142,32 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
this.cleanSprites(0, true);
|
||||
|
||||
if(this._geometry)
|
||||
if (this._geometry)
|
||||
{
|
||||
this._geometry.dispose();
|
||||
|
||||
this._geometry = null;
|
||||
}
|
||||
|
||||
if(this._mask) this._mask = null;
|
||||
if (this._mask) this._mask = null;
|
||||
|
||||
if(this._objectCache)
|
||||
if (this._objectCache)
|
||||
{
|
||||
this._objectCache.dispose();
|
||||
|
||||
this._objectCache = null;
|
||||
}
|
||||
|
||||
if(this._master)
|
||||
if (this._master)
|
||||
{
|
||||
while(this._master.children.length)
|
||||
while (this._master.children.length)
|
||||
{
|
||||
const child = this._master.removeChildAt(0);
|
||||
|
||||
child.destroy();
|
||||
}
|
||||
|
||||
if(this._master.parent) this._master.parent.removeChild(this._master);
|
||||
if (this._master.parent) this._master.parent.removeChild(this._master);
|
||||
|
||||
this._master.destroy();
|
||||
|
||||
@ -178,16 +177,16 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._display = null;
|
||||
this._sortableSprites = [];
|
||||
|
||||
if(this._mouseActiveObjects)
|
||||
if (this._mouseActiveObjects)
|
||||
{
|
||||
this._mouseActiveObjects.clear();
|
||||
|
||||
this._mouseActiveObjects = null;
|
||||
}
|
||||
|
||||
if(this._spritePool)
|
||||
if (this._spritePool)
|
||||
{
|
||||
for(const sprite of this._spritePool)
|
||||
for (const sprite of this._spritePool)
|
||||
{
|
||||
this.cleanSprite(sprite, true);
|
||||
}
|
||||
@ -195,7 +194,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._spritePool = [];
|
||||
}
|
||||
|
||||
if(this._eventCache)
|
||||
if (this._eventCache)
|
||||
{
|
||||
this._eventCache.clear();
|
||||
|
||||
@ -210,20 +209,20 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
width = width < 1 ? 1 : width;
|
||||
height = height < 1 ? 1 : height;
|
||||
|
||||
if(this._usesMask)
|
||||
if (this._usesMask)
|
||||
{
|
||||
if(!this._mask)
|
||||
if (!this._mask)
|
||||
{
|
||||
this._mask = new Graphics()
|
||||
.beginFill(0xFF0000)
|
||||
.drawRect(0, 0, width, height)
|
||||
.endFill();
|
||||
|
||||
if(this._master)
|
||||
if (this._master)
|
||||
{
|
||||
this._master.addChild(this._mask);
|
||||
|
||||
if(this._display) this._display.mask = this._mask;
|
||||
if (this._display) this._display.mask = this._mask;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -236,9 +235,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
}
|
||||
}
|
||||
|
||||
if(this._master)
|
||||
if (this._master)
|
||||
{
|
||||
if(this._master.hitArea)
|
||||
if (this._master.hitArea)
|
||||
{
|
||||
const hitArea = (this._master.hitArea as Rectangle);
|
||||
|
||||
@ -250,7 +249,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._master.hitArea = new Rectangle(0, 0, width, height);
|
||||
}
|
||||
|
||||
if(this._master.filterArea)
|
||||
if (this._master.filterArea)
|
||||
{
|
||||
const filterArea = this._master.filterArea;
|
||||
|
||||
@ -269,11 +268,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public setMask(flag: boolean): void
|
||||
{
|
||||
if(flag && !this._usesMask)
|
||||
if (flag && !this._usesMask)
|
||||
{
|
||||
this._usesMask = true;
|
||||
|
||||
if(this._mask && (this._mask.parent !== this._master))
|
||||
if (this._mask && (this._mask.parent !== this._master))
|
||||
{
|
||||
this._master.addChild(this._mask);
|
||||
|
||||
@ -281,11 +280,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
}
|
||||
}
|
||||
|
||||
else if(!flag && this._usesMask)
|
||||
else if (!flag && this._usesMask)
|
||||
{
|
||||
this._usesMask = false;
|
||||
|
||||
if(this._mask && (this._mask.parent === this._master))
|
||||
if (this._mask && (this._mask.parent === this._master))
|
||||
{
|
||||
this._master.removeChild(this._mask);
|
||||
|
||||
@ -296,17 +295,17 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public setScale(scale: number, point: Point = null, offsetPoint: Point = null, override: boolean = false, asDelta: boolean = false): void
|
||||
{
|
||||
if(!this._master || !this._display) return;
|
||||
if (!this._master || !this._display) return;
|
||||
|
||||
if(this._restrictsScaling && !override) return;
|
||||
if (this._restrictsScaling && !override) return;
|
||||
|
||||
if(!point) point = new Point((this._width / 2), (this._height / 2));
|
||||
if (!point) point = new Point((this._width / 2), (this._height / 2));
|
||||
|
||||
if(!offsetPoint) offsetPoint = point;
|
||||
if (!offsetPoint) offsetPoint = point;
|
||||
|
||||
point = this._display.toLocal(point);
|
||||
|
||||
if(asDelta)
|
||||
if (asDelta)
|
||||
{
|
||||
this._scale *= scale;
|
||||
}
|
||||
@ -325,15 +324,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
this._totalTimeRunning += PixiApplicationProxy.instance.ticker.deltaTime;
|
||||
|
||||
if(this._totalTimeRunning === this._renderTimestamp) return;
|
||||
if (this._totalTimeRunning === this._renderTimestamp) return;
|
||||
|
||||
if(time === -1) time = (this._renderTimestamp + 1);
|
||||
if (time === -1) time = (this._renderTimestamp + 1);
|
||||
|
||||
if(!this._container || !this._geometry) return;
|
||||
if (!this._container || !this._geometry) return;
|
||||
|
||||
if((this._width !== this._renderedWidth) || (this._height !== this._renderedHeight)) update = true;
|
||||
if ((this._width !== this._renderedWidth) || (this._height !== this._renderedHeight)) update = true;
|
||||
|
||||
if((this._display.x !== this._screenOffsetX) || (this._display.y !== this._screenOffsetY))
|
||||
if ((this._display.x !== this._screenOffsetX) || (this._display.y !== this._screenOffsetY))
|
||||
{
|
||||
this._display.x = this._screenOffsetX;
|
||||
this._display.y = this._screenOffsetY;
|
||||
@ -341,7 +340,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
update = true;
|
||||
}
|
||||
|
||||
if(this._display.scale.x !== this._scale)
|
||||
if (this._display.scale.x !== this._scale)
|
||||
{
|
||||
this._display.scale.set(this._scale);
|
||||
|
||||
@ -354,7 +353,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
let updateVisuals = false;
|
||||
|
||||
if(frame !== this._lastFrame)
|
||||
if (frame !== this._lastFrame)
|
||||
{
|
||||
this._lastFrame = frame;
|
||||
|
||||
@ -365,11 +364,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
const objects = this._container.objects;
|
||||
|
||||
if(objects.size)
|
||||
if (objects.size)
|
||||
{
|
||||
for(const object of objects.values())
|
||||
for (const object of objects.values())
|
||||
{
|
||||
if(!object) continue;
|
||||
if (!object) continue;
|
||||
|
||||
spriteCount = (spriteCount + this.renderObject(object, object.instanceId.toString(), time, update, updateVisuals, spriteCount));
|
||||
}
|
||||
@ -380,25 +379,25 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
return b.z - a.z;
|
||||
});
|
||||
|
||||
if(spriteCount < this._sortableSprites.length)
|
||||
if (spriteCount < this._sortableSprites.length)
|
||||
{
|
||||
this._sortableSprites.splice(spriteCount);
|
||||
}
|
||||
|
||||
let iterator = 0;
|
||||
|
||||
while(iterator < spriteCount)
|
||||
while (iterator < spriteCount)
|
||||
{
|
||||
const sprite = this._sortableSprites[iterator];
|
||||
|
||||
if(sprite && sprite.sprite) this.renderSprite(iterator, sprite);
|
||||
if (sprite && sprite.sprite) this.renderSprite(iterator, sprite);
|
||||
|
||||
iterator++;
|
||||
}
|
||||
|
||||
this.cleanSprites(spriteCount);
|
||||
|
||||
if(update || updateVisuals) this._canvasUpdated = true;
|
||||
if (update || updateVisuals) this._canvasUpdated = true;
|
||||
|
||||
this._renderTimestamp = this._totalTimeRunning;
|
||||
this._renderedWidth = this._width;
|
||||
@ -434,11 +433,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private renderObject(object: IRoomObject, identifier: string, time: number, update: boolean, updateVisuals: boolean, count: number): number
|
||||
{
|
||||
if(!object) return 0;
|
||||
if (!object) return 0;
|
||||
|
||||
const visualization = object.visualization as IRoomObjectSpriteVisualization;
|
||||
|
||||
if(!visualization)
|
||||
if (!visualization)
|
||||
{
|
||||
this.removeFromCache(identifier);
|
||||
|
||||
@ -453,18 +452,18 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
const vector = locationCache.updateLocation(object, this._geometry);
|
||||
|
||||
if(!vector)
|
||||
if (!vector)
|
||||
{
|
||||
this.removeFromCache(identifier);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(updateVisuals) visualization.update(this._geometry, time, (!sortableCache.isEmpty || update), (this._skipObjectUpdate && this._runningSlow));
|
||||
if (updateVisuals) visualization.update(this._geometry, time, (!sortableCache.isEmpty || update), (this._skipObjectUpdate && this._runningSlow));
|
||||
|
||||
if(locationCache.locationChanged) update = true;
|
||||
if (locationCache.locationChanged) update = true;
|
||||
|
||||
if(!sortableCache.needsUpdate(visualization.instanceId, visualization.updateSpriteCounter) && !update)
|
||||
if (!sortableCache.needsUpdate(visualization.instanceId, visualization.updateSpriteCounter) && !update)
|
||||
{
|
||||
return sortableCache.spriteCount;
|
||||
}
|
||||
@ -473,7 +472,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
let y = vector.y;
|
||||
let z = vector.z;
|
||||
|
||||
if(x > 0) z = (z + (x * 1.2E-7));
|
||||
if (x > 0) z = (z + (x * 1.2E-7));
|
||||
else z = (z + (-(x) * 1.2E-7));
|
||||
|
||||
x = (x + Math.trunc(this._width / 2));
|
||||
@ -481,40 +480,40 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
let spriteCount = 0;
|
||||
|
||||
for(const sprite of visualization.sprites.values())
|
||||
for (const sprite of visualization.sprites.values())
|
||||
{
|
||||
if(!sprite || !sprite.visible) continue;
|
||||
if (!sprite || !sprite.visible) continue;
|
||||
|
||||
const texture = sprite.texture;
|
||||
const baseTexture = texture && texture.baseTexture;
|
||||
|
||||
if(!texture || !baseTexture) continue;
|
||||
if (!texture || !baseTexture) continue;
|
||||
|
||||
const spriteX = ((x + sprite.offsetX) + this._screenOffsetX);
|
||||
const spriteY = ((y + sprite.offsetY) + this._screenOffsetY);
|
||||
|
||||
if(sprite.flipH)
|
||||
if (sprite.flipH)
|
||||
{
|
||||
const checkX = ((x + (-(texture.width + (-(sprite.offsetX))))) + this._screenOffsetX);
|
||||
|
||||
if(!this.isSpriteVisible(checkX, spriteY, texture.width, texture.height)) continue;
|
||||
if (!this.isSpriteVisible(checkX, spriteY, texture.width, texture.height)) continue;
|
||||
}
|
||||
|
||||
else if(sprite.flipV)
|
||||
else if (sprite.flipV)
|
||||
{
|
||||
const checkY = ((y + (-(texture.height + (-(sprite.offsetY))))) + this._screenOffsetY);
|
||||
|
||||
if(!this.isSpriteVisible(spriteX, checkY, texture.width, texture.height)) continue;
|
||||
if (!this.isSpriteVisible(spriteX, checkY, texture.width, texture.height)) continue;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(!this.isSpriteVisible(spriteX, spriteY, texture.width, texture.height)) continue;
|
||||
if (!this.isSpriteVisible(spriteX, spriteY, texture.width, texture.height)) continue;
|
||||
}
|
||||
|
||||
let sortableSprite = sortableCache.getSprite(spriteCount);
|
||||
|
||||
if(!sortableSprite)
|
||||
if (!sortableSprite)
|
||||
{
|
||||
sortableSprite = new SortableSprite();
|
||||
|
||||
@ -527,7 +526,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
sortableSprite.sprite = sprite;
|
||||
|
||||
if((sprite.spriteType === RoomObjectSpriteType.AVATAR) || (sprite.spriteType === RoomObjectSpriteType.AVATAR_OWN))
|
||||
if ((sprite.spriteType === RoomObjectSpriteType.AVATAR) || (sprite.spriteType === RoomObjectSpriteType.AVATAR_OWN))
|
||||
{
|
||||
sortableSprite.sprite.libraryAssetName = 'avatar_' + object.id;
|
||||
}
|
||||
@ -549,41 +548,41 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private getExtendedSprite(index: number): ExtendedSprite
|
||||
{
|
||||
if((index < 0) || (index >= this._spriteCount)) return null;
|
||||
if ((index < 0) || (index >= this._spriteCount)) return null;
|
||||
|
||||
const sprite = (this._display.getChildAt(index) as ExtendedSprite);
|
||||
|
||||
if(!sprite) return null;
|
||||
if (!sprite) return null;
|
||||
|
||||
return sprite;
|
||||
}
|
||||
|
||||
protected getExtendedSpriteIdentifier(sprite: ExtendedSprite): string
|
||||
{
|
||||
if(!sprite) return '';
|
||||
if (!sprite) return '';
|
||||
|
||||
return sprite.name;
|
||||
}
|
||||
|
||||
private renderSprite(index: number, sprite: SortableSprite): boolean
|
||||
{
|
||||
if(index >= this._spriteCount)
|
||||
if (index >= this._spriteCount)
|
||||
{
|
||||
this.createAndAddSprite(sprite);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!sprite) return false;
|
||||
if (!sprite) return false;
|
||||
|
||||
const objectSprite = sprite.sprite;
|
||||
const extendedSprite = this.getExtendedSprite(index);
|
||||
|
||||
if(!objectSprite || !extendedSprite) return false;
|
||||
if (!objectSprite || !extendedSprite) return false;
|
||||
|
||||
if(extendedSprite.varyingDepth !== objectSprite.varyingDepth)
|
||||
if (extendedSprite.varyingDepth !== objectSprite.varyingDepth)
|
||||
{
|
||||
if(extendedSprite.varyingDepth && !objectSprite.varyingDepth)
|
||||
if (extendedSprite.varyingDepth && !objectSprite.varyingDepth)
|
||||
{
|
||||
this._display.removeChildAt(index);
|
||||
|
||||
@ -597,7 +596,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
return true;
|
||||
}
|
||||
|
||||
if(extendedSprite.needsUpdate(objectSprite.id, objectSprite.updateCounter) || RoomEnterEffect.isVisualizationOn())
|
||||
if (extendedSprite.needsUpdate(objectSprite.id, objectSprite.updateCounter) || RoomEnterEffect.isVisualizationOn())
|
||||
{
|
||||
extendedSprite.tag = objectSprite.tag;
|
||||
extendedSprite.alphaTolerance = objectSprite.alphaTolerance;
|
||||
@ -608,48 +607,48 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
const alpha = (objectSprite.alpha / 255);
|
||||
|
||||
if(extendedSprite.alpha !== alpha) extendedSprite.alpha = alpha;
|
||||
if (extendedSprite.alpha !== alpha) extendedSprite.alpha = alpha;
|
||||
|
||||
if(extendedSprite.tint !== objectSprite.color) extendedSprite.tint = objectSprite.color;
|
||||
if (extendedSprite.tint !== objectSprite.color) extendedSprite.tint = objectSprite.color;
|
||||
|
||||
if(extendedSprite.blendMode !== objectSprite.blendMode) extendedSprite.blendMode = objectSprite.blendMode;
|
||||
if (extendedSprite.blendMode !== objectSprite.blendMode) extendedSprite.blendMode = objectSprite.blendMode;
|
||||
|
||||
if(extendedSprite.texture !== objectSprite.texture) extendedSprite.setTexture(objectSprite.texture);
|
||||
if (extendedSprite.texture !== objectSprite.texture) extendedSprite.setTexture(objectSprite.texture);
|
||||
|
||||
if(objectSprite.updateContainer)
|
||||
if (objectSprite.updateContainer)
|
||||
{
|
||||
const length = extendedSprite.children.length;
|
||||
|
||||
if(length === 1) extendedSprite.removeChildAt(0);
|
||||
if (length === 1) extendedSprite.removeChildAt(0);
|
||||
|
||||
extendedSprite.addChild(objectSprite.container);
|
||||
|
||||
objectSprite.updateContainer = false;
|
||||
}
|
||||
|
||||
if(objectSprite.flipH)
|
||||
if (objectSprite.flipH)
|
||||
{
|
||||
if(extendedSprite.scale.x !== -1) extendedSprite.scale.x = -1;
|
||||
if (extendedSprite.scale.x !== -1) extendedSprite.scale.x = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(extendedSprite.scale.x !== 1) extendedSprite.scale.x = 1;
|
||||
if (extendedSprite.scale.x !== 1) extendedSprite.scale.x = 1;
|
||||
}
|
||||
|
||||
if(objectSprite.flipV)
|
||||
if (objectSprite.flipV)
|
||||
{
|
||||
if(extendedSprite.scale.y !== -1) extendedSprite.scale.y = -1;
|
||||
if (extendedSprite.scale.y !== -1) extendedSprite.scale.y = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(extendedSprite.scale.y !== 1) extendedSprite.scale.y = 1;
|
||||
if (extendedSprite.scale.y !== 1) extendedSprite.scale.y = 1;
|
||||
}
|
||||
|
||||
this.updateEnterRoomEffect(extendedSprite, objectSprite);
|
||||
}
|
||||
|
||||
if(extendedSprite.x !== sprite.x) extendedSprite.x = sprite.x;
|
||||
if(extendedSprite.y !== sprite.y) extendedSprite.y = sprite.y;
|
||||
if (extendedSprite.x !== sprite.x) extendedSprite.x = sprite.x;
|
||||
if (extendedSprite.y !== sprite.y) extendedSprite.y = sprite.y;
|
||||
|
||||
extendedSprite.offsetX = objectSprite.offsetX;
|
||||
extendedSprite.offsetY = objectSprite.offsetY;
|
||||
@ -661,15 +660,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
const sprite = sortableSprite.sprite;
|
||||
|
||||
if(!sprite) return;
|
||||
if (!sprite) return;
|
||||
|
||||
let extendedSprite: ExtendedSprite = null;
|
||||
|
||||
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();
|
||||
|
||||
extendedSprite.tag = sprite.tag;
|
||||
extendedSprite.alphaTolerance = sprite.alphaTolerance;
|
||||
@ -687,20 +686,20 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
extendedSprite.setTexture(sprite.texture);
|
||||
|
||||
if(sprite.updateContainer)
|
||||
if (sprite.updateContainer)
|
||||
{
|
||||
extendedSprite.addChild(sprite.container);
|
||||
|
||||
sprite.updateContainer = false;
|
||||
}
|
||||
|
||||
if(sprite.flipH) extendedSprite.scale.x = -1;
|
||||
if (sprite.flipH) extendedSprite.scale.x = -1;
|
||||
|
||||
if(sprite.flipV) extendedSprite.scale.y = -1;
|
||||
if (sprite.flipV) extendedSprite.scale.y = -1;
|
||||
|
||||
this.updateEnterRoomEffect(extendedSprite, sprite);
|
||||
|
||||
if((index < 0) || (index >= this._spriteCount))
|
||||
if ((index < 0) || (index >= this._spriteCount))
|
||||
{
|
||||
this._display.addChild(extendedSprite);
|
||||
|
||||
@ -716,15 +715,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private cleanSprites(spriteCount: number, _arg_2: boolean = false): void
|
||||
{
|
||||
if(!this._display) return;
|
||||
if (!this._display) return;
|
||||
|
||||
if(spriteCount < 0) spriteCount = 0;
|
||||
if (spriteCount < 0) spriteCount = 0;
|
||||
|
||||
if((spriteCount < this._activeSpriteCount) || !this._activeSpriteCount)
|
||||
if ((spriteCount < this._activeSpriteCount) || !this._activeSpriteCount)
|
||||
{
|
||||
let iterator = (this._spriteCount - 1);
|
||||
|
||||
while(iterator >= spriteCount)
|
||||
while (iterator >= spriteCount)
|
||||
{
|
||||
this.cleanSprite(this.getExtendedSprite(iterator), _arg_2);
|
||||
|
||||
@ -737,9 +736,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private updateEnterRoomEffect(sprite: ExtendedSprite, _arg_2: IRoomObjectSprite): void
|
||||
{
|
||||
if(!RoomEnterEffect.isVisualizationOn() || !_arg_2) return;
|
||||
if (!RoomEnterEffect.isVisualizationOn() || !_arg_2) return;
|
||||
|
||||
switch(_arg_2.spriteType)
|
||||
switch (_arg_2.spriteType)
|
||||
{
|
||||
case RoomObjectSpriteType.AVATAR_OWN:
|
||||
return;
|
||||
@ -756,15 +755,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private cleanSprite(sprite: ExtendedSprite, _arg_2: boolean): void
|
||||
{
|
||||
if(!sprite) return;
|
||||
if (!sprite) return;
|
||||
|
||||
if(!_arg_2)
|
||||
if (!_arg_2)
|
||||
{
|
||||
sprite.setTexture(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sprite.parent) sprite.parent.removeChild(sprite);
|
||||
if (sprite.parent) sprite.parent.removeChild(sprite);
|
||||
|
||||
sprite.destroy({
|
||||
children: true
|
||||
@ -774,7 +773,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public update(): void
|
||||
{
|
||||
if(!this._mouseCheckCount)
|
||||
if (!this._mouseCheckCount)
|
||||
{
|
||||
//this.checkMouseHits(this._mouseLocation.x, this._mouseLocation.y, MouseEventType.MOUSE_MOVE);
|
||||
}
|
||||
@ -796,16 +795,16 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private isSpriteVisible(x: number, y: number, width: number, height: number): boolean
|
||||
{
|
||||
if(this._noSpriteVisibilityChecking) return true;
|
||||
if (this._noSpriteVisibilityChecking) return true;
|
||||
|
||||
x = (((x - this._screenOffsetX) * this._scale) + this._screenOffsetX);
|
||||
y = (((y - this._screenOffsetY) * this._scale) + this._screenOffsetY);
|
||||
width = (width * this._scale);
|
||||
height = (height * this._scale);
|
||||
|
||||
if(((x < this._width) && ((x + width) >= 0)) && ((y < this._height) && ((y + height) >= 0)))
|
||||
if (((x < this._width) && ((x + width) >= 0)) && ((y < this._height) && ((y + height) >= 0)))
|
||||
{
|
||||
if(!this._usesExclusionRectangles) return true;
|
||||
if (!this._usesExclusionRectangles) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -819,7 +818,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._mouseLocation.x = (x / this._scale);
|
||||
this._mouseLocation.y = (y / this._scale);
|
||||
|
||||
if((this._mouseCheckCount > 0) && (type == MouseEventType.MOUSE_MOVE)) return this._mouseSpriteWasHit;
|
||||
if ((this._mouseCheckCount > 0) && (type == MouseEventType.MOUSE_MOVE)) return this._mouseSpriteWasHit;
|
||||
|
||||
this._mouseSpriteWasHit = this.checkMouseHits(Math.trunc(x / this._scale), Math.trunc(y / this._scale), type, altKey, ctrlKey, shiftKey, buttonDown);
|
||||
|
||||
@ -836,13 +835,13 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
let mouseEvent: IRoomSpriteMouseEvent = null;
|
||||
let spriteId = (this._activeSpriteCount - 1);
|
||||
|
||||
while(spriteId >= 0)
|
||||
while (spriteId >= 0)
|
||||
{
|
||||
const extendedSprite = this.getExtendedSprite(spriteId);
|
||||
|
||||
if(extendedSprite && extendedSprite.containsPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y))))
|
||||
if (extendedSprite && extendedSprite.containsPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y))))
|
||||
{
|
||||
if(extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK)))
|
||||
if (extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK)))
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -850,15 +849,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
const identifier = this.getExtendedSpriteIdentifier(extendedSprite);
|
||||
|
||||
if(checkedSprites.indexOf(identifier) === -1)
|
||||
if (checkedSprites.indexOf(identifier) === -1)
|
||||
{
|
||||
const tag = extendedSprite.tag;
|
||||
|
||||
let mouseData = this._mouseActiveObjects.get(identifier);
|
||||
|
||||
if(mouseData)
|
||||
if (mouseData)
|
||||
{
|
||||
if(mouseData.spriteTag !== tag)
|
||||
if (mouseData.spriteTag !== tag)
|
||||
{
|
||||
mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, mouseData.spriteTag, altKey, ctrlKey, shiftKey, buttonDown);
|
||||
|
||||
@ -866,7 +865,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
}
|
||||
}
|
||||
|
||||
if((type === MouseEventType.MOUSE_MOVE) && (!mouseData || (mouseData.spriteTag !== tag)))
|
||||
if ((type === MouseEventType.MOUSE_MOVE) && (!mouseData || (mouseData.spriteTag !== tag)))
|
||||
{
|
||||
mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), MouseEventType.ROLL_OVER, tag, altKey, ctrlKey, shiftKey, buttonDown);
|
||||
}
|
||||
@ -878,7 +877,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
mouseEvent.spriteOffsetY = extendedSprite.offsetY;
|
||||
}
|
||||
|
||||
if(!mouseData)
|
||||
if (!mouseData)
|
||||
{
|
||||
mouseData = new ObjectMouseData();
|
||||
|
||||
@ -888,7 +887,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
mouseData.spriteTag = tag;
|
||||
|
||||
if(((type !== MouseEventType.MOUSE_MOVE) || (x !== this._mouseOldX)) || (y !== this._mouseOldY))
|
||||
if (((type !== MouseEventType.MOUSE_MOVE) || (x !== this._mouseOldX)) || (y !== this._mouseOldY))
|
||||
{
|
||||
this.bufferMouseEvent(mouseEvent, identifier);
|
||||
}
|
||||
@ -905,30 +904,30 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
const keys: string[] = [];
|
||||
|
||||
for(const key of this._mouseActiveObjects.keys()) key && keys.push(key);
|
||||
for (const key of this._mouseActiveObjects.keys()) key && keys.push(key);
|
||||
|
||||
let index = 0;
|
||||
|
||||
while(index < keys.length)
|
||||
while (index < keys.length)
|
||||
{
|
||||
const key = keys[index];
|
||||
|
||||
if(checkedSprites.indexOf(key) >= 0) keys[index] = null;
|
||||
if (checkedSprites.indexOf(key) >= 0) keys[index] = null;
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
|
||||
while(index < keys.length)
|
||||
while (index < keys.length)
|
||||
{
|
||||
const key = keys[index];
|
||||
|
||||
if(key !== null)
|
||||
if (key !== null)
|
||||
{
|
||||
const existing = this._mouseActiveObjects.get(key);
|
||||
|
||||
if(existing) this._mouseActiveObjects.delete(key);
|
||||
if (existing) this._mouseActiveObjects.delete(key);
|
||||
|
||||
const mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, existing.spriteTag, altKey, ctrlKey, shiftKey, buttonDown);
|
||||
|
||||
@ -956,7 +955,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
protected bufferMouseEvent(k: IRoomSpriteMouseEvent, _arg_2: string): void
|
||||
{
|
||||
if(!k || !this._eventCache) return;
|
||||
if (!k || !this._eventCache) return;
|
||||
|
||||
this._eventCache.delete(_arg_2);
|
||||
this._eventCache.set(_arg_2, k);
|
||||
@ -964,19 +963,19 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
protected processMouseEvents(): void
|
||||
{
|
||||
if(!this._container || !this._eventCache) return;
|
||||
if (!this._container || !this._eventCache) return;
|
||||
|
||||
for(const [key, event] of this._eventCache.entries())
|
||||
for (const [key, event] of this._eventCache.entries())
|
||||
{
|
||||
if(!this._eventCache) return;
|
||||
if (!this._eventCache) return;
|
||||
|
||||
if(!event) continue;
|
||||
if (!event) continue;
|
||||
|
||||
const roomObject = this._container.getRoomObject(parseInt(key));
|
||||
|
||||
if(!roomObject) continue;
|
||||
if (!roomObject) continue;
|
||||
|
||||
if(this._mouseListener)
|
||||
if (this._mouseListener)
|
||||
{
|
||||
this._mouseListener.processRoomCanvasMouseEvent(event, roomObject, this._geometry);
|
||||
}
|
||||
@ -984,14 +983,14 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
const logic = roomObject.mouseHandler;
|
||||
|
||||
if(logic)
|
||||
if (logic)
|
||||
{
|
||||
logic.mouseEvent(event, this._geometry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this._eventCache) this._eventCache.clear();
|
||||
if (this._eventCache) this._eventCache.clear();
|
||||
}
|
||||
|
||||
public getDisplayAsTexture(): RenderTexture
|
||||
@ -1034,7 +1033,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
const geometry = (this.geometry as RoomGeometry);
|
||||
|
||||
if(this._rotation !== 0)
|
||||
if (this._rotation !== 0)
|
||||
{
|
||||
let direction = this._effectDirection;
|
||||
|
||||
@ -1060,18 +1059,18 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._effectDirection.assign(geometry.direction);
|
||||
}
|
||||
|
||||
if(RoomShakingEffect.isVisualizationOn() && !this._SafeStr_4507)
|
||||
if (RoomShakingEffect.isVisualizationOn() && !this._SafeStr_4507)
|
||||
{
|
||||
this.changeShaking();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!RoomShakingEffect.isVisualizationOn() && this._SafeStr_4507) this.changeShaking();
|
||||
if (!RoomShakingEffect.isVisualizationOn() && this._SafeStr_4507) this.changeShaking();
|
||||
}
|
||||
|
||||
if(RoomRotatingEffect.isVisualizationOn()) this.changeRotation();
|
||||
if (RoomRotatingEffect.isVisualizationOn()) this.changeRotation();
|
||||
|
||||
if(this._SafeStr_4507)
|
||||
if (this._SafeStr_4507)
|
||||
{
|
||||
this._SafeStr_795++;
|
||||
|
||||
@ -1092,7 +1091,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
this._SafeStr_4507 = !this._SafeStr_4507;
|
||||
|
||||
if(this._SafeStr_4507)
|
||||
if (this._SafeStr_4507)
|
||||
{
|
||||
const direction = this.geometry.direction;
|
||||
|
||||
@ -1102,13 +1101,13 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private changeRotation(): void
|
||||
{
|
||||
if(this._SafeStr_4507) return;
|
||||
if (this._SafeStr_4507) return;
|
||||
|
||||
const geometry = (this.geometry as RoomGeometry);
|
||||
|
||||
if(!geometry) return;
|
||||
if (!geometry) return;
|
||||
|
||||
if(this._rotation === 0)
|
||||
if (this._rotation === 0)
|
||||
{
|
||||
const location = geometry.location;
|
||||
const directionAxis = geometry.directionAxis;
|
||||
@ -1120,7 +1119,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
const intersection = RoomGeometry.getIntersectionVector(location, directionAxis, new Vector3d(0, 0, 0), new Vector3d(0, 0, 1));
|
||||
|
||||
if(intersection !== null)
|
||||
if (intersection !== null)
|
||||
{
|
||||
this._rotationOrigin = new Vector3d(intersection.x, intersection.y, intersection.z);
|
||||
this._rotationRodLength = Vector3d.dif(intersection, location).length;
|
||||
@ -1139,9 +1138,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public moveLeft(): void
|
||||
{
|
||||
if(this._rotation !== 0)
|
||||
if (this._rotation !== 0)
|
||||
{
|
||||
if(this._rotation === 1)
|
||||
if (this._rotation === 1)
|
||||
{
|
||||
this._rotation = -1;
|
||||
}
|
||||
@ -1161,9 +1160,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public moveRight(): void
|
||||
{
|
||||
if(this._rotation !== 0)
|
||||
if (this._rotation !== 0)
|
||||
{
|
||||
if(this._rotation === -1)
|
||||
if (this._rotation === -1)
|
||||
{
|
||||
this._rotation = 1;
|
||||
}
|
||||
@ -1183,7 +1182,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public moveUp(): void
|
||||
{
|
||||
if(this._rotation !== 0) return;
|
||||
if (this._rotation !== 0) return;
|
||||
|
||||
const geometry = (this.geometry as RoomGeometry);
|
||||
const direction = ((geometry.direction.x / 180) * 3.14159265358979);
|
||||
@ -1193,7 +1192,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public moveDown(): void
|
||||
{
|
||||
if(this._rotation !== 0) return;
|
||||
if (this._rotation !== 0) return;
|
||||
|
||||
const geometry = (this.geometry as RoomGeometry);
|
||||
const direction = (((geometry.direction.x + 180) / 180) * 3.14159265358979);
|
||||
|
Loading…
x
Reference in New Issue
Block a user