Merge branch 'main' into png-encoder

This commit is contained in:
Bill 2021-07-30 15:31:40 -04:00
commit e2d6ef315a
21 changed files with 83 additions and 24 deletions

View File

@ -194,12 +194,12 @@ export class SocketConnection extends EventDispatcher implements IConnection
if(!encoded)
{
if(Nitro.instance.getConfiguration<boolean>('communication.packet.log')) console.log(`Encoding Failed: ${ composer.constructor.name }`);
if(Nitro.instance.getConfiguration<boolean>('system.packet.log')) console.log(`Encoding Failed: ${ composer.constructor.name }`);
continue;
}
if(Nitro.instance.getConfiguration<boolean>('communication.packet.log')) console.log(`OutgoingComposer: [${ header }] ${ composer.constructor.name }`, message);
if(Nitro.instance.getConfiguration<boolean>('system.packet.log')) console.log(`OutgoingComposer: [${ header }] ${ composer.constructor.name }`, message);
this.write(encoded.getBuffer());
}
@ -257,7 +257,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
if(!messages || !messages.length) continue;
if(Nitro.instance.getConfiguration<boolean>('communication.packet.log'))
if(Nitro.instance.getConfiguration<boolean>('system.packet.log'))
{
console.log(`IncomingMessage: [${ wrapper.header }] ${ messages[0].constructor.name }`, messages[0].parser);
}
@ -291,7 +291,7 @@ export class SocketConnection extends EventDispatcher implements IConnection
if(!events || !events.length)
{
if(Nitro.instance.getConfiguration<boolean>('communication.packet.log'))
if(Nitro.instance.getConfiguration<boolean>('system.packet.log'))
{
console.log(`IncomingMessage: [${ wrapper.header }] UNREGISTERED`, wrapper);
}

View File

@ -6,12 +6,14 @@ import { IConfigurationManager } from './IConfigurationManager';
export class ConfigurationManager extends NitroManager implements IConfigurationManager
{
private _definitions: AdvancedMap<string, unknown>;
private _pendingUrls: string[];
constructor()
{
super();
this._definitions = new AdvancedMap();
this._pendingUrls = [];
this.onConfigurationLoaded = this.onConfigurationLoaded.bind(this);
}
@ -19,7 +21,38 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
protected onInit(): void
{
//@ts-ignore
this.loadConfigurationFromUrl(NitroConfig.configurationUrl);
let urls: string[] = NitroConfig.configurationUrls;
if(!urls || !urls.length)
{
//@ts-ignore
const url: string = NitroConfig.configurationUrl;
if(url && url.length) urls = [ url ];
}
if(!urls || !urls.length)
{
this.dispatchConfigurationEvent(ConfigurationEvent.FAILED);
return;
}
this._pendingUrls = urls;
this.loadNextConfiguration();
}
private loadNextConfiguration(): void
{
if(!this._pendingUrls.length)
{
this.dispatchConfigurationEvent(ConfigurationEvent.LOADED);
return;
}
this.loadConfigurationFromUrl(this._pendingUrls[0]);
}
public loadConfigurationFromUrl(url: string): void
@ -33,17 +66,21 @@ export class ConfigurationManager extends NitroManager implements IConfiguration
fetch(url)
.then(response => response.json())
.then(data => this.onConfigurationLoaded(data))
.then(data => this.onConfigurationLoaded(data, url))
.catch(err => this.onConfigurationFailed(err));
}
private onConfigurationLoaded(data: { [index: string]: any }): void
private onConfigurationLoaded(data: { [index: string]: any }, url: string): void
{
if(!data) return;
if(this.parseConfiguration(data))
{
this.dispatchConfigurationEvent(ConfigurationEvent.LOADED);
const index = this._pendingUrls.indexOf(url);
if(index >= 0) this._pendingUrls.splice(index, 1);
this.loadNextConfiguration();
return;
}

View File

@ -1,10 +1,3 @@
export * from './AdvancedMap';
export * from './INitroPoint';
export * from './NitroAdjustmentFilter';
export * from './NitroContainer';
export * from './NitroFilter';
export * from './NitroPoint';
export * from './NitroRectangle';
export * from './NitroSprite';
export * from './NitroTexture';
export * from './NitroTimer';
export * from './proxy';

View File

@ -0,0 +1,4 @@
import { RenderTexture } from '@pixi/core';
export class NitroRenderTexture extends RenderTexture
{}

View File

@ -0,0 +1,4 @@
import { Application } from '@pixi/app';
export class PixiApplicationProxy extends Application
{}

View File

@ -0,0 +1,4 @@
import { InteractionEvent } from '@pixi/interaction';
export class PixiInteractionEventProxy extends InteractionEvent
{}

View File

@ -0,0 +1,4 @@
import { Loader } from '@pixi/loaders';
export class PixiLoaderProxy extends Loader
{}

View File

@ -0,0 +1,12 @@
export * from './INitroPoint';
export * from './NitroAdjustmentFilter';
export * from './NitroContainer';
export * from './NitroFilter';
export * from './NitroPoint';
export * from './NitroRectangle';
export * from './NitroRenderTexture';
export * from './NitroSprite';
export * from './NitroTexture';
export * from './PixiApplicationProxy';
export * from './PixiInteractionEventProxy';
export * from './PixiLoaderProxy';

View File

@ -217,8 +217,8 @@ export class Nitro extends Application implements INitro
private onConfigurationLoadedEvent(event: ConfigurationEvent): void
{
const animationFPS = this.getConfiguration<number>('animation.fps', 24);
const limitsFPS = this.getConfiguration<boolean>('limits.fps', true);
const animationFPS = this.getConfiguration<number>('system.animation.fps', 24);
const limitsFPS = this.getConfiguration<boolean>('system.limits.fps', true);
if(limitsFPS) Nitro.instance.ticker.maxFPS = animationFPS;
}

View File

@ -84,7 +84,7 @@ export class NitroCommunicationDemo extends NitroManager
this.dispatchCommunicationDemoEvent(NitroCommunicationDemoEvent.CONNECTION_ESTABLISHED, connection);
if(Nitro.instance.getConfiguration<boolean>('communication.pong.manually', false)) this.startPonging();
if(Nitro.instance.getConfiguration<boolean>('system.pong.manually', false)) this.startPonging();
this.startHandshake(connection);
@ -177,7 +177,7 @@ export class NitroCommunicationDemo extends NitroManager
{
this.stopPonging();
this._pongInterval = setInterval(this.sendPong, Nitro.instance.getConfiguration<number>('communication.pong.interval.ms', 20000));
this._pongInterval = setInterval(this.sendPong, Nitro.instance.getConfiguration<number>('system.pong.interval.ms', 20000));
}
private stopPonging(): void

View File

@ -25,8 +25,9 @@ export class FurnitureExternalImageVisualization extends FurnitureDynamicThumbna
if(!jsonString || jsonString === '') return null;
if(this.object.type.indexOf('') >= 0)
{
this._typePrefix = (this.object.type.indexOf('') >= 0) ? '' : 'postcards/selfie/';
}
const json = JSON.parse(jsonString);

View File

@ -139,8 +139,8 @@ export class LandscapeRasterizer extends PlaneRasterizer
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>('animation.fps') : 0;
const speedY = item.speedY ? item.speedY / Nitro.instance.getConfiguration<number>('animation.fps') : 0;
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;
animationItems.push({
asset: assetId,

View File

@ -74,7 +74,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
this._container = container;
this._geometry = new RoomGeometry(scale, new Vector3d(-135, 30, 0), new Vector3d(11, 11, 5), new Vector3d(-135, 0.5, 0));
this._animationFPS = Nitro.instance.getConfiguration<number>('animation.fps', 24);
this._animationFPS = Nitro.instance.getConfiguration<number>('system.animation.fps', 24);
this._renderTimestamp = 0;
this._totalTimeRunning = 0;
this._lastFrame = 0;