From 30d56bf18056a290d9c7f18eb72e6b01b59515a1 Mon Sep 17 00:00:00 2001 From: Bill Date: Mon, 16 Aug 2021 23:21:24 -0400 Subject: [PATCH] Updates --- .../quest/CommunityGoalHallOfFameData.ts | 57 ++++++++-------- .../incoming/quest/HallOfFameEntryData.ts | 66 +++++++++---------- src/nitro/room/RoomObjectEventHandler.ts | 2 +- .../FurnitureAnimatedVisualization.ts | 15 +++-- .../FurnitureSoundBlockVisualization.ts | 12 +++- .../FurnitureYoutubeVisualization.ts | 10 +-- 6 files changed, 87 insertions(+), 75 deletions(-) diff --git a/src/nitro/communication/messages/incoming/quest/CommunityGoalHallOfFameData.ts b/src/nitro/communication/messages/incoming/quest/CommunityGoalHallOfFameData.ts index 13d06d47..bb0338cf 100644 --- a/src/nitro/communication/messages/incoming/quest/CommunityGoalHallOfFameData.ts +++ b/src/nitro/communication/messages/incoming/quest/CommunityGoalHallOfFameData.ts @@ -4,38 +4,39 @@ import { HallOfFameEntryData } from './HallOfFameEntryData'; export class CommunityGoalHallOfFameData implements IDisposable { - private _goalCode: string; - private _hof: HallOfFameEntryData[]; + private _goalCode: string; + private _hof: HallOfFameEntryData[]; - constructor(wrapper: IMessageDataWrapper) - { - this._hof = []; - this._goalCode = wrapper.readString(); + constructor(wrapper: IMessageDataWrapper) + { + this._hof = []; + this._goalCode = wrapper.readString(); - const count = wrapper.readInt(); - for(let i = 0; i < count; i++) - { - this._hof.push(new HallOfFameEntryData(wrapper)); - } - } + const count = wrapper.readInt(); - public dispose(): void - { - this._hof = null; - } + for(let i = 0; i < count; i++) + { + this._hof.push(new HallOfFameEntryData(wrapper)); + } + } - public get disposed(): boolean - { - return this._hof == null; - } + public dispose(): void + { + this._hof = null; + } - public get hof(): HallOfFameEntryData[] - { - return this._hof; - } + public get disposed(): boolean + { + return this._hof == null; + } - public get goalCode(): string - { - return this._goalCode; - } + public get hof(): HallOfFameEntryData[] + { + return this._hof; + } + + public get goalCode(): string + { + return this._goalCode; + } } diff --git a/src/nitro/communication/messages/incoming/quest/HallOfFameEntryData.ts b/src/nitro/communication/messages/incoming/quest/HallOfFameEntryData.ts index 30130b7f..7678e5bf 100644 --- a/src/nitro/communication/messages/incoming/quest/HallOfFameEntryData.ts +++ b/src/nitro/communication/messages/incoming/quest/HallOfFameEntryData.ts @@ -3,43 +3,43 @@ import { ILandingPageUserEntry } from './ILandingPageUserEntry'; export class HallOfFameEntryData implements ILandingPageUserEntry { - private _userId: number; - private _userName: string; - private _figure: string; - private _rank: number; - private _currentScore: number; + private _userId: number; + private _userName: string; + private _figure: string; + private _rank: number; + private _currentScore: number; - constructor(wrapper: IMessageDataWrapper) - { - this._userId = wrapper.readInt(); - this._userName = wrapper.readString(); - this._figure = wrapper.readString(); - this._rank = wrapper.readInt(); - this._currentScore = wrapper.readInt(); - } + constructor(wrapper: IMessageDataWrapper) + { + this._userId = wrapper.readInt(); + this._userName = wrapper.readString(); + this._figure = wrapper.readString(); + this._rank = wrapper.readInt(); + this._currentScore = wrapper.readInt(); + } - public get userId(): number - { - return this._userId; - } + public get userId(): number + { + return this._userId; + } - public get userName(): string - { - return this._userName; - } + public get userName(): string + { + return this._userName; + } - public get figure(): string - { - return this._figure; - } + public get figure(): string + { + return this._figure; + } - public get rank(): number - { - return this._rank; - } + public get rank(): number + { + return this._rank; + } - public get currentScore(): number - { - return this._currentScore; - } + public get currentScore(): number + { + return this._currentScore; + } } diff --git a/src/nitro/room/RoomObjectEventHandler.ts b/src/nitro/room/RoomObjectEventHandler.ts index e246bb61..39a43708 100644 --- a/src/nitro/room/RoomObjectEventHandler.ts +++ b/src/nitro/room/RoomObjectEventHandler.ts @@ -882,7 +882,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType); const selectedData = this.getSelectedRoomObjectData(roomId); - if(!selectedData) + if(selectedData) { if((selectedData.category === objectCategory) && (selectedData.id === event.objectId)) { diff --git a/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts index a2d4c115..7c3324b1 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureAnimatedVisualization.ts @@ -9,14 +9,13 @@ import { FurnitureVisualization } from './FurnitureVisualization'; export class FurnitureAnimatedVisualization extends FurnitureVisualization { - private static FRAME_INCREASE_AMOUNT: number = 1; - public static TYPE: string = RoomObjectVisualizationType.FURNITURE_ANIMATED; public static DEFAULT_ANIMATION_ID: number = 0; protected _data: FurnitureAnimatedVisualizationData; protected _state: number; + protected _frameIncrease: number; private _animationData: AnimationStateData; private _animationScale: number; private _animationChangeTime: number; @@ -28,6 +27,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization super(); this._state = -1; + this._frameIncrease = 1; this._animationData = new AnimationStateData(); this._animationScale = 0; this._animationChangeTime = 0; @@ -290,7 +290,7 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization if(!frameCount) frameCount = this._data.getStartFrame(scale, animationId, this._direction); - frameCount += FurnitureAnimatedVisualization.FRAME_INCREASE_AMOUNT; + frameCount += this.frameIncrease; animationData.frameCounter = frameCount; animationData.animationOver = true; @@ -312,13 +312,13 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization if(frame) { - if(frame.isLastFrame && (frame.remainingFrameRepeats <= FurnitureAnimatedVisualization.FRAME_INCREASE_AMOUNT)) + if(frame.isLastFrame && (frame.remainingFrameRepeats <= this.frameIncrease)) { lastFramePlayed = true; } } - if((this._directionChanged || !frame) || ((frame.remainingFrameRepeats >= 0) && ((frame.remainingFrameRepeats = (frame.remainingFrameRepeats - FurnitureAnimatedVisualization.FRAME_INCREASE_AMOUNT)) <= 0))) + if((this._directionChanged || !frame) || ((frame.remainingFrameRepeats >= 0) && ((frame.remainingFrameRepeats = (frame.remainingFrameRepeats - this.frameIncrease)) <= 0))) { sequenceId = AnimationFrame.SEQUENCE_NOT_DEFINED; @@ -404,4 +404,9 @@ export class FurnitureAnimatedVisualization extends FurnitureVisualization this._directionChanged = true; } + + protected get frameIncrease(): number + { + return this._frameIncrease; + } } diff --git a/src/nitro/room/object/visualization/furniture/FurnitureSoundBlockVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureSoundBlockVisualization.ts index ca6e557e..3f60e213 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureSoundBlockVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureSoundBlockVisualization.ts @@ -1,6 +1,16 @@ +import { RoomObjectVariable } from '../../RoomObjectVariable'; import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization'; export class FurnitureSoundBlockVisualization extends FurnitureAnimatedVisualization { + private _internalFrameIncreaseCounter: number = 0; -} \ No newline at end of file + protected updateAnimations(scale: number): number + { + this._internalFrameIncreaseCounter = (this._internalFrameIncreaseCounter + this.object.model.getValue(RoomObjectVariable.FURNITURE_SOUNDBLOCK_RELATIVE_ANIMATION_SPEED)); + this._frameIncrease = this._internalFrameIncreaseCounter; + this._internalFrameIncreaseCounter = (this._internalFrameIncreaseCounter - this._frameIncrease); + + return super.updateAnimations(scale); + } +} diff --git a/src/nitro/room/object/visualization/furniture/FurnitureYoutubeVisualization.ts b/src/nitro/room/object/visualization/furniture/FurnitureYoutubeVisualization.ts index 91b9edf1..1e7a9811 100644 --- a/src/nitro/room/object/visualization/furniture/FurnitureYoutubeVisualization.ts +++ b/src/nitro/room/object/visualization/furniture/FurnitureYoutubeVisualization.ts @@ -1,3 +1,4 @@ +import { RoomObjectVariable } from '../../RoomObjectVariable'; import { FurnitureDynamicThumbnailVisualization } from './FurnitureDynamicThumbnailVisualization'; export class FurnitureYoutubeVisualization extends FurnitureDynamicThumbnailVisualization @@ -8,13 +9,8 @@ export class FurnitureYoutubeVisualization extends FurnitureDynamicThumbnailVisu { if(!this.object) return null; - return null; + const url = this.object.model.getValue(RoomObjectVariable.SESSION_URL_PREFIX); - // const data = this.object.model.getValue(RoomObjectVariable.FURNITURE_DATA); - // const url = this.object.model.getValue(RoomObjectVariable.SESSION_URL_PREFIX); - - // if(!data || !url) return null; - - // return (url + FurnitureYoutubeVisualization.THUMBNAIL); + return (url + FurnitureYoutubeVisualization.THUMBNAIL); } }