mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-23 08:00:51 +01:00
Update logics
This commit is contained in:
parent
a1a55038b9
commit
114b560bdc
@ -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
|
||||||
|
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ 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));
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ 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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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,20 +22,6 @@ 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;
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
@ -353,17 +353,14 @@ 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
|
||||||
{
|
{
|
||||||
|
@ -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,23 +43,9 @@ 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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -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,23 +10,9 @@ 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));
|
||||||
}
|
}
|
||||||
|
@ -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));
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user