Add FurnitureMysteryBoxLogic

This commit is contained in:
Bill 2021-07-12 00:51:03 -04:00
parent 3f025a030e
commit 471c171d47
3 changed files with 30 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import { IEventDispatcher } from '../../core/events/IEventDispatcher';
import { IRoomObjectEventHandler } from '../../room/object/logic/IRoomObjectEventHandler';
import { IRoomObjectLogicFactory } from '../../room/object/logic/IRoomObjectLogicFactory';
import { RoomObjectLogicBase } from '../../room/object/logic/RoomObjectLogicBase';
import { FurnitureEffectBoxLogic, FurnitureLoveLockLogic, FurnitureMonsterplantSeedLogic, FurnitureMysteryTrophyLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic } from './object';
import { FurnitureEffectBoxLogic, FurnitureLoveLockLogic, FurnitureMonsterplantSeedLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic } from './object';
import { AvatarLogic } from './object/logic/avatar/AvatarLogic';
import { FurnitureBadgeDisplayLogic } from './object/logic/furniture/FurnitureBadgeDisplayLogic';
import { FurnitureChangeStateWhenStepOnLogic } from './object/logic/furniture/FurnitureChangeStateWhenStepOnLogic';
@ -295,6 +295,9 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
case RoomObjectLogicType.FURNITURE_MONSTERPLANT_SEED:
logic = FurnitureMonsterplantSeedLogic;
break;
case RoomObjectLogicType.FURNITURE_MYSTERYBOX:
logic = FurnitureMysteryBoxLogic;
break;
case RoomObjectLogicType.FURNITURE_MYSTERYTROPHY:
logic = FurnitureMysteryTrophyLogic;
break;

View File

@ -0,0 +1,25 @@
import { ContextMenuEnum } from '../../../../ui';
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
export class FurnitureMysteryBoxLogic extends FurnitureMultiStateLogic
{
public getEventTypes(): string[]
{
const types = [ RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG ];
return this.mergeTypes(super.getEventTypes(), types);
}
public useObject(): void
{
if(!this.eventDispatcher || !this.object) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG, this.object));
}
public get contextMenu(): string
{
return ContextMenuEnum.MYSTERY_BOX;
}
}

View File

@ -24,6 +24,7 @@ export * from './FurnitureMannequinLogic';
export * from './FurnitureMonsterplantSeedLogic';
export * from './FurnitureMultiHeightLogic';
export * from './FurnitureMultiStateLogic';
export * from './FurnitureMysteryBoxLogic';
export * from './FurnitureMysteryTrophyLogic';
export * from './FurnitureOneWayDoorLogic';
export * from './FurniturePetCustomizationLogic';