mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-27 01:40:52 +01:00
Update avatar additions, add guide bubble
This commit is contained in:
parent
32bb662ac1
commit
0f358e3ab7
@ -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;
|
||||||
|
@ -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
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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 { 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)
|
||||||
{
|
{
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -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';
|
||||||
|
Loading…
Reference in New Issue
Block a user