diff --git a/src/nitro/room/RoomObjectEventHandler.ts b/src/nitro/room/RoomObjectEventHandler.ts index 713e2147..23a80b14 100644 --- a/src/nitro/room/RoomObjectEventHandler.ts +++ b/src/nitro/room/RoomObjectEventHandler.ts @@ -289,6 +289,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou case RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY: case RoomObjectWidgetRequestEvent.INERNAL_LINK: case RoomObjectWidgetRequestEvent.ROOM_LINK: + case RoomObjectWidgetRequestEvent.YOUTUBE: this.onRoomObjectWidgetRequestEvent((event as RoomObjectWidgetRequestEvent), roomId); return; case RoomObjectFurnitureActionEvent.DICE_ACTIVATE: @@ -873,6 +874,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou case RoomObjectWidgetRequestEvent.ROOM_LINK: eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_ROOM_LINK, roomId, objectId, objectCategory)); return; + case RoomObjectWidgetRequestEvent.YOUTUBE: + eventDispatcher.dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_YOUTUBE, roomId, objectId, objectCategory)); + return; } } diff --git a/src/nitro/room/events/RoomEngineTriggerWidgetEvent.ts b/src/nitro/room/events/RoomEngineTriggerWidgetEvent.ts index 1bca9f7f..ba1c8cbd 100644 --- a/src/nitro/room/events/RoomEngineTriggerWidgetEvent.ts +++ b/src/nitro/room/events/RoomEngineTriggerWidgetEvent.ts @@ -35,6 +35,7 @@ export class RoomEngineTriggerWidgetEvent extends RoomEngineObjectEvent public static REQUEST_HIDE_HIGH_SCORE_DISPLAY: string = 'RETWE_REQUEST_HIDE_HIGH_SCORE_DISPLAY'; public static REQUEST_INTERNAL_LINK: string = 'RETWE_REQUEST_INTERNAL_LINK'; public static REQUEST_ROOM_LINK: string = 'RETWE_REQUEST_ROOM_LINK'; + public static REQUEST_YOUTUBE: string = 'RETWE_REQUEST_YOUTUBE'; private _widget: string; diff --git a/src/nitro/room/events/RoomObjectWidgetRequestEvent.ts b/src/nitro/room/events/RoomObjectWidgetRequestEvent.ts index ffc06d7a..e1e13db9 100644 --- a/src/nitro/room/events/RoomObjectWidgetRequestEvent.ts +++ b/src/nitro/room/events/RoomObjectWidgetRequestEvent.ts @@ -39,6 +39,7 @@ export class RoomObjectWidgetRequestEvent extends RoomObjectEvent public static HIDE_HIGH_SCORE_DISPLAY: string = 'ROWRE_HIDE_HIGH_SCORE_DISPLAY'; public static INERNAL_LINK: string = 'ROWRE_INTERNAL_LINK'; public static ROOM_LINK: string = 'ROWRE_ROOM_LINK'; + public static YOUTUBE: string = 'ROWRE_YOUTUBE'; constructor(type: string, roomObject: IRoomObject) { diff --git a/src/nitro/room/object/logic/furniture/FurnitureYoutubeLogic.ts b/src/nitro/room/object/logic/furniture/FurnitureYoutubeLogic.ts index ef007738..35bf225a 100644 --- a/src/nitro/room/object/logic/furniture/FurnitureYoutubeLogic.ts +++ b/src/nitro/room/object/logic/furniture/FurnitureYoutubeLogic.ts @@ -1,4 +1,4 @@ -import { RoomWidgetEnum } from '../../../../ui/widget/enums/RoomWidgetEnum'; +import { RoomObjectWidgetRequestEvent } from '../../../events'; import { RoomObjectDataRequestEvent } from '../../../events/RoomObjectDataRequestEvent'; import { RoomObjectVariable } from '../../RoomObjectVariable'; import { FurnitureLogic } from './FurnitureLogic'; @@ -8,6 +8,7 @@ export class FurnitureYoutubeLogic extends FurnitureLogic public getEventTypes(): string[] { const types = [ + RoomObjectWidgetRequestEvent.YOUTUBE, RoomObjectDataRequestEvent.RODRE_URL_PREFIX ]; @@ -24,8 +25,12 @@ export class FurnitureYoutubeLogic extends FurnitureLogic } } - public get widget(): string + public useObject(): void { - return RoomWidgetEnum.YOUTUBE; + if(!this.object || !this.eventDispatcher) return; + + console.log(this.object); + + this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.YOUTUBE, this.object)); } }