Merge branch 'main' into avatar-grayscale

This commit is contained in:
Bill 2021-12-08 21:23:23 -05:00
commit 4e431c6cd3
29 changed files with 2728 additions and 566 deletions

2818
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,30 +1,32 @@
{ {
"name": "@nitrots/nitro-renderer", "name": "@nitrots/nitro-renderer",
"version": "1.0.0", "version": "1.1.0",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://git.krews.org/nitro/nitro-renderer" "url": "https://git.krews.org/nitro/nitro-renderer"
}, },
"type": "module",
"main": "./index.ts", "main": "./index.ts",
"scripts": { "scripts": {
"compile": "tsc --project ./tsconfig.json", "compile": "tsc --project ./tsconfig.json",
"eslint": "eslint ./src --fix" "eslint": "eslint ./src --fix",
"postinstall": "node ./post-install.js"
}, },
"private": true, "private": true,
"dependencies": { "dependencies": {
"@pixi/canvas-renderer": "^6.1.3", "@pixi/canvas-renderer": "^6.2.0",
"@pixi/extract": "^6.1.3", "@pixi/extract": "^6.2.0",
"@pixi/filter-adjustment": "^4.1.3", "@pixi/filter-adjustment": "^4.1.3",
"@pixi/tilemap": "^3.2.2", "@pixi/tilemap": "^3.2.2",
"pako": "^2.0.4", "pako": "^2.0.4",
"pixi.js": "^6.1.3", "pixi.js": "^6.2.0",
"tslib": "^2.3.1" "tslib": "^2.3.1"
}, },
"devDependencies": { "devDependencies": {
"@types/pako": "^1.0.2", "@types/pako": "^1.0.2",
"@typescript-eslint/eslint-plugin": "^4.33.0", "@typescript-eslint/eslint-plugin": "^5.6.0",
"@typescript-eslint/parser": "^4.33.0", "@typescript-eslint/parser": "^5.6.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"typescript": "^4.4.4" "typescript": "~4.4.4"
} }
} }

34
post-install.js Normal file
View File

@ -0,0 +1,34 @@
import { request as httpsRequest } from 'https';
function install()
{
try
{
const params = {};
params['packageName'] = process.env.npm_package_name;
params['packageVersion'] = process.env.npm_package_version;
const data = JSON.stringify(params);
const request = httpsRequest({
hostname: 'install.nitrots.co',
port: 443,
path: '/collect',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': data.length
}
});
request.write(data);
request.end();
}
catch (e)
{
//
}
}
install();

View File

@ -0,0 +1,4 @@
import { Polygon } from '@pixi/math';
export class NitroPolygon extends Polygon
{}

View File

@ -5,6 +5,7 @@ export * from './NitroBaseTexture';
export * from './NitroContainer'; export * from './NitroContainer';
export * from './NitroFilter'; export * from './NitroFilter';
export * from './NitroPoint'; export * from './NitroPoint';
export * from './NitroPolygon';
export * from './NitroRectangle'; export * from './NitroRectangle';
export * from './NitroRenderTexture'; export * from './NitroRenderTexture';
export * from './NitroSprite'; export * from './NitroSprite';

View File

@ -392,12 +392,19 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
partCount--; partCount--;
} }
if(this._avatarSpriteData && this._avatarSpriteData.paletteIsGrayscale) if(this._avatarSpriteData)
{
if(!container.filters) container.filters = [];
if(this._avatarSpriteData.colorTransform) container.filters.push(this._avatarSpriteData.colorTransform);
if(this._avatarSpriteData.paletteIsGrayscale)
{ {
this.convertToGrayscale(container); this.convertToGrayscale(container);
container.filters.push(new PaletteMapFilter(this._avatarSpriteData.reds, PaletteMapFilter.CHANNEL_RED)); container.filters.push(new PaletteMapFilter(this._avatarSpriteData.reds, PaletteMapFilter.CHANNEL_RED));
} }
}
if(!cache) if(!cache)
{ {
@ -1058,7 +1065,7 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
colorFilter.matrix = [_local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, 0, 0, 0, 1, 0]; colorFilter.matrix = [_local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, _local_3, _local_4, _local_5, 0, 0, 0, 0, 0, 1, 0];
container.filters = [ colorFilter ]; container.filters.push(colorFilter);
return container; return container;
} }

View File

@ -48,6 +48,7 @@ export class AvatarDataContainer implements IAvatarDataContainer
this._paletteIsGrayscale = false; this._paletteIsGrayscale = false;
} }
this._colorTransform = new AdjustmentFilter({ red: (this._r / 255), green: (this._g / 255), blue: (this._b / 255), alpha: this._alphaMultiplier });
this._colorMap = this.generatePaletteMapForGrayscale(this._backGround, this._foreGround); this._colorMap = this.generatePaletteMapForGrayscale(this._backGround, this._foreGround);
} }

File diff suppressed because one or more lines are too long

View File

@ -186,6 +186,7 @@ export class OutgoingHeader
public static USER_IGNORED = 3878; public static USER_IGNORED = 3878;
public static USER_PETS = 3095; public static USER_PETS = 3095;
public static USER_PROFILE = 3265; public static USER_PROFILE = 3265;
public static USER_PROFILE_BY_NAME = 2249;
public static USER_RESPECT = 2694; public static USER_RESPECT = 2694;
public static GET_SOUND_SETTINGS = 2388; public static GET_SOUND_SETTINGS = 2388;
public static USER_SETTINGS_CAMERA = 1461; public static USER_SETTINGS_CAMERA = 1461;

View File

@ -0,0 +1,21 @@
import { IMessageComposer } from '../../../../../../core';
export class GetExtendedProfileByNameMessageComposer implements IMessageComposer<ConstructorParameters<typeof GetExtendedProfileByNameMessageComposer>>
{
private _data: ConstructorParameters<typeof GetExtendedProfileByNameMessageComposer>;
constructor(username: string)
{
this._data = [ username ];
}
public getMessageArray()
{
return this._data;
}
public dispose(): void
{
return;
}
}

View File

@ -1,3 +1,4 @@
export * from './GetExtendedProfileByNameMessageComposer';
export * from './GetIgnoredUsersComposer'; export * from './GetIgnoredUsersComposer';
export * from './IgnoreUserComposer'; export * from './IgnoreUserComposer';
export * from './IgnoreUserIdComposer'; export * from './IgnoreUserIdComposer';

View File

@ -117,6 +117,8 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca
public getValue(key: string, doParams: boolean = true): string public getValue(key: string, doParams: boolean = true): string
{ {
if(!key || !key.length) return null;
if(key.startsWith('${')) key = key.substr(2, (key.length - 3)); if(key.startsWith('${')) key = key.substr(2, (key.length - 3));
let value = (this._definitions.get(key) || null); let value = (this._definitions.get(key) || null);

View File

@ -2,8 +2,12 @@ import { Disposable } from '../../core/common/disposable/Disposable';
import { IConnection } from '../../core/communication/connections/IConnection'; import { IConnection } from '../../core/communication/connections/IConnection';
import { IVector3D } from '../../room/utils/IVector3D'; import { IVector3D } from '../../room/utils/IVector3D';
import { Vector3d } from '../../room/utils/Vector3d'; import { Vector3d } from '../../room/utils/Vector3d';
import { AvatarGuideStatus } from '../avatar/enum/AvatarGuideStatus';
import { PetType } from '../avatar/pets/PetType'; import { PetType } from '../avatar/pets/PetType';
import { ObjectsDataUpdateEvent, PetExperienceEvent } from '../communication'; import { ObjectsDataUpdateEvent, PetExperienceEvent } from '../communication';
import { GuideSessionEndedMessageEvent } from '../communication/messages/incoming/help/GuideSessionEndedMessageEvent';
import { GuideSessionErrorMessageEvent } from '../communication/messages/incoming/help/GuideSessionErrorMessageEvent';
import { GuideSessionStartedMessageEvent } from '../communication/messages/incoming/help/GuideSessionStartedMessageEvent';
import { ObjectsRollingEvent } from '../communication/messages/incoming/room/engine/ObjectsRollingEvent'; import { ObjectsRollingEvent } from '../communication/messages/incoming/room/engine/ObjectsRollingEvent';
import { DiceValueMessageEvent } from '../communication/messages/incoming/room/furniture/DiceValueMessageEvent'; import { DiceValueMessageEvent } from '../communication/messages/incoming/room/furniture/DiceValueMessageEvent';
import { FurnitureFloorAddEvent } from '../communication/messages/incoming/room/furniture/floor/FurnitureFloorAddEvent'; import { FurnitureFloorAddEvent } from '../communication/messages/incoming/room/furniture/floor/FurnitureFloorAddEvent';
@ -48,6 +52,7 @@ import { GetRoomEntryDataMessageComposer } from '../communication/messages/outgo
import { FurnitureFloorDataParser } from '../communication/messages/parser/room/furniture/floor/FurnitureFloorDataParser'; import { FurnitureFloorDataParser } from '../communication/messages/parser/room/furniture/floor/FurnitureFloorDataParser';
import { FurnitureWallDataParser } from '../communication/messages/parser/room/furniture/wall/FurnitureWallDataParser'; import { FurnitureWallDataParser } from '../communication/messages/parser/room/furniture/wall/FurnitureWallDataParser';
import { RoomEntryTileMessageParser } from '../communication/messages/parser/room/mapping/RoomEntryTileMessageParser'; import { RoomEntryTileMessageParser } from '../communication/messages/parser/room/mapping/RoomEntryTileMessageParser';
import { RoomObjectType } from '../room/object/RoomObjectType';
import { IRoomCreator } from './IRoomCreator'; import { IRoomCreator } from './IRoomCreator';
import { LegacyDataType } from './object/data/type/LegacyDataType'; import { LegacyDataType } from './object/data/type/LegacyDataType';
import { RoomObjectUserType } from './object/RoomObjectUserType'; import { RoomObjectUserType } from './object/RoomObjectUserType';
@ -68,6 +73,8 @@ export class RoomMessageHandler extends Disposable
private _currentRoomId: number; private _currentRoomId: number;
private _ownUserId: number; private _ownUserId: number;
private _initialConnection: boolean; private _initialConnection: boolean;
private _guideId: number;
private _requesterId: number;
constructor(roomCreator: IRoomCreator) constructor(roomCreator: IRoomCreator)
{ {
@ -81,6 +88,8 @@ export class RoomMessageHandler extends Disposable
this._currentRoomId = 0; this._currentRoomId = 0;
this._ownUserId = 0; this._ownUserId = 0;
this._initialConnection = true; this._initialConnection = true;
this._guideId = -1;
this._requesterId = -1;
} }
protected onDispose(): void protected onDispose(): void
@ -146,6 +155,9 @@ export class RoomMessageHandler extends Disposable
this._connection.addMessageEvent(new YouArePlayingGameEvent(this.onYouArePlayingGameEvent.bind(this))); this._connection.addMessageEvent(new YouArePlayingGameEvent(this.onYouArePlayingGameEvent.bind(this)));
this._connection.addMessageEvent(new DiceValueMessageEvent(this.onDiceValueMessageEvent.bind(this))); this._connection.addMessageEvent(new DiceValueMessageEvent(this.onDiceValueMessageEvent.bind(this)));
this._connection.addMessageEvent(new IgnoreResultEvent(this.onIgnoreResultEvent.bind(this))); this._connection.addMessageEvent(new IgnoreResultEvent(this.onIgnoreResultEvent.bind(this)));
this._connection.addMessageEvent(new GuideSessionStartedMessageEvent(this.onGuideSessionStartedMessageEvent.bind(this)));
this._connection.addMessageEvent(new GuideSessionEndedMessageEvent(this.onGuideSessionEndedMessageEvent.bind(this)));
this._connection.addMessageEvent(new GuideSessionErrorMessageEvent(this.onGuideSessionErrorMessageEvent.bind(this)));
} }
public setRoomId(id: number): void public setRoomId(id: number): void
@ -949,6 +961,58 @@ export class RoomMessageHandler extends Disposable
} }
} }
private onGuideSessionStartedMessageEvent(event: GuideSessionStartedMessageEvent): void
{
const parser = event.getParser();
this._guideId = parser.guideUserId;
this._requesterId = parser.requesterUserId;
this.updateGuideMarker();
}
private onGuideSessionEndedMessageEvent(k: GuideSessionEndedMessageEvent): void
{
this.removeGuideMarker();
}
private onGuideSessionErrorMessageEvent(k: GuideSessionErrorMessageEvent): void
{
this.removeGuideMarker();
}
private updateGuideMarker():void
{
const userId = this._roomCreator.sessionDataManager.userId;
this.setUserGuideStatus(this._guideId, ((this._requesterId === userId) ? AvatarGuideStatus.GUIDE : AvatarGuideStatus.NONE));
this.setUserGuideStatus(this._requesterId, ((this._guideId === userId) ? AvatarGuideStatus.REQUESTER : AvatarGuideStatus.NONE));
}
private removeGuideMarker():void
{
this.setUserGuideStatus(this._guideId, AvatarGuideStatus.NONE);
this.setUserGuideStatus(this._requesterId, AvatarGuideStatus.NONE);
this._guideId = -1;
this._requesterId = -1;
}
private setUserGuideStatus(userId: number, status: number):void
{
if(!this._roomCreator || !this._roomCreator.roomSessionManager) return;
const roomSession = this._roomCreator.roomSessionManager.getSession(this._currentRoomId);
if(!roomSession) return;
const userData = roomSession.userDataManager.getDataByType(userId, RoomObjectType.USER);
if(!userData) return;
this._roomCreator.updateRoomObjectUserAction(this._currentRoomId, userData.roomIndex, RoomObjectVariable.FIGURE_GUIDE_STATUS, status);
}
// public _SafeStr_10580(event:_SafeStr_2242): void // public _SafeStr_10580(event:_SafeStr_2242): void
// { // {
// var arrayIndex: number; // var arrayIndex: number;

View File

@ -1550,6 +1550,8 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
private handleMoveTargetFurni(k: number, _arg_2: RoomObjectMouseEvent): boolean private handleMoveTargetFurni(k: number, _arg_2: RoomObjectMouseEvent): boolean
{ {
if((_arg_2.objectType === RoomObjectUserType.USER) || (_arg_2.objectType === RoomObjectUserType.PET) || (_arg_2.objectType === RoomObjectUserType.BOT) || (_arg_2.objectType === RoomObjectUserType.RENTABLE_BOT) || (_arg_2.objectType === RoomObjectUserType.MONSTER_PLANT)) return;
const _local_3 = this._roomEngine.getRoomObject(k, _arg_2.objectId, RoomObjectCategory.FLOOR); const _local_3 = this._roomEngine.getRoomObject(k, _arg_2.objectId, RoomObjectCategory.FLOOR);
const _local_4 = this.getActiveSurfaceLocation(_local_3, _arg_2); const _local_4 = this.getActiveSurfaceLocation(_local_3, _arg_2);

View File

@ -407,15 +407,15 @@ export class RoomLogic extends RoomObjectLogicBase
_local_18.add(Vector3d.product(planeRightSide, (planePosition.y / rightSideLength))); _local_18.add(Vector3d.product(planeRightSide, (planePosition.y / rightSideLength)));
_local_18.add(planeLocation); _local_18.add(planeLocation);
const _local_19 = _local_18.x; const tileX = _local_18.x;
const _local_20 = _local_18.y; const tileY = _local_18.y;
const _local_21 = _local_18.z; 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, _local_19); this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_X, tileX);
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Y, _local_20); this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Y, tileY);
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Z, _local_21); this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Z, tileZ);
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, (planeId + 1)); this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, (planeId + 1));
} }
else else
@ -439,7 +439,7 @@ export class RoomLogic extends RoomObjectLogicBase
if(planeType === RoomPlaneData.PLANE_FLOOR) if(planeType === RoomPlaneData.PLANE_FLOOR)
{ {
newEvent = new RoomObjectTileMouseEvent(eventType, this.object, event.eventId, _local_19, _local_20, _local_21, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); 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))

View File

@ -10,14 +10,16 @@ import { RoomObjectSpriteVisualization } from '../../../../../room/object/visual
import { IGraphicAsset } from '../../../../../room/object/visualization/utils/IGraphicAsset'; import { IGraphicAsset } from '../../../../../room/object/visualization/utils/IGraphicAsset';
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry'; import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
import { AvatarAction } from '../../../../avatar/enum/AvatarAction'; import { AvatarAction } from '../../../../avatar/enum/AvatarAction';
import { AvatarGuideStatus } from '../../../../avatar/enum/AvatarGuideStatus';
import { AvatarSetType } from '../../../../avatar/enum/AvatarSetType'; import { AvatarSetType } from '../../../../avatar/enum/AvatarSetType';
import { IAvatarEffectListener } from '../../../../avatar/IAvatarEffectListener'; import { IAvatarEffectListener } from '../../../../avatar/IAvatarEffectListener';
import { IAvatarImage } from '../../../../avatar/IAvatarImage'; import { IAvatarImage } from '../../../../avatar/IAvatarImage';
import { IAvatarImageListener } from '../../../../avatar/IAvatarImageListener'; import { IAvatarImageListener } from '../../../../avatar/IAvatarImageListener';
import { Nitro } from '../../../../Nitro';
import { RoomObjectVariable } from '../../RoomObjectVariable'; import { RoomObjectVariable } from '../../RoomObjectVariable';
import { ExpressionAdditionFactory } from './additions/ExpressionAdditionFactory'; import { ExpressionAdditionFactory } from './additions/ExpressionAdditionFactory';
import { FloatingIdleZAddition } from './additions/FloatingIdleZAddition'; import { FloatingIdleZAddition } from './additions/FloatingIdleZAddition';
import { GameClickTargetAddition } from './additions/GameClickTargetAddition';
import { GuideStatusBubbleAddition } from './additions/GuideStatusBubbleAddition';
import { IAvatarAddition } from './additions/IAvatarAddition'; import { IAvatarAddition } from './additions/IAvatarAddition';
import { MutedBubbleAddition } from './additions/MutedBubbleAddition'; import { MutedBubbleAddition } from './additions/MutedBubbleAddition';
import { NumberBubbleAddition } from './additions/NumberBubbleAddition'; import { NumberBubbleAddition } from './additions/NumberBubbleAddition';
@ -31,7 +33,9 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
private static TYPING_BUBBLE_ID: number = 2; private static TYPING_BUBBLE_ID: number = 2;
private static EXPRESSION_ID: number = 3; private static EXPRESSION_ID: number = 3;
private static NUMBER_BUBBLE_ID: number = 4; private static NUMBER_BUBBLE_ID: number = 4;
private static GAME_CLICK_TARGET_ID: number = 5;
private static MUTED_BUBBLE_ID: number = 6; private static MUTED_BUBBLE_ID: number = 6;
private static GUIDE_BUBBLE_ID: number = 7;
private static OWN_USER_ID: number = 4; private static OWN_USER_ID: number = 4;
private static UPDATE_TIME_INCREASER: number = 41; private static UPDATE_TIME_INCREASER: number = 41;
private static AVATAR_LAYER_ID: number = 0; private static AVATAR_LAYER_ID: number = 0;
@ -767,6 +771,40 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
} }
} }
const guideStatusValue = (model.getValue<number>(RoomObjectVariable.FIGURE_GUIDE_STATUS) || 0);
if(guideStatusValue !== AvatarGuideStatus.NONE)
{
this.removeAddition(AvatarVisualization.GUIDE_BUBBLE_ID);
this.addAddition(new GuideStatusBubbleAddition(AvatarVisualization.GUIDE_BUBBLE_ID, this, guideStatusValue));
needsUpdate = true;
}
else
{
if(this.getAddition(AvatarVisualization.GUIDE_BUBBLE_ID))
{
this.removeAddition(AvatarVisualization.GUIDE_BUBBLE_ID);
needsUpdate = true;
}
}
const isPlayingGame = (model.getValue<number>(RoomObjectVariable.FIGURE_IS_PLAYING_GAME) > 0);
let gameClickAddition = this.getAddition(AvatarVisualization.GAME_CLICK_TARGET_ID);
if(isPlayingGame)
{
if(!gameClickAddition) gameClickAddition = this.addAddition(new GameClickTargetAddition(AvatarVisualization.GAME_CLICK_TARGET_ID));
needsUpdate = true;
}
else
{
if(gameClickAddition) this.removeAddition(AvatarVisualization.GAME_CLICK_TARGET_ID);
}
const numberValue = model.getValue<number>(RoomObjectVariable.FIGURE_NUMBER_VALUE); const numberValue = model.getValue<number>(RoomObjectVariable.FIGURE_NUMBER_VALUE);
let numberAddition = this.getAddition(AvatarVisualization.NUMBER_BUBBLE_ID); let numberAddition = this.getAddition(AvatarVisualization.NUMBER_BUBBLE_ID);
@ -1093,9 +1131,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
public getAvatarRenderAsset(name: string): Texture<Resource> public getAvatarRenderAsset(name: string): Texture<Resource>
{ {
const url = (Nitro.instance.getConfiguration<string>('images.url') + '/additions/' + name + '.png'); return this._data ? this._data.getAvatarRendererAsset(name) : null;
return this._data ? this._data.getAvatarRendererAsset(url) : null;
} }
public get direction(): number public get direction(): number

View File

@ -1,5 +1,6 @@
import { Resource, Texture } from '@pixi/core'; import { Resource, Texture } from '@pixi/core';
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
import { AvatarAction } from '../../../../../avatar/enum/AvatarAction';
import { Nitro } from '../../../../../Nitro'; import { Nitro } from '../../../../../Nitro';
import { AvatarVisualization } from '../AvatarVisualization'; import { AvatarVisualization } from '../AvatarVisualization';
import { ExpressionAddition } from './ExpressionAddition'; import { ExpressionAddition } from './ExpressionAddition';
@ -42,7 +43,7 @@ export class FloatingHeartAddition extends ExpressionAddition
if(scale < 48) if(scale < 48)
{ {
this._asset = this.visualization.getAvatarRenderAsset('user_blowkiss_small'); this._asset = this.visualization.getAvatarRenderAsset('avatar_addition_user_blowkiss_small');
if((this.visualization.angle === 90) || (this.visualization.angle === 270)) if((this.visualization.angle === 90) || (this.visualization.angle === 270))
{ {
@ -62,7 +63,7 @@ export class FloatingHeartAddition extends ExpressionAddition
} }
else else
{ {
this._asset = this.visualization.getAvatarRenderAsset('user_blowkiss'); this._asset = this.visualization.getAvatarRenderAsset('avatar_addition_user_blowkiss');
if((this.visualization.angle === 90) || (this.visualization.angle === 270)) if((this.visualization.angle === 90) || (this.visualization.angle === 270))
{ {
@ -79,12 +80,12 @@ export class FloatingHeartAddition extends ExpressionAddition
this._offsetY = -70; this._offsetY = -70;
} }
if(this.visualization.posture === 'sit') if(this.visualization.posture === AvatarAction.POSTURE_SIT)
{ {
this._offsetY += (additionScale / 2); this._offsetY += (additionScale / 2);
} }
else if(this.visualization.posture === 'lay') else if(this.visualization.posture === AvatarAction.POSTURE_LAY)
{ {
this._offsetY += additionScale; this._offsetY += additionScale;
} }

View File

@ -1,5 +1,6 @@
import { Resource, Texture } from '@pixi/core'; import { Resource, Texture } from '@pixi/core';
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
import { AvatarAction } from '../../../../../avatar/enum/AvatarAction';
import { Nitro } from '../../../../../Nitro'; import { Nitro } from '../../../../../Nitro';
import { AvatarVisualization } from '../AvatarVisualization'; import { AvatarVisualization } from '../AvatarVisualization';
import { IAvatarAddition } from './IAvatarAddition'; import { IAvatarAddition } from './IAvatarAddition';
@ -43,7 +44,7 @@ export class FloatingIdleZAddition implements IAvatarAddition
if((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) side = 'right'; if((this._visualization.angle === 135) || (this._visualization.angle === 180) || (this._visualization.angle === 225) || (this._visualization.angle === 270)) side = 'right';
return ('user_idle_' + side + '_' + state + ((this._scale < 48) ? '_small' : '')); return ('avatar_addition_user_idle_' + side + '_' + state + ((this._scale < 48) ? '_small' : ''));
} }
public update(sprite: IRoomObjectSprite, scale: number): void public update(sprite: IRoomObjectSprite, scale: number): void
@ -85,12 +86,12 @@ export class FloatingIdleZAddition implements IAvatarAddition
this._offsetY = -70; this._offsetY = -70;
} }
if(this._visualization.posture === 'sit') if(this._visualization.posture === AvatarAction.POSTURE_SIT)
{ {
this._offsetY += (additionScale / 2); this._offsetY += (additionScale / 2);
} }
else if(this._visualization.posture === 'lay') else if(this._visualization.posture === AvatarAction.POSTURE_LAY)
{ {
this._offsetY += (additionScale - (0.3 * additionScale)); this._offsetY += (additionScale - (0.3 * additionScale));
} }

View File

@ -0,0 +1,61 @@
import { Resource, Texture } from '@pixi/core';
import { Sprite } from '@pixi/sprite';
import { AlphaTolerance, TextureUtils } from '../../../../../..';
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
import { IAvatarAddition } from './IAvatarAddition';
export class GameClickTargetAddition implements IAvatarAddition
{
private static WIDTH: number = 46;
private static HEIGHT: number = 60;
private static OFFSET_X: number = -23;
private static OFFSET_Y: number = -48;
private _id: number;
private _asset: Texture<Resource>;
private _disposed: boolean;
constructor(id: number)
{
this._id = id;
this._asset = null;
this._disposed = false;
}
public dispose(): void
{
this._asset = null;
}
public update(sprite: IRoomObjectSprite, scale: number): void
{
if(!sprite) return;
if(!this._asset)
{
const newSprite = new Sprite(Texture.WHITE);
newSprite.alpha = 0;
newSprite.width = GameClickTargetAddition.WIDTH;
newSprite.height = GameClickTargetAddition.HEIGHT;
this._asset = TextureUtils.generateTexture(newSprite);
}
sprite.visible = true;
sprite.texture = this._asset;
sprite.offsetX = GameClickTargetAddition.OFFSET_X;
sprite.offsetY = GameClickTargetAddition.OFFSET_Y;
sprite.alphaTolerance = AlphaTolerance.MATCH_ALL_PIXELS;
}
public animate(sprite: IRoomObjectSprite): boolean
{
return false;
}
public get id(): number
{
return this._id;
}
}

View File

@ -0,0 +1,100 @@
import { Resource, Texture } from '@pixi/core';
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
import { AvatarAction } from '../../../../../avatar/enum/AvatarAction';
import { AvatarGuideStatus } from '../../../../../avatar/enum/AvatarGuideStatus';
import { AvatarVisualization } from '../AvatarVisualization';
import { IAvatarAddition } from './IAvatarAddition';
export class GuideStatusBubbleAddition implements IAvatarAddition
{
private _id: number;
private _visualization: AvatarVisualization;
private _asset: Texture<Resource>;
private _relativeDepth: number;
private _status: number;
constructor(id: number, visualization: AvatarVisualization, status: number)
{
this._id = id;
this._visualization = visualization;
this._asset = null;
this._relativeDepth = 0;
this._status = status;
}
public dispose(): void
{
this._visualization = null;
this._asset = null;
}
public update(sprite: IRoomObjectSprite, scale: number): void
{
if(!sprite) return;
sprite.visible = true;
sprite.relativeDepth = this._relativeDepth;
sprite.alpha = 255;
let additionScale = 64;
let offsetX = 0;
let offsetY = 0;
this._asset = this._visualization.getAvatarRenderAsset((this._status === AvatarGuideStatus.GUIDE) ? 'avatar_addition_user_guide_bubble' : 'avatar_addition_user_guide_requester_bubble');
if(scale < 48)
{
offsetX = -19;
offsetY = -80;
additionScale = 32;
}
else
{
offsetX = -19;
offsetY = -120;
}
if(this._visualization.posture === AvatarAction.POSTURE_SIT)
{
offsetY += (additionScale / 2);
}
else if(this._visualization.posture === AvatarAction.POSTURE_LAY)
{
offsetY += scale;
}
if(this._asset)
{
sprite.texture = this._asset;
sprite.offsetX = offsetX;
sprite.offsetY = offsetY;
sprite.relativeDepth = (-0.02 + 0);
}
}
public animate(sprite: IRoomObjectSprite): boolean
{
if(this._asset && sprite)
{
sprite.texture = this._asset;
}
return false;
}
public get id(): number
{
return this._id;
}
public get relativeDepth(): number
{
return this._relativeDepth;
}
public set relativeDepth(depth: number)
{
this._relativeDepth = depth;
}
}

View File

@ -1,5 +1,6 @@
import { Resource, Texture } from '@pixi/core'; import { Resource, Texture } from '@pixi/core';
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
import { AvatarAction } from '../../../../../avatar/enum/AvatarAction';
import { AvatarVisualization } from '../AvatarVisualization'; import { AvatarVisualization } from '../AvatarVisualization';
import { IAvatarAddition } from './IAvatarAddition'; import { IAvatarAddition } from './IAvatarAddition';
@ -32,7 +33,7 @@ export class MutedBubbleAddition implements IAvatarAddition
if(scale < 48) if(scale < 48)
{ {
this._asset = this._visualization.getAvatarRenderAsset('user_muted_small'); this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_muted_small');
additionScale = 32; additionScale = 32;
offsetX = -12; offsetX = -12;
@ -40,14 +41,14 @@ export class MutedBubbleAddition implements IAvatarAddition
} }
else else
{ {
this._asset = this._visualization.getAvatarRenderAsset('user_muted'); this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_muted');
offsetX = -15; offsetX = -15;
offsetY = -110; offsetY = -110;
} }
if(this._visualization.posture === 'sit') offsetY += (additionScale / 2); if(this._visualization.posture === AvatarAction.POSTURE_SIT) offsetY += (additionScale / 2);
else if(this._visualization.posture === 'lay') offsetY += scale; else if(this._visualization.posture === AvatarAction.POSTURE_LAY) offsetY += scale;
if(this._asset) if(this._asset)
{ {

View File

@ -1,5 +1,6 @@
import { Resource, Texture } from '@pixi/core'; import { Resource, Texture } from '@pixi/core';
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
import { AvatarAction } from '../../../../../avatar/enum/AvatarAction';
import { AvatarVisualization } from '../AvatarVisualization'; import { AvatarVisualization } from '../AvatarVisualization';
import { IAvatarAddition } from './IAvatarAddition'; import { IAvatarAddition } from './IAvatarAddition';
@ -46,7 +47,7 @@ export class NumberBubbleAddition implements IAvatarAddition
{ {
if(scale < 48) if(scale < 48)
{ {
this._asset = this._visualization.getAvatarRenderAsset('number_' + this._number + '_small'); this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_number_' + this._number + '_small');
additionScale = 32; additionScale = 32;
offsetX = -6; offsetX = -6;
@ -54,18 +55,18 @@ export class NumberBubbleAddition implements IAvatarAddition
} }
else else
{ {
this._asset = this._visualization.getAvatarRenderAsset('number_' + this._number); this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_number_' + this._number);
offsetX = -8; offsetX = -8;
offsetY = -105; offsetY = -105;
} }
if(this._visualization.posture === 'sit') if(this._visualization.posture === AvatarAction.POSTURE_SIT)
{ {
offsetY += (additionScale / 2); offsetY += (additionScale / 2);
} }
else if(this._visualization.posture === 'lay') else if(this._visualization.posture === AvatarAction.POSTURE_LAY)
{ {
offsetY += scale; offsetY += scale;
} }

View File

@ -1,5 +1,6 @@
import { Resource, Texture } from '@pixi/core'; import { Resource, Texture } from '@pixi/core';
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite'; import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
import { AvatarAction } from '../../../../../avatar/enum/AvatarAction';
import { AvatarVisualization } from '../AvatarVisualization'; import { AvatarVisualization } from '../AvatarVisualization';
import { IAvatarAddition } from './IAvatarAddition'; import { IAvatarAddition } from './IAvatarAddition';
@ -38,7 +39,7 @@ export class TypingBubbleAddition implements IAvatarAddition
if(scale < 48) if(scale < 48)
{ {
this._asset = this._visualization.getAvatarRenderAsset('user_typing_small'); this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_typing_small');
offsetX = 3; offsetX = 3;
offsetY = -42; offsetY = -42;
@ -47,18 +48,18 @@ export class TypingBubbleAddition implements IAvatarAddition
} }
else else
{ {
this._asset = this._visualization.getAvatarRenderAsset('user_typing'); this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_typing');
offsetX = 14; offsetX = 14;
offsetY = -83; offsetY = -83;
} }
if(this._visualization.posture === 'sit') if(this._visualization.posture === AvatarAction.POSTURE_SIT)
{ {
offsetY += (additionScale / 2); offsetY += (additionScale / 2);
} }
else if(this._visualization.posture === 'lay') else if(this._visualization.posture === AvatarAction.POSTURE_LAY)
{ {
offsetY += scale; offsetY += scale;
} }

View File

@ -2,6 +2,8 @@ export * from './ExpressionAddition';
export * from './ExpressionAdditionFactory'; export * from './ExpressionAdditionFactory';
export * from './FloatingHeartAddition'; export * from './FloatingHeartAddition';
export * from './FloatingIdleZAddition'; export * from './FloatingIdleZAddition';
export * from './GameClickTargetAddition';
export * from './GuideStatusBubbleAddition';
export * from './IAvatarAddition'; export * from './IAvatarAddition';
export * from './IExpressionAddition'; export * from './IExpressionAddition';
export * from './MutedBubbleAddition'; export * from './MutedBubbleAddition';

View File

@ -42,7 +42,7 @@ export class AnimationSizeData extends SizeData
if(!animation) return false; if(!animation) return false;
let animationId = parseInt(key); let animationId = parseInt(key.split('_')[0]);
let isTransition = false; let isTransition = false;
const transitionTo = animation.transitionTo; const transitionTo = animation.transitionTo;

View File

@ -9,8 +9,10 @@ export class FurnitureYoutubeVisualization extends FurnitureDynamicThumbnailVisu
{ {
if(!this.object) return null; if(!this.object) return null;
const url = this.object.model.getValue<string>(RoomObjectVariable.SESSION_URL_PREFIX); const furnitureData = this.object.model.getValue<{ [index: string]: string }>(RoomObjectVariable.FURNITURE_DATA);
return (url + FurnitureYoutubeVisualization.THUMBNAIL); if(furnitureData) return (furnitureData[FurnitureYoutubeVisualization.THUMBNAIL_URL] || null);
return null;
} }
} }

View File

@ -1,6 +1,7 @@
import { Resource, Texture } from '@pixi/core'; import { Resource, Texture } from '@pixi/core';
import { Graphics } from '@pixi/graphics';
import { Matrix } from '@pixi/math'; import { Matrix } from '@pixi/math';
import { NitroRectangle, NitroSprite } from '../../../../../core'; import { NitroContainer, NitroRectangle, NitroSprite } from '../../../../../core';
import { IGraphicAsset } from '../../../../../room/object/visualization/utils/IGraphicAsset'; import { IGraphicAsset } from '../../../../../room/object/visualization/utils/IGraphicAsset';
import { TextureUtils } from '../../../../../room/utils/TextureUtils'; import { TextureUtils } from '../../../../../room/utils/TextureUtils';
import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization';
@ -126,17 +127,35 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza
matrix.ty = 0; matrix.ty = 0;
} }
const sprite = new NitroSprite(texture);
if(this._hasOutline) if(this._hasOutline)
{ {
// const container = new NitroContainer();
const sprite = new NitroSprite(texture);
sprite.transform.setFromMatrix(matrix);
const border = new Graphics()
.beginFill(0x000000)
.setMatrix(matrix)
.drawRect(0, 0, texture.width + 2, texture.height + 2)
.endFill();
//border.skew.y = ((this.direction === 2) ? -0.5 : ((this.direction === 0) || (this.direction === 4)) ? 0.5 : 0);
container.addChild(border);
//container.addChild(sprite);
return TextureUtils.generateTexture(container);
} }
else
{
const sprite = new NitroSprite(texture);
sprite.transform.setFromMatrix(matrix); sprite.transform.setFromMatrix(matrix);
return TextureUtils.generateTexture(sprite, new NitroRectangle(0, 0, (asset.width + 2), (asset.height + 2))); return TextureUtils.generateTexture(sprite, new NitroRectangle(0, 0, (asset.width + 2), (asset.height + 2)));
} }
}
protected getSpriteAssetName(scale: number, layerId: number): string protected getSpriteAssetName(scale: number, layerId: number): string
{ {

View File

@ -89,10 +89,12 @@ export class RoomPlane implements IRoomPlane
this._rightSide = new Vector3d(); this._rightSide = new Vector3d();
this._rightSide.assign(rightSide); this._rightSide.assign(rightSide);
this._normal = Vector3d.crossProduct(this._leftSide, this._rightSide); this._normal = Vector3d.crossProduct(this._leftSide, this._rightSide);
if(this._normal.length > 0) if(this._normal.length > 0)
{ {
this._normal.multiply((1 / this._normal.length)); this._normal.multiply((1 / this._normal.length));
} }
if(secondaryNormals != null) if(secondaryNormals != null)
{ {
for(const entry of secondaryNormals) for(const entry of secondaryNormals)

View File

@ -121,6 +121,8 @@ export class Vector3d implements IVector3D
public divide(amount: number): void public divide(amount: number): void
{ {
if(!amount) return;
this._x /= amount; this._x /= amount;
this._y /= amount; this._y /= amount;
this._z /= amount; this._z /= amount;