mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-26 17:30:52 +01:00
Move some events, fix fps again
This commit is contained in:
parent
59ac489a3a
commit
fe2f2efcc8
@ -1,4 +1,4 @@
|
||||
import { NitroEvent } from '../../events';
|
||||
import { NitroEvent } from '../core';
|
||||
|
||||
export class RoomContentLoadedEvent extends NitroEvent
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject } from '../../api';
|
||||
import { RoomObjectEvent } from '../../room';
|
||||
import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectBadgeAssetEvent extends RoomObjectEvent
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject } from '../../api';
|
||||
import { RoomObjectEvent } from '../../room';
|
||||
import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectDataRequestEvent extends RoomObjectEvent
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject } from '../../api';
|
||||
import { RoomObjectEvent } from '../../room';
|
||||
import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectDimmerStateUpdateEvent extends RoomObjectEvent
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject } from '../../api';
|
||||
import { RoomObjectEvent } from '../../room';
|
||||
import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectFloorHoleEvent extends RoomObjectEvent
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { RoomObjectEvent } from '../../room';
|
||||
import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectFurnitureActionEvent extends RoomObjectEvent
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject } from '../../api';
|
||||
import { RoomObjectEvent } from '../../room';
|
||||
import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectHSLColorEnableEvent extends RoomObjectEvent
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject } from '../../api';
|
||||
import { RoomObjectEvent } from '../../room';
|
||||
import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectMoveEvent extends RoomObjectEvent
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject } from '../../api';
|
||||
import { RoomObjectEvent } from '../../room';
|
||||
import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectRoomAdEvent extends RoomObjectEvent
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject } from '../../api';
|
||||
import { RoomObjectEvent } from '../../room';
|
||||
import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectSamplePlaybackEvent extends RoomObjectEvent
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject } from '../../api';
|
||||
import { RoomObjectEvent } from '../../room';
|
||||
import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectStateChangedEvent extends RoomObjectEvent
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject } from '../../api';
|
||||
import { RoomObjectMouseEvent } from '../../room';
|
||||
import { RoomObjectMouseEvent } from './RoomObjectMouseEvent';
|
||||
|
||||
export class RoomObjectTileMouseEvent extends RoomObjectMouseEvent
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject, IVector3D, Vector3d } from '../../api';
|
||||
import { RoomObjectMouseEvent } from '../../room';
|
||||
import { RoomObjectMouseEvent } from './RoomObjectMouseEvent';
|
||||
|
||||
export class RoomObjectWallMouseEvent extends RoomObjectMouseEvent
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IRoomObject } from '../../api';
|
||||
import { RoomObjectEvent } from '../../room';
|
||||
import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectWidgetRequestEvent extends RoomObjectEvent
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { NitroEvent } from '../../events';
|
||||
import { NitroEvent } from '../core';
|
||||
|
||||
export class RoomToObjectEvent extends NitroEvent
|
||||
{
|
@ -1,5 +1,5 @@
|
||||
import { IVector3D } from '../../api';
|
||||
import { RoomToObjectEvent } from '../../room';
|
||||
import { RoomToObjectEvent } from './RoomToObjectEvent';
|
||||
|
||||
export class RoomToObjectOwnAvatarMoveEvent extends RoomToObjectEvent
|
||||
{
|
||||
|
@ -1,4 +1,5 @@
|
||||
export * from './RoomBackgroundColorEvent';
|
||||
export * from './RoomContentLoadedEvent';
|
||||
export * from './RoomDragEvent';
|
||||
export * from './RoomEngineDimmerStateEvent';
|
||||
export * from './RoomEngineEvent';
|
||||
@ -13,10 +14,12 @@ export * from './RoomEngineUseProductEvent';
|
||||
export * from './RoomObjectBadgeAssetEvent';
|
||||
export * from './RoomObjectDataRequestEvent';
|
||||
export * from './RoomObjectDimmerStateUpdateEvent';
|
||||
export * from './RoomObjectEvent';
|
||||
export * from './RoomObjectFloorHoleEvent';
|
||||
export * from './RoomObjectFurnitureActionEvent';
|
||||
export * from './RoomObjectHSLColorEnabledEvent';
|
||||
export * from './RoomObjectHSLColorEnableEvent';
|
||||
export * from './RoomObjectMouseEvent';
|
||||
export * from './RoomObjectMoveEvent';
|
||||
export * from './RoomObjectPlaySoundIdEvent';
|
||||
export * from './RoomObjectRoomAdEvent';
|
||||
@ -26,5 +29,7 @@ export * from './RoomObjectStateChangedEvent';
|
||||
export * from './RoomObjectTileMouseEvent';
|
||||
export * from './RoomObjectWallMouseEvent';
|
||||
export * from './RoomObjectWidgetRequestEvent';
|
||||
export * from './RoomSpriteMouseEvent';
|
||||
export * from './RoomToObjectEvent';
|
||||
export * from './RoomToObjectOwnAvatarMoveEvent';
|
||||
export * from './RoomZoomEvent';
|
||||
|
@ -3,7 +3,7 @@ import { Loader, LoaderResource } from '@pixi/loaders';
|
||||
import { Spritesheet } from '@pixi/spritesheet';
|
||||
import { FurnitureType, GetAssetManager, GraphicAssetCollection, GraphicAssetGifCollection, IAssetData, IEventDispatcher, IFurnitureData, IFurnitureDataListener, IGraphicAssetCollection, IGraphicAssetGifCollection, IPetColorResult, IRoomContentListener, IRoomContentLoader, IRoomObject, ISessionDataManager, NitroBundle, NitroConfiguration, NitroLogger, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, RoomObjectVisualizationType } from '../../api';
|
||||
import { NitroEvent } from '../../events';
|
||||
import { RoomContentLoadedEvent } from '../../room/events/RoomContentLoadedEvent';
|
||||
import { RoomContentLoadedEvent } from '../../events/room/RoomContentLoadedEvent';
|
||||
import { PetColorResult } from './PetColorResult';
|
||||
|
||||
export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLoader
|
||||
@ -78,7 +78,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
this.setFurnitureData();
|
||||
|
||||
for(const [index, name] of NitroConfiguration.getValue<string[]>('pet.types').entries()) this._pets[name] = index;
|
||||
for (const [index, name] of NitroConfiguration.getValue<string[]>('pet.types').entries()) this._pets[name] = index;
|
||||
}
|
||||
|
||||
public dispose(): void
|
||||
@ -90,7 +90,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
this._sessionDataManager = sessionData;
|
||||
|
||||
if(this._waitingForSessionDataManager)
|
||||
if (this._waitingForSessionDataManager)
|
||||
{
|
||||
this._waitingForSessionDataManager = false;
|
||||
|
||||
@ -105,7 +105,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
private setFurnitureData(): void
|
||||
{
|
||||
if(!this._sessionDataManager)
|
||||
if (!this._sessionDataManager)
|
||||
{
|
||||
this._waitingForSessionDataManager = true;
|
||||
|
||||
@ -114,7 +114,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
const furnitureData = this._sessionDataManager.getAllFurnitureData(this);
|
||||
|
||||
if(!furnitureData) return;
|
||||
if (!furnitureData) return;
|
||||
|
||||
this._sessionDataManager.removePendingFurniDataListener(this);
|
||||
|
||||
@ -125,42 +125,42 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
private processFurnitureData(furnitureData: IFurnitureData[]): void
|
||||
{
|
||||
if(!furnitureData) return;
|
||||
if (!furnitureData) return;
|
||||
|
||||
for(const furniture of furnitureData)
|
||||
for (const furniture of furnitureData)
|
||||
{
|
||||
if(!furniture) continue;
|
||||
if (!furniture) continue;
|
||||
|
||||
const id = furniture.id;
|
||||
|
||||
let className = furniture.className;
|
||||
|
||||
if(furniture.hasIndexedColor) className = ((className + '*') + furniture.colorIndex);
|
||||
if (furniture.hasIndexedColor) className = ((className + '*') + furniture.colorIndex);
|
||||
|
||||
const revision = furniture.revision;
|
||||
const adUrl = furniture.adUrl;
|
||||
|
||||
if(adUrl && adUrl.length > 0) this._objectTypeAdUrls.set(className, adUrl);
|
||||
if (adUrl && adUrl.length > 0) this._objectTypeAdUrls.set(className, adUrl);
|
||||
|
||||
let name = furniture.className;
|
||||
|
||||
if(furniture.type === FurnitureType.FLOOR)
|
||||
if (furniture.type === FurnitureType.FLOOR)
|
||||
{
|
||||
this._activeObjectTypes.set(id, className);
|
||||
this._activeObjectTypeIds.set(className, id);
|
||||
|
||||
if(!this._activeObjects[name]) this._activeObjects[name] = 1;
|
||||
if (!this._activeObjects[name]) this._activeObjects[name] = 1;
|
||||
}
|
||||
|
||||
else if(furniture.type === FurnitureType.WALL)
|
||||
else if (furniture.type === FurnitureType.WALL)
|
||||
{
|
||||
if(name === 'post.it')
|
||||
if (name === 'post.it')
|
||||
{
|
||||
className = 'post_it';
|
||||
name = 'post_it';
|
||||
}
|
||||
|
||||
if(name === 'post.it.vd')
|
||||
if (name === 'post.it.vd')
|
||||
{
|
||||
className = 'post_it_vd';
|
||||
name = 'post_id_vd';
|
||||
@ -169,12 +169,12 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
this._wallItemTypes.set(id, className);
|
||||
this._wallItemTypeIds.set(className, id);
|
||||
|
||||
if(!this._wallItems[name]) this._wallItems[name] = 1;
|
||||
if (!this._wallItems[name]) this._wallItems[name] = 1;
|
||||
}
|
||||
|
||||
const existingRevision = this._furniRevisions.get(name);
|
||||
|
||||
if(revision > existingRevision)
|
||||
if (revision > existingRevision)
|
||||
{
|
||||
this._furniRevisions.delete(name);
|
||||
this._furniRevisions.set(name, revision);
|
||||
@ -193,7 +193,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
let type = this._wallItemTypes.get(typeId);
|
||||
|
||||
if((type === 'poster') && (extra !== null)) type = (type + extra);
|
||||
if ((type === 'poster') && (extra !== null)) type = (type + extra);
|
||||
|
||||
return this.removeColorIndex(type);
|
||||
}
|
||||
@ -202,7 +202,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const type = this._activeObjectTypes.get(typeId);
|
||||
|
||||
if(!type) return -1;
|
||||
if (!type) return -1;
|
||||
|
||||
return this.getColorIndexFromName(type);
|
||||
}
|
||||
@ -211,29 +211,29 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const type = this._wallItemTypes.get(typeId);
|
||||
|
||||
if(!type) return -1;
|
||||
if (!type) return -1;
|
||||
|
||||
return this.getColorIndexFromName(type);
|
||||
}
|
||||
|
||||
private getColorIndexFromName(name: string): number
|
||||
{
|
||||
if(!name) return -1;
|
||||
if (!name) return -1;
|
||||
|
||||
const index = name.indexOf('*');
|
||||
|
||||
if(index === -1) return 0;
|
||||
if (index === -1) return 0;
|
||||
|
||||
return parseInt(name.substr(index + 1));
|
||||
}
|
||||
|
||||
private removeColorIndex(name: string): string
|
||||
{
|
||||
if(!name) return null;
|
||||
if (!name) return null;
|
||||
|
||||
const index = name.indexOf('*');
|
||||
|
||||
if(index === -1) return name;
|
||||
if (index === -1) return name;
|
||||
|
||||
return name.substr(0, index);
|
||||
}
|
||||
@ -242,7 +242,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const value = this._objectTypeAdUrls.get(type);
|
||||
|
||||
if(!value) return '';
|
||||
if (!value) return '';
|
||||
|
||||
return value;
|
||||
}
|
||||
@ -251,7 +251,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const colorResults = this._petColors.get(petIndex);
|
||||
|
||||
if(!colorResults) return null;
|
||||
if (!colorResults) return null;
|
||||
|
||||
return colorResults.get(paletteIndex);
|
||||
}
|
||||
@ -261,11 +261,11 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
const colorResults = this._petColors.get(petIndex);
|
||||
const results: IPetColorResult[] = [];
|
||||
|
||||
if(colorResults)
|
||||
if (colorResults)
|
||||
{
|
||||
for(const result of colorResults.values())
|
||||
for (const result of colorResults.values())
|
||||
{
|
||||
if(result.tag === tagName) results.push(result);
|
||||
if (result.tag === tagName) results.push(result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,15 +274,15 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
public getCollection(name: string): IGraphicAssetCollection
|
||||
{
|
||||
if(!name) return null;
|
||||
if (!name) return null;
|
||||
|
||||
const existing = this._collections.get(name);
|
||||
|
||||
if(!existing)
|
||||
if (!existing)
|
||||
{
|
||||
const globalCollection = GetAssetManager().getCollection(name);
|
||||
|
||||
if(globalCollection)
|
||||
if (globalCollection)
|
||||
{
|
||||
this._collections.set(name, globalCollection);
|
||||
|
||||
@ -297,18 +297,18 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
public getGifCollection(name: string): IGraphicAssetGifCollection
|
||||
{
|
||||
if(!name) return null;
|
||||
if (!name) return null;
|
||||
|
||||
return this._gifCollections.get(name) || null;
|
||||
}
|
||||
|
||||
public getImage(name: string): HTMLImageElement
|
||||
{
|
||||
if(!name) return null;
|
||||
if (!name) return null;
|
||||
|
||||
const existing = this._images.get(name);
|
||||
|
||||
if(!existing) return null;
|
||||
if (!existing) return null;
|
||||
|
||||
const image = new Image();
|
||||
|
||||
@ -321,14 +321,14 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const collection = this.getCollection(collectionName);
|
||||
|
||||
if(!collection) return false;
|
||||
if (!collection) return false;
|
||||
|
||||
return collection.addAsset(assetName, texture, override, 0, 0, false, false);
|
||||
}
|
||||
|
||||
public createGifCollection(collectionName: string, textures: Texture<Resource>[], durations: number[]): GraphicAssetGifCollection
|
||||
{
|
||||
if(!collectionName || !textures || !durations) return null;
|
||||
if (!collectionName || !textures || !durations) return null;
|
||||
|
||||
const collection = new GraphicAssetGifCollection(collectionName, textures, durations);
|
||||
|
||||
@ -339,7 +339,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
private createCollection(data: IAssetData, spritesheet: Spritesheet): GraphicAssetCollection
|
||||
{
|
||||
if(!data || !spritesheet) return null;
|
||||
if (!data || !spritesheet) return null;
|
||||
|
||||
const collection = new GraphicAssetCollection(data, spritesheet);
|
||||
|
||||
@ -347,12 +347,12 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
const petIndex = this._pets[collection.name];
|
||||
|
||||
if(petIndex !== undefined)
|
||||
if (petIndex !== undefined)
|
||||
{
|
||||
const keys = collection.getPaletteNames();
|
||||
const palettes: Map<number, IPetColorResult> = new Map();
|
||||
|
||||
for(const key of keys)
|
||||
for (const key of keys)
|
||||
{
|
||||
const palette = collection.getPalette(key);
|
||||
const paletteData = data.palettes[key];
|
||||
@ -375,14 +375,14 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const category = this.getCategoryForType(type);
|
||||
|
||||
switch(category)
|
||||
switch (category)
|
||||
{
|
||||
case RoomObjectCategory.FLOOR:
|
||||
return RoomContentLoader.PLACE_HOLDER;
|
||||
case RoomObjectCategory.WALL:
|
||||
return RoomContentLoader.PLACE_HOLDER_WALL;
|
||||
default:
|
||||
if(this._pets[type] !== undefined) return RoomContentLoader.PLACE_HOLDER_PET;
|
||||
if (this._pets[type] !== undefined) return RoomContentLoader.PLACE_HOLDER_PET;
|
||||
|
||||
return RoomContentLoader.PLACE_HOLDER_DEFAULT;
|
||||
}
|
||||
@ -390,27 +390,27 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
public getCategoryForType(type: string): number
|
||||
{
|
||||
if(!type) return RoomObjectCategory.MINIMUM;
|
||||
if (!type) return RoomObjectCategory.MINIMUM;
|
||||
|
||||
if(this._activeObjects[type] !== undefined) return RoomObjectCategory.FLOOR;
|
||||
if (this._activeObjects[type] !== undefined) return RoomObjectCategory.FLOOR;
|
||||
|
||||
if(this._wallItems[type] !== undefined) return RoomObjectCategory.WALL;
|
||||
if (this._wallItems[type] !== undefined) return RoomObjectCategory.WALL;
|
||||
|
||||
if(this._pets[type] !== undefined) return RoomObjectCategory.UNIT;
|
||||
if (this._pets[type] !== undefined) return RoomObjectCategory.UNIT;
|
||||
|
||||
if(type.indexOf('poster') === 0) return RoomObjectCategory.WALL;
|
||||
if (type.indexOf('poster') === 0) return RoomObjectCategory.WALL;
|
||||
|
||||
if(type === 'room') return RoomObjectCategory.ROOM;
|
||||
if (type === 'room') return RoomObjectCategory.ROOM;
|
||||
|
||||
if(type === RoomObjectUserType.USER) return RoomObjectCategory.UNIT;
|
||||
if (type === RoomObjectUserType.USER) return RoomObjectCategory.UNIT;
|
||||
|
||||
if(type === RoomObjectUserType.PET) return RoomObjectCategory.UNIT;
|
||||
if (type === RoomObjectUserType.PET) return RoomObjectCategory.UNIT;
|
||||
|
||||
if(type === RoomObjectUserType.BOT) return RoomObjectCategory.UNIT;
|
||||
if (type === RoomObjectUserType.BOT) return RoomObjectCategory.UNIT;
|
||||
|
||||
if(type === RoomObjectUserType.RENTABLE_BOT) return RoomObjectCategory.UNIT;
|
||||
if (type === RoomObjectUserType.RENTABLE_BOT) return RoomObjectCategory.UNIT;
|
||||
|
||||
if((type === RoomContentLoader.TILE_CURSOR) || (type === RoomContentLoader.SELECTION_ARROW)) return RoomObjectCategory.CURSOR;
|
||||
if ((type === RoomContentLoader.TILE_CURSOR) || (type === RoomContentLoader.SELECTION_ARROW)) return RoomObjectCategory.CURSOR;
|
||||
|
||||
return RoomObjectCategory.MINIMUM;
|
||||
}
|
||||
@ -424,7 +424,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
type = RoomObjectUserType.getRealType(type);
|
||||
|
||||
if(type === RoomObjectVisualizationType.USER) return false;
|
||||
if (type === RoomObjectVisualizationType.USER) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -434,13 +434,13 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
let typeName: string = null;
|
||||
let assetUrls: string[] = [];
|
||||
|
||||
if(type && (type.indexOf(',') >= 0))
|
||||
if (type && (type.indexOf(',') >= 0))
|
||||
{
|
||||
typeName = type;
|
||||
type = typeName.split(',')[0];
|
||||
}
|
||||
|
||||
if(typeName)
|
||||
if (typeName)
|
||||
{
|
||||
assetUrls = this.getAssetUrls(typeName, param, true);
|
||||
}
|
||||
@ -449,7 +449,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
assetUrls = this.getAssetUrls(type, param, true);
|
||||
}
|
||||
|
||||
if(assetUrls && assetUrls.length)
|
||||
if (assetUrls && assetUrls.length)
|
||||
{
|
||||
const url = assetUrls[0];
|
||||
|
||||
@ -485,18 +485,18 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const assetUrls: string[] = this.getAssetUrls(type);
|
||||
|
||||
if(!assetUrls || !assetUrls.length) return;
|
||||
if (!assetUrls || !assetUrls.length) return;
|
||||
|
||||
if((this._pendingContentTypes.indexOf(type) >= 0) || this.getOrRemoveEventDispatcher(type)) return;
|
||||
if ((this._pendingContentTypes.indexOf(type) >= 0) || this.getOrRemoveEventDispatcher(type)) return;
|
||||
|
||||
this._pendingContentTypes.push(type);
|
||||
this._events.set(type, events);
|
||||
|
||||
const loader = new Loader();
|
||||
|
||||
for(const url of assetUrls)
|
||||
for (const url of assetUrls)
|
||||
{
|
||||
if(!url || !url.length) continue;
|
||||
if (!url || !url.length) continue;
|
||||
|
||||
loader
|
||||
.add({
|
||||
@ -511,7 +511,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
const onDownloaded = (status: boolean, url: string) =>
|
||||
{
|
||||
if(!status)
|
||||
if (!status)
|
||||
{
|
||||
NitroLogger.error('Failed to download asset', url);
|
||||
|
||||
@ -524,13 +524,13 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
remaining--;
|
||||
|
||||
if(!remaining)
|
||||
if (!remaining)
|
||||
{
|
||||
loader.destroy();
|
||||
|
||||
const events = this._events.get(type);
|
||||
|
||||
if(!events) return;
|
||||
if (!events) return;
|
||||
|
||||
events.dispatchEvent(new RoomContentLoadedEvent(RoomContentLoadedEvent.RCLE_SUCCESS, type));
|
||||
|
||||
@ -540,11 +540,11 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
loader.load((loader, resources) =>
|
||||
{
|
||||
for(const key in resources)
|
||||
for (const key in resources)
|
||||
{
|
||||
const resource = resources[key];
|
||||
|
||||
if(!resource || resource.error || !resource.xhr)
|
||||
if (!resource || resource.error || !resource.xhr)
|
||||
{
|
||||
onDownloaded(false, resource.url);
|
||||
|
||||
@ -553,7 +553,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
|
||||
const resourceType = (resource.xhr.getResponseHeader('Content-Type') || 'application/octet-stream');
|
||||
|
||||
if(resourceType === 'application/octet-stream')
|
||||
if (resourceType === 'application/octet-stream')
|
||||
{
|
||||
const nitroBundle = new NitroBundle(resource.data);
|
||||
|
||||
@ -572,7 +572,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const spritesheetData = data.spritesheet;
|
||||
|
||||
if(!baseTexture || !spritesheetData || !Object.keys(spritesheetData).length)
|
||||
if (!baseTexture || !spritesheetData || !Object.keys(spritesheetData).length)
|
||||
{
|
||||
this.createCollection(data, null);
|
||||
|
||||
@ -593,7 +593,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
});
|
||||
};
|
||||
|
||||
if(baseTexture.valid)
|
||||
if (baseTexture.valid)
|
||||
{
|
||||
createAsset();
|
||||
}
|
||||
@ -613,7 +613,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const existing = this._objectAliases.get(name);
|
||||
|
||||
if(!existing) return name;
|
||||
if (!existing) return name;
|
||||
|
||||
return existing;
|
||||
}
|
||||
@ -622,14 +622,14 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const existing = this._objectOriginalNames.get(name);
|
||||
|
||||
if(!existing) return name;
|
||||
if (!existing) return name;
|
||||
|
||||
return existing;
|
||||
}
|
||||
|
||||
public getAssetUrls(type: string, param: string = null, icon: boolean = false): string[]
|
||||
{
|
||||
switch(type)
|
||||
switch (type)
|
||||
{
|
||||
case RoomContentLoader.PLACE_HOLDER:
|
||||
return [this.getAssetUrlWithGenericBase(RoomContentLoader.PLACE_HOLDER)];
|
||||
@ -646,13 +646,13 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
default: {
|
||||
const category = this.getCategoryForType(type);
|
||||
|
||||
if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL))
|
||||
if ((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL))
|
||||
{
|
||||
const name = this.getAssetAliasName(type);
|
||||
|
||||
let assetUrl = (icon ? this.getAssetUrlWithFurniIconBase(name) : this.getAssetUrlWithFurniBase(type));
|
||||
|
||||
if(icon)
|
||||
if (icon)
|
||||
{
|
||||
const active = (param && (param !== '') && (this._activeObjectTypeIds.has((name + '*' + param))));
|
||||
|
||||
@ -662,7 +662,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
return [assetUrl];
|
||||
}
|
||||
|
||||
if(category === RoomObjectCategory.UNIT)
|
||||
if (category === RoomObjectCategory.UNIT)
|
||||
{
|
||||
return [this.getAssetUrlWithPetBase(type)];
|
||||
}
|
||||
@ -677,14 +677,14 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
let assetName: string = null;
|
||||
let assetUrls: string[] = [];
|
||||
|
||||
if(type && (type.indexOf(',') >= 0))
|
||||
if (type && (type.indexOf(',') >= 0))
|
||||
{
|
||||
assetName = type;
|
||||
|
||||
type = assetName.split(',')[0];
|
||||
}
|
||||
|
||||
if(assetName)
|
||||
if (assetName)
|
||||
{
|
||||
assetUrls = this.getAssetUrls(assetName, colorIndex, true);
|
||||
}
|
||||
@ -693,7 +693,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
assetUrls = this.getAssetUrls(type, colorIndex, true);
|
||||
}
|
||||
|
||||
if(assetUrls && assetUrls.length) return assetUrls[0];
|
||||
if (assetUrls && assetUrls.length) return assetUrls[0];
|
||||
|
||||
return null;
|
||||
}
|
||||
@ -722,7 +722,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const model = object && object.model;
|
||||
|
||||
if(!model) return;
|
||||
if (!model) return;
|
||||
|
||||
model.setValue(RoomObjectVariable.OBJECT_ROOM_ID, roomId);
|
||||
}
|
||||
@ -731,7 +731,7 @@ export class RoomContentLoader implements IFurnitureDataListener, IRoomContentLo
|
||||
{
|
||||
const existing = this._events.get(type);
|
||||
|
||||
if(remove) this._events.delete(type);
|
||||
if (remove) this._events.delete(type);
|
||||
|
||||
return existing;
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
||||
|
||||
import { AvatarAction, IRoomGeometry, IRoomObjectModel, MouseEventType, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { RoomObjectFurnitureActionEvent, RoomObjectMoveEvent } from '../../../../../events';
|
||||
import { RoomObjectFurnitureActionEvent, RoomObjectMouseEvent, RoomObjectMoveEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { GetTickerTime } from '../../../../../pixi-proxy';
|
||||
import { RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, ObjectAvatarDanceUpdateMessage, ObjectAvatarEffectUpdateMessage, ObjectAvatarExpressionUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarFlatControlUpdateMessage, ObjectAvatarGestureUpdateMessage, ObjectAvatarMutedUpdateMessage, ObjectAvatarOwnMessage, ObjectAvatarPlayerValueUpdateMessage, ObjectAvatarPlayingGameUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSelectedMessage, ObjectAvatarSignUpdateMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarTypingUpdateMessage, ObjectAvatarUpdateMessage, ObjectAvatarUseObjectUpdateMessage } from '../../../messages';
|
||||
import { MovingObjectLogic } from '../MovingObjectLogic';
|
||||
|
||||
@ -64,9 +64,9 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
if(this._selected && this.object)
|
||||
if (this._selected && this.object)
|
||||
{
|
||||
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object));
|
||||
if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object));
|
||||
}
|
||||
|
||||
super.dispose();
|
||||
@ -78,15 +78,15 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
{
|
||||
super.update(time);
|
||||
|
||||
if(this._selected && this.object)
|
||||
if (this._selected && this.object)
|
||||
{
|
||||
if(this.eventDispatcher)
|
||||
if (this.eventDispatcher)
|
||||
{
|
||||
const location = this.object.getLocation();
|
||||
|
||||
if(((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z))
|
||||
if (((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z))
|
||||
{
|
||||
if(!this._reportedLocation) this._reportedLocation = new Vector3d();
|
||||
if (!this._reportedLocation) this._reportedLocation = new Vector3d();
|
||||
|
||||
this._reportedLocation.assign(location);
|
||||
|
||||
@ -97,14 +97,14 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
|
||||
const model = this.object && this.object.model;
|
||||
|
||||
if(model) this.updateModel(this.time, model);
|
||||
if (model) this.updateModel(this.time, model);
|
||||
}
|
||||
|
||||
private updateModel(time: number, model: IRoomObjectModel): void
|
||||
{
|
||||
if(this._talkingEndTimestamp > 0)
|
||||
if (this._talkingEndTimestamp > 0)
|
||||
{
|
||||
if(time > this._talkingEndTimestamp)
|
||||
if (time > this._talkingEndTimestamp)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_TALK, 0);
|
||||
|
||||
@ -114,14 +114,14 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!this._talkingPauseEndTimestamp && !this._talkingPauseStartTimestamp)
|
||||
if (!this._talkingPauseEndTimestamp && !this._talkingPauseStartTimestamp)
|
||||
{
|
||||
this._talkingPauseStartTimestamp = time + this.randomTalkingPauseStartTimestamp();
|
||||
this._talkingPauseEndTimestamp = this._talkingPauseStartTimestamp + this.randomTalkingPauseEndTimestamp();
|
||||
}
|
||||
else
|
||||
{
|
||||
if((this._talkingPauseStartTimestamp > 0) && (time > this._talkingPauseStartTimestamp))
|
||||
if ((this._talkingPauseStartTimestamp > 0) && (time > this._talkingPauseStartTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_TALK, 0);
|
||||
|
||||
@ -129,7 +129,7 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
}
|
||||
else
|
||||
{
|
||||
if((this._talkingPauseEndTimestamp > 0) && (time > this._talkingPauseEndTimestamp))
|
||||
if ((this._talkingPauseEndTimestamp > 0) && (time > this._talkingPauseEndTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_TALK, 1);
|
||||
|
||||
@ -140,30 +140,30 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
}
|
||||
}
|
||||
|
||||
if((this._animationEndTimestamp > 0) && (time > this._animationEndTimestamp))
|
||||
if ((this._animationEndTimestamp > 0) && (time > this._animationEndTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, 0);
|
||||
|
||||
this._animationEndTimestamp = 0;
|
||||
}
|
||||
|
||||
if((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp))
|
||||
if ((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_GESTURE, 0);
|
||||
|
||||
this._gestureEndTimestamp = 0;
|
||||
}
|
||||
|
||||
if((this._signEndTimestamp > 0) && (time > this._signEndTimestamp))
|
||||
if ((this._signEndTimestamp > 0) && (time > this._signEndTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_SIGN, -1);
|
||||
|
||||
this._signEndTimestamp = 0;
|
||||
}
|
||||
|
||||
if(this._carryObjectEndTimestamp > 0)
|
||||
if (this._carryObjectEndTimestamp > 0)
|
||||
{
|
||||
if(time > this._carryObjectEndTimestamp)
|
||||
if (time > this._carryObjectEndTimestamp)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, 0);
|
||||
model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0);
|
||||
@ -174,11 +174,11 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
}
|
||||
}
|
||||
|
||||
if(this._allowUseCarryObject)
|
||||
if (this._allowUseCarryObject)
|
||||
{
|
||||
if((time - this._carryObjectStartTimestamp) > 5000)
|
||||
if ((time - this._carryObjectStartTimestamp) > 5000)
|
||||
{
|
||||
if(((time - this._carryObjectStartTimestamp) % 10000) < 1000)
|
||||
if (((time - this._carryObjectStartTimestamp) % 10000) < 1000)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 1);
|
||||
}
|
||||
@ -189,7 +189,7 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
}
|
||||
}
|
||||
|
||||
if((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp))
|
||||
if ((this._blinkingStartTimestamp > -1) && (time > this._blinkingStartTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 1);
|
||||
|
||||
@ -197,21 +197,21 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
this._blinkingEndTimestamp = time + this.randomBlinkEndTimestamp();
|
||||
}
|
||||
|
||||
if((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp))
|
||||
if ((this._blinkingEndTimestamp > 0) && (time > this._blinkingEndTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_BLINK, 0);
|
||||
|
||||
this._blinkingEndTimestamp = 0;
|
||||
}
|
||||
|
||||
if((this._effectChangeTimeStamp > 0) && (time > this._effectChangeTimeStamp))
|
||||
if ((this._effectChangeTimeStamp > 0) && (time > this._effectChangeTimeStamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_EFFECT, this._newEffect);
|
||||
|
||||
this._effectChangeTimeStamp = 0;
|
||||
}
|
||||
|
||||
if((this._numberValueEndTimestamp > 0) && (time > this._numberValueEndTimestamp))
|
||||
if ((this._numberValueEndTimestamp > 0) && (time > this._numberValueEndTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, 0);
|
||||
|
||||
@ -221,15 +221,15 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
|
||||
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||
{
|
||||
if(!message || !this.object) return;
|
||||
if (!message || !this.object) return;
|
||||
|
||||
super.processUpdateMessage(message);
|
||||
|
||||
const model = this.object && this.object.model;
|
||||
|
||||
if(!model) return;
|
||||
if (!model) return;
|
||||
|
||||
if(message instanceof ObjectAvatarPostureUpdateMessage)
|
||||
if (message instanceof ObjectAvatarPostureUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_POSTURE, message.postureType);
|
||||
model.setValue(RoomObjectVariable.FIGURE_POSTURE_PARAMETER, message.parameter);
|
||||
@ -237,7 +237,7 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarChatUpdateMessage)
|
||||
if (message instanceof ObjectAvatarChatUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_TALK, 1);
|
||||
|
||||
@ -246,28 +246,28 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarTypingUpdateMessage)
|
||||
if (message instanceof ObjectAvatarTypingUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_IS_TYPING, message.isTyping ? 1 : 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarMutedUpdateMessage)
|
||||
if (message instanceof ObjectAvatarMutedUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_IS_MUTED, (message.isMuted ? 1 : 0));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarPlayingGameUpdateMessage)
|
||||
if (message instanceof ObjectAvatarPlayingGameUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_IS_PLAYING_GAME, (message.isPlayingGame ? 1 : 0));
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarUpdateMessage)
|
||||
if (message instanceof ObjectAvatarUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.HEAD_DIRECTION, message.headDirection);
|
||||
model.setValue(RoomObjectVariable.FIGURE_CAN_STAND_UP, message.canStandUp);
|
||||
@ -276,7 +276,7 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarGestureUpdateMessage)
|
||||
if (message instanceof ObjectAvatarGestureUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_GESTURE, message.gesture);
|
||||
|
||||
@ -285,35 +285,35 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarExpressionUpdateMessage)
|
||||
if (message instanceof ObjectAvatarExpressionUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, message.expressionType);
|
||||
|
||||
this._animationEndTimestamp = AvatarAction.getExpressionTimeout(model.getValue<number>(RoomObjectVariable.FIGURE_EXPRESSION));
|
||||
|
||||
if(this._animationEndTimestamp > -1) this._animationEndTimestamp += this.time;
|
||||
if (this._animationEndTimestamp > -1) this._animationEndTimestamp += this.time;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarDanceUpdateMessage)
|
||||
if (message instanceof ObjectAvatarDanceUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_DANCE, message.danceStyle);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarSleepUpdateMessage)
|
||||
if (message instanceof ObjectAvatarSleepUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_SLEEP, message.isSleeping ? 1 : 0);
|
||||
|
||||
if(message.isSleeping) this._blinkingStartTimestamp = -1;
|
||||
if (message.isSleeping) this._blinkingStartTimestamp = -1;
|
||||
else this._blinkingStartTimestamp = (this.time + this.randomBlinkStartTimestamp());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarPlayerValueUpdateMessage)
|
||||
if (message instanceof ObjectAvatarPlayerValueUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_NUMBER_VALUE, message.value);
|
||||
|
||||
@ -322,19 +322,19 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarEffectUpdateMessage)
|
||||
if (message instanceof ObjectAvatarEffectUpdateMessage)
|
||||
{
|
||||
this.updateAvatarEffect(message.effect, message.delayMilliseconds, model);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarCarryObjectUpdateMessage)
|
||||
if (message instanceof ObjectAvatarCarryObjectUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_CARRY_OBJECT, message.itemType);
|
||||
model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, 0);
|
||||
|
||||
if(message.itemType === 0)
|
||||
if (message.itemType === 0)
|
||||
{
|
||||
this._carryObjectStartTimestamp = 0;
|
||||
this._carryObjectEndTimestamp = 0;
|
||||
@ -344,7 +344,7 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
{
|
||||
this._carryObjectStartTimestamp = this.time;
|
||||
|
||||
if(message.itemType < AvatarLogic.MAX_HAND_ID)
|
||||
if (message.itemType < AvatarLogic.MAX_HAND_ID)
|
||||
{
|
||||
this._carryObjectEndTimestamp = 0;
|
||||
this._allowUseCarryObject = message.itemType <= AvatarLogic.MAX_HAND_USE_ID;
|
||||
@ -359,14 +359,14 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarUseObjectUpdateMessage)
|
||||
if (message instanceof ObjectAvatarUseObjectUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_USE_OBJECT, message.itemType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarSignUpdateMessage)
|
||||
if (message instanceof ObjectAvatarSignUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_SIGN, message.signType);
|
||||
|
||||
@ -375,14 +375,14 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarFlatControlUpdateMessage)
|
||||
if (message instanceof ObjectAvatarFlatControlUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_FLAT_CONTROL, message.level);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarFigureUpdateMessage)
|
||||
if (message instanceof ObjectAvatarFigureUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE, message.figure);
|
||||
model.setValue(RoomObjectVariable.GENDER, message.gender);
|
||||
@ -390,7 +390,7 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarSelectedMessage)
|
||||
if (message instanceof ObjectAvatarSelectedMessage)
|
||||
{
|
||||
this._selected = message.selected;
|
||||
this._reportedLocation = null;
|
||||
@ -398,7 +398,7 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarOwnMessage)
|
||||
if (message instanceof ObjectAvatarOwnMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.OWN_USER, 1);
|
||||
|
||||
@ -408,19 +408,19 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
|
||||
private updateAvatarEffect(effect: number, delay: number, model: IRoomObjectModel): void
|
||||
{
|
||||
if(effect === AvatarLogic.EFFECT_TYPE_SPLASH)
|
||||
if (effect === AvatarLogic.EFFECT_TYPE_SPLASH)
|
||||
{
|
||||
this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH);
|
||||
this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM;
|
||||
}
|
||||
|
||||
else if(effect === AvatarLogic.EFFECT_TYPE_SPLASH_DARK)
|
||||
else if (effect === AvatarLogic.EFFECT_TYPE_SPLASH_DARK)
|
||||
{
|
||||
this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH);
|
||||
this._newEffect = AvatarLogic.EFFECT_TYPE_SWIM_DARK;
|
||||
}
|
||||
|
||||
else if(model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM)
|
||||
else if (model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM)
|
||||
{
|
||||
this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH);
|
||||
this._newEffect = effect;
|
||||
@ -428,7 +428,7 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
effect = AvatarLogic.EFFECT_TYPE_SPLASH;
|
||||
}
|
||||
|
||||
else if(model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM_DARK)
|
||||
else if (model.getValue<number>(RoomObjectVariable.FIGURE_EFFECT) === AvatarLogic.EFFECT_TYPE_SWIM_DARK)
|
||||
{
|
||||
this._effectChangeTimeStamp = (GetTickerTime() + AvatarLogic.EFFECT_SPLASH_LENGTH);
|
||||
this._newEffect = effect;
|
||||
@ -436,7 +436,7 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
effect = AvatarLogic.EFFECT_TYPE_SPLASH_DARK;
|
||||
}
|
||||
|
||||
else if(delay === 0)
|
||||
else if (delay === 0)
|
||||
{
|
||||
this._effectChangeTimeStamp = 0;
|
||||
}
|
||||
@ -456,7 +456,7 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
{
|
||||
let eventType: string = null;
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.MOUSE_CLICK:
|
||||
eventType = RoomObjectMouseEvent.CLICK;
|
||||
@ -464,20 +464,20 @@ export class AvatarLogic extends MovingObjectLogic
|
||||
case MouseEventType.ROLL_OVER:
|
||||
eventType = RoomObjectMouseEvent.MOUSE_ENTER;
|
||||
|
||||
if(this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 1);
|
||||
if (this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 1);
|
||||
|
||||
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object));
|
||||
if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object));
|
||||
break;
|
||||
case MouseEventType.ROLL_OUT:
|
||||
eventType = RoomObjectMouseEvent.MOUSE_LEAVE;
|
||||
|
||||
if(this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 0);
|
||||
if (this.object.model) this.object.model.setValue(RoomObjectVariable.FIGURE_HIGHLIGHT, 0);
|
||||
|
||||
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object));
|
||||
if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object));
|
||||
break;
|
||||
}
|
||||
|
||||
if(eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown));
|
||||
if (eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown));
|
||||
}
|
||||
|
||||
private randomTalkingPauseStartTimestamp(): number
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectEvent, RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { RoomObjectBadgeAssetEvent, RoomObjectEvent, RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { ObjectGroupBadgeUpdateMessage, ObjectSelectedMessage } from '../../../messages';
|
||||
import { FurnitureBadgeDisplayLogic } from './FurnitureBadgeDisplayLogic';
|
||||
|
||||
@ -24,17 +24,17 @@ export class FurnitureAchievementResolutionLogic extends FurnitureBadgeDisplayLo
|
||||
{
|
||||
super.processUpdateMessage(message);
|
||||
|
||||
if(message instanceof ObjectGroupBadgeUpdateMessage)
|
||||
if (message instanceof ObjectGroupBadgeUpdateMessage)
|
||||
{
|
||||
if(message.assetName !== 'loading_icon')
|
||||
if (message.assetName !== 'loading_icon')
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_VISIBLE_IN_STATE, FurnitureAchievementResolutionLogic.BADGE_VISIBLE_IN_STATE);
|
||||
}
|
||||
}
|
||||
|
||||
if(message instanceof ObjectSelectedMessage)
|
||||
if (message instanceof ObjectSelectedMessage)
|
||||
{
|
||||
if(!this.eventDispatcher || !this.object) return;
|
||||
if (!this.eventDispatcher || !this.object) return;
|
||||
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object));
|
||||
}
|
||||
@ -42,11 +42,11 @@ export class FurnitureAchievementResolutionLogic extends FurnitureBadgeDisplayLo
|
||||
|
||||
public useObject(): void
|
||||
{
|
||||
if(!this.object || !this.eventDispatcher) return;
|
||||
if (!this.object || !this.eventDispatcher) return;
|
||||
|
||||
let event: RoomObjectEvent = null;
|
||||
|
||||
switch(this.object.getState(0))
|
||||
switch (this.object.getState(0))
|
||||
{
|
||||
case FurnitureAchievementResolutionLogic.STATE_RESOLUTION_NOT_STARTED:
|
||||
case FurnitureAchievementResolutionLogic.STATE_RESOLUTION_IN_PROGRESS:
|
||||
@ -60,12 +60,12 @@ export class FurnitureAchievementResolutionLogic extends FurnitureBadgeDisplayLo
|
||||
break;
|
||||
}
|
||||
|
||||
if(event) this.eventDispatcher.dispatchEvent(event);
|
||||
if (event) this.eventDispatcher.dispatchEvent(event);
|
||||
}
|
||||
|
||||
protected updateBadge(badgeId: string): void
|
||||
{
|
||||
if(badgeId === FurnitureAchievementResolutionLogic.ACH_NOT_SET) return;
|
||||
if (badgeId === FurnitureAchievementResolutionLogic.ACH_NOT_SET) return;
|
||||
|
||||
super.updateBadge(badgeId);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { IRoomGeometry, MouseEventType } from '../../../../../api';
|
||||
import { RoomObjectStateChangedEvent } from '../../../../../events';
|
||||
import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectEvent, RoomObjectStateChangedEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureCounterClockLogic extends FurnitureLogic
|
||||
@ -14,14 +13,14 @@ export class FurnitureCounterClockLogic extends FurnitureLogic
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry || !this.object) return;
|
||||
if (!event || !geometry || !this.object) return;
|
||||
|
||||
let objectEvent: RoomObjectEvent = null;
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.DOUBLE_CLICK:
|
||||
switch(event.spriteTag)
|
||||
switch (event.spriteTag)
|
||||
{
|
||||
case 'start_stop':
|
||||
objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1);
|
||||
@ -31,7 +30,7 @@ export class FurnitureCounterClockLogic extends FurnitureLogic
|
||||
break;
|
||||
}
|
||||
|
||||
if(this.eventDispatcher && objectEvent)
|
||||
if (this.eventDispatcher && objectEvent)
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(objectEvent);
|
||||
|
||||
@ -45,7 +44,7 @@ export class FurnitureCounterClockLogic extends FurnitureLogic
|
||||
|
||||
public useObject(): void
|
||||
{
|
||||
if(!this.object || !this.eventDispatcher) return;
|
||||
if (!this.object || !this.eventDispatcher) return;
|
||||
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1));
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { IRoomGeometry, MouseEventType } from '../../../../../api';
|
||||
import { RoomObjectFurnitureActionEvent } from '../../../../../events';
|
||||
import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectEvent, RoomObjectFurnitureActionEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureDiceLogic extends FurnitureLogic
|
||||
@ -25,16 +24,16 @@ export class FurnitureDiceLogic extends FurnitureLogic
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry || !this.object) return;
|
||||
if (!event || !geometry || !this.object) return;
|
||||
|
||||
let objectEvent: RoomObjectEvent = null;
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.DOUBLE_CLICK:
|
||||
if(this._noTags)
|
||||
if (this._noTags)
|
||||
{
|
||||
if(((!(this._noTagsLastStateActivate)) || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100))
|
||||
if (((!(this._noTagsLastStateActivate)) || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100))
|
||||
{
|
||||
objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_ACTIVATE, this.object);
|
||||
|
||||
@ -49,18 +48,18 @@ export class FurnitureDiceLogic extends FurnitureLogic
|
||||
}
|
||||
else
|
||||
{
|
||||
if(((event.spriteTag === 'activate') || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100))
|
||||
if (((event.spriteTag === 'activate') || (this.object.getState(0) === 0)) || (this.object.getState(0) === 100))
|
||||
{
|
||||
objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_ACTIVATE, this.object);
|
||||
}
|
||||
|
||||
else if(event.spriteTag === 'deactivate')
|
||||
else if (event.spriteTag === 'deactivate')
|
||||
{
|
||||
objectEvent = new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.DICE_OFF, this.object);
|
||||
}
|
||||
}
|
||||
|
||||
if(objectEvent && this.eventDispatcher) this.eventDispatcher.dispatchEvent(objectEvent);
|
||||
if (objectEvent && this.eventDispatcher) this.eventDispatcher.dispatchEvent(objectEvent);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { IAssetData, IRoomGeometry, MouseEventType, RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureEditableInternalLinkLogic extends FurnitureLogic
|
||||
@ -27,11 +26,11 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic
|
||||
{
|
||||
super.initialize(asset);
|
||||
|
||||
if(asset.logic)
|
||||
if (asset.logic)
|
||||
{
|
||||
if(asset.logic.action)
|
||||
if (asset.logic.action)
|
||||
{
|
||||
if(asset.logic.action.startState === 1) this._showStateOnceRendered = true;
|
||||
if (asset.logic.action.startState === 1) this._showStateOnceRendered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -40,11 +39,11 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic
|
||||
{
|
||||
super.update(time);
|
||||
|
||||
if(!this._showStateOnceRendered) return;
|
||||
if (!this._showStateOnceRendered) return;
|
||||
|
||||
this._updateCount++;
|
||||
|
||||
if(this._showStateOnceRendered && (this._updateCount > 20))
|
||||
if (this._showStateOnceRendered && (this._updateCount > 20))
|
||||
{
|
||||
this.setAutomaticStateIndex(1);
|
||||
|
||||
@ -54,9 +53,9 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic
|
||||
|
||||
private setAutomaticStateIndex(state: number): void
|
||||
{
|
||||
if(!this.object) return;
|
||||
if (!this.object) return;
|
||||
|
||||
if(this.object.model)
|
||||
if (this.object.model)
|
||||
{
|
||||
this.object.model.setValue<number>(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX, state);
|
||||
}
|
||||
@ -64,9 +63,9 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry) return;
|
||||
if (!event || !geometry) return;
|
||||
|
||||
if(event.type === MouseEventType.DOUBLE_CLICK)
|
||||
if (event.type === MouseEventType.DOUBLE_CLICK)
|
||||
{
|
||||
this.setAutomaticStateIndex(0);
|
||||
}
|
||||
@ -76,7 +75,7 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic
|
||||
|
||||
public useObject(): void
|
||||
{
|
||||
if(!this.object || !this.eventDispatcher) return;
|
||||
if (!this.object || !this.eventDispatcher) return;
|
||||
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object));
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { IAssetData, IParticleSystem, IRoomGeometry, MouseEventType, RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectStateChangedEvent } from '../../../../../events';
|
||||
import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectEvent, RoomObjectStateChangedEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureFireworksLogic extends FurnitureLogic
|
||||
@ -16,9 +15,9 @@ export class FurnitureFireworksLogic extends FurnitureLogic
|
||||
{
|
||||
super.initialize(asset);
|
||||
|
||||
if(asset.logic)
|
||||
if (asset.logic)
|
||||
{
|
||||
if(asset.logic.particleSystems && asset.logic.particleSystems.length)
|
||||
if (asset.logic.particleSystems && asset.logic.particleSystems.length)
|
||||
{
|
||||
this.object.model.setValue<IParticleSystem[]>(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.logic.particleSystems);
|
||||
}
|
||||
@ -27,14 +26,14 @@ export class FurnitureFireworksLogic extends FurnitureLogic
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry || !this.object) return;
|
||||
if (!event || !geometry || !this.object) return;
|
||||
|
||||
let objectEvent: RoomObjectEvent = null;
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.DOUBLE_CLICK:
|
||||
switch(event.spriteTag)
|
||||
switch (event.spriteTag)
|
||||
{
|
||||
case 'start_stop':
|
||||
objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1);
|
||||
@ -44,7 +43,7 @@ export class FurnitureFireworksLogic extends FurnitureLogic
|
||||
break;
|
||||
}
|
||||
|
||||
if(this.eventDispatcher && objectEvent)
|
||||
if (this.eventDispatcher && objectEvent)
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(objectEvent);
|
||||
|
||||
@ -58,7 +57,7 @@ export class FurnitureFireworksLogic extends FurnitureLogic
|
||||
|
||||
public useObject(): void
|
||||
{
|
||||
if(!this.object || !this.eventDispatcher) return;
|
||||
if (!this.object || !this.eventDispatcher) return;
|
||||
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 0));
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { IRoomGeometry, MouseEventType, RoomObjectVariable, StringDataType } from '../../../../../api';
|
||||
import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectBadgeAssetEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { GetTickerTime } from '../../../../../pixi-proxy';
|
||||
import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { ObjectDataUpdateMessage, ObjectGroupBadgeUpdateMessage, ObjectSelectedMessage } from '../../../messages';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
@ -27,11 +27,11 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
|
||||
{
|
||||
super.processUpdateMessage(message);
|
||||
|
||||
if(message instanceof ObjectDataUpdateMessage)
|
||||
if (message instanceof ObjectDataUpdateMessage)
|
||||
{
|
||||
const data = message.data;
|
||||
|
||||
if(data instanceof StringDataType)
|
||||
if (data instanceof StringDataType)
|
||||
{
|
||||
this.updateGroupId(data.getValue(FurnitureGuildCustomizedLogic.GROUPID_KEY));
|
||||
this.updateBadge(data.getValue(FurnitureGuildCustomizedLogic.BADGE_KEY));
|
||||
@ -39,9 +39,9 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
|
||||
}
|
||||
}
|
||||
|
||||
else if(message instanceof ObjectGroupBadgeUpdateMessage)
|
||||
else if (message instanceof ObjectGroupBadgeUpdateMessage)
|
||||
{
|
||||
if(message.assetName !== 'loading_icon')
|
||||
if (message.assetName !== 'loading_icon')
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME, message.assetName);
|
||||
|
||||
@ -49,9 +49,9 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
|
||||
}
|
||||
}
|
||||
|
||||
else if(message instanceof ObjectSelectedMessage)
|
||||
else if (message instanceof ObjectSelectedMessage)
|
||||
{
|
||||
if(!message.selected)
|
||||
if (!message.selected)
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object));
|
||||
}
|
||||
@ -76,9 +76,9 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry || !this.object) return;
|
||||
if (!event || !geometry || !this.object) return;
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.MOUSE_CLICK:
|
||||
this.openContextMenu();
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { IRoomGeometry, MouseEventType } from '../../../../../api';
|
||||
import { RoomObjectStateChangedEvent } from '../../../../../events';
|
||||
import { RoomObjectEvent, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectEvent, RoomObjectStateChangedEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureHockeyScoreLogic extends FurnitureLogic
|
||||
@ -14,14 +13,14 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry || !this.object) return;
|
||||
if (!event || !geometry || !this.object) return;
|
||||
|
||||
let objectEvent: RoomObjectEvent = null;
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.DOUBLE_CLICK:
|
||||
switch(event.spriteTag)
|
||||
switch (event.spriteTag)
|
||||
{
|
||||
case 'off':
|
||||
objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 3);
|
||||
@ -29,7 +28,7 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic
|
||||
}
|
||||
break;
|
||||
case MouseEventType.MOUSE_CLICK:
|
||||
switch(event.spriteTag)
|
||||
switch (event.spriteTag)
|
||||
{
|
||||
case 'inc':
|
||||
objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 2);
|
||||
@ -41,7 +40,7 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic
|
||||
break;
|
||||
}
|
||||
|
||||
if(this.eventDispatcher && objectEvent)
|
||||
if (this.eventDispatcher && objectEvent)
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(objectEvent);
|
||||
|
||||
@ -53,7 +52,7 @@ export class FurnitureHockeyScoreLogic extends FurnitureLogic
|
||||
|
||||
public useObject(): void
|
||||
{
|
||||
if(!this.object || !this.eventDispatcher) return;
|
||||
if (!this.object || !this.eventDispatcher) return;
|
||||
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 3));
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { IAssetData, IRoomGeometry, MouseEventType, RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureInternalLinkLogic extends FurnitureLogic
|
||||
@ -21,13 +20,13 @@ export class FurnitureInternalLinkLogic extends FurnitureLogic
|
||||
{
|
||||
super.initialize(asset);
|
||||
|
||||
if(asset.logic)
|
||||
if (asset.logic)
|
||||
{
|
||||
if(asset.logic.action)
|
||||
if (asset.logic.action)
|
||||
{
|
||||
this.object.model.setValue<string>(RoomObjectVariable.FURNITURE_INTERNAL_LINK, asset.logic.action.link);
|
||||
|
||||
if(asset.logic.action.startState === 1) this._showStateOnceRendered = true;
|
||||
if (asset.logic.action.startState === 1) this._showStateOnceRendered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -36,11 +35,11 @@ export class FurnitureInternalLinkLogic extends FurnitureLogic
|
||||
{
|
||||
super.update(time);
|
||||
|
||||
if(!this._showStateOnceRendered) return;
|
||||
if (!this._showStateOnceRendered) return;
|
||||
|
||||
this._updateCount++;
|
||||
|
||||
if(this._showStateOnceRendered && (this._updateCount === 20))
|
||||
if (this._showStateOnceRendered && (this._updateCount === 20))
|
||||
{
|
||||
this.setAutomaticStateIndex(1);
|
||||
|
||||
@ -50,9 +49,9 @@ export class FurnitureInternalLinkLogic extends FurnitureLogic
|
||||
|
||||
private setAutomaticStateIndex(state: number): void
|
||||
{
|
||||
if(!this.object) return;
|
||||
if (!this.object) return;
|
||||
|
||||
if(this.object.model)
|
||||
if (this.object.model)
|
||||
{
|
||||
this.object.model.setValue<number>(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX, state);
|
||||
}
|
||||
@ -60,9 +59,9 @@ export class FurnitureInternalLinkLogic extends FurnitureLogic
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry) return;
|
||||
if (!event || !geometry) return;
|
||||
|
||||
if((event.type === MouseEventType.DOUBLE_CLICK) && this._showStateOnceRendered)
|
||||
if ((event.type === MouseEventType.DOUBLE_CLICK) && this._showStateOnceRendered)
|
||||
{
|
||||
this.setAutomaticStateIndex(0);
|
||||
}
|
||||
@ -72,7 +71,7 @@ export class FurnitureInternalLinkLogic extends FurnitureLogic
|
||||
|
||||
public useObject(): void
|
||||
{
|
||||
if(!this.object || !this.eventDispatcher) return;
|
||||
if (!this.object || !this.eventDispatcher) return;
|
||||
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { IAssetData, IRoomGeometry, IRoomObjectController, IRoomObjectModel, IVector3D, MouseEventType, NitroConfiguration, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { RoomObjectRoomAdEvent, RoomObjectStateChangedEvent, RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectMouseEvent, RoomObjectRoomAdEvent, RoomObjectStateChangedEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { ObjectDataUpdateMessage, ObjectHeightUpdateMessage, ObjectItemDataUpdateMessage, ObjectMoveUpdateMessage, ObjectSelectedMessage } from '../../../messages';
|
||||
import { MovingObjectLogic } from '../MovingObjectLogic';
|
||||
|
||||
@ -45,12 +45,12 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
this._storedRotateMessage = null;
|
||||
this._directionInitialized = false;
|
||||
|
||||
if(FurnitureLogic.BOUNCING_STEPS === -1)
|
||||
if (FurnitureLogic.BOUNCING_STEPS === -1)
|
||||
{
|
||||
FurnitureLogic.BOUNCING_STEPS = NitroConfiguration.getValue<number>('furni.rotation.bounce.steps', 8);
|
||||
}
|
||||
|
||||
if(FurnitureLogic.BOUNCING_Z === -1)
|
||||
if (FurnitureLogic.BOUNCING_Z === -1)
|
||||
{
|
||||
FurnitureLogic.BOUNCING_Z = NitroConfiguration.getValue<number>('furni.rotation.bounce.height', 0.0625);
|
||||
}
|
||||
@ -68,28 +68,28 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK,
|
||||
RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK];
|
||||
|
||||
if(this.widget) types.push(RoomObjectWidgetRequestEvent.OPEN_WIDGET, RoomObjectWidgetRequestEvent.CLOSE_WIDGET);
|
||||
if (this.widget) types.push(RoomObjectWidgetRequestEvent.OPEN_WIDGET, RoomObjectWidgetRequestEvent.CLOSE_WIDGET);
|
||||
|
||||
if(this.contextMenu) types.push(RoomObjectWidgetRequestEvent.OPEN_FURNI_CONTEXT_MENU, RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU);
|
||||
if (this.contextMenu) types.push(RoomObjectWidgetRequestEvent.OPEN_FURNI_CONTEXT_MENU, RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU);
|
||||
|
||||
return this.mergeTypes(super.getEventTypes(), types);
|
||||
}
|
||||
|
||||
public initialize(asset: IAssetData): void
|
||||
{
|
||||
if(!asset) return;
|
||||
if (!asset) return;
|
||||
|
||||
const model = this.object && this.object.model;
|
||||
|
||||
if(!model) return;
|
||||
if (!model) return;
|
||||
|
||||
if(asset.logic)
|
||||
if (asset.logic)
|
||||
{
|
||||
if(asset.logic.model)
|
||||
if (asset.logic.model)
|
||||
{
|
||||
const dimensions = asset.logic.model.dimensions;
|
||||
|
||||
if(dimensions)
|
||||
if (dimensions)
|
||||
{
|
||||
this._sizeX = dimensions.x;
|
||||
this._sizeY = dimensions.y;
|
||||
@ -102,19 +102,19 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
|
||||
const directions = asset.logic.model.directions;
|
||||
|
||||
if(directions && directions.length)
|
||||
if (directions && directions.length)
|
||||
{
|
||||
for(const direction of directions) this._directions.push(direction);
|
||||
for (const direction of directions) this._directions.push(direction);
|
||||
|
||||
this._directions.sort((a, b) => (a - b));
|
||||
}
|
||||
}
|
||||
|
||||
if(asset.logic.customVars)
|
||||
if (asset.logic.customVars)
|
||||
{
|
||||
const variables = asset.logic.customVars.variables;
|
||||
|
||||
if(variables && variables.length)
|
||||
if (variables && variables.length)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FURNITURE_CUSTOM_VARIABLES, variables);
|
||||
}
|
||||
@ -143,7 +143,7 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
{
|
||||
super.setObject(object);
|
||||
|
||||
if(object && object.getLocation().length) this._directionInitialized = true;
|
||||
if (object && object.getLocation().length) this._directionInitialized = true;
|
||||
}
|
||||
|
||||
protected getAdClickUrl(model: IRoomObjectModel): string
|
||||
@ -153,7 +153,7 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
|
||||
protected handleAdClick(objectId: number, objectType: string, clickUrl: string): void
|
||||
{
|
||||
if(!this.eventDispatcher) return;
|
||||
if (!this.eventDispatcher) return;
|
||||
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK, this.object));
|
||||
}
|
||||
@ -162,31 +162,31 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
{
|
||||
super.update(time);
|
||||
|
||||
if(this._bouncingStep > 0)
|
||||
if (this._bouncingStep > 0)
|
||||
{
|
||||
this._bouncingStep++;
|
||||
|
||||
if(this._bouncingStep > FurnitureLogic.BOUNCING_STEPS) this._bouncingStep = 0;
|
||||
if (this._bouncingStep > FurnitureLogic.BOUNCING_STEPS) this._bouncingStep = 0;
|
||||
}
|
||||
}
|
||||
|
||||
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||
{
|
||||
if(message instanceof ObjectDataUpdateMessage)
|
||||
if (message instanceof ObjectDataUpdateMessage)
|
||||
{
|
||||
this.processDataUpdateMessage(message);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectHeightUpdateMessage)
|
||||
if (message instanceof ObjectHeightUpdateMessage)
|
||||
{
|
||||
this.processObjectHeightUpdateMessage(message);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectItemDataUpdateMessage)
|
||||
if (message instanceof ObjectItemDataUpdateMessage)
|
||||
{
|
||||
this.processItemDataUpdateMessage(message);
|
||||
|
||||
@ -195,16 +195,16 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
|
||||
this._mouseOver = false;
|
||||
|
||||
if(message.location && message.direction)
|
||||
if (message.location && message.direction)
|
||||
{
|
||||
if(!(message instanceof ObjectMoveUpdateMessage))
|
||||
if (!(message instanceof ObjectMoveUpdateMessage))
|
||||
{
|
||||
const direction = this.object.getDirection();
|
||||
const location = this.object.getLocation();
|
||||
|
||||
if((direction.x !== message.direction.x) && this._directionInitialized)
|
||||
if ((direction.x !== message.direction.x) && this._directionInitialized)
|
||||
{
|
||||
if((location.x === message.location.x) && (location.y === message.location.y) && (location.z === message.location.z))
|
||||
if ((location.x === message.location.x) && (location.y === message.location.y) && (location.z === message.location.z))
|
||||
{
|
||||
this._bouncingStep = 1;
|
||||
this._storedRotateMessage = new RoomObjectUpdateMessage(message.location, message.direction);
|
||||
@ -217,9 +217,9 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
this._directionInitialized = true;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectSelectedMessage)
|
||||
if (message instanceof ObjectSelectedMessage)
|
||||
{
|
||||
if(this.contextMenu && this.eventDispatcher && this.object)
|
||||
if (this.contextMenu && this.eventDispatcher && this.object)
|
||||
{
|
||||
const eventType = (message.selected) ? RoomObjectWidgetRequestEvent.OPEN_FURNI_CONTEXT_MENU : RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU;
|
||||
|
||||
@ -232,27 +232,27 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
|
||||
private processDataUpdateMessage(message: ObjectDataUpdateMessage): void
|
||||
{
|
||||
if(!message) return;
|
||||
if (!message) return;
|
||||
|
||||
this.object.setState(message.state, 0);
|
||||
|
||||
if(message.data) message.data.writeRoomObjectModel(this.object.model);
|
||||
if (message.data) message.data.writeRoomObjectModel(this.object.model);
|
||||
|
||||
if(message.extra !== null) this.object.model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, message.extra.toString());
|
||||
if (message.extra !== null) this.object.model.setValue(RoomObjectVariable.FURNITURE_EXTRAS, message.extra.toString());
|
||||
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_STATE_UPDATE_TIME, this.lastUpdateTime);
|
||||
}
|
||||
|
||||
private processObjectHeightUpdateMessage(message: ObjectHeightUpdateMessage): void
|
||||
{
|
||||
if(!message) return;
|
||||
if (!message) return;
|
||||
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_SIZE_Z, message.height);
|
||||
}
|
||||
|
||||
private processItemDataUpdateMessage(message: ObjectItemDataUpdateMessage): void
|
||||
{
|
||||
if(!message) return;
|
||||
if (!message) return;
|
||||
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_ITEMDATA, message.data);
|
||||
}
|
||||
@ -261,10 +261,10 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
{
|
||||
const adUrl = this.getAdClickUrl(this.object.model);
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.MOUSE_MOVE:
|
||||
if(this.eventDispatcher)
|
||||
if (this.eventDispatcher)
|
||||
{
|
||||
const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_MOVE, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
|
||||
|
||||
@ -277,11 +277,11 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
}
|
||||
return;
|
||||
case MouseEventType.ROLL_OVER:
|
||||
if(!this._mouseOver)
|
||||
if (!this._mouseOver)
|
||||
{
|
||||
if(this.eventDispatcher)
|
||||
if (this.eventDispatcher)
|
||||
{
|
||||
if(adUrl && (adUrl.indexOf('http') === 0))
|
||||
if (adUrl && (adUrl.indexOf('http') === 0))
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW, this.object));
|
||||
}
|
||||
@ -300,11 +300,11 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
}
|
||||
return;
|
||||
case MouseEventType.ROLL_OUT:
|
||||
if(this._mouseOver)
|
||||
if (this._mouseOver)
|
||||
{
|
||||
if(this.eventDispatcher)
|
||||
if (this.eventDispatcher)
|
||||
{
|
||||
if(adUrl && (adUrl.indexOf('http') === 0))
|
||||
if (adUrl && (adUrl.indexOf('http') === 0))
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE, this.object));
|
||||
}
|
||||
@ -326,7 +326,7 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
this.useObject();
|
||||
return;
|
||||
case MouseEventType.MOUSE_CLICK:
|
||||
if(this.eventDispatcher)
|
||||
if (this.eventDispatcher)
|
||||
{
|
||||
const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.CLICK, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
|
||||
|
||||
@ -337,16 +337,16 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
|
||||
this.eventDispatcher.dispatchEvent(mouseEvent);
|
||||
|
||||
if(adUrl && (adUrl.indexOf('http') === 0))
|
||||
if (adUrl && (adUrl.indexOf('http') === 0))
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE, this.object));
|
||||
}
|
||||
|
||||
if(adUrl && adUrl.length) this.handleAdClick(this.object.id, this.object.type, adUrl);
|
||||
if (adUrl && adUrl.length) this.handleAdClick(this.object.id, this.object.type, adUrl);
|
||||
}
|
||||
return;
|
||||
case MouseEventType.MOUSE_DOWN:
|
||||
if(this.eventDispatcher)
|
||||
if (this.eventDispatcher)
|
||||
{
|
||||
const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
|
||||
|
||||
@ -354,7 +354,7 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
}
|
||||
return;
|
||||
case MouseEventType.MOUSE_DOWN_LONG:
|
||||
if(this.eventDispatcher)
|
||||
if (this.eventDispatcher)
|
||||
{
|
||||
const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN_LONG, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
|
||||
|
||||
@ -366,20 +366,20 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
|
||||
protected getLocationOffset(): IVector3D
|
||||
{
|
||||
if(this._bouncingStep <= 0) return null;
|
||||
if (this._bouncingStep <= 0) return null;
|
||||
|
||||
this._locationOffset.x = 0;
|
||||
this._locationOffset.y = 0;
|
||||
|
||||
if(this._bouncingStep <= (FurnitureLogic.BOUNCING_STEPS / 2))
|
||||
if (this._bouncingStep <= (FurnitureLogic.BOUNCING_STEPS / 2))
|
||||
{
|
||||
this._locationOffset.z = FurnitureLogic.BOUNCING_Z * this._bouncingStep;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(this._bouncingStep <= FurnitureLogic.BOUNCING_STEPS)
|
||||
if (this._bouncingStep <= FurnitureLogic.BOUNCING_STEPS)
|
||||
{
|
||||
if(this._storedRotateMessage)
|
||||
if (this._storedRotateMessage)
|
||||
{
|
||||
super.processUpdateMessage(this._storedRotateMessage);
|
||||
|
||||
@ -395,27 +395,27 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
|
||||
public useObject(): void
|
||||
{
|
||||
if(!this.object || !this.eventDispatcher) return;
|
||||
if (!this.object || !this.eventDispatcher) return;
|
||||
|
||||
const clickUrl = this.getAdClickUrl(this.object.model);
|
||||
|
||||
if(clickUrl && clickUrl.length)
|
||||
if (clickUrl && clickUrl.length)
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK, this.object, null, clickUrl));
|
||||
}
|
||||
|
||||
if(this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.OPEN_WIDGET, this.object));
|
||||
if (this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.OPEN_WIDGET, this.object));
|
||||
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object));
|
||||
}
|
||||
|
||||
public tearDown(): void
|
||||
{
|
||||
if(this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1)
|
||||
if (this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1)
|
||||
{
|
||||
if(this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_WIDGET, this.object));
|
||||
if (this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_WIDGET, this.object));
|
||||
|
||||
if(this.contextMenu) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object));
|
||||
if (this.contextMenu) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_FURNI_CONTEXT_MENU, this.object));
|
||||
}
|
||||
|
||||
super.tearDown();
|
||||
|
@ -1,6 +1,5 @@
|
||||
import { IRoomGeometry, MouseEventType } from '../../../../../api';
|
||||
import { RoomObjectFurnitureActionEvent } from '../../../../../events';
|
||||
import { RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectFurnitureActionEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
export class FurnitureMultiStateLogic extends FurnitureLogic
|
||||
@ -14,9 +13,9 @@ export class FurnitureMultiStateLogic extends FurnitureLogic
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry || !this.object) return;
|
||||
if (!event || !geometry || !this.object) return;
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.ROLL_OVER:
|
||||
this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object));
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { IAssetData, IParticleSystem, IRoomGeometry, MapDataType, MouseEventType, RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectFurnitureActionEvent, RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectFurnitureActionEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { ObjectDataUpdateMessage, ObjectModelDataUpdateMessage } from '../../../messages';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
|
||||
@ -25,9 +25,9 @@ export class FurniturePresentLogic extends FurnitureLogic
|
||||
{
|
||||
super.initialize(asset);
|
||||
|
||||
if(asset.logic)
|
||||
if (asset.logic)
|
||||
{
|
||||
if(asset.logic.particleSystems && asset.logic.particleSystems.length)
|
||||
if (asset.logic.particleSystems && asset.logic.particleSystems.length)
|
||||
{
|
||||
this.object.model.setValue<IParticleSystem[]>(RoomObjectVariable.FURNITURE_FIREWORKS_DATA, asset.logic.particleSystems);
|
||||
}
|
||||
@ -38,16 +38,16 @@ export class FurniturePresentLogic extends FurnitureLogic
|
||||
{
|
||||
super.processUpdateMessage(message);
|
||||
|
||||
if(message instanceof ObjectDataUpdateMessage)
|
||||
if (message instanceof ObjectDataUpdateMessage)
|
||||
{
|
||||
message.data.writeRoomObjectModel(this.object.model);
|
||||
|
||||
this.updateStuffData();
|
||||
}
|
||||
|
||||
if(message instanceof ObjectModelDataUpdateMessage)
|
||||
if (message instanceof ObjectModelDataUpdateMessage)
|
||||
{
|
||||
if(message.numberKey === RoomObjectVariable.FURNITURE_DISABLE_PICKING_ANIMATION)
|
||||
if (message.numberKey === RoomObjectVariable.FURNITURE_DISABLE_PICKING_ANIMATION)
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_DISABLE_PICKING_ANIMATION, message.numberValue);
|
||||
}
|
||||
@ -56,7 +56,7 @@ export class FurniturePresentLogic extends FurnitureLogic
|
||||
|
||||
private updateStuffData(): void
|
||||
{
|
||||
if(!this.object || !this.object.model) return;
|
||||
if (!this.object || !this.object.model) return;
|
||||
|
||||
const stuffData = new MapDataType();
|
||||
|
||||
@ -65,7 +65,7 @@ export class FurniturePresentLogic extends FurnitureLogic
|
||||
const message = stuffData.getValue(FurniturePresentLogic.MESSAGE);
|
||||
const data = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_DATA);
|
||||
|
||||
if(!message && (typeof data === 'string'))
|
||||
if (!message && (typeof data === 'string'))
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_DATA, data.substr(1));
|
||||
}
|
||||
@ -81,16 +81,16 @@ export class FurniturePresentLogic extends FurnitureLogic
|
||||
|
||||
private writeToModel(key: string, value: string): void
|
||||
{
|
||||
if(!value) return;
|
||||
if (!value) return;
|
||||
|
||||
this.object.model.setValue(key, value);
|
||||
}
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry || !this.object) return;
|
||||
if (!event || !geometry || !this.object) return;
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.ROLL_OVER:
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_BUTTON, this.object));
|
||||
@ -105,7 +105,7 @@ export class FurniturePresentLogic extends FurnitureLogic
|
||||
|
||||
public useObject(): void
|
||||
{
|
||||
if(!this.object || !this.eventDispatcher) return;
|
||||
if (!this.object || !this.eventDispatcher) return;
|
||||
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PRESENT, this.object));
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { IRoomGeometry, MouseEventType, NumberDataType, RoomObjectVariable } from '../../../../../api';
|
||||
import { RoomObjectHSLColorEnableEvent, RoomObjectWidgetRequestEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectHSLColorEnableEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { ObjectDataUpdateMessage } from '../../../messages';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
@ -28,13 +28,13 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic
|
||||
|
||||
protected onDispose(): void
|
||||
{
|
||||
if(this._roomColorUpdated)
|
||||
if (this._roomColorUpdated)
|
||||
{
|
||||
if(this.eventDispatcher && this.object)
|
||||
if (this.eventDispatcher && this.object)
|
||||
{
|
||||
const realRoomObject = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT);
|
||||
|
||||
if(realRoomObject === 1)
|
||||
if (realRoomObject === 1)
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectHSLColorEnableEvent(RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR, this.object, false, 0, 0, 0));
|
||||
}
|
||||
@ -50,19 +50,19 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic
|
||||
{
|
||||
super.processUpdateMessage(message);
|
||||
|
||||
if(message instanceof ObjectDataUpdateMessage)
|
||||
if (message instanceof ObjectDataUpdateMessage)
|
||||
{
|
||||
message.data.writeRoomObjectModel(this.object.model);
|
||||
|
||||
const realRoomObject = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT);
|
||||
|
||||
if(realRoomObject === 1) this.processColorUpdate();
|
||||
if (realRoomObject === 1) this.processColorUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
private processColorUpdate(): void
|
||||
{
|
||||
if(!this.object || !this.object.model) return;
|
||||
if (!this.object || !this.object.model) return;
|
||||
|
||||
const numberData = new NumberDataType();
|
||||
|
||||
@ -73,7 +73,7 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic
|
||||
const saturation = numberData.getValue(2);
|
||||
const lightness = numberData.getValue(3);
|
||||
|
||||
if((state > -1) && (hue > -1) && (saturation > -1) && (lightness > -1))
|
||||
if ((state > -1) && (hue > -1) && (saturation > -1) && (lightness > -1))
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_HUE, hue);
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_ROOM_BACKGROUND_COLOR_SATURATION, saturation);
|
||||
@ -81,7 +81,7 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic
|
||||
|
||||
this.object.setState(state, 0);
|
||||
|
||||
if(this.eventDispatcher)
|
||||
if (this.eventDispatcher)
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectHSLColorEnableEvent(RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR, this.object, (state === 1), hue, saturation, lightness));
|
||||
}
|
||||
@ -92,9 +92,9 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry || !this.object) return;
|
||||
if (!event || !geometry || !this.object) return;
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.DOUBLE_CLICK:
|
||||
(this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BACKGROUND_COLOR, this.object)));
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { BaseTexture, Texture } from '@pixi/core';
|
||||
import { decompressFrames, parseGIF } from 'gifuct-js';
|
||||
import { GetAssetManager, IAssetData, IRoomGeometry, MapDataType, MouseEventType, RoomObjectVariable, RoomWidgetEnumItemExtradataParameter } from '../../../../../api';
|
||||
import { RoomObjectRoomAdEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectRoomAdEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { Nitro } from '../../../../Nitro';
|
||||
import { ObjectAdUpdateMessage, ObjectDataUpdateMessage } from '../../../messages';
|
||||
import { FurnitureLogic } from './FurnitureLogic';
|
||||
@ -38,7 +38,7 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
{
|
||||
super.initialize(asset);
|
||||
|
||||
if(this._disableFurnitureSelection)
|
||||
if (this._disableFurnitureSelection)
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_SELECTION_DISABLED, 1);
|
||||
}
|
||||
@ -48,14 +48,14 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
{
|
||||
super.processUpdateMessage(message);
|
||||
|
||||
if(message instanceof ObjectDataUpdateMessage) this.processAdDataUpdateMessage(message);
|
||||
if (message instanceof ObjectDataUpdateMessage) this.processAdDataUpdateMessage(message);
|
||||
|
||||
if(message instanceof ObjectAdUpdateMessage) this.processAdUpdate(message);
|
||||
if (message instanceof ObjectAdUpdateMessage) this.processAdUpdate(message);
|
||||
}
|
||||
|
||||
private processAdDataUpdateMessage(message: ObjectDataUpdateMessage): void
|
||||
{
|
||||
if(!message) return;
|
||||
if (!message) return;
|
||||
|
||||
const objectData = new MapDataType();
|
||||
|
||||
@ -63,12 +63,12 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
|
||||
const state = parseInt(objectData.getValue(FurnitureRoomBrandingLogic.STATE));
|
||||
|
||||
if(!isNaN(state) && (this.object.getState(0) !== state)) this.object.setState(state, 0);
|
||||
if (!isNaN(state) && (this.object.getState(0) !== state)) this.object.setState(state, 0);
|
||||
|
||||
const imageUrl = objectData.getValue(FurnitureRoomBrandingLogic.IMAGEURL_KEY);
|
||||
const existingUrl = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL);
|
||||
|
||||
if(!existingUrl || (existingUrl !== imageUrl))
|
||||
if (!existingUrl || (existingUrl !== imageUrl))
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL, imageUrl);
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS, 0);
|
||||
@ -78,13 +78,13 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
|
||||
const clickUrl = objectData.getValue(FurnitureRoomBrandingLogic.CLICKURL_KEY);
|
||||
|
||||
if(clickUrl)
|
||||
if (clickUrl)
|
||||
{
|
||||
const existingUrl = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_BRANDING_URL);
|
||||
|
||||
if(!existingUrl || existingUrl !== clickUrl)
|
||||
if (!existingUrl || existingUrl !== clickUrl)
|
||||
{
|
||||
if(this.object.model) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_URL, clickUrl);
|
||||
if (this.object.model) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_URL, clickUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,13 +92,13 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
const offsetY = parseInt(objectData.getValue(FurnitureRoomBrandingLogic.OFFSETY_KEY));
|
||||
const offsetZ = parseInt(objectData.getValue(FurnitureRoomBrandingLogic.OFFSETZ_KEY));
|
||||
|
||||
if(!isNaN(offsetX)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_X, offsetX);
|
||||
if(!isNaN(offsetY)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Y, offsetY);
|
||||
if(!isNaN(offsetZ)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Z, offsetZ);
|
||||
if (!isNaN(offsetX)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_X, offsetX);
|
||||
if (!isNaN(offsetY)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Y, offsetY);
|
||||
if (!isNaN(offsetZ)) this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_OFFSET_Z, offsetZ);
|
||||
|
||||
let options = (((FurnitureRoomBrandingLogic.IMAGEURL_KEY + '=') + ((imageUrl !== null) ? imageUrl : '')) + '\t');
|
||||
|
||||
if(this._hasClickUrl)
|
||||
if (this._hasClickUrl)
|
||||
{
|
||||
options = (options + (((FurnitureRoomBrandingLogic.CLICKURL_KEY + '=') + ((clickUrl !== null) ? clickUrl : '')) + '\t'));
|
||||
}
|
||||
@ -112,9 +112,9 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
|
||||
private processAdUpdate(message: ObjectAdUpdateMessage): void
|
||||
{
|
||||
if(!message || !this.object) return;
|
||||
if (!message || !this.object) return;
|
||||
|
||||
switch(message.type)
|
||||
switch (message.type)
|
||||
{
|
||||
case ObjectAdUpdateMessage.IMAGE_LOADED:
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS, 1);
|
||||
@ -127,9 +127,9 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry) return;
|
||||
if (!event || !geometry) return;
|
||||
|
||||
if((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.DOUBLE_CLICK)) return;
|
||||
if ((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.DOUBLE_CLICK)) return;
|
||||
|
||||
super.mouseEvent(event, geometry);
|
||||
}
|
||||
@ -138,14 +138,14 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
{
|
||||
const model = this.object && this.object.model;
|
||||
|
||||
if(!model) return;
|
||||
if (!model) return;
|
||||
|
||||
const imageUrl = model.getValue<string>(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_URL);
|
||||
const imageStatus = model.getValue<number>(RoomObjectVariable.FURNITURE_BRANDING_IMAGE_STATUS);
|
||||
|
||||
if(!imageUrl || (imageUrl === '') || (imageStatus === 1)) return;
|
||||
if (!imageUrl || (imageUrl === '') || (imageStatus === 1)) return;
|
||||
|
||||
if(imageUrl.endsWith('.gif'))
|
||||
if (imageUrl.endsWith('.gif'))
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_BRANDING_IS_ANIMATED, true);
|
||||
|
||||
@ -163,23 +163,23 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
|
||||
let frame = new Uint8Array(wh * 4);
|
||||
|
||||
for(let ind = 0; ind < frames.length; ind++)
|
||||
for (let ind = 0; ind < frames.length; ind++)
|
||||
{
|
||||
if(ind > 0) frame = frame.slice(0);
|
||||
if (ind > 0) frame = frame.slice(0);
|
||||
|
||||
const pixels = frames[ind].pixels;
|
||||
const colorTable = frames[ind].colorTable;
|
||||
const trans = frames[ind].transparentIndex;
|
||||
const dims = frames[ind].dims;
|
||||
|
||||
for(let j = 0; j < dims.height; j++)
|
||||
for (let j = 0; j < dims.height; j++)
|
||||
{
|
||||
for(let i = 0; i < dims.width; i++)
|
||||
for (let i = 0; i < dims.width; i++)
|
||||
{
|
||||
const pixel = pixels[j * dims.width + i];
|
||||
const coord = (j + dims.top) * width + (i + dims.left);
|
||||
|
||||
if(trans !== pixel)
|
||||
if (trans !== pixel)
|
||||
{
|
||||
const c = colorTable[pixel];
|
||||
|
||||
@ -210,15 +210,15 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
{
|
||||
const asset = GetAssetManager();
|
||||
|
||||
if(!asset) return;
|
||||
if (!asset) return;
|
||||
|
||||
const texture = asset.getTexture(imageUrl);
|
||||
|
||||
if(!texture)
|
||||
if (!texture)
|
||||
{
|
||||
asset.downloadAsset(imageUrl, (flag: boolean) =>
|
||||
{
|
||||
if(flag)
|
||||
if (flag)
|
||||
{
|
||||
this.processUpdateMessage(new ObjectAdUpdateMessage(ObjectAdUpdateMessage.IMAGE_LOADED));
|
||||
}
|
||||
|
@ -1,17 +1,16 @@
|
||||
import { IRoomGeometry, MouseEventType } from '../../../../../api';
|
||||
import { RoomObjectStateChangedEvent } from '../../../../../events';
|
||||
import { RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectStateChangedEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||
|
||||
export class FurnitureWelcomeGiftLogic extends FurnitureMultiStateLogic
|
||||
{
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry) return;
|
||||
if (!event || !geometry) return;
|
||||
|
||||
if(event.type === MouseEventType.DOUBLE_CLICK)
|
||||
if (event.type === MouseEventType.DOUBLE_CLICK)
|
||||
{
|
||||
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object));
|
||||
if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object));
|
||||
}
|
||||
|
||||
super.mouseEvent(event, geometry);
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { IAssetData, IRoomGeometry, IRoomObjectModel, MouseEventType, PetType, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { RoomObjectMoveEvent } from '../../../../../events';
|
||||
import { RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectMouseEvent, RoomObjectMoveEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { PetFigureData } from '../../../../avatar';
|
||||
import { ObjectAvatarChatUpdateMessage, ObjectAvatarExperienceUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarPetGestureUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSelectedMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarUpdateMessage } from '../../../messages';
|
||||
import { MovingObjectLogic } from '../MovingObjectLogic';
|
||||
@ -43,21 +43,21 @@ export class PetLogic extends MovingObjectLogic
|
||||
|
||||
public initialize(asset: IAssetData): void
|
||||
{
|
||||
if(!asset) return;
|
||||
if (!asset) return;
|
||||
|
||||
const model = this.object && this.object.model;
|
||||
|
||||
if(!model) return;
|
||||
if (!model) return;
|
||||
|
||||
if(asset.logic)
|
||||
if (asset.logic)
|
||||
{
|
||||
if(asset.logic.model)
|
||||
if (asset.logic.model)
|
||||
{
|
||||
const directions = asset.logic.model.directions;
|
||||
|
||||
if(directions && directions.length)
|
||||
if (directions && directions.length)
|
||||
{
|
||||
for(const direction of directions) this._directions.push(direction);
|
||||
for (const direction of directions) this._directions.push(direction);
|
||||
|
||||
this._directions.sort();
|
||||
}
|
||||
@ -69,9 +69,9 @@ export class PetLogic extends MovingObjectLogic
|
||||
|
||||
public dispose(): void
|
||||
{
|
||||
if(this._selected && this.object)
|
||||
if (this._selected && this.object)
|
||||
{
|
||||
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object));
|
||||
if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMoveEvent(RoomObjectMoveEvent.OBJECT_REMOVED, this.object));
|
||||
}
|
||||
|
||||
this._directions = null;
|
||||
@ -82,15 +82,15 @@ export class PetLogic extends MovingObjectLogic
|
||||
{
|
||||
super.update(totalTimeRunning);
|
||||
|
||||
if(this._selected && this.object)
|
||||
if (this._selected && this.object)
|
||||
{
|
||||
if(this.eventDispatcher)
|
||||
if (this.eventDispatcher)
|
||||
{
|
||||
const location = this.object.getLocation();
|
||||
|
||||
if(((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z))
|
||||
if (((!this._reportedLocation || (this._reportedLocation.x !== location.x)) || (this._reportedLocation.y !== location.y)) || (this._reportedLocation.z !== location.z))
|
||||
{
|
||||
if(!this._reportedLocation) this._reportedLocation = new Vector3d();
|
||||
if (!this._reportedLocation) this._reportedLocation = new Vector3d();
|
||||
|
||||
this._reportedLocation.assign(location);
|
||||
|
||||
@ -99,21 +99,21 @@ export class PetLogic extends MovingObjectLogic
|
||||
}
|
||||
}
|
||||
|
||||
if(this.object && this.object.model) this.updateModel(totalTimeRunning, this.object.model);
|
||||
if (this.object && this.object.model) this.updateModel(totalTimeRunning, this.object.model);
|
||||
}
|
||||
|
||||
private updateModel(time: number, model: IRoomObjectModel): void
|
||||
{
|
||||
if((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp))
|
||||
if ((this._gestureEndTimestamp > 0) && (time > this._gestureEndTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_GESTURE, null);
|
||||
|
||||
this._gestureEndTimestamp = 0;
|
||||
}
|
||||
|
||||
if(this._talkingEndTimestamp > 0)
|
||||
if (this._talkingEndTimestamp > 0)
|
||||
{
|
||||
if(time > this._talkingEndTimestamp)
|
||||
if (time > this._talkingEndTimestamp)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_TALK, 0);
|
||||
|
||||
@ -121,7 +121,7 @@ export class PetLogic extends MovingObjectLogic
|
||||
}
|
||||
}
|
||||
|
||||
if((this._expressionEndTimestamp > 0) && (time > this._expressionEndTimestamp))
|
||||
if ((this._expressionEndTimestamp > 0) && (time > this._expressionEndTimestamp))
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_EXPRESSION, 0);
|
||||
|
||||
@ -131,22 +131,22 @@ export class PetLogic extends MovingObjectLogic
|
||||
|
||||
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||
{
|
||||
if(!message || !this.object) return;
|
||||
if (!message || !this.object) return;
|
||||
|
||||
super.processUpdateMessage(message);
|
||||
|
||||
const model = this.object && this.object.model;
|
||||
|
||||
if(!model) return;
|
||||
if (!model) return;
|
||||
|
||||
if(message instanceof ObjectAvatarUpdateMessage)
|
||||
if (message instanceof ObjectAvatarUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.HEAD_DIRECTION, message.headDirection);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarFigureUpdateMessage)
|
||||
if (message instanceof ObjectAvatarFigureUpdateMessage)
|
||||
{
|
||||
const petFigureData = new PetFigureData(message.figure);
|
||||
|
||||
@ -163,14 +163,14 @@ export class PetLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarPostureUpdateMessage)
|
||||
if (message instanceof ObjectAvatarPostureUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_POSTURE, message.postureType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarChatUpdateMessage)
|
||||
if (message instanceof ObjectAvatarChatUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_TALK, 1);
|
||||
|
||||
@ -179,14 +179,14 @@ export class PetLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarSleepUpdateMessage)
|
||||
if (message instanceof ObjectAvatarSleepUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_SLEEP, message.isSleeping ? 1 : 0);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarPetGestureUpdateMessage)
|
||||
if (message instanceof ObjectAvatarPetGestureUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_GESTURE, message.gesture);
|
||||
|
||||
@ -195,7 +195,7 @@ export class PetLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarSelectedMessage)
|
||||
if (message instanceof ObjectAvatarSelectedMessage)
|
||||
{
|
||||
this._selected = message.selected;
|
||||
this._reportedLocation = null;
|
||||
@ -203,7 +203,7 @@ export class PetLogic extends MovingObjectLogic
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectAvatarExperienceUpdateMessage)
|
||||
if (message instanceof ObjectAvatarExperienceUpdateMessage)
|
||||
{
|
||||
model.setValue(RoomObjectVariable.FIGURE_EXPERIENCE_TIMESTAMP, this.time);
|
||||
model.setValue(RoomObjectVariable.FIGURE_GAINED_EXPERIENCE, message.gainedExperience);
|
||||
@ -216,7 +216,7 @@ export class PetLogic extends MovingObjectLogic
|
||||
{
|
||||
let eventType: string = null;
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.MOUSE_CLICK:
|
||||
eventType = RoomObjectMouseEvent.CLICK;
|
||||
@ -226,14 +226,14 @@ export class PetLogic extends MovingObjectLogic
|
||||
case MouseEventType.MOUSE_DOWN: {
|
||||
const petType = this.object.model.getValue<number>(RoomObjectVariable.PET_TYPE);
|
||||
|
||||
if(petType === PetType.MONSTERPLANT)
|
||||
if (petType === PetType.MONSTERPLANT)
|
||||
{
|
||||
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown));
|
||||
if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown));
|
||||
if (eventType && this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(eventType, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown));
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { Point } from '@pixi/math';
|
||||
import { IRoomGeometry, IRoomObjectModel, MouseEventType, NitroConfiguration, RoomObjectVariable, Vector3d } from '../../../../../api';
|
||||
import { RoomObjectTileMouseEvent, RoomObjectWallMouseEvent } from '../../../../../events';
|
||||
import { ColorConverter, RoomObjectEvent, RoomObjectLogicBase, RoomObjectMouseEvent, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectEvent, RoomObjectMouseEvent, RoomObjectTileMouseEvent, RoomObjectWallMouseEvent, RoomSpriteMouseEvent } from '../../../../../events';
|
||||
import { ColorConverter, RoomObjectLogicBase, RoomObjectUpdateMessage } from '../../../../../room';
|
||||
import { ObjectRoomColorUpdateMessage, ObjectRoomFloorHoleUpdateMessage, ObjectRoomMapUpdateMessage, ObjectRoomMaskUpdateMessage, ObjectRoomPlanePropertyUpdateMessage, ObjectRoomPlaneVisibilityUpdateMessage, ObjectRoomUpdateMessage } from '../../../messages';
|
||||
import { RoomMapData } from '../../RoomMapData';
|
||||
import { RoomPlaneBitmapMaskData } from '../../RoomPlaneBitmapMaskData';
|
||||
@ -55,14 +55,14 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
{
|
||||
super.dispose();
|
||||
|
||||
if(this._planeParser)
|
||||
if (this._planeParser)
|
||||
{
|
||||
this._planeParser.dispose();
|
||||
|
||||
this._planeParser = null;
|
||||
}
|
||||
|
||||
if(this._planeBitmapMaskParser)
|
||||
if (this._planeBitmapMaskParser)
|
||||
{
|
||||
this._planeBitmapMaskParser.dispose();
|
||||
|
||||
@ -72,11 +72,11 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
public initialize(roomMap: RoomMapData): void
|
||||
{
|
||||
if(!roomMap || !this.object) return;
|
||||
if (!roomMap || !this.object) return;
|
||||
|
||||
if(!(roomMap instanceof RoomMapData)) return;
|
||||
if (!(roomMap instanceof RoomMapData)) return;
|
||||
|
||||
if(!this._planeParser.initializeFromMapData(roomMap)) return;
|
||||
if (!this._planeParser.initializeFromMapData(roomMap)) return;
|
||||
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_MAP_DATA, roomMap);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR, 0xFFFFFF);
|
||||
@ -93,13 +93,13 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
this.updateBackgroundColor(time);
|
||||
|
||||
if(this._needsMapUpdate)
|
||||
if (this._needsMapUpdate)
|
||||
{
|
||||
if(this._lastHoleUpdate && (time - this._lastHoleUpdate) < 5) return;
|
||||
if (this._lastHoleUpdate && (time - this._lastHoleUpdate) < 5) return;
|
||||
|
||||
const model = this.object && this.object.model;
|
||||
|
||||
if(model)
|
||||
if (model)
|
||||
{
|
||||
const mapData = this._planeParser.getMapData();
|
||||
|
||||
@ -117,12 +117,12 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
private updateBackgroundColor(k: number): void
|
||||
{
|
||||
if(!this.object || !this._colorChangedTime) return;
|
||||
if (!this.object || !this._colorChangedTime) return;
|
||||
|
||||
let color = this._color;
|
||||
let newColor = this._light;
|
||||
|
||||
if((k - this._colorChangedTime) >= this._colorTransitionLength)
|
||||
if ((k - this._colorChangedTime) >= this._colorTransitionLength)
|
||||
{
|
||||
color = this._targetColor;
|
||||
newColor = this._targetLight;
|
||||
@ -156,60 +156,60 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
_local_5 = ((_local_5 & 0xFFFF00) + newColor);
|
||||
color = ColorConverter.hslToRGB(_local_5);
|
||||
|
||||
if(this.object.model) this.object.model.setValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR, color);
|
||||
if (this.object.model) this.object.model.setValue(RoomObjectVariable.ROOM_BACKGROUND_COLOR, color);
|
||||
}
|
||||
|
||||
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||
{
|
||||
if(!message || !this.object) return;
|
||||
if (!message || !this.object) return;
|
||||
|
||||
const model = this.object.model;
|
||||
|
||||
if(!model) return;
|
||||
if (!model) return;
|
||||
|
||||
if(message instanceof ObjectRoomUpdateMessage)
|
||||
if (message instanceof ObjectRoomUpdateMessage)
|
||||
{
|
||||
this.onObjectRoomUpdateMessage(message, model);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectRoomMaskUpdateMessage)
|
||||
if (message instanceof ObjectRoomMaskUpdateMessage)
|
||||
{
|
||||
this.onObjectRoomMaskUpdateMessage(message, model);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectRoomPlaneVisibilityUpdateMessage)
|
||||
if (message instanceof ObjectRoomPlaneVisibilityUpdateMessage)
|
||||
{
|
||||
this.onObjectRoomPlaneVisibilityUpdateMessage(message, model);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectRoomPlanePropertyUpdateMessage)
|
||||
if (message instanceof ObjectRoomPlanePropertyUpdateMessage)
|
||||
{
|
||||
this.onObjectRoomPlanePropertyUpdateMessage(message, model);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectRoomFloorHoleUpdateMessage)
|
||||
if (message instanceof ObjectRoomFloorHoleUpdateMessage)
|
||||
{
|
||||
this.onObjectRoomFloorHoleUpdateMessage(message, model);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectRoomColorUpdateMessage)
|
||||
if (message instanceof ObjectRoomColorUpdateMessage)
|
||||
{
|
||||
this.onObjectRoomColorUpdateMessage(message, model);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(message instanceof ObjectRoomMapUpdateMessage)
|
||||
if (message instanceof ObjectRoomMapUpdateMessage)
|
||||
{
|
||||
this.onObjectRoomMapUpdateMessage(message);
|
||||
}
|
||||
@ -217,7 +217,7 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
private onObjectRoomUpdateMessage(message: ObjectRoomUpdateMessage, model: IRoomObjectModel): void
|
||||
{
|
||||
switch(message.type)
|
||||
switch (message.type)
|
||||
{
|
||||
case ObjectRoomUpdateMessage.ROOM_FLOOR_UPDATE:
|
||||
model.setValue(RoomObjectVariable.ROOM_FLOOR_TYPE, message.value);
|
||||
@ -236,12 +236,12 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
let maskType: string = null;
|
||||
let update = false;
|
||||
|
||||
switch(message.type)
|
||||
switch (message.type)
|
||||
{
|
||||
case ObjectRoomMaskUpdateMessage.ADD_MASK:
|
||||
maskType = RoomPlaneBitmapMaskData.WINDOW;
|
||||
|
||||
if(message.maskCategory === ObjectRoomMaskUpdateMessage.HOLE) maskType = RoomPlaneBitmapMaskData.HOLE;
|
||||
if (message.maskCategory === ObjectRoomMaskUpdateMessage.HOLE) maskType = RoomPlaneBitmapMaskData.HOLE;
|
||||
|
||||
this._planeBitmapMaskParser.addMask(message.maskId, message.maskType, message.maskLocation, maskType);
|
||||
|
||||
@ -253,16 +253,16 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
}
|
||||
|
||||
if(update) _arg_2.setValue(RoomObjectVariable.ROOM_PLANE_MASK_XML, this._planeBitmapMaskParser.getXML());
|
||||
if (update) _arg_2.setValue(RoomObjectVariable.ROOM_PLANE_MASK_XML, this._planeBitmapMaskParser.getXML());
|
||||
}
|
||||
|
||||
private onObjectRoomPlaneVisibilityUpdateMessage(message: ObjectRoomPlaneVisibilityUpdateMessage, model: IRoomObjectModel): void
|
||||
{
|
||||
let visible = 0;
|
||||
|
||||
if(message.visible) visible = 1;
|
||||
if (message.visible) visible = 1;
|
||||
|
||||
switch(message.type)
|
||||
switch (message.type)
|
||||
{
|
||||
case ObjectRoomPlaneVisibilityUpdateMessage.FLOOR_VISIBILITY:
|
||||
model.setValue(RoomObjectVariable.ROOM_FLOOR_VISIBILITY, visible);
|
||||
@ -276,7 +276,7 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
private onObjectRoomPlanePropertyUpdateMessage(message: ObjectRoomPlanePropertyUpdateMessage, model: IRoomObjectModel): void
|
||||
{
|
||||
switch(message.type)
|
||||
switch (message.type)
|
||||
{
|
||||
case ObjectRoomPlanePropertyUpdateMessage.FLOOR_THICKNESS:
|
||||
model.setValue(RoomObjectVariable.ROOM_FLOOR_THICKNESS, message.value);
|
||||
@ -289,7 +289,7 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
private onObjectRoomFloorHoleUpdateMessage(message: ObjectRoomFloorHoleUpdateMessage, model: IRoomObjectModel): void
|
||||
{
|
||||
switch(message.type)
|
||||
switch (message.type)
|
||||
{
|
||||
case ObjectRoomFloorHoleUpdateMessage.ADD:
|
||||
this._planeParser.addFloorHole(message.id, message.x, message.y, message.width, message.height);
|
||||
@ -306,7 +306,7 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
private onObjectRoomColorUpdateMessage(message: ObjectRoomColorUpdateMessage, model: IRoomObjectModel): void
|
||||
{
|
||||
if(!message || !model) return;
|
||||
if (!message || !model) return;
|
||||
|
||||
this._originalColor = this._color;
|
||||
this._originalLight = this._light;
|
||||
@ -314,7 +314,7 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
this._targetLight = message.light;
|
||||
this._colorChangedTime = this.time;
|
||||
|
||||
if(this._skipColorTransition)
|
||||
if (this._skipColorTransition)
|
||||
this._colorTransitionLength = 0;
|
||||
else
|
||||
this._colorTransitionLength = 1500;
|
||||
@ -324,7 +324,7 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
private onObjectRoomMapUpdateMessage(message: ObjectRoomMapUpdateMessage): void
|
||||
{
|
||||
if(!message || !message.mapData) return;
|
||||
if (!message || !message.mapData) return;
|
||||
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_MAP_DATA, message.mapData);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_FLOOR_HOLE_UPDATE_TIME, this.time);
|
||||
@ -334,20 +334,20 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry || !this.object || !this.object.model) return;
|
||||
if (!event || !geometry || !this.object || !this.object.model) return;
|
||||
|
||||
const tag = event.spriteTag;
|
||||
|
||||
let planeId = 0;
|
||||
|
||||
if(tag && (tag.indexOf('@') >= 0))
|
||||
if (tag && (tag.indexOf('@') >= 0))
|
||||
{
|
||||
planeId = parseInt(tag.substr(tag.indexOf('@') + 1));
|
||||
}
|
||||
|
||||
if((planeId < 1) || (planeId > this._planeParser.planeCount))
|
||||
if ((planeId < 1) || (planeId > this._planeParser.planeCount))
|
||||
{
|
||||
if(event.type === MouseEventType.ROLL_OUT)
|
||||
if (event.type === MouseEventType.ROLL_OUT)
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0);
|
||||
}
|
||||
@ -365,12 +365,12 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
const planeNormalDirection = this._planeParser.getPlaneNormalDirection(planeId);
|
||||
const planeType = this._planeParser.getPlaneType(planeId);
|
||||
|
||||
if(((((planeLocation == null) || (planeLeftSide == null)) || (planeRightSide == null)) || (planeNormalDirection == null))) return;
|
||||
if (((((planeLocation == null) || (planeLeftSide == null)) || (planeRightSide == null)) || (planeNormalDirection == null))) return;
|
||||
|
||||
const leftSideLength = planeLeftSide.length;
|
||||
const rightSideLength = planeRightSide.length;
|
||||
|
||||
if(((leftSideLength == 0) || (rightSideLength == 0))) return;
|
||||
if (((leftSideLength == 0) || (rightSideLength == 0))) return;
|
||||
|
||||
const screenX = event.screenX;
|
||||
const screenY = event.screenY;
|
||||
@ -378,7 +378,7 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
planePosition = geometry.getPlanePosition(screenPoint, planeLocation, planeLeftSide, planeRightSide);
|
||||
|
||||
if(!planePosition)
|
||||
if (!planePosition)
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0);
|
||||
|
||||
@ -394,7 +394,7 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
const tileY = _local_18.y;
|
||||
const tileZ = _local_18.z;
|
||||
|
||||
if(((((planePosition.x >= 0) && (planePosition.x < leftSideLength)) && (planePosition.y >= 0)) && (planePosition.y < rightSideLength)))
|
||||
if (((((planePosition.x >= 0) && (planePosition.x < leftSideLength)) && (planePosition.y >= 0)) && (planePosition.y < rightSideLength)))
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_X, tileX);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Y, tileY);
|
||||
@ -410,30 +410,30 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
let eventType: string = null;
|
||||
|
||||
if((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.ROLL_OVER)) eventType = RoomObjectMouseEvent.MOUSE_MOVE;
|
||||
else if((event.type === MouseEventType.MOUSE_CLICK)) eventType = RoomObjectMouseEvent.CLICK;
|
||||
if ((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.ROLL_OVER)) eventType = RoomObjectMouseEvent.MOUSE_MOVE;
|
||||
else if ((event.type === MouseEventType.MOUSE_CLICK)) eventType = RoomObjectMouseEvent.CLICK;
|
||||
|
||||
switch(event.type)
|
||||
switch (event.type)
|
||||
{
|
||||
case MouseEventType.MOUSE_MOVE:
|
||||
case MouseEventType.ROLL_OVER:
|
||||
case MouseEventType.MOUSE_CLICK: {
|
||||
let newEvent: RoomObjectEvent = null;
|
||||
|
||||
if(planeType === RoomPlaneData.PLANE_FLOOR)
|
||||
if (planeType === RoomPlaneData.PLANE_FLOOR)
|
||||
{
|
||||
newEvent = new RoomObjectTileMouseEvent(eventType, this.object, event.eventId, tileX, tileY, tileZ, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
|
||||
}
|
||||
|
||||
else if((planeType === RoomPlaneData.PLANE_WALL) || (planeType === RoomPlaneData.PLANE_LANDSCAPE))
|
||||
else if ((planeType === RoomPlaneData.PLANE_WALL) || (planeType === RoomPlaneData.PLANE_LANDSCAPE))
|
||||
{
|
||||
let direction = 90;
|
||||
|
||||
if(planeNormalDirection)
|
||||
if (planeNormalDirection)
|
||||
{
|
||||
direction = (planeNormalDirection.x + 90);
|
||||
|
||||
if(direction > 360) direction -= 360;
|
||||
if (direction > 360) direction -= 360;
|
||||
}
|
||||
|
||||
const _local_27 = ((planeLeftSide.length * planePosition.x) / leftSideLength);
|
||||
@ -442,7 +442,7 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
newEvent = new RoomObjectWallMouseEvent(eventType, this.object, event.eventId, planeLocation, planeLeftSide, planeRightSide, _local_27, _local_28, direction, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
|
||||
}
|
||||
|
||||
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(newEvent);
|
||||
if (this.eventDispatcher) this.eventDispatcher.dispatchEvent(newEvent);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { IGraphicAssetCollection, IRoomContentLoader, IRoomInstance, IRoomInstanceContainer, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectManager, IRoomObjectVisualizationFactory, NitroLogger } from '../api';
|
||||
import { NitroManager } from '../core';
|
||||
import { RoomContentLoadedEvent } from '../events';
|
||||
import { RoomContentLoader } from '../nitro/room/RoomContentLoader';
|
||||
import { RoomContentLoadedEvent } from './events';
|
||||
import { RoomInstance } from './RoomInstance';
|
||||
import { RoomObjectManager } from './RoomObjectManager';
|
||||
|
||||
@ -57,15 +57,15 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
public onInit(): void
|
||||
{
|
||||
if(this._state >= RoomManager.ROOM_MANAGER_INITIALIZING || !this._contentLoader) return;
|
||||
if (this._state >= RoomManager.ROOM_MANAGER_INITIALIZING || !this._contentLoader) return;
|
||||
|
||||
const mandatoryLibraries = RoomContentLoader.MANDATORY_LIBRARIES;
|
||||
|
||||
for(const library of mandatoryLibraries)
|
||||
for (const library of mandatoryLibraries)
|
||||
{
|
||||
if(!library) continue;
|
||||
if (!library) continue;
|
||||
|
||||
if(this._initialLoadList.indexOf(library) === -1)
|
||||
if (this._initialLoadList.indexOf(library) === -1)
|
||||
{
|
||||
this._contentLoader.downloadAsset(library, this.events);
|
||||
|
||||
@ -80,22 +80,22 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
const existing = this._rooms.get(roomId);
|
||||
|
||||
if(!existing) return null;
|
||||
if (!existing) return null;
|
||||
|
||||
return existing;
|
||||
}
|
||||
|
||||
public createRoomInstance(roomId: string): IRoomInstance
|
||||
{
|
||||
if(this._rooms.get(roomId)) return null;
|
||||
if (this._rooms.get(roomId)) return null;
|
||||
|
||||
const instance = new RoomInstance(roomId, this);
|
||||
|
||||
this._rooms.set(instance.id, instance);
|
||||
|
||||
if(this._updateCategories.length)
|
||||
if (this._updateCategories.length)
|
||||
{
|
||||
for(const category of this._updateCategories)
|
||||
for (const category of this._updateCategories)
|
||||
{
|
||||
instance.addUpdateCategory(category);
|
||||
}
|
||||
@ -108,7 +108,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
const existing = this._rooms.get(roomId);
|
||||
|
||||
if(!existing) return false;
|
||||
if (!existing) return false;
|
||||
|
||||
this._rooms.delete(roomId);
|
||||
|
||||
@ -121,7 +121,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
const instance = this.getRoomInstance(roomId);
|
||||
|
||||
if(!instance) return null;
|
||||
if (!instance) return null;
|
||||
|
||||
let visualization = type;
|
||||
let logic = type;
|
||||
@ -129,11 +129,11 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
let asset: IGraphicAssetCollection = null;
|
||||
let isLoading = false;
|
||||
|
||||
if(this._contentLoader.isLoaderType(type))
|
||||
if (this._contentLoader.isLoaderType(type))
|
||||
{
|
||||
asset = this._contentLoader.getCollection(type);
|
||||
|
||||
if(!asset)
|
||||
if (!asset)
|
||||
{
|
||||
isLoading = true;
|
||||
|
||||
@ -142,7 +142,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
assetName = this._contentLoader.getPlaceholderName(type);
|
||||
asset = this._contentLoader.getCollection(assetName);
|
||||
|
||||
if(!asset) return null;
|
||||
if (!asset) return null;
|
||||
}
|
||||
|
||||
visualization = asset.data.visualizationType;
|
||||
@ -151,13 +151,13 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
const object = (instance.createRoomObject(objectId, 1, type, category) as IRoomObjectController);
|
||||
|
||||
if(!object) return null;
|
||||
if (!object) return null;
|
||||
|
||||
if(this._visualizationFactory)
|
||||
if (this._visualizationFactory)
|
||||
{
|
||||
const visualizationInstance = this._visualizationFactory.getVisualization(visualization);
|
||||
|
||||
if(!visualizationInstance)
|
||||
if (!visualizationInstance)
|
||||
{
|
||||
instance.removeRoomObject(objectId, category);
|
||||
|
||||
@ -168,7 +168,7 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
const visualizationData = this._visualizationFactory.getVisualizationData(assetName, visualization, ((asset && asset.data) || null));
|
||||
|
||||
if(!visualizationData || !visualizationInstance.initialize(visualizationData))
|
||||
if (!visualizationData || !visualizationInstance.initialize(visualizationData))
|
||||
{
|
||||
instance.removeRoomObject(objectId, category);
|
||||
|
||||
@ -178,19 +178,19 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
object.setVisualization(visualizationInstance);
|
||||
}
|
||||
|
||||
if(this._logicFactory)
|
||||
if (this._logicFactory)
|
||||
{
|
||||
const logicInstance = this._logicFactory.getLogic(logic);
|
||||
|
||||
object.setLogic(logicInstance);
|
||||
|
||||
if(logicInstance)
|
||||
if (logicInstance)
|
||||
{
|
||||
logicInstance.initialize((asset && asset.data) || null);
|
||||
}
|
||||
}
|
||||
|
||||
if(!isLoading) object.isReady = true;
|
||||
if (!isLoading) object.isReady = true;
|
||||
|
||||
this._contentLoader.setRoomObjectRoomId(object, roomId);
|
||||
|
||||
@ -199,35 +199,35 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
private reinitializeRoomObjectsByType(type: string): void
|
||||
{
|
||||
if(!type || !this._contentLoader || !this._visualizationFactory || !this._logicFactory) return;
|
||||
if (!type || !this._contentLoader || !this._visualizationFactory || !this._logicFactory) return;
|
||||
|
||||
const asset = this._contentLoader.getCollection(type);
|
||||
|
||||
if(!asset) return;
|
||||
if (!asset) return;
|
||||
|
||||
const visualization = asset.data.visualizationType;
|
||||
const logic = asset.data.logicType;
|
||||
const visualizationData = this._visualizationFactory.getVisualizationData(type, visualization, asset.data);
|
||||
|
||||
for(const room of this._rooms.values())
|
||||
for (const room of this._rooms.values())
|
||||
{
|
||||
if(!room) continue;
|
||||
if (!room) continue;
|
||||
|
||||
for(const [category, manager] of room.managers.entries())
|
||||
for (const [category, manager] of room.managers.entries())
|
||||
{
|
||||
if(!manager) continue;
|
||||
if (!manager) continue;
|
||||
|
||||
for(const object of manager.objects.getValues())
|
||||
for (const object of manager.objects.getValues())
|
||||
{
|
||||
if(!object || object.type !== type) continue;
|
||||
if (!object || object.type !== type) continue;
|
||||
|
||||
const visualizationInstance = this._visualizationFactory.getVisualization(visualization);
|
||||
|
||||
if(visualizationInstance)
|
||||
if (visualizationInstance)
|
||||
{
|
||||
visualizationInstance.asset = asset;
|
||||
|
||||
if(!visualizationData || !visualizationInstance.initialize(visualizationData))
|
||||
if (!visualizationData || !visualizationInstance.initialize(visualizationData))
|
||||
{
|
||||
manager.removeObject(object.id);
|
||||
}
|
||||
@ -239,14 +239,14 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
object.setLogic(logicInstance);
|
||||
|
||||
if(logicInstance)
|
||||
if (logicInstance)
|
||||
{
|
||||
logicInstance.initialize(asset.data);
|
||||
}
|
||||
|
||||
object.isReady = true;
|
||||
|
||||
if(this._listener) this._listener.objectInitialized(room.id, object.id, category);
|
||||
if (this._listener) this._listener.objectInitialized(room.id, object.id, category);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -262,15 +262,15 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
const index = this._updateCategories.indexOf(category);
|
||||
|
||||
if(index >= 0) return;
|
||||
if (index >= 0) return;
|
||||
|
||||
this._updateCategories.push(category);
|
||||
|
||||
if(!this._rooms.size) return;
|
||||
if (!this._rooms.size) return;
|
||||
|
||||
for(const room of this._rooms.values())
|
||||
for (const room of this._rooms.values())
|
||||
{
|
||||
if(!room) continue;
|
||||
if (!room) continue;
|
||||
|
||||
room.addUpdateCategory(category);
|
||||
}
|
||||
@ -280,15 +280,15 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
const index = this._updateCategories.indexOf(category);
|
||||
|
||||
if(index === -1) return;
|
||||
if (index === -1) return;
|
||||
|
||||
this._updateCategories.splice(index, 1);
|
||||
|
||||
if(!this._rooms.size) return;
|
||||
if (!this._rooms.size) return;
|
||||
|
||||
for(const room of this._rooms.values())
|
||||
for (const room of this._rooms.values())
|
||||
{
|
||||
if(!room) continue;
|
||||
if (!room) continue;
|
||||
|
||||
room.removeUpdateCategory(category);
|
||||
}
|
||||
@ -296,29 +296,29 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
public setContentLoader(loader: IRoomContentLoader): void
|
||||
{
|
||||
if(this._contentLoader) this._contentLoader.dispose();
|
||||
if (this._contentLoader) this._contentLoader.dispose();
|
||||
|
||||
this._contentLoader = loader;
|
||||
}
|
||||
|
||||
private processPendingContentTypes(time: number): void
|
||||
{
|
||||
if(this._skipContentProcessing)
|
||||
if (this._skipContentProcessing)
|
||||
{
|
||||
this._skipContentProcessing = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
while(this._pendingContentTypes.length)
|
||||
while (this._pendingContentTypes.length)
|
||||
{
|
||||
const type = this._pendingContentTypes.shift();
|
||||
|
||||
const collection = this._contentLoader.getCollection(type);
|
||||
|
||||
if(!collection)
|
||||
if (!collection)
|
||||
{
|
||||
if(this._listener)
|
||||
if (this._listener)
|
||||
{
|
||||
this._listener.initalizeTemporaryObjectsByType(type, false);
|
||||
}
|
||||
@ -330,29 +330,29 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
|
||||
this.reinitializeRoomObjectsByType(type);
|
||||
|
||||
if(this._listener) this._listener.initalizeTemporaryObjectsByType(type, true);
|
||||
if (this._listener) this._listener.initalizeTemporaryObjectsByType(type, true);
|
||||
|
||||
if(this._initialLoadList.length > 0) this.removeFromInitialLoad(type);
|
||||
if (this._initialLoadList.length > 0) this.removeFromInitialLoad(type);
|
||||
}
|
||||
}
|
||||
|
||||
private removeFromInitialLoad(type: string): void
|
||||
{
|
||||
if(!type || this._state === RoomManager.ROOM_MANAGER_ERROR) return;
|
||||
if (!type || this._state === RoomManager.ROOM_MANAGER_ERROR) return;
|
||||
|
||||
if(!this._contentLoader) this._state = RoomManager.ROOM_MANAGER_ERROR;
|
||||
if (!this._contentLoader) this._state = RoomManager.ROOM_MANAGER_ERROR;
|
||||
|
||||
if(this._contentLoader.getCollection(type))
|
||||
if (this._contentLoader.getCollection(type))
|
||||
{
|
||||
const i = this._initialLoadList.indexOf(type);
|
||||
|
||||
if(i >= 0) this._initialLoadList.splice(i, 1);
|
||||
if (i >= 0) this._initialLoadList.splice(i, 1);
|
||||
|
||||
if(!this._initialLoadList.length)
|
||||
if (!this._initialLoadList.length)
|
||||
{
|
||||
this._state = RoomManager.ROOM_MANAGER_INITIALIZED;
|
||||
|
||||
if(this._listener)
|
||||
if (this._listener)
|
||||
{
|
||||
this._listener.onRoomEngineInitalized(true);
|
||||
}
|
||||
@ -362,17 +362,17 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
this._state = RoomManager.ROOM_MANAGER_ERROR;
|
||||
|
||||
if(this._listener) this._listener.onRoomEngineInitalized(false);
|
||||
if (this._listener) this._listener.onRoomEngineInitalized(false);
|
||||
}
|
||||
}
|
||||
|
||||
private onRoomContentLoadedEvent(event: RoomContentLoadedEvent): void
|
||||
{
|
||||
if(!this._contentLoader) return;
|
||||
if (!this._contentLoader) return;
|
||||
|
||||
const contentType = event.contentType;
|
||||
|
||||
if(this._pendingContentTypes.indexOf(contentType) >= 0) return;
|
||||
if (this._pendingContentTypes.indexOf(contentType) >= 0) return;
|
||||
|
||||
this._pendingContentTypes.push(contentType);
|
||||
}
|
||||
@ -381,9 +381,9 @@ export class RoomManager extends NitroManager implements IRoomManager, IRoomInst
|
||||
{
|
||||
this.processPendingContentTypes(time);
|
||||
|
||||
if(!this._rooms.size) return;
|
||||
if (!this._rooms.size) return;
|
||||
|
||||
for(const room of this._rooms.values()) room && room.update(time, update);
|
||||
for (const room of this._rooms.values()) room && room.update(time, update);
|
||||
}
|
||||
|
||||
public createRoomObjectManager(category: number): IRoomObjectManager
|
||||
|
@ -1,5 +0,0 @@
|
||||
export * from './RoomContentLoadedEvent';
|
||||
export * from './RoomObjectEvent';
|
||||
export * from './RoomObjectMouseEvent';
|
||||
export * from './RoomSpriteMouseEvent';
|
||||
export * from './RoomToObjectEvent';
|
@ -1,4 +1,3 @@
|
||||
export * from './events';
|
||||
export * from './messages';
|
||||
export * from './object';
|
||||
export * from './object/logic';
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { IEventDispatcher, IRoomGeometry, IRoomObjectController, IRoomObjectEventHandler, IRoomObjectUpdateMessage } from '../../../api';
|
||||
import { Disposable } from '../../../core';
|
||||
import { RoomSpriteMouseEvent } from '../../events';
|
||||
import { RoomSpriteMouseEvent } from '../../../events';
|
||||
|
||||
export class RoomObjectLogicBase extends Disposable implements IRoomObjectEventHandler
|
||||
{
|
||||
@ -38,7 +38,7 @@ export class RoomObjectLogicBase extends Disposable implements IRoomObjectEventH
|
||||
|
||||
public processUpdateMessage(message: IRoomObjectUpdateMessage): void
|
||||
{
|
||||
if(!message || !this._object) return;
|
||||
if (!message || !this._object) return;
|
||||
|
||||
this._object.setLocation(message.location);
|
||||
this._object.setDirection(message.direction);
|
||||
@ -53,9 +53,9 @@ export class RoomObjectLogicBase extends Disposable implements IRoomObjectEventH
|
||||
{
|
||||
const types = k.concat();
|
||||
|
||||
for(const type of _arg_2)
|
||||
for (const type of _arg_2)
|
||||
{
|
||||
if(!type || (types.indexOf(type) >= 0)) continue;
|
||||
if (!type || (types.indexOf(type) >= 0)) continue;
|
||||
|
||||
types.push(type);
|
||||
}
|
||||
@ -75,14 +75,14 @@ export class RoomObjectLogicBase extends Disposable implements IRoomObjectEventH
|
||||
|
||||
public setObject(object: IRoomObjectController): void
|
||||
{
|
||||
if(this._object === object) return;
|
||||
if (this._object === object) return;
|
||||
|
||||
if(this._object)
|
||||
if (this._object)
|
||||
{
|
||||
this._object.setLogic(null);
|
||||
}
|
||||
|
||||
if(!object)
|
||||
if (!object)
|
||||
{
|
||||
this.dispose();
|
||||
|
||||
|
@ -4,9 +4,9 @@ import { Graphics } from '@pixi/graphics';
|
||||
import { Matrix, Point, Rectangle } from '@pixi/math';
|
||||
import { Sprite } from '@pixi/sprite';
|
||||
import { IRoomCanvasMouseListener, IRoomGeometry, IRoomObject, IRoomObjectSprite, IRoomObjectSpriteVisualization, IRoomRenderingCanvas, IRoomSpriteCanvasContainer, IRoomSpriteMouseEvent, MouseEventType, RoomObjectSpriteData, RoomObjectSpriteType, Vector3d } from '../../api';
|
||||
import { RoomSpriteMouseEvent } from '../../events';
|
||||
import { Nitro } from '../../nitro/Nitro';
|
||||
import { GetTickerTime, NitroContainer, NitroSprite, PixiApplicationProxy } from '../../pixi-proxy';
|
||||
import { RoomSpriteMouseEvent } from '../events';
|
||||
import { GetTicker, NitroContainer, NitroSprite, PixiApplicationProxy } from '../../pixi-proxy';
|
||||
import { RoomEnterEffect, RoomGeometry, RoomRotatingEffect, RoomShakingEffect } from '../utils';
|
||||
import { RoomObjectCache, RoomObjectCacheItem } from './cache';
|
||||
import { ExtendedSprite, ObjectMouseData, SortableSprite } from './utils';
|
||||
@ -121,14 +121,14 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private setupCanvas(): void
|
||||
{
|
||||
if(!this._master)
|
||||
if (!this._master)
|
||||
{
|
||||
this._master = new NitroSprite();
|
||||
|
||||
this._master.interactiveChildren = false;
|
||||
}
|
||||
|
||||
if(!this._display)
|
||||
if (!this._display)
|
||||
{
|
||||
const display = new NitroContainer();
|
||||
|
||||
@ -142,32 +142,32 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
this.cleanSprites(0, true);
|
||||
|
||||
if(this._geometry)
|
||||
if (this._geometry)
|
||||
{
|
||||
this._geometry.dispose();
|
||||
|
||||
this._geometry = null;
|
||||
}
|
||||
|
||||
if(this._mask) this._mask = null;
|
||||
if (this._mask) this._mask = null;
|
||||
|
||||
if(this._objectCache)
|
||||
if (this._objectCache)
|
||||
{
|
||||
this._objectCache.dispose();
|
||||
|
||||
this._objectCache = null;
|
||||
}
|
||||
|
||||
if(this._master)
|
||||
if (this._master)
|
||||
{
|
||||
while(this._master.children.length)
|
||||
while (this._master.children.length)
|
||||
{
|
||||
const child = this._master.removeChildAt(0);
|
||||
|
||||
child.destroy();
|
||||
}
|
||||
|
||||
if(this._master.parent) this._master.parent.removeChild(this._master);
|
||||
if (this._master.parent) this._master.parent.removeChild(this._master);
|
||||
|
||||
this._master.destroy();
|
||||
|
||||
@ -177,16 +177,16 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._display = null;
|
||||
this._sortableSprites = [];
|
||||
|
||||
if(this._mouseActiveObjects)
|
||||
if (this._mouseActiveObjects)
|
||||
{
|
||||
this._mouseActiveObjects.clear();
|
||||
|
||||
this._mouseActiveObjects = null;
|
||||
}
|
||||
|
||||
if(this._spritePool)
|
||||
if (this._spritePool)
|
||||
{
|
||||
for(const sprite of this._spritePool)
|
||||
for (const sprite of this._spritePool)
|
||||
{
|
||||
this.cleanSprite(sprite, true);
|
||||
}
|
||||
@ -194,7 +194,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._spritePool = [];
|
||||
}
|
||||
|
||||
if(this._eventCache)
|
||||
if (this._eventCache)
|
||||
{
|
||||
this._eventCache.clear();
|
||||
|
||||
@ -209,20 +209,20 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
width = width < 1 ? 1 : width;
|
||||
height = height < 1 ? 1 : height;
|
||||
|
||||
if(this._usesMask)
|
||||
if (this._usesMask)
|
||||
{
|
||||
if(!this._mask)
|
||||
if (!this._mask)
|
||||
{
|
||||
this._mask = new Graphics()
|
||||
.beginFill(0xFF0000)
|
||||
.drawRect(0, 0, width, height)
|
||||
.endFill();
|
||||
|
||||
if(this._master)
|
||||
if (this._master)
|
||||
{
|
||||
this._master.addChild(this._mask);
|
||||
|
||||
if(this._display) this._display.mask = this._mask;
|
||||
if (this._display) this._display.mask = this._mask;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -235,9 +235,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
}
|
||||
}
|
||||
|
||||
if(this._master)
|
||||
if (this._master)
|
||||
{
|
||||
if(this._master.hitArea)
|
||||
if (this._master.hitArea)
|
||||
{
|
||||
const hitArea = (this._master.hitArea as Rectangle);
|
||||
|
||||
@ -249,7 +249,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._master.hitArea = new Rectangle(0, 0, width, height);
|
||||
}
|
||||
|
||||
if(this._master.filterArea)
|
||||
if (this._master.filterArea)
|
||||
{
|
||||
const filterArea = this._master.filterArea;
|
||||
|
||||
@ -268,11 +268,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public setMask(flag: boolean): void
|
||||
{
|
||||
if(flag && !this._usesMask)
|
||||
if (flag && !this._usesMask)
|
||||
{
|
||||
this._usesMask = true;
|
||||
|
||||
if(this._mask && (this._mask.parent !== this._master))
|
||||
if (this._mask && (this._mask.parent !== this._master))
|
||||
{
|
||||
this._master.addChild(this._mask);
|
||||
|
||||
@ -280,11 +280,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
}
|
||||
}
|
||||
|
||||
else if(!flag && this._usesMask)
|
||||
else if (!flag && this._usesMask)
|
||||
{
|
||||
this._usesMask = false;
|
||||
|
||||
if(this._mask && (this._mask.parent === this._master))
|
||||
if (this._mask && (this._mask.parent === this._master))
|
||||
{
|
||||
this._master.removeChild(this._mask);
|
||||
|
||||
@ -295,17 +295,17 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public setScale(scale: number, point: Point = null, offsetPoint: Point = null, override: boolean = false, asDelta: boolean = false): void
|
||||
{
|
||||
if(!this._master || !this._display) return;
|
||||
if (!this._master || !this._display) return;
|
||||
|
||||
if(this._restrictsScaling && !override) return;
|
||||
if (this._restrictsScaling && !override) return;
|
||||
|
||||
if(!point) point = new Point((this._width / 2), (this._height / 2));
|
||||
if (!point) point = new Point((this._width / 2), (this._height / 2));
|
||||
|
||||
if(!offsetPoint) offsetPoint = point;
|
||||
if (!offsetPoint) offsetPoint = point;
|
||||
|
||||
point = this._display.toLocal(point);
|
||||
|
||||
if(asDelta)
|
||||
if (asDelta)
|
||||
{
|
||||
this._scale *= scale;
|
||||
}
|
||||
@ -322,24 +322,24 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
this._canvasUpdated = false;
|
||||
|
||||
this._totalTimeRunning = GetTickerTime();
|
||||
this._totalTimeRunning += GetTicker().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.position.set(this._screenOffsetX, this._screenOffsetY);
|
||||
|
||||
update = true;
|
||||
}
|
||||
|
||||
if(this._display.scale.x !== this._scale)
|
||||
if (this._display.scale.x !== this._scale)
|
||||
{
|
||||
this._display.scale.set(this._scale);
|
||||
|
||||
@ -352,7 +352,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
let updateVisuals = false;
|
||||
|
||||
if(frame !== this._lastFrame)
|
||||
if (frame !== this._lastFrame)
|
||||
{
|
||||
this._lastFrame = frame;
|
||||
|
||||
@ -363,11 +363,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
const objects = this._container.objects;
|
||||
|
||||
if(objects.size)
|
||||
if (objects.size)
|
||||
{
|
||||
for(const object of objects.values())
|
||||
for (const object of objects.values())
|
||||
{
|
||||
if(!object) continue;
|
||||
if (!object) continue;
|
||||
|
||||
spriteCount = (spriteCount + this.renderObject(object, object.instanceId.toString(), time, update, updateVisuals, spriteCount));
|
||||
}
|
||||
@ -375,22 +375,22 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
this._sortableSprites.sort((a, b) => (b.z - a.z));
|
||||
|
||||
if(spriteCount < this._sortableSprites.length) this._sortableSprites.splice(spriteCount);
|
||||
if (spriteCount < this._sortableSprites.length) this._sortableSprites.splice(spriteCount);
|
||||
|
||||
let iterator = 0;
|
||||
|
||||
while(iterator < spriteCount)
|
||||
while (iterator < spriteCount)
|
||||
{
|
||||
const sprite = this._sortableSprites[iterator];
|
||||
|
||||
if(sprite && sprite.sprite) this.renderSprite(iterator, sprite);
|
||||
if (sprite && sprite.sprite) this.renderSprite(iterator, sprite);
|
||||
|
||||
iterator++;
|
||||
}
|
||||
|
||||
this.cleanSprites(spriteCount);
|
||||
|
||||
if(update || updateVisuals) this._canvasUpdated = true;
|
||||
if (update || updateVisuals) this._canvasUpdated = true;
|
||||
|
||||
this._renderTimestamp = this._totalTimeRunning;
|
||||
this._renderedWidth = this._width;
|
||||
@ -426,11 +426,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private renderObject(object: IRoomObject, identifier: string, time: number, update: boolean, updateVisuals: boolean, count: number): number
|
||||
{
|
||||
if(!object) return 0;
|
||||
if (!object) return 0;
|
||||
|
||||
const visualization = object.visualization as IRoomObjectSpriteVisualization;
|
||||
|
||||
if(!visualization)
|
||||
if (!visualization)
|
||||
{
|
||||
this.removeFromCache(identifier);
|
||||
|
||||
@ -445,18 +445,18 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
const vector = locationCache.updateLocation(object, this._geometry);
|
||||
|
||||
if(!vector)
|
||||
if (!vector)
|
||||
{
|
||||
this.removeFromCache(identifier);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(updateVisuals) visualization.update(this._geometry, time, (!sortableCache.isEmpty || update), (this._skipObjectUpdate && this._runningSlow));
|
||||
if (updateVisuals) visualization.update(this._geometry, time, (!sortableCache.isEmpty || update), (this._skipObjectUpdate && this._runningSlow));
|
||||
|
||||
if(locationCache.locationChanged) update = true;
|
||||
if (locationCache.locationChanged) update = true;
|
||||
|
||||
if(!sortableCache.needsUpdate(visualization.instanceId, visualization.updateSpriteCounter) && !update)
|
||||
if (!sortableCache.needsUpdate(visualization.instanceId, visualization.updateSpriteCounter) && !update)
|
||||
{
|
||||
return sortableCache.spriteCount;
|
||||
}
|
||||
@ -465,7 +465,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
let y = vector.y;
|
||||
let z = vector.z;
|
||||
|
||||
if(x > 0) z = (z + (x * 1.2E-7));
|
||||
if (x > 0) z = (z + (x * 1.2E-7));
|
||||
else z = (z + (-(x) * 1.2E-7));
|
||||
|
||||
x = (x + Math.trunc(this._width / 2));
|
||||
@ -473,40 +473,40 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
let spriteCount = 0;
|
||||
|
||||
for(const sprite of visualization.sprites.values())
|
||||
for (const sprite of visualization.sprites.values())
|
||||
{
|
||||
if(!sprite || !sprite.visible) continue;
|
||||
if (!sprite || !sprite.visible) continue;
|
||||
|
||||
const texture = sprite.texture;
|
||||
const baseTexture = texture && texture.baseTexture;
|
||||
|
||||
if(!texture || !baseTexture) continue;
|
||||
if (!texture || !baseTexture) continue;
|
||||
|
||||
const spriteX = ((x + sprite.offsetX) + this._screenOffsetX);
|
||||
const spriteY = ((y + sprite.offsetY) + this._screenOffsetY);
|
||||
|
||||
if(sprite.flipH)
|
||||
if (sprite.flipH)
|
||||
{
|
||||
const checkX = ((x + (-(texture.width + (-(sprite.offsetX))))) + this._screenOffsetX);
|
||||
|
||||
if(!this.isSpriteVisible(checkX, spriteY, texture.width, texture.height)) continue;
|
||||
if (!this.isSpriteVisible(checkX, spriteY, texture.width, texture.height)) continue;
|
||||
}
|
||||
|
||||
else if(sprite.flipV)
|
||||
else if (sprite.flipV)
|
||||
{
|
||||
const checkY = ((y + (-(texture.height + (-(sprite.offsetY))))) + this._screenOffsetY);
|
||||
|
||||
if(!this.isSpriteVisible(spriteX, checkY, texture.width, texture.height)) continue;
|
||||
if (!this.isSpriteVisible(spriteX, checkY, texture.width, texture.height)) continue;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if(!this.isSpriteVisible(spriteX, spriteY, texture.width, texture.height)) continue;
|
||||
if (!this.isSpriteVisible(spriteX, spriteY, texture.width, texture.height)) continue;
|
||||
}
|
||||
|
||||
let sortableSprite = sortableCache.getSprite(spriteCount);
|
||||
|
||||
if(!sortableSprite)
|
||||
if (!sortableSprite)
|
||||
{
|
||||
sortableSprite = new SortableSprite();
|
||||
|
||||
@ -519,7 +519,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
sortableSprite.sprite = sprite;
|
||||
|
||||
if((sprite.spriteType === RoomObjectSpriteType.AVATAR) || (sprite.spriteType === RoomObjectSpriteType.AVATAR_OWN))
|
||||
if ((sprite.spriteType === RoomObjectSpriteType.AVATAR) || (sprite.spriteType === RoomObjectSpriteType.AVATAR_OWN))
|
||||
{
|
||||
sortableSprite.sprite.libraryAssetName = 'avatar_' + object.id;
|
||||
}
|
||||
@ -541,41 +541,41 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private getExtendedSprite(index: number): ExtendedSprite
|
||||
{
|
||||
if((index < 0) || (index >= this._spriteCount)) return null;
|
||||
if ((index < 0) || (index >= this._spriteCount)) return null;
|
||||
|
||||
const sprite = (this._display.getChildAt(index) as ExtendedSprite);
|
||||
|
||||
if(!sprite) return null;
|
||||
if (!sprite) return null;
|
||||
|
||||
return sprite;
|
||||
}
|
||||
|
||||
protected getExtendedSpriteIdentifier(sprite: ExtendedSprite): string
|
||||
{
|
||||
if(!sprite) return '';
|
||||
if (!sprite) return '';
|
||||
|
||||
return sprite.name;
|
||||
}
|
||||
|
||||
private renderSprite(index: number, sprite: SortableSprite): boolean
|
||||
{
|
||||
if(index >= this._spriteCount)
|
||||
if (index >= this._spriteCount)
|
||||
{
|
||||
this.createAndAddSprite(sprite);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if(!sprite) return false;
|
||||
if (!sprite) return false;
|
||||
|
||||
const objectSprite = sprite.sprite;
|
||||
const extendedSprite = this.getExtendedSprite(index);
|
||||
|
||||
if(!objectSprite || !extendedSprite) return false;
|
||||
if (!objectSprite || !extendedSprite) return false;
|
||||
|
||||
if(extendedSprite.varyingDepth !== objectSprite.varyingDepth)
|
||||
if (extendedSprite.varyingDepth !== objectSprite.varyingDepth)
|
||||
{
|
||||
if(extendedSprite.varyingDepth && !objectSprite.varyingDepth)
|
||||
if (extendedSprite.varyingDepth && !objectSprite.varyingDepth)
|
||||
{
|
||||
this._display.removeChildAt(index);
|
||||
|
||||
@ -589,7 +589,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
return true;
|
||||
}
|
||||
|
||||
if(extendedSprite.needsUpdate(objectSprite.id, objectSprite.updateCounter) || RoomEnterEffect.isVisualizationOn())
|
||||
if (extendedSprite.needsUpdate(objectSprite.id, objectSprite.updateCounter) || RoomEnterEffect.isVisualizationOn())
|
||||
{
|
||||
extendedSprite.tag = objectSprite.tag;
|
||||
extendedSprite.alphaTolerance = objectSprite.alphaTolerance;
|
||||
@ -600,48 +600,48 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
const alpha = (objectSprite.alpha / 255);
|
||||
|
||||
if(extendedSprite.alpha !== alpha) extendedSprite.alpha = alpha;
|
||||
if (extendedSprite.alpha !== alpha) extendedSprite.alpha = alpha;
|
||||
|
||||
if(extendedSprite.tint !== objectSprite.color) extendedSprite.tint = objectSprite.color;
|
||||
if (extendedSprite.tint !== objectSprite.color) extendedSprite.tint = objectSprite.color;
|
||||
|
||||
if(extendedSprite.blendMode !== objectSprite.blendMode) extendedSprite.blendMode = objectSprite.blendMode;
|
||||
if (extendedSprite.blendMode !== objectSprite.blendMode) extendedSprite.blendMode = objectSprite.blendMode;
|
||||
|
||||
if(extendedSprite.texture !== objectSprite.texture) extendedSprite.setTexture(objectSprite.texture);
|
||||
if (extendedSprite.texture !== objectSprite.texture) extendedSprite.setTexture(objectSprite.texture);
|
||||
|
||||
if(objectSprite.updateContainer)
|
||||
if (objectSprite.updateContainer)
|
||||
{
|
||||
const length = extendedSprite.children.length;
|
||||
|
||||
if(length === 1) extendedSprite.removeChildAt(0);
|
||||
if (length === 1) extendedSprite.removeChildAt(0);
|
||||
|
||||
extendedSprite.addChild(objectSprite.container);
|
||||
|
||||
objectSprite.updateContainer = false;
|
||||
}
|
||||
|
||||
if(objectSprite.flipH)
|
||||
if (objectSprite.flipH)
|
||||
{
|
||||
if(extendedSprite.scale.x !== -1) extendedSprite.scale.x = -1;
|
||||
if (extendedSprite.scale.x !== -1) extendedSprite.scale.x = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(extendedSprite.scale.x !== 1) extendedSprite.scale.x = 1;
|
||||
if (extendedSprite.scale.x !== 1) extendedSprite.scale.x = 1;
|
||||
}
|
||||
|
||||
if(objectSprite.flipV)
|
||||
if (objectSprite.flipV)
|
||||
{
|
||||
if(extendedSprite.scale.y !== -1) extendedSprite.scale.y = -1;
|
||||
if (extendedSprite.scale.y !== -1) extendedSprite.scale.y = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(extendedSprite.scale.y !== 1) extendedSprite.scale.y = 1;
|
||||
if (extendedSprite.scale.y !== 1) extendedSprite.scale.y = 1;
|
||||
}
|
||||
|
||||
this.updateEnterRoomEffect(extendedSprite, objectSprite);
|
||||
}
|
||||
|
||||
if(extendedSprite.x !== sprite.x) extendedSprite.x = sprite.x;
|
||||
if(extendedSprite.y !== sprite.y) extendedSprite.y = sprite.y;
|
||||
if (extendedSprite.x !== sprite.x) extendedSprite.x = sprite.x;
|
||||
if (extendedSprite.y !== sprite.y) extendedSprite.y = sprite.y;
|
||||
|
||||
extendedSprite.offsetX = objectSprite.offsetX;
|
||||
extendedSprite.offsetY = objectSprite.offsetY;
|
||||
@ -653,15 +653,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
const sprite = sortableSprite.sprite;
|
||||
|
||||
if(!sprite) return;
|
||||
if (!sprite) return;
|
||||
|
||||
let extendedSprite: ExtendedSprite = null;
|
||||
|
||||
if(this._spritePool.length > 0) extendedSprite = this._spritePool.pop();
|
||||
if (this._spritePool.length > 0) extendedSprite = this._spritePool.pop();
|
||||
|
||||
if(!extendedSprite) extendedSprite = new ExtendedSprite();
|
||||
if (!extendedSprite) extendedSprite = new ExtendedSprite();
|
||||
|
||||
if(extendedSprite.children.length) extendedSprite.removeChildren();
|
||||
if (extendedSprite.children.length) extendedSprite.removeChildren();
|
||||
|
||||
extendedSprite.tag = sprite.tag;
|
||||
extendedSprite.alphaTolerance = sprite.alphaTolerance;
|
||||
@ -679,20 +679,20 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
extendedSprite.setTexture(sprite.texture);
|
||||
|
||||
if(sprite.updateContainer)
|
||||
if (sprite.updateContainer)
|
||||
{
|
||||
extendedSprite.addChild(sprite.container);
|
||||
|
||||
sprite.updateContainer = false;
|
||||
}
|
||||
|
||||
if(sprite.flipH) extendedSprite.scale.x = -1;
|
||||
if (sprite.flipH) extendedSprite.scale.x = -1;
|
||||
|
||||
if(sprite.flipV) extendedSprite.scale.y = -1;
|
||||
if (sprite.flipV) extendedSprite.scale.y = -1;
|
||||
|
||||
this.updateEnterRoomEffect(extendedSprite, sprite);
|
||||
|
||||
if((index < 0) || (index >= this._spriteCount))
|
||||
if ((index < 0) || (index >= this._spriteCount))
|
||||
{
|
||||
this._display.addChild(extendedSprite);
|
||||
|
||||
@ -708,15 +708,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private cleanSprites(spriteCount: number, _arg_2: boolean = false): void
|
||||
{
|
||||
if(!this._display) return;
|
||||
if (!this._display) return;
|
||||
|
||||
if(spriteCount < 0) spriteCount = 0;
|
||||
if (spriteCount < 0) spriteCount = 0;
|
||||
|
||||
if((spriteCount < this._activeSpriteCount) || !this._activeSpriteCount)
|
||||
if ((spriteCount < this._activeSpriteCount) || !this._activeSpriteCount)
|
||||
{
|
||||
let iterator = (this._spriteCount - 1);
|
||||
|
||||
while(iterator >= spriteCount)
|
||||
while (iterator >= spriteCount)
|
||||
{
|
||||
this.cleanSprite(this.getExtendedSprite(iterator), _arg_2);
|
||||
|
||||
@ -729,9 +729,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private updateEnterRoomEffect(sprite: ExtendedSprite, _arg_2: IRoomObjectSprite): void
|
||||
{
|
||||
if(!RoomEnterEffect.isVisualizationOn() || !_arg_2) return;
|
||||
if (!RoomEnterEffect.isVisualizationOn() || !_arg_2) return;
|
||||
|
||||
switch(_arg_2.spriteType)
|
||||
switch (_arg_2.spriteType)
|
||||
{
|
||||
case RoomObjectSpriteType.AVATAR_OWN:
|
||||
return;
|
||||
@ -748,15 +748,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private cleanSprite(sprite: ExtendedSprite, _arg_2: boolean): void
|
||||
{
|
||||
if(!sprite) return;
|
||||
if (!sprite) return;
|
||||
|
||||
if(!_arg_2)
|
||||
if (!_arg_2)
|
||||
{
|
||||
sprite.setTexture(null);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(sprite.parent) sprite.parent.removeChild(sprite);
|
||||
if (sprite.parent) sprite.parent.removeChild(sprite);
|
||||
|
||||
sprite.destroy({
|
||||
children: true
|
||||
@ -766,7 +766,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public update(): void
|
||||
{
|
||||
if(!this._mouseCheckCount)
|
||||
if (!this._mouseCheckCount)
|
||||
{
|
||||
//this.checkMouseHits(this._mouseLocation.x, this._mouseLocation.y, MouseEventType.MOUSE_MOVE);
|
||||
}
|
||||
@ -788,16 +788,16 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private isSpriteVisible(x: number, y: number, width: number, height: number): boolean
|
||||
{
|
||||
if(this._noSpriteVisibilityChecking) return true;
|
||||
if (this._noSpriteVisibilityChecking) return true;
|
||||
|
||||
x = (((x - this._screenOffsetX) * this._scale) + this._screenOffsetX);
|
||||
y = (((y - this._screenOffsetY) * this._scale) + this._screenOffsetY);
|
||||
width = (width * this._scale);
|
||||
height = (height * this._scale);
|
||||
|
||||
if(((x < this._width) && ((x + width) >= 0)) && ((y < this._height) && ((y + height) >= 0)))
|
||||
if (((x < this._width) && ((x + width) >= 0)) && ((y < this._height) && ((y + height) >= 0)))
|
||||
{
|
||||
if(!this._usesExclusionRectangles) return true;
|
||||
if (!this._usesExclusionRectangles) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -811,7 +811,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._mouseLocation.x = (x / this._scale);
|
||||
this._mouseLocation.y = (y / this._scale);
|
||||
|
||||
if((this._mouseCheckCount > 0) && (type == MouseEventType.MOUSE_MOVE)) return this._mouseSpriteWasHit;
|
||||
if ((this._mouseCheckCount > 0) && (type == MouseEventType.MOUSE_MOVE)) return this._mouseSpriteWasHit;
|
||||
|
||||
this._mouseSpriteWasHit = this.checkMouseHits(Math.trunc(x / this._scale), Math.trunc(y / this._scale), type, altKey, ctrlKey, shiftKey, buttonDown);
|
||||
|
||||
@ -828,13 +828,13 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
let mouseEvent: IRoomSpriteMouseEvent = null;
|
||||
let spriteId = (this._activeSpriteCount - 1);
|
||||
|
||||
while(spriteId >= 0)
|
||||
while (spriteId >= 0)
|
||||
{
|
||||
const extendedSprite = this.getExtendedSprite(spriteId);
|
||||
|
||||
if(extendedSprite && extendedSprite.containsPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y))))
|
||||
if (extendedSprite && extendedSprite.containsPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y))))
|
||||
{
|
||||
if(extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK)))
|
||||
if (extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK)))
|
||||
{
|
||||
//
|
||||
}
|
||||
@ -842,15 +842,15 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
const identifier = this.getExtendedSpriteIdentifier(extendedSprite);
|
||||
|
||||
if(checkedSprites.indexOf(identifier) === -1)
|
||||
if (checkedSprites.indexOf(identifier) === -1)
|
||||
{
|
||||
const tag = extendedSprite.tag;
|
||||
|
||||
let mouseData = this._mouseActiveObjects.get(identifier);
|
||||
|
||||
if(mouseData)
|
||||
if (mouseData)
|
||||
{
|
||||
if(mouseData.spriteTag !== tag)
|
||||
if (mouseData.spriteTag !== tag)
|
||||
{
|
||||
mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, mouseData.spriteTag, altKey, ctrlKey, shiftKey, buttonDown);
|
||||
|
||||
@ -858,7 +858,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);
|
||||
}
|
||||
@ -870,7 +870,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
mouseEvent.spriteOffsetY = extendedSprite.offsetY;
|
||||
}
|
||||
|
||||
if(!mouseData)
|
||||
if (!mouseData)
|
||||
{
|
||||
mouseData = new ObjectMouseData();
|
||||
|
||||
@ -880,7 +880,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
mouseData.spriteTag = tag;
|
||||
|
||||
if(((type !== MouseEventType.MOUSE_MOVE) || (x !== this._mouseOldX)) || (y !== this._mouseOldY))
|
||||
if (((type !== MouseEventType.MOUSE_MOVE) || (x !== this._mouseOldX)) || (y !== this._mouseOldY))
|
||||
{
|
||||
this.bufferMouseEvent(mouseEvent, identifier);
|
||||
}
|
||||
@ -897,30 +897,30 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
const keys: string[] = [];
|
||||
|
||||
for(const key of this._mouseActiveObjects.keys()) key && keys.push(key);
|
||||
for (const key of this._mouseActiveObjects.keys()) key && keys.push(key);
|
||||
|
||||
let index = 0;
|
||||
|
||||
while(index < keys.length)
|
||||
while (index < keys.length)
|
||||
{
|
||||
const key = keys[index];
|
||||
|
||||
if(checkedSprites.indexOf(key) >= 0) keys[index] = null;
|
||||
if (checkedSprites.indexOf(key) >= 0) keys[index] = null;
|
||||
|
||||
index++;
|
||||
}
|
||||
|
||||
index = 0;
|
||||
|
||||
while(index < keys.length)
|
||||
while (index < keys.length)
|
||||
{
|
||||
const key = keys[index];
|
||||
|
||||
if(key !== null)
|
||||
if (key !== null)
|
||||
{
|
||||
const existing = this._mouseActiveObjects.get(key);
|
||||
|
||||
if(existing) this._mouseActiveObjects.delete(key);
|
||||
if (existing) this._mouseActiveObjects.delete(key);
|
||||
|
||||
const mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, existing.spriteTag, altKey, ctrlKey, shiftKey, buttonDown);
|
||||
|
||||
@ -948,7 +948,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
protected bufferMouseEvent(k: IRoomSpriteMouseEvent, _arg_2: string): void
|
||||
{
|
||||
if(!k || !this._eventCache) return;
|
||||
if (!k || !this._eventCache) return;
|
||||
|
||||
this._eventCache.delete(_arg_2);
|
||||
this._eventCache.set(_arg_2, k);
|
||||
@ -956,19 +956,19 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
protected processMouseEvents(): void
|
||||
{
|
||||
if(!this._container || !this._eventCache) return;
|
||||
if (!this._container || !this._eventCache) return;
|
||||
|
||||
for(const [key, event] of this._eventCache.entries())
|
||||
for (const [key, event] of this._eventCache.entries())
|
||||
{
|
||||
if(!this._eventCache) return;
|
||||
if (!this._eventCache) return;
|
||||
|
||||
if(!event) continue;
|
||||
if (!event) continue;
|
||||
|
||||
const roomObject = this._container.getRoomObject(parseInt(key));
|
||||
|
||||
if(!roomObject) continue;
|
||||
if (!roomObject) continue;
|
||||
|
||||
if(this._mouseListener)
|
||||
if (this._mouseListener)
|
||||
{
|
||||
this._mouseListener.processRoomCanvasMouseEvent(event, roomObject, this._geometry);
|
||||
}
|
||||
@ -976,14 +976,14 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
const logic = roomObject.mouseHandler;
|
||||
|
||||
if(logic)
|
||||
if (logic)
|
||||
{
|
||||
logic.mouseEvent(event, this._geometry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this._eventCache) this._eventCache.clear();
|
||||
if (this._eventCache) this._eventCache.clear();
|
||||
}
|
||||
|
||||
public getDisplayAsTexture(): RenderTexture
|
||||
@ -1026,7 +1026,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
const geometry = (this.geometry as RoomGeometry);
|
||||
|
||||
if(this._rotation !== 0)
|
||||
if (this._rotation !== 0)
|
||||
{
|
||||
let direction = this._effectDirection;
|
||||
|
||||
@ -1052,18 +1052,18 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._effectDirection.assign(geometry.direction);
|
||||
}
|
||||
|
||||
if(RoomShakingEffect.isVisualizationOn() && !this._SafeStr_4507)
|
||||
if (RoomShakingEffect.isVisualizationOn() && !this._SafeStr_4507)
|
||||
{
|
||||
this.changeShaking();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!RoomShakingEffect.isVisualizationOn() && this._SafeStr_4507) this.changeShaking();
|
||||
if (!RoomShakingEffect.isVisualizationOn() && this._SafeStr_4507) this.changeShaking();
|
||||
}
|
||||
|
||||
if(RoomRotatingEffect.isVisualizationOn()) this.changeRotation();
|
||||
if (RoomRotatingEffect.isVisualizationOn()) this.changeRotation();
|
||||
|
||||
if(this._SafeStr_4507)
|
||||
if (this._SafeStr_4507)
|
||||
{
|
||||
this._SafeStr_795++;
|
||||
|
||||
@ -1084,7 +1084,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
this._SafeStr_4507 = !this._SafeStr_4507;
|
||||
|
||||
if(this._SafeStr_4507)
|
||||
if (this._SafeStr_4507)
|
||||
{
|
||||
const direction = this.geometry.direction;
|
||||
|
||||
@ -1094,13 +1094,13 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
private changeRotation(): void
|
||||
{
|
||||
if(this._SafeStr_4507) return;
|
||||
if (this._SafeStr_4507) return;
|
||||
|
||||
const geometry = (this.geometry as RoomGeometry);
|
||||
|
||||
if(!geometry) return;
|
||||
if (!geometry) return;
|
||||
|
||||
if(this._rotation === 0)
|
||||
if (this._rotation === 0)
|
||||
{
|
||||
const location = geometry.location;
|
||||
const directionAxis = geometry.directionAxis;
|
||||
@ -1112,7 +1112,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
const intersection = RoomGeometry.getIntersectionVector(location, directionAxis, new Vector3d(0, 0, 0), new Vector3d(0, 0, 1));
|
||||
|
||||
if(intersection !== null)
|
||||
if (intersection !== null)
|
||||
{
|
||||
this._rotationOrigin = new Vector3d(intersection.x, intersection.y, intersection.z);
|
||||
this._rotationRodLength = Vector3d.dif(intersection, location).length;
|
||||
@ -1131,9 +1131,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public moveLeft(): void
|
||||
{
|
||||
if(this._rotation !== 0)
|
||||
if (this._rotation !== 0)
|
||||
{
|
||||
if(this._rotation === 1)
|
||||
if (this._rotation === 1)
|
||||
{
|
||||
this._rotation = -1;
|
||||
}
|
||||
@ -1153,9 +1153,9 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public moveRight(): void
|
||||
{
|
||||
if(this._rotation !== 0)
|
||||
if (this._rotation !== 0)
|
||||
{
|
||||
if(this._rotation === -1)
|
||||
if (this._rotation === -1)
|
||||
{
|
||||
this._rotation = 1;
|
||||
}
|
||||
@ -1175,7 +1175,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public moveUp(): void
|
||||
{
|
||||
if(this._rotation !== 0) return;
|
||||
if (this._rotation !== 0) return;
|
||||
|
||||
const geometry = (this.geometry as RoomGeometry);
|
||||
const direction = ((geometry.direction.x / 180) * 3.14159265358979);
|
||||
@ -1185,7 +1185,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
|
||||
public moveDown(): void
|
||||
{
|
||||
if(this._rotation !== 0) return;
|
||||
if (this._rotation !== 0) return;
|
||||
|
||||
const geometry = (this.geometry as RoomGeometry);
|
||||
const direction = (((geometry.direction.x + 180) / 180) * 3.14159265358979);
|
||||
|
Loading…
Reference in New Issue
Block a user