mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-26 17:30:52 +01:00
Merge branch 'main' into avatar-grayscale
This commit is contained in:
commit
4e431c6cd3
2818
package-lock.json
generated
2818
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -1,30 +1,32 @@
|
||||
{
|
||||
"name": "@nitrots/nitro-renderer",
|
||||
"version": "1.0.0",
|
||||
"version": "1.1.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://git.krews.org/nitro/nitro-renderer"
|
||||
},
|
||||
"type": "module",
|
||||
"main": "./index.ts",
|
||||
"scripts": {
|
||||
"compile": "tsc --project ./tsconfig.json",
|
||||
"eslint": "eslint ./src --fix"
|
||||
"eslint": "eslint ./src --fix",
|
||||
"postinstall": "node ./post-install.js"
|
||||
},
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@pixi/canvas-renderer": "^6.1.3",
|
||||
"@pixi/extract": "^6.1.3",
|
||||
"@pixi/canvas-renderer": "^6.2.0",
|
||||
"@pixi/extract": "^6.2.0",
|
||||
"@pixi/filter-adjustment": "^4.1.3",
|
||||
"@pixi/tilemap": "^3.2.2",
|
||||
"pako": "^2.0.4",
|
||||
"pixi.js": "^6.1.3",
|
||||
"pixi.js": "^6.2.0",
|
||||
"tslib": "^2.3.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/pako": "^1.0.2",
|
||||
"@typescript-eslint/eslint-plugin": "^4.33.0",
|
||||
"@typescript-eslint/parser": "^4.33.0",
|
||||
"@typescript-eslint/eslint-plugin": "^5.6.0",
|
||||
"@typescript-eslint/parser": "^5.6.0",
|
||||
"eslint": "^7.32.0",
|
||||
"typescript": "^4.4.4"
|
||||
"typescript": "~4.4.4"
|
||||
}
|
||||
}
|
||||
|
34
post-install.js
Normal file
34
post-install.js
Normal 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();
|
4
src/core/utils/proxy/NitroPolygon.ts
Normal file
4
src/core/utils/proxy/NitroPolygon.ts
Normal file
@ -0,0 +1,4 @@
|
||||
import { Polygon } from '@pixi/math';
|
||||
|
||||
export class NitroPolygon extends Polygon
|
||||
{}
|
@ -5,6 +5,7 @@ export * from './NitroBaseTexture';
|
||||
export * from './NitroContainer';
|
||||
export * from './NitroFilter';
|
||||
export * from './NitroPoint';
|
||||
export * from './NitroPolygon';
|
||||
export * from './NitroRectangle';
|
||||
export * from './NitroRenderTexture';
|
||||
export * from './NitroSprite';
|
||||
|
@ -392,12 +392,19 @@ export class AvatarImage implements IAvatarImage, IAvatarEffectListener
|
||||
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);
|
||||
|
||||
container.filters.push(new PaletteMapFilter(this._avatarSpriteData.reds, PaletteMapFilter.CHANNEL_RED));
|
||||
}
|
||||
}
|
||||
|
||||
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];
|
||||
|
||||
container.filters = [ colorFilter ];
|
||||
container.filters.push(colorFilter);
|
||||
|
||||
return container;
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ export class AvatarDataContainer implements IAvatarDataContainer
|
||||
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);
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -186,6 +186,7 @@ export class OutgoingHeader
|
||||
public static USER_IGNORED = 3878;
|
||||
public static USER_PETS = 3095;
|
||||
public static USER_PROFILE = 3265;
|
||||
public static USER_PROFILE_BY_NAME = 2249;
|
||||
public static USER_RESPECT = 2694;
|
||||
public static GET_SOUND_SETTINGS = 2388;
|
||||
public static USER_SETTINGS_CAMERA = 1461;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -1,3 +1,4 @@
|
||||
export * from './GetExtendedProfileByNameMessageComposer';
|
||||
export * from './GetIgnoredUsersComposer';
|
||||
export * from './IgnoreUserComposer';
|
||||
export * from './IgnoreUserIdComposer';
|
||||
|
@ -117,6 +117,8 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca
|
||||
|
||||
public getValue(key: string, doParams: boolean = true): string
|
||||
{
|
||||
if(!key || !key.length) return null;
|
||||
|
||||
if(key.startsWith('${')) key = key.substr(2, (key.length - 3));
|
||||
|
||||
let value = (this._definitions.get(key) || null);
|
||||
|
@ -2,8 +2,12 @@ import { Disposable } from '../../core/common/disposable/Disposable';
|
||||
import { IConnection } from '../../core/communication/connections/IConnection';
|
||||
import { IVector3D } from '../../room/utils/IVector3D';
|
||||
import { Vector3d } from '../../room/utils/Vector3d';
|
||||
import { AvatarGuideStatus } from '../avatar/enum/AvatarGuideStatus';
|
||||
import { PetType } from '../avatar/pets/PetType';
|
||||
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 { DiceValueMessageEvent } from '../communication/messages/incoming/room/furniture/DiceValueMessageEvent';
|
||||
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 { FurnitureWallDataParser } from '../communication/messages/parser/room/furniture/wall/FurnitureWallDataParser';
|
||||
import { RoomEntryTileMessageParser } from '../communication/messages/parser/room/mapping/RoomEntryTileMessageParser';
|
||||
import { RoomObjectType } from '../room/object/RoomObjectType';
|
||||
import { IRoomCreator } from './IRoomCreator';
|
||||
import { LegacyDataType } from './object/data/type/LegacyDataType';
|
||||
import { RoomObjectUserType } from './object/RoomObjectUserType';
|
||||
@ -68,6 +73,8 @@ export class RoomMessageHandler extends Disposable
|
||||
private _currentRoomId: number;
|
||||
private _ownUserId: number;
|
||||
private _initialConnection: boolean;
|
||||
private _guideId: number;
|
||||
private _requesterId: number;
|
||||
|
||||
constructor(roomCreator: IRoomCreator)
|
||||
{
|
||||
@ -81,6 +88,8 @@ export class RoomMessageHandler extends Disposable
|
||||
this._currentRoomId = 0;
|
||||
this._ownUserId = 0;
|
||||
this._initialConnection = true;
|
||||
this._guideId = -1;
|
||||
this._requesterId = -1;
|
||||
}
|
||||
|
||||
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 DiceValueMessageEvent(this.onDiceValueMessageEvent.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
|
||||
@ -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
|
||||
// {
|
||||
// var arrayIndex: number;
|
||||
|
@ -1550,6 +1550,8 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
||||
|
||||
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_4 = this.getActiveSurfaceLocation(_local_3, _arg_2);
|
||||
|
||||
|
@ -407,15 +407,15 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
_local_18.add(Vector3d.product(planeRightSide, (planePosition.y / rightSideLength)));
|
||||
_local_18.add(planeLocation);
|
||||
|
||||
const _local_19 = _local_18.x;
|
||||
const _local_20 = _local_18.y;
|
||||
const _local_21 = _local_18.z;
|
||||
const tileX = _local_18.x;
|
||||
const tileY = _local_18.y;
|
||||
const tileZ = _local_18.z;
|
||||
|
||||
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_Y, _local_20);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Z, _local_21);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_X, tileX);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Y, tileY);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Z, tileZ);
|
||||
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, (planeId + 1));
|
||||
}
|
||||
else
|
||||
@ -439,7 +439,7 @@ export class RoomLogic extends RoomObjectLogicBase
|
||||
|
||||
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))
|
||||
|
@ -10,14 +10,16 @@ import { RoomObjectSpriteVisualization } from '../../../../../room/object/visual
|
||||
import { IGraphicAsset } from '../../../../../room/object/visualization/utils/IGraphicAsset';
|
||||
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
|
||||
import { AvatarAction } from '../../../../avatar/enum/AvatarAction';
|
||||
import { AvatarGuideStatus } from '../../../../avatar/enum/AvatarGuideStatus';
|
||||
import { AvatarSetType } from '../../../../avatar/enum/AvatarSetType';
|
||||
import { IAvatarEffectListener } from '../../../../avatar/IAvatarEffectListener';
|
||||
import { IAvatarImage } from '../../../../avatar/IAvatarImage';
|
||||
import { IAvatarImageListener } from '../../../../avatar/IAvatarImageListener';
|
||||
import { Nitro } from '../../../../Nitro';
|
||||
import { RoomObjectVariable } from '../../RoomObjectVariable';
|
||||
import { ExpressionAdditionFactory } from './additions/ExpressionAdditionFactory';
|
||||
import { FloatingIdleZAddition } from './additions/FloatingIdleZAddition';
|
||||
import { GameClickTargetAddition } from './additions/GameClickTargetAddition';
|
||||
import { GuideStatusBubbleAddition } from './additions/GuideStatusBubbleAddition';
|
||||
import { IAvatarAddition } from './additions/IAvatarAddition';
|
||||
import { MutedBubbleAddition } from './additions/MutedBubbleAddition';
|
||||
import { NumberBubbleAddition } from './additions/NumberBubbleAddition';
|
||||
@ -31,7 +33,9 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
private static TYPING_BUBBLE_ID: number = 2;
|
||||
private static EXPRESSION_ID: number = 3;
|
||||
private static NUMBER_BUBBLE_ID: number = 4;
|
||||
private static GAME_CLICK_TARGET_ID: number = 5;
|
||||
private static MUTED_BUBBLE_ID: number = 6;
|
||||
private static GUIDE_BUBBLE_ID: number = 7;
|
||||
private static OWN_USER_ID: number = 4;
|
||||
private static UPDATE_TIME_INCREASER: number = 41;
|
||||
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);
|
||||
|
||||
let numberAddition = this.getAddition(AvatarVisualization.NUMBER_BUBBLE_ID);
|
||||
@ -1093,9 +1131,7 @@ export class AvatarVisualization extends RoomObjectSpriteVisualization implement
|
||||
|
||||
public getAvatarRenderAsset(name: string): Texture<Resource>
|
||||
{
|
||||
const url = (Nitro.instance.getConfiguration<string>('images.url') + '/additions/' + name + '.png');
|
||||
|
||||
return this._data ? this._data.getAvatarRendererAsset(url) : null;
|
||||
return this._data ? this._data.getAvatarRendererAsset(name) : null;
|
||||
}
|
||||
|
||||
public get direction(): number
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Resource, Texture } from '@pixi/core';
|
||||
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
|
||||
import { AvatarAction } from '../../../../../avatar/enum/AvatarAction';
|
||||
import { Nitro } from '../../../../../Nitro';
|
||||
import { AvatarVisualization } from '../AvatarVisualization';
|
||||
import { ExpressionAddition } from './ExpressionAddition';
|
||||
@ -42,7 +43,7 @@ export class FloatingHeartAddition extends ExpressionAddition
|
||||
|
||||
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))
|
||||
{
|
||||
@ -62,7 +63,7 @@ export class FloatingHeartAddition extends ExpressionAddition
|
||||
}
|
||||
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))
|
||||
{
|
||||
@ -79,12 +80,12 @@ export class FloatingHeartAddition extends ExpressionAddition
|
||||
this._offsetY = -70;
|
||||
}
|
||||
|
||||
if(this.visualization.posture === 'sit')
|
||||
if(this.visualization.posture === AvatarAction.POSTURE_SIT)
|
||||
{
|
||||
this._offsetY += (additionScale / 2);
|
||||
}
|
||||
|
||||
else if(this.visualization.posture === 'lay')
|
||||
else if(this.visualization.posture === AvatarAction.POSTURE_LAY)
|
||||
{
|
||||
this._offsetY += additionScale;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Resource, Texture } from '@pixi/core';
|
||||
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
|
||||
import { AvatarAction } from '../../../../../avatar/enum/AvatarAction';
|
||||
import { Nitro } from '../../../../../Nitro';
|
||||
import { AvatarVisualization } from '../AvatarVisualization';
|
||||
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';
|
||||
|
||||
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
|
||||
@ -85,12 +86,12 @@ export class FloatingIdleZAddition implements IAvatarAddition
|
||||
this._offsetY = -70;
|
||||
}
|
||||
|
||||
if(this._visualization.posture === 'sit')
|
||||
if(this._visualization.posture === AvatarAction.POSTURE_SIT)
|
||||
{
|
||||
this._offsetY += (additionScale / 2);
|
||||
}
|
||||
|
||||
else if(this._visualization.posture === 'lay')
|
||||
else if(this._visualization.posture === AvatarAction.POSTURE_LAY)
|
||||
{
|
||||
this._offsetY += (additionScale - (0.3 * additionScale));
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
import { Resource, Texture } from '@pixi/core';
|
||||
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
|
||||
import { AvatarAction } from '../../../../../avatar/enum/AvatarAction';
|
||||
import { AvatarVisualization } from '../AvatarVisualization';
|
||||
import { IAvatarAddition } from './IAvatarAddition';
|
||||
|
||||
@ -32,7 +33,7 @@ export class MutedBubbleAddition implements IAvatarAddition
|
||||
|
||||
if(scale < 48)
|
||||
{
|
||||
this._asset = this._visualization.getAvatarRenderAsset('user_muted_small');
|
||||
this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_muted_small');
|
||||
|
||||
additionScale = 32;
|
||||
offsetX = -12;
|
||||
@ -40,14 +41,14 @@ export class MutedBubbleAddition implements IAvatarAddition
|
||||
}
|
||||
else
|
||||
{
|
||||
this._asset = this._visualization.getAvatarRenderAsset('user_muted');
|
||||
this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_muted');
|
||||
|
||||
offsetX = -15;
|
||||
offsetY = -110;
|
||||
}
|
||||
|
||||
if(this._visualization.posture === 'sit') offsetY += (additionScale / 2);
|
||||
else if(this._visualization.posture === 'lay') offsetY += scale;
|
||||
if(this._visualization.posture === AvatarAction.POSTURE_SIT) offsetY += (additionScale / 2);
|
||||
else if(this._visualization.posture === AvatarAction.POSTURE_LAY) offsetY += scale;
|
||||
|
||||
if(this._asset)
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Resource, Texture } from '@pixi/core';
|
||||
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
|
||||
import { AvatarAction } from '../../../../../avatar/enum/AvatarAction';
|
||||
import { AvatarVisualization } from '../AvatarVisualization';
|
||||
import { IAvatarAddition } from './IAvatarAddition';
|
||||
|
||||
@ -46,7 +47,7 @@ export class NumberBubbleAddition implements IAvatarAddition
|
||||
{
|
||||
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;
|
||||
offsetX = -6;
|
||||
@ -54,18 +55,18 @@ export class NumberBubbleAddition implements IAvatarAddition
|
||||
}
|
||||
else
|
||||
{
|
||||
this._asset = this._visualization.getAvatarRenderAsset('number_' + this._number);
|
||||
this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_number_' + this._number);
|
||||
|
||||
offsetX = -8;
|
||||
offsetY = -105;
|
||||
}
|
||||
|
||||
if(this._visualization.posture === 'sit')
|
||||
if(this._visualization.posture === AvatarAction.POSTURE_SIT)
|
||||
{
|
||||
offsetY += (additionScale / 2);
|
||||
}
|
||||
|
||||
else if(this._visualization.posture === 'lay')
|
||||
else if(this._visualization.posture === AvatarAction.POSTURE_LAY)
|
||||
{
|
||||
offsetY += scale;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { Resource, Texture } from '@pixi/core';
|
||||
import { IRoomObjectSprite } from '../../../../../../room/object/visualization/IRoomObjectSprite';
|
||||
import { AvatarAction } from '../../../../../avatar/enum/AvatarAction';
|
||||
import { AvatarVisualization } from '../AvatarVisualization';
|
||||
import { IAvatarAddition } from './IAvatarAddition';
|
||||
|
||||
@ -38,7 +39,7 @@ export class TypingBubbleAddition implements IAvatarAddition
|
||||
|
||||
if(scale < 48)
|
||||
{
|
||||
this._asset = this._visualization.getAvatarRenderAsset('user_typing_small');
|
||||
this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_typing_small');
|
||||
|
||||
offsetX = 3;
|
||||
offsetY = -42;
|
||||
@ -47,18 +48,18 @@ export class TypingBubbleAddition implements IAvatarAddition
|
||||
}
|
||||
else
|
||||
{
|
||||
this._asset = this._visualization.getAvatarRenderAsset('user_typing');
|
||||
this._asset = this._visualization.getAvatarRenderAsset('avatar_addition_user_typing');
|
||||
|
||||
offsetX = 14;
|
||||
offsetY = -83;
|
||||
}
|
||||
|
||||
if(this._visualization.posture === 'sit')
|
||||
if(this._visualization.posture === AvatarAction.POSTURE_SIT)
|
||||
{
|
||||
offsetY += (additionScale / 2);
|
||||
}
|
||||
|
||||
else if(this._visualization.posture === 'lay')
|
||||
else if(this._visualization.posture === AvatarAction.POSTURE_LAY)
|
||||
{
|
||||
offsetY += scale;
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ export * from './ExpressionAddition';
|
||||
export * from './ExpressionAdditionFactory';
|
||||
export * from './FloatingHeartAddition';
|
||||
export * from './FloatingIdleZAddition';
|
||||
export * from './GameClickTargetAddition';
|
||||
export * from './GuideStatusBubbleAddition';
|
||||
export * from './IAvatarAddition';
|
||||
export * from './IExpressionAddition';
|
||||
export * from './MutedBubbleAddition';
|
||||
|
@ -42,7 +42,7 @@ export class AnimationSizeData extends SizeData
|
||||
|
||||
if(!animation) return false;
|
||||
|
||||
let animationId = parseInt(key);
|
||||
let animationId = parseInt(key.split('_')[0]);
|
||||
let isTransition = false;
|
||||
|
||||
const transitionTo = animation.transitionTo;
|
||||
|
@ -9,8 +9,10 @@ export class FurnitureYoutubeVisualization extends FurnitureDynamicThumbnailVisu
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Resource, Texture } from '@pixi/core';
|
||||
import { Graphics } from '@pixi/graphics';
|
||||
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 { TextureUtils } from '../../../../../room/utils/TextureUtils';
|
||||
import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization';
|
||||
@ -126,17 +127,35 @@ export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualiza
|
||||
matrix.ty = 0;
|
||||
}
|
||||
|
||||
const sprite = new NitroSprite(texture);
|
||||
|
||||
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);
|
||||
|
||||
return TextureUtils.generateTexture(sprite, new NitroRectangle(0, 0, (asset.width + 2), (asset.height + 2)));
|
||||
}
|
||||
}
|
||||
|
||||
protected getSpriteAssetName(scale: number, layerId: number): string
|
||||
{
|
||||
|
@ -89,10 +89,12 @@ export class RoomPlane implements IRoomPlane
|
||||
this._rightSide = new Vector3d();
|
||||
this._rightSide.assign(rightSide);
|
||||
this._normal = Vector3d.crossProduct(this._leftSide, this._rightSide);
|
||||
|
||||
if(this._normal.length > 0)
|
||||
{
|
||||
this._normal.multiply((1 / this._normal.length));
|
||||
}
|
||||
|
||||
if(secondaryNormals != null)
|
||||
{
|
||||
for(const entry of secondaryNormals)
|
||||
|
@ -121,6 +121,8 @@ export class Vector3d implements IVector3D
|
||||
|
||||
public divide(amount: number): void
|
||||
{
|
||||
if(!amount) return;
|
||||
|
||||
this._x /= amount;
|
||||
this._y /= amount;
|
||||
this._z /= amount;
|
||||
|
Loading…
Reference in New Issue
Block a user