Update logics

This commit is contained in:
Bill 2021-07-14 01:49:54 -04:00
parent a1a55038b9
commit 114b560bdc
25 changed files with 77 additions and 246 deletions

View File

@ -1,8 +1,5 @@
import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent';
import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage';
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
import { Nitro } from '../../../../Nitro'; import { Nitro } from '../../../../Nitro';
import { MouseEventType } from '../../../../ui/MouseEventType';
import { RoomObjectBadgeAssetEvent } from '../../../events/RoomObjectBadgeAssetEvent'; import { RoomObjectBadgeAssetEvent } from '../../../events/RoomObjectBadgeAssetEvent';
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage';
@ -49,24 +46,11 @@ export class FurnitureBadgeDisplayLogic extends FurnitureLogic
} }
} }
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{
if(!event || !geometry || !this.object) return;
switch(event.type)
{
case MouseEventType.DOUBLE_CLICK:
this.useObject();
return;
default:
super.mouseEvent(event, geometry);
return;
}
}
public useObject(): void public useObject(): void
{ {
(this.object && this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING, this.object))); if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BADGE_DISPLAY_ENGRAVING, this.object));
} }
protected updateBadge(badgeId: string): void protected updateBadge(badgeId: string): void

View File

@ -51,4 +51,4 @@ export class FurnitureCounterClockLogic extends FurnitureLogic
this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1)); this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, 1));
} }
} }

View File

@ -1,7 +1,4 @@
import { IAssetData } from '../../../../../core/asset/interfaces'; import { IAssetData } from '../../../../../core/asset/interfaces';
import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent';
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
import { MouseEventType } from '../../../../ui/MouseEventType';
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
import { RoomObjectVariable } from '../../RoomObjectVariable'; import { RoomObjectVariable } from '../../RoomObjectVariable';
import { FurnitureLogic } from './FurnitureLogic'; import { FurnitureLogic } from './FurnitureLogic';
@ -28,23 +25,11 @@ export class FurnitureCreditLogic extends FurnitureLogic
this.object.model.setValue(RoomObjectVariable.FURNITURE_CREDIT_VALUE, creditValue); this.object.model.setValue(RoomObjectVariable.FURNITURE_CREDIT_VALUE, creditValue);
} }
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{
if(!event || !geometry || !this.object) return;
switch(event.type)
{
case MouseEventType.DOUBLE_CLICK:
this.useObject();
return;
default:
super.mouseEvent(event, geometry);
}
}
public useObject(): void public useObject(): void
{ {
(this.object && this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CREDITFURNI, this.object))); if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CREDITFURNI, this.object));
super.useObject(); super.useObject();
} }

View File

@ -76,8 +76,8 @@ export class FurnitureEditableInternalLinkLogic extends FurnitureLogic
public useObject(): void public useObject(): void
{ {
if(!this.eventDispatcher || !this.object) return; if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object));
} }
} }

View File

@ -67,8 +67,8 @@ export class FurnitureEditableRoomLinkLogic extends FurnitureLogic
this._timer = null; this._timer = null;
}, 2500); }, 2500);
if(!this.eventDispatcher || !this.object) return; if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.ROOM_LINK, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.ROOM_LINK, this.object));
} }
} }

View File

@ -15,7 +15,7 @@ export class FurnitureEffectBoxLogic extends FurnitureLogic
public useObject(): void public useObject(): void
{ {
if(!this.eventDispatcher || !this.object) return; if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.EFFECTBOX_OPEN_DIALOG, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.EFFECTBOX_OPEN_DIALOG, this.object));
} }

View File

@ -1,7 +1,4 @@
import { IAssetData } from '../../../../../core/asset/interfaces'; import { IAssetData } from '../../../../../core/asset/interfaces';
import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent';
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
import { MouseEventType } from '../../../../ui/MouseEventType';
import { RoomWidgetEnum } from '../../../../ui/widget/enums/RoomWidgetEnum'; import { RoomWidgetEnum } from '../../../../ui/widget/enums/RoomWidgetEnum';
import { RoomObjectVariable } from '../../RoomObjectVariable'; import { RoomObjectVariable } from '../../RoomObjectVariable';
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic'; import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
@ -25,22 +22,8 @@ export class FurnitureExternalImageLogic extends FurnitureMultiStateLogic
} }
} }
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{
if(!event || !geometry || !this.object) return;
switch(event.type)
{
case MouseEventType.DOUBLE_CLICK:
this.useObject();
break;
}
super.mouseEvent(event, geometry);
}
public get widget(): string public get widget(): string
{ {
return RoomWidgetEnum.EXTERNAL_IMAGE; return RoomWidgetEnum.EXTERNAL_IMAGE;
} }
} }

View File

@ -50,7 +50,7 @@ export class FurnitureFriendFurniLogic extends FurnitureMultiStateLogic
public useObject(): void public useObject(): void
{ {
if(!this.eventDispatcher || !this.object) return; if(!this.object || !this.eventDispatcher) return;
if(this._state === FurnitureFriendFurniLogic.STATE_LOCKED) if(this._state === FurnitureFriendFurniLogic.STATE_LOCKED)
{ {

View File

@ -1,6 +1,3 @@
import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent';
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
import { MouseEventType } from '../../../../ui/MouseEventType';
import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent'; import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent';
import { FurnitureLogic } from './FurnitureLogic'; import { FurnitureLogic } from './FurnitureLogic';
@ -13,28 +10,10 @@ export class FurnitureHabboWheelLogic extends FurnitureLogic
return this.mergeTypes(super.getEventTypes(), types); return this.mergeTypes(super.getEventTypes(), types);
} }
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{
if(!event || !geometry || !this.object) return;
switch(event.type)
{
case MouseEventType.DOUBLE_CLICK:
this.useObject();
return;
default:
super.mouseEvent(event, geometry);
return;
}
}
public useObject(): void public useObject(): void
{ {
if(!this.object) return; if(!this.object || !this.eventDispatcher) return;
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.USE_HABBOWHEEL, this.object));
{
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.USE_HABBOWHEEL, this.object));
}
} }
} }

View File

@ -1,7 +1,4 @@
import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent';
import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage';
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
import { MouseEventType } from '../../../../ui/MouseEventType';
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage';
import { RoomObjectVariable } from '../../RoomObjectVariable'; import { RoomObjectVariable } from '../../RoomObjectVariable';
@ -48,18 +45,4 @@ export class FurnitureHighScoreLogic extends FurnitureLogic
this._state = message.state; this._state = message.state;
} }
} }
}
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{
if(!event || !geometry || !this.object) return;
switch(event.type)
{
case MouseEventType.DOUBLE_CLICK:
this.useObject();
return;
default:
super.mouseEvent(event, geometry);
}
}
}

View File

@ -353,16 +353,13 @@ export class FurnitureLogic extends MovingObjectLogic
public useObject(): void public useObject(): void
{ {
if(!this.object) return; if(!this.object || !this.eventDispatcher) return;
const adUrl = this.getAdClickUrl(this.object.model); const adUrl = this.getAdClickUrl(this.object.model);
if(this.eventDispatcher) if(this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.OPEN_WIDGET, this.object));
{
if(this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.OPEN_WIDGET, this.object));
this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object));
}
} }
public tearDown(): void public tearDown(): void

View File

@ -1,7 +1,4 @@
import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent';
import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage';
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
import { MouseEventType } from '../../../../ui/MouseEventType';
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage'; import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage';
import { MapDataType } from '../../data/type/MapDataType'; import { MapDataType } from '../../data/type/MapDataType';
@ -46,24 +43,10 @@ export class FurnitureMannequinLogic extends FurnitureLogic
this.object.model.setValue(RoomObjectVariable.FURNITURE_MANNEQUIN_NAME, data.getValue(FurnitureMannequinLogic.OUTFIT_NAME)); this.object.model.setValue(RoomObjectVariable.FURNITURE_MANNEQUIN_NAME, data.getValue(FurnitureMannequinLogic.OUTFIT_NAME));
} }
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{
if(!event || !geometry || !this.object) return;
switch(event.type)
{
case MouseEventType.DOUBLE_CLICK:
this.useObject();
return;
}
super.mouseEvent(event, geometry);
}
public useObject(): void public useObject(): void
{ {
if(!this.eventDispatcher || !this.object) return; if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MANNEQUIN, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MANNEQUIN, this.object));
} }
} }

View File

@ -13,7 +13,7 @@ export class FurnitureMonsterplantSeedLogic extends FurnitureMultiStateLogic
public useObject(): void public useObject(): void
{ {
if(!this.eventDispatcher || !this.object) return; if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG, this.object));
} }

View File

@ -13,7 +13,7 @@ export class FurnitureMysteryBoxLogic extends FurnitureMultiStateLogic
public useObject(): void public useObject(): void
{ {
if(!this.eventDispatcher || !this.object) return; if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG, this.object));
} }

View File

@ -13,7 +13,7 @@ export class FurnitureMysteryTrophyLogic extends FurnitureMultiStateLogic
public useObject(): void public useObject(): void
{ {
if(!this.eventDispatcher || !this.object) return; if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MYSTERYTROPHY_OPEN_DIALOG, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.MYSTERYTROPHY_OPEN_DIALOG, this.object));
} }

View File

@ -1,6 +1,3 @@
import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent';
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
import { MouseEventType } from '../../../../ui/MouseEventType';
import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent'; import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent';
import { FurnitureLogic } from './FurnitureLogic'; import { FurnitureLogic } from './FurnitureLogic';
@ -13,25 +10,10 @@ export class FurnitureOneWayDoorLogic extends FurnitureLogic
return this.mergeTypes(super.getEventTypes(), types); return this.mergeTypes(super.getEventTypes(), types);
} }
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{
if(!event || !geometry || !this.object) return;
switch(event.type)
{
case MouseEventType.DOUBLE_CLICK:
this.useObject();
return;
}
super.mouseEvent(event, geometry);
}
public useObject(): void public useObject(): void
{ {
if(!this.object) return; if(!this.object || !this.eventDispatcher) return;
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.ENTER_ONEWAYDOOR, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.ENTER_ONEWAYDOOR, this.object));
} }
} }

View File

@ -1,5 +1,5 @@
import { IRoomGeometry, RoomObjectUpdateMessage, RoomSpriteMouseEvent } from '../../../../../room'; import { RoomObjectUpdateMessage } from '../../../../../room';
import { MouseEventType, RoomWidgetEnumItemExtradataParameter } from '../../../../ui'; import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui';
import { RoomObjectWidgetRequestEvent } from '../../../events'; import { RoomObjectWidgetRequestEvent } from '../../../events';
import { RoomObjectVariable } from '../../RoomObjectVariable'; import { RoomObjectVariable } from '../../RoomObjectVariable';
import { FurnitureLogic } from './FurnitureLogic'; import { FurnitureLogic } from './FurnitureLogic';
@ -25,24 +25,9 @@ export class FurniturePetCustomizationLogic extends FurnitureLogic
} }
} }
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{
if(!event || !geometry || !this.object) return;
switch(event.type)
{
case MouseEventType.DOUBLE_CLICK:
this.useObject();
return;
}
super.mouseEvent(event, geometry);
}
public useObject(): void public useObject(): void
{ {
if(!this.eventDispatcher || !this.object) return; if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PET_PRODUCT_MENU, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PET_PRODUCT_MENU, this.object));
} }

View File

@ -99,16 +99,15 @@ export class FurniturePresentLogic extends FurnitureLogic
case MouseEventType.ROLL_OUT: case MouseEventType.ROLL_OUT:
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.MOUSE_ARROW, this.object));
break; break;
case MouseEventType.DOUBLE_CLICK:
this.useObject();
return;
default:
super.mouseEvent(event, geometry);
} }
super.mouseEvent(event, geometry);
} }
public useObject(): void public useObject(): void
{ {
(this.object && this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PRESENT, this.object))); if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PRESENT, this.object));
} }
} }

View File

@ -16,7 +16,7 @@ export class FurniturePurchaseableClothingLogic extends FurnitureMultiStateLogic
public useObject(): void public useObject(): void
{ {
if(!this.eventDispatcher || !this.object) return; if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG, this.object));
} }

View File

@ -98,13 +98,14 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{ {
if(!event || !geometry || !this.object) return; if(!event || !geometry || !this.object) return;
switch(event.type) switch(event.type)
{ {
case MouseEventType.DOUBLE_CLICK: case MouseEventType.DOUBLE_CLICK:
(this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BACKGROUND_COLOR, this.object))); (this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.BACKGROUND_COLOR, this.object)));
return; return;
default:
super.mouseEvent(event, geometry);
} }
super.mouseEvent(event, geometry);
} }
} }

View File

@ -113,6 +113,8 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic
public useObject(): void public useObject(): void
{ {
if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.DIMMER, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.DIMMER, this.object));
} }
@ -137,4 +139,4 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic
} }
} }
} }
} }

View File

@ -1,8 +1,5 @@
import { IAssetData } from '../../../../../core/asset/interfaces'; import { IAssetData } from '../../../../../core/asset/interfaces';
import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent';
import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage'; import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage';
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
import { MouseEventType } from '../../../../ui/MouseEventType';
import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent'; import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent';
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
import { ObjectItemDataUpdateMessage } from '../../../messages/ObjectItemDataUpdateMessage'; import { ObjectItemDataUpdateMessage } from '../../../messages/ObjectItemDataUpdateMessage';
@ -57,22 +54,10 @@ export class FurnitureStickieLogic extends FurnitureLogic
this.object.model.setValue(RoomObjectVariable.FURNITURE_COLOR, (colorIndex + 1)); this.object.model.setValue(RoomObjectVariable.FURNITURE_COLOR, (colorIndex + 1));
} }
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{
if(!event || !geometry || !this.object) return;
switch(event.type)
{
case MouseEventType.DOUBLE_CLICK:
this.useObject();
return;
default:
super.mouseEvent(event, geometry);
}
}
public useObject(): void public useObject(): void
{ {
(this.object && this.eventDispatcher && this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.STICKIE, this.object))); if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.STICKIE, this.object));
} }
} }

View File

@ -1,6 +1,3 @@
import { RoomSpriteMouseEvent } from '../../../../../room/events/RoomSpriteMouseEvent';
import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
import { MouseEventType } from '../../../../ui/MouseEventType';
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent'; import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
import { FurnitureLogic } from './FurnitureLogic'; import { FurnitureLogic } from './FurnitureLogic';
@ -13,24 +10,10 @@ export class FurnitureTrophyLogic extends FurnitureLogic
return this.mergeTypes(super.getEventTypes(), types); return this.mergeTypes(super.getEventTypes(), types);
} }
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
{
if(!event || !geometry || !this.object) return;
switch(event.type)
{
case MouseEventType.DOUBLE_CLICK:
this.useObject();
return;
}
super.mouseEvent(event, geometry);
}
public useObject(): void public useObject(): void
{ {
if(!this.eventDispatcher || !this.object) return; if(!this.object || !this.eventDispatcher) return;
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.TROPHY, this.object)); this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.TROPHY, this.object));
} }
} }

View File

@ -229,7 +229,7 @@ export class PetLogic extends MovingObjectLogic
case MouseEventType.MOUSE_DOWN: { case MouseEventType.MOUSE_DOWN: {
const petType = this.object.model.getValue<number>(RoomObjectVariable.PET_TYPE); const petType = this.object.model.getValue<number>(RoomObjectVariable.PET_TYPE);
if(petType == PetType.MONSTERPLANT) if(petType === PetType.MONSTERPLANT)
{ {
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown)); if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown));
} }

View File

@ -365,44 +365,44 @@ export class RoomLogic extends RoomObjectLogicBase
planeId--; planeId--;
let _local_7: Point = null; let planePosition: Point = null;
const _local_8 = this._planeParser.getPlaneLocation(planeId); const planeLocation = this._planeParser.getPlaneLocation(planeId);
const _local_9 = this._planeParser.getPlaneLeftSide(planeId); const planeLeftSide = this._planeParser.getPlaneLeftSide(planeId);
const _local_10 = this._planeParser.getPlaneRightSide(planeId); const planeRightSide = this._planeParser.getPlaneRightSide(planeId);
const _local_11 = this._planeParser.getPlaneNormalDirection(planeId); const planeNormalDirection = this._planeParser.getPlaneNormalDirection(planeId);
const _local_12 = this._planeParser.getPlaneType(planeId); const planeType = this._planeParser.getPlaneType(planeId);
if(((((_local_8 == null) || (_local_9 == null)) || (_local_10 == null)) || (_local_11 == null))) return; if(((((planeLocation == null) || (planeLeftSide == null)) || (planeRightSide == null)) || (planeNormalDirection == null))) return;
const _local_13 = _local_9.length; const leftSideLength = planeLeftSide.length;
const _local_14 = _local_10.length; const rightSideLength = planeRightSide.length;
if(((_local_13 == 0) || (_local_14 == 0))) return; if(((leftSideLength == 0) || (rightSideLength == 0))) return;
const _local_15 = event.screenX; const screenX = event.screenX;
const _local_16 = event.screenY; const screenY = event.screenY;
const _local_17 = new Point(_local_15, _local_16); const screenPoint = new Point(screenX, screenY);
_local_7 = geometry.getPlanePosition(_local_17, _local_8, _local_9, _local_10); planePosition = geometry.getPlanePosition(screenPoint, planeLocation, planeLeftSide, planeRightSide);
if(!_local_7) if(!planePosition)
{ {
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0); this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_PLANE, 0);
return; return;
} }
const _local_18 = Vector3d.product(_local_9, (_local_7.x / _local_13)); const _local_18 = Vector3d.product(planeLeftSide, (planePosition.x / leftSideLength));
_local_18.add(Vector3d.product(_local_10, (_local_7.y / _local_14))); _local_18.add(Vector3d.product(planeRightSide, (planePosition.y / rightSideLength)));
_local_18.add(_local_8); _local_18.add(planeLocation);
const _local_19 = _local_18.x; const _local_19 = _local_18.x;
const _local_20 = _local_18.y; const _local_20 = _local_18.y;
const _local_21 = _local_18.z; const _local_21 = _local_18.z;
if(((((_local_7.x >= 0) && (_local_7.x < _local_13)) && (_local_7.y >= 0)) && (_local_7.y < _local_14))) 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_X, _local_19);
this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Y, _local_20); this.object.model.setValue(RoomObjectVariable.ROOM_SELECTED_Y, _local_20);
@ -428,26 +428,26 @@ export class RoomLogic extends RoomObjectLogicBase
case MouseEventType.MOUSE_CLICK: { case MouseEventType.MOUSE_CLICK: {
let newEvent: RoomObjectEvent = null; let newEvent: RoomObjectEvent = null;
if(_local_12 === RoomPlaneData.PLANE_FLOOR) 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, _local_19, _local_20, _local_21, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
} }
else if((_local_12 === RoomPlaneData.PLANE_WALL) || (_local_12 === RoomPlaneData.PLANE_LANDSCAPE)) else if((planeType === RoomPlaneData.PLANE_WALL) || (planeType === RoomPlaneData.PLANE_LANDSCAPE))
{ {
let direction = 90; let direction = 90;
if(_local_11) if(planeNormalDirection)
{ {
direction = (_local_11.x + 90); direction = (planeNormalDirection.x + 90);
if(direction > 360) direction -= 360; if(direction > 360) direction -= 360;
} }
const _local_27 = ((_local_9.length * _local_7.x) / _local_13); const _local_27 = ((planeLeftSide.length * planePosition.x) / leftSideLength);
const _local_28 = ((_local_10.length * _local_7.y) / _local_14); const _local_28 = ((planeRightSide.length * planePosition.y) / rightSideLength);
newEvent = new RoomObjectWallMouseEvent(eventType, this.object, event.eventId, _local_8, _local_9, _local_10, _local_27, _local_28, direction, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown); newEvent = new RoomObjectWallMouseEvent(eventType, this.object, event.eventId, planeLocation, planeLeftSide, planeRightSide, _local_27, _local_28, direction, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
} }
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(newEvent); if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(newEvent);