mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-22 23:50:52 +01:00
Merge remote-tracking branch 'github/nitro-v2-updates' into fix/variable-cleanup
This commit is contained in:
commit
6a8ce00266
@ -221,7 +221,7 @@ export class Nitro extends Application implements INitro
|
||||
const animationFPS = this.getConfiguration<number>('animation.fps', 24);
|
||||
const limitsFPS = this.getConfiguration<boolean>('limits.fps', true);
|
||||
|
||||
Nitro.instance.ticker.maxFPS = animationFPS;
|
||||
if(limitsFPS) Nitro.instance.ticker.maxFPS = animationFPS;
|
||||
}
|
||||
|
||||
private onRoomEngineReady(event: RoomEngineEvent): void
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration';
|
||||
import { ApproveNameMessageComposer, CatalogApproveNameResultEvent, ChangeUserNameResultMessageEvent, SellablePetPalettesEvent } from './messages';
|
||||
import { ApproveNameMessageComposer, CatalogApproveNameResultEvent, SellablePetPalettesEvent } from './messages';
|
||||
import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent';
|
||||
import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent';
|
||||
import { CatalogClubGiftsEvent } from './messages/incoming/catalog/CatalogClubGiftsEvent';
|
||||
@ -130,6 +130,7 @@ import { RoomSettingsEvent } from './messages/incoming/room/data/RoomSettingsEve
|
||||
import { RoomSettingsSavedEvent } from './messages/incoming/room/data/RoomSettingsSavedEvent';
|
||||
import { RoomSettingsUpdatedEvent } from './messages/incoming/room/data/RoomSettingsUpdatedEvent';
|
||||
import { RoomUsersWithRightsEvent } from './messages/incoming/room/data/RoomUsersWithRightsEvent';
|
||||
import { ObjectsDataUpdateEvent } from './messages/incoming/room/engine/ObjectsDataUpdateEvent';
|
||||
import { ObjectsRollingEvent } from './messages/incoming/room/engine/ObjectsRollingEvent';
|
||||
import { RoomCreatedEvent } from './messages/incoming/room/engine/RoomCreatedEvent';
|
||||
import { FurnitureFloorAddEvent } from './messages/incoming/room/furniture/floor/FurnitureFloorAddEvent';
|
||||
@ -592,6 +593,7 @@ export class NitroMessages implements IMessageConfiguration
|
||||
this._events.set(IncomingHeader.LOVELOCK_FURNI_FINISHED, LoveLockFurniFinishedEvent);
|
||||
this._events.set(IncomingHeader.LOVELOCK_FURNI_FRIEND_COMFIRMED, LoveLockFurniFriendConfirmedEvent);
|
||||
this._events.set(IncomingHeader.LOVELOCK_FURNI_START, LoveLockFurniStartEvent);
|
||||
this._events.set(IncomingHeader.OBJECTS_DATA_UPDATE, ObjectsDataUpdateEvent);
|
||||
|
||||
// FLOOR
|
||||
this._events.set(IncomingHeader.FURNITURE_FLOOR_ADD, FurnitureFloorAddEvent);
|
||||
@ -1022,3 +1024,7 @@ export class NitroMessages implements IMessageConfiguration
|
||||
return this._composers;
|
||||
}
|
||||
}
|
||||
function ChangeUserNameResultMessageEvent(USER_CHANGE_NAME: number, ChangeUserNameResultMessageEvent: any)
|
||||
{
|
||||
throw new Error('Function not implemented.');
|
||||
}
|
||||
|
@ -247,4 +247,5 @@ export class IncomingHeader
|
||||
public static MARKETPLACE_AFTER_ORDER_STATUS = 2032;
|
||||
public static CATALOG_RECEIVE_PET_BREEDS = 3331;
|
||||
public static CATALOG_APPROVE_NAME_RESULT = 1503;
|
||||
public static OBJECTS_DATA_UPDATE = 1453;
|
||||
}
|
||||
|
@ -0,0 +1,30 @@
|
||||
import { IObjectData } from '../../../../../room';
|
||||
|
||||
export class ObjectData
|
||||
{
|
||||
private _id: number = 0;
|
||||
private _state: number = 0;
|
||||
private _data: IObjectData;
|
||||
|
||||
constructor(id: number, state: number, objectData: IObjectData)
|
||||
{
|
||||
this._id = id;
|
||||
this._state = state;
|
||||
this._data = objectData;
|
||||
}
|
||||
|
||||
public get id(): number
|
||||
{
|
||||
return this._id;
|
||||
}
|
||||
|
||||
public get state(): number
|
||||
{
|
||||
return this._state;
|
||||
}
|
||||
|
||||
public get data(): IObjectData
|
||||
{
|
||||
return this._data;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
import { IMessageEvent } from '../../../../../../core/communication/messages/IMessageEvent';
|
||||
import { MessageEvent } from '../../../../../../core/communication/messages/MessageEvent';
|
||||
import { ObjectsDataUpdateParser } from '../../../parser/room/engine/ObjectsDataUpdateParser';
|
||||
|
||||
export class ObjectsDataUpdateEvent extends MessageEvent implements IMessageEvent
|
||||
{
|
||||
constructor(callBack: Function)
|
||||
{
|
||||
super(callBack, ObjectsDataUpdateParser);
|
||||
}
|
||||
|
||||
public getParser(): ObjectsDataUpdateParser
|
||||
{
|
||||
return this.parser as ObjectsDataUpdateParser;
|
||||
}
|
||||
}
|
@ -1,2 +1,4 @@
|
||||
export * from './ObjectData';
|
||||
export * from './ObjectsDataUpdateEvent';
|
||||
export * from './ObjectsRollingEvent';
|
||||
export * from './RoomCreatedEvent';
|
||||
|
@ -0,0 +1,41 @@
|
||||
import { IMessageDataWrapper } from '../../../../../../core/communication/messages/IMessageDataWrapper';
|
||||
import { IMessageParser } from '../../../../../../core/communication/messages/IMessageParser';
|
||||
import { ObjectData } from '../../../incoming/room/engine/ObjectData';
|
||||
import { FurnitureDataParser } from '../furniture/FurnitureDataParser';
|
||||
|
||||
export class ObjectsDataUpdateParser implements IMessageParser
|
||||
{
|
||||
private _objects: ObjectData[];
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._objects = [];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return false;
|
||||
|
||||
let totalObjects = wrapper.readInt();
|
||||
|
||||
while(totalObjects > 0)
|
||||
{
|
||||
const id = wrapper.readInt();
|
||||
const stuffData = FurnitureDataParser.parseObjectData(wrapper);
|
||||
const state = parseFloat(stuffData.getLegacyString());
|
||||
|
||||
this._objects.push(new ObjectData(id, state, stuffData));
|
||||
|
||||
totalObjects--;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public get objects(): ObjectData[]
|
||||
{
|
||||
return this._objects;
|
||||
}
|
||||
}
|
@ -21,7 +21,7 @@ export class ObjectsRollingParser implements IMessageParser
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return;
|
||||
if(!wrapper) return false;
|
||||
|
||||
const x = wrapper.readInt();
|
||||
const y = wrapper.readInt();
|
||||
@ -79,4 +79,4 @@ export class ObjectsRollingParser implements IMessageParser
|
||||
{
|
||||
return this._unitRolling;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ export class RoomCreatedParser implements IMessageParser
|
||||
|
||||
public parse(wrapper: IMessageDataWrapper): boolean
|
||||
{
|
||||
if(!wrapper) return;
|
||||
if(!wrapper) return false;
|
||||
|
||||
this._roomId = wrapper.readInt();
|
||||
this._roomName = wrapper.readString();
|
||||
@ -33,4 +33,4 @@ export class RoomCreatedParser implements IMessageParser
|
||||
{
|
||||
return this._roomName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,3 @@
|
||||
export * from './ObjectsDataUpdateParser';
|
||||
export * from './ObjectsRollingParser';
|
||||
export * from './RoomCreatedParser';
|
||||
|
@ -18,16 +18,16 @@ export class UserSubscriptionParser implements IMessageParser
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
this._name = null;
|
||||
this._days = 0;
|
||||
this._int1 = 0;
|
||||
this._months = 0;
|
||||
this._years = 0;
|
||||
this._hasEverBeenMember = false;
|
||||
this._isVip = false;
|
||||
this._pastClubDays = 0;
|
||||
this._pastVIPDays = 0;
|
||||
this._totalSeconds = 0;
|
||||
this._name = null;
|
||||
this._days = 0;
|
||||
this._int1 = 0;
|
||||
this._months = 0;
|
||||
this._years = 0;
|
||||
this._hasEverBeenMember = false;
|
||||
this._isVip = false;
|
||||
this._pastClubDays = 0;
|
||||
this._pastVIPDays = 0;
|
||||
this._totalSeconds = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -45,7 +45,8 @@ export class UserSubscriptionParser implements IMessageParser
|
||||
this._isVip = wrapper.readBoolean();
|
||||
this._pastClubDays = wrapper.readInt();
|
||||
this._pastVIPDays = wrapper.readInt();
|
||||
this._totalSeconds = wrapper.readInt();
|
||||
|
||||
if(wrapper.bytesAvailable) this._totalSeconds = wrapper.readInt();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -153,7 +153,48 @@ export class NitroLocalizationManager extends NitroManager implements INitroLoca
|
||||
{
|
||||
for(let i = 0; i < parameters.length; i++)
|
||||
{
|
||||
value = value.replace('%' + parameters[i] + '%', replacements[i]);
|
||||
const parameter = parameters[i];
|
||||
const replacement = replacements[i];
|
||||
|
||||
value = value.replace('%' + parameter + '%', replacement);
|
||||
|
||||
if(value.startsWith('%{'))
|
||||
{
|
||||
const regex = new RegExp('%{' + parameter.toUpperCase() + '\\|([^|]*)\\|([^|]*)\\|([^|]*)}');
|
||||
const result = value.match(regex);
|
||||
|
||||
if(!result) continue;
|
||||
|
||||
const replacementAsNumber = parseInt(replacement);
|
||||
|
||||
let indexKey = -1;
|
||||
let replace = false;
|
||||
|
||||
switch(replacementAsNumber)
|
||||
{
|
||||
case 0:
|
||||
indexKey = 1;
|
||||
break;
|
||||
case 1:
|
||||
indexKey = 2;
|
||||
break;
|
||||
case 2:
|
||||
default:
|
||||
indexKey = 3;
|
||||
replace = true;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if((indexKey === -1) || (typeof result[indexKey] === 'undefined')) continue;
|
||||
|
||||
const valueFromResults = result[indexKey];
|
||||
|
||||
if(valueFromResults)
|
||||
{
|
||||
value = valueFromResults.replace('%%', replacement);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2476,6 +2476,8 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
|
||||
else if(type === MouseEventType.MOUSE_DOWN) eventType = RoomObjectMouseEvent.MOUSE_DOWN;
|
||||
|
||||
else if(type === MouseEventType.MOUSE_DOWN_LONG) eventType = RoomObjectMouseEvent.MOUSE_DOWN_LONG;
|
||||
|
||||
else if(type === MouseEventType.MOUSE_UP) eventType = RoomObjectMouseEvent.MOUSE_UP;
|
||||
}
|
||||
|
||||
@ -2483,9 +2485,9 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
}
|
||||
}
|
||||
|
||||
this._activeRoomActiveCanvas = canvasId;
|
||||
this._activeRoomActiveCanvasMouseX = x;
|
||||
this._activeRoomActiveCanvasMouseY = y;
|
||||
this._activeRoomActiveCanvas = canvasId;
|
||||
this._activeRoomActiveCanvasMouseX = x;
|
||||
this._activeRoomActiveCanvasMouseY = y;
|
||||
}
|
||||
|
||||
private handleRoomDragging(canvas: IRoomRenderingCanvas, x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean): boolean
|
||||
@ -2506,87 +2508,81 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
else if(type === MouseEventType.MOUSE_UP)
|
||||
{
|
||||
if(type === MouseEventType.MOUSE_UP)
|
||||
if(this._activeRoomIsDragged)
|
||||
{
|
||||
if(this._activeRoomIsDragged)
|
||||
this._activeRoomIsDragged = false;
|
||||
|
||||
if(this._activeRoomWasDragged)
|
||||
{
|
||||
this._activeRoomIsDragged = false;
|
||||
const instanceData = this.getRoomInstanceData(this._activeRoomId);
|
||||
|
||||
if(this._activeRoomWasDragged)
|
||||
if(instanceData)
|
||||
{
|
||||
const instanceData = this.getRoomInstanceData(this._activeRoomId);
|
||||
const camera = instanceData.roomCamera;
|
||||
|
||||
if(instanceData)
|
||||
if(camera)
|
||||
{
|
||||
const camera = instanceData.roomCamera;
|
||||
|
||||
if(camera)
|
||||
if(this._Str_11555)
|
||||
{
|
||||
if(this._Str_11555)
|
||||
if(!camera.isMoving)
|
||||
{
|
||||
if(!camera.isMoving)
|
||||
{
|
||||
camera.centeredLocX = false;
|
||||
camera.centeredLocY = false;
|
||||
}
|
||||
|
||||
camera.resetLocation(new Vector3d(-(canvas.screenOffsetX), -(canvas.screenOffsetY)));
|
||||
camera.centeredLocX = false;
|
||||
camera.centeredLocY = false;
|
||||
}
|
||||
|
||||
if(this._roomDraggingAlwaysCenters) camera.reset();
|
||||
camera.resetLocation(new Vector3d(-(canvas.screenOffsetX), -(canvas.screenOffsetY)));
|
||||
}
|
||||
|
||||
if(this._roomDraggingAlwaysCenters) camera.reset();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
}
|
||||
|
||||
else if(type === MouseEventType.MOUSE_MOVE)
|
||||
{
|
||||
if(this._activeRoomIsDragged)
|
||||
{
|
||||
if(type === MouseEventType.MOUSE_MOVE)
|
||||
if(!this._activeRoomWasDragged)
|
||||
{
|
||||
if(this._activeRoomIsDragged)
|
||||
offsetX = (x - this._activeRoomDragStartX);
|
||||
offsetY = (y - this._activeRoomDragStartY);
|
||||
|
||||
if(((((offsetX <= -(RoomEngine.DRAG_THRESHOLD)) || (offsetX >= RoomEngine.DRAG_THRESHOLD)) || (offsetY <= -(RoomEngine.DRAG_THRESHOLD))) || (offsetY >= RoomEngine.DRAG_THRESHOLD)))
|
||||
{
|
||||
if(!this._activeRoomWasDragged)
|
||||
{
|
||||
offsetX = (x - this._activeRoomDragStartX);
|
||||
offsetY = (y - this._activeRoomDragStartY);
|
||||
|
||||
if(((((offsetX <= -(RoomEngine.DRAG_THRESHOLD)) || (offsetX >= RoomEngine.DRAG_THRESHOLD)) || (offsetY <= -(RoomEngine.DRAG_THRESHOLD))) || (offsetY >= RoomEngine.DRAG_THRESHOLD)))
|
||||
{
|
||||
this._activeRoomWasDragged = true;
|
||||
}
|
||||
|
||||
offsetX = 0;
|
||||
offsetY = 0;
|
||||
}
|
||||
|
||||
if(((!(offsetX == 0)) || (!(offsetY == 0))))
|
||||
{
|
||||
this._activeRoomDragX += offsetX;
|
||||
this._activeRoomDragY += offsetY;
|
||||
|
||||
this._activeRoomWasDragged = true;
|
||||
}
|
||||
this._activeRoomWasDragged = true;
|
||||
}
|
||||
|
||||
offsetX = 0;
|
||||
offsetY = 0;
|
||||
}
|
||||
else
|
||||
|
||||
if(((!(offsetX == 0)) || (!(offsetY == 0))))
|
||||
{
|
||||
if((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK))
|
||||
{
|
||||
this._activeRoomIsDragged = false;
|
||||
this._activeRoomDragX += offsetX;
|
||||
this._activeRoomDragY += offsetY;
|
||||
|
||||
if(this._activeRoomWasDragged)
|
||||
{
|
||||
this._activeRoomWasDragged = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
this._activeRoomWasDragged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK))
|
||||
{
|
||||
this._activeRoomIsDragged = false;
|
||||
|
||||
if(this._activeRoomWasDragged)
|
||||
{
|
||||
this._activeRoomWasDragged = false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ import { IConnection } from '../../core/communication/connections/IConnection';
|
||||
import { IVector3D } from '../../room/utils/IVector3D';
|
||||
import { Vector3d } from '../../room/utils/Vector3d';
|
||||
import { PetType } from '../avatar/pets/PetType';
|
||||
import { ObjectsDataUpdateEvent } from '../communication';
|
||||
import { ObjectsRollingEvent } from '../communication/messages/incoming/room/engine/ObjectsRollingEvent';
|
||||
import { FurnitureFloorAddEvent } from '../communication/messages/incoming/room/furniture/floor/FurnitureFloorAddEvent';
|
||||
import { FurnitureFloorEvent } from '../communication/messages/incoming/room/furniture/floor/FurnitureFloorEvent';
|
||||
@ -113,6 +114,7 @@ export class RoomMessageHandler extends Disposable
|
||||
this._connection.addMessageEvent(new RoomThicknessEvent(this.onRoomThicknessEvent.bind(this)));
|
||||
this._connection.addMessageEvent(new RoomDoorEvent(this.onRoomDoorEvent.bind(this)));
|
||||
this._connection.addMessageEvent(new ObjectsRollingEvent(this.onRoomRollingEvent.bind(this)));
|
||||
this._connection.addMessageEvent(new ObjectsDataUpdateEvent(this.onObjectsDataUpdateEvent.bind(this)));
|
||||
this._connection.addMessageEvent(new FurnitureAliasesEvent(this.onFurnitureAliasesEvent.bind(this)));
|
||||
this._connection.addMessageEvent(new FurnitureFloorAddEvent(this.onFurnitureFloorAddEvent.bind(this)));
|
||||
this._connection.addMessageEvent(new FurnitureFloorEvent(this.onFurnitureFloorEvent.bind(this)));
|
||||
@ -459,6 +461,20 @@ export class RoomMessageHandler extends Disposable
|
||||
}
|
||||
}
|
||||
|
||||
private onObjectsDataUpdateEvent(event: ObjectsDataUpdateEvent): void
|
||||
{
|
||||
if(!(event instanceof ObjectsDataUpdateEvent) || !event.connection || !this._roomCreator) return;
|
||||
|
||||
const parser = event.getParser();
|
||||
|
||||
if(!parser) return;
|
||||
|
||||
for(const object of parser.objects)
|
||||
{
|
||||
this._roomCreator.updateRoomObjectFloor(this._currentRoomId, object.id, null, null, object.state, object.data);
|
||||
}
|
||||
}
|
||||
|
||||
private onFurnitureAliasesEvent(event: FurnitureAliasesEvent): void
|
||||
{
|
||||
if(!(event instanceof FurnitureAliasesEvent) || !event.connection || !this._roomCreator) return;
|
||||
|
@ -338,6 +338,9 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
||||
case RoomObjectMouseEvent.MOUSE_DOWN:
|
||||
this.handleRoomObjectMouseDownEvent(event, roomId);
|
||||
return;
|
||||
case RoomObjectMouseEvent.MOUSE_DOWN_LONG:
|
||||
this.handleRoomObjectMouseDownLongEvent(event, roomId);
|
||||
return;
|
||||
case RoomObjectMouseEvent.MOUSE_ENTER:
|
||||
this.handleRoomObjectMouseEnterEvent(event, roomId);
|
||||
return;
|
||||
@ -605,6 +608,32 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
||||
}
|
||||
}
|
||||
|
||||
private handleRoomObjectMouseDownLongEvent(event: RoomObjectMouseEvent, roomId: number): void
|
||||
{
|
||||
if(!event) return;
|
||||
|
||||
let operation = RoomObjectOperationType.OBJECT_UNDEFINED;
|
||||
|
||||
const selectedData = this.getSelectedRoomObjectData(roomId);
|
||||
|
||||
if(selectedData) operation = selectedData.operation;
|
||||
|
||||
const category = this._roomEngine.getRoomObjectCategoryForType(event.objectType);
|
||||
|
||||
switch(operation)
|
||||
{
|
||||
case RoomObjectOperationType.OBJECT_UNDEFINED:
|
||||
if((category === RoomObjectCategory.FLOOR) || (category === RoomObjectCategory.WALL) || (event.objectType === RoomObjectUserType.MONSTER_PLANT))
|
||||
{
|
||||
if((!event.ctrlKey && !event.shiftKey) || this._Str_25211(event))
|
||||
{
|
||||
if(this._roomEngine.events) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.REQUEST_MANIPULATION, roomId, event.objectId, category));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private handleRoomObjectMouseEnterEvent(event: RoomObjectMouseEvent, roomId: number): void
|
||||
{
|
||||
const id = event.objectId;
|
||||
|
@ -2,17 +2,18 @@ import { RoomEngineEvent } from './RoomEngineEvent';
|
||||
|
||||
export class RoomEngineObjectEvent extends RoomEngineEvent
|
||||
{
|
||||
public static SELECTED: string = 'REOE_SELECTED';
|
||||
public static DESELECTED: string = 'REOE_DESELECTED';
|
||||
public static ADDED: string = 'REOE_ADDED';
|
||||
public static REMOVED: string = 'REOE_REMOVED';
|
||||
public static PLACED: string = 'REOE_PLACED';
|
||||
public static PLACED_ON_USER: string = 'REOE_PLACED_ON_USER';
|
||||
public static CONTENT_UPDATED: string = 'REOE_CONTENT_UPDATED';
|
||||
public static REQUEST_MOVE: string = 'REOE_REQUEST_MOVE';
|
||||
public static REQUEST_ROTATE: string = 'REOE_REQUEST_ROTATE';
|
||||
public static MOUSE_ENTER: string = 'REOE_MOUSE_ENTER';
|
||||
public static MOUSE_LEAVE: string = 'REOE_MOUSE_LEAVE';
|
||||
public static SELECTED: string = 'REOE_SELECTED';
|
||||
public static DESELECTED: string = 'REOE_DESELECTED';
|
||||
public static ADDED: string = 'REOE_ADDED';
|
||||
public static REMOVED: string = 'REOE_REMOVED';
|
||||
public static PLACED: string = 'REOE_PLACED';
|
||||
public static PLACED_ON_USER: string = 'REOE_PLACED_ON_USER';
|
||||
public static CONTENT_UPDATED: string = 'REOE_CONTENT_UPDATED';
|
||||
public static REQUEST_MOVE: string = 'REOE_REQUEST_MOVE';
|
||||
public static REQUEST_ROTATE: string = 'REOE_REQUEST_ROTATE';
|
||||
public static REQUEST_MANIPULATION: string = 'REOE_REQUEST_MANIPULATION';
|
||||
public static MOUSE_ENTER: string = 'REOE_MOUSE_ENTER';
|
||||
public static MOUSE_LEAVE: string = 'REOE_MOUSE_LEAVE';
|
||||
|
||||
private _objectId: number;
|
||||
private _category: number;
|
||||
@ -34,4 +35,4 @@ export class RoomEngineObjectEvent extends RoomEngineEvent
|
||||
{
|
||||
return this._category;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
|
||||
public getEventTypes(): string[]
|
||||
{
|
||||
const types = [ RoomObjectStateChangedEvent.STATE_CHANGE, RoomObjectMouseEvent.CLICK, RoomObjectMouseEvent.MOUSE_DOWN ];
|
||||
const types = [ RoomObjectStateChangedEvent.STATE_CHANGE, RoomObjectMouseEvent.CLICK, RoomObjectMouseEvent.MOUSE_DOWN, RoomObjectMouseEvent.MOUSE_DOWN_LONG ];
|
||||
|
||||
if(this.widget) types.push(RoomObjectWidgetRequestEvent.OPEN_WIDGET, RoomObjectWidgetRequestEvent.CLOSE_WIDGET);
|
||||
|
||||
@ -316,6 +316,14 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
this.eventDispatcher.dispatchEvent(mouseEvent);
|
||||
}
|
||||
return;
|
||||
case MouseEventType.MOUSE_DOWN_LONG:
|
||||
if(this.eventDispatcher)
|
||||
{
|
||||
const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_DOWN_LONG, this.object, event._Str_3463, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
|
||||
|
||||
this.eventDispatcher.dispatchEvent(mouseEvent);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,8 @@ export class MouseEventType
|
||||
public static DOUBLE_CLICK: string = 'double_click';
|
||||
public static MOUSE_MOVE: string = 'mousemove';
|
||||
public static MOUSE_DOWN: string = 'mousedown';
|
||||
public static MOUSE_DOWN_LONG: string = 'mousedown_long';
|
||||
public static MOUSE_UP: string = 'mouseup';
|
||||
public static ROLL_OVER: string = 'mouseover';
|
||||
public static ROLL_OUT: string = 'mouseout';
|
||||
}
|
||||
}
|
||||
|
@ -4,4 +4,5 @@ export class TouchEventType
|
||||
public static TOUCH_MOVE: string = 'touchmove';
|
||||
public static TOUCH_CANCEL: string = 'touchcancel';
|
||||
public static TOUCH_END: string = 'touchend';
|
||||
}
|
||||
public static TOUCH_LONG: string = 'touchlong';
|
||||
}
|
||||
|
@ -3,13 +3,14 @@ import { RoomObjectEvent } from './RoomObjectEvent';
|
||||
|
||||
export class RoomObjectMouseEvent extends RoomObjectEvent
|
||||
{
|
||||
public static CLICK: string = 'ROE_MOUSE_CLICK';
|
||||
public static DOUBLE_CLICK: string = 'ROE_MOUSE_DOUBLE_CLICK';
|
||||
public static MOUSE_MOVE: string = 'ROE_MOUSE_MOVE';
|
||||
public static MOUSE_DOWN: string = 'ROE_MOUSE_DOWN';
|
||||
public static MOUSE_UP: string = 'ROE_MOUSE_UP';
|
||||
public static MOUSE_ENTER: string = 'ROE_MOUSE_ENTER';
|
||||
public static MOUSE_LEAVE: string = 'ROE_MOUSE_LEAVE';
|
||||
public static CLICK: string = 'ROE_MOUSE_CLICK';
|
||||
public static DOUBLE_CLICK: string = 'ROE_MOUSE_DOUBLE_CLICK';
|
||||
public static MOUSE_MOVE: string = 'ROE_MOUSE_MOVE';
|
||||
public static MOUSE_DOWN: string = 'ROE_MOUSE_DOWN';
|
||||
public static MOUSE_DOWN_LONG: string = 'ROE_MOUSE_DOWN_LONG';
|
||||
public static MOUSE_UP: string = 'ROE_MOUSE_UP';
|
||||
public static MOUSE_ENTER: string = 'ROE_MOUSE_ENTER';
|
||||
public static MOUSE_LEAVE: string = 'ROE_MOUSE_LEAVE';
|
||||
|
||||
private _eventId: string = '';
|
||||
private _altKey: boolean;
|
||||
@ -96,4 +97,4 @@ export class RoomObjectMouseEvent extends RoomObjectEvent
|
||||
{
|
||||
this._spriteOffsetY = k;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,10 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
private _container: IRoomSpriteCanvasContainer;
|
||||
|
||||
private _geometry: RoomGeometry;
|
||||
private _animationFPS: number;
|
||||
private _renderTimestamp: number;
|
||||
private _totalTimeRunning: number;
|
||||
private _lastFrame: number;
|
||||
|
||||
private _master: Sprite;
|
||||
private _display: Container;
|
||||
@ -71,7 +74,10 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
this._container = container;
|
||||
|
||||
this._geometry = new RoomGeometry(scale, new Vector3d(-135, 30, 0), new Vector3d(11, 11, 5), new Vector3d(-135, 0.5, 0));
|
||||
this._animationFPS = Nitro.instance.getConfiguration<number>('animation.fps', 24);
|
||||
this._renderTimestamp = 0;
|
||||
this._totalTimeRunning = 0;
|
||||
this._lastFrame = 0;
|
||||
|
||||
this._master = null;
|
||||
this._display = null;
|
||||
@ -321,12 +327,14 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
{
|
||||
this._canvasUpdated = false;
|
||||
|
||||
this._totalTimeRunning += Nitro.instance.ticker.deltaTime;
|
||||
|
||||
if(this._totalTimeRunning === this._renderTimestamp) return;
|
||||
|
||||
if(time === -1) time = (this._renderTimestamp + 1);
|
||||
|
||||
if(!this._container || !this._geometry) return;
|
||||
|
||||
if(time === this._renderTimestamp) return;
|
||||
|
||||
if((this._width !== this._renderedWidth) || (this._height !== this._renderedHeight)) update = true;
|
||||
|
||||
if((this._display.x !== this._screenOffsetX) || (this._display.y !== this._screenOffsetY))
|
||||
@ -344,46 +352,53 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
||||
update = true;
|
||||
}
|
||||
|
||||
let spriteCount = 0;
|
||||
const frame = Math.round(this._totalTimeRunning / (60 / this._animationFPS));
|
||||
|
||||
const objects = this._container.objects;
|
||||
|
||||
if(objects.size)
|
||||
if(frame !== this._lastFrame)
|
||||
{
|
||||
for(const object of objects.values())
|
||||
this._lastFrame = frame;
|
||||
|
||||
let spriteCount = 0;
|
||||
|
||||
const objects = this._container.objects;
|
||||
|
||||
if(objects.size)
|
||||
{
|
||||
if(!object) continue;
|
||||
for(const object of objects.values())
|
||||
{
|
||||
if(!object) continue;
|
||||
|
||||
spriteCount = (spriteCount + this.renderObject(object, object.instanceId.toString(), time, update, spriteCount));
|
||||
spriteCount = (spriteCount + this.renderObject(object, object.instanceId.toString(), time, update, spriteCount));
|
||||
}
|
||||
}
|
||||
|
||||
this._sortableSprites.sort((a, b) =>
|
||||
{
|
||||
return b.z - a.z;
|
||||
});
|
||||
|
||||
if(spriteCount < this._sortableSprites.length)
|
||||
{
|
||||
this._sortableSprites.splice(spriteCount);
|
||||
}
|
||||
|
||||
let iterator = 0;
|
||||
|
||||
while(iterator < spriteCount)
|
||||
{
|
||||
const sprite = this._sortableSprites[iterator];
|
||||
|
||||
if(sprite && sprite.sprite) this.renderSprite(iterator, sprite);
|
||||
|
||||
iterator++;
|
||||
}
|
||||
|
||||
this.cleanSprites(spriteCount);
|
||||
}
|
||||
|
||||
this._sortableSprites.sort((a, b) =>
|
||||
{
|
||||
return b.z - a.z;
|
||||
});
|
||||
|
||||
if(spriteCount < this._sortableSprites.length)
|
||||
{
|
||||
this._sortableSprites.splice(spriteCount);
|
||||
}
|
||||
|
||||
let iterator = 0;
|
||||
|
||||
while(iterator < spriteCount)
|
||||
{
|
||||
const sprite = this._sortableSprites[iterator];
|
||||
|
||||
if(sprite && sprite.sprite) this.renderSprite(iterator, sprite);
|
||||
|
||||
iterator++;
|
||||
}
|
||||
|
||||
this.cleanSprites(spriteCount);
|
||||
|
||||
if(update) this._canvasUpdated = true;
|
||||
|
||||
this._renderTimestamp = time;
|
||||
this._renderTimestamp = this._totalTimeRunning;
|
||||
this._renderedWidth = this._width;
|
||||
this._renderedHeight = this._height;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user