mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-27 01:40:52 +01:00
Move pixi-proxy files
This commit is contained in:
parent
7dc36f2e77
commit
894680ed36
@ -1,4 +1,4 @@
|
|||||||
import { NitroBaseTexture, NitroFilter } from './proxy';
|
import { NitroBaseTexture, NitroFilter } from '../../pixi-proxy';
|
||||||
|
|
||||||
const vertex = `
|
const vertex = `
|
||||||
attribute vec2 aVertexPosition;
|
attribute vec2 aVertexPosition;
|
||||||
@ -66,7 +66,7 @@ export class PaletteMapFilter extends NitroFilter
|
|||||||
{
|
{
|
||||||
const lut = [];
|
const lut = [];
|
||||||
|
|
||||||
for(let i = 0; i < data.length; i++)
|
for (let i = 0; i < data.length; i++)
|
||||||
{
|
{
|
||||||
// R
|
// R
|
||||||
lut[(i * 4) + PaletteMapFilter.CHANNEL_RED] = ((data[i] >> 16) & 0xFF);
|
lut[(i * 4) + PaletteMapFilter.CHANNEL_RED] = ((data[i] >> 16) & 0xFF);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
export * from './AdvancedMap';
|
export * from './AdvancedMap';
|
||||||
export * from './ArrayBufferToBase64';
|
export * from './ArrayBufferToBase64';
|
||||||
export * from './NitroTimer';
|
export * from './NitroTimer';
|
||||||
export * from './proxy';
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
export * from './api';
|
export * from './api';
|
||||||
export * from './core';
|
export * from './core';
|
||||||
export * from './nitro';
|
export * from './nitro';
|
||||||
|
export * from './pixi-proxy';
|
||||||
export * from './room';
|
export * from './room';
|
||||||
|
@ -4,9 +4,9 @@ import { ColorMatrixFilter } from '@pixi/filter-color-matrix';
|
|||||||
import { Rectangle } from '@pixi/math';
|
import { Rectangle } from '@pixi/math';
|
||||||
import { Sprite } from '@pixi/sprite';
|
import { Sprite } from '@pixi/sprite';
|
||||||
import { IGraphicAsset } from '../../api';
|
import { IGraphicAsset } from '../../api';
|
||||||
import { NitroContainer, NitroSprite } from '../../core';
|
|
||||||
import { AdvancedMap } from '../../core/utils/AdvancedMap';
|
import { AdvancedMap } from '../../core/utils/AdvancedMap';
|
||||||
import { PaletteMapFilter } from '../../core/utils/PaletteMapFilter';
|
import { PaletteMapFilter } from '../../core/utils/PaletteMapFilter';
|
||||||
|
import { NitroContainer, NitroSprite } from '../../pixi-proxy';
|
||||||
import { TextureUtils } from '../../room/utils/TextureUtils';
|
import { TextureUtils } from '../../room/utils/TextureUtils';
|
||||||
import { Nitro } from '../Nitro';
|
import { Nitro } from '../Nitro';
|
||||||
import { ActiveActionData } from './actions/ActiveActionData';
|
import { ActiveActionData } from './actions/ActiveActionData';
|
||||||
|
154
src/nitro/avatar/cache/AvatarImageCache.ts
vendored
154
src/nitro/avatar/cache/AvatarImageCache.ts
vendored
@ -1,6 +1,6 @@
|
|||||||
import { Texture } from '@pixi/core';
|
import { Texture } from '@pixi/core';
|
||||||
import { Matrix, Point, Rectangle } from '@pixi/math';
|
import { Matrix, Point, Rectangle } from '@pixi/math';
|
||||||
import { NitroContainer, NitroSprite } from '../../../core';
|
import { NitroContainer, NitroSprite } from '../../../pixi-proxy';
|
||||||
import { RoomObjectSpriteData } from '../../../room/data/RoomObjectSpriteData';
|
import { RoomObjectSpriteData } from '../../../room/data/RoomObjectSpriteData';
|
||||||
import { Nitro } from '../../Nitro';
|
import { Nitro } from '../../Nitro';
|
||||||
import { IActiveActionData } from '../actions/IActiveActionData';
|
import { IActiveActionData } from '../actions/IActiveActionData';
|
||||||
@ -52,7 +52,7 @@ export class AvatarImageCache
|
|||||||
|
|
||||||
public dispose(): void
|
public dispose(): void
|
||||||
{
|
{
|
||||||
if(this._disposed) return;
|
if (this._disposed) return;
|
||||||
|
|
||||||
this._structure = null;
|
this._structure = null;
|
||||||
this._avatar = null;
|
this._avatar = null;
|
||||||
@ -60,11 +60,11 @@ export class AvatarImageCache
|
|||||||
this._canvas = null;
|
this._canvas = null;
|
||||||
this._disposed = true;
|
this._disposed = true;
|
||||||
|
|
||||||
if(this._cache)
|
if (this._cache)
|
||||||
{
|
{
|
||||||
for(const cache of this._cache.values())
|
for (const cache of this._cache.values())
|
||||||
{
|
{
|
||||||
if(!cache) continue;
|
if (!cache) continue;
|
||||||
|
|
||||||
cache.dispose();
|
cache.dispose();
|
||||||
}
|
}
|
||||||
@ -72,11 +72,11 @@ export class AvatarImageCache
|
|||||||
this._cache = null;
|
this._cache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._unionImages)
|
if (this._unionImages)
|
||||||
{
|
{
|
||||||
for(const image of this._unionImages)
|
for (const image of this._unionImages)
|
||||||
{
|
{
|
||||||
if(!image) continue;
|
if (!image) continue;
|
||||||
|
|
||||||
image.dispose();
|
image.dispose();
|
||||||
}
|
}
|
||||||
@ -89,11 +89,11 @@ export class AvatarImageCache
|
|||||||
{
|
{
|
||||||
const time = Nitro.instance.time;
|
const time = Nitro.instance.time;
|
||||||
|
|
||||||
if(this._cache)
|
if (this._cache)
|
||||||
{
|
{
|
||||||
for(const cache of this._cache.values())
|
for (const cache of this._cache.values())
|
||||||
{
|
{
|
||||||
if(!cache) continue;
|
if (!cache) continue;
|
||||||
|
|
||||||
cache.disposeActions(k, time);
|
cache.disposeActions(k, time);
|
||||||
}
|
}
|
||||||
@ -102,11 +102,11 @@ export class AvatarImageCache
|
|||||||
|
|
||||||
public resetBodyPartCache(k: IActiveActionData): void
|
public resetBodyPartCache(k: IActiveActionData): void
|
||||||
{
|
{
|
||||||
if(this._cache)
|
if (this._cache)
|
||||||
{
|
{
|
||||||
for(const cache of this._cache.values())
|
for (const cache of this._cache.values())
|
||||||
{
|
{
|
||||||
if(!cache) continue;
|
if (!cache) continue;
|
||||||
|
|
||||||
cache.setAction(k, 0);
|
cache.setAction(k, 0);
|
||||||
}
|
}
|
||||||
@ -117,13 +117,13 @@ export class AvatarImageCache
|
|||||||
{
|
{
|
||||||
const parts = this._structure.getBodyPartsUnordered(k);
|
const parts = this._structure.getBodyPartsUnordered(k);
|
||||||
|
|
||||||
if(parts)
|
if (parts)
|
||||||
{
|
{
|
||||||
for(const part of parts)
|
for (const part of parts)
|
||||||
{
|
{
|
||||||
const actionCache = this.getBodyPartCache(part);
|
const actionCache = this.getBodyPartCache(part);
|
||||||
|
|
||||||
if(!actionCache) continue;
|
if (!actionCache) continue;
|
||||||
|
|
||||||
actionCache.setDirection(_arg_2);
|
actionCache.setDirection(_arg_2);
|
||||||
}
|
}
|
||||||
@ -134,19 +134,19 @@ export class AvatarImageCache
|
|||||||
{
|
{
|
||||||
const _local_3 = this._structure.getActiveBodyPartIds(k, this._avatar);
|
const _local_3 = this._structure.getActiveBodyPartIds(k, this._avatar);
|
||||||
|
|
||||||
for(const _local_4 of _local_3)
|
for (const _local_4 of _local_3)
|
||||||
{
|
{
|
||||||
const _local_5 = this.getBodyPartCache(_local_4);
|
const _local_5 = this.getBodyPartCache(_local_4);
|
||||||
|
|
||||||
if(_local_5) _local_5.setAction(k, _arg_2);
|
if (_local_5) _local_5.setAction(k, _arg_2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public setGeometryType(k: string): void
|
public setGeometryType(k: string): void
|
||||||
{
|
{
|
||||||
if(this._geometryType === k) return;
|
if (this._geometryType === k) return;
|
||||||
|
|
||||||
if((((this._geometryType === GeometryType.SITTING) && (k === GeometryType.VERTICAL)) || ((this._geometryType === GeometryType.VERTICAL) && (k === GeometryType.SITTING)) || ((this._geometryType === GeometryType.SNOWWARS_HORIZONTAL) && (k = GeometryType.SNOWWARS_HORIZONTAL))))
|
if ((((this._geometryType === GeometryType.SITTING) && (k === GeometryType.VERTICAL)) || ((this._geometryType === GeometryType.VERTICAL) && (k === GeometryType.SITTING)) || ((this._geometryType === GeometryType.SNOWWARS_HORIZONTAL) && (k = GeometryType.SNOWWARS_HORIZONTAL))))
|
||||||
{
|
{
|
||||||
this._geometryType = k;
|
this._geometryType = k;
|
||||||
this._canvas = null;
|
this._canvas = null;
|
||||||
@ -164,7 +164,7 @@ export class AvatarImageCache
|
|||||||
{
|
{
|
||||||
let _local_4 = this.getBodyPartCache(k);
|
let _local_4 = this.getBodyPartCache(k);
|
||||||
|
|
||||||
if(!_local_4)
|
if (!_local_4)
|
||||||
{
|
{
|
||||||
_local_4 = new AvatarImageBodyPartCache();
|
_local_4 = new AvatarImageBodyPartCache();
|
||||||
|
|
||||||
@ -175,48 +175,48 @@ export class AvatarImageCache
|
|||||||
let _local_7 = _local_4.getAction();
|
let _local_7 = _local_4.getAction();
|
||||||
let frameCount = frameNumber;
|
let frameCount = frameNumber;
|
||||||
|
|
||||||
if(_local_7.definition.startFromFrameZero) frameCount -= _local_7.startFrame;
|
if (_local_7.definition.startFromFrameZero) frameCount -= _local_7.startFrame;
|
||||||
|
|
||||||
let _local_8 = _local_7;
|
let _local_8 = _local_7;
|
||||||
let _local_9: string[] = [];
|
let _local_9: string[] = [];
|
||||||
let _local_10: Map<string, string> = new Map();
|
let _local_10: Map<string, string> = new Map();
|
||||||
const _local_11 = new Point();
|
const _local_11 = new Point();
|
||||||
|
|
||||||
if(!((!(_local_7)) || (!(_local_7.definition))))
|
if (!((!(_local_7)) || (!(_local_7.definition))))
|
||||||
{
|
{
|
||||||
if(_local_7.definition.isAnimation)
|
if (_local_7.definition.isAnimation)
|
||||||
{
|
{
|
||||||
let _local_15 = _local_5;
|
let _local_15 = _local_5;
|
||||||
|
|
||||||
const _local_16 = this._structure.getAnimation(((_local_7.definition.state + '.') + _local_7.actionParameter));
|
const _local_16 = this._structure.getAnimation(((_local_7.definition.state + '.') + _local_7.actionParameter));
|
||||||
const _local_17 = (frameNumber - _local_7.startFrame);
|
const _local_17 = (frameNumber - _local_7.startFrame);
|
||||||
|
|
||||||
if(_local_16)
|
if (_local_16)
|
||||||
{
|
{
|
||||||
const _local_18 = _local_16.getLayerData(_local_17, k, _local_7.overridingAction);
|
const _local_18 = _local_16.getLayerData(_local_17, k, _local_7.overridingAction);
|
||||||
|
|
||||||
if(_local_18)
|
if (_local_18)
|
||||||
{
|
{
|
||||||
_local_15 = (_local_5 + _local_18.dd);
|
_local_15 = (_local_5 + _local_18.dd);
|
||||||
|
|
||||||
if(_local_18.dd < 0)
|
if (_local_18.dd < 0)
|
||||||
{
|
{
|
||||||
if(_local_15 < 0)
|
if (_local_15 < 0)
|
||||||
{
|
{
|
||||||
_local_15 = (8 + _local_15);
|
_local_15 = (8 + _local_15);
|
||||||
}
|
}
|
||||||
else if(_local_15 > 7) _local_15 = (8 - _local_15);
|
else if (_local_15 > 7) _local_15 = (8 - _local_15);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(_local_15 < 0)
|
if (_local_15 < 0)
|
||||||
{
|
{
|
||||||
_local_15 = (_local_15 + 8);
|
_local_15 = (_local_15 + 8);
|
||||||
}
|
}
|
||||||
else if(_local_15 > 7) _local_15 = (_local_15 - 8);
|
else if (_local_15 > 7) _local_15 = (_local_15 - 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._scale === AvatarScaleType.LARGE)
|
if (this._scale === AvatarScaleType.LARGE)
|
||||||
{
|
{
|
||||||
_local_11.x = _local_18.dx;
|
_local_11.x = _local_18.dx;
|
||||||
_local_11.y = _local_18.dy;
|
_local_11.y = _local_18.dy;
|
||||||
@ -229,21 +229,21 @@ export class AvatarImageCache
|
|||||||
|
|
||||||
frameCount = _local_18.animationFrame;
|
frameCount = _local_18.animationFrame;
|
||||||
|
|
||||||
if(_local_18.action)
|
if (_local_18.action)
|
||||||
{
|
{
|
||||||
_local_7 = _local_18.action;
|
_local_7 = _local_18.action;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_local_18.type === AvatarAnimationLayerData.BODYPART)
|
if (_local_18.type === AvatarAnimationLayerData.BODYPART)
|
||||||
{
|
{
|
||||||
if(_local_18.action != null)
|
if (_local_18.action != null)
|
||||||
{
|
{
|
||||||
_local_8 = _local_18.action;
|
_local_8 = _local_18.action;
|
||||||
}
|
}
|
||||||
|
|
||||||
_local_5 = _local_15;
|
_local_5 = _local_15;
|
||||||
}
|
}
|
||||||
else if(_local_18.type === AvatarAnimationLayerData.FX) _local_5 = _local_15;
|
else if (_local_18.type === AvatarAnimationLayerData.FX) _local_5 = _local_15;
|
||||||
|
|
||||||
_local_10 = _local_18.items;
|
_local_10 = _local_18.items;
|
||||||
}
|
}
|
||||||
@ -255,7 +255,7 @@ export class AvatarImageCache
|
|||||||
|
|
||||||
let _local_12 = _local_4.getActionCache(_local_8);
|
let _local_12 = _local_4.getActionCache(_local_8);
|
||||||
|
|
||||||
if(!_local_12 || _arg_3)
|
if (!_local_12 || _arg_3)
|
||||||
{
|
{
|
||||||
_local_12 = new AvatarImageActionCache();
|
_local_12 = new AvatarImageActionCache();
|
||||||
_local_4.updateActionCache(_local_8, _local_12);
|
_local_4.updateActionCache(_local_8, _local_12);
|
||||||
@ -263,7 +263,7 @@ export class AvatarImageCache
|
|||||||
|
|
||||||
let _local_13 = _local_12.getDirectionCache(_local_5);
|
let _local_13 = _local_12.getDirectionCache(_local_5);
|
||||||
|
|
||||||
if(!_local_13 || _arg_3)
|
if (!_local_13 || _arg_3)
|
||||||
{
|
{
|
||||||
const _local_19 = this._structure.getParts(k, this._avatar.getFigure(), _local_8, this._geometryType, _local_5, _local_9, this._avatar, _local_10);
|
const _local_19 = this._structure.getParts(k, this._avatar.getFigure(), _local_8, this._geometryType, _local_5, _local_9, this._avatar, _local_10);
|
||||||
|
|
||||||
@ -274,15 +274,15 @@ export class AvatarImageCache
|
|||||||
|
|
||||||
let _local_14 = _local_13.getImageContainer(frameCount);
|
let _local_14 = _local_13.getImageContainer(frameCount);
|
||||||
|
|
||||||
if(!_local_14 || _arg_3)
|
if (!_local_14 || _arg_3)
|
||||||
{
|
{
|
||||||
const _local_20 = _local_13.getPartList();
|
const _local_20 = _local_13.getPartList();
|
||||||
|
|
||||||
_local_14 = this.renderBodyPart(_local_5, _local_20, frameCount, _local_7, _arg_3);
|
_local_14 = this.renderBodyPart(_local_5, _local_20, frameCount, _local_7, _arg_3);
|
||||||
|
|
||||||
if(_local_14 && !_arg_3)
|
if (_local_14 && !_arg_3)
|
||||||
{
|
{
|
||||||
if(_local_14.isCacheable) _local_13.updateImageContainer(_local_14, frameCount);
|
if (_local_14.isCacheable) _local_13.updateImageContainer(_local_14, frameCount);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -311,7 +311,7 @@ export class AvatarImageCache
|
|||||||
{
|
{
|
||||||
let existing = this._cache.get(k);
|
let existing = this._cache.get(k);
|
||||||
|
|
||||||
if(!existing)
|
if (!existing)
|
||||||
{
|
{
|
||||||
existing = new AvatarImageBodyPartCache();
|
existing = new AvatarImageBodyPartCache();
|
||||||
|
|
||||||
@ -323,13 +323,13 @@ export class AvatarImageCache
|
|||||||
|
|
||||||
private renderBodyPart(direction: number, containers: AvatarImagePartContainer[], frameCount: number, _arg_4: IActiveActionData, renderServerData: boolean = false): AvatarImageBodyPartContainer
|
private renderBodyPart(direction: number, containers: AvatarImagePartContainer[], frameCount: number, _arg_4: IActiveActionData, renderServerData: boolean = false): AvatarImageBodyPartContainer
|
||||||
{
|
{
|
||||||
if(!containers || !containers.length) return null;
|
if (!containers || !containers.length) return null;
|
||||||
|
|
||||||
if(!this._canvas)
|
if (!this._canvas)
|
||||||
{
|
{
|
||||||
this._canvas = this._structure.getCanvas(this._scale, this._geometryType);
|
this._canvas = this._structure.getCanvas(this._scale, this._geometryType);
|
||||||
|
|
||||||
if(!this._canvas) return null;
|
if (!this._canvas) return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const isFlipped = AvatarDirectionAngle.DIRECTION_IS_FLIPPED[direction] || false;
|
const isFlipped = AvatarDirectionAngle.DIRECTION_IS_FLIPPED[direction] || false;
|
||||||
@ -337,15 +337,15 @@ export class AvatarImageCache
|
|||||||
let isCacheable = true;
|
let isCacheable = true;
|
||||||
let containerIndex = (containers.length - 1);
|
let containerIndex = (containers.length - 1);
|
||||||
|
|
||||||
while(containerIndex >= 0)
|
while (containerIndex >= 0)
|
||||||
{
|
{
|
||||||
const container = containers[containerIndex];
|
const container = containers[containerIndex];
|
||||||
|
|
||||||
let color = 16777215;
|
let color = 16777215;
|
||||||
|
|
||||||
if(!((direction == 7) && ((container.partType === 'fc') || (container.partType === 'ey'))))
|
if (!((direction == 7) && ((container.partType === 'fc') || (container.partType === 'ey'))))
|
||||||
{
|
{
|
||||||
if(!((container.partType === 'ri') && !container.partId))
|
if (!((container.partType === 'ri') && !container.partId))
|
||||||
{
|
{
|
||||||
const partId = container.partId;
|
const partId = container.partId;
|
||||||
const animationFrame = container.getFrameDefinition(frameCount);
|
const animationFrame = container.getFrameDefinition(frameCount);
|
||||||
@ -353,59 +353,59 @@ export class AvatarImageCache
|
|||||||
let partType = container.partType;
|
let partType = container.partType;
|
||||||
let frameNumber = 0;
|
let frameNumber = 0;
|
||||||
|
|
||||||
if(animationFrame)
|
if (animationFrame)
|
||||||
{
|
{
|
||||||
frameNumber = animationFrame.number;
|
frameNumber = animationFrame.number;
|
||||||
|
|
||||||
if((animationFrame.assetPartDefinition) && (animationFrame.assetPartDefinition !== '')) assetPartDefinition = animationFrame.assetPartDefinition;
|
if ((animationFrame.assetPartDefinition) && (animationFrame.assetPartDefinition !== '')) assetPartDefinition = animationFrame.assetPartDefinition;
|
||||||
}
|
}
|
||||||
else frameNumber = container.getFrameIndex(frameCount);
|
else frameNumber = container.getFrameIndex(frameCount);
|
||||||
|
|
||||||
let assetDirection = direction;
|
let assetDirection = direction;
|
||||||
let flipH = false;
|
let flipH = false;
|
||||||
|
|
||||||
if(isFlipped)
|
if (isFlipped)
|
||||||
{
|
{
|
||||||
if(((assetPartDefinition === 'wav') && (((partType === AvatarFigurePartType.LEFT_HAND) || (partType === AvatarFigurePartType.LEFT_SLEEVE)) || (partType === AvatarFigurePartType.LEFT_COAT_SLEEVE))) || ((assetPartDefinition === 'drk') && (((partType === AvatarFigurePartType.RIGHT_HAND) || (partType === AvatarFigurePartType.RIGHT_SLEEVE)) || (partType === AvatarFigurePartType.RIGHT_COAT_SLEEVE))) || ((assetPartDefinition === 'blw') && (partType === AvatarFigurePartType.RIGHT_HAND)) || ((assetPartDefinition === 'sig') && (partType === AvatarFigurePartType.LEFT_HAND)) || ((assetPartDefinition === 'respect') && (partType === AvatarFigurePartType.LEFT_HAND)) || (partType === AvatarFigurePartType.RIGHT_HAND_ITEM) || (partType === AvatarFigurePartType.LEFT_HAND_ITEM) || (partType === AvatarFigurePartType.CHEST_PRINT))
|
if (((assetPartDefinition === 'wav') && (((partType === AvatarFigurePartType.LEFT_HAND) || (partType === AvatarFigurePartType.LEFT_SLEEVE)) || (partType === AvatarFigurePartType.LEFT_COAT_SLEEVE))) || ((assetPartDefinition === 'drk') && (((partType === AvatarFigurePartType.RIGHT_HAND) || (partType === AvatarFigurePartType.RIGHT_SLEEVE)) || (partType === AvatarFigurePartType.RIGHT_COAT_SLEEVE))) || ((assetPartDefinition === 'blw') && (partType === AvatarFigurePartType.RIGHT_HAND)) || ((assetPartDefinition === 'sig') && (partType === AvatarFigurePartType.LEFT_HAND)) || ((assetPartDefinition === 'respect') && (partType === AvatarFigurePartType.LEFT_HAND)) || (partType === AvatarFigurePartType.RIGHT_HAND_ITEM) || (partType === AvatarFigurePartType.LEFT_HAND_ITEM) || (partType === AvatarFigurePartType.CHEST_PRINT))
|
||||||
{
|
{
|
||||||
flipH = true;
|
flipH = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(direction === 4) assetDirection = 2;
|
if (direction === 4) assetDirection = 2;
|
||||||
else if(direction === 5) assetDirection = 1;
|
else if (direction === 5) assetDirection = 1;
|
||||||
else if(direction === 6) assetDirection = 0;
|
else if (direction === 6) assetDirection = 0;
|
||||||
|
|
||||||
if(container.flippedPartType !== partType) partType = container.flippedPartType;
|
if (container.flippedPartType !== partType) partType = container.flippedPartType;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let assetName = (this._scale + '_' + assetPartDefinition + '_' + partType + '_' + partId + '_' + assetDirection + '_' + frameNumber);
|
let assetName = (this._scale + '_' + assetPartDefinition + '_' + partType + '_' + partId + '_' + assetDirection + '_' + frameNumber);
|
||||||
let asset = this._assets.getAsset(assetName);
|
let asset = this._assets.getAsset(assetName);
|
||||||
|
|
||||||
if(!asset)
|
if (!asset)
|
||||||
{
|
{
|
||||||
assetName = (this._scale + '_std_' + partType + '_' + partId + '_' + assetDirection + '_0');
|
assetName = (this._scale + '_std_' + partType + '_' + partId + '_' + assetDirection + '_0');
|
||||||
asset = this._assets.getAsset(assetName);
|
asset = this._assets.getAsset(assetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(asset)
|
if (asset)
|
||||||
{
|
{
|
||||||
const texture = asset.texture;
|
const texture = asset.texture;
|
||||||
|
|
||||||
if(!texture || !texture.valid || !texture.baseTexture)
|
if (!texture || !texture.valid || !texture.baseTexture)
|
||||||
{
|
{
|
||||||
isCacheable = false;
|
isCacheable = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(container.isColorable && container.color) color = container.color.rgb;
|
if (container.isColorable && container.color) color = container.color.rgb;
|
||||||
|
|
||||||
const offset = new Point(-(asset.x), -(asset.y));
|
const offset = new Point(-(asset.x), -(asset.y));
|
||||||
|
|
||||||
if(flipH) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 65 : 31));
|
if (flipH) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 65 : 31));
|
||||||
|
|
||||||
if(renderServerData)
|
if (renderServerData)
|
||||||
{
|
{
|
||||||
const spriteData = new RoomObjectSpriteData();
|
const spriteData = new RoomObjectSpriteData();
|
||||||
|
|
||||||
@ -417,17 +417,17 @@ export class AvatarImageCache
|
|||||||
spriteData.height = asset.rectangle.height;
|
spriteData.height = asset.rectangle.height;
|
||||||
spriteData.flipH = flipH;
|
spriteData.flipH = flipH;
|
||||||
|
|
||||||
if(assetPartDefinition === 'lay') spriteData.x = (spriteData.x + 53);
|
if (assetPartDefinition === 'lay') spriteData.x = (spriteData.x + 53);
|
||||||
|
|
||||||
if(isFlipped)
|
if (isFlipped)
|
||||||
{
|
{
|
||||||
spriteData.flipH = (!(spriteData.flipH));
|
spriteData.flipH = (!(spriteData.flipH));
|
||||||
|
|
||||||
if(spriteData.flipH) spriteData.x = (-(spriteData.x) - texture.width);
|
if (spriteData.flipH) spriteData.x = (-(spriteData.x) - texture.width);
|
||||||
else spriteData.x = (spriteData.x + 65);
|
else spriteData.x = (spriteData.x + 65);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(container.isColorable) spriteData.color = `${ color }`;
|
if (container.isColorable) spriteData.color = `${color}`;
|
||||||
|
|
||||||
this._serverRenderData.push(spriteData);
|
this._serverRenderData.push(spriteData);
|
||||||
}
|
}
|
||||||
@ -441,21 +441,21 @@ export class AvatarImageCache
|
|||||||
containerIndex--;
|
containerIndex--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this._unionImages.length) return null;
|
if (!this._unionImages.length) return null;
|
||||||
|
|
||||||
const imageData = this.createUnionImage(this._unionImages, isFlipped);
|
const imageData = this.createUnionImage(this._unionImages, isFlipped);
|
||||||
const canvasOffset = ((this._scale === AvatarScaleType.LARGE) ? (this._canvas.height - 16) : (this._canvas.height - 8));
|
const canvasOffset = ((this._scale === AvatarScaleType.LARGE) ? (this._canvas.height - 16) : (this._canvas.height - 8));
|
||||||
const offset = new Point(-(imageData.regPoint.x), (canvasOffset - imageData.regPoint.y));
|
const offset = new Point(-(imageData.regPoint.x), (canvasOffset - imageData.regPoint.y));
|
||||||
|
|
||||||
if(isFlipped && (assetPartDefinition !== 'lay')) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 67 : 31));
|
if (isFlipped && (assetPartDefinition !== 'lay')) offset.x = (offset.x + ((this._scale === AvatarScaleType.LARGE) ? 67 : 31));
|
||||||
|
|
||||||
let imageIndex = (this._unionImages.length - 1);
|
let imageIndex = (this._unionImages.length - 1);
|
||||||
|
|
||||||
while(imageIndex >= 0)
|
while (imageIndex >= 0)
|
||||||
{
|
{
|
||||||
const _local_17 = this._unionImages.pop();
|
const _local_17 = this._unionImages.pop();
|
||||||
|
|
||||||
if(_local_17) _local_17.dispose();
|
if (_local_17) _local_17.dispose();
|
||||||
|
|
||||||
imageIndex--;
|
imageIndex--;
|
||||||
}
|
}
|
||||||
@ -466,7 +466,7 @@ export class AvatarImageCache
|
|||||||
private convertColorToHex(k: number): string
|
private convertColorToHex(k: number): string
|
||||||
{
|
{
|
||||||
let _local_2: string = (k * 0xFF).toString(16);
|
let _local_2: string = (k * 0xFF).toString(16);
|
||||||
if(_local_2.length < 2)
|
if (_local_2.length < 2)
|
||||||
{
|
{
|
||||||
_local_2 = ('0' + _local_2);
|
_local_2 = ('0' + _local_2);
|
||||||
}
|
}
|
||||||
@ -477,7 +477,7 @@ export class AvatarImageCache
|
|||||||
{
|
{
|
||||||
const bounds = new Rectangle();
|
const bounds = new Rectangle();
|
||||||
|
|
||||||
for(const data of k) data && bounds.enlarge(data.offsetRect);
|
for (const data of k) data && bounds.enlarge(data.offsetRect);
|
||||||
|
|
||||||
const point = new Point(-(bounds.x), -(bounds.y));
|
const point = new Point(-(bounds.x), -(bounds.y));
|
||||||
const container = new NitroContainer();
|
const container = new NitroContainer();
|
||||||
@ -489,9 +489,9 @@ export class AvatarImageCache
|
|||||||
|
|
||||||
container.addChild(sprite);
|
container.addChild(sprite);
|
||||||
|
|
||||||
for(const data of k)
|
for (const data of k)
|
||||||
{
|
{
|
||||||
if(!data) continue;
|
if (!data) continue;
|
||||||
|
|
||||||
const texture = data.texture;
|
const texture = data.texture;
|
||||||
const color = data.colorTransform;
|
const color = data.colorTransform;
|
||||||
@ -501,9 +501,9 @@ export class AvatarImageCache
|
|||||||
regPoint.x -= data.regPoint.x;
|
regPoint.x -= data.regPoint.x;
|
||||||
regPoint.y -= data.regPoint.y;
|
regPoint.y -= data.regPoint.y;
|
||||||
|
|
||||||
if(isFlipped) regPoint.x = (container.width - (regPoint.x + data.rect.width));
|
if (isFlipped) regPoint.x = (container.width - (regPoint.x + data.rect.width));
|
||||||
|
|
||||||
if(flipH)
|
if (flipH)
|
||||||
{
|
{
|
||||||
this._matrix.a = -1;
|
this._matrix.a = -1;
|
||||||
this._matrix.tx = ((data.rect.x + data.rect.width) + regPoint.x);
|
this._matrix.tx = ((data.rect.x + data.rect.width) + regPoint.x);
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { Texture } from '@pixi/core';
|
import { Texture } from '@pixi/core';
|
||||||
import { ColorMatrix, ColorMatrixFilter } from '@pixi/filter-color-matrix';
|
import { ColorMatrix, ColorMatrixFilter } from '@pixi/filter-color-matrix';
|
||||||
import { IEventDispatcher } from '../../api';
|
import { IEventDispatcher } from '../../api';
|
||||||
import { EventDispatcher, NitroContainer, NitroSprite } from '../../core';
|
import { EventDispatcher } from '../../core';
|
||||||
|
import { NitroContainer, NitroSprite } from '../../pixi-proxy';
|
||||||
import { TextureUtils } from '../../room';
|
import { TextureUtils } from '../../room';
|
||||||
import { Nitro } from '../Nitro';
|
import { Nitro } from '../Nitro';
|
||||||
import { RoomCameraWidgetManagerEvent } from './events/RoomCameraWidgetManagerEvent';
|
import { RoomCameraWidgetManagerEvent } from './events/RoomCameraWidgetManagerEvent';
|
||||||
|
@ -2,9 +2,9 @@ import { RenderTexture, Resource, Texture } from '@pixi/core';
|
|||||||
import { Container, DisplayObject } from '@pixi/display';
|
import { Container, DisplayObject } from '@pixi/display';
|
||||||
import { Matrix, Point, Rectangle } from '@pixi/math';
|
import { Matrix, Point, Rectangle } from '@pixi/math';
|
||||||
import { IConnection, IDisposable, IMessageComposer, IUpdateReceiver } from '../../api';
|
import { IConnection, IDisposable, IMessageComposer, IUpdateReceiver } from '../../api';
|
||||||
import { NitroSprite } from '../../core';
|
|
||||||
import { NitroManager } from '../../core/common/NitroManager';
|
import { NitroManager } from '../../core/common/NitroManager';
|
||||||
import { NitroEvent } from '../../core/events/NitroEvent';
|
import { NitroEvent } from '../../core/events/NitroEvent';
|
||||||
|
import { NitroSprite } from '../../pixi-proxy';
|
||||||
import { TextureUtils } from '../../room';
|
import { TextureUtils } from '../../room';
|
||||||
import { RoomObjectEvent } from '../../room/events/RoomObjectEvent';
|
import { RoomObjectEvent } from '../../room/events/RoomObjectEvent';
|
||||||
import { RoomObjectMouseEvent } from '../../room/events/RoomObjectMouseEvent';
|
import { RoomObjectMouseEvent } from '../../room/events/RoomObjectMouseEvent';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { RenderTexture, Resource, Texture } from '@pixi/core';
|
import { RenderTexture, Resource, Texture } from '@pixi/core';
|
||||||
import { Matrix } from '@pixi/math';
|
import { Matrix } from '@pixi/math';
|
||||||
import { IGraphicAsset } from '../../../../../api';
|
import { IGraphicAsset } from '../../../../../api';
|
||||||
import { NitroSprite } from '../../../../../core/utils/proxy/NitroSprite';
|
import { NitroSprite } from '../../../../../pixi-proxy';
|
||||||
import { Nitro } from '../../../../Nitro';
|
import { Nitro } from '../../../../Nitro';
|
||||||
import { FurnitureBBVisualization } from './FurnitureBBVisualization';
|
import { FurnitureBBVisualization } from './FurnitureBBVisualization';
|
||||||
import { FurnitureBrandedImageVisualization } from './FurnitureBrandedImageVisualization';
|
import { FurnitureBrandedImageVisualization } from './FurnitureBrandedImageVisualization';
|
||||||
|
@ -3,7 +3,8 @@ import { AlphaFilter } from '@pixi/filter-alpha';
|
|||||||
import { Graphics } from '@pixi/graphics';
|
import { Graphics } from '@pixi/graphics';
|
||||||
import { Matrix } from '@pixi/math';
|
import { Matrix } from '@pixi/math';
|
||||||
import { IGraphicAsset, IParticleSystem } from '../../../../../api';
|
import { IGraphicAsset, IParticleSystem } from '../../../../../api';
|
||||||
import { AdvancedMap, NitroPoint, NitroSprite } from '../../../../../core';
|
import { AdvancedMap } from '../../../../../core';
|
||||||
|
import { NitroPoint, NitroSprite } from '../../../../../pixi-proxy';
|
||||||
import { IRoomObjectSprite } from '../../../../../room';
|
import { IRoomObjectSprite } from '../../../../../room';
|
||||||
import { Vector3D } from '../../../../avatar';
|
import { Vector3D } from '../../../../avatar';
|
||||||
import { Nitro } from '../../../../Nitro';
|
import { Nitro } from '../../../../Nitro';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NitroPoint } from '../../../../../core';
|
import { NitroPoint } from '../../../../../pixi-proxy';
|
||||||
import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization';
|
import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization';
|
||||||
|
|
||||||
export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualization
|
export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualization
|
||||||
@ -24,15 +24,15 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz
|
|||||||
|
|
||||||
protected updateAnimation(scale: number): number
|
protected updateAnimation(scale: number): number
|
||||||
{
|
{
|
||||||
if(!this._animSpeedIndex) this.initItems(scale);
|
if (!this._animSpeedIndex) this.initItems(scale);
|
||||||
|
|
||||||
let sprite = this.getSprite(2);
|
let sprite = this.getSprite(2);
|
||||||
|
|
||||||
if(sprite) this._animOffsetIndex[0] = this.getNewPoint(scale, 0);
|
if (sprite) this._animOffsetIndex[0] = this.getNewPoint(scale, 0);
|
||||||
|
|
||||||
sprite = this.getSprite(3);
|
sprite = this.getSprite(3);
|
||||||
|
|
||||||
if(sprite) this._animOffsetIndex[1] = this.getNewPoint(scale, 1);
|
if (sprite) this._animOffsetIndex[1] = this.getNewPoint(scale, 1);
|
||||||
|
|
||||||
return super.updateAnimation(scale);
|
return super.updateAnimation(scale);
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz
|
|||||||
|
|
||||||
let _local_7 = 1;
|
let _local_7 = 1;
|
||||||
|
|
||||||
if(scale == 32)
|
if (scale == 32)
|
||||||
{
|
{
|
||||||
diameter = FurniturePartyBeamerVisualization.AREA_DIAMETER_SMALL;
|
diameter = FurniturePartyBeamerVisualization.AREA_DIAMETER_SMALL;
|
||||||
_local_7 = 0.5;
|
_local_7 = 0.5;
|
||||||
@ -61,9 +61,9 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz
|
|||||||
|
|
||||||
const _local_9: number = (animationPhase + (animationDirection * animationSpeed));
|
const _local_9: number = (animationPhase + (animationDirection * animationSpeed));
|
||||||
|
|
||||||
if(Math.abs(_local_9) >= diameter)
|
if (Math.abs(_local_9) >= diameter)
|
||||||
{
|
{
|
||||||
if(animationDirection > 0)
|
if (animationDirection > 0)
|
||||||
{
|
{
|
||||||
animationPhase = (animationPhase - (_local_9 - diameter));
|
animationPhase = (animationPhase - (_local_9 - diameter));
|
||||||
}
|
}
|
||||||
@ -81,7 +81,7 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz
|
|||||||
|
|
||||||
let _local_11: number = ((animationDirection * Math.sin(Math.abs((animationPhase / 4)))) * _local_10);
|
let _local_11: number = ((animationDirection * Math.sin(Math.abs((animationPhase / 4)))) * _local_10);
|
||||||
|
|
||||||
if(animationDirection > 0)
|
if (animationDirection > 0)
|
||||||
{
|
{
|
||||||
_local_11 = (_local_11 - _local_10);
|
_local_11 = (_local_11 - _local_10);
|
||||||
}
|
}
|
||||||
@ -94,16 +94,16 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz
|
|||||||
|
|
||||||
this._animPhaseIndex[layerId] = animationPhase;
|
this._animPhaseIndex[layerId] = animationPhase;
|
||||||
|
|
||||||
if(Math.trunc(_local_11) == 0) this._animFactorIndex[layerId] = this.getRandomAmplitudeFactor();
|
if (Math.trunc(_local_11) == 0) this._animFactorIndex[layerId] = this.getRandomAmplitudeFactor();
|
||||||
|
|
||||||
return new NitroPoint(animationPhase, _local_11);
|
return new NitroPoint(animationPhase, _local_11);
|
||||||
}
|
}
|
||||||
|
|
||||||
private initItems(scale: number):void
|
private initItems(scale: number): void
|
||||||
{
|
{
|
||||||
let diameter: number;
|
let diameter: number;
|
||||||
|
|
||||||
if(scale === 32)
|
if (scale === 32)
|
||||||
{
|
{
|
||||||
diameter = FurniturePartyBeamerVisualization.AREA_DIAMETER_SMALL;
|
diameter = FurniturePartyBeamerVisualization.AREA_DIAMETER_SMALL;
|
||||||
}
|
}
|
||||||
@ -131,9 +131,9 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz
|
|||||||
|
|
||||||
protected getLayerXOffset(scale: number, direction: number, layerId: number): number
|
protected getLayerXOffset(scale: number, direction: number, layerId: number): number
|
||||||
{
|
{
|
||||||
if((layerId === 2) || (layerId === 3))
|
if ((layerId === 2) || (layerId === 3))
|
||||||
{
|
{
|
||||||
if(this._animOffsetIndex.length == 2)
|
if (this._animOffsetIndex.length == 2)
|
||||||
{
|
{
|
||||||
return this._animOffsetIndex[(layerId - 2)].x;
|
return this._animOffsetIndex[(layerId - 2)].x;
|
||||||
}
|
}
|
||||||
@ -143,9 +143,9 @@ export class FurniturePartyBeamerVisualization extends FurnitureAnimatedVisualiz
|
|||||||
|
|
||||||
protected getLayerYOffset(scale: number, direction: number, layerId: number): number
|
protected getLayerYOffset(scale: number, direction: number, layerId: number): number
|
||||||
{
|
{
|
||||||
if((layerId === 2) || (layerId === 3))
|
if ((layerId === 2) || (layerId === 3))
|
||||||
{
|
{
|
||||||
if(this._animOffsetIndex.length == 2)
|
if (this._animOffsetIndex.length == 2)
|
||||||
{
|
{
|
||||||
return this._animOffsetIndex[(layerId - 2)].y;
|
return this._animOffsetIndex[(layerId - 2)].y;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { Resource, Texture } from '@pixi/core';
|
import { Resource, Texture } from '@pixi/core';
|
||||||
import { Matrix } from '@pixi/math';
|
import { Matrix } from '@pixi/math';
|
||||||
import { IGraphicAsset } from '../../../../../api';
|
import { IGraphicAsset } from '../../../../../api';
|
||||||
import { NitroSprite, NitroTexture } from '../../../../../core';
|
import { NitroSprite, NitroTexture } from '../../../../../pixi-proxy';
|
||||||
import { TextureUtils } from '../../../../../room/utils/TextureUtils';
|
import { TextureUtils } from '../../../../../room/utils/TextureUtils';
|
||||||
import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization';
|
import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { RenderTexture, Resource, Texture } from '@pixi/core';
|
import { RenderTexture, Resource, Texture } from '@pixi/core';
|
||||||
import { Sprite } from '@pixi/sprite';
|
import { Sprite } from '@pixi/sprite';
|
||||||
import { Text } from '@pixi/text';
|
import { Text } from '@pixi/text';
|
||||||
import { NitroContainer, NitroSprite } from '../../../../../core';
|
import { NitroContainer, NitroSprite } from '../../../../../pixi-proxy';
|
||||||
import { TextureUtils } from '../../../../../room';
|
import { TextureUtils } from '../../../../../room';
|
||||||
import { Nitro } from '../../../../Nitro';
|
import { Nitro } from '../../../../Nitro';
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ export class ExperienceData
|
|||||||
|
|
||||||
public renderBubble(amount: number): RenderTexture
|
public renderBubble(amount: number): RenderTexture
|
||||||
{
|
{
|
||||||
if(!this._sprite || (this._amount === amount)) return null;
|
if (!this._sprite || (this._amount === amount)) return null;
|
||||||
|
|
||||||
const container = new NitroContainer();
|
const container = new NitroContainer();
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ export class ExperienceData
|
|||||||
|
|
||||||
container.addChild(text);
|
container.addChild(text);
|
||||||
|
|
||||||
if(!this._texture)
|
if (!this._texture)
|
||||||
{
|
{
|
||||||
this._texture = TextureUtils.generateTexture(container);
|
this._texture = TextureUtils.generateTexture(container);
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { RenderTexture, Resource, Texture } from '@pixi/core';
|
import { RenderTexture, Resource, Texture } from '@pixi/core';
|
||||||
import { Graphics } from '@pixi/graphics';
|
import { Graphics } from '@pixi/graphics';
|
||||||
import { Matrix, Point, Rectangle } from '@pixi/math';
|
import { Matrix, Point, Rectangle } from '@pixi/math';
|
||||||
import { NitroRenderTexture } from '../../../../../core';
|
import { NitroRenderTexture } from '../../../../../pixi-proxy';
|
||||||
import { IRoomPlane } from '../../../../../room/object/visualization/IRoomPlane';
|
import { IRoomPlane } from '../../../../../room/object/visualization/IRoomPlane';
|
||||||
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
|
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
|
||||||
import { IVector3D } from '../../../../../room/utils/IVector3D';
|
import { IVector3D } from '../../../../../room/utils/IVector3D';
|
||||||
@ -60,15 +60,15 @@ export class RoomPlane implements IRoomPlane
|
|||||||
private _maskBitmapData: Graphics;
|
private _maskBitmapData: Graphics;
|
||||||
private _bitmapMasksOld: RoomPlaneBitmapMask[];
|
private _bitmapMasksOld: RoomPlaneBitmapMask[];
|
||||||
private _rectangleMasksOld: RoomPlaneRectangleMask[];
|
private _rectangleMasksOld: RoomPlaneRectangleMask[];
|
||||||
private _cornerA:Vector3d;
|
private _cornerA: Vector3d;
|
||||||
private _cornerB:Vector3d;
|
private _cornerB: Vector3d;
|
||||||
private _cornerC:Vector3d;
|
private _cornerC: Vector3d;
|
||||||
private _cornerD:Vector3d;
|
private _cornerD: Vector3d;
|
||||||
private _width: number = 0;
|
private _width: number = 0;
|
||||||
private _height: number = 0;
|
private _height: number = 0;
|
||||||
private _canBeVisible: boolean;
|
private _canBeVisible: boolean;
|
||||||
|
|
||||||
constructor(origin: IVector3D, location: IVector3D, leftSide: IVector3D, rightSide: IVector3D, type: number, usesMask: boolean, secondaryNormals: IVector3D[], randomSeed: number, textureOffsetX: number=0, textureOffsetY: number=0, textureMaxX: number=0, textureMaxY: number=0)
|
constructor(origin: IVector3D, location: IVector3D, leftSide: IVector3D, rightSide: IVector3D, type: number, usesMask: boolean, secondaryNormals: IVector3D[], randomSeed: number, textureOffsetX: number = 0, textureOffsetY: number = 0, textureMaxX: number = 0, textureMaxY: number = 0)
|
||||||
{
|
{
|
||||||
this._secondaryNormals = [];
|
this._secondaryNormals = [];
|
||||||
this._bitmapMasks = [];
|
this._bitmapMasks = [];
|
||||||
@ -90,16 +90,16 @@ export class RoomPlane implements IRoomPlane
|
|||||||
this._rightSide.assign(rightSide);
|
this._rightSide.assign(rightSide);
|
||||||
this._normal = Vector3d.crossProduct(this._leftSide, this._rightSide);
|
this._normal = Vector3d.crossProduct(this._leftSide, this._rightSide);
|
||||||
|
|
||||||
if(this._normal.length > 0)
|
if (this._normal.length > 0)
|
||||||
{
|
{
|
||||||
this._normal.multiply((1 / this._normal.length));
|
this._normal.multiply((1 / this._normal.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(secondaryNormals != null)
|
if (secondaryNormals != null)
|
||||||
{
|
{
|
||||||
for(const entry of secondaryNormals)
|
for (const entry of secondaryNormals)
|
||||||
{
|
{
|
||||||
if(!entry) continue;
|
if (!entry) continue;
|
||||||
|
|
||||||
const vector = new Vector3d();
|
const vector = new Vector3d();
|
||||||
|
|
||||||
@ -142,9 +142,9 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
public set canBeVisible(k: boolean)
|
public set canBeVisible(k: boolean)
|
||||||
{
|
{
|
||||||
if(k !== this._canBeVisible)
|
if (k !== this._canBeVisible)
|
||||||
{
|
{
|
||||||
if(!this._canBeVisible) this.resetTextureCache();
|
if (!this._canBeVisible) this.resetTextureCache();
|
||||||
|
|
||||||
this._canBeVisible = k;
|
this._canBeVisible = k;
|
||||||
}
|
}
|
||||||
@ -157,11 +157,11 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
public get bitmapData(): Texture<Resource>
|
public get bitmapData(): Texture<Resource>
|
||||||
{
|
{
|
||||||
if(!this.visible || !this._bitmapData) return null;
|
if (!this.visible || !this._bitmapData) return null;
|
||||||
|
|
||||||
let texture: RenderTexture = RoomVisualization.getTextureCache(this._bitmapData);
|
let texture: RenderTexture = RoomVisualization.getTextureCache(this._bitmapData);
|
||||||
|
|
||||||
if(!texture)
|
if (!texture)
|
||||||
{
|
{
|
||||||
texture = TextureUtils.generateTexture(this._bitmapData, new Rectangle(0, 0, this._width, this._height));
|
texture = TextureUtils.generateTexture(this._bitmapData, new Rectangle(0, 0, this._width, this._height));
|
||||||
|
|
||||||
@ -231,7 +231,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
this._hasTexture = k;
|
this._hasTexture = k;
|
||||||
}
|
}
|
||||||
|
|
||||||
public set rasterizer(k:IPlaneRasterizer)
|
public set rasterizer(k: IPlaneRasterizer)
|
||||||
{
|
{
|
||||||
this._rasterizer = k;
|
this._rasterizer = k;
|
||||||
}
|
}
|
||||||
@ -243,7 +243,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
public set id(k: string)
|
public set id(k: string)
|
||||||
{
|
{
|
||||||
if(k === this._id) return;
|
if (k === this._id) return;
|
||||||
|
|
||||||
this.resetTextureCache();
|
this.resetTextureCache();
|
||||||
this._id = k;
|
this._id = k;
|
||||||
@ -256,20 +256,20 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
public dispose(): void
|
public dispose(): void
|
||||||
{
|
{
|
||||||
if(this._bitmapData)
|
if (this._bitmapData)
|
||||||
{
|
{
|
||||||
this._bitmapData.destroy();
|
this._bitmapData.destroy();
|
||||||
|
|
||||||
this._bitmapData = null;
|
this._bitmapData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._textures)
|
if (this._textures)
|
||||||
{
|
{
|
||||||
for(const bitmap of this._textures.values())
|
for (const bitmap of this._textures.values())
|
||||||
{
|
{
|
||||||
if(!bitmap) continue;
|
if (!bitmap) continue;
|
||||||
|
|
||||||
if(bitmap.bitmap) bitmap.bitmap.destroy();
|
if (bitmap.bitmap) bitmap.bitmap.destroy();
|
||||||
|
|
||||||
bitmap.dispose();
|
bitmap.dispose();
|
||||||
}
|
}
|
||||||
@ -291,7 +291,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
this._bitmapMasks = null;
|
this._bitmapMasks = null;
|
||||||
this._rectangleMasks = null;
|
this._rectangleMasks = null;
|
||||||
|
|
||||||
if(this._maskBitmapData)
|
if (this._maskBitmapData)
|
||||||
{
|
{
|
||||||
this._maskBitmapData.destroy();
|
this._maskBitmapData.destroy();
|
||||||
|
|
||||||
@ -303,9 +303,9 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
public copyBitmapData(k: Texture<Resource>): Texture<Resource>
|
public copyBitmapData(k: Texture<Resource>): Texture<Resource>
|
||||||
{
|
{
|
||||||
if(!this.visible || !this._bitmapData || !k) return null;
|
if (!this.visible || !this._bitmapData || !k) return null;
|
||||||
|
|
||||||
if((this._bitmapData.width !== k.width) || (this._bitmapData.height !== k.height)) return null;
|
if ((this._bitmapData.width !== k.width) || (this._bitmapData.height !== k.height)) return null;
|
||||||
|
|
||||||
//k.copyPixels(this._bitmapData, this._bitmapData.rect, RoomPlane.ZERO_POINT);
|
//k.copyPixels(this._bitmapData, this._bitmapData.rect, RoomPlane.ZERO_POINT);
|
||||||
return k;
|
return k;
|
||||||
@ -315,7 +315,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
{
|
{
|
||||||
const existing = this._textures.get(k);
|
const existing = this._textures.get(k);
|
||||||
|
|
||||||
if(existing)
|
if (existing)
|
||||||
{
|
{
|
||||||
this._textures.delete(k);
|
this._textures.delete(k);
|
||||||
|
|
||||||
@ -330,11 +330,11 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
private resetTextureCache(k: Graphics = null): void
|
private resetTextureCache(k: Graphics = null): void
|
||||||
{
|
{
|
||||||
if(this._textures && this._textures.size)
|
if (this._textures && this._textures.size)
|
||||||
{
|
{
|
||||||
for(const bitmap of this._textures.values())
|
for (const bitmap of this._textures.values())
|
||||||
{
|
{
|
||||||
if(!bitmap) continue;
|
if (!bitmap) continue;
|
||||||
|
|
||||||
bitmap.dispose();
|
bitmap.dispose();
|
||||||
}
|
}
|
||||||
@ -347,43 +347,43 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
private getTextureIdentifier(k: number): string
|
private getTextureIdentifier(k: number): string
|
||||||
{
|
{
|
||||||
if(this._rasterizer) return this._rasterizer.getTextureIdentifier(k, this.normal);
|
if (this._rasterizer) return this._rasterizer.getTextureIdentifier(k, this.normal);
|
||||||
|
|
||||||
return k.toString();
|
return k.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private needsNewTexture(k: IRoomGeometry, _arg_2: number): boolean
|
private needsNewTexture(k: IRoomGeometry, _arg_2: number): boolean
|
||||||
{
|
{
|
||||||
if(!k) return false;
|
if (!k) return false;
|
||||||
|
|
||||||
let planeBitmap = this._activeTexture;
|
let planeBitmap = this._activeTexture;
|
||||||
|
|
||||||
if(!planeBitmap)
|
if (!planeBitmap)
|
||||||
{
|
{
|
||||||
planeBitmap = this._textures.get(this.getTextureIdentifier(k.scale));
|
planeBitmap = this._textures.get(this.getTextureIdentifier(k.scale));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateMaskChangeStatus();
|
this.updateMaskChangeStatus();
|
||||||
|
|
||||||
if(this._canBeVisible && ((!planeBitmap || ((planeBitmap.timeStamp >= 0) && (_arg_2 > planeBitmap.timeStamp))) || this._maskChanged)) return true;
|
if (this._canBeVisible && ((!planeBitmap || ((planeBitmap.timeStamp >= 0) && (_arg_2 > planeBitmap.timeStamp))) || this._maskChanged)) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getTexture(k: IRoomGeometry, _arg_2: number): Graphics
|
private getTexture(k: IRoomGeometry, _arg_2: number): Graphics
|
||||||
{
|
{
|
||||||
if(!k) return null;
|
if (!k) return null;
|
||||||
|
|
||||||
let _local_3: PlaneBitmapData = null;
|
let _local_3: PlaneBitmapData = null;
|
||||||
|
|
||||||
if(this.needsNewTexture(k, _arg_2))
|
if (this.needsNewTexture(k, _arg_2))
|
||||||
{
|
{
|
||||||
const _local_4 = this.getTextureIdentifier(k.scale);
|
const _local_4 = this.getTextureIdentifier(k.scale);
|
||||||
const _local_5 = (this._leftSide.length * k.scale);
|
const _local_5 = (this._leftSide.length * k.scale);
|
||||||
const _local_6 = (this._rightSide.length * k.scale);
|
const _local_6 = (this._rightSide.length * k.scale);
|
||||||
const _local_7 = k.getCoordinatePosition(this._normal);
|
const _local_7 = k.getCoordinatePosition(this._normal);
|
||||||
|
|
||||||
if(this._activeTexture)
|
if (this._activeTexture)
|
||||||
{
|
{
|
||||||
_local_3 = this._activeTexture;
|
_local_3 = this._activeTexture;
|
||||||
}
|
}
|
||||||
@ -394,15 +394,15 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
let _local_8: Graphics = null;
|
let _local_8: Graphics = null;
|
||||||
|
|
||||||
if(_local_3) _local_8 = _local_3.bitmap;
|
if (_local_3) _local_8 = _local_3.bitmap;
|
||||||
|
|
||||||
if(this._rasterizer)
|
if (this._rasterizer)
|
||||||
{
|
{
|
||||||
_local_3 = this._rasterizer.render(_local_8, this._id, _local_5, _local_6, k.scale, _local_7, this._hasTexture, this._textureOffsetX, this._textureOffsetY, this._textureMaxX, this._textureMaxY, _arg_2);
|
_local_3 = this._rasterizer.render(_local_8, this._id, _local_5, _local_6, k.scale, _local_7, this._hasTexture, this._textureOffsetX, this._textureOffsetY, this._textureMaxX, this._textureMaxY, _arg_2);
|
||||||
|
|
||||||
if(_local_3)
|
if (_local_3)
|
||||||
{
|
{
|
||||||
if(_local_8 && (_local_3.bitmap !== _local_8)) _local_8.destroy();
|
if (_local_8 && (_local_3.bitmap !== _local_8)) _local_8.destroy();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -416,7 +416,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
_local_3 = new PlaneBitmapData(_local_9, -1);
|
_local_3 = new PlaneBitmapData(_local_9, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_local_3)
|
if (_local_3)
|
||||||
{
|
{
|
||||||
this.updateMask(_local_3.bitmap, k);
|
this.updateMask(_local_3.bitmap, k);
|
||||||
this.cacheTexture(_local_4, _local_3);
|
this.cacheTexture(_local_4, _local_3);
|
||||||
@ -424,7 +424,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(this._activeTexture)
|
if (this._activeTexture)
|
||||||
{
|
{
|
||||||
_local_3 = this._activeTexture;
|
_local_3 = this._activeTexture;
|
||||||
}
|
}
|
||||||
@ -434,7 +434,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(_local_3)
|
if (_local_3)
|
||||||
{
|
{
|
||||||
this._activeTexture = _local_3;
|
this._activeTexture = _local_3;
|
||||||
|
|
||||||
@ -446,30 +446,30 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
private resolveMasks(k: IRoomGeometry): PlaneDrawingData
|
private resolveMasks(k: IRoomGeometry): PlaneDrawingData
|
||||||
{
|
{
|
||||||
if(!this._useMask) return null;
|
if (!this._useMask) return null;
|
||||||
|
|
||||||
const _local_5 = new PlaneDrawingData();
|
const _local_5 = new PlaneDrawingData();
|
||||||
|
|
||||||
const index = 0;
|
const index = 0;
|
||||||
|
|
||||||
while(index < this._bitmapMasks.length)
|
while (index < this._bitmapMasks.length)
|
||||||
{
|
{
|
||||||
const mask = this._bitmapMasks[index];
|
const mask = this._bitmapMasks[index];
|
||||||
|
|
||||||
if(mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
const planeMask = this._maskManager.getMask(mask.type);
|
const planeMask = this._maskManager.getMask(mask.type);
|
||||||
|
|
||||||
if(planeMask)
|
if (planeMask)
|
||||||
{
|
{
|
||||||
const assetName = planeMask.getAssetName(k.scale);
|
const assetName = planeMask.getAssetName(k.scale);
|
||||||
|
|
||||||
if(assetName)
|
if (assetName)
|
||||||
{
|
{
|
||||||
const position = k.getCoordinatePosition(this._normal);
|
const position = k.getCoordinatePosition(this._normal);
|
||||||
const asset = planeMask.getGraphicAsset(k.scale, position);
|
const asset = planeMask.getGraphicAsset(k.scale, position);
|
||||||
|
|
||||||
if(asset)
|
if (asset)
|
||||||
{
|
{
|
||||||
const _local_3 = (this._maskBitmapData.width * (1 - (mask.leftSideLoc / this._leftSide.length)));
|
const _local_3 = (this._maskBitmapData.width * (1 - (mask.leftSideLoc / this._leftSide.length)));
|
||||||
const _local_4 = (this._maskBitmapData.height * (1 - (mask.rightSideLoc / this._rightSide.length)));
|
const _local_4 = (this._maskBitmapData.height * (1 - (mask.rightSideLoc / this._rightSide.length)));
|
||||||
@ -493,24 +493,24 @@ export class RoomPlane implements IRoomPlane
|
|||||||
return Math.round((this._leftSide.length * Math.abs((_local_2.x - _local_3.x))));
|
return Math.round((this._leftSide.length * Math.abs((_local_2.x - _local_3.x))));
|
||||||
}
|
}
|
||||||
|
|
||||||
public getDrawingDatas(geometry:IRoomGeometry): PlaneDrawingData[]
|
public getDrawingDatas(geometry: IRoomGeometry): PlaneDrawingData[]
|
||||||
{
|
{
|
||||||
const drawingDatas: PlaneDrawingData[] = [];
|
const drawingDatas: PlaneDrawingData[] = [];
|
||||||
|
|
||||||
if(this._isVisible)
|
if (this._isVisible)
|
||||||
{
|
{
|
||||||
const maskData = this.resolveMasks(geometry);
|
const maskData = this.resolveMasks(geometry);
|
||||||
const layers = this._rasterizer.getLayers(this._id);
|
const layers = this._rasterizer.getLayers(this._id);
|
||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
while(i < layers.length)
|
while (i < layers.length)
|
||||||
{
|
{
|
||||||
const layer = (layers[i] as PlaneVisualizationLayer);
|
const layer = (layers[i] as PlaneVisualizationLayer);
|
||||||
|
|
||||||
if(layer)
|
if (layer)
|
||||||
{
|
{
|
||||||
if(this._hasTexture && layer.getMaterial())
|
if (this._hasTexture && layer.getMaterial())
|
||||||
{
|
{
|
||||||
const normal = geometry.getCoordinatePosition(this._normal);
|
const normal = geometry.getCoordinatePosition(this._normal);
|
||||||
const cm = layer.getMaterial().getMaterialCellMatrix(normal);
|
const cm = layer.getMaterial().getMaterialCellMatrix(normal);
|
||||||
@ -519,26 +519,26 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
Randomizer.setSeed(this._randomSeed);
|
Randomizer.setSeed(this._randomSeed);
|
||||||
|
|
||||||
for(const column of cm.getColumns(this.screenWidth(geometry)))
|
for (const column of cm.getColumns(this.screenWidth(geometry)))
|
||||||
{
|
{
|
||||||
const assetNames: string[] = [];
|
const assetNames: string[] = [];
|
||||||
|
|
||||||
for(const cell of column.getCells())
|
for (const cell of column.getCells())
|
||||||
{
|
{
|
||||||
const name = cell.getAssetName(normal);
|
const name = cell.getAssetName(normal);
|
||||||
|
|
||||||
if(name) assetNames.push(name);
|
if (name) assetNames.push(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(assetNames.length > 0)
|
if (assetNames.length > 0)
|
||||||
{
|
{
|
||||||
if(!column.isRepeated()) assetNames.push('');
|
if (!column.isRepeated()) assetNames.push('');
|
||||||
|
|
||||||
data.addAssetColumn(assetNames);
|
data.addAssetColumn(assetNames);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data.assetNameColumns.length > 0) drawingDatas.push(data);
|
if (data.assetNameColumns.length > 0) drawingDatas.push(data);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -552,7 +552,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!drawingDatas.length) drawingDatas.push(new PlaneDrawingData(maskData, this._color));
|
if (!drawingDatas.length) drawingDatas.push(new PlaneDrawingData(maskData, this._color));
|
||||||
}
|
}
|
||||||
|
|
||||||
return drawingDatas;
|
return drawingDatas;
|
||||||
@ -564,18 +564,18 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
public update(geometry: IRoomGeometry, timeSinceStartMs: number): boolean
|
public update(geometry: IRoomGeometry, timeSinceStartMs: number): boolean
|
||||||
{
|
{
|
||||||
if(!geometry || this._disposed) return false;
|
if (!geometry || this._disposed) return false;
|
||||||
|
|
||||||
let geometryChanged = false;
|
let geometryChanged = false;
|
||||||
|
|
||||||
if(this._geometryUpdateId != geometry.updateId) geometryChanged = true;
|
if (this._geometryUpdateId != geometry.updateId) geometryChanged = true;
|
||||||
|
|
||||||
if(!geometryChanged || !this._canBeVisible)
|
if (!geometryChanged || !this._canBeVisible)
|
||||||
{
|
{
|
||||||
if(!this.visible) return false;
|
if (!this.visible) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(geometryChanged)
|
if (geometryChanged)
|
||||||
{
|
{
|
||||||
this._activeTexture = null;
|
this._activeTexture = null;
|
||||||
|
|
||||||
@ -583,9 +583,9 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
cosAngle = Vector3d.cosAngle(geometry.directionAxis, this.normal);
|
cosAngle = Vector3d.cosAngle(geometry.directionAxis, this.normal);
|
||||||
|
|
||||||
if(cosAngle > -0.001)
|
if (cosAngle > -0.001)
|
||||||
{
|
{
|
||||||
if(this._isVisible)
|
if (this._isVisible)
|
||||||
{
|
{
|
||||||
this._isVisible = false;
|
this._isVisible = false;
|
||||||
return true;
|
return true;
|
||||||
@ -596,13 +596,13 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
while(i < this._secondaryNormals.length)
|
while (i < this._secondaryNormals.length)
|
||||||
{
|
{
|
||||||
cosAngle = Vector3d.cosAngle(geometry.directionAxis, this._secondaryNormals[i]);
|
cosAngle = Vector3d.cosAngle(geometry.directionAxis, this._secondaryNormals[i]);
|
||||||
|
|
||||||
if(cosAngle > -0.001)
|
if (cosAngle > -0.001)
|
||||||
{
|
{
|
||||||
if(this._isVisible)
|
if (this._isVisible)
|
||||||
{
|
{
|
||||||
this._isVisible = false;
|
this._isVisible = false;
|
||||||
return true;
|
return true;
|
||||||
@ -621,12 +621,12 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
let relativeDepth = (Math.max(this._cornerA.z, this._cornerB.z, this._cornerC.z, this._cornerD.z) - originZ);
|
let relativeDepth = (Math.max(this._cornerA.z, this._cornerB.z, this._cornerC.z, this._cornerD.z) - originZ);
|
||||||
|
|
||||||
if(this._type === RoomPlane.TYPE_FLOOR)
|
if (this._type === RoomPlane.TYPE_FLOOR)
|
||||||
{
|
{
|
||||||
relativeDepth = (relativeDepth - ((this._location.z + Math.min(0, this._leftSide.z, this._rightSide.z)) * 8));
|
relativeDepth = (relativeDepth - ((this._location.z + Math.min(0, this._leftSide.z, this._rightSide.z)) * 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._type === RoomPlane.TYPE_LANDSCAPE)
|
if (this._type === RoomPlane.TYPE_LANDSCAPE)
|
||||||
{
|
{
|
||||||
relativeDepth = (relativeDepth + 0.02);
|
relativeDepth = (relativeDepth + 0.02);
|
||||||
}
|
}
|
||||||
@ -636,21 +636,21 @@ export class RoomPlane implements IRoomPlane
|
|||||||
this._geometryUpdateId = geometry.updateId;
|
this._geometryUpdateId = geometry.updateId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(geometryChanged || this.needsNewTexture(geometry, timeSinceStartMs))
|
if (geometryChanged || this.needsNewTexture(geometry, timeSinceStartMs))
|
||||||
{
|
{
|
||||||
if(!this._bitmapData || (this._width !== this._bitmapData.width) || (this._height !== this._bitmapData.height))
|
if (!this._bitmapData || (this._width !== this._bitmapData.width) || (this._height !== this._bitmapData.height))
|
||||||
{
|
{
|
||||||
if(this._bitmapData)
|
if (this._bitmapData)
|
||||||
{
|
{
|
||||||
this._bitmapData.destroy();
|
this._bitmapData.destroy();
|
||||||
|
|
||||||
this._bitmapData = null;
|
this._bitmapData = null;
|
||||||
|
|
||||||
if((this._width < 1) || (this._height < 1)) return true;
|
if ((this._width < 1) || (this._height < 1)) return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if((this._width < 1) || (this._height < 1)) return false;
|
if ((this._width < 1) || (this._height < 1)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const graphic = new Graphics();
|
const graphic = new Graphics();
|
||||||
@ -661,7 +661,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
this._bitmapData = graphic;
|
this._bitmapData = graphic;
|
||||||
|
|
||||||
if(!this._bitmapData) return false;
|
if (!this._bitmapData) return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -673,7 +673,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
const texture = this.getTexture(geometry, timeSinceStartMs);
|
const texture = this.getTexture(geometry, timeSinceStartMs);
|
||||||
|
|
||||||
if(texture)
|
if (texture)
|
||||||
{
|
{
|
||||||
this.renderTexture(geometry, texture);
|
this.renderTexture(geometry, texture);
|
||||||
}
|
}
|
||||||
@ -729,7 +729,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
private renderTexture(k: IRoomGeometry, _arg_2: Graphics): void
|
private renderTexture(k: IRoomGeometry, _arg_2: Graphics): void
|
||||||
{
|
{
|
||||||
if(((((((this._cornerA == null) || (this._cornerB == null)) || (this._cornerC == null)) || (this._cornerD == null)) || (_arg_2 == null)) || (this._bitmapData == null)))
|
if (((((((this._cornerA == null) || (this._cornerB == null)) || (this._cornerC == null)) || (this._cornerD == null)) || (_arg_2 == null)) || (this._bitmapData == null)))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -737,21 +737,21 @@ export class RoomPlane implements IRoomPlane
|
|||||||
let _local_4: number = (this._cornerD.y - this._cornerC.y);
|
let _local_4: number = (this._cornerD.y - this._cornerC.y);
|
||||||
let _local_5: number = (this._cornerB.x - this._cornerC.x);
|
let _local_5: number = (this._cornerB.x - this._cornerC.x);
|
||||||
let _local_6: number = (this._cornerB.y - this._cornerC.y);
|
let _local_6: number = (this._cornerB.y - this._cornerC.y);
|
||||||
if(((this._type == RoomPlane.TYPE_WALL) || (this._type == RoomPlane.TYPE_LANDSCAPE)))
|
if (((this._type == RoomPlane.TYPE_WALL) || (this._type == RoomPlane.TYPE_LANDSCAPE)))
|
||||||
{
|
{
|
||||||
if(Math.abs((_local_5 - _arg_2.width)) <= 1)
|
if (Math.abs((_local_5 - _arg_2.width)) <= 1)
|
||||||
{
|
{
|
||||||
_local_5 = _arg_2.width;
|
_local_5 = _arg_2.width;
|
||||||
}
|
}
|
||||||
if(Math.abs((_local_6 - _arg_2.width)) <= 1)
|
if (Math.abs((_local_6 - _arg_2.width)) <= 1)
|
||||||
{
|
{
|
||||||
_local_6 = _arg_2.width;
|
_local_6 = _arg_2.width;
|
||||||
}
|
}
|
||||||
if(Math.abs((_local_3 - _arg_2.height)) <= 1)
|
if (Math.abs((_local_3 - _arg_2.height)) <= 1)
|
||||||
{
|
{
|
||||||
_local_3 = _arg_2.height;
|
_local_3 = _arg_2.height;
|
||||||
}
|
}
|
||||||
if(Math.abs((_local_4 - _arg_2.height)) <= 1)
|
if (Math.abs((_local_4 - _arg_2.height)) <= 1)
|
||||||
{
|
{
|
||||||
_local_4 = _arg_2.height;
|
_local_4 = _arg_2.height;
|
||||||
}
|
}
|
||||||
@ -781,7 +781,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
public resetBitmapMasks(): void
|
public resetBitmapMasks(): void
|
||||||
{
|
{
|
||||||
if(this._disposed || !this._useMask || !this._bitmapMasks.length) return;
|
if (this._disposed || !this._useMask || !this._bitmapMasks.length) return;
|
||||||
|
|
||||||
this._maskChanged = true;
|
this._maskChanged = true;
|
||||||
this._bitmapMasks = [];
|
this._bitmapMasks = [];
|
||||||
@ -789,17 +789,17 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
public addBitmapMask(k: string, _arg_2: number, _arg_3: number): boolean
|
public addBitmapMask(k: string, _arg_2: number, _arg_3: number): boolean
|
||||||
{
|
{
|
||||||
if(!this._useMask) return false;
|
if (!this._useMask) return false;
|
||||||
|
|
||||||
let _local_5 = 0;
|
let _local_5 = 0;
|
||||||
|
|
||||||
while(_local_5 < this._bitmapMasks.length)
|
while (_local_5 < this._bitmapMasks.length)
|
||||||
{
|
{
|
||||||
const mask = this._bitmapMasks[_local_5];
|
const mask = this._bitmapMasks[_local_5];
|
||||||
|
|
||||||
if(mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
if((((mask.type === k) && (mask.leftSideLoc === _arg_2)) && (mask.rightSideLoc === _arg_3))) return false;
|
if ((((mask.type === k) && (mask.leftSideLoc === _arg_2)) && (mask.rightSideLoc === _arg_3))) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_local_5++;
|
_local_5++;
|
||||||
@ -815,7 +815,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
public resetRectangleMasks(): void
|
public resetRectangleMasks(): void
|
||||||
{
|
{
|
||||||
if(!this._useMask || !this._rectangleMasks.length) return;
|
if (!this._useMask || !this._rectangleMasks.length) return;
|
||||||
|
|
||||||
this._maskChanged = true;
|
this._maskChanged = true;
|
||||||
this._rectangleMasks = [];
|
this._rectangleMasks = [];
|
||||||
@ -823,13 +823,13 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
public addRectangleMask(k: number, _arg_2: number, _arg_3: number, _arg_4: number): boolean
|
public addRectangleMask(k: number, _arg_2: number, _arg_3: number, _arg_4: number): boolean
|
||||||
{
|
{
|
||||||
if(this._useMask)
|
if (this._useMask)
|
||||||
{
|
{
|
||||||
for(const mask of this._rectangleMasks)
|
for (const mask of this._rectangleMasks)
|
||||||
{
|
{
|
||||||
if(!mask) continue;
|
if (!mask) continue;
|
||||||
|
|
||||||
if((((mask.leftSideLoc === k) && (mask.rightSideLoc === _arg_2)) && (mask.leftSideLength === _arg_3)) && (mask.rightSideLength === _arg_4)) return false;
|
if ((((mask.leftSideLoc === k) && (mask.rightSideLoc === _arg_2)) && (mask.leftSideLength === _arg_3)) && (mask.rightSideLength === _arg_4)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const _local_5 = new RoomPlaneRectangleMask(k, _arg_2, _arg_3, _arg_4);
|
const _local_5 = new RoomPlaneRectangleMask(k, _arg_2, _arg_3, _arg_4);
|
||||||
@ -845,24 +845,24 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
private updateMaskChangeStatus(): void
|
private updateMaskChangeStatus(): void
|
||||||
{
|
{
|
||||||
if(!this._maskChanged) return;
|
if (!this._maskChanged) return;
|
||||||
|
|
||||||
let _local_3 = true;
|
let _local_3 = true;
|
||||||
let _local_6: boolean;
|
let _local_6: boolean;
|
||||||
|
|
||||||
if(this._bitmapMasks.length === this._bitmapMasksOld.length)
|
if (this._bitmapMasks.length === this._bitmapMasksOld.length)
|
||||||
{
|
{
|
||||||
for(const mask of this._bitmapMasks)
|
for (const mask of this._bitmapMasks)
|
||||||
{
|
{
|
||||||
if(!mask) continue;
|
if (!mask) continue;
|
||||||
|
|
||||||
_local_6 = false;
|
_local_6 = false;
|
||||||
|
|
||||||
for(const plane of this._bitmapMasksOld)
|
for (const plane of this._bitmapMasksOld)
|
||||||
{
|
{
|
||||||
if(!plane) continue;
|
if (!plane) continue;
|
||||||
|
|
||||||
if(((plane.type === mask.type) && (plane.leftSideLoc === mask.leftSideLoc)) && (plane.rightSideLoc === mask.rightSideLoc))
|
if (((plane.type === mask.type) && (plane.leftSideLoc === mask.leftSideLoc)) && (plane.rightSideLoc === mask.rightSideLoc))
|
||||||
{
|
{
|
||||||
_local_6 = true;
|
_local_6 = true;
|
||||||
|
|
||||||
@ -870,7 +870,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!_local_6)
|
if (!_local_6)
|
||||||
{
|
{
|
||||||
_local_3 = false;
|
_local_3 = false;
|
||||||
|
|
||||||
@ -883,25 +883,25 @@ export class RoomPlane implements IRoomPlane
|
|||||||
_local_3 = false;
|
_local_3 = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._rectangleMasks.length > this._rectangleMasksOld.length) _local_3 = false;
|
if (this._rectangleMasks.length > this._rectangleMasksOld.length) _local_3 = false;
|
||||||
|
|
||||||
if(_local_3) this._maskChanged = false;
|
if (_local_3) this._maskChanged = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateMask(texture: Graphics, geometry: IRoomGeometry): void
|
private updateMask(texture: Graphics, geometry: IRoomGeometry): void
|
||||||
{
|
{
|
||||||
if(!texture || !geometry) return;
|
if (!texture || !geometry) return;
|
||||||
|
|
||||||
if(((!this._useMask) || ((!this._bitmapMasks.length && !this._rectangleMasks.length) && !this._maskChanged)) || !this._maskManager) return;
|
if (((!this._useMask) || ((!this._bitmapMasks.length && !this._rectangleMasks.length) && !this._maskChanged)) || !this._maskManager) return;
|
||||||
|
|
||||||
const width = texture.width;
|
const width = texture.width;
|
||||||
const height = texture.height;
|
const height = texture.height;
|
||||||
|
|
||||||
this.updateMaskChangeStatus();
|
this.updateMaskChangeStatus();
|
||||||
|
|
||||||
if(!this._maskBitmapData || (this._maskBitmapData.width !== width) || (this._maskBitmapData.height !== height))
|
if (!this._maskBitmapData || (this._maskBitmapData.width !== width) || (this._maskBitmapData.height !== height))
|
||||||
{
|
{
|
||||||
if(this._maskBitmapData)
|
if (this._maskBitmapData)
|
||||||
{
|
{
|
||||||
this._maskBitmapData.destroy();
|
this._maskBitmapData.destroy();
|
||||||
this._maskBitmapData = null;
|
this._maskBitmapData = null;
|
||||||
@ -918,12 +918,12 @@ export class RoomPlane implements IRoomPlane
|
|||||||
this._maskChanged = true;
|
this._maskChanged = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._maskChanged)
|
if (this._maskChanged)
|
||||||
{
|
{
|
||||||
this._bitmapMasksOld = [];
|
this._bitmapMasksOld = [];
|
||||||
this._rectangleMasksOld = [];
|
this._rectangleMasksOld = [];
|
||||||
|
|
||||||
if(this._maskBitmapData)
|
if (this._maskBitmapData)
|
||||||
{
|
{
|
||||||
this._maskBitmapData
|
this._maskBitmapData
|
||||||
.beginFill(0xFFFFFF, 0)
|
.beginFill(0xFFFFFF, 0)
|
||||||
@ -940,11 +940,11 @@ export class RoomPlane implements IRoomPlane
|
|||||||
let posY = 0;
|
let posY = 0;
|
||||||
let i = 0;
|
let i = 0;
|
||||||
|
|
||||||
while(i < this._bitmapMasks.length)
|
while (i < this._bitmapMasks.length)
|
||||||
{
|
{
|
||||||
const mask = this._bitmapMasks[i];
|
const mask = this._bitmapMasks[i];
|
||||||
|
|
||||||
if(mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
type = mask.type;
|
type = mask.type;
|
||||||
posX = (this._maskBitmapData.width - ((this._maskBitmapData.width * mask.leftSideLoc) / this._leftSide.length));
|
posX = (this._maskBitmapData.width - ((this._maskBitmapData.width * mask.leftSideLoc) / this._leftSide.length));
|
||||||
@ -959,11 +959,11 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
while(i < this._rectangleMasks.length)
|
while (i < this._rectangleMasks.length)
|
||||||
{
|
{
|
||||||
const rectMask = this._rectangleMasks[i];
|
const rectMask = this._rectangleMasks[i];
|
||||||
|
|
||||||
if(rectMask)
|
if (rectMask)
|
||||||
{
|
{
|
||||||
posX = (this._maskBitmapData.width - ((this._maskBitmapData.width * rectMask.leftSideLoc) / this._leftSide.length));
|
posX = (this._maskBitmapData.width - ((this._maskBitmapData.width * rectMask.leftSideLoc) / this._leftSide.length));
|
||||||
posY = (this._maskBitmapData.height - ((this._maskBitmapData.height * rectMask.rightSideLoc) / this._rightSide.length));
|
posY = (this._maskBitmapData.height - ((this._maskBitmapData.height * rectMask.rightSideLoc) / this._rightSide.length));
|
||||||
@ -990,7 +990,7 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
private combineTextureMask(texture: Graphics, mask: Graphics): void
|
private combineTextureMask(texture: Graphics, mask: Graphics): void
|
||||||
{
|
{
|
||||||
if(!texture || !mask) return;
|
if (!texture || !mask) return;
|
||||||
|
|
||||||
const maskCanvas = TextureUtils.generateCanvas(mask);
|
const maskCanvas = TextureUtils.generateCanvas(mask);
|
||||||
const textureCanvas = TextureUtils.generateCanvas(texture);
|
const textureCanvas = TextureUtils.generateCanvas(texture);
|
||||||
@ -1001,21 +1001,21 @@ export class RoomPlane implements IRoomPlane
|
|||||||
const textureImageData = textureCtx.getImageData(0, 0, textureCanvas.width, textureCanvas.height);
|
const textureImageData = textureCtx.getImageData(0, 0, textureCanvas.width, textureCanvas.height);
|
||||||
const data = textureImageData.data;
|
const data = textureImageData.data;
|
||||||
|
|
||||||
for(let i = 0; i < data.length; i += 4)
|
for (let i = 0; i < data.length; i += 4)
|
||||||
{
|
{
|
||||||
const red = data[ i ];
|
const red = data[i];
|
||||||
const green = data[ i + 1 ];
|
const green = data[i + 1];
|
||||||
const blue = data[ i + 2 ];
|
const blue = data[i + 2];
|
||||||
const alpha = data[ i + 3 ];
|
const alpha = data[i + 3];
|
||||||
|
|
||||||
if(!red && !green && !blue) data[ i + 3 ] = 0;
|
if (!red && !green && !blue) data[i + 3] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
textureCtx.putImageData(textureImageData, 0, 0);
|
textureCtx.putImageData(textureImageData, 0, 0);
|
||||||
|
|
||||||
const newTexture = Texture.from(textureCanvas);
|
const newTexture = Texture.from(textureCanvas);
|
||||||
|
|
||||||
if(!newTexture) return;
|
if (!newTexture) return;
|
||||||
|
|
||||||
texture
|
texture
|
||||||
.clear()
|
.clear()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { Matrix, Point } from '@pixi/math';
|
import { Matrix, Point } from '@pixi/math';
|
||||||
import { IGraphicAsset } from '../../../../../../../api';
|
import { IGraphicAsset } from '../../../../../../../api';
|
||||||
import { NitroSprite } from '../../../../../../../core';
|
import { NitroSprite } from '../../../../../../../pixi-proxy';
|
||||||
import { IVector3D } from '../../../../../../../room/utils/IVector3D';
|
import { IVector3D } from '../../../../../../../room/utils/IVector3D';
|
||||||
import { Randomizer } from '../../utils';
|
import { Randomizer } from '../../utils';
|
||||||
import { PlaneTexture } from './PlaneTexture';
|
import { PlaneTexture } from './PlaneTexture';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { Graphics } from '@pixi/graphics';
|
import { Graphics } from '@pixi/graphics';
|
||||||
import { NitroRenderTexture } from '../../../../../../../core';
|
import { NitroRenderTexture } from '../../../../../../../pixi-proxy';
|
||||||
import { IVector3D } from '../../../../../../../room/utils/IVector3D';
|
import { IVector3D } from '../../../../../../../room/utils/IVector3D';
|
||||||
import { Vector3d } from '../../../../../../../room/utils/Vector3d';
|
import { Vector3d } from '../../../../../../../room/utils/Vector3d';
|
||||||
import { PlaneMaterialCell } from './PlaneMaterialCell';
|
import { PlaneMaterialCell } from './PlaneMaterialCell';
|
||||||
@ -36,19 +36,19 @@ export class PlaneMaterialCellColumn
|
|||||||
this._isCached = false;
|
this._isCached = false;
|
||||||
this._isStatic = true;
|
this._isStatic = true;
|
||||||
|
|
||||||
if(cells && cells.length)
|
if (cells && cells.length)
|
||||||
{
|
{
|
||||||
let cellIndex = 0;
|
let cellIndex = 0;
|
||||||
|
|
||||||
while(cellIndex < cells.length)
|
while (cellIndex < cells.length)
|
||||||
{
|
{
|
||||||
const cell = cells[cellIndex];
|
const cell = cells[cellIndex];
|
||||||
|
|
||||||
if(cell)
|
if (cell)
|
||||||
{
|
{
|
||||||
this._cells.push(cell);
|
this._cells.push(cell);
|
||||||
|
|
||||||
if(!cell.isStatic) this._isStatic = false;
|
if (!cell.isStatic) this._isStatic = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
cellIndex++;
|
cellIndex++;
|
||||||
@ -73,11 +73,11 @@ export class PlaneMaterialCellColumn
|
|||||||
|
|
||||||
public dispose(): void
|
public dispose(): void
|
||||||
{
|
{
|
||||||
if(this._cells && this._cells.length)
|
if (this._cells && this._cells.length)
|
||||||
{
|
{
|
||||||
for(const cell of this._cells)
|
for (const cell of this._cells)
|
||||||
{
|
{
|
||||||
if(!cell) continue;
|
if (!cell) continue;
|
||||||
|
|
||||||
cell.dispose();
|
cell.dispose();
|
||||||
}
|
}
|
||||||
@ -85,39 +85,39 @@ export class PlaneMaterialCellColumn
|
|||||||
this._cells = null;
|
this._cells = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._cachedBitmapData)
|
if (this._cachedBitmapData)
|
||||||
{
|
{
|
||||||
this._cachedBitmapData.destroy();
|
this._cachedBitmapData.destroy();
|
||||||
|
|
||||||
this._cachedBitmapData = null;
|
this._cachedBitmapData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._cachedBitmapNormal) this._cachedBitmapNormal = null;
|
if (this._cachedBitmapNormal) this._cachedBitmapNormal = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public clearCache(): void
|
public clearCache(): void
|
||||||
{
|
{
|
||||||
if(!this._isCached) return;
|
if (!this._isCached) return;
|
||||||
|
|
||||||
if(this._cachedBitmapData)
|
if (this._cachedBitmapData)
|
||||||
{
|
{
|
||||||
this._cachedBitmapData.destroy();
|
this._cachedBitmapData.destroy();
|
||||||
|
|
||||||
this._cachedBitmapData = null;
|
this._cachedBitmapData = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._cachedBitmapNormal)
|
if (this._cachedBitmapNormal)
|
||||||
{
|
{
|
||||||
this._cachedBitmapNormal.x = 0;
|
this._cachedBitmapNormal.x = 0;
|
||||||
this._cachedBitmapNormal.y = 0;
|
this._cachedBitmapNormal.y = 0;
|
||||||
this._cachedBitmapNormal.z = 0;
|
this._cachedBitmapNormal.z = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._cells && this._cells.length)
|
if (this._cells && this._cells.length)
|
||||||
{
|
{
|
||||||
for(const cell of this._cells)
|
for (const cell of this._cells)
|
||||||
{
|
{
|
||||||
if(!cell) continue;
|
if (!cell) continue;
|
||||||
|
|
||||||
cell.clearCache();
|
cell.clearCache();
|
||||||
}
|
}
|
||||||
@ -130,19 +130,19 @@ export class PlaneMaterialCellColumn
|
|||||||
{
|
{
|
||||||
let ht = 0;
|
let ht = 0;
|
||||||
|
|
||||||
if(this._repeatMode == PlaneMaterialCellColumn.REPEAT_MODE_NONE)
|
if (this._repeatMode == PlaneMaterialCellColumn.REPEAT_MODE_NONE)
|
||||||
{
|
{
|
||||||
ht = this.getCellsHeight(this._cells, normal);
|
ht = this.getCellsHeight(this._cells, normal);
|
||||||
height = ht;
|
height = ht;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this._cachedBitmapNormal) this._cachedBitmapNormal = new Vector3d();
|
if (!this._cachedBitmapNormal) this._cachedBitmapNormal = new Vector3d();
|
||||||
|
|
||||||
if(this.isStatic)
|
if (this.isStatic)
|
||||||
{
|
{
|
||||||
if(this._cachedBitmapData)
|
if (this._cachedBitmapData)
|
||||||
{
|
{
|
||||||
if((this._cachedBitmapData.height === height) && Vector3d.isEqual(this._cachedBitmapNormal, normal) && (this._cachedBitmapDataOffsetX === offsetX) && (this._cachedBitmapDataOffsetY === offsetY))
|
if ((this._cachedBitmapData.height === height) && Vector3d.isEqual(this._cachedBitmapNormal, normal) && (this._cachedBitmapDataOffsetX === offsetX) && (this._cachedBitmapDataOffsetY === offsetY))
|
||||||
{
|
{
|
||||||
return this._cachedBitmapData;
|
return this._cachedBitmapData;
|
||||||
}
|
}
|
||||||
@ -154,9 +154,9 @@ export class PlaneMaterialCellColumn
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(this._cachedBitmapData)
|
if (this._cachedBitmapData)
|
||||||
{
|
{
|
||||||
if(this._cachedBitmapData.height === height)
|
if (this._cachedBitmapData.height === height)
|
||||||
{
|
{
|
||||||
this._cachedBitmapData
|
this._cachedBitmapData
|
||||||
.beginFill(0xFFFFFF)
|
.beginFill(0xFFFFFF)
|
||||||
@ -174,7 +174,7 @@ export class PlaneMaterialCellColumn
|
|||||||
|
|
||||||
this._isCached = true;
|
this._isCached = true;
|
||||||
|
|
||||||
if(!this._cachedBitmapData)
|
if (!this._cachedBitmapData)
|
||||||
{
|
{
|
||||||
this._cachedBitmapData = new Graphics()
|
this._cachedBitmapData = new Graphics()
|
||||||
.beginFill(0xFFFFFF)
|
.beginFill(0xFFFFFF)
|
||||||
@ -186,9 +186,9 @@ export class PlaneMaterialCellColumn
|
|||||||
this._cachedBitmapDataOffsetX = offsetX;
|
this._cachedBitmapDataOffsetX = offsetX;
|
||||||
this._cachedBitmapDataOffsetY = offsetY;
|
this._cachedBitmapDataOffsetY = offsetY;
|
||||||
|
|
||||||
if(!this._cells.length) return this._cachedBitmapData;
|
if (!this._cells.length) return this._cachedBitmapData;
|
||||||
|
|
||||||
switch(this._repeatMode)
|
switch (this._repeatMode)
|
||||||
{
|
{
|
||||||
case PlaneMaterialCellColumn.REPEAT_MODE_NONE:
|
case PlaneMaterialCellColumn.REPEAT_MODE_NONE:
|
||||||
this.renderRepeatNone(normal);
|
this.renderRepeatNone(normal);
|
||||||
@ -219,16 +219,16 @@ export class PlaneMaterialCellColumn
|
|||||||
|
|
||||||
private getCellsHeight(cells: PlaneMaterialCell[], normal: IVector3D): number
|
private getCellsHeight(cells: PlaneMaterialCell[], normal: IVector3D): number
|
||||||
{
|
{
|
||||||
if(!cells || !cells.length) return 0;
|
if (!cells || !cells.length) return 0;
|
||||||
|
|
||||||
let height = 0;
|
let height = 0;
|
||||||
let cellIterator = 0;
|
let cellIterator = 0;
|
||||||
|
|
||||||
while(cellIterator < cells.length)
|
while (cellIterator < cells.length)
|
||||||
{
|
{
|
||||||
const cell = cells[cellIterator];
|
const cell = cells[cellIterator];
|
||||||
|
|
||||||
if(cell) height += cell.getHeight(normal);
|
if (cell) height += cell.getHeight(normal);
|
||||||
|
|
||||||
cellIterator++;
|
cellIterator++;
|
||||||
}
|
}
|
||||||
@ -238,15 +238,15 @@ export class PlaneMaterialCellColumn
|
|||||||
|
|
||||||
private renderCells(cells: PlaneMaterialCell[], index: number, flag: boolean, normal: IVector3D, offsetX: number = 0, offsetY: number = 0): number
|
private renderCells(cells: PlaneMaterialCell[], index: number, flag: boolean, normal: IVector3D, offsetX: number = 0, offsetY: number = 0): number
|
||||||
{
|
{
|
||||||
if(((!cells || !cells.length) || !this._cachedBitmapData)) return index;
|
if (((!cells || !cells.length) || !this._cachedBitmapData)) return index;
|
||||||
|
|
||||||
let cellIndex = 0;
|
let cellIndex = 0;
|
||||||
|
|
||||||
while(cellIndex < cells.length)
|
while (cellIndex < cells.length)
|
||||||
{
|
{
|
||||||
let cell: PlaneMaterialCell = null;
|
let cell: PlaneMaterialCell = null;
|
||||||
|
|
||||||
if(flag)
|
if (flag)
|
||||||
{
|
{
|
||||||
cell = cells[cellIndex];
|
cell = cells[cellIndex];
|
||||||
}
|
}
|
||||||
@ -255,21 +255,21 @@ export class PlaneMaterialCellColumn
|
|||||||
cell = cells[((cells.length - 1) - cellIndex)];
|
cell = cells[((cells.length - 1) - cellIndex)];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(cell)
|
if (cell)
|
||||||
{
|
{
|
||||||
const graphic = cell.render(normal, offsetX, offsetY);
|
const graphic = cell.render(normal, offsetX, offsetY);
|
||||||
|
|
||||||
if(graphic)
|
if (graphic)
|
||||||
{
|
{
|
||||||
if(!flag) index -= graphic.height;
|
if (!flag) index -= graphic.height;
|
||||||
|
|
||||||
graphic.y = index;
|
graphic.y = index;
|
||||||
|
|
||||||
this._cachedBitmapData.addChild(graphic);
|
this._cachedBitmapData.addChild(graphic);
|
||||||
|
|
||||||
if(flag) index = (index + graphic.height);
|
if (flag) index = (index + graphic.height);
|
||||||
|
|
||||||
if(((flag) && (index >= this._cachedBitmapData.height)) || ((!(flag)) && (index <= 0))) return index;
|
if (((flag) && (index >= this._cachedBitmapData.height)) || ((!(flag)) && (index <= 0))) return index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,22 +281,22 @@ export class PlaneMaterialCellColumn
|
|||||||
|
|
||||||
private renderRepeatNone(normal: IVector3D): void
|
private renderRepeatNone(normal: IVector3D): void
|
||||||
{
|
{
|
||||||
if(!this._cells.length || !this._cachedBitmapData) return;
|
if (!this._cells.length || !this._cachedBitmapData) return;
|
||||||
|
|
||||||
this.renderCells(this._cells, 0, true, normal);
|
this.renderCells(this._cells, 0, true, normal);
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderRepeatAll(normal: IVector3D, offsetX: number, offsetY: number): void
|
private renderRepeatAll(normal: IVector3D, offsetX: number, offsetY: number): void
|
||||||
{
|
{
|
||||||
if(!this._cells.length || !this._cachedBitmapData) return;
|
if (!this._cells.length || !this._cachedBitmapData) return;
|
||||||
|
|
||||||
let index = 0;
|
let index = 0;
|
||||||
|
|
||||||
while(index < this._cachedBitmapData.height)
|
while (index < this._cachedBitmapData.height)
|
||||||
{
|
{
|
||||||
index = this.renderCells(this._cells, index, true, normal, offsetX, offsetY);
|
index = this.renderCells(this._cells, index, true, normal, offsetX, offsetY);
|
||||||
|
|
||||||
if(!index) return;
|
if (!index) return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import { RenderTexture, Texture } from '@pixi/core';
|
|||||||
import { Container, DisplayObject } from '@pixi/display';
|
import { Container, DisplayObject } from '@pixi/display';
|
||||||
import { Point, Rectangle } from '@pixi/math';
|
import { Point, Rectangle } from '@pixi/math';
|
||||||
import { Sprite } from '@pixi/sprite';
|
import { Sprite } from '@pixi/sprite';
|
||||||
import { NitroSprite } from '../../../core';
|
import { NitroSprite } from '../../../pixi-proxy';
|
||||||
import { IRoomObjectController } from '../../../room/object/IRoomObjectController';
|
import { IRoomObjectController } from '../../../room/object/IRoomObjectController';
|
||||||
import { IRoomRenderingCanvas } from '../../../room/renderer/IRoomRenderingCanvas';
|
import { IRoomRenderingCanvas } from '../../../room/renderer/IRoomRenderingCanvas';
|
||||||
import { IVector3D } from '../../../room/utils/IVector3D';
|
import { IVector3D } from '../../../room/utils/IVector3D';
|
||||||
@ -69,7 +69,7 @@ export class RoomPreviewer
|
|||||||
this.onRoomObjectAdded = this.onRoomObjectAdded.bind(this);
|
this.onRoomObjectAdded = this.onRoomObjectAdded.bind(this);
|
||||||
this.onRoomInitializedonRoomInitialized = this.onRoomInitializedonRoomInitialized.bind(this);
|
this.onRoomInitializedonRoomInitialized = this.onRoomInitializedonRoomInitialized.bind(this);
|
||||||
|
|
||||||
if(this.isRoomEngineReady && this._roomEngine.events)
|
if (this.isRoomEngineReady && this._roomEngine.events)
|
||||||
{
|
{
|
||||||
this._roomEngine.events.addEventListener(RoomEngineObjectEvent.ADDED, this.onRoomObjectAdded);
|
this._roomEngine.events.addEventListener(RoomEngineObjectEvent.ADDED, this.onRoomObjectAdded);
|
||||||
this._roomEngine.events.addEventListener(RoomEngineObjectEvent.CONTENT_UPDATED, this.onRoomObjectAdded);
|
this._roomEngine.events.addEventListener(RoomEngineObjectEvent.CONTENT_UPDATED, this.onRoomObjectAdded);
|
||||||
@ -83,21 +83,21 @@ export class RoomPreviewer
|
|||||||
{
|
{
|
||||||
this.reset(true);
|
this.reset(true);
|
||||||
|
|
||||||
if(this.isRoomEngineReady && this._roomEngine.events)
|
if (this.isRoomEngineReady && this._roomEngine.events)
|
||||||
{
|
{
|
||||||
this._roomEngine.events.removeEventListener(RoomEngineObjectEvent.ADDED, this.onRoomObjectAdded);
|
this._roomEngine.events.removeEventListener(RoomEngineObjectEvent.ADDED, this.onRoomObjectAdded);
|
||||||
this._roomEngine.events.removeEventListener(RoomEngineObjectEvent.CONTENT_UPDATED, this.onRoomObjectAdded);
|
this._roomEngine.events.removeEventListener(RoomEngineObjectEvent.CONTENT_UPDATED, this.onRoomObjectAdded);
|
||||||
this._roomEngine.events.removeEventListener(RoomEngineEvent.INITIALIZED, this.onRoomInitializedonRoomInitialized);
|
this._roomEngine.events.removeEventListener(RoomEngineEvent.INITIALIZED, this.onRoomInitializedonRoomInitialized);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._backgroundSprite)
|
if (this._backgroundSprite)
|
||||||
{
|
{
|
||||||
this._backgroundSprite.destroy();
|
this._backgroundSprite.destroy();
|
||||||
|
|
||||||
this._backgroundSprite = null;
|
this._backgroundSprite = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._planeParser)
|
if (this._planeParser)
|
||||||
{
|
{
|
||||||
this._planeParser.dispose();
|
this._planeParser.dispose();
|
||||||
|
|
||||||
@ -107,7 +107,7 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
private createRoomForPreview(): void
|
private createRoomForPreview(): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
const size = 7;
|
const size = 7;
|
||||||
|
|
||||||
@ -117,11 +117,11 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
let y = 1;
|
let y = 1;
|
||||||
|
|
||||||
while(y < (1 + size))
|
while (y < (1 + size))
|
||||||
{
|
{
|
||||||
let x = 1;
|
let x = 1;
|
||||||
|
|
||||||
while(x < (1 + size))
|
while (x < (1 + size))
|
||||||
{
|
{
|
||||||
planeParser.setTileHeight(x, y, 0);
|
planeParser.setTileHeight(x, y, 0);
|
||||||
|
|
||||||
@ -141,13 +141,13 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public reset(k: boolean): void
|
public reset(k: boolean): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
this._roomEngine.removeRoomObjectFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID);
|
this._roomEngine.removeRoomObjectFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID);
|
||||||
this._roomEngine.removeRoomObjectWall(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID);
|
this._roomEngine.removeRoomObjectWall(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID);
|
||||||
this._roomEngine.removeRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID);
|
this._roomEngine.removeRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID);
|
||||||
|
|
||||||
if(!k) this.updatePreviewRoomView();
|
if (!k) this.updatePreviewRoomView();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._currentPreviewObjectCategory = RoomObjectCategory.MINIMUM;
|
this._currentPreviewObjectCategory = RoomObjectCategory.MINIMUM;
|
||||||
@ -163,7 +163,7 @@ export class RoomPreviewer
|
|||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const wallGeometry = (this._roomEngine as IRoomCreator).getLegacyWallGeometry(this._previewRoomId);
|
const wallGeometry = (this._roomEngine as IRoomCreator).getLegacyWallGeometry(this._previewRoomId);
|
||||||
|
|
||||||
if(!wallGeometry) return;
|
if (!wallGeometry) return;
|
||||||
|
|
||||||
this._planeParser.reset();
|
this._planeParser.reset();
|
||||||
|
|
||||||
@ -181,17 +181,17 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
let y = 0;
|
let y = 0;
|
||||||
|
|
||||||
while(y < height)
|
while (y < height)
|
||||||
{
|
{
|
||||||
let x = 0;
|
let x = 0;
|
||||||
|
|
||||||
while(x < width)
|
while (x < width)
|
||||||
{
|
{
|
||||||
const tileHeight = parser.getHeight(x, y);
|
const tileHeight = parser.getHeight(x, y);
|
||||||
|
|
||||||
if(((((y > 0) && (y < (height - 1))) || ((x > 0) && (x < (width - 1)))) && (!(tileHeight == RoomPlaneParser.TILE_BLOCKED))) && ((entryTile == null) || ((x == entryTile.x) && (y == entryTile.y))))
|
if (((((y > 0) && (y < (height - 1))) || ((x > 0) && (x < (width - 1)))) && (!(tileHeight == RoomPlaneParser.TILE_BLOCKED))) && ((entryTile == null) || ((x == entryTile.x) && (y == entryTile.y))))
|
||||||
{
|
{
|
||||||
if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight(x, (y + 1)) == RoomPlaneParser.TILE_BLOCKED))
|
if (((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight(x, (y + 1)) == RoomPlaneParser.TILE_BLOCKED))
|
||||||
{
|
{
|
||||||
doorX = (x + 0.5);
|
doorX = (x + 0.5);
|
||||||
doorY = y;
|
doorY = y;
|
||||||
@ -199,7 +199,7 @@ export class RoomPreviewer
|
|||||||
doorDirection = 90;
|
doorDirection = 90;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight((x + 1), y) == RoomPlaneParser.TILE_BLOCKED))
|
if (((parser.getHeight(x, (y - 1)) == RoomPlaneParser.TILE_BLOCKED) && (parser.getHeight((x - 1), y) == RoomPlaneParser.TILE_BLOCKED)) && (parser.getHeight((x + 1), y) == RoomPlaneParser.TILE_BLOCKED))
|
||||||
{
|
{
|
||||||
doorX = x;
|
doorX = x;
|
||||||
doorY = (y + 0.5);
|
doorY = (y + 0.5);
|
||||||
@ -225,11 +225,11 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
let heightIterator = (parser.height - 1);
|
let heightIterator = (parser.height - 1);
|
||||||
|
|
||||||
while(heightIterator >= 0)
|
while (heightIterator >= 0)
|
||||||
{
|
{
|
||||||
let widthIterator = (parser.width - 1);
|
let widthIterator = (parser.width - 1);
|
||||||
|
|
||||||
while(widthIterator >= 0)
|
while (widthIterator >= 0)
|
||||||
{
|
{
|
||||||
wallGeometry.setHeight(widthIterator, heightIterator, this._planeParser.getTileHeight(widthIterator, heightIterator));
|
wallGeometry.setHeight(widthIterator, heightIterator, this._planeParser.getTileHeight(widthIterator, heightIterator));
|
||||||
widthIterator--;
|
widthIterator--;
|
||||||
@ -249,14 +249,14 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
const roomObject = this.getRoomPreviewOwnRoomObject();
|
const roomObject = this.getRoomPreviewOwnRoomObject();
|
||||||
|
|
||||||
if(roomObject) roomObject.processUpdateMessage(new ObjectRoomMapUpdateMessage(roomMap));
|
if (roomObject) roomObject.processUpdateMessage(new ObjectRoomMapUpdateMessage(roomMap));
|
||||||
}
|
}
|
||||||
|
|
||||||
public addFurnitureIntoRoom(classId: number, direction: IVector3D, objectData: IObjectData = null, extra: string = null): number
|
public addFurnitureIntoRoom(classId: number, direction: IVector3D, objectData: IObjectData = null, extra: string = null): number
|
||||||
{
|
{
|
||||||
if(!objectData) objectData = new LegacyDataType();
|
if (!objectData) objectData = new LegacyDataType();
|
||||||
|
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
this.reset(false);
|
this.reset(false);
|
||||||
|
|
||||||
@ -264,14 +264,14 @@ export class RoomPreviewer
|
|||||||
this._currentPreviewObjectCategory = RoomObjectCategory.FLOOR;
|
this._currentPreviewObjectCategory = RoomObjectCategory.FLOOR;
|
||||||
this._currentPreviewObjectData = '';
|
this._currentPreviewObjectData = '';
|
||||||
|
|
||||||
if(this._roomEngine.addFurnitureFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, classId, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), direction, 0, objectData, NaN, -1, 0, -1, '', true, false))
|
if (this._roomEngine.addFurnitureFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, classId, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), direction, 0, objectData, NaN, -1, 0, -1, '', true, false))
|
||||||
{
|
{
|
||||||
this._previousAutomaticStateChangeTime = Nitro.instance.time;
|
this._previousAutomaticStateChangeTime = Nitro.instance.time;
|
||||||
this._automaticStateChange = true;
|
this._automaticStateChange = true;
|
||||||
|
|
||||||
const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
||||||
|
|
||||||
if(roomObject && extra) roomObject.model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, extra);
|
if (roomObject && extra) roomObject.model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, extra);
|
||||||
|
|
||||||
this.updatePreviewRoomView();
|
this.updatePreviewRoomView();
|
||||||
|
|
||||||
@ -284,9 +284,9 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public addWallItemIntoRoom(classId: number, direction: IVector3D, objectData: string): number
|
public addWallItemIntoRoom(classId: number, direction: IVector3D, objectData: string): number
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
if((this._currentPreviewObjectCategory === RoomObjectCategory.WALL) && (this._currentPreviewObjectType === classId) && (this._currentPreviewObjectData === objectData)) return RoomPreviewer.PREVIEW_OBJECT_ID;
|
if ((this._currentPreviewObjectCategory === RoomObjectCategory.WALL) && (this._currentPreviewObjectType === classId) && (this._currentPreviewObjectData === objectData)) return RoomPreviewer.PREVIEW_OBJECT_ID;
|
||||||
|
|
||||||
this.reset(false);
|
this.reset(false);
|
||||||
|
|
||||||
@ -294,7 +294,7 @@ export class RoomPreviewer
|
|||||||
this._currentPreviewObjectCategory = RoomObjectCategory.WALL;
|
this._currentPreviewObjectCategory = RoomObjectCategory.WALL;
|
||||||
this._currentPreviewObjectData = objectData;
|
this._currentPreviewObjectData = objectData;
|
||||||
|
|
||||||
if(this._roomEngine.addFurnitureWall(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, classId, new Vector3d(0.5, 2.3, 1.8), direction, 0, objectData, 0, 0, -1, '', false))
|
if (this._roomEngine.addFurnitureWall(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, classId, new Vector3d(0.5, 2.3, 1.8), direction, 0, objectData, 0, 0, -1, '', false))
|
||||||
{
|
{
|
||||||
this._previousAutomaticStateChangeTime = Nitro.instance.time;
|
this._previousAutomaticStateChangeTime = Nitro.instance.time;
|
||||||
this._automaticStateChange = true;
|
this._automaticStateChange = true;
|
||||||
@ -310,7 +310,7 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public addAvatarIntoRoom(figure: string, effect: number): number
|
public addAvatarIntoRoom(figure: string, effect: number): number
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
this.reset(false);
|
this.reset(false);
|
||||||
|
|
||||||
@ -318,7 +318,7 @@ export class RoomPreviewer
|
|||||||
this._currentPreviewObjectCategory = RoomObjectCategory.UNIT;
|
this._currentPreviewObjectCategory = RoomObjectCategory.UNIT;
|
||||||
this._currentPreviewObjectData = figure;
|
this._currentPreviewObjectData = figure;
|
||||||
|
|
||||||
if(this._roomEngine.addRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(90, 0, 0), 135, RoomObjectUserType.getTypeNumber(RoomObjectUserType.USER), figure))
|
if (this._roomEngine.addRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(90, 0, 0), 135, RoomObjectUserType.getTypeNumber(RoomObjectUserType.USER), figure))
|
||||||
{
|
{
|
||||||
this._previousAutomaticStateChangeTime = Nitro.instance.time;
|
this._previousAutomaticStateChangeTime = Nitro.instance.time;
|
||||||
this._automaticStateChange = true;
|
this._automaticStateChange = true;
|
||||||
@ -338,7 +338,7 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public addPetIntoRoom(figure: string): number
|
public addPetIntoRoom(figure: string): number
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
this.reset(false);
|
this.reset(false);
|
||||||
|
|
||||||
@ -346,7 +346,7 @@ export class RoomPreviewer
|
|||||||
this._currentPreviewObjectCategory = RoomObjectCategory.UNIT;
|
this._currentPreviewObjectCategory = RoomObjectCategory.UNIT;
|
||||||
this._currentPreviewObjectData = figure;
|
this._currentPreviewObjectData = figure;
|
||||||
|
|
||||||
if(this._roomEngine.addRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(90, 0, 0), 90, RoomObjectUserType.getTypeNumber(RoomObjectUserType.PET), figure))
|
if (this._roomEngine.addRoomObjectUser(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(90, 0, 0), 90, RoomObjectUserType.getTypeNumber(RoomObjectUserType.PET), figure))
|
||||||
{
|
{
|
||||||
this._previousAutomaticStateChangeTime = Nitro.instance.time;
|
this._previousAutomaticStateChangeTime = Nitro.instance.time;
|
||||||
this._automaticStateChange = false;
|
this._automaticStateChange = false;
|
||||||
@ -365,57 +365,57 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public updateUserPosture(type: string, parameter: string = ''): void
|
public updateUserPosture(type: string, parameter: string = ''): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserPosture(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, type, parameter);
|
if (this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserPosture(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, type, parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateUserGesture(gestureId: number): void
|
public updateUserGesture(gestureId: number): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserGesture(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, gestureId);
|
if (this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserGesture(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, gestureId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateUserEffect(effectId: number): void
|
public updateUserEffect(effectId: number): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserEffect(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, effectId);
|
if (this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserEffect(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, effectId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateObjectUserFigure(figure: string, gender: string = null, subType: string = null, isRiding: boolean = false): boolean
|
public updateObjectUserFigure(figure: string, gender: string = null, subType: string = null, isRiding: boolean = false): boolean
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady) return this._roomEngine.updateRoomObjectUserFigure(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, figure, gender, subType, isRiding);
|
if (this.isRoomEngineReady) return this._roomEngine.updateRoomObjectUserFigure(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, figure, gender, subType, isRiding);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateObjectUserAction(action: string, value: number, parameter: string = null): void
|
public updateObjectUserAction(action: string, value: number, parameter: string = null): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserAction(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, action, value, parameter);
|
if (this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserAction(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, action, value, parameter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateObjectStuffData(stuffData: IObjectData): void
|
public updateObjectStuffData(stuffData: IObjectData): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, null, null, stuffData.state, stuffData);
|
if (this.isRoomEngineReady) this._roomEngine.updateRoomObjectFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, null, null, stuffData.state, stuffData);
|
||||||
}
|
}
|
||||||
|
|
||||||
public changeRoomObjectState(): void
|
public changeRoomObjectState(): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
this._automaticStateChange = false;
|
this._automaticStateChange = false;
|
||||||
|
|
||||||
if(this._currentPreviewObjectCategory !== RoomObjectCategory.UNIT) this._roomEngine.changeObjectState(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
if (this._currentPreviewObjectCategory !== RoomObjectCategory.UNIT) this._roomEngine.changeObjectState(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public changeRoomObjectDirection(): void
|
public changeRoomObjectDirection(): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
||||||
|
|
||||||
if(!roomObject) return;
|
if (!roomObject) return;
|
||||||
|
|
||||||
const direction = this._roomEngine.objectEventHandler.getValidRoomObjectDirection(roomObject, true);
|
const direction = this._roomEngine.objectEventHandler.getValidRoomObjectDirection(roomObject, true);
|
||||||
|
|
||||||
switch(this._currentPreviewObjectCategory)
|
switch (this._currentPreviewObjectCategory)
|
||||||
{
|
{
|
||||||
case RoomObjectCategory.FLOOR: {
|
case RoomObjectCategory.FLOOR: {
|
||||||
const floorLocation = new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y);
|
const floorLocation = new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y);
|
||||||
@ -433,30 +433,30 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
private checkAutomaticRoomObjectStateChange(): void
|
private checkAutomaticRoomObjectStateChange(): void
|
||||||
{
|
{
|
||||||
if(this._automaticStateChange)
|
if (this._automaticStateChange)
|
||||||
{
|
{
|
||||||
const time = Nitro.instance.time;
|
const time = Nitro.instance.time;
|
||||||
|
|
||||||
if(time > (this._previousAutomaticStateChangeTime + RoomPreviewer.AUTOMATIC_STATE_CHANGE_INTERVAL))
|
if (time > (this._previousAutomaticStateChangeTime + RoomPreviewer.AUTOMATIC_STATE_CHANGE_INTERVAL))
|
||||||
{
|
{
|
||||||
this._previousAutomaticStateChangeTime = time;
|
this._previousAutomaticStateChangeTime = time;
|
||||||
|
|
||||||
if(this.isRoomEngineReady) this._roomEngine.changeObjectState(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
if (this.isRoomEngineReady) this._roomEngine.changeObjectState(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRoomCanvas(width: number, height: number): DisplayObject
|
public getRoomCanvas(width: number, height: number): DisplayObject
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
const displayObject = (this._roomEngine.getRoomInstanceDisplay(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, width, height, this._currentPreviewScale) as Container);
|
const displayObject = (this._roomEngine.getRoomInstanceDisplay(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, width, height, this._currentPreviewScale) as Container);
|
||||||
|
|
||||||
if(displayObject && (this._backgroundColor !== null))
|
if (displayObject && (this._backgroundColor !== null))
|
||||||
{
|
{
|
||||||
let backgroundSprite = this._backgroundSprite;
|
let backgroundSprite = this._backgroundSprite;
|
||||||
|
|
||||||
if(!backgroundSprite)
|
if (!backgroundSprite)
|
||||||
{
|
{
|
||||||
backgroundSprite = new NitroSprite(Texture.WHITE);
|
backgroundSprite = new NitroSprite(Texture.WHITE);
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
const geometry = this._roomEngine.getRoomInstanceGeometry(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID);
|
const geometry = this._roomEngine.getRoomInstanceGeometry(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID);
|
||||||
|
|
||||||
if(geometry) geometry.adjustLocation(new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), 30);
|
if (geometry) geometry.adjustLocation(new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), 30);
|
||||||
|
|
||||||
this._currentPreviewCanvasWidth = width;
|
this._currentPreviewCanvasWidth = width;
|
||||||
this._currentPreviewCanvasHeight = height;
|
this._currentPreviewCanvasHeight = height;
|
||||||
@ -485,12 +485,12 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public modifyRoomCanvas(width: number, height: number): void
|
public modifyRoomCanvas(width: number, height: number): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
this._currentPreviewCanvasWidth = width;
|
this._currentPreviewCanvasWidth = width;
|
||||||
this._currentPreviewCanvasHeight = height;
|
this._currentPreviewCanvasHeight = height;
|
||||||
|
|
||||||
if(this._backgroundSprite)
|
if (this._backgroundSprite)
|
||||||
{
|
{
|
||||||
this._backgroundSprite.width = width;
|
this._backgroundSprite.width = width;
|
||||||
this._backgroundSprite.height = height;
|
this._backgroundSprite.height = height;
|
||||||
@ -514,7 +514,7 @@ export class RoomPreviewer
|
|||||||
{
|
{
|
||||||
const objectBounds = this._roomEngine.getRoomObjectBoundingRectangle(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory, RoomPreviewer.PREVIEW_CANVAS_ID);
|
const objectBounds = this._roomEngine.getRoomObjectBoundingRectangle(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory, RoomPreviewer.PREVIEW_CANVAS_ID);
|
||||||
|
|
||||||
if(objectBounds && point)
|
if (objectBounds && point)
|
||||||
{
|
{
|
||||||
objectBounds.x += -(this._currentPreviewCanvasWidth >> 1);
|
objectBounds.x += -(this._currentPreviewCanvasWidth >> 1);
|
||||||
objectBounds.y += -(this._currentPreviewCanvasHeight >> 1);
|
objectBounds.y += -(this._currentPreviewCanvasHeight >> 1);
|
||||||
@ -522,7 +522,7 @@ export class RoomPreviewer
|
|||||||
objectBounds.x += -(point.x);
|
objectBounds.x += -(point.x);
|
||||||
objectBounds.y += -(point.y);
|
objectBounds.y += -(point.y);
|
||||||
|
|
||||||
if(!this._currentPreviewRectangle)
|
if (!this._currentPreviewRectangle)
|
||||||
{
|
{
|
||||||
this._currentPreviewRectangle = objectBounds;
|
this._currentPreviewRectangle = objectBounds;
|
||||||
}
|
}
|
||||||
@ -530,27 +530,27 @@ export class RoomPreviewer
|
|||||||
{
|
{
|
||||||
const bounds = this._currentPreviewRectangle.clone().enlarge(objectBounds);
|
const bounds = this._currentPreviewRectangle.clone().enlarge(objectBounds);
|
||||||
|
|
||||||
if(((((bounds.width - this._currentPreviewRectangle.width) > ((this._currentPreviewCanvasWidth - this._currentPreviewRectangle.width) >> 1)) || ((bounds.height - this._currentPreviewRectangle.height) > ((this._currentPreviewCanvasHeight - this._currentPreviewRectangle.height) >> 1))) || (this._currentPreviewRectangle.width < 1)) || (this._currentPreviewRectangle.height < 1)) this._currentPreviewRectangle = bounds;
|
if (((((bounds.width - this._currentPreviewRectangle.width) > ((this._currentPreviewCanvasWidth - this._currentPreviewRectangle.width) >> 1)) || ((bounds.height - this._currentPreviewRectangle.height) > ((this._currentPreviewCanvasHeight - this._currentPreviewRectangle.height) >> 1))) || (this._currentPreviewRectangle.width < 1)) || (this._currentPreviewRectangle.height < 1)) this._currentPreviewRectangle = bounds;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private validatePreviewSize(point: Point): Point
|
private validatePreviewSize(point: Point): Point
|
||||||
{
|
{
|
||||||
if(((this._currentPreviewRectangle.width < 1) || (this._currentPreviewRectangle.height < 1)))
|
if (((this._currentPreviewRectangle.width < 1) || (this._currentPreviewRectangle.height < 1)))
|
||||||
{
|
{
|
||||||
return point;
|
return point;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
const geometry = this._roomEngine.getRoomInstanceGeometry(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID);
|
const geometry = this._roomEngine.getRoomInstanceGeometry(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID);
|
||||||
|
|
||||||
if((this._currentPreviewRectangle.width > (this._currentPreviewCanvasWidth * (1 + RoomPreviewer.ALLOWED_IMAGE_CUT))) || (this._currentPreviewRectangle.height > (this._currentPreviewCanvasHeight * (1 + RoomPreviewer.ALLOWED_IMAGE_CUT))))
|
if ((this._currentPreviewRectangle.width > (this._currentPreviewCanvasWidth * (1 + RoomPreviewer.ALLOWED_IMAGE_CUT))) || (this._currentPreviewRectangle.height > (this._currentPreviewCanvasHeight * (1 + RoomPreviewer.ALLOWED_IMAGE_CUT))))
|
||||||
{
|
{
|
||||||
if(RoomPreviewer.ZOOM_ENABLED)
|
if (RoomPreviewer.ZOOM_ENABLED)
|
||||||
{
|
{
|
||||||
if(this._roomEngine.getRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID) !== 0.5)
|
if (this._roomEngine.getRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID) !== 0.5)
|
||||||
{
|
{
|
||||||
this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 0.5, null, null);
|
this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 0.5, null, null);
|
||||||
|
|
||||||
@ -568,7 +568,7 @@ export class RoomPreviewer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(geometry.isZoomedIn())
|
if (geometry.isZoomedIn())
|
||||||
{
|
{
|
||||||
geometry.performZoomOut();
|
geometry.performZoomOut();
|
||||||
|
|
||||||
@ -578,11 +578,11 @@ export class RoomPreviewer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(!this._currentPreviewNeedsZoomOut)
|
else if (!this._currentPreviewNeedsZoomOut)
|
||||||
{
|
{
|
||||||
if(RoomPreviewer.ZOOM_ENABLED)
|
if (RoomPreviewer.ZOOM_ENABLED)
|
||||||
{
|
{
|
||||||
if(this._roomEngine.getRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID) !== 1)
|
if (this._roomEngine.getRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID) !== 1)
|
||||||
{
|
{
|
||||||
this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 1, null, null);
|
this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 1, null, null);
|
||||||
|
|
||||||
@ -591,7 +591,7 @@ export class RoomPreviewer
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!geometry.isZoomedIn())
|
if (!geometry.isZoomedIn())
|
||||||
{
|
{
|
||||||
geometry.performZoomIn();
|
geometry.performZoomIn();
|
||||||
|
|
||||||
@ -606,9 +606,9 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public zoomIn(): void
|
public zoomIn(): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
if(RoomPreviewer.ZOOM_ENABLED)
|
if (RoomPreviewer.ZOOM_ENABLED)
|
||||||
{
|
{
|
||||||
this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 1);
|
this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 1);
|
||||||
}
|
}
|
||||||
@ -625,9 +625,9 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public zoomOut(): void
|
public zoomOut(): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
if(RoomPreviewer.ZOOM_ENABLED)
|
if (RoomPreviewer.ZOOM_ENABLED)
|
||||||
{
|
{
|
||||||
this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 0.5);
|
this._roomEngine.setRoomInstanceRenderingCanvasScale(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, 0.5);
|
||||||
}
|
}
|
||||||
@ -644,7 +644,7 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public updateAvatarDirection(direction: number, headDirection: number): void
|
public updateAvatarDirection(direction: number, headDirection: number): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
this._roomEngine.updateRoomObjectUserLocation(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), false, 0, new Vector3d((direction * 45), 0, 0), (headDirection * 45));
|
this._roomEngine.updateRoomObjectUserLocation(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), new Vector3d(RoomPreviewer.PREVIEW_OBJECT_LOCATION_X, RoomPreviewer.PREVIEW_OBJECT_LOCATION_Y, 0), false, 0, new Vector3d((direction * 45), 0, 0), (headDirection * 45));
|
||||||
}
|
}
|
||||||
@ -652,31 +652,31 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public updateObjectRoom(floorType: string = null, wallType: string = null, landscapeType: string = null, _arg_4: boolean = false): boolean
|
public updateObjectRoom(floorType: string = null, wallType: string = null, landscapeType: string = null, _arg_4: boolean = false): boolean
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady) return this._roomEngine.updateRoomInstancePlaneType(this._previewRoomId, floorType, wallType, landscapeType, _arg_4);
|
if (this.isRoomEngineReady) return this._roomEngine.updateRoomInstancePlaneType(this._previewRoomId, floorType, wallType, landscapeType, _arg_4);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public updateRoomWallsAndFloorVisibility(wallsVisible: boolean, floorsVisible: boolean = true): void
|
public updateRoomWallsAndFloorVisibility(wallsVisible: boolean, floorsVisible: boolean = true): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady) this._roomEngine.updateRoomInstancePlaneVisibility(this._previewRoomId, wallsVisible, floorsVisible);
|
if (this.isRoomEngineReady) this._roomEngine.updateRoomInstancePlaneVisibility(this._previewRoomId, wallsVisible, floorsVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
private getCanvasOffset(point: Point): Point
|
private getCanvasOffset(point: Point): Point
|
||||||
{
|
{
|
||||||
if(((this._currentPreviewRectangle.width < 1) || (this._currentPreviewRectangle.height < 1))) return point;
|
if (((this._currentPreviewRectangle.width < 1) || (this._currentPreviewRectangle.height < 1))) return point;
|
||||||
|
|
||||||
let x = (-(this._currentPreviewRectangle.left + this._currentPreviewRectangle.right) >> 1);
|
let x = (-(this._currentPreviewRectangle.left + this._currentPreviewRectangle.right) >> 1);
|
||||||
let y = (-(this._currentPreviewRectangle.top + this._currentPreviewRectangle.bottom) >> 1);
|
let y = (-(this._currentPreviewRectangle.top + this._currentPreviewRectangle.bottom) >> 1);
|
||||||
const height = ((this._currentPreviewCanvasHeight - this._currentPreviewRectangle.height) >> 1);
|
const height = ((this._currentPreviewCanvasHeight - this._currentPreviewRectangle.height) >> 1);
|
||||||
|
|
||||||
if(height > 10)
|
if (height > 10)
|
||||||
{
|
{
|
||||||
y = (y + Math.min(15, (height - 10)));
|
y = (y + Math.min(15, (height - 10)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(this._currentPreviewObjectCategory !== RoomObjectCategory.UNIT)
|
if (this._currentPreviewObjectCategory !== RoomObjectCategory.UNIT)
|
||||||
{
|
{
|
||||||
y = (y + (5 - Math.max(0, (height / 2))));
|
y = (y + (5 - Math.max(0, (height / 2))));
|
||||||
}
|
}
|
||||||
@ -692,11 +692,11 @@ export class RoomPreviewer
|
|||||||
const offsetX = (x - point.x);
|
const offsetX = (x - point.x);
|
||||||
const offsetY = (y - point.y);
|
const offsetY = (y - point.y);
|
||||||
|
|
||||||
if((offsetX !== 0) || (offsetY !== 0))
|
if ((offsetX !== 0) || (offsetY !== 0))
|
||||||
{
|
{
|
||||||
const _local_7 = Math.sqrt(((offsetX * offsetX) + (offsetY * offsetY)));
|
const _local_7 = Math.sqrt(((offsetX * offsetX) + (offsetY * offsetY)));
|
||||||
|
|
||||||
if(_local_7 > 10)
|
if (_local_7 > 10)
|
||||||
{
|
{
|
||||||
x = (point.x + ((offsetX * 10) / _local_7));
|
x = (point.x + ((offsetX * 10) / _local_7));
|
||||||
y = (point.y + ((offsetY * 10) / _local_7));
|
y = (point.y + ((offsetY * 10) / _local_7));
|
||||||
@ -710,19 +710,19 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public updatePreviewRoomView(k: boolean = false): void
|
public updatePreviewRoomView(k: boolean = false): void
|
||||||
{
|
{
|
||||||
if(this._disableUpdate && !k) return;
|
if (this._disableUpdate && !k) return;
|
||||||
|
|
||||||
this.checkAutomaticRoomObjectStateChange();
|
this.checkAutomaticRoomObjectStateChange();
|
||||||
|
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
let offset = this._roomEngine.getRoomInstanceRenderingCanvasOffset(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID);
|
let offset = this._roomEngine.getRoomInstanceRenderingCanvasOffset(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID);
|
||||||
|
|
||||||
if(offset)
|
if (offset)
|
||||||
{
|
{
|
||||||
this.updatePreviewObjectBoundingRectangle(offset);
|
this.updatePreviewObjectBoundingRectangle(offset);
|
||||||
|
|
||||||
if(this._currentPreviewRectangle)
|
if (this._currentPreviewRectangle)
|
||||||
{
|
{
|
||||||
const scale = this._currentPreviewScale;
|
const scale = this._currentPreviewScale;
|
||||||
|
|
||||||
@ -730,12 +730,12 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
const canvasOffset = this.getCanvasOffset(offset);
|
const canvasOffset = this.getCanvasOffset(offset);
|
||||||
|
|
||||||
if(canvasOffset)
|
if (canvasOffset)
|
||||||
{
|
{
|
||||||
this._roomEngine.setRoomInstanceRenderingCanvasOffset(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, canvasOffset);
|
this._roomEngine.setRoomInstanceRenderingCanvasOffset(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, canvasOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._currentPreviewScale !== scale) this._currentPreviewRectangle = null;
|
if (this._currentPreviewScale !== scale) this._currentPreviewRectangle = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -748,17 +748,17 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public set disableRoomEngineUpdate(flag: boolean)
|
public set disableRoomEngineUpdate(flag: boolean)
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady) this._roomEngine.disableUpdate(flag);
|
if (this.isRoomEngineReady) this._roomEngine.disableUpdate(flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
private onRoomInitializedonRoomInitialized(event: RoomEngineEvent): void
|
private onRoomInitializedonRoomInitialized(event: RoomEngineEvent): void
|
||||||
{
|
{
|
||||||
if(!event) return;
|
if (!event) return;
|
||||||
|
|
||||||
switch(event.type)
|
switch (event.type)
|
||||||
{
|
{
|
||||||
case RoomEngineEvent.INITIALIZED:
|
case RoomEngineEvent.INITIALIZED:
|
||||||
if((event.roomId === this._previewRoomId) && this.isRoomEngineReady)
|
if ((event.roomId === this._previewRoomId) && this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
this._roomEngine.updateRoomInstancePlaneType(this._previewRoomId, '110', '99999');
|
this._roomEngine.updateRoomInstancePlaneType(this._previewRoomId, '110', '99999');
|
||||||
}
|
}
|
||||||
@ -768,19 +768,19 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
private onRoomObjectAdded(event: RoomEngineObjectEvent): void
|
private onRoomObjectAdded(event: RoomEngineObjectEvent): void
|
||||||
{
|
{
|
||||||
if((event.roomId === this._previewRoomId) && (event.objectId === RoomPreviewer.PREVIEW_OBJECT_ID) && (event.category === this._currentPreviewObjectCategory))
|
if ((event.roomId === this._previewRoomId) && (event.objectId === RoomPreviewer.PREVIEW_OBJECT_ID) && (event.category === this._currentPreviewObjectCategory))
|
||||||
{
|
{
|
||||||
this._currentPreviewRectangle = null;
|
this._currentPreviewRectangle = null;
|
||||||
this._currentPreviewNeedsZoomOut = false;
|
this._currentPreviewNeedsZoomOut = false;
|
||||||
|
|
||||||
const roomObject = this._roomEngine.getRoomObject(event.roomId, event.objectId, event.category);
|
const roomObject = this._roomEngine.getRoomObject(event.roomId, event.objectId, event.category);
|
||||||
|
|
||||||
if(roomObject && roomObject.model && (event.category === RoomObjectCategory.WALL))
|
if (roomObject && roomObject.model && (event.category === RoomObjectCategory.WALL))
|
||||||
{
|
{
|
||||||
const sizeZ = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_SIZE_Z);
|
const sizeZ = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_SIZE_Z);
|
||||||
const centerZ = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_CENTER_Z);
|
const centerZ = roomObject.model.getValue<number>(RoomObjectVariable.FURNITURE_CENTER_Z);
|
||||||
|
|
||||||
if((sizeZ !== null) || (centerZ !== null))
|
if ((sizeZ !== null) || (centerZ !== null))
|
||||||
{
|
{
|
||||||
this._roomEngine.updateRoomObjectWallLocation(event.roomId, event.objectId, new Vector3d(0.5, 2.3, (((3.6 - sizeZ) / 2) + centerZ)));
|
this._roomEngine.updateRoomObjectWallLocation(event.roomId, event.objectId, new Vector3d(0.5, 2.3, (((3.6 - sizeZ) / 2) + centerZ)));
|
||||||
}
|
}
|
||||||
@ -790,21 +790,21 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public updateRoomEngine(): void
|
public updateRoomEngine(): void
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady) this._roomEngine.runUpdate();
|
if (this.isRoomEngineReady) this._roomEngine.runUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRenderingCanvas(): IRoomRenderingCanvas
|
public getRenderingCanvas(): IRoomRenderingCanvas
|
||||||
{
|
{
|
||||||
const renderingCanvas = this._roomEngine.getRoomInstanceRenderingCanvas(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID);
|
const renderingCanvas = this._roomEngine.getRoomInstanceRenderingCanvas(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID);
|
||||||
|
|
||||||
if(!renderingCanvas) return null;
|
if (!renderingCanvas) return null;
|
||||||
|
|
||||||
return renderingCanvas;
|
return renderingCanvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
public getGenericRoomObjectImage(type: string, value: string, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0, extras: string = null, objectData: IObjectData = null, state: number = -1, frame: number = -1, posture: string = null): ImageResult
|
public getGenericRoomObjectImage(type: string, value: string, direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0, extras: string = null, objectData: IObjectData = null, state: number = -1, frame: number = -1, posture: string = null): ImageResult
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
return this._roomEngine.getGenericRoomObjectImage(type, value, direction, scale, listener, bgColor, extras, objectData, state, frame, posture);
|
return this._roomEngine.getGenericRoomObjectImage(type, value, direction, scale, listener, bgColor, extras, objectData, state, frame, posture);
|
||||||
}
|
}
|
||||||
@ -814,7 +814,7 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public getRoomObjectImage(direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0): ImageResult
|
public getRoomObjectImage(direction: IVector3D, scale: number, listener: IGetImageListener, bgColor: number = 0): ImageResult
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
return this._roomEngine.getRoomObjectImage(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory, direction, scale, listener, bgColor);
|
return this._roomEngine.getRoomObjectImage(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory, direction, scale, listener, bgColor);
|
||||||
}
|
}
|
||||||
@ -824,11 +824,11 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public getRoomObjectCurrentImage(): RenderTexture
|
public getRoomObjectCurrentImage(): RenderTexture
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
||||||
|
|
||||||
if(roomObject && roomObject.visualization) return roomObject.visualization.getImage(0xFFFFFF, -1);
|
if (roomObject && roomObject.visualization) return roomObject.visualization.getImage(0xFFFFFF, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -836,11 +836,11 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public getRoomPreviewObject(): IRoomObjectController
|
public getRoomPreviewObject(): IRoomObjectController
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, this._currentPreviewObjectCategory);
|
||||||
|
|
||||||
if(roomObject) return roomObject;
|
if (roomObject) return roomObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -848,11 +848,11 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
public getRoomPreviewOwnRoomObject(): IRoomObjectController
|
public getRoomPreviewOwnRoomObject(): IRoomObjectController
|
||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if (this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM);
|
const roomObject = this._roomEngine.getRoomObject(this._previewRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM);
|
||||||
|
|
||||||
if(roomObject) return roomObject;
|
if (roomObject) return roomObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import { Resource, Texture } from '@pixi/core';
|
import { Resource, Texture } from '@pixi/core';
|
||||||
import { IAssetManager, IDisposable, IMessageEvent } from '../../../api';
|
import { IAssetManager, IDisposable, IMessageEvent } from '../../../api';
|
||||||
import { NitroContainer, NitroTexture } from '../../../core/utils';
|
import { NitroContainer, NitroSprite, NitroTexture } from '../../../pixi-proxy';
|
||||||
import { NitroSprite } from '../../../core/utils/proxy/NitroSprite';
|
|
||||||
import { GroupBadgePartsEvent } from '../../communication/messages/incoming/group/GroupBadgePartsEvent';
|
import { GroupBadgePartsEvent } from '../../communication/messages/incoming/group/GroupBadgePartsEvent';
|
||||||
import { Nitro } from '../../Nitro';
|
import { Nitro } from '../../Nitro';
|
||||||
import { BadgeImageReadyEvent } from '../events/BadgeImageReadyEvent';
|
import { BadgeImageReadyEvent } from '../events/BadgeImageReadyEvent';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { RenderTexture } from '@pixi/core';
|
import { RenderTexture } from '@pixi/core';
|
||||||
import { Point, Rectangle } from '@pixi/math';
|
import { Point, Rectangle } from '@pixi/math';
|
||||||
import { IGraphicAssetCollection } from '../../../api';
|
import { IGraphicAssetCollection } from '../../../api';
|
||||||
import { NitroContainer, NitroSprite } from '../../../core';
|
import { NitroContainer, NitroSprite } from '../../../pixi-proxy';
|
||||||
import { RoomObjectSpriteData } from '../../data/RoomObjectSpriteData';
|
import { RoomObjectSpriteData } from '../../data/RoomObjectSpriteData';
|
||||||
import { IRoomGeometry } from '../../utils/IRoomGeometry';
|
import { IRoomGeometry } from '../../utils/IRoomGeometry';
|
||||||
import { TextureUtils } from '../../utils/TextureUtils';
|
import { TextureUtils } from '../../utils/TextureUtils';
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
import { Resource, Texture } from '@pixi/core';
|
import { Resource, Texture } from '@pixi/core';
|
||||||
import { NitroSprite } from '../../../../core';
|
import { NitroSprite } from '../../../../pixi-proxy';
|
||||||
import { TextureUtils } from '../../../utils';
|
import { TextureUtils } from '../../../utils';
|
||||||
|
|
||||||
export class GraphicAssetPalette
|
export class GraphicAssetPalette
|
||||||
{
|
{
|
||||||
private _palette: [ number, number, number ][];
|
private _palette: [number, number, number][];
|
||||||
private _primaryColor: number;
|
private _primaryColor: number;
|
||||||
private _secondaryColor: number;
|
private _secondaryColor: number;
|
||||||
|
|
||||||
constructor(palette: [ number, number, number ][], primaryColor: number, secondaryColor: number)
|
constructor(palette: [number, number, number][], primaryColor: number, secondaryColor: number)
|
||||||
{
|
{
|
||||||
this._palette = palette;
|
this._palette = palette;
|
||||||
|
|
||||||
while(this._palette.length < 256) this._palette.push([ 0, 0, 0 ]);
|
while (this._palette.length < 256) this._palette.push([0, 0, 0]);
|
||||||
|
|
||||||
this._primaryColor = primaryColor;
|
this._primaryColor = primaryColor;
|
||||||
this._secondaryColor = secondaryColor;
|
this._secondaryColor = secondaryColor;
|
||||||
@ -31,15 +31,15 @@ export class GraphicAssetPalette
|
|||||||
const textureImageData = textureCtx.getImageData(0, 0, textureCanvas.width, textureCanvas.height);
|
const textureImageData = textureCtx.getImageData(0, 0, textureCanvas.width, textureCanvas.height);
|
||||||
const data = textureImageData.data;
|
const data = textureImageData.data;
|
||||||
|
|
||||||
for(let i = 0; i < data.length; i += 4)
|
for (let i = 0; i < data.length; i += 4)
|
||||||
{
|
{
|
||||||
let paletteColor = this._palette[data[ i + 1 ]];
|
let paletteColor = this._palette[data[i + 1]];
|
||||||
|
|
||||||
if(paletteColor === undefined) paletteColor = [ 0, 0, 0 ];
|
if (paletteColor === undefined) paletteColor = [0, 0, 0];
|
||||||
|
|
||||||
data[ i ] = paletteColor[0];
|
data[i] = paletteColor[0];
|
||||||
data[ i + 1 ] = paletteColor[1];
|
data[i + 1] = paletteColor[1];
|
||||||
data[ i + 2 ] = paletteColor[2];
|
data[i + 2] = paletteColor[2];
|
||||||
}
|
}
|
||||||
|
|
||||||
textureCtx.putImageData(textureImageData, 0, 0);
|
textureCtx.putImageData(textureImageData, 0, 0);
|
||||||
|
@ -3,9 +3,9 @@ import { Container, DisplayObject } from '@pixi/display';
|
|||||||
import { Graphics } from '@pixi/graphics';
|
import { Graphics } from '@pixi/graphics';
|
||||||
import { Matrix, Point, Rectangle } from '@pixi/math';
|
import { Matrix, Point, Rectangle } from '@pixi/math';
|
||||||
import { Sprite } from '@pixi/sprite';
|
import { Sprite } from '@pixi/sprite';
|
||||||
import { NitroContainer, NitroSprite } from '../../core';
|
|
||||||
import { Nitro } from '../../nitro/Nitro';
|
import { Nitro } from '../../nitro/Nitro';
|
||||||
import { MouseEventType } from '../../nitro/ui/MouseEventType';
|
import { MouseEventType } from '../../nitro/ui/MouseEventType';
|
||||||
|
import { NitroContainer, NitroSprite } from '../../pixi-proxy';
|
||||||
import { RoomObjectSpriteData } from '../data/RoomObjectSpriteData';
|
import { RoomObjectSpriteData } from '../data/RoomObjectSpriteData';
|
||||||
import { RoomSpriteMouseEvent } from '../events/RoomSpriteMouseEvent';
|
import { RoomSpriteMouseEvent } from '../events/RoomSpriteMouseEvent';
|
||||||
import { RoomObjectSpriteType } from '../object/enum/RoomObjectSpriteType';
|
import { RoomObjectSpriteType } from '../object/enum/RoomObjectSpriteType';
|
||||||
@ -136,14 +136,14 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
private setupCanvas(): void
|
private setupCanvas(): void
|
||||||
{
|
{
|
||||||
if(!this._master)
|
if (!this._master)
|
||||||
{
|
{
|
||||||
this._master = new NitroSprite();
|
this._master = new NitroSprite();
|
||||||
|
|
||||||
this._master.interactiveChildren = false;
|
this._master.interactiveChildren = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this._display)
|
if (!this._display)
|
||||||
{
|
{
|
||||||
const display = new NitroContainer();
|
const display = new NitroContainer();
|
||||||
|
|
||||||
@ -157,32 +157,32 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
{
|
{
|
||||||
this.cleanSprites(0, true);
|
this.cleanSprites(0, true);
|
||||||
|
|
||||||
if(this._geometry)
|
if (this._geometry)
|
||||||
{
|
{
|
||||||
this._geometry.dispose();
|
this._geometry.dispose();
|
||||||
|
|
||||||
this._geometry = null;
|
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.dispose();
|
||||||
|
|
||||||
this._objectCache = null;
|
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);
|
const child = this._master.removeChildAt(0);
|
||||||
|
|
||||||
child.destroy();
|
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();
|
this._master.destroy();
|
||||||
|
|
||||||
@ -192,16 +192,16 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
this._display = null;
|
this._display = null;
|
||||||
this._sortableSprites = [];
|
this._sortableSprites = [];
|
||||||
|
|
||||||
if(this._mouseActiveObjects)
|
if (this._mouseActiveObjects)
|
||||||
{
|
{
|
||||||
this._mouseActiveObjects.clear();
|
this._mouseActiveObjects.clear();
|
||||||
|
|
||||||
this._mouseActiveObjects = null;
|
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);
|
this.cleanSprite(sprite, true);
|
||||||
}
|
}
|
||||||
@ -209,7 +209,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
this._spritePool = [];
|
this._spritePool = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._eventCache)
|
if (this._eventCache)
|
||||||
{
|
{
|
||||||
this._eventCache.clear();
|
this._eventCache.clear();
|
||||||
|
|
||||||
@ -224,20 +224,20 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
width = width < 1 ? 1 : width;
|
width = width < 1 ? 1 : width;
|
||||||
height = height < 1 ? 1 : height;
|
height = height < 1 ? 1 : height;
|
||||||
|
|
||||||
if(this._usesMask)
|
if (this._usesMask)
|
||||||
{
|
{
|
||||||
if(!this._mask)
|
if (!this._mask)
|
||||||
{
|
{
|
||||||
this._mask = new Graphics()
|
this._mask = new Graphics()
|
||||||
.beginFill(0xFF0000)
|
.beginFill(0xFF0000)
|
||||||
.drawRect(0, 0, width, height)
|
.drawRect(0, 0, width, height)
|
||||||
.endFill();
|
.endFill();
|
||||||
|
|
||||||
if(this._master)
|
if (this._master)
|
||||||
{
|
{
|
||||||
this._master.addChild(this._mask);
|
this._master.addChild(this._mask);
|
||||||
|
|
||||||
if(this._display) this._display.mask = this._mask;
|
if (this._display) this._display.mask = this._mask;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -250,9 +250,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);
|
const hitArea = (this._master.hitArea as Rectangle);
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
this._master.hitArea = new Rectangle(0, 0, width, height);
|
this._master.hitArea = new Rectangle(0, 0, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._master.filterArea)
|
if (this._master.filterArea)
|
||||||
{
|
{
|
||||||
const filterArea = this._master.filterArea;
|
const filterArea = this._master.filterArea;
|
||||||
|
|
||||||
@ -283,11 +283,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
public setMask(flag: boolean): void
|
public setMask(flag: boolean): void
|
||||||
{
|
{
|
||||||
if(flag && !this._usesMask)
|
if (flag && !this._usesMask)
|
||||||
{
|
{
|
||||||
this._usesMask = true;
|
this._usesMask = true;
|
||||||
|
|
||||||
if(this._mask && (this._mask.parent !== this._master))
|
if (this._mask && (this._mask.parent !== this._master))
|
||||||
{
|
{
|
||||||
this._master.addChild(this._mask);
|
this._master.addChild(this._mask);
|
||||||
|
|
||||||
@ -295,11 +295,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(!flag && this._usesMask)
|
else if (!flag && this._usesMask)
|
||||||
{
|
{
|
||||||
this._usesMask = false;
|
this._usesMask = false;
|
||||||
|
|
||||||
if(this._mask && (this._mask.parent === this._master))
|
if (this._mask && (this._mask.parent === this._master))
|
||||||
{
|
{
|
||||||
this._master.removeChild(this._mask);
|
this._master.removeChild(this._mask);
|
||||||
|
|
||||||
@ -310,17 +310,17 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
public setScale(scale: number, point: Point = null, offsetPoint: Point = null, override: boolean = false, asDelta: boolean = false): void
|
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);
|
point = this._display.toLocal(point);
|
||||||
|
|
||||||
if(asDelta)
|
if (asDelta)
|
||||||
{
|
{
|
||||||
this._scale *= scale;
|
this._scale *= scale;
|
||||||
}
|
}
|
||||||
@ -339,15 +339,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
this._totalTimeRunning += Nitro.instance.ticker.deltaTime;
|
this._totalTimeRunning += Nitro.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.x = this._screenOffsetX;
|
||||||
this._display.y = this._screenOffsetY;
|
this._display.y = this._screenOffsetY;
|
||||||
@ -355,7 +355,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
update = true;
|
update = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._display.scale.x !== this._scale)
|
if (this._display.scale.x !== this._scale)
|
||||||
{
|
{
|
||||||
this._display.scale.set(this._scale);
|
this._display.scale.set(this._scale);
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
let updateVisuals = false;
|
let updateVisuals = false;
|
||||||
|
|
||||||
if(frame !== this._lastFrame)
|
if (frame !== this._lastFrame)
|
||||||
{
|
{
|
||||||
this._lastFrame = frame;
|
this._lastFrame = frame;
|
||||||
|
|
||||||
@ -379,11 +379,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
const objects = this._container.objects;
|
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));
|
spriteCount = (spriteCount + this.renderObject(object, object.instanceId.toString(), time, update, updateVisuals, spriteCount));
|
||||||
}
|
}
|
||||||
@ -394,25 +394,25 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
return b.z - a.z;
|
return b.z - a.z;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(spriteCount < this._sortableSprites.length)
|
if (spriteCount < this._sortableSprites.length)
|
||||||
{
|
{
|
||||||
this._sortableSprites.splice(spriteCount);
|
this._sortableSprites.splice(spriteCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
let iterator = 0;
|
let iterator = 0;
|
||||||
|
|
||||||
while(iterator < spriteCount)
|
while (iterator < spriteCount)
|
||||||
{
|
{
|
||||||
const sprite = this._sortableSprites[iterator];
|
const sprite = this._sortableSprites[iterator];
|
||||||
|
|
||||||
if(sprite && sprite.sprite) this.renderSprite(iterator, sprite);
|
if (sprite && sprite.sprite) this.renderSprite(iterator, sprite);
|
||||||
|
|
||||||
iterator++;
|
iterator++;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.cleanSprites(spriteCount);
|
this.cleanSprites(spriteCount);
|
||||||
|
|
||||||
if(update || updateVisuals) this._canvasUpdated = true;
|
if (update || updateVisuals) this._canvasUpdated = true;
|
||||||
|
|
||||||
this._renderTimestamp = this._totalTimeRunning;
|
this._renderTimestamp = this._totalTimeRunning;
|
||||||
this._renderedWidth = this._width;
|
this._renderedWidth = this._width;
|
||||||
@ -448,11 +448,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
private renderObject(object: IRoomObject, identifier: string, time: number, update: boolean, updateVisuals: boolean, count: number): number
|
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;
|
const visualization = object.visualization as IRoomObjectSpriteVisualization;
|
||||||
|
|
||||||
if(!visualization)
|
if (!visualization)
|
||||||
{
|
{
|
||||||
this.removeFromCache(identifier);
|
this.removeFromCache(identifier);
|
||||||
|
|
||||||
@ -467,18 +467,18 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
const vector = locationCache.updateLocation(object, this._geometry);
|
const vector = locationCache.updateLocation(object, this._geometry);
|
||||||
|
|
||||||
if(!vector)
|
if (!vector)
|
||||||
{
|
{
|
||||||
this.removeFromCache(identifier);
|
this.removeFromCache(identifier);
|
||||||
|
|
||||||
return 0;
|
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;
|
return sortableCache.spriteCount;
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
let y = vector.y;
|
let y = vector.y;
|
||||||
let z = vector.z;
|
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));
|
else z = (z + (-(x) * 1.2E-7));
|
||||||
|
|
||||||
x = (x + Math.trunc(this._width / 2));
|
x = (x + Math.trunc(this._width / 2));
|
||||||
@ -495,40 +495,40 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
let spriteCount = 0;
|
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 texture = sprite.texture;
|
||||||
const baseTexture = texture && texture.baseTexture;
|
const baseTexture = texture && texture.baseTexture;
|
||||||
|
|
||||||
if(!texture || !baseTexture) continue;
|
if (!texture || !baseTexture) continue;
|
||||||
|
|
||||||
const spriteX = ((x + sprite.offsetX) + this._screenOffsetX);
|
const spriteX = ((x + sprite.offsetX) + this._screenOffsetX);
|
||||||
const spriteY = ((y + sprite.offsetY) + this._screenOffsetY);
|
const spriteY = ((y + sprite.offsetY) + this._screenOffsetY);
|
||||||
|
|
||||||
if(sprite.flipH)
|
if (sprite.flipH)
|
||||||
{
|
{
|
||||||
const checkX = ((x + (-(texture.width + (-(sprite.offsetX))))) + this._screenOffsetX);
|
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);
|
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
|
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);
|
let sortableSprite = sortableCache.getSprite(spriteCount);
|
||||||
|
|
||||||
if(!sortableSprite)
|
if (!sortableSprite)
|
||||||
{
|
{
|
||||||
sortableSprite = new SortableSprite();
|
sortableSprite = new SortableSprite();
|
||||||
|
|
||||||
@ -541,7 +541,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
sortableSprite.sprite = sprite;
|
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;
|
sortableSprite.sprite.libraryAssetName = 'avatar_' + object.id;
|
||||||
}
|
}
|
||||||
@ -563,41 +563,41 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
private getExtendedSprite(index: number): ExtendedSprite
|
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);
|
const sprite = (this._display.getChildAt(index) as ExtendedSprite);
|
||||||
|
|
||||||
if(!sprite) return null;
|
if (!sprite) return null;
|
||||||
|
|
||||||
return sprite;
|
return sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getExtendedSpriteIdentifier(sprite: ExtendedSprite): string
|
protected getExtendedSpriteIdentifier(sprite: ExtendedSprite): string
|
||||||
{
|
{
|
||||||
if(!sprite) return '';
|
if (!sprite) return '';
|
||||||
|
|
||||||
return sprite.name;
|
return sprite.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderSprite(index: number, sprite: SortableSprite): boolean
|
private renderSprite(index: number, sprite: SortableSprite): boolean
|
||||||
{
|
{
|
||||||
if(index >= this._spriteCount)
|
if (index >= this._spriteCount)
|
||||||
{
|
{
|
||||||
this.createAndAddSprite(sprite);
|
this.createAndAddSprite(sprite);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!sprite) return false;
|
if (!sprite) return false;
|
||||||
|
|
||||||
const objectSprite = sprite.sprite;
|
const objectSprite = sprite.sprite;
|
||||||
const extendedSprite = this.getExtendedSprite(index);
|
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);
|
this._display.removeChildAt(index);
|
||||||
|
|
||||||
@ -611,7 +611,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
return true;
|
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.tag = objectSprite.tag;
|
||||||
extendedSprite.alphaTolerance = objectSprite.alphaTolerance;
|
extendedSprite.alphaTolerance = objectSprite.alphaTolerance;
|
||||||
@ -622,48 +622,48 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
const alpha = (objectSprite.alpha / 255);
|
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;
|
const length = extendedSprite.children.length;
|
||||||
|
|
||||||
if(length === 1) extendedSprite.removeChildAt(0);
|
if (length === 1) extendedSprite.removeChildAt(0);
|
||||||
|
|
||||||
extendedSprite.addChild(objectSprite.container);
|
extendedSprite.addChild(objectSprite.container);
|
||||||
|
|
||||||
objectSprite.updateContainer = false;
|
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
|
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
|
else
|
||||||
{
|
{
|
||||||
if(extendedSprite.scale.y !== 1) extendedSprite.scale.y = 1;
|
if (extendedSprite.scale.y !== 1) extendedSprite.scale.y = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.updateEnterRoomEffect(extendedSprite, objectSprite);
|
this.updateEnterRoomEffect(extendedSprite, objectSprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(extendedSprite.x !== sprite.x) extendedSprite.x = sprite.x;
|
if (extendedSprite.x !== sprite.x) extendedSprite.x = sprite.x;
|
||||||
if(extendedSprite.y !== sprite.y) extendedSprite.y = sprite.y;
|
if (extendedSprite.y !== sprite.y) extendedSprite.y = sprite.y;
|
||||||
|
|
||||||
extendedSprite.offsetX = objectSprite.offsetX;
|
extendedSprite.offsetX = objectSprite.offsetX;
|
||||||
extendedSprite.offsetY = objectSprite.offsetY;
|
extendedSprite.offsetY = objectSprite.offsetY;
|
||||||
@ -675,15 +675,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
{
|
{
|
||||||
const sprite = sortableSprite.sprite;
|
const sprite = sortableSprite.sprite;
|
||||||
|
|
||||||
if(!sprite) return;
|
if (!sprite) return;
|
||||||
|
|
||||||
let extendedSprite: ExtendedSprite = null;
|
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.tag = sprite.tag;
|
||||||
extendedSprite.alphaTolerance = sprite.alphaTolerance;
|
extendedSprite.alphaTolerance = sprite.alphaTolerance;
|
||||||
@ -701,20 +701,20 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
extendedSprite.setTexture(sprite.texture);
|
extendedSprite.setTexture(sprite.texture);
|
||||||
|
|
||||||
if(sprite.updateContainer)
|
if (sprite.updateContainer)
|
||||||
{
|
{
|
||||||
extendedSprite.addChild(sprite.container);
|
extendedSprite.addChild(sprite.container);
|
||||||
|
|
||||||
sprite.updateContainer = false;
|
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);
|
this.updateEnterRoomEffect(extendedSprite, sprite);
|
||||||
|
|
||||||
if((index < 0) || (index >= this._spriteCount))
|
if ((index < 0) || (index >= this._spriteCount))
|
||||||
{
|
{
|
||||||
this._display.addChild(extendedSprite);
|
this._display.addChild(extendedSprite);
|
||||||
|
|
||||||
@ -730,15 +730,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
private cleanSprites(spriteCount: number, _arg_2: boolean = false): void
|
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);
|
let iterator = (this._spriteCount - 1);
|
||||||
|
|
||||||
while(iterator >= spriteCount)
|
while (iterator >= spriteCount)
|
||||||
{
|
{
|
||||||
this.cleanSprite(this.getExtendedSprite(iterator), _arg_2);
|
this.cleanSprite(this.getExtendedSprite(iterator), _arg_2);
|
||||||
|
|
||||||
@ -751,9 +751,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
private updateEnterRoomEffect(sprite: ExtendedSprite, _arg_2: IRoomObjectSprite): void
|
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:
|
case RoomObjectSpriteType.AVATAR_OWN:
|
||||||
return;
|
return;
|
||||||
@ -770,15 +770,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
private cleanSprite(sprite: ExtendedSprite, _arg_2: boolean): void
|
private cleanSprite(sprite: ExtendedSprite, _arg_2: boolean): void
|
||||||
{
|
{
|
||||||
if(!sprite) return;
|
if (!sprite) return;
|
||||||
|
|
||||||
if(!_arg_2)
|
if (!_arg_2)
|
||||||
{
|
{
|
||||||
sprite.setTexture(null);
|
sprite.setTexture(null);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(sprite.parent) sprite.parent.removeChild(sprite);
|
if (sprite.parent) sprite.parent.removeChild(sprite);
|
||||||
|
|
||||||
sprite.destroy({
|
sprite.destroy({
|
||||||
children: true
|
children: true
|
||||||
@ -788,7 +788,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
public update(): void
|
public update(): void
|
||||||
{
|
{
|
||||||
if(!this._mouseCheckCount)
|
if (!this._mouseCheckCount)
|
||||||
{
|
{
|
||||||
//this.checkMouseHits(this._mouseLocation.x, this._mouseLocation.y, MouseEventType.MOUSE_MOVE);
|
//this.checkMouseHits(this._mouseLocation.x, this._mouseLocation.y, MouseEventType.MOUSE_MOVE);
|
||||||
}
|
}
|
||||||
@ -810,16 +810,16 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
private isSpriteVisible(x: number, y: number, width: number, height: number): boolean
|
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);
|
x = (((x - this._screenOffsetX) * this._scale) + this._screenOffsetX);
|
||||||
y = (((y - this._screenOffsetY) * this._scale) + this._screenOffsetY);
|
y = (((y - this._screenOffsetY) * this._scale) + this._screenOffsetY);
|
||||||
width = (width * this._scale);
|
width = (width * this._scale);
|
||||||
height = (height * 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;
|
return false;
|
||||||
@ -833,7 +833,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
this._mouseLocation.x = (x / this._scale);
|
this._mouseLocation.x = (x / this._scale);
|
||||||
this._mouseLocation.y = (y / 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);
|
this._mouseSpriteWasHit = this.checkMouseHits(Math.trunc(x / this._scale), Math.trunc(y / this._scale), type, altKey, ctrlKey, shiftKey, buttonDown);
|
||||||
|
|
||||||
@ -850,13 +850,13 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
let mouseEvent: RoomSpriteMouseEvent = null;
|
let mouseEvent: RoomSpriteMouseEvent = null;
|
||||||
let spriteId = (this._activeSpriteCount - 1);
|
let spriteId = (this._activeSpriteCount - 1);
|
||||||
|
|
||||||
while(spriteId >= 0)
|
while (spriteId >= 0)
|
||||||
{
|
{
|
||||||
const extendedSprite = this.getExtendedSprite(spriteId);
|
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)))
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
@ -864,15 +864,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
{
|
{
|
||||||
const identifier = this.getExtendedSpriteIdentifier(extendedSprite);
|
const identifier = this.getExtendedSpriteIdentifier(extendedSprite);
|
||||||
|
|
||||||
if(checkedSprites.indexOf(identifier) === -1)
|
if (checkedSprites.indexOf(identifier) === -1)
|
||||||
{
|
{
|
||||||
const tag = extendedSprite.tag;
|
const tag = extendedSprite.tag;
|
||||||
|
|
||||||
let mouseData = this._mouseActiveObjects.get(identifier);
|
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);
|
mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, mouseData.spriteTag, altKey, ctrlKey, shiftKey, buttonDown);
|
||||||
|
|
||||||
@ -880,7 +880,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);
|
mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), MouseEventType.ROLL_OVER, tag, altKey, ctrlKey, shiftKey, buttonDown);
|
||||||
}
|
}
|
||||||
@ -892,7 +892,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
mouseEvent.spriteOffsetY = extendedSprite.offsetY;
|
mouseEvent.spriteOffsetY = extendedSprite.offsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!mouseData)
|
if (!mouseData)
|
||||||
{
|
{
|
||||||
mouseData = new ObjectMouseData();
|
mouseData = new ObjectMouseData();
|
||||||
|
|
||||||
@ -902,7 +902,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
mouseData.spriteTag = tag;
|
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);
|
this.bufferMouseEvent(mouseEvent, identifier);
|
||||||
}
|
}
|
||||||
@ -919,30 +919,30 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
const keys: string[] = [];
|
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;
|
let index = 0;
|
||||||
|
|
||||||
while(index < keys.length)
|
while (index < keys.length)
|
||||||
{
|
{
|
||||||
const key = keys[index];
|
const key = keys[index];
|
||||||
|
|
||||||
if(checkedSprites.indexOf(key) >= 0) keys[index] = null;
|
if (checkedSprites.indexOf(key) >= 0) keys[index] = null;
|
||||||
|
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = 0;
|
index = 0;
|
||||||
|
|
||||||
while(index < keys.length)
|
while (index < keys.length)
|
||||||
{
|
{
|
||||||
const key = keys[index];
|
const key = keys[index];
|
||||||
|
|
||||||
if(key !== null)
|
if (key !== null)
|
||||||
{
|
{
|
||||||
const existing = this._mouseActiveObjects.get(key);
|
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);
|
const mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, existing.spriteTag, altKey, ctrlKey, shiftKey, buttonDown);
|
||||||
|
|
||||||
@ -963,14 +963,14 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
{
|
{
|
||||||
const screenX: number = (x - (this._width / 2));
|
const screenX: number = (x - (this._width / 2));
|
||||||
const screenY: number = (y - (this._height / 2));
|
const screenY: number = (y - (this._height / 2));
|
||||||
const canvasName = `canvas_${ this._id }`;
|
const canvasName = `canvas_${this._id}`;
|
||||||
|
|
||||||
return new RoomSpriteMouseEvent(type, ((canvasName + '_') + this._eventId), canvasName, tag, screenX, screenY, localX, localY, ctrlKey, altKey, shiftKey, buttonDown);
|
return new RoomSpriteMouseEvent(type, ((canvasName + '_') + this._eventId), canvasName, tag, screenX, screenY, localX, localY, ctrlKey, altKey, shiftKey, buttonDown);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bufferMouseEvent(k: RoomSpriteMouseEvent, _arg_2: string): void
|
protected bufferMouseEvent(k: RoomSpriteMouseEvent, _arg_2: string): void
|
||||||
{
|
{
|
||||||
if(!k || !this._eventCache) return;
|
if (!k || !this._eventCache) return;
|
||||||
|
|
||||||
this._eventCache.delete(_arg_2);
|
this._eventCache.delete(_arg_2);
|
||||||
this._eventCache.set(_arg_2, k);
|
this._eventCache.set(_arg_2, k);
|
||||||
@ -978,19 +978,19 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
protected processMouseEvents(): void
|
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));
|
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);
|
this._mouseListener.processRoomCanvasMouseEvent(event, roomObject, this._geometry);
|
||||||
}
|
}
|
||||||
@ -998,14 +998,14 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
{
|
{
|
||||||
const logic = roomObject.mouseHandler;
|
const logic = roomObject.mouseHandler;
|
||||||
|
|
||||||
if(logic)
|
if (logic)
|
||||||
{
|
{
|
||||||
logic.mouseEvent(event, this._geometry);
|
logic.mouseEvent(event, this._geometry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this._eventCache) this._eventCache.clear();
|
if (this._eventCache) this._eventCache.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
public getDisplayAsTexture(): RenderTexture
|
public getDisplayAsTexture(): RenderTexture
|
||||||
@ -1048,7 +1048,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
{
|
{
|
||||||
const geometry = (this.geometry as RoomGeometry);
|
const geometry = (this.geometry as RoomGeometry);
|
||||||
|
|
||||||
if(this._rotation !== 0)
|
if (this._rotation !== 0)
|
||||||
{
|
{
|
||||||
let direction = this._effectDirection;
|
let direction = this._effectDirection;
|
||||||
|
|
||||||
@ -1074,18 +1074,18 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
this._effectDirection.assign(geometry.direction);
|
this._effectDirection.assign(geometry.direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(RoomShakingEffect.isVisualizationOn() && !this._SafeStr_4507)
|
if (RoomShakingEffect.isVisualizationOn() && !this._SafeStr_4507)
|
||||||
{
|
{
|
||||||
this.changeShaking();
|
this.changeShaking();
|
||||||
}
|
}
|
||||||
else
|
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++;
|
this._SafeStr_795++;
|
||||||
|
|
||||||
@ -1106,7 +1106,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
{
|
{
|
||||||
this._SafeStr_4507 = !this._SafeStr_4507;
|
this._SafeStr_4507 = !this._SafeStr_4507;
|
||||||
|
|
||||||
if(this._SafeStr_4507)
|
if (this._SafeStr_4507)
|
||||||
{
|
{
|
||||||
const direction = this.geometry.direction;
|
const direction = this.geometry.direction;
|
||||||
|
|
||||||
@ -1116,13 +1116,13 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
private changeRotation(): void
|
private changeRotation(): void
|
||||||
{
|
{
|
||||||
if(this._SafeStr_4507) return;
|
if (this._SafeStr_4507) return;
|
||||||
|
|
||||||
const geometry = (this.geometry as RoomGeometry);
|
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 location = geometry.location;
|
||||||
const directionAxis = geometry.directionAxis;
|
const directionAxis = geometry.directionAxis;
|
||||||
@ -1134,7 +1134,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
const intersection = RoomGeometry.getIntersectionVector(location, directionAxis, new Vector3d(0, 0, 0), new Vector3d(0, 0, 1));
|
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._rotationOrigin = new Vector3d(intersection.x, intersection.y, intersection.z);
|
||||||
this._rotationRodLength = Vector3d.dif(intersection, location).length;
|
this._rotationRodLength = Vector3d.dif(intersection, location).length;
|
||||||
@ -1153,9 +1153,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
public moveLeft(): void
|
public moveLeft(): void
|
||||||
{
|
{
|
||||||
if(this._rotation !== 0)
|
if (this._rotation !== 0)
|
||||||
{
|
{
|
||||||
if(this._rotation === 1)
|
if (this._rotation === 1)
|
||||||
{
|
{
|
||||||
this._rotation = -1;
|
this._rotation = -1;
|
||||||
}
|
}
|
||||||
@ -1175,9 +1175,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
public moveRight(): void
|
public moveRight(): void
|
||||||
{
|
{
|
||||||
if(this._rotation !== 0)
|
if (this._rotation !== 0)
|
||||||
{
|
{
|
||||||
if(this._rotation === -1)
|
if (this._rotation === -1)
|
||||||
{
|
{
|
||||||
this._rotation = 1;
|
this._rotation = 1;
|
||||||
}
|
}
|
||||||
@ -1197,7 +1197,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
public moveUp(): void
|
public moveUp(): void
|
||||||
{
|
{
|
||||||
if(this._rotation !== 0) return;
|
if (this._rotation !== 0) return;
|
||||||
|
|
||||||
const geometry = (this.geometry as RoomGeometry);
|
const geometry = (this.geometry as RoomGeometry);
|
||||||
const direction = ((geometry.direction.x / 180) * 3.14159265358979);
|
const direction = ((geometry.direction.x / 180) * 3.14159265358979);
|
||||||
@ -1207,7 +1207,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
public moveDown(): void
|
public moveDown(): void
|
||||||
{
|
{
|
||||||
if(this._rotation !== 0) return;
|
if (this._rotation !== 0) return;
|
||||||
|
|
||||||
const geometry = (this.geometry as RoomGeometry);
|
const geometry = (this.geometry as RoomGeometry);
|
||||||
const direction = (((geometry.direction.x + 180) / 180) * 3.14159265358979);
|
const direction = (((geometry.direction.x + 180) / 180) * 3.14159265358979);
|
||||||
|
@ -2,7 +2,7 @@ import { BLEND_MODES } from '@pixi/constants';
|
|||||||
import { BaseTexture, RenderTexture, Resource, Texture } from '@pixi/core';
|
import { BaseTexture, RenderTexture, Resource, Texture } from '@pixi/core';
|
||||||
import { Point } from '@pixi/math';
|
import { Point } from '@pixi/math';
|
||||||
import { Sprite } from '@pixi/sprite';
|
import { Sprite } from '@pixi/sprite';
|
||||||
import { NitroSprite } from '../../../core';
|
import { NitroSprite } from '../../../pixi-proxy';
|
||||||
import { TextureUtils } from '../../utils';
|
import { TextureUtils } from '../../utils';
|
||||||
|
|
||||||
export class ExtendedSprite extends Sprite
|
export class ExtendedSprite extends Sprite
|
||||||
@ -36,7 +36,7 @@ export class ExtendedSprite extends Sprite
|
|||||||
|
|
||||||
public needsUpdate(pairedSpriteId: number, pairedSpriteUpdateCounter: number): boolean
|
public needsUpdate(pairedSpriteId: number, pairedSpriteUpdateCounter: number): boolean
|
||||||
{
|
{
|
||||||
if((this._pairedSpriteId === pairedSpriteId) && (this._pairedSpriteUpdateCounter === pairedSpriteUpdateCounter)) return false;
|
if ((this._pairedSpriteId === pairedSpriteId) && (this._pairedSpriteUpdateCounter === pairedSpriteUpdateCounter)) return false;
|
||||||
|
|
||||||
this._pairedSpriteId = pairedSpriteId;
|
this._pairedSpriteId = pairedSpriteId;
|
||||||
this._pairedSpriteUpdateCounter = pairedSpriteUpdateCounter;
|
this._pairedSpriteUpdateCounter = pairedSpriteUpdateCounter;
|
||||||
@ -46,18 +46,18 @@ export class ExtendedSprite extends Sprite
|
|||||||
|
|
||||||
public calculateVertices(): void
|
public calculateVertices(): void
|
||||||
{
|
{
|
||||||
if(!this.texture.orig) return;
|
if (!this.texture.orig) return;
|
||||||
|
|
||||||
super.calculateVertices();
|
super.calculateVertices();
|
||||||
}
|
}
|
||||||
|
|
||||||
public setTexture(texture: Texture<Resource>): void
|
public setTexture(texture: Texture<Resource>): void
|
||||||
{
|
{
|
||||||
if(!texture) texture = Texture.EMPTY;
|
if (!texture) texture = Texture.EMPTY;
|
||||||
|
|
||||||
if(texture === this.texture) return;
|
if (texture === this.texture) return;
|
||||||
|
|
||||||
if(texture === Texture.EMPTY)
|
if (texture === Texture.EMPTY)
|
||||||
{
|
{
|
||||||
this._pairedSpriteId = -1;
|
this._pairedSpriteId = -1;
|
||||||
this._pairedSpriteUpdateCounter = -1;
|
this._pairedSpriteUpdateCounter = -1;
|
||||||
@ -73,31 +73,31 @@ export class ExtendedSprite extends Sprite
|
|||||||
|
|
||||||
public static containsPoint(sprite: ExtendedSprite, point: Point): boolean
|
public static containsPoint(sprite: ExtendedSprite, point: Point): boolean
|
||||||
{
|
{
|
||||||
if(!sprite || !point || (sprite.alphaTolerance > 255)) return false;
|
if (!sprite || !point || (sprite.alphaTolerance > 255)) return false;
|
||||||
|
|
||||||
if(!(sprite instanceof Sprite)) return false;
|
if (!(sprite instanceof Sprite)) return false;
|
||||||
|
|
||||||
if((sprite.texture === Texture.EMPTY) || (sprite.blendMode !== BLEND_MODES.NORMAL)) return;
|
if ((sprite.texture === Texture.EMPTY) || (sprite.blendMode !== BLEND_MODES.NORMAL)) return;
|
||||||
|
|
||||||
const texture = sprite.texture;
|
const texture = sprite.texture;
|
||||||
const baseTexture = texture.baseTexture;
|
const baseTexture = texture.baseTexture;
|
||||||
|
|
||||||
if(!texture || !baseTexture || !baseTexture.valid) return false;
|
if (!texture || !baseTexture || !baseTexture.valid) return false;
|
||||||
|
|
||||||
const x = (point.x * sprite.scale.x);
|
const x = (point.x * sprite.scale.x);
|
||||||
const y = (point.y * sprite.scale.y);
|
const y = (point.y * sprite.scale.y);
|
||||||
|
|
||||||
if(!sprite.getLocalBounds().contains(x, y)) return false;
|
if (!sprite.getLocalBounds().contains(x, y)) return false;
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
if(!baseTexture.hitMap)
|
if (!baseTexture.hitMap)
|
||||||
{
|
{
|
||||||
let canvas: HTMLCanvasElement = null;
|
let canvas: HTMLCanvasElement = null;
|
||||||
|
|
||||||
if(!baseTexture.resource)
|
if (!baseTexture.resource)
|
||||||
{
|
{
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
if(!texture.getLocalBounds)
|
if (!texture.getLocalBounds)
|
||||||
{
|
{
|
||||||
const tempSprite = new NitroSprite(texture);
|
const tempSprite = new NitroSprite(texture);
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ export class ExtendedSprite extends Sprite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ExtendedSprite.generateHitMap(baseTexture, canvas)) return false;
|
if (!ExtendedSprite.generateHitMap(baseTexture, canvas)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
@ -120,7 +120,7 @@ export class ExtendedSprite extends Sprite
|
|||||||
let dx = (x + texture.frame.x);
|
let dx = (x + texture.frame.x);
|
||||||
let dy = (y + texture.frame.y);
|
let dy = (y + texture.frame.y);
|
||||||
|
|
||||||
if(texture.trim)
|
if (texture.trim)
|
||||||
{
|
{
|
||||||
dx -= texture.trim.x;
|
dx -= texture.trim.x;
|
||||||
dy -= texture.trim.y;
|
dy -= texture.trim.y;
|
||||||
@ -141,27 +141,27 @@ export class ExtendedSprite extends Sprite
|
|||||||
let canvas: HTMLCanvasElement = null;
|
let canvas: HTMLCanvasElement = null;
|
||||||
let context: CanvasRenderingContext2D = null;
|
let context: CanvasRenderingContext2D = null;
|
||||||
|
|
||||||
if(tempCanvas)
|
if (tempCanvas)
|
||||||
{
|
{
|
||||||
canvas = tempCanvas;
|
canvas = tempCanvas;
|
||||||
context = canvas.getContext('2d');
|
context = canvas.getContext('2d');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(!baseTexture.resource) return false;
|
if (!baseTexture.resource) return false;
|
||||||
|
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
const source = baseTexture.resource.source as HTMLCanvasElement;
|
const source = baseTexture.resource.source as HTMLCanvasElement;
|
||||||
|
|
||||||
if(!source) return false;
|
if (!source) return false;
|
||||||
|
|
||||||
if(source.getContext)
|
if (source.getContext)
|
||||||
{
|
{
|
||||||
canvas = source;
|
canvas = source;
|
||||||
context = canvas.getContext('2d');
|
context = canvas.getContext('2d');
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(source instanceof Image)
|
else if (source instanceof Image)
|
||||||
{
|
{
|
||||||
canvas = document.createElement('canvas');
|
canvas = document.createElement('canvas');
|
||||||
canvas.width = source.width;
|
canvas.width = source.width;
|
||||||
@ -181,12 +181,12 @@ export class ExtendedSprite extends Sprite
|
|||||||
const hitmap = new Uint32Array(Math.ceil(width * height / 32));
|
const hitmap = new Uint32Array(Math.ceil(width * height / 32));
|
||||||
const threshold = 128;
|
const threshold = 128;
|
||||||
|
|
||||||
for(let i = 0; i < width * height; i++)
|
for (let i = 0; i < width * height; i++)
|
||||||
{
|
{
|
||||||
const ind1 = i % 32;
|
const ind1 = i % 32;
|
||||||
const ind2 = i / 32 | 0;
|
const ind2 = i / 32 | 0;
|
||||||
|
|
||||||
if(imageData.data[i * 4 + 3] >= threshold)
|
if (imageData.data[i * 4 + 3] >= threshold)
|
||||||
{
|
{
|
||||||
hitmap[ind2] = hitmap[ind2] | (1 << ind1);
|
hitmap[ind2] = hitmap[ind2] | (1 << ind1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user