mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-19 06:46:28 +01:00
Update furniture logics
This commit is contained in:
parent
c9b34cc22f
commit
7ca4141931
@ -3,6 +3,7 @@ import { IAsset } from './IAsset';
|
|||||||
import { IAssetAlias } from './IAssetAlias';
|
import { IAssetAlias } from './IAssetAlias';
|
||||||
import { IAssetDimension } from './IAssetDimension';
|
import { IAssetDimension } from './IAssetDimension';
|
||||||
import { IAssetPalette } from './IAssetPalette';
|
import { IAssetPalette } from './IAssetPalette';
|
||||||
|
import { IPlanetSystem } from './IPlanetSystem';
|
||||||
import { ISpritesheet } from './spritesheet';
|
import { ISpritesheet } from './spritesheet';
|
||||||
import { IAssetVisualizationData } from './visualization';
|
import { IAssetVisualizationData } from './visualization';
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ export interface IAssetData {
|
|||||||
credits?: string;
|
credits?: string;
|
||||||
soundSample?: { id?: number, noPitch?: boolean };
|
soundSample?: { id?: number, noPitch?: boolean };
|
||||||
action?: { link?: string, startState?: number };
|
action?: { link?: string, startState?: number };
|
||||||
|
planetSystem?: IPlanetSystem;
|
||||||
spritesheet?: ISpritesheet;
|
spritesheet?: ISpritesheet;
|
||||||
dimensions?: IAssetDimension;
|
dimensions?: IAssetDimension;
|
||||||
directions?: number[];
|
directions?: number[];
|
||||||
|
6
src/core/asset/interfaces/IPlanetSystem.ts
Normal file
6
src/core/asset/interfaces/IPlanetSystem.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { IPlanetSystemObject } from './IPlanetSystemObject';
|
||||||
|
|
||||||
|
export interface IPlanetSystem
|
||||||
|
{
|
||||||
|
objects?: IPlanetSystemObject[];
|
||||||
|
}
|
11
src/core/asset/interfaces/IPlanetSystemObject.ts
Normal file
11
src/core/asset/interfaces/IPlanetSystemObject.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
export interface IPlanetSystemObject
|
||||||
|
{
|
||||||
|
id?: number;
|
||||||
|
name?: string;
|
||||||
|
parent?: string;
|
||||||
|
radius?: number;
|
||||||
|
arcSpeed?: number;
|
||||||
|
arcOffset?: number;
|
||||||
|
blend?: number;
|
||||||
|
height?: number;
|
||||||
|
}
|
@ -4,5 +4,7 @@ export * from './IAssetAlias';
|
|||||||
export * from './IAssetData';
|
export * from './IAssetData';
|
||||||
export * from './IAssetDimension';
|
export * from './IAssetDimension';
|
||||||
export * from './IAssetPalette';
|
export * from './IAssetPalette';
|
||||||
|
export * from './IPlanetSystem';
|
||||||
|
export * from './IPlanetSystemObject';
|
||||||
export * from './spritesheet';
|
export * from './spritesheet';
|
||||||
export * from './visualization';
|
export * from './visualization';
|
||||||
|
@ -35,7 +35,7 @@ import { RoomUnitWalkComposer } from '../communication/messages/outgoing/room/un
|
|||||||
import { Nitro } from '../Nitro';
|
import { Nitro } from '../Nitro';
|
||||||
import { MouseEventType } from '../ui/MouseEventType';
|
import { MouseEventType } from '../ui/MouseEventType';
|
||||||
import { RoomObjectPlacementSource } from './enums/RoomObjectPlacementSource';
|
import { RoomObjectPlacementSource } from './enums/RoomObjectPlacementSource';
|
||||||
import { RoomEngineRoomAdEvent, RoomEngineUseProductEvent, RoomObjectRoomAdEvent } from './events';
|
import { RoomEngineObjectPlaySoundEvent, RoomEngineRoomAdEvent, RoomEngineUseProductEvent, RoomObjectPlaySoundIdEvent, RoomObjectRoomAdEvent, RoomObjectSoundMachineEvent } from './events';
|
||||||
import { RoomEngineDimmerStateEvent } from './events/RoomEngineDimmerStateEvent';
|
import { RoomEngineDimmerStateEvent } from './events/RoomEngineDimmerStateEvent';
|
||||||
import { RoomEngineObjectEvent } from './events/RoomEngineObjectEvent';
|
import { RoomEngineObjectEvent } from './events/RoomEngineObjectEvent';
|
||||||
import { RoomEngineObjectPlacedEvent } from './events/RoomEngineObjectPlacedEvent';
|
import { RoomEngineObjectPlacedEvent } from './events/RoomEngineObjectPlacedEvent';
|
||||||
@ -243,14 +243,14 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
|||||||
{
|
{
|
||||||
case RoomObjectStateChangedEvent.STATE_CHANGE:
|
case RoomObjectStateChangedEvent.STATE_CHANGE:
|
||||||
case RoomObjectStateChangedEvent.STATE_RANDOM:
|
case RoomObjectStateChangedEvent.STATE_RANDOM:
|
||||||
this.onRoomObjectStateChangedEvent(event as RoomObjectStateChangedEvent, roomId);
|
this.onRoomObjectStateChangedEvent((event as RoomObjectStateChangedEvent), roomId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectDimmerStateUpdateEvent.DIMMER_STATE:
|
case RoomObjectDimmerStateUpdateEvent.DIMMER_STATE:
|
||||||
this.onRoomObjectDimmerStateUpdateEvent(event as RoomObjectDimmerStateUpdateEvent, roomId);
|
this.onRoomObjectDimmerStateUpdateEvent((event as RoomObjectDimmerStateUpdateEvent), roomId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectMoveEvent.POSITION_CHANGED:
|
case RoomObjectMoveEvent.POSITION_CHANGED:
|
||||||
case RoomObjectMoveEvent.OBJECT_REMOVED:
|
case RoomObjectMoveEvent.OBJECT_REMOVED:
|
||||||
this.onRoomObjectMoveEvent(event as RoomObjectMoveEvent, roomId);
|
this.handleSelectedObjectRemove((event as RoomObjectMoveEvent), roomId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectWidgetRequestEvent.OPEN_WIDGET:
|
case RoomObjectWidgetRequestEvent.OPEN_WIDGET:
|
||||||
case RoomObjectWidgetRequestEvent.CLOSE_WIDGET:
|
case RoomObjectWidgetRequestEvent.CLOSE_WIDGET:
|
||||||
@ -286,45 +286,61 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
|||||||
case RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY:
|
case RoomObjectWidgetRequestEvent.HIDE_HIGH_SCORE_DISPLAY:
|
||||||
case RoomObjectWidgetRequestEvent.INERNAL_LINK:
|
case RoomObjectWidgetRequestEvent.INERNAL_LINK:
|
||||||
case RoomObjectWidgetRequestEvent.ROOM_LINK:
|
case RoomObjectWidgetRequestEvent.ROOM_LINK:
|
||||||
this.onRoomObjectWidgetRequestEvent(event as RoomObjectWidgetRequestEvent, roomId);
|
this.onRoomObjectWidgetRequestEvent((event as RoomObjectWidgetRequestEvent), roomId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectFurnitureActionEvent.DICE_ACTIVATE:
|
case RoomObjectFurnitureActionEvent.DICE_ACTIVATE:
|
||||||
case RoomObjectFurnitureActionEvent.DICE_OFF:
|
case RoomObjectFurnitureActionEvent.DICE_OFF:
|
||||||
case RoomObjectFurnitureActionEvent.USE_HABBOWHEEL:
|
case RoomObjectFurnitureActionEvent.USE_HABBOWHEEL:
|
||||||
case RoomObjectFurnitureActionEvent.STICKIE:
|
case RoomObjectFurnitureActionEvent.STICKIE:
|
||||||
case RoomObjectFurnitureActionEvent.ENTER_ONEWAYDOOR:
|
case RoomObjectFurnitureActionEvent.ENTER_ONEWAYDOOR:
|
||||||
this.onRoomObjectFurnitureActionEvent(event as RoomObjectFurnitureActionEvent, roomId);
|
this.onRoomObjectFurnitureActionEvent((event as RoomObjectFurnitureActionEvent), roomId);
|
||||||
|
return;
|
||||||
|
case RoomObjectFurnitureActionEvent.SOUND_MACHINE_INIT:
|
||||||
|
case RoomObjectFurnitureActionEvent.SOUND_MACHINE_START:
|
||||||
|
case RoomObjectFurnitureActionEvent.SOUND_MACHINE_STOP:
|
||||||
|
case RoomObjectFurnitureActionEvent.SOUND_MACHINE_DISPOSE:
|
||||||
|
this.handleObjectSoundMachineEvent(event, roomId);
|
||||||
|
return;
|
||||||
|
case RoomObjectFurnitureActionEvent.JUKEBOX_INIT:
|
||||||
|
case RoomObjectFurnitureActionEvent.JUKEBOX_START:
|
||||||
|
case RoomObjectFurnitureActionEvent.JUKEBOX_MACHINE_STOP:
|
||||||
|
case RoomObjectFurnitureActionEvent.JUKEBOX_DISPOSE:
|
||||||
|
this.handleObjectJukeboxEvent(event, roomId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectFloorHoleEvent.ADD_HOLE:
|
case RoomObjectFloorHoleEvent.ADD_HOLE:
|
||||||
case RoomObjectFloorHoleEvent.REMOVE_HOLE:
|
case RoomObjectFloorHoleEvent.REMOVE_HOLE:
|
||||||
this.onRoomObjectFloorHoleEvent(event as RoomObjectFloorHoleEvent, roomId);
|
this.onRoomObjectFloorHoleEvent((event as RoomObjectFloorHoleEvent), roomId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK:
|
case RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK:
|
||||||
case RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK:
|
case RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK:
|
||||||
case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW:
|
case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW:
|
||||||
case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE:
|
case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE:
|
||||||
case RoomObjectRoomAdEvent.ROOM_AD_LOAD_IMAGE:
|
case RoomObjectRoomAdEvent.ROOM_AD_LOAD_IMAGE:
|
||||||
this.onRoomObjectRoomAdEvent(event as RoomObjectRoomAdEvent, roomId);
|
this.onRoomObjectRoomAdEvent((event as RoomObjectRoomAdEvent), roomId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectBadgeAssetEvent.LOAD_BADGE:
|
case RoomObjectBadgeAssetEvent.LOAD_BADGE:
|
||||||
this.onRoomObjectBadgeAssetEvent(event as RoomObjectBadgeAssetEvent, roomId);
|
this.onRoomObjectBadgeAssetEvent((event as RoomObjectBadgeAssetEvent), roomId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectFurnitureActionEvent.MOUSE_ARROW:
|
case RoomObjectFurnitureActionEvent.MOUSE_ARROW:
|
||||||
case RoomObjectFurnitureActionEvent.MOUSE_BUTTON:
|
case RoomObjectFurnitureActionEvent.MOUSE_BUTTON:
|
||||||
this.handleMousePointer(event as RoomObjectFurnitureActionEvent, roomId);
|
this.handleMousePointer((event as RoomObjectFurnitureActionEvent), roomId);
|
||||||
|
return;
|
||||||
|
case RoomObjectPlaySoundIdEvent.PLAY_SOUND:
|
||||||
|
case RoomObjectPlaySoundIdEvent.PLAY_SOUND_AT_PITCH:
|
||||||
|
this.handleRoomObjectPlaySoundEvent((event as RoomObjectPlaySoundIdEvent), roomId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectSamplePlaybackEvent.ROOM_OBJECT_INITIALIZED:
|
case RoomObjectSamplePlaybackEvent.ROOM_OBJECT_INITIALIZED:
|
||||||
case RoomObjectSamplePlaybackEvent.ROOM_OBJECT_DISPOSED:
|
case RoomObjectSamplePlaybackEvent.ROOM_OBJECT_DISPOSED:
|
||||||
case RoomObjectSamplePlaybackEvent.PLAY_SAMPLE:
|
case RoomObjectSamplePlaybackEvent.PLAY_SAMPLE:
|
||||||
case RoomObjectSamplePlaybackEvent.CHANGE_PITCH:
|
case RoomObjectSamplePlaybackEvent.CHANGE_PITCH:
|
||||||
this.handleRoomObjectSamplePlaybackEvent(event as RoomObjectSamplePlaybackEvent, roomId);
|
this.handleRoomObjectSamplePlaybackEvent((event as RoomObjectSamplePlaybackEvent), roomId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR:
|
case RoomObjectHSLColorEnableEvent.ROOM_BACKGROUND_COLOR:
|
||||||
this.onHSLColorEnableEvent(event as RoomObjectHSLColorEnableEvent, roomId);
|
this.onHSLColorEnableEvent((event as RoomObjectHSLColorEnableEvent), roomId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectDataRequestEvent.RODRE_CURRENT_USER_ID:
|
case RoomObjectDataRequestEvent.RODRE_CURRENT_USER_ID:
|
||||||
case RoomObjectDataRequestEvent.RODRE_URL_PREFIX:
|
case RoomObjectDataRequestEvent.RODRE_URL_PREFIX:
|
||||||
this.onRoomObjectDataRequestEvent(event as RoomObjectDataRequestEvent, roomId);
|
this.onRoomObjectDataRequestEvent((event as RoomObjectDataRequestEvent), roomId);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
NitroLogger.log(`Unhandled Event: ${ event.constructor.name }`, `Object ID: ${ event.object.id }`);
|
NitroLogger.log(`Unhandled Event: ${ event.constructor.name }`, `Object ID: ${ event.object.id }`);
|
||||||
@ -686,10 +702,10 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
|||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomObjectStateChangedEvent.STATE_CHANGE:
|
case RoomObjectStateChangedEvent.STATE_CHANGE:
|
||||||
this.updateRoomObjectState(roomId, event.object.id, event.object.type, event.state, false);
|
this.changeObjectState(roomId, event.object.id, event.object.type, event.state, false);
|
||||||
return;
|
return;
|
||||||
case RoomObjectStateChangedEvent.STATE_RANDOM:
|
case RoomObjectStateChangedEvent.STATE_RANDOM:
|
||||||
this.updateRoomObjectState(roomId, event.object.id, event.object.type, event.state, true);
|
this.changeObjectState(roomId, event.object.id, event.object.type, event.state, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -706,7 +722,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onRoomObjectMoveEvent(event: RoomObjectMoveEvent, roomId: number): void
|
private handleSelectedObjectRemove(event: RoomObjectMoveEvent, roomId: number): void
|
||||||
{
|
{
|
||||||
if(!event || !this._roomEngine) return;
|
if(!event || !this._roomEngine) return;
|
||||||
|
|
||||||
@ -859,6 +875,70 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
|||||||
this.useObject(roomId, event.object.id, event.object.type, event.type);
|
this.useObject(roomId, event.object.id, event.object.type, event.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private handleObjectSoundMachineEvent(event: RoomObjectEvent, roomId: number): void
|
||||||
|
{
|
||||||
|
if(!event) return;
|
||||||
|
|
||||||
|
const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType);
|
||||||
|
const selectedData = this.getSelectedRoomObjectData(roomId);
|
||||||
|
|
||||||
|
if(!selectedData)
|
||||||
|
{
|
||||||
|
if((selectedData.category === objectCategory) && (selectedData.id === event.objectId))
|
||||||
|
{
|
||||||
|
if(selectedData.operation === RoomObjectOperationType.OBJECT_PLACE) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(event.type)
|
||||||
|
{
|
||||||
|
case RoomObjectFurnitureActionEvent.SOUND_MACHINE_INIT:
|
||||||
|
this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_INIT, roomId, event.objectId, objectCategory));
|
||||||
|
return;
|
||||||
|
case RoomObjectFurnitureActionEvent.SOUND_MACHINE_START:
|
||||||
|
this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_SWITCHED_ON, roomId, event.objectId, objectCategory));
|
||||||
|
return;
|
||||||
|
case RoomObjectFurnitureActionEvent.SOUND_MACHINE_STOP:
|
||||||
|
this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_SWITCHED_OFF, roomId, event.objectId, objectCategory));
|
||||||
|
return;
|
||||||
|
case RoomObjectFurnitureActionEvent.SOUND_MACHINE_DISPOSE:
|
||||||
|
this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.SOUND_MACHINE_DISPOSE, roomId, event.objectId, objectCategory));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private handleObjectJukeboxEvent(event: RoomObjectEvent, roomId: number): void
|
||||||
|
{
|
||||||
|
if(!event) return;
|
||||||
|
|
||||||
|
const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType);
|
||||||
|
const selectedData = this.getSelectedRoomObjectData(roomId);
|
||||||
|
|
||||||
|
if(!selectedData)
|
||||||
|
{
|
||||||
|
if((selectedData.category === objectCategory) && (selectedData.id === event.objectId))
|
||||||
|
{
|
||||||
|
if(selectedData.operation === RoomObjectOperationType.OBJECT_PLACE) return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(event.type)
|
||||||
|
{
|
||||||
|
case RoomObjectFurnitureActionEvent.JUKEBOX_INIT:
|
||||||
|
this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_INIT, roomId, event.objectId, objectCategory));
|
||||||
|
return;
|
||||||
|
case RoomObjectFurnitureActionEvent.JUKEBOX_START:
|
||||||
|
this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_SWITCHED_ON, roomId, event.objectId, objectCategory));
|
||||||
|
return;
|
||||||
|
case RoomObjectFurnitureActionEvent.JUKEBOX_MACHINE_STOP:
|
||||||
|
this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_SWITCHED_OFF, roomId, event.objectId, objectCategory));
|
||||||
|
return;
|
||||||
|
case RoomObjectFurnitureActionEvent.JUKEBOX_DISPOSE:
|
||||||
|
this._roomEngine.events.dispatchEvent(new RoomObjectSoundMachineEvent(RoomObjectSoundMachineEvent.JUKEBOX_DISPOSE, roomId, event.objectId, objectCategory));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private onRoomObjectFloorHoleEvent(event: RoomObjectFloorHoleEvent, roomId: number): void
|
private onRoomObjectFloorHoleEvent(event: RoomObjectFloorHoleEvent, roomId: number): void
|
||||||
{
|
{
|
||||||
if(!event) return;
|
if(!event) return;
|
||||||
@ -940,6 +1020,21 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
|||||||
this._roomEngine.updateMousePointer(event.type, event.objectId, event.objectType);
|
this._roomEngine.updateMousePointer(event.type, event.objectId, event.objectType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private handleRoomObjectPlaySoundEvent(event: RoomObjectPlaySoundIdEvent, roomId: number): void
|
||||||
|
{
|
||||||
|
const objectCategory = this._roomEngine.getRoomObjectCategoryForType(event.objectType);
|
||||||
|
|
||||||
|
switch(event.type)
|
||||||
|
{
|
||||||
|
case RoomObjectPlaySoundIdEvent.PLAY_SOUND:
|
||||||
|
this._roomEngine.events.dispatchEvent(new RoomEngineObjectPlaySoundEvent(RoomEngineObjectPlaySoundEvent.PLAY_SOUND, roomId, event.objectId, objectCategory, event.soundId, event.pitch));
|
||||||
|
return;
|
||||||
|
case RoomObjectPlaySoundIdEvent.PLAY_SOUND_AT_PITCH:
|
||||||
|
this._roomEngine.events.dispatchEvent(new RoomEngineObjectPlaySoundEvent(RoomEngineObjectPlaySoundEvent.PLAY_SOUND_AT_PITCH, roomId, event.objectId, objectCategory, event.soundId, event.pitch));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private handleRoomObjectSamplePlaybackEvent(event: RoomObjectSamplePlaybackEvent, roomId: number): void
|
private handleRoomObjectSamplePlaybackEvent(event: RoomObjectSamplePlaybackEvent, roomId: number): void
|
||||||
{
|
{
|
||||||
if(!event) return;
|
if(!event) return;
|
||||||
@ -985,7 +1080,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
|||||||
event.object.model.setValue(RoomObjectVariable.SESSION_CURRENT_USER_ID, this._roomEngine.sessionDataManager.userId);
|
event.object.model.setValue(RoomObjectVariable.SESSION_CURRENT_USER_ID, this._roomEngine.sessionDataManager.userId);
|
||||||
return;
|
return;
|
||||||
case RoomObjectDataRequestEvent.RODRE_URL_PREFIX:
|
case RoomObjectDataRequestEvent.RODRE_URL_PREFIX:
|
||||||
event.object.model.setValue(RoomObjectVariable.SESSION_CURRENT_USER_ID, Nitro.instance.getConfiguration('url.prefix'));
|
event.object.model.setValue(RoomObjectVariable.SESSION_URL_PREFIX, Nitro.instance.getConfiguration('url.prefix'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1369,11 +1464,11 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
|||||||
return _local_11;
|
return _local_11;
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateRoomObjectState(roomId: number, objectId: number, type: string, state: number, isRandom: boolean): void
|
private changeObjectState(roomId: number, objectId: number, type: string, state: number, isRandom: boolean): void
|
||||||
{
|
{
|
||||||
const category = this._roomEngine.getRoomObjectCategoryForType(type);
|
const category = this._roomEngine.getRoomObjectCategoryForType(type);
|
||||||
|
|
||||||
this.sendStateUpdate(roomId, objectId, category, state, isRandom);
|
this.changeRoomObjectState(roomId, objectId, category, state, isRandom);
|
||||||
}
|
}
|
||||||
|
|
||||||
private useObject(roomId: number, objectId: number, type: string, action: string): void
|
private useObject(roomId: number, objectId: number, type: string, action: string): void
|
||||||
@ -1399,7 +1494,7 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private sendStateUpdate(roomId: number, objectId: number, category: number, state: number, isRandom: boolean): boolean
|
private changeRoomObjectState(roomId: number, objectId: number, category: number, state: number, isRandom: boolean): boolean
|
||||||
{
|
{
|
||||||
if(!this._roomEngine || !this._roomEngine.connection) return true;
|
if(!this._roomEngine || !this._roomEngine.connection) return true;
|
||||||
|
|
||||||
|
@ -4,14 +4,16 @@ import { IEventDispatcher } from '../../core/events/IEventDispatcher';
|
|||||||
import { IRoomObjectEventHandler } from '../../room/object/logic/IRoomObjectEventHandler';
|
import { IRoomObjectEventHandler } from '../../room/object/logic/IRoomObjectEventHandler';
|
||||||
import { IRoomObjectLogicFactory } from '../../room/object/logic/IRoomObjectLogicFactory';
|
import { IRoomObjectLogicFactory } from '../../room/object/logic/IRoomObjectLogicFactory';
|
||||||
import { RoomObjectLogicBase } from '../../room/object/logic/RoomObjectLogicBase';
|
import { RoomObjectLogicBase } from '../../room/object/logic/RoomObjectLogicBase';
|
||||||
import { FurnitureEffectBoxLogic, FurnitureLoveLockLogic, FurnitureMonsterplantSeedLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic } from './object';
|
import { FurnitureEcotronBoxLogic, FurnitureEffectBoxLogic, FurnitureGroupForumTerminalLogic, FurnitureHweenLovelockLogic, FurnitureInternalLinkLogic, FurnitureJukeboxLogic, FurnitureLoveLockLogic, FurnitureMonsterplantSeedLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurniturePlaceholderLogic, FurniturePlanetSystemLogic, FurnitureRandomStateLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic, FurnitureSongDiskLogic, FurnitureSoundMachineLogic, FurnitureWelcomeGiftLogic } from './object';
|
||||||
import { AvatarLogic } from './object/logic/avatar/AvatarLogic';
|
import { AvatarLogic } from './object/logic/avatar/AvatarLogic';
|
||||||
import { FurnitureBadgeDisplayLogic } from './object/logic/furniture/FurnitureBadgeDisplayLogic';
|
import { FurnitureBadgeDisplayLogic } from './object/logic/furniture/FurnitureBadgeDisplayLogic';
|
||||||
import { FurnitureChangeStateWhenStepOnLogic } from './object/logic/furniture/FurnitureChangeStateWhenStepOnLogic';
|
import { FurnitureChangeStateWhenStepOnLogic } from './object/logic/furniture/FurnitureChangeStateWhenStepOnLogic';
|
||||||
|
import { FurnitureClothingChangeLogic } from './object/logic/furniture/FurnitureClothingChangeLogic';
|
||||||
import { FurnitureCounterClockLogic } from './object/logic/furniture/FurnitureCounterClockLogic';
|
import { FurnitureCounterClockLogic } from './object/logic/furniture/FurnitureCounterClockLogic';
|
||||||
import { FurnitureCrackableLogic } from './object/logic/furniture/FurnitureCrackableLogic';
|
import { FurnitureCrackableLogic } from './object/logic/furniture/FurnitureCrackableLogic';
|
||||||
import { FurnitureCraftingGizmoLogic } from './object/logic/furniture/FurnitureCraftingGizmoLogic';
|
import { FurnitureCraftingGizmoLogic } from './object/logic/furniture/FurnitureCraftingGizmoLogic';
|
||||||
import { FurnitureCreditLogic } from './object/logic/furniture/FurnitureCreditLogic';
|
import { FurnitureCreditLogic } from './object/logic/furniture/FurnitureCreditLogic';
|
||||||
|
import { FurnitureCuckooClockLogic } from './object/logic/furniture/FurnitureCuckooClockLogic';
|
||||||
import { FurnitureCustomStackHeightLogic } from './object/logic/furniture/FurnitureCustomStackHeightLogic';
|
import { FurnitureCustomStackHeightLogic } from './object/logic/furniture/FurnitureCustomStackHeightLogic';
|
||||||
import { FurnitureDiceLogic } from './object/logic/furniture/FurnitureDiceLogic';
|
import { FurnitureDiceLogic } from './object/logic/furniture/FurnitureDiceLogic';
|
||||||
import { FurnitureEditableInternalLinkLogic } from './object/logic/furniture/FurnitureEditableInternalLinkLogic';
|
import { FurnitureEditableInternalLinkLogic } from './object/logic/furniture/FurnitureEditableInternalLinkLogic';
|
||||||
@ -304,6 +306,45 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
|
|||||||
case RoomObjectLogicType.FURNITURE_RANDOM_TELEPORT:
|
case RoomObjectLogicType.FURNITURE_RANDOM_TELEPORT:
|
||||||
logic = FurnitureRandomTeleportLogic;
|
logic = FurnitureRandomTeleportLogic;
|
||||||
break;
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_CLOTHING_CHANGE:
|
||||||
|
logic = FurnitureClothingChangeLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_CUCKOO_CLOCK:
|
||||||
|
logic = FurnitureCuckooClockLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_ECOTRON_BOX:
|
||||||
|
logic = FurnitureEcotronBoxLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_GROUP_FORUM_TERMINAL:
|
||||||
|
logic = FurnitureGroupForumTerminalLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_HWEEN_LOVELOCK:
|
||||||
|
logic = FurnitureHweenLovelockLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_INTERNAL_LINK:
|
||||||
|
logic = FurnitureInternalLinkLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_JUKEBOX:
|
||||||
|
logic = FurnitureJukeboxLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_PLACEHOLDER:
|
||||||
|
logic = FurniturePlaceholderLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_PLANET_SYSTEM:
|
||||||
|
logic = FurniturePlanetSystemLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_RANDOMSTATE:
|
||||||
|
logic = FurnitureRandomStateLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_SONG_DISK:
|
||||||
|
logic = FurnitureSongDiskLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_SOUND_MACHINE:
|
||||||
|
logic = FurnitureSoundMachineLogic;
|
||||||
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_WELCOME_GIFT:
|
||||||
|
logic = FurnitureWelcomeGiftLogic;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
logic = FurnitureLogic;
|
logic = FurnitureLogic;
|
||||||
break;
|
break;
|
||||||
|
28
src/nitro/room/events/RoomEngineObjectPlaySoundEvent.ts
Normal file
28
src/nitro/room/events/RoomEngineObjectPlaySoundEvent.ts
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
import { RoomEngineObjectEvent } from './RoomEngineObjectEvent';
|
||||||
|
|
||||||
|
export class RoomEngineObjectPlaySoundEvent extends RoomEngineObjectEvent
|
||||||
|
{
|
||||||
|
public static PLAY_SOUND: string = 'REOPSE_PLAY_SOUND';
|
||||||
|
public static PLAY_SOUND_AT_PITCH: string = 'REOPSE_PLAY_SOUND_AT_PITCH';
|
||||||
|
|
||||||
|
private _soundId: string;
|
||||||
|
private _pitch: number;
|
||||||
|
|
||||||
|
constructor(type: string, roomId: number, objectId: number, objectCategory: number, soundId: string, pitch: number = 1)
|
||||||
|
{
|
||||||
|
super(type, roomId, objectId, objectCategory);
|
||||||
|
|
||||||
|
this._soundId = soundId;
|
||||||
|
this._pitch = pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get soundId(): string
|
||||||
|
{
|
||||||
|
return this._soundId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get pitch(): number
|
||||||
|
{
|
||||||
|
return this._pitch;
|
||||||
|
}
|
||||||
|
}
|
29
src/nitro/room/events/RoomObjectPlaySoundIdEvent.ts
Normal file
29
src/nitro/room/events/RoomObjectPlaySoundIdEvent.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { IRoomObject } from '../../../room';
|
||||||
|
import { RoomObjectFurnitureActionEvent } from './RoomObjectFurnitureActionEvent';
|
||||||
|
|
||||||
|
export class RoomObjectPlaySoundIdEvent extends RoomObjectFurnitureActionEvent
|
||||||
|
{
|
||||||
|
public static PLAY_SOUND: string = 'ROPSIE_PLAY_SOUND';
|
||||||
|
public static PLAY_SOUND_AT_PITCH: string = 'ROPSIE_PLAY_SOUND_AT_PITCH';
|
||||||
|
|
||||||
|
private _soundId: string;
|
||||||
|
private _pitch: number;
|
||||||
|
|
||||||
|
constructor(type: string, object: IRoomObject, soundId: string, pitch: number = 1)
|
||||||
|
{
|
||||||
|
super(type, object);
|
||||||
|
|
||||||
|
this._soundId = soundId;
|
||||||
|
this._pitch = pitch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get soundId(): string
|
||||||
|
{
|
||||||
|
return this._soundId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get pitch(): number
|
||||||
|
{
|
||||||
|
return this._pitch;
|
||||||
|
}
|
||||||
|
}
|
13
src/nitro/room/events/RoomObjectSoundMachineEvent.ts
Normal file
13
src/nitro/room/events/RoomObjectSoundMachineEvent.ts
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import { RoomEngineObjectEvent } from './RoomEngineObjectEvent';
|
||||||
|
|
||||||
|
export class RoomObjectSoundMachineEvent extends RoomEngineObjectEvent
|
||||||
|
{
|
||||||
|
public static SOUND_MACHINE_INIT: string = 'ROSM_SOUND_MACHINE_INIT';
|
||||||
|
public static SOUND_MACHINE_SWITCHED_ON: string = 'ROSM_SOUND_MACHINE_SWITCHED_ON';
|
||||||
|
public static SOUND_MACHINE_SWITCHED_OFF: string = 'ROSM_SOUND_MACHINE_SWITCHED_OFF';
|
||||||
|
public static SOUND_MACHINE_DISPOSE: string = 'ROSM_SOUND_MACHINE_DISPOSE';
|
||||||
|
public static JUKEBOX_INIT: string = 'ROSM_JUKEBOX_INIT';
|
||||||
|
public static JUKEBOX_SWITCHED_ON: string = 'ROSM_JUKEBOX_SWITCHED_ON';
|
||||||
|
public static JUKEBOX_SWITCHED_OFF: string = 'ROSM_JUKEBOX_SWITCHED_OFF';
|
||||||
|
public static JUKEBOX_DISPOSE: string = 'ROSM_JUKEBOX_DISPOSE';
|
||||||
|
}
|
@ -5,6 +5,7 @@ export * from './RoomEngineEvent';
|
|||||||
export * from './RoomEngineObjectEvent';
|
export * from './RoomEngineObjectEvent';
|
||||||
export * from './RoomEngineObjectPlacedEvent';
|
export * from './RoomEngineObjectPlacedEvent';
|
||||||
export * from './RoomEngineObjectPlacedOnUserEvent';
|
export * from './RoomEngineObjectPlacedOnUserEvent';
|
||||||
|
export * from './RoomEngineObjectPlaySoundEvent';
|
||||||
export * from './RoomEngineRoomAdEvent';
|
export * from './RoomEngineRoomAdEvent';
|
||||||
export * from './RoomEngineSamplePlaybackEvent';
|
export * from './RoomEngineSamplePlaybackEvent';
|
||||||
export * from './RoomEngineTriggerWidgetEvent';
|
export * from './RoomEngineTriggerWidgetEvent';
|
||||||
@ -17,8 +18,10 @@ export * from './RoomObjectFurnitureActionEvent';
|
|||||||
export * from './RoomObjectHSLColorEnabledEvent';
|
export * from './RoomObjectHSLColorEnabledEvent';
|
||||||
export * from './RoomObjectHSLColorEnableEvent';
|
export * from './RoomObjectHSLColorEnableEvent';
|
||||||
export * from './RoomObjectMoveEvent';
|
export * from './RoomObjectMoveEvent';
|
||||||
|
export * from './RoomObjectPlaySoundIdEvent';
|
||||||
export * from './RoomObjectRoomAdEvent';
|
export * from './RoomObjectRoomAdEvent';
|
||||||
export * from './RoomObjectSamplePlaybackEvent';
|
export * from './RoomObjectSamplePlaybackEvent';
|
||||||
|
export * from './RoomObjectSoundMachineEvent';
|
||||||
export * from './RoomObjectStateChangedEvent';
|
export * from './RoomObjectStateChangedEvent';
|
||||||
export * from './RoomObjectTileMouseEvent';
|
export * from './RoomObjectTileMouseEvent';
|
||||||
export * from './RoomObjectWallMouseEvent';
|
export * from './RoomObjectWallMouseEvent';
|
||||||
|
@ -99,6 +99,9 @@ export class RoomObjectVariable
|
|||||||
public static FURNITURE_HIGHSCORE_DATA_ENTRY_BASE_USERS_: string = 'furniture_highscore_data_entry_base_users_';
|
public static FURNITURE_HIGHSCORE_DATA_ENTRY_BASE_USERS_: string = 'furniture_highscore_data_entry_base_users_';
|
||||||
public static FURNITURE_HIGHSCORE_DATA_ENTRY_BASE_SCORE_: string = 'furniture_highscore_data_entry_base_score_';
|
public static FURNITURE_HIGHSCORE_DATA_ENTRY_BASE_SCORE_: string = 'furniture_highscore_data_entry_base_score_';
|
||||||
public static FURNITURE_INTERNAL_LINK: string = 'furniture_internal_link';
|
public static FURNITURE_INTERNAL_LINK: string = 'furniture_internal_link';
|
||||||
|
public static FURNITURE_CLOTHING_BOY: string = 'furniture_clothing_boy';
|
||||||
|
public static FURNITURE_CLOTHING_GIRL: string = 'furniture_clothing_girl';
|
||||||
|
public static FURNITURE_PLANETSYSTEM_DATA: string = 'furniture_planetsystem_data';
|
||||||
public static PET_PALETTE_INDEX: string = 'pet_palette_index';
|
public static PET_PALETTE_INDEX: string = 'pet_palette_index';
|
||||||
public static PET_COLOR: string = 'pet_color';
|
public static PET_COLOR: string = 'pet_color';
|
||||||
public static PET_HEAD_ONLY: string = 'pet_head_only';
|
public static PET_HEAD_ONLY: string = 'pet_head_only';
|
||||||
|
@ -31,11 +31,11 @@ export class MovingObjectLogic extends RoomObjectLogicBase
|
|||||||
this._updateInterval = 500;
|
this._updateInterval = 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void
|
protected onDispose(): void
|
||||||
{
|
{
|
||||||
this._liftAmount = 0;
|
this._liftAmount = 0;
|
||||||
|
|
||||||
super.dispose();
|
super.onDispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public update(time: number): void
|
public update(time: number): void
|
||||||
|
@ -0,0 +1,49 @@
|
|||||||
|
import { IAssetData } from '../../../../../core';
|
||||||
|
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||||
|
import { RoomObjectWidgetRequestEvent } from '../../../events';
|
||||||
|
import { ObjectDataUpdateMessage } from '../../../messages';
|
||||||
|
import { RoomObjectVariable } from '../../RoomObjectVariable';
|
||||||
|
import { FurnitureLogic } from './FurnitureLogic';
|
||||||
|
|
||||||
|
export class FurnitureClothingChangeLogic extends FurnitureLogic
|
||||||
|
{
|
||||||
|
public getEventTypes(): string[]
|
||||||
|
{
|
||||||
|
const types = [ RoomObjectWidgetRequestEvent.CLOTHING_CHANGE ];
|
||||||
|
|
||||||
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
|
}
|
||||||
|
|
||||||
|
public initialize(asset: IAssetData): void
|
||||||
|
{
|
||||||
|
super.initialize(asset);
|
||||||
|
|
||||||
|
const furniData = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_DATA);
|
||||||
|
|
||||||
|
this.updateClothingData(furniData);
|
||||||
|
}
|
||||||
|
|
||||||
|
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||||
|
{
|
||||||
|
super.processUpdateMessage(message);
|
||||||
|
|
||||||
|
if(message instanceof ObjectDataUpdateMessage) message.data && this.updateClothingData(message.data.getLegacyString());
|
||||||
|
}
|
||||||
|
|
||||||
|
private updateClothingData(furnitureData: string): void
|
||||||
|
{
|
||||||
|
if(!furnitureData || !furnitureData.length) return;
|
||||||
|
|
||||||
|
const [ boyClothing, girlClothing ] = furnitureData.split(',');
|
||||||
|
|
||||||
|
if(boyClothing && boyClothing.length) this.object.model.setValue<string>(RoomObjectVariable.FURNITURE_CLOTHING_BOY, boyClothing);
|
||||||
|
if(girlClothing && girlClothing.length) this.object.model.setValue<string>(RoomObjectVariable.FURNITURE_CLOTHING_GIRL, girlClothing);
|
||||||
|
}
|
||||||
|
|
||||||
|
public useObject(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOTHING_CHANGE, this.object));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,38 @@
|
|||||||
|
import { RoomObjectUpdateMessage } from '../../../../../room';
|
||||||
|
import { RoomObjectPlaySoundIdEvent } from '../../../events';
|
||||||
|
import { ObjectDataUpdateMessage } from '../../../messages';
|
||||||
|
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||||
|
|
||||||
|
export class FurnitureCuckooClockLogic extends FurnitureMultiStateLogic
|
||||||
|
{
|
||||||
|
private _state: number = 1;
|
||||||
|
|
||||||
|
public getEventTypes(): string[]
|
||||||
|
{
|
||||||
|
const types = [ RoomObjectPlaySoundIdEvent.PLAY_SOUND_AT_PITCH ];
|
||||||
|
|
||||||
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
|
}
|
||||||
|
|
||||||
|
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||||
|
{
|
||||||
|
super.processUpdateMessage(message);
|
||||||
|
|
||||||
|
if(message instanceof ObjectDataUpdateMessage)
|
||||||
|
{
|
||||||
|
if((this._state !== -1) && (message.state !== this._state))
|
||||||
|
{
|
||||||
|
this.dispatchSoundEvent(this.object.location.z);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._state = message.state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private dispatchSoundEvent(height: number): void
|
||||||
|
{
|
||||||
|
const pitch = Math.pow(2, (height - 1.2));
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectPlaySoundIdEvent(RoomObjectPlaySoundIdEvent.PLAY_SOUND_AT_PITCH, this.object, 'FURNITURE_cuckoo_clock', pitch));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
|
||||||
|
import { FurnitureLogic } from './FurnitureLogic';
|
||||||
|
|
||||||
|
export class FurnitureEcotronBoxLogic extends FurnitureLogic
|
||||||
|
{
|
||||||
|
public getEventTypes(): string[]
|
||||||
|
{
|
||||||
|
const types = [
|
||||||
|
RoomObjectWidgetRequestEvent.ECOTRONBOX
|
||||||
|
];
|
||||||
|
|
||||||
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
|
}
|
||||||
|
|
||||||
|
public useObject(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.ECOTRONBOX, this.object));
|
||||||
|
}
|
||||||
|
}
|
@ -27,16 +27,16 @@ export class FurnitureEditableRoomLinkLogic extends FurnitureLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void
|
protected onDispose(): void
|
||||||
{
|
{
|
||||||
super.dispose();
|
|
||||||
|
|
||||||
if(this._timer)
|
if(this._timer)
|
||||||
{
|
{
|
||||||
clearTimeout(this._timer);
|
clearTimeout(this._timer);
|
||||||
|
|
||||||
this._timer = null;
|
this._timer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.onDispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
private setAutomaticStateIndex(state: number): void
|
private setAutomaticStateIndex(state: number): void
|
||||||
|
@ -27,14 +27,14 @@ export class FurnitureFloorHoleLogic extends FurnitureMultiStateLogic
|
|||||||
return this.mergeTypes(super.getEventTypes(), types);
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void
|
protected onDispose(): void
|
||||||
{
|
{
|
||||||
if(this._currentState === FurnitureFloorHoleLogic.STATE_HOLE)
|
if(this._currentState === FurnitureFloorHoleLogic.STATE_HOLE)
|
||||||
{
|
{
|
||||||
this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.REMOVE_HOLE, this.object));
|
this.eventDispatcher.dispatchEvent(new RoomObjectFloorHoleEvent(RoomObjectFloorHoleEvent.REMOVE_HOLE, this.object));
|
||||||
}
|
}
|
||||||
|
|
||||||
super.dispose();
|
super.onDispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public update(time: number): void
|
public update(time: number): void
|
||||||
|
@ -0,0 +1,31 @@
|
|||||||
|
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
|
||||||
|
import { RoomObjectVariable } from '../../RoomObjectVariable';
|
||||||
|
import { FurnitureGuildCustomizedLogic } from './FurnitureGuildCustomizedLogic';
|
||||||
|
|
||||||
|
export class FurnitureGroupForumTerminalLogic extends FurnitureGuildCustomizedLogic
|
||||||
|
{
|
||||||
|
public getEventTypes(): string[]
|
||||||
|
{
|
||||||
|
const types = [
|
||||||
|
RoomObjectWidgetRequestEvent.INERNAL_LINK
|
||||||
|
];
|
||||||
|
|
||||||
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected updateGroupId(id: string): void
|
||||||
|
{
|
||||||
|
super.updateGroupId(id);
|
||||||
|
|
||||||
|
this.object.model.setValue(RoomObjectVariable.FURNITURE_INTERNAL_LINK, `groupforum/${ id }`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public useObject(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object));
|
||||||
|
|
||||||
|
super.useObject();
|
||||||
|
}
|
||||||
|
}
|
@ -28,7 +28,7 @@ export class FurnitureGuildCustomizedLogic extends FurnitureMultiStateLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private updateGroupId(id: string): void
|
protected updateGroupId(id: string): void
|
||||||
{
|
{
|
||||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_GUILD_ID, parseInt(id));
|
this.object.model.setValue(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_GUILD_ID, parseInt(id));
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
import { FriendFurniEngravingWidgetType } from '../../../enums';
|
||||||
|
import { FurnitureFriendFurniLogic } from './FurnitureFriendFurniLogic';
|
||||||
|
|
||||||
|
export class FurnitureHweenLovelockLogic extends FurnitureFriendFurniLogic
|
||||||
|
{
|
||||||
|
public get engravingDialogType(): number
|
||||||
|
{
|
||||||
|
return FriendFurniEngravingWidgetType.HABBOWEEN;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,79 @@
|
|||||||
|
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 { RoomObjectVariable } from '../../RoomObjectVariable';
|
||||||
|
import { FurnitureLogic } from './FurnitureLogic';
|
||||||
|
|
||||||
|
export class FurnitureInternalLinkLogic extends FurnitureLogic
|
||||||
|
{
|
||||||
|
private _showStateOnceRendered: boolean = false;
|
||||||
|
private _updateCount: number = 0;
|
||||||
|
|
||||||
|
public getEventTypes(): string[]
|
||||||
|
{
|
||||||
|
const types = [
|
||||||
|
RoomObjectWidgetRequestEvent.INERNAL_LINK
|
||||||
|
];
|
||||||
|
|
||||||
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
|
}
|
||||||
|
|
||||||
|
public initialize(asset: IAssetData): void
|
||||||
|
{
|
||||||
|
super.initialize(asset);
|
||||||
|
|
||||||
|
if(asset.action)
|
||||||
|
{
|
||||||
|
this.object.model.setValue<string>(RoomObjectVariable.FURNITURE_INTERNAL_LINK, asset.action.link);
|
||||||
|
|
||||||
|
if(asset.action.startState === 1) this._showStateOnceRendered = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public update(time: number): void
|
||||||
|
{
|
||||||
|
super.update(time);
|
||||||
|
|
||||||
|
if(!this._showStateOnceRendered) return;
|
||||||
|
|
||||||
|
this._updateCount++;
|
||||||
|
|
||||||
|
if(this._showStateOnceRendered && (this._updateCount === 20))
|
||||||
|
{
|
||||||
|
this.setAutomaticStateIndex(1);
|
||||||
|
|
||||||
|
this._showStateOnceRendered = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private setAutomaticStateIndex(state: number): void
|
||||||
|
{
|
||||||
|
if(!this.object) return;
|
||||||
|
|
||||||
|
if(this.object.model)
|
||||||
|
{
|
||||||
|
this.object.model.setValue<number>(RoomObjectVariable.FURNITURE_AUTOMATIC_STATE_INDEX, state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||||
|
{
|
||||||
|
if(!event || !geometry) return;
|
||||||
|
|
||||||
|
if((event.type === MouseEventType.DOUBLE_CLICK) && this._showStateOnceRendered)
|
||||||
|
{
|
||||||
|
this.setAutomaticStateIndex(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
super.mouseEvent(event, geometry);
|
||||||
|
}
|
||||||
|
|
||||||
|
public useObject(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.INERNAL_LINK, this.object));
|
||||||
|
}
|
||||||
|
}
|
101
src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts
Normal file
101
src/nitro/room/object/logic/furniture/FurnitureJukeboxLogic.ts
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage';
|
||||||
|
import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui';
|
||||||
|
import { RoomObjectStateChangedEvent } from '../../../events';
|
||||||
|
import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent';
|
||||||
|
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
|
||||||
|
import { ObjectDataUpdateMessage } from '../../../messages';
|
||||||
|
import { RoomObjectVariable } from '../../RoomObjectVariable';
|
||||||
|
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||||
|
|
||||||
|
export class FurnitureJukeboxLogic extends FurnitureMultiStateLogic
|
||||||
|
{
|
||||||
|
private _disposeEventsAllowed: boolean = false;
|
||||||
|
private _isInitialized: boolean = false;
|
||||||
|
private _currentState: number = -1;
|
||||||
|
|
||||||
|
public getEventTypes(): string[]
|
||||||
|
{
|
||||||
|
const types = [
|
||||||
|
RoomObjectFurnitureActionEvent.JUKEBOX_START,
|
||||||
|
RoomObjectFurnitureActionEvent.JUKEBOX_MACHINE_STOP,
|
||||||
|
RoomObjectFurnitureActionEvent.JUKEBOX_DISPOSE,
|
||||||
|
RoomObjectFurnitureActionEvent.JUKEBOX_INIT,
|
||||||
|
RoomObjectWidgetRequestEvent.JUKEBOX_PLAYLIST_EDITOR
|
||||||
|
];
|
||||||
|
|
||||||
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onDispose(): void
|
||||||
|
{
|
||||||
|
this.requestDispose();
|
||||||
|
|
||||||
|
super.onDispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||||
|
{
|
||||||
|
super.processUpdateMessage(message);
|
||||||
|
|
||||||
|
if(this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return;
|
||||||
|
|
||||||
|
if(!this._isInitialized) this.requestInit();
|
||||||
|
|
||||||
|
this.object.model.setValue<string>(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.JUKEBOX);
|
||||||
|
|
||||||
|
if(message instanceof ObjectDataUpdateMessage)
|
||||||
|
{
|
||||||
|
const state = this.object.getState(0);
|
||||||
|
|
||||||
|
if(state !== this._currentState)
|
||||||
|
{
|
||||||
|
this._currentState = state;
|
||||||
|
|
||||||
|
if(state === 1) this.requestPlayList();
|
||||||
|
else if(state === 0) this.requestStopPlaying();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private requestInit(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this._disposeEventsAllowed = true;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_INIT, this.object));
|
||||||
|
|
||||||
|
this._isInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private requestPlayList(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this._disposeEventsAllowed = true;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_START, this.object));
|
||||||
|
}
|
||||||
|
|
||||||
|
private requestStopPlaying(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_MACHINE_STOP, this.object));
|
||||||
|
}
|
||||||
|
|
||||||
|
private requestDispose(): void
|
||||||
|
{
|
||||||
|
if(!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.JUKEBOX_DISPOSE, this.object));
|
||||||
|
}
|
||||||
|
|
||||||
|
public useObject(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.JUKEBOX_PLAYLIST_EDITOR, this.object));
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object, -1));
|
||||||
|
}
|
||||||
|
}
|
@ -133,12 +133,12 @@ export class FurnitureLogic extends MovingObjectLogic
|
|||||||
model.setValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER, 1);
|
model.setValue(RoomObjectVariable.FURNITURE_ALPHA_MULTIPLIER, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void
|
protected onDispose(): void
|
||||||
{
|
{
|
||||||
super.dispose();
|
|
||||||
|
|
||||||
this._storedRotateMessage = null;
|
this._storedRotateMessage = null;
|
||||||
this._directions = null;
|
this._directions = null;
|
||||||
|
|
||||||
|
super.onDispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public setObject(object: IRoomObjectController): void
|
public setObject(object: IRoomObjectController): void
|
||||||
@ -413,7 +413,7 @@ export class FurnitureLogic extends MovingObjectLogic
|
|||||||
|
|
||||||
public tearDown(): void
|
public tearDown(): void
|
||||||
{
|
{
|
||||||
if(this.object.model.getValue(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1)
|
if(this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1)
|
||||||
{
|
{
|
||||||
if(this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_WIDGET, this.object));
|
if(this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.CLOSE_WIDGET, this.object));
|
||||||
|
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
|
||||||
|
import { FurnitureLogic } from './FurnitureLogic';
|
||||||
|
|
||||||
|
export class FurniturePlaceholderLogic extends FurnitureLogic
|
||||||
|
{
|
||||||
|
public getEventTypes(): string[]
|
||||||
|
{
|
||||||
|
const types = [
|
||||||
|
RoomObjectWidgetRequestEvent.PLACEHOLDER
|
||||||
|
];
|
||||||
|
|
||||||
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
|
}
|
||||||
|
|
||||||
|
public useObject(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.PLACEHOLDER, this.object));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
import { IAssetData, IPlanetSystem } from '../../../../../core/asset/interfaces';
|
||||||
|
import { RoomObjectVariable } from '../../RoomObjectVariable';
|
||||||
|
import { FurnitureLogic } from './FurnitureLogic';
|
||||||
|
|
||||||
|
export class FurniturePlanetSystemLogic extends FurnitureLogic
|
||||||
|
{
|
||||||
|
public initialize(asset: IAssetData): void
|
||||||
|
{
|
||||||
|
super.initialize(asset);
|
||||||
|
|
||||||
|
if(asset.planetSystem)
|
||||||
|
{
|
||||||
|
this.object.model.setValue<IPlanetSystem>(RoomObjectVariable.FURNITURE_PLANETSYSTEM_DATA, asset.planetSystem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
import { RoomObjectStateChangedEvent } from '../../../events';
|
||||||
|
import { FurnitureLogic } from './FurnitureLogic';
|
||||||
|
|
||||||
|
export class FurnitureRandomStateLogic extends FurnitureLogic
|
||||||
|
{
|
||||||
|
public getEventTypes(): string[]
|
||||||
|
{
|
||||||
|
const types = [
|
||||||
|
RoomObjectStateChangedEvent.STATE_RANDOM
|
||||||
|
];
|
||||||
|
|
||||||
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
|
}
|
||||||
|
|
||||||
|
public useObject(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_RANDOM, this.object));
|
||||||
|
}
|
||||||
|
}
|
@ -31,7 +31,7 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic
|
|||||||
return this.mergeTypes(super.getEventTypes(), types);
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void
|
protected onDispose(): void
|
||||||
{
|
{
|
||||||
if(this._roomColorUpdated)
|
if(this._roomColorUpdated)
|
||||||
{
|
{
|
||||||
@ -48,7 +48,7 @@ export class FurnitureRoomBackgroundColorLogic extends FurnitureMultiStateLogic
|
|||||||
this._roomColorUpdated = false;
|
this._roomColorUpdated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.dispose();
|
super.onDispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||||
|
@ -27,7 +27,7 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic
|
|||||||
return this.mergeTypes(super.getEventTypes(), types);
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void
|
protected onDispose(): void
|
||||||
{
|
{
|
||||||
if(this._roomColorUpdated)
|
if(this._roomColorUpdated)
|
||||||
{
|
{
|
||||||
@ -45,7 +45,7 @@ export class FurnitureRoomDimmerLogic extends FurnitureLogic
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.dispose();
|
super.onDispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage';
|
||||||
|
import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui';
|
||||||
|
import { RoomObjectVariable } from '../../RoomObjectVariable';
|
||||||
|
import { FurnitureLogic } from './FurnitureLogic';
|
||||||
|
|
||||||
|
export class FurnitureSongDiskLogic extends FurnitureLogic
|
||||||
|
{
|
||||||
|
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||||
|
{
|
||||||
|
super.processUpdateMessage(message);
|
||||||
|
|
||||||
|
if(this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1)
|
||||||
|
{
|
||||||
|
const extras = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_EXTRAS);
|
||||||
|
const diskId = parseInt(extras);
|
||||||
|
|
||||||
|
this.object.model.setValue<string>(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, (RoomWidgetEnumItemExtradataParameter.SONGDISK + diskId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,20 +11,10 @@ export class FurnitureSoundBlockLogic extends FurnitureMultiStateLogic
|
|||||||
private static LOWEST_SEMITONE: number = -12;
|
private static LOWEST_SEMITONE: number = -12;
|
||||||
private static STATE_UNINITIALIZED: number = -1;
|
private static STATE_UNINITIALIZED: number = -1;
|
||||||
|
|
||||||
private _state: number;
|
private _state: number = -1;
|
||||||
private _sampleId: number;
|
private _sampleId: number = -1;
|
||||||
private _noPitch: boolean;
|
private _noPitch: boolean = false;
|
||||||
private _lastLocZ: number;
|
private _lastLocZ: number = 0;
|
||||||
|
|
||||||
constructor()
|
|
||||||
{
|
|
||||||
super();
|
|
||||||
|
|
||||||
this._state = -1;
|
|
||||||
this._sampleId = -1;
|
|
||||||
this._noPitch = false;
|
|
||||||
this._lastLocZ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getEventTypes(): string[]
|
public getEventTypes(): string[]
|
||||||
{
|
{
|
||||||
@ -47,17 +37,17 @@ export class FurnitureSoundBlockLogic extends FurnitureMultiStateLogic
|
|||||||
this._sampleId = asset.soundSample.id;
|
this._sampleId = asset.soundSample.id;
|
||||||
this._noPitch = asset.soundSample.noPitch;
|
this._noPitch = asset.soundSample.noPitch;
|
||||||
|
|
||||||
this.updateModel();
|
this.object.model.setValue(RoomObjectVariable.FURNITURE_SOUNDBLOCK_RELATIVE_ANIMATION_SPEED, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose(): void
|
protected onDispose(): void
|
||||||
{
|
{
|
||||||
super.dispose();
|
|
||||||
|
|
||||||
if(this._state !== FurnitureSoundBlockLogic.STATE_UNINITIALIZED)
|
if(this._state !== FurnitureSoundBlockLogic.STATE_UNINITIALIZED)
|
||||||
{
|
{
|
||||||
this.eventDispatcher.dispatchEvent(new RoomObjectSamplePlaybackEvent(RoomObjectSamplePlaybackEvent.ROOM_OBJECT_DISPOSED, this.object, this._sampleId));
|
this.eventDispatcher.dispatchEvent(new RoomObjectSamplePlaybackEvent(RoomObjectSamplePlaybackEvent.ROOM_OBJECT_DISPOSED, this.object, this._sampleId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.onDispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||||
@ -100,34 +90,26 @@ export class FurnitureSoundBlockLogic extends FurnitureMultiStateLogic
|
|||||||
this._state = message.state;
|
this._state = message.state;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected updateModel(): boolean
|
private playSoundAt(height: number): void
|
||||||
{
|
{
|
||||||
const model = this.object && this.object.model;
|
if(!this.object) return;
|
||||||
|
|
||||||
if(!model) return false;
|
const pitch: number = this.getPitchForHeight(height);
|
||||||
|
|
||||||
model.setValue(RoomObjectVariable.FURNITURE_SOUNDBLOCK_RELATIVE_ANIMATION_SPEED, 1);
|
this.object.model.setValue(RoomObjectVariable.FURNITURE_SOUNDBLOCK_RELATIVE_ANIMATION_SPEED, pitch);
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectSamplePlaybackEvent(RoomObjectSamplePlaybackEvent.PLAY_SAMPLE, this.object, this._sampleId, pitch));
|
||||||
}
|
}
|
||||||
|
|
||||||
private playSoundAt(k: number): void
|
private getPitchForHeight(height: number): number
|
||||||
{
|
{
|
||||||
const model = this.object && this.object.model;
|
let heightScaled: number = (height * 2);
|
||||||
|
|
||||||
if(!model) return;
|
if(heightScaled > FurnitureSoundBlockLogic.HIGHEST_SEMITONE)
|
||||||
|
{
|
||||||
const _local_2: number = this.getPitchForHeight(k);
|
heightScaled = Math.min(0, (FurnitureSoundBlockLogic.LOWEST_SEMITONE + ((heightScaled - FurnitureSoundBlockLogic.HIGHEST_SEMITONE) - 1)));
|
||||||
|
|
||||||
model.setValue(RoomObjectVariable.FURNITURE_SOUNDBLOCK_RELATIVE_ANIMATION_SPEED, _local_2);
|
|
||||||
this.eventDispatcher.dispatchEvent(new RoomObjectSamplePlaybackEvent(RoomObjectSamplePlaybackEvent.PLAY_SAMPLE, this.object, this._sampleId, _local_2));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private getPitchForHeight(k: number): number
|
return (this._noPitch) ? 1 : Math.pow(2, (heightScaled / 12));
|
||||||
{
|
|
||||||
let _local_2: number = (k * 2);
|
|
||||||
if(_local_2 > FurnitureSoundBlockLogic.HIGHEST_SEMITONE)
|
|
||||||
{
|
|
||||||
_local_2 = Math.min(0, (FurnitureSoundBlockLogic.LOWEST_SEMITONE + ((_local_2 - FurnitureSoundBlockLogic.HIGHEST_SEMITONE) - 1)));
|
|
||||||
}
|
|
||||||
return (this._noPitch) ? 1 : Math.pow(2, (_local_2 / 12));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,90 @@
|
|||||||
|
import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage';
|
||||||
|
import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui';
|
||||||
|
import { RoomObjectFurnitureActionEvent } from '../../../events/RoomObjectFurnitureActionEvent';
|
||||||
|
import { ObjectDataUpdateMessage } from '../../../messages';
|
||||||
|
import { RoomObjectVariable } from '../../RoomObjectVariable';
|
||||||
|
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||||
|
|
||||||
|
export class FurnitureSoundMachineLogic extends FurnitureMultiStateLogic
|
||||||
|
{
|
||||||
|
private _disposeEventsAllowed: boolean = false;
|
||||||
|
private _isInitialized: boolean = false;
|
||||||
|
private _currentState: number = -1;
|
||||||
|
|
||||||
|
public getEventTypes(): string[]
|
||||||
|
{
|
||||||
|
const types = [
|
||||||
|
RoomObjectFurnitureActionEvent.SOUND_MACHINE_START,
|
||||||
|
RoomObjectFurnitureActionEvent.SOUND_MACHINE_STOP,
|
||||||
|
RoomObjectFurnitureActionEvent.SOUND_MACHINE_DISPOSE,
|
||||||
|
RoomObjectFurnitureActionEvent.SOUND_MACHINE_INIT
|
||||||
|
];
|
||||||
|
|
||||||
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected onDispose(): void
|
||||||
|
{
|
||||||
|
this.requestDispose();
|
||||||
|
|
||||||
|
super.onDispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||||
|
{
|
||||||
|
super.processUpdateMessage(message);
|
||||||
|
|
||||||
|
if(this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) !== 1) return;
|
||||||
|
|
||||||
|
if(!this._isInitialized) this.requestInit();
|
||||||
|
|
||||||
|
this.object.model.setValue<string>(RoomWidgetEnumItemExtradataParameter.INFOSTAND_EXTRA_PARAM, RoomWidgetEnumItemExtradataParameter.JUKEBOX);
|
||||||
|
|
||||||
|
if(message instanceof ObjectDataUpdateMessage)
|
||||||
|
{
|
||||||
|
const state = this.object.getState(0);
|
||||||
|
|
||||||
|
if(state !== this._currentState)
|
||||||
|
{
|
||||||
|
this._currentState = state;
|
||||||
|
|
||||||
|
if(state === 1) this.requestPlayList();
|
||||||
|
else if(state === 0) this.requestStopPlaying();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private requestInit(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this._disposeEventsAllowed = true;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_INIT, this.object));
|
||||||
|
|
||||||
|
this._isInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private requestPlayList(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this._disposeEventsAllowed = true;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_START, this.object));
|
||||||
|
}
|
||||||
|
|
||||||
|
private requestStopPlaying(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_STOP, this.object));
|
||||||
|
}
|
||||||
|
|
||||||
|
private requestDispose(): void
|
||||||
|
{
|
||||||
|
if(!this._disposeEventsAllowed || !this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectFurnitureActionEvent(RoomObjectFurnitureActionEvent.SOUND_MACHINE_DISPOSE, this.object));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
import { IRoomGeometry, RoomSpriteMouseEvent } from '../../../../../room';
|
||||||
|
import { MouseEventType } from '../../../../ui';
|
||||||
|
import { RoomObjectStateChangedEvent } from '../../../events';
|
||||||
|
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||||
|
|
||||||
|
export class FurnitureWelcomeGiftLogic extends FurnitureMultiStateLogic
|
||||||
|
{
|
||||||
|
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||||
|
{
|
||||||
|
if(!event || !geometry) return;
|
||||||
|
|
||||||
|
if(event.type === MouseEventType.DOUBLE_CLICK)
|
||||||
|
{
|
||||||
|
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object));
|
||||||
|
}
|
||||||
|
|
||||||
|
super.mouseEvent(event, geometry);
|
||||||
|
}
|
||||||
|
}
|
@ -6,6 +6,7 @@ export * from './FurnitureCraftingGizmoLogic';
|
|||||||
export * from './FurnitureCreditLogic';
|
export * from './FurnitureCreditLogic';
|
||||||
export * from './FurnitureCustomStackHeightLogic';
|
export * from './FurnitureCustomStackHeightLogic';
|
||||||
export * from './FurnitureDiceLogic';
|
export * from './FurnitureDiceLogic';
|
||||||
|
export * from './FurnitureEcotronBoxLogic';
|
||||||
export * from './FurnitureEditableInternalLinkLogic';
|
export * from './FurnitureEditableInternalLinkLogic';
|
||||||
export * from './FurnitureEditableRoomLinkLogic';
|
export * from './FurnitureEditableRoomLinkLogic';
|
||||||
export * from './FurnitureEffectBoxLogic';
|
export * from './FurnitureEffectBoxLogic';
|
||||||
@ -13,11 +14,15 @@ export * from './FurnitureExternalImageLogic';
|
|||||||
export * from './FurnitureFireworksLogic';
|
export * from './FurnitureFireworksLogic';
|
||||||
export * from './FurnitureFloorHoleLogic';
|
export * from './FurnitureFloorHoleLogic';
|
||||||
export * from './FurnitureFriendFurniLogic';
|
export * from './FurnitureFriendFurniLogic';
|
||||||
|
export * from './FurnitureGroupForumTerminalLogic';
|
||||||
export * from './FurnitureGuildCustomizedLogic';
|
export * from './FurnitureGuildCustomizedLogic';
|
||||||
export * from './FurnitureHabboWheelLogic';
|
export * from './FurnitureHabboWheelLogic';
|
||||||
export * from './FurnitureHighScoreLogic';
|
export * from './FurnitureHighScoreLogic';
|
||||||
export * from './FurnitureHockeyScoreLogic';
|
export * from './FurnitureHockeyScoreLogic';
|
||||||
|
export * from './FurnitureHweenLovelockLogic';
|
||||||
export * from './FurnitureIceStormLogic';
|
export * from './FurnitureIceStormLogic';
|
||||||
|
export * from './FurnitureInternalLinkLogic';
|
||||||
|
export * from './FurnitureJukeboxLogic';
|
||||||
export * from './FurnitureLogic';
|
export * from './FurnitureLogic';
|
||||||
export * from './FurnitureLoveLockLogic';
|
export * from './FurnitureLoveLockLogic';
|
||||||
export * from './FurnitureMannequinLogic';
|
export * from './FurnitureMannequinLogic';
|
||||||
@ -28,9 +33,12 @@ export * from './FurnitureMysteryBoxLogic';
|
|||||||
export * from './FurnitureMysteryTrophyLogic';
|
export * from './FurnitureMysteryTrophyLogic';
|
||||||
export * from './FurnitureOneWayDoorLogic';
|
export * from './FurnitureOneWayDoorLogic';
|
||||||
export * from './FurniturePetCustomizationLogic';
|
export * from './FurniturePetCustomizationLogic';
|
||||||
|
export * from './FurniturePlaceholderLogic';
|
||||||
|
export * from './FurniturePlanetSystemLogic';
|
||||||
export * from './FurniturePresentLogic';
|
export * from './FurniturePresentLogic';
|
||||||
export * from './FurniturePurchaseableClothingLogic';
|
export * from './FurniturePurchaseableClothingLogic';
|
||||||
export * from './FurniturePushableLogic';
|
export * from './FurniturePushableLogic';
|
||||||
|
export * from './FurnitureRandomStateLogic';
|
||||||
export * from './FurnitureRandomTeleportLogic';
|
export * from './FurnitureRandomTeleportLogic';
|
||||||
export * from './FurnitureRentableSpaceLogic';
|
export * from './FurnitureRentableSpaceLogic';
|
||||||
export * from './FurnitureRoomBackgroundColorLogic';
|
export * from './FurnitureRoomBackgroundColorLogic';
|
||||||
@ -39,10 +47,13 @@ export * from './FurnitureRoomBillboardLogic';
|
|||||||
export * from './FurnitureRoomBrandingLogic';
|
export * from './FurnitureRoomBrandingLogic';
|
||||||
export * from './FurnitureRoomDimmerLogic';
|
export * from './FurnitureRoomDimmerLogic';
|
||||||
export * from './FurnitureScoreLogic';
|
export * from './FurnitureScoreLogic';
|
||||||
|
export * from './FurnitureSongDiskLogic';
|
||||||
export * from './FurnitureSoundBlockLogic';
|
export * from './FurnitureSoundBlockLogic';
|
||||||
|
export * from './FurnitureSoundMachineLogic';
|
||||||
export * from './FurnitureStickieLogic';
|
export * from './FurnitureStickieLogic';
|
||||||
export * from './FurnitureTrophyLogic';
|
export * from './FurnitureTrophyLogic';
|
||||||
export * from './FurnitureVoteCounterLogic';
|
export * from './FurnitureVoteCounterLogic';
|
||||||
export * from './FurnitureVoteMajorityLogic';
|
export * from './FurnitureVoteMajorityLogic';
|
||||||
|
export * from './FurnitureWelcomeGiftLogic';
|
||||||
export * from './FurnitureWindowLogic';
|
export * from './FurnitureWindowLogic';
|
||||||
export * from './FurnitureYoutubeLogic';
|
export * from './FurnitureYoutubeLogic';
|
||||||
|
Loading…
Reference in New Issue
Block a user