mirror of
https://github.com/duckietm/Nitro-Cool-UI-Renderer.git
synced 2025-06-21 15:06:58 +00:00
🆙 added latest changes
This commit is contained in:
parent
d5a3a05c40
commit
bd09ea8b25
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,8 +1,9 @@
|
|||||||
mpiled output
|
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||||
|
|
||||||
|
# compiled output
|
||||||
/dist
|
/dist
|
||||||
/tmp
|
/tmp
|
||||||
/out-tsc
|
/out-tsc
|
||||||
|
|
||||||
# Only exists if Bazel was run
|
# Only exists if Bazel was run
|
||||||
/bazel-out
|
/bazel-out
|
||||||
|
|
||||||
|
155
eslint.config.js
Normal file
155
eslint.config.js
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
// @ts-check
|
||||||
|
|
||||||
|
import eslint from '@eslint/js';
|
||||||
|
import path from 'path';
|
||||||
|
import tseslint from 'typescript-eslint';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
|
||||||
|
export default tseslint.config(
|
||||||
|
eslint.configs.recommended,
|
||||||
|
...tseslint.configs.recommendedTypeChecked,
|
||||||
|
{
|
||||||
|
languageOptions: {
|
||||||
|
parserOptions: {
|
||||||
|
project: ['./tsconfig.json','./packages/*/tsconfig.json'],
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
'indent': [
|
||||||
|
'error',
|
||||||
|
4,
|
||||||
|
{
|
||||||
|
'SwitchCase': 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'no-multi-spaces': [
|
||||||
|
'error'
|
||||||
|
],
|
||||||
|
'no-trailing-spaces': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'skipBlankLines': false,
|
||||||
|
'ignoreComments': true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'linebreak-style': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'quotes': [
|
||||||
|
'error',
|
||||||
|
'single'
|
||||||
|
],
|
||||||
|
'semi': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'brace-style': [
|
||||||
|
'error',
|
||||||
|
'allman'
|
||||||
|
],
|
||||||
|
'object-curly-spacing': [
|
||||||
|
'error',
|
||||||
|
'always'
|
||||||
|
],
|
||||||
|
'keyword-spacing': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'overrides':
|
||||||
|
{
|
||||||
|
'if':
|
||||||
|
{
|
||||||
|
'after': false
|
||||||
|
},
|
||||||
|
'for':
|
||||||
|
{
|
||||||
|
'after': false
|
||||||
|
},
|
||||||
|
'while':
|
||||||
|
{
|
||||||
|
'after': false
|
||||||
|
},
|
||||||
|
'switch':
|
||||||
|
{
|
||||||
|
'after': false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-explicit-any': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-unsafe-assignment': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-unsafe-call': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-unsafe-member-access': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-floating-promises': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'@typescript-eslint/require-await': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-unsafe-argument': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-unsafe-return': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'@typescript-eslint/explicit-module-boundary-types': [
|
||||||
|
'off',
|
||||||
|
{
|
||||||
|
'allowedNames': [
|
||||||
|
'getMessageArray'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@typescript-eslint/unbound-method': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'@typescript-eslint/ban-ts-comment': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-empty-function': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'allow': [
|
||||||
|
'functions',
|
||||||
|
'arrowFunctions',
|
||||||
|
'generatorFunctions',
|
||||||
|
'methods',
|
||||||
|
'generatorMethods',
|
||||||
|
'constructors'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'@typescript-eslint/no-unused-vars': [
|
||||||
|
'off'
|
||||||
|
],
|
||||||
|
'@typescript-eslint/ban-types': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
'types':
|
||||||
|
{
|
||||||
|
'String': true,
|
||||||
|
'Boolean': true,
|
||||||
|
'Number': true,
|
||||||
|
'Symbol': true,
|
||||||
|
'{}': false,
|
||||||
|
'Object': false,
|
||||||
|
'object': false,
|
||||||
|
'Function': false
|
||||||
|
},
|
||||||
|
'extendDefaults': true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
17
package.json
17
package.json
@ -22,26 +22,29 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
||||||
"eslint": "eslint ./src --fix"
|
"eslint": "eslint ./src ./packages/*/src",
|
||||||
|
"eslint-fix": "eslint ./src --fix"
|
||||||
|
|
||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"howler": "^2.2.4",
|
"howler": "^2.2.4",
|
||||||
"pako": "^2.1.0",
|
"pako": "^2.1.0",
|
||||||
"pixi-filters": "^6.0.0",
|
"pixi-filters": "^6.0.4",
|
||||||
"pixi.js": "~8.0.4",
|
"pixi.js": "^8.1.6",
|
||||||
"@pixi/gif": "^3.0.0",
|
|
||||||
"clientjs": "^0.2.1"
|
"clientjs": "^0.2.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@eslint/js": "^9.5.0",
|
||||||
"@rollup/plugin-typescript": "^11.1.6",
|
"@rollup/plugin-typescript": "^11.1.6",
|
||||||
|
"@types/eslint__js": "^8.42.3",
|
||||||
"@types/howler": "^2.2.11",
|
"@types/howler": "^2.2.11",
|
||||||
|
"@types/node": "^20.14.4",
|
||||||
"@types/pako": "^2.0.3",
|
"@types/pako": "^2.0.3",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
"eslint": "^9.5.0",
|
||||||
"@typescript-eslint/parser": "^7.1.1",
|
|
||||||
"eslint": "^8.57.0",
|
|
||||||
"tslib": "^2.3.1",
|
"tslib": "^2.3.1",
|
||||||
"typescript": "~5.4.2",
|
"typescript": "~5.4.2",
|
||||||
|
"typescript-eslint": "^7.13.1",
|
||||||
"vite": "^5.1.3"
|
"vite": "^5.1.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,13 +8,11 @@
|
|||||||
},
|
},
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"compile": "tsc --project ./tsconfig.json --noEmit false"
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
|
||||||
"eslint": "eslint ./src --fix"
|
|
||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"pixi.js": "^8.1.0"
|
"pixi.js": "^8.1.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "~5.4.2"
|
"typescript": "~5.4.2"
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
export interface IAvatarEffectListener
|
export interface IAvatarEffectListener
|
||||||
{
|
{
|
||||||
resetEffect(effect: number): void;
|
resetEffect(effect: number): void;
|
||||||
|
disposed: boolean;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import { IRoomCameraWidgetSelectedEffect } from './IRoomCameraWidgetSelectedEffe
|
|||||||
export interface IRoomCameraWidgetManager
|
export interface IRoomCameraWidgetManager
|
||||||
{
|
{
|
||||||
init(): Promise<void>;
|
init(): Promise<void>;
|
||||||
applyEffects(texture: Texture, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): Promise<HTMLImageElement>;
|
applyEffects(texture: Texture, effects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): Promise<HTMLImageElement>;
|
||||||
effects: Map<string, IRoomCameraWidgetEffect>;
|
effects: Map<string, IRoomCameraWidgetEffect>;
|
||||||
isLoaded: boolean;
|
isLoaded: boolean;
|
||||||
}
|
}
|
||||||
|
@ -3,5 +3,5 @@ import { IRoomCameraWidgetEffect } from './IRoomCameraWidgetEffect';
|
|||||||
export interface IRoomCameraWidgetSelectedEffect
|
export interface IRoomCameraWidgetSelectedEffect
|
||||||
{
|
{
|
||||||
effect: IRoomCameraWidgetEffect;
|
effect: IRoomCameraWidgetEffect;
|
||||||
alpha: number;
|
strength: number;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ export interface IRoomCreator
|
|||||||
updateRoomInstancePlaneVisibility(roomId: number, wallVisible: boolean, floorVisible?: boolean): boolean;
|
updateRoomInstancePlaneVisibility(roomId: number, wallVisible: boolean, floorVisible?: boolean): boolean;
|
||||||
updateRoomInstancePlaneThickness(roomId: number, wallThickness: number, floorThickness: number): boolean;
|
updateRoomInstancePlaneThickness(roomId: number, wallThickness: number, floorThickness: number): boolean;
|
||||||
updateRoomInstancePlaneType(roomId: number, floorType?: string, wallType?: string, landscapeType?: string, _arg_5?: boolean): boolean;
|
updateRoomInstancePlaneType(roomId: number, floorType?: string, wallType?: string, landscapeType?: string, _arg_5?: boolean): boolean;
|
||||||
|
updateAreaHide(roomId: number, furniId: number, on: boolean, rootX: number, rootY: number, width: number, length: number, invert: boolean): boolean;
|
||||||
removeRoomInstance(roomId: number): void;
|
removeRoomInstance(roomId: number): void;
|
||||||
createRoomInstance(roomId: number, roomMap: IRoomMapData): void;
|
createRoomInstance(roomId: number, roomMap: IRoomMapData): void;
|
||||||
setRoomSessionOwnUser(roomId: number, objectId: number): void;
|
setRoomSessionOwnUser(roomId: number, objectId: number): void;
|
||||||
|
@ -24,6 +24,7 @@ export interface IRoomEngine
|
|||||||
updateRoomInstancePlaneVisibility(roomId: number, wallVisible: boolean, floorVisible?: boolean): boolean;
|
updateRoomInstancePlaneVisibility(roomId: number, wallVisible: boolean, floorVisible?: boolean): boolean;
|
||||||
updateRoomInstancePlaneThickness(roomId: number, wallThickness: number, floorThickness: number): boolean;
|
updateRoomInstancePlaneThickness(roomId: number, wallThickness: number, floorThickness: number): boolean;
|
||||||
updateRoomInstancePlaneType(roomId: number, floorType?: string, wallType?: string, landscapeType?: string, _arg_5?: boolean): boolean;
|
updateRoomInstancePlaneType(roomId: number, floorType?: string, wallType?: string, landscapeType?: string, _arg_5?: boolean): boolean;
|
||||||
|
updateAreaHide(roomId: number, furniId: number, on: boolean, rootX: number, rootY: number, width: number, length: number, invert: boolean): boolean;
|
||||||
updateObjectRoomColor(k: number, _arg_2: number, _arg_3: number, _arg_4: boolean): boolean;
|
updateObjectRoomColor(k: number, _arg_2: number, _arg_3: number, _arg_4: boolean): boolean;
|
||||||
getRoomInstanceGeometry(roomId: number, canvasId?: number): IRoomGeometry;
|
getRoomInstanceGeometry(roomId: number, canvasId?: number): IRoomGeometry;
|
||||||
getRoomInstanceVariable<T>(roomId: number, key: string): T;
|
getRoomInstanceVariable<T>(roomId: number, key: string): T;
|
||||||
@ -81,9 +82,12 @@ export interface IRoomEngine
|
|||||||
saveTextureAsScreenshot(texture: RenderTexture, saveAsThumbnail?: boolean): Promise<void>;
|
saveTextureAsScreenshot(texture: RenderTexture, saveAsThumbnail?: boolean): Promise<void>;
|
||||||
saveBase64AsScreenshot(base64: string, saveAsThumbnail?: boolean): void;
|
saveBase64AsScreenshot(base64: string, saveAsThumbnail?: boolean): void;
|
||||||
deleteRoomObject(objectId: number, objectCategory: number): boolean;
|
deleteRoomObject(objectId: number, objectCategory: number): boolean;
|
||||||
roomManager: IRoomManager;
|
readonly roomManager: IRoomManager;
|
||||||
objectEventHandler: IRoomObjectEventManager;
|
readonly objectEventHandler: IRoomObjectEventManager;
|
||||||
activeRoomId: number;
|
readonly activeRoomId: number;
|
||||||
selectedAvatarId: number;
|
readonly selectedAvatarId: number;
|
||||||
isDecorating: boolean;
|
readonly isDecorating: boolean;
|
||||||
|
moveBlocked: boolean;
|
||||||
|
isAreaSelectionMode(): boolean;
|
||||||
|
whereYouClickIsWhereYouGo(): boolean;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import { IRoomInstance, IRoomObjectController, IRoomRenderingCanvas } from '../.
|
|||||||
import { IVector3D } from '../../utils';
|
import { IVector3D } from '../../utils';
|
||||||
import { ISelectedRoomObjectData } from './ISelectedRoomObjectData';
|
import { ISelectedRoomObjectData } from './ISelectedRoomObjectData';
|
||||||
import { IObjectData } from './object';
|
import { IObjectData } from './object';
|
||||||
import { IFurnitureStackingHeightMap, ILegacyWallGeometry, ITileObjectMap } from './utils';
|
import { IFurnitureStackingHeightMap, ILegacyWallGeometry, IRoomAreaSelectionManager, ITileObjectMap } from './utils';
|
||||||
|
|
||||||
export interface IRoomEngineServices
|
export interface IRoomEngineServices
|
||||||
{
|
{
|
||||||
@ -38,4 +38,8 @@ export interface IRoomEngineServices
|
|||||||
isPlayingGame(): boolean;
|
isPlayingGame(): boolean;
|
||||||
activeRoomId: number;
|
activeRoomId: number;
|
||||||
isDecorating: boolean;
|
isDecorating: boolean;
|
||||||
|
moveBlocked: boolean;
|
||||||
|
isAreaSelectionMode(): boolean;
|
||||||
|
whereYouClickIsWhereYouGo(): boolean;
|
||||||
|
areaSelectionManager: IRoomAreaSelectionManager;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +62,7 @@ export class RoomObjectLogicType
|
|||||||
public static FURNITURE_EDITABLE_INTERNAL_LINK = 'furniture_editable_internal_link';
|
public static FURNITURE_EDITABLE_INTERNAL_LINK = 'furniture_editable_internal_link';
|
||||||
public static FURNITURE_EDITABLE_ROOM_LINK = 'furniture_editable_room_link';
|
public static FURNITURE_EDITABLE_ROOM_LINK = 'furniture_editable_room_link';
|
||||||
public static FURNITURE_CRAFTING_GIZMO = 'furniture_crafting_gizmo';
|
public static FURNITURE_CRAFTING_GIZMO = 'furniture_crafting_gizmo';
|
||||||
|
public static FURNITURE_AREA_HIDE = 'furniture_area_hide';
|
||||||
public static ROOM = 'room';
|
public static ROOM = 'room';
|
||||||
public static USER = 'user';
|
public static USER = 'user';
|
||||||
public static BOT = 'bot';
|
public static BOT = 'bot';
|
||||||
|
@ -85,6 +85,13 @@ export class RoomObjectVariable
|
|||||||
public static FURNITURE_ROOM_BACKGROUND_COLOR_HUE: string = 'furniture_room_background_color_hue';
|
public static FURNITURE_ROOM_BACKGROUND_COLOR_HUE: string = 'furniture_room_background_color_hue';
|
||||||
public static FURNITURE_ROOM_BACKGROUND_COLOR_SATURATION: string = 'furniture_room_background_color_saturation';
|
public static FURNITURE_ROOM_BACKGROUND_COLOR_SATURATION: string = 'furniture_room_background_color_saturation';
|
||||||
public static FURNITURE_ROOM_BACKGROUND_COLOR_LIGHTNESS: string = 'furniture_room_background_color_lightness';
|
public static FURNITURE_ROOM_BACKGROUND_COLOR_LIGHTNESS: string = 'furniture_room_background_color_lightness';
|
||||||
|
public static FURNITURE_AREA_HIDE_ROOT_X: string = 'furniture_area_hide_root_x';
|
||||||
|
public static FURNITURE_AREA_HIDE_ROOT_Y: string = 'furniture_area_hide_root_y';
|
||||||
|
public static FURNITURE_AREA_HIDE_WIDTH: string = 'furniture_area_hide_width';
|
||||||
|
public static FURNITURE_AREA_HIDE_LENGTH: string = 'furniture_area_hide_length';
|
||||||
|
public static FURNITURE_AREA_HIDE_INVISIBILITY: string = 'furniture_area_hide_invisibility';
|
||||||
|
public static FURNITURE_AREA_HIDE_WALL_ITEMS: string = 'furniture_area_hide_wall_items';
|
||||||
|
public static FURNITURE_AREA_HIDE_INVERT: string = 'furniture_area_hide_invert';
|
||||||
public static FURNITURE_USES_PLANE_MASK: string = 'furniture_uses_plane_mask';
|
public static FURNITURE_USES_PLANE_MASK: string = 'furniture_uses_plane_mask';
|
||||||
public static FURNITURE_PLANE_MASK_TYPE: string = 'furniture_plane_mask_type';
|
public static FURNITURE_PLANE_MASK_TYPE: string = 'furniture_plane_mask_type';
|
||||||
public static FURNITURE_IS_VARIABLE_HEIGHT: string = 'furniture_is_variable_height';
|
public static FURNITURE_IS_VARIABLE_HEIGHT: string = 'furniture_is_variable_height';
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
import { INitroEvent } from '../../../common';
|
||||||
|
|
||||||
|
export interface IRoomAreaSelectionManager
|
||||||
|
{
|
||||||
|
startSelecting(): void;
|
||||||
|
clearHighlight(): void;
|
||||||
|
handleTileMouseEvent(event: INitroEvent): void;
|
||||||
|
finishSelecting(): boolean;
|
||||||
|
activate(callback: (rootX: number, rootY: number, width: number, height: number) => void, highlightType: string): boolean;
|
||||||
|
deactivate(): void;
|
||||||
|
setHighlight(rootX: number, rootY: number, width: number, height: number): void;
|
||||||
|
readonly areaSelectionState: number;
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
export * from './IFurnitureStackingHeightMap';
|
export * from './IFurnitureStackingHeightMap';
|
||||||
export * from './ILegacyWallGeometry';
|
export * from './ILegacyWallGeometry';
|
||||||
|
export * from './IRoomAreaSelectionManager';
|
||||||
export * from './ITileObjectMap';
|
export * from './ITileObjectMap';
|
||||||
export * from './ObjectRolling';
|
export * from './ObjectRolling';
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
import { FurnitureType } from './FurnitureType';
|
||||||
|
|
||||||
export interface IFurnitureData
|
export interface IFurnitureData
|
||||||
{
|
{
|
||||||
type: string;
|
type: FurnitureType;
|
||||||
id: number;
|
id: number;
|
||||||
className: string;
|
className: string;
|
||||||
fullName: string;
|
fullName: string;
|
||||||
|
@ -29,4 +29,5 @@ export interface IRoomObjectSprite
|
|||||||
alphaTolerance: number;
|
alphaTolerance: number;
|
||||||
filters: Filter[];
|
filters: Filter[];
|
||||||
updateCounter: number;
|
updateCounter: number;
|
||||||
|
skipMouseHandling: boolean;
|
||||||
}
|
}
|
||||||
|
@ -13,4 +13,5 @@
|
|||||||
y: number;
|
y: number;
|
||||||
z: number;
|
z: number;
|
||||||
length: number;
|
length: number;
|
||||||
|
toString(): string;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,5 @@
|
|||||||
"ESNext"
|
"ESNext"
|
||||||
],
|
],
|
||||||
"module": "ES6"
|
"module": "ES6"
|
||||||
},
|
}
|
||||||
"include": [
|
|
||||||
"src" ]
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [ "@nitrots/eslint-config" ]
|
|
||||||
}
|
|
@ -8,15 +8,13 @@
|
|||||||
},
|
},
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
"compile": "tsc --project ./tsconfig.json --noEmit false"
|
||||||
"eslint": "eslint ./src --fix"
|
|
||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nitrots/api": "1.0.0",
|
"@nitrots/api": "1.0.0",
|
||||||
"@nitrots/eslint-config": "1.0.0",
|
|
||||||
"@nitrots/utils": "1.0.0",
|
"@nitrots/utils": "1.0.0",
|
||||||
"pixi.js": "^8.1.0",
|
"pixi.js": "^8.1.6",
|
||||||
"@pixi/gif": "^3.0.0"
|
"@pixi/gif": "^3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
import { IGraphicAsset } from '@nitrots/api';
|
||||||
import { Rectangle, Texture } from 'pixi.js';
|
import { Rectangle, Texture } from 'pixi.js';
|
||||||
import { IGraphicAsset } from '../../api/src/asset/IGraphicAsset';
|
|
||||||
|
|
||||||
export class GraphicAsset implements IGraphicAsset
|
export class GraphicAsset implements IGraphicAsset
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,5 @@
|
|||||||
"ESNext"
|
"ESNext"
|
||||||
],
|
],
|
||||||
"module": "ES6"
|
"module": "ES6"
|
||||||
},
|
}
|
||||||
"include": [
|
|
||||||
"src" ]
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [ "@nitrots/eslint-config" ]
|
|
||||||
}
|
|
@ -5,14 +5,12 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
"compile": "tsc --project ./tsconfig.json --noEmit false"
|
||||||
"eslint": "eslint ./src --fix"
|
|
||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nitrots/api": "1.0.0",
|
"@nitrots/api": "1.0.0",
|
||||||
"@nitrots/assets": "1.0.0",
|
"@nitrots/assets": "1.0.0",
|
||||||
"@nitrots/eslint-config": "1.0.0",
|
|
||||||
"@nitrots/events": "1.0.0",
|
"@nitrots/events": "1.0.0",
|
||||||
"@nitrots/utils": "1.0.0"
|
"@nitrots/utils": "1.0.0"
|
||||||
},
|
},
|
||||||
|
@ -141,7 +141,7 @@ export class AvatarStructure
|
|||||||
|
|
||||||
public getAnimation(k: string): Animation
|
public getAnimation(k: string): Animation
|
||||||
{
|
{
|
||||||
return this._animationManager.getAnimation(k) as Animation;
|
return this._animationManager.getAnimation(k);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getActionDefinition(k: string): ActionDefinition
|
public getActionDefinition(k: string): ActionDefinition
|
||||||
@ -319,7 +319,7 @@ export class AvatarStructure
|
|||||||
let _local_20: AvatarAnimationFrame[] = [];
|
let _local_20: AvatarAnimationFrame[] = [];
|
||||||
let _local_36: IPartColor = null;
|
let _local_36: IPartColor = null;
|
||||||
|
|
||||||
if(!_arg_3 == null) return [];
|
if(!_arg_3) return [];
|
||||||
|
|
||||||
const _local_9 = this._partSetsData.getActiveParts(_arg_3.definition);
|
const _local_9 = this._partSetsData.getActiveParts(_arg_3.definition);
|
||||||
const _local_11: AvatarImagePartContainer[] = [];
|
const _local_11: AvatarImagePartContainer[] = [];
|
||||||
|
@ -135,7 +135,19 @@ export class AvatarActionManager
|
|||||||
validatedActions.push(action);
|
validatedActions.push(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
validatedActions.sort(this.sortByPrecedence);
|
validatedActions.sort((actionOne: IActiveActionData, actionTwo: IActiveActionData) =>
|
||||||
|
{
|
||||||
|
if(!actionOne || !actionTwo) return 0;
|
||||||
|
|
||||||
|
const precedenceOne = actionOne.definition.precedence;
|
||||||
|
const precedenceTwo = actionTwo.definition.precedence;
|
||||||
|
|
||||||
|
if(precedenceOne < precedenceTwo) return 1;
|
||||||
|
|
||||||
|
if(precedenceOne > precedenceTwo) return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
return validatedActions;
|
return validatedActions;
|
||||||
}
|
}
|
||||||
@ -169,18 +181,4 @@ export class AvatarActionManager
|
|||||||
|
|
||||||
return activeActions;
|
return activeActions;
|
||||||
}
|
}
|
||||||
|
|
||||||
private sortByPrecedence(actionOne: IActiveActionData, actionTwo: IActiveActionData): number
|
|
||||||
{
|
|
||||||
if(!actionOne || !actionTwo) return 0;
|
|
||||||
|
|
||||||
const precedenceOne = actionOne.definition.precedence;
|
|
||||||
const precedenceTwo = actionTwo.definition.precedence;
|
|
||||||
|
|
||||||
if(precedenceOne < precedenceTwo) return 1;
|
|
||||||
|
|
||||||
if(precedenceOne > precedenceTwo) return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ export class GeometryItem extends Node3D
|
|||||||
|
|
||||||
public toString(): string
|
public toString(): string
|
||||||
{
|
{
|
||||||
return ((((this._id + ': ') + this.location) + ' - ') + this.transformedLocation);
|
return `${this._id}: ${this.location.toString()} - ${this.transformedLocation.toString()}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get isDynamic(): boolean
|
public get isDynamic(): boolean
|
||||||
|
@ -25,7 +25,5 @@
|
|||||||
"ESNext"
|
"ESNext"
|
||||||
],
|
],
|
||||||
"module": "ES6"
|
"module": "ES6"
|
||||||
},
|
}
|
||||||
"include": [
|
|
||||||
"src" ]
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [ "@nitrots/eslint-config" ]
|
|
||||||
}
|
|
@ -5,18 +5,16 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
"compile": "tsc --project ./tsconfig.json --noEmit false"
|
||||||
"eslint": "eslint ./src --fix"
|
|
||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nitrots/api": "1.0.0",
|
"@nitrots/api": "1.0.0",
|
||||||
"@nitrots/assets": "1.0.0",
|
"@nitrots/assets": "1.0.0",
|
||||||
"@nitrots/configuration": "1.0.0",
|
"@nitrots/configuration": "1.0.0",
|
||||||
"@nitrots/eslint-config": "1.0.0",
|
|
||||||
"@nitrots/events": "1.0.0",
|
"@nitrots/events": "1.0.0",
|
||||||
"@nitrots/utils": "1.0.0",
|
"@nitrots/utils": "1.0.0",
|
||||||
"pixi.js": "^8.1.0"
|
"pixi.js": "^8.1.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "~5.4.2"
|
"typescript": "~5.4.2"
|
||||||
|
@ -3,19 +3,13 @@ import { GetAssetManager } from '@nitrots/assets';
|
|||||||
import { GetConfiguration } from '@nitrots/configuration';
|
import { GetConfiguration } from '@nitrots/configuration';
|
||||||
import { GetEventDispatcher, RoomCameraWidgetManagerEvent } from '@nitrots/events';
|
import { GetEventDispatcher, RoomCameraWidgetManagerEvent } from '@nitrots/events';
|
||||||
import { TextureUtils } from '@nitrots/utils';
|
import { TextureUtils } from '@nitrots/utils';
|
||||||
import { BLEND_MODES, ColorMatrix, ColorMatrixFilter, Container, Sprite, Texture } from 'pixi.js';
|
import { BLEND_MODES, ColorMatrix, ColorMatrixFilter, Container, Filter, Sprite, Texture } from 'pixi.js';
|
||||||
import { RoomCameraWidgetEffect } from './RoomCameraWidgetEffect';
|
import { RoomCameraWidgetEffect } from './RoomCameraWidgetEffect';
|
||||||
|
|
||||||
export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
||||||
{
|
{
|
||||||
private _effects: Map<string, IRoomCameraWidgetEffect>;
|
private _effects: Map<string, IRoomCameraWidgetEffect> = new Map();
|
||||||
private _isLoaded: boolean;
|
private _isLoaded: boolean = false;
|
||||||
|
|
||||||
constructor()
|
|
||||||
{
|
|
||||||
this._effects = new Map();
|
|
||||||
this._isLoaded = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async init(): Promise<void>
|
public async init(): Promise<void>
|
||||||
{
|
{
|
||||||
@ -52,7 +46,7 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
|||||||
GetEventDispatcher().dispatchEvent(new RoomCameraWidgetManagerEvent(RoomCameraWidgetManagerEvent.INITIALIZED));
|
GetEventDispatcher().dispatchEvent(new RoomCameraWidgetManagerEvent(RoomCameraWidgetManagerEvent.INITIALIZED));
|
||||||
}
|
}
|
||||||
|
|
||||||
public async applyEffects(texture: Texture, selectedEffects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): Promise<HTMLImageElement>
|
public async applyEffects(texture: Texture, effects: IRoomCameraWidgetSelectedEffect[], isZoomed: boolean): Promise<HTMLImageElement>
|
||||||
{
|
{
|
||||||
const container = new Container();
|
const container = new Container();
|
||||||
const sprite = new Sprite(texture);
|
const sprite = new Sprite(texture);
|
||||||
@ -61,7 +55,34 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
|||||||
|
|
||||||
if(isZoomed) sprite.scale.set(2);
|
if(isZoomed) sprite.scale.set(2);
|
||||||
|
|
||||||
for(const selectedEffect of selectedEffects)
|
const filters: Filter[] = [];
|
||||||
|
|
||||||
|
const getColorMatrixFilter = (matrix: ColorMatrix, flag: boolean, strength: number): ColorMatrixFilter =>
|
||||||
|
{
|
||||||
|
const filter = new ColorMatrixFilter();
|
||||||
|
|
||||||
|
if(flag)
|
||||||
|
{
|
||||||
|
filter.matrix = matrix;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//@ts-ignore
|
||||||
|
const newMatrix: ColorMatrix = [];
|
||||||
|
const otherMatrix: ColorMatrix = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0];
|
||||||
|
|
||||||
|
for(let i = 0; i < matrix.length; i++)
|
||||||
|
{
|
||||||
|
newMatrix.push((matrix[i] * strength) + (otherMatrix[i] * (1 - strength)));
|
||||||
|
}
|
||||||
|
|
||||||
|
filter.matrix = newMatrix;
|
||||||
|
}
|
||||||
|
|
||||||
|
return filter;
|
||||||
|
};
|
||||||
|
|
||||||
|
for(const selectedEffect of effects)
|
||||||
{
|
{
|
||||||
const effect = selectedEffect.effect;
|
const effect = selectedEffect.effect;
|
||||||
|
|
||||||
@ -69,26 +90,24 @@ export class RoomCameraWidgetManager implements IRoomCameraWidgetManager
|
|||||||
|
|
||||||
if(effect.colorMatrix)
|
if(effect.colorMatrix)
|
||||||
{
|
{
|
||||||
const filter = new ColorMatrixFilter();
|
const filter = getColorMatrixFilter(effect.colorMatrix, false, selectedEffect.strength);
|
||||||
|
|
||||||
filter.matrix = effect.colorMatrix;
|
filters.push(filter);
|
||||||
filter.alpha = selectedEffect.alpha;
|
|
||||||
|
|
||||||
if(!Array.isArray(sprite.filters)) sprite.filters = [];
|
|
||||||
|
|
||||||
sprite.filters.push(filter);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const effectSprite = new Sprite(effect.texture);
|
const effectSprite = new Sprite(effect.texture);
|
||||||
effectSprite.alpha = selectedEffect.alpha;
|
|
||||||
|
effectSprite.alpha = selectedEffect.strength;
|
||||||
effectSprite.blendMode = effect.blendMode;
|
effectSprite.blendMode = effect.blendMode;
|
||||||
|
|
||||||
container.addChild(effectSprite);
|
container.addChild(effectSprite);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return await TextureUtils.generateImage(container);
|
container.filters = filters;
|
||||||
|
|
||||||
|
return await TextureUtils.generateImage(sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get effects(): Map<string, IRoomCameraWidgetEffect>
|
public get effects(): Map<string, IRoomCameraWidgetEffect>
|
||||||
|
@ -3,12 +3,12 @@ import { IRoomCameraWidgetEffect } from '@nitrots/api';
|
|||||||
export class RoomCameraWidgetSelectedEffect
|
export class RoomCameraWidgetSelectedEffect
|
||||||
{
|
{
|
||||||
private _effect: IRoomCameraWidgetEffect;
|
private _effect: IRoomCameraWidgetEffect;
|
||||||
private _alpha: number;
|
private _strength: number;
|
||||||
|
|
||||||
constructor(effect: IRoomCameraWidgetEffect, alpha: number)
|
constructor(effect: IRoomCameraWidgetEffect, strength: number)
|
||||||
{
|
{
|
||||||
this._effect = effect;
|
this._effect = effect;
|
||||||
this._alpha = alpha;
|
this._strength = strength;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get effect(): IRoomCameraWidgetEffect
|
public get effect(): IRoomCameraWidgetEffect
|
||||||
@ -16,8 +16,8 @@ export class RoomCameraWidgetSelectedEffect
|
|||||||
return this._effect;
|
return this._effect;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get alpha(): number
|
public get strength(): number
|
||||||
{
|
{
|
||||||
return this._alpha;
|
return this._strength;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,5 @@
|
|||||||
"ESNext"
|
"ESNext"
|
||||||
],
|
],
|
||||||
"module": "ES6"
|
"module": "ES6"
|
||||||
},
|
}
|
||||||
"include": [
|
|
||||||
"src" ]
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [ "@nitrots/eslint-config" ]
|
|
||||||
}
|
|
@ -5,13 +5,11 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
"compile": "tsc --project ./tsconfig.json --noEmit false"
|
||||||
"eslint": "eslint ./src --fix"
|
|
||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nitrots/api": "1.0.0",
|
"@nitrots/api": "1.0.0",
|
||||||
"@nitrots/eslint-config": "1.0.0",
|
|
||||||
"@nitrots/events": "1.0.0",
|
"@nitrots/events": "1.0.0",
|
||||||
"@nitrots/utils": "1.0.0"
|
"@nitrots/utils": "1.0.0"
|
||||||
},
|
},
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,5 +1,9 @@
|
|||||||
export class IncomingHeader
|
export class IncomingHeader
|
||||||
{
|
{
|
||||||
|
// These packets do not belong to this revision, so these are custom packet ids
|
||||||
|
public static AREA_HIDE = 6001;
|
||||||
|
|
||||||
|
// Original packets
|
||||||
public static ACHIEVEMENT_LIST = 305;
|
public static ACHIEVEMENT_LIST = 305;
|
||||||
public static AUTHENTICATED = 2491;
|
public static AUTHENTICATED = 2491;
|
||||||
public static AUTHENTICATION = -1;
|
public static AUTHENTICATION = -1;
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
import { IMessageEvent } from '@nitrots/api';
|
||||||
|
import { MessageEvent } from '@nitrots/events';
|
||||||
|
import { AreaHideMessageParser } from '../../../parser';
|
||||||
|
|
||||||
|
export class AreaHideMessageEvent extends MessageEvent implements IMessageEvent
|
||||||
|
{
|
||||||
|
constructor(callBack: Function)
|
||||||
|
{
|
||||||
|
super(callBack, AreaHideMessageParser);
|
||||||
|
}
|
||||||
|
|
||||||
|
public getParser(): AreaHideMessageParser
|
||||||
|
{
|
||||||
|
return this.parser as AreaHideMessageParser;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
|
export * from './AreaHideMessageEvent';
|
||||||
export * from './CustomUserNotificationMessageEvent';
|
export * from './CustomUserNotificationMessageEvent';
|
||||||
export * from './DiceValueMessageEvent';
|
export * from './DiceValueMessageEvent';
|
||||||
export * from './floor';
|
|
||||||
export * from './FurniRentOrBuyoutOfferMessageEvent';
|
export * from './FurniRentOrBuyoutOfferMessageEvent';
|
||||||
export * from './FurnitureAliasesEvent';
|
export * from './FurnitureAliasesEvent';
|
||||||
export * from './FurnitureDataEvent';
|
export * from './FurnitureDataEvent';
|
||||||
@ -17,6 +17,7 @@ export * from './RentableSpaceStatusMessageEvent';
|
|||||||
export * from './RequestSpamWallPostItMessageEvent';
|
export * from './RequestSpamWallPostItMessageEvent';
|
||||||
export * from './RoomDimmerPresetsMessageEvent';
|
export * from './RoomDimmerPresetsMessageEvent';
|
||||||
export * from './RoomMessageNotificationMessageEvent';
|
export * from './RoomMessageNotificationMessageEvent';
|
||||||
export * from './wall';
|
|
||||||
export * from './WelcomeGiftStatusEvent';
|
export * from './WelcomeGiftStatusEvent';
|
||||||
|
export * from './floor';
|
||||||
|
export * from './wall';
|
||||||
export * from './youtube';
|
export * from './youtube';
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
export class OutgoingHeader
|
export class OutgoingHeader
|
||||||
{
|
{
|
||||||
|
// These packets do not belong to this revision, so these are custom packet ids
|
||||||
|
public static CLICK_FURNI = 6002;
|
||||||
|
|
||||||
public static ACHIEVEMENT_LIST = 219;
|
public static ACHIEVEMENT_LIST = 219;
|
||||||
public static AUTHENTICATION = -1;
|
public static AUTHENTICATION = -1;
|
||||||
public static BOT_CONFIGURATION = 1986;
|
public static BOT_CONFIGURATION = 1986;
|
||||||
@ -469,7 +472,5 @@ export class OutgoingHeader
|
|||||||
public static RENTABLE_EXTEND_RENT_OR_BUYOUT_FURNI = 1071;
|
public static RENTABLE_EXTEND_RENT_OR_BUYOUT_FURNI = 1071;
|
||||||
public static RENTABLE_GET_RENT_OR_BUYOUT_OFFER = 2518;
|
public static RENTABLE_GET_RENT_OR_BUYOUT_OFFER = 2518;
|
||||||
|
|
||||||
// CUSTOM HEADERS
|
|
||||||
|
|
||||||
public static DELETE_ITEM = 10018;
|
public static DELETE_ITEM = 10018;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,21 @@
|
|||||||
|
import { IMessageComposer } from '@nitrots/api';
|
||||||
|
|
||||||
|
export class ClickFurniMessageComposer implements IMessageComposer<ConstructorParameters<typeof ClickFurniMessageComposer>>
|
||||||
|
{
|
||||||
|
private _data: ConstructorParameters<typeof ClickFurniMessageComposer>;
|
||||||
|
|
||||||
|
constructor(id: number, category: number)
|
||||||
|
{
|
||||||
|
this._data = [id, category];
|
||||||
|
}
|
||||||
|
|
||||||
|
public getMessageArray()
|
||||||
|
{
|
||||||
|
return this._data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public dispose(): void
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,7 @@
|
|||||||
export * from './BotPlaceComposer';
|
export * from './BotPlaceComposer';
|
||||||
export * from './BotRemoveComposer';
|
export * from './BotRemoveComposer';
|
||||||
export * from './BotSkillSaveComposer';
|
export * from './BotSkillSaveComposer';
|
||||||
|
export * from './ClickFurniMessageComposer';
|
||||||
export * from './CompostPlantMessageComposer';
|
export * from './CompostPlantMessageComposer';
|
||||||
export * from './GetItemDataComposer';
|
export * from './GetItemDataComposer';
|
||||||
export * from './HarvestPetMessageComposer';
|
export * from './HarvestPetMessageComposer';
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
import { IMessageDataWrapper } from '@nitrots/api';
|
import { FurnitureType, IMessageDataWrapper } from '@nitrots/api';
|
||||||
|
|
||||||
export class CatalogPageMessageProductData
|
export class CatalogPageMessageProductData
|
||||||
{
|
{
|
||||||
public static I: string = 'i';
|
private _productType: FurnitureType;
|
||||||
public static S: string = 's';
|
|
||||||
public static E: string = 'e';
|
|
||||||
public static B: string = 'b';
|
|
||||||
|
|
||||||
private _productType: string;
|
|
||||||
private _furniClassId: number;
|
private _furniClassId: number;
|
||||||
private _extraParam: string;
|
private _extraParam: string;
|
||||||
private _productCount: number;
|
private _productCount: number;
|
||||||
@ -38,11 +33,11 @@ export class CatalogPageMessageProductData
|
|||||||
|
|
||||||
public parse(wrapper: IMessageDataWrapper): boolean
|
public parse(wrapper: IMessageDataWrapper): boolean
|
||||||
{
|
{
|
||||||
this._productType = wrapper.readString();
|
this._productType = wrapper.readString().toUpperCase() as FurnitureType;
|
||||||
|
|
||||||
switch(this._productType)
|
switch(this._productType)
|
||||||
{
|
{
|
||||||
case CatalogPageMessageProductData.B:
|
case FurnitureType.BADGE:
|
||||||
this._extraParam = wrapper.readString();
|
this._extraParam = wrapper.readString();
|
||||||
this._productCount = 1;
|
this._productCount = 1;
|
||||||
return true;
|
return true;
|
||||||
@ -57,11 +52,12 @@ export class CatalogPageMessageProductData
|
|||||||
this._uniqueLimitedItemSeriesSize = wrapper.readInt();
|
this._uniqueLimitedItemSeriesSize = wrapper.readInt();
|
||||||
this._uniqueLimitedItemsLeft = wrapper.readInt();
|
this._uniqueLimitedItemsLeft = wrapper.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public get productType(): string
|
public get productType(): FurnitureType
|
||||||
{
|
{
|
||||||
return this._productType;
|
return this._productType;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,58 @@
|
|||||||
|
import { IMessageDataWrapper } from '@nitrots/api';
|
||||||
|
|
||||||
|
export class AreaHideMessageData
|
||||||
|
{
|
||||||
|
private _furniId: number;
|
||||||
|
private _on: boolean;
|
||||||
|
private _rootX: number;
|
||||||
|
private _rootY: number;
|
||||||
|
private _width: number;
|
||||||
|
private _length: number;
|
||||||
|
private _invert: boolean;
|
||||||
|
|
||||||
|
constructor(wrapper: IMessageDataWrapper)
|
||||||
|
{
|
||||||
|
this._furniId = wrapper.readInt();
|
||||||
|
this._on = wrapper.readBoolean();
|
||||||
|
this._rootX = wrapper.readInt();
|
||||||
|
this._rootY = wrapper.readInt();
|
||||||
|
this._width = wrapper.readInt();
|
||||||
|
this._length = wrapper.readInt();
|
||||||
|
this._invert = wrapper.readBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
|
public get furniId(): number
|
||||||
|
{
|
||||||
|
return this._furniId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get on(): boolean
|
||||||
|
{
|
||||||
|
return this._on;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get rootX(): number
|
||||||
|
{
|
||||||
|
return this._rootX;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get rootY(): number
|
||||||
|
{
|
||||||
|
return this._rootY;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get width(): number
|
||||||
|
{
|
||||||
|
return this._width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get length(): number
|
||||||
|
{
|
||||||
|
return this._length;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get invert(): boolean
|
||||||
|
{
|
||||||
|
return this._invert;
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
export * from './AreaHideMessageData';
|
||||||
export * from './FavoriteMembershipUpdateMessageParser';
|
export * from './FavoriteMembershipUpdateMessageParser';
|
||||||
export * from './ObjectData';
|
export * from './ObjectData';
|
||||||
export * from './ObjectsDataUpdateParser';
|
export * from './ObjectsDataUpdateParser';
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
import { IMessageDataWrapper, IMessageParser } from '@nitrots/api';
|
||||||
|
import { AreaHideMessageData } from '../engine';
|
||||||
|
|
||||||
|
export class AreaHideMessageParser implements IMessageParser
|
||||||
|
{
|
||||||
|
private _areaData: AreaHideMessageData;
|
||||||
|
|
||||||
|
public flush(): boolean
|
||||||
|
{
|
||||||
|
this._areaData = null;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public parse(wrapper: IMessageDataWrapper): boolean
|
||||||
|
{
|
||||||
|
if(!wrapper) return false;
|
||||||
|
|
||||||
|
this._areaData = new AreaHideMessageData(wrapper);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get areaData(): AreaHideMessageData
|
||||||
|
{
|
||||||
|
return this._areaData;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,6 @@
|
|||||||
|
export * from './AreaHideMessageParser';
|
||||||
export * from './CustomUserNotificationMessageParser';
|
export * from './CustomUserNotificationMessageParser';
|
||||||
export * from './DiceValueMessageParser';
|
export * from './DiceValueMessageParser';
|
||||||
export * from './floor';
|
|
||||||
export * from './FurniRentOrBuyoutOfferMessageParser';
|
export * from './FurniRentOrBuyoutOfferMessageParser';
|
||||||
export * from './FurnitureAliasesParser';
|
export * from './FurnitureAliasesParser';
|
||||||
export * from './FurnitureDataParser';
|
export * from './FurnitureDataParser';
|
||||||
@ -18,6 +18,7 @@ export * from './RequestSpamWallPostItMessageParser';
|
|||||||
export * from './RoomDimmerPresetsMessageData';
|
export * from './RoomDimmerPresetsMessageData';
|
||||||
export * from './RoomDimmerPresetsMessageParser';
|
export * from './RoomDimmerPresetsMessageParser';
|
||||||
export * from './RoomMessageNotificationMessageParser';
|
export * from './RoomMessageNotificationMessageParser';
|
||||||
export * from './wall';
|
|
||||||
export * from './WelcomeGiftStatusParser';
|
export * from './WelcomeGiftStatusParser';
|
||||||
|
export * from './floor';
|
||||||
|
export * from './wall';
|
||||||
export * from './youtube';
|
export * from './youtube';
|
||||||
|
@ -25,7 +25,5 @@
|
|||||||
"ESNext"
|
"ESNext"
|
||||||
],
|
],
|
||||||
"module": "ES6"
|
"module": "ES6"
|
||||||
},
|
}
|
||||||
"include": [
|
|
||||||
"src" ]
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [ "@nitrots/eslint-config" ]
|
|
||||||
}
|
|
@ -5,13 +5,11 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
"compile": "tsc --project ./tsconfig.json --noEmit false"
|
||||||
"eslint": "eslint ./src --fix"
|
|
||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nitrots/api": "1.0.0",
|
"@nitrots/api": "1.0.0",
|
||||||
"@nitrots/eslint-config": "1.0.0",
|
|
||||||
"@nitrots/utils": "1.0.0"
|
"@nitrots/utils": "1.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -65,7 +65,7 @@ export class ConfigurationManager implements IConfigurationManager
|
|||||||
{
|
{
|
||||||
let value = data[key];
|
let value = data[key];
|
||||||
|
|
||||||
if(typeof value === 'string') value = this.interpolate((value as string), regex);
|
if(typeof value === 'string') value = this.interpolate(value, regex);
|
||||||
|
|
||||||
if(this._definitions.has(key))
|
if(this._definitions.has(key))
|
||||||
{
|
{
|
||||||
|
@ -25,7 +25,5 @@
|
|||||||
"ESNext"
|
"ESNext"
|
||||||
],
|
],
|
||||||
"module": "ES6"
|
"module": "ES6"
|
||||||
},
|
}
|
||||||
"include": [
|
|
||||||
"src" ]
|
|
||||||
}
|
}
|
||||||
|
@ -1,128 +0,0 @@
|
|||||||
{
|
|
||||||
"env": {
|
|
||||||
"browser": true,
|
|
||||||
"es2021": true,
|
|
||||||
"node": true
|
|
||||||
},
|
|
||||||
"extends": [
|
|
||||||
"eslint:recommended",
|
|
||||||
"plugin:@typescript-eslint/recommended"
|
|
||||||
],
|
|
||||||
"parser": "@typescript-eslint/parser",
|
|
||||||
"parserOptions": {
|
|
||||||
"ecmaVersion": 12,
|
|
||||||
"sourceType": "module"
|
|
||||||
},
|
|
||||||
"plugins": [
|
|
||||||
"@typescript-eslint"
|
|
||||||
],
|
|
||||||
"rules": {
|
|
||||||
"indent": [
|
|
||||||
"error",
|
|
||||||
4,
|
|
||||||
{
|
|
||||||
"SwitchCase": 1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-multi-spaces": [
|
|
||||||
"error"
|
|
||||||
],
|
|
||||||
"no-trailing-spaces": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"skipBlankLines": false,
|
|
||||||
"ignoreComments": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"linebreak-style": [
|
|
||||||
"off"
|
|
||||||
],
|
|
||||||
"quotes": [
|
|
||||||
"error",
|
|
||||||
"single"
|
|
||||||
],
|
|
||||||
"semi": [
|
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"brace-style": [
|
|
||||||
"error",
|
|
||||||
"allman"
|
|
||||||
],
|
|
||||||
"object-curly-spacing": [
|
|
||||||
"error",
|
|
||||||
"always"
|
|
||||||
],
|
|
||||||
"keyword-spacing": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"overrides":
|
|
||||||
{
|
|
||||||
"if":
|
|
||||||
{
|
|
||||||
"after": false
|
|
||||||
},
|
|
||||||
"for":
|
|
||||||
{
|
|
||||||
"after": false
|
|
||||||
},
|
|
||||||
"while":
|
|
||||||
{
|
|
||||||
"after": false
|
|
||||||
},
|
|
||||||
"switch":
|
|
||||||
{
|
|
||||||
"after": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@typescript-eslint/no-explicit-any": [
|
|
||||||
"off"
|
|
||||||
],
|
|
||||||
"@typescript-eslint/explicit-module-boundary-types": [
|
|
||||||
"off",
|
|
||||||
{
|
|
||||||
"allowedNames": [
|
|
||||||
"getMessageArray"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@typescript-eslint/ban-ts-comment": [
|
|
||||||
"off"
|
|
||||||
],
|
|
||||||
"@typescript-eslint/no-empty-function": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"allow": [
|
|
||||||
"functions",
|
|
||||||
"arrowFunctions",
|
|
||||||
"generatorFunctions",
|
|
||||||
"methods",
|
|
||||||
"generatorMethods",
|
|
||||||
"constructors"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@typescript-eslint/no-unused-vars": [
|
|
||||||
"off"
|
|
||||||
],
|
|
||||||
"@typescript-eslint/ban-types": [
|
|
||||||
"error",
|
|
||||||
{
|
|
||||||
"types":
|
|
||||||
{
|
|
||||||
"String": true,
|
|
||||||
"Boolean": true,
|
|
||||||
"Number": true,
|
|
||||||
"Symbol": true,
|
|
||||||
"{}": false,
|
|
||||||
"Object": false,
|
|
||||||
"object": false,
|
|
||||||
"Function": false
|
|
||||||
},
|
|
||||||
"extendDefaults": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
51
packages/eslint-config/.gitignore
vendored
51
packages/eslint-config/.gitignore
vendored
@ -1,51 +0,0 @@
|
|||||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
|
||||||
|
|
||||||
# compiled output
|
|
||||||
/dist
|
|
||||||
/tmp
|
|
||||||
/out-tsc
|
|
||||||
# Only exists if Bazel was run
|
|
||||||
/bazel-out
|
|
||||||
|
|
||||||
# dependencies
|
|
||||||
/node_modules
|
|
||||||
|
|
||||||
# profiling files
|
|
||||||
chrome-profiler-events*.json
|
|
||||||
speed-measure-plugin*.json
|
|
||||||
|
|
||||||
# IDEs and editors
|
|
||||||
/.idea
|
|
||||||
.project
|
|
||||||
.classpath
|
|
||||||
.c9/
|
|
||||||
*.launch
|
|
||||||
.settings/
|
|
||||||
*.sublime-workspace
|
|
||||||
|
|
||||||
# IDE - VSCode
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
.history/*
|
|
||||||
|
|
||||||
# misc
|
|
||||||
/.sass-cache
|
|
||||||
/connect.lock
|
|
||||||
/coverage
|
|
||||||
/libpeerconnection.log
|
|
||||||
npm-debug.log
|
|
||||||
yarn-error.log
|
|
||||||
testem.log
|
|
||||||
/typings
|
|
||||||
.git
|
|
||||||
|
|
||||||
# System Files
|
|
||||||
.DS_Store
|
|
||||||
Thumbs.db
|
|
||||||
|
|
||||||
*.zip
|
|
||||||
*.as
|
|
||||||
*.bin
|
|
@ -1 +0,0 @@
|
|||||||
module.exports = require('./.eslintrc.json');
|
|
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "@nitrots/eslint-config",
|
|
||||||
"description": "Nitro eslint configs",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"license": "GPL-3.0",
|
|
||||||
"main": "./index",
|
|
||||||
"dependencies": {
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@typescript-eslint/eslint-plugin": "^7.1.1",
|
|
||||||
"@typescript-eslint/parser": "^7.1.1",
|
|
||||||
"eslint": "^8.57.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [ "@nitrots/eslint-config" ]
|
|
||||||
}
|
|
@ -5,14 +5,11 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"compile": "tsc --project ./tsconfig.json --noEmit false"
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
|
||||||
"eslint": "eslint ./src --fix"
|
|
||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nitrots/api": "1.0.0",
|
"@nitrots/api": "1.0.0",
|
||||||
"@nitrots/eslint-config": "1.0.0",
|
|
||||||
"@nitrots/utils": "1.0.0"
|
"@nitrots/utils": "1.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -23,6 +23,8 @@ export class EventDispatcher implements IEventDispatcher
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NitroLogger.events('Added Event Listener', type);
|
||||||
|
|
||||||
existing.push(callback);
|
existing.push(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,7 +80,7 @@ export class EventDispatcher implements IEventDispatcher
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
(callback as Function)(event);
|
callback(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (err)
|
catch (err)
|
||||||
|
20
packages/events/src/room/RoomEngineAreaHideStateEvent.ts
Normal file
20
packages/events/src/room/RoomEngineAreaHideStateEvent.ts
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { RoomEngineTriggerWidgetEvent } from './RoomEngineTriggerWidgetEvent';
|
||||||
|
|
||||||
|
export class RoomEngineAreaHideStateEvent extends RoomEngineTriggerWidgetEvent
|
||||||
|
{
|
||||||
|
public static UPDATE_STATE_AREA_HIDE: string = 'REAHSE_UPDATE_STATE_AREA_HIDE';
|
||||||
|
|
||||||
|
private _isOn: boolean;
|
||||||
|
|
||||||
|
constructor(roomId: number, furniId: number, category: number, on: boolean)
|
||||||
|
{
|
||||||
|
super(RoomEngineAreaHideStateEvent.UPDATE_STATE_AREA_HIDE, roomId, furniId, category);
|
||||||
|
|
||||||
|
this._isOn = on;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get isOn(): boolean
|
||||||
|
{
|
||||||
|
return this._isOn;
|
||||||
|
}
|
||||||
|
}
|
@ -23,6 +23,7 @@ export class RoomEngineTriggerWidgetEvent extends RoomEngineObjectEvent
|
|||||||
public static REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: string = 'ROWRE_REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG';
|
public static REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: string = 'ROWRE_REQUEST_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG';
|
||||||
public static REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: string = 'ROWRE_REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG';
|
public static REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: string = 'ROWRE_REQUEST_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG';
|
||||||
public static REQUEST_BACKGROUND_COLOR: string = 'RETWE_REQUEST_BACKGROUND_COLOR';
|
public static REQUEST_BACKGROUND_COLOR: string = 'RETWE_REQUEST_BACKGROUND_COLOR';
|
||||||
|
public static REQUEST_AREA_HIDE: string = 'RETWE_REQUEST_AREA_HIDE';
|
||||||
public static REQUEST_MYSTERYBOX_OPEN_DIALOG: string = 'RETWE_REQUEST_MYSTERYBOX_OPEN_DIALOG';
|
public static REQUEST_MYSTERYBOX_OPEN_DIALOG: string = 'RETWE_REQUEST_MYSTERYBOX_OPEN_DIALOG';
|
||||||
public static REQUEST_EFFECTBOX_OPEN_DIALOG: string = 'RETWE_REQUEST_EFFECTBOX_OPEN_DIALOG';
|
public static REQUEST_EFFECTBOX_OPEN_DIALOG: string = 'RETWE_REQUEST_EFFECTBOX_OPEN_DIALOG';
|
||||||
public static REQUEST_MYSTERYTROPHY_OPEN_DIALOG: string = 'RETWE_REQUEST_MYSTERYTROPHY_OPEN_DIALOG';
|
public static REQUEST_MYSTERYTROPHY_OPEN_DIALOG: string = 'RETWE_REQUEST_MYSTERYTROPHY_OPEN_DIALOG';
|
||||||
|
@ -26,6 +26,7 @@ export class RoomObjectWidgetRequestEvent extends RoomObjectEvent
|
|||||||
public static MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: string = 'ROWRE_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG';
|
public static MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG: string = 'ROWRE_MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG';
|
||||||
public static PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: string = 'ROWRE_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG';
|
public static PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG: string = 'ROWRE_PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG';
|
||||||
public static BACKGROUND_COLOR: string = 'ROWRE_BACKGROUND_COLOR';
|
public static BACKGROUND_COLOR: string = 'ROWRE_BACKGROUND_COLOR';
|
||||||
|
public static AREA_HIDE: string = 'ROWRE_AREA_HIDE';
|
||||||
public static MYSTERYBOX_OPEN_DIALOG: string = 'ROWRE_MYSTERYBOX_OPEN_DIALOG';
|
public static MYSTERYBOX_OPEN_DIALOG: string = 'ROWRE_MYSTERYBOX_OPEN_DIALOG';
|
||||||
public static EFFECTBOX_OPEN_DIALOG: string = 'ROWRE_EFFECTBOX_OPEN_DIALOG';
|
public static EFFECTBOX_OPEN_DIALOG: string = 'ROWRE_EFFECTBOX_OPEN_DIALOG';
|
||||||
public static MYSTERYTROPHY_OPEN_DIALOG: string = 'ROWRE_MYSTERYTROPHY_OPEN_DIALOG';
|
public static MYSTERYTROPHY_OPEN_DIALOG: string = 'ROWRE_MYSTERYTROPHY_OPEN_DIALOG';
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
export * from './RoomBackgroundColorEvent';
|
export * from './RoomBackgroundColorEvent';
|
||||||
export * from './RoomContentLoadedEvent';
|
export * from './RoomContentLoadedEvent';
|
||||||
export * from './RoomDragEvent';
|
export * from './RoomDragEvent';
|
||||||
|
export * from './RoomEngineAreaHideStateEvent';
|
||||||
export * from './RoomEngineDimmerStateEvent';
|
export * from './RoomEngineDimmerStateEvent';
|
||||||
export * from './RoomEngineEvent';
|
export * from './RoomEngineEvent';
|
||||||
export * from './RoomEngineObjectEvent';
|
export * from './RoomEngineObjectEvent';
|
||||||
|
@ -25,7 +25,5 @@
|
|||||||
"ESNext"
|
"ESNext"
|
||||||
],
|
],
|
||||||
"module": "ES6"
|
"module": "ES6"
|
||||||
},
|
}
|
||||||
"include": [
|
|
||||||
"src" ]
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [ "@nitrots/eslint-config" ]
|
|
||||||
}
|
|
@ -5,17 +5,15 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
"compile": "tsc --project ./tsconfig.json --noEmit false"
|
||||||
"eslint": "eslint ./src --fix"
|
|
||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nitrots/api": "1.0.0",
|
"@nitrots/api": "1.0.0",
|
||||||
"@nitrots/communication": "1.0.0",
|
"@nitrots/communication": "1.0.0",
|
||||||
"@nitrots/configuration": "1.0.0",
|
"@nitrots/configuration": "1.0.0",
|
||||||
"@nitrots/eslint-config": "1.0.0",
|
|
||||||
"@nitrots/events": "1.0.0",
|
"@nitrots/events": "1.0.0",
|
||||||
"pixi.js": "^8.1.0"
|
"pixi.js": "^8.1.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "~5.4.2"
|
"typescript": "~5.4.2"
|
||||||
|
@ -25,7 +25,5 @@
|
|||||||
"ESNext"
|
"ESNext"
|
||||||
],
|
],
|
||||||
"module": "ES6"
|
"module": "ES6"
|
||||||
},
|
}
|
||||||
"include": [
|
|
||||||
"src" ]
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [ "@nitrots/eslint-config" ]
|
|
||||||
}
|
|
@ -5,8 +5,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
"compile": "tsc --project ./tsconfig.json --noEmit false"
|
||||||
"eslint": "eslint ./src --fix"
|
|
||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -15,10 +14,9 @@
|
|||||||
"@nitrots/avatar": "1.0.0",
|
"@nitrots/avatar": "1.0.0",
|
||||||
"@nitrots/communication": "1.0.0",
|
"@nitrots/communication": "1.0.0",
|
||||||
"@nitrots/configuration": "1.0.0",
|
"@nitrots/configuration": "1.0.0",
|
||||||
"@nitrots/eslint-config": "1.0.0",
|
|
||||||
"@nitrots/events": "1.0.0",
|
"@nitrots/events": "1.0.0",
|
||||||
"@nitrots/session": "1.0.0",
|
"@nitrots/session": "1.0.0",
|
||||||
"pixi.js": "^8.1.0"
|
"pixi.js": "^8.1.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "~5.4.2"
|
"typescript": "~5.4.2"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { IFurnitureStackingHeightMap, IGetImageListener, IImageResult, ILegacyWallGeometry, IObjectData, IPetColorResult, IPetCustomPart, IRoomContentListener, IRoomContentLoader, IRoomCreator, IRoomEngine, IRoomEngineServices, IRoomGeometry, IRoomInstance, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomRenderer, IRoomRenderingCanvas, IRoomSessionManager, ISelectedRoomObjectData, ISessionDataManager, ITileObjectMap, IUpdateReceiver, IVector3D, LegacyDataType, MouseEventType, ObjectDataFactory, PetFigureData, RoomControllerLevel, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, ToolbarIconEnum } from '@nitrots/api';
|
import { IFurnitureStackingHeightMap, IGetImageListener, IImageResult, ILegacyWallGeometry, IObjectData, IPetColorResult, IPetCustomPart, IRoomAreaSelectionManager, IRoomContentListener, IRoomContentLoader, IRoomCreator, IRoomEngine, IRoomEngineServices, IRoomGeometry, IRoomInstance, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomRenderer, IRoomRenderingCanvas, IRoomSessionManager, ISelectedRoomObjectData, ISessionDataManager, ITileObjectMap, IUpdateReceiver, IVector3D, LegacyDataType, MouseEventType, ObjectDataFactory, PetFigureData, RoomControllerLevel, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, ToolbarIconEnum } from '@nitrots/api';
|
||||||
import { GetCommunication, RenderRoomMessageComposer, RenderRoomThumbnailMessageComposer } from '@nitrots/communication';
|
import { GetCommunication, RenderRoomMessageComposer, RenderRoomThumbnailMessageComposer } from '@nitrots/communication';
|
||||||
import { GetConfiguration } from '@nitrots/configuration';
|
import { GetConfiguration } from '@nitrots/configuration';
|
||||||
import { BadgeImageReadyEvent, GetEventDispatcher, NitroToolbarAnimateIconEvent, RoomBackgroundColorEvent, RoomDragEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomObjectEvent, RoomObjectFurnitureActionEvent, RoomObjectMouseEvent, RoomSessionEvent, RoomToObjectOwnAvatarMoveEvent } from '@nitrots/events';
|
import { BadgeImageReadyEvent, GetEventDispatcher, NitroToolbarAnimateIconEvent, RoomBackgroundColorEvent, RoomDragEvent, RoomEngineAreaHideStateEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomObjectEvent, RoomObjectFurnitureActionEvent, RoomObjectMouseEvent, RoomSessionEvent, RoomToObjectOwnAvatarMoveEvent } from '@nitrots/events';
|
||||||
import { GetRoomSessionManager, GetSessionDataManager } from '@nitrots/session';
|
import { GetRoomSessionManager, GetSessionDataManager } from '@nitrots/session';
|
||||||
import { FurniId, GetTickerTime, NitroLogger, NumberBank, TextureUtils, Vector3d } from '@nitrots/utils';
|
import { FurniId, GetTickerTime, NitroLogger, NumberBank, TextureUtils, Vector3d } from '@nitrots/utils';
|
||||||
import { Container, Matrix, Point, Rectangle, RenderTexture, Sprite, Texture, Ticker } from 'pixi.js';
|
import { Container, Matrix, Point, Rectangle, RenderTexture, Sprite, Texture, Ticker } from 'pixi.js';
|
||||||
@ -16,7 +16,7 @@ import { RoomVariableEnum } from './RoomVariableEnum';
|
|||||||
import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, ObjectAvatarDanceUpdateMessage, ObjectAvatarEffectUpdateMessage, ObjectAvatarExperienceUpdateMessage, ObjectAvatarExpressionUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarFlatControlUpdateMessage, ObjectAvatarGestureUpdateMessage, ObjectAvatarGuideStatusUpdateMessage, ObjectAvatarMutedUpdateMessage, ObjectAvatarOwnMessage, ObjectAvatarPetGestureUpdateMessage, ObjectAvatarPlayerValueUpdateMessage, ObjectAvatarPlayingGameUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSignUpdateMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarTypingUpdateMessage, ObjectAvatarUpdateMessage, ObjectAvatarUseObjectUpdateMessage, ObjectDataUpdateMessage, ObjectGroupBadgeUpdateMessage, ObjectHeightUpdateMessage, ObjectItemDataUpdateMessage, ObjectModelDataUpdateMessage, ObjectMoveUpdateMessage, ObjectRoomColorUpdateMessage, ObjectRoomFloorHoleUpdateMessage, ObjectRoomMaskUpdateMessage, ObjectRoomPlanePropertyUpdateMessage, ObjectRoomPlaneVisibilityUpdateMessage, ObjectRoomUpdateMessage, ObjectStateUpdateMessage, RoomObjectUpdateMessage } from './messages';
|
import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, ObjectAvatarDanceUpdateMessage, ObjectAvatarEffectUpdateMessage, ObjectAvatarExperienceUpdateMessage, ObjectAvatarExpressionUpdateMessage, ObjectAvatarFigureUpdateMessage, ObjectAvatarFlatControlUpdateMessage, ObjectAvatarGestureUpdateMessage, ObjectAvatarGuideStatusUpdateMessage, ObjectAvatarMutedUpdateMessage, ObjectAvatarOwnMessage, ObjectAvatarPetGestureUpdateMessage, ObjectAvatarPlayerValueUpdateMessage, ObjectAvatarPlayingGameUpdateMessage, ObjectAvatarPostureUpdateMessage, ObjectAvatarSignUpdateMessage, ObjectAvatarSleepUpdateMessage, ObjectAvatarTypingUpdateMessage, ObjectAvatarUpdateMessage, ObjectAvatarUseObjectUpdateMessage, ObjectDataUpdateMessage, ObjectGroupBadgeUpdateMessage, ObjectHeightUpdateMessage, ObjectItemDataUpdateMessage, ObjectModelDataUpdateMessage, ObjectMoveUpdateMessage, ObjectRoomColorUpdateMessage, ObjectRoomFloorHoleUpdateMessage, ObjectRoomMaskUpdateMessage, ObjectRoomPlanePropertyUpdateMessage, ObjectRoomPlaneVisibilityUpdateMessage, ObjectRoomUpdateMessage, ObjectStateUpdateMessage, RoomObjectUpdateMessage } from './messages';
|
||||||
import { RoomLogic, RoomMapData } from './object';
|
import { RoomLogic, RoomMapData } from './object';
|
||||||
import { RoomRenderer } from './renderer';
|
import { RoomRenderer } from './renderer';
|
||||||
import { RoomCamera, RoomData, RoomEnterEffect, RoomFurnitureData, RoomGeometry, RoomInstanceData, RoomObjectBadgeImageAssetListener } from './utils';
|
import { RoomAreaSelectionManager, RoomCamera, RoomData, RoomEnterEffect, RoomFurnitureData, RoomGeometry, RoomInstanceData, RoomObjectBadgeImageAssetListener } from './utils';
|
||||||
|
|
||||||
export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineServices, IRoomManagerListener, IRoomContentListener, IUpdateReceiver
|
export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineServices, IRoomManagerListener, IRoomContentListener, IUpdateReceiver
|
||||||
{
|
{
|
||||||
@ -55,6 +55,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
private _activeRoomDragStartY: number = 0;
|
private _activeRoomDragStartY: number = 0;
|
||||||
private _activeRoomDragX: number = 0;
|
private _activeRoomDragX: number = 0;
|
||||||
private _activeRoomDragY: number = 0;
|
private _activeRoomDragY: number = 0;
|
||||||
|
private _moveBlocked: boolean = false;
|
||||||
private _roomDraggingAlwaysCenters: boolean = false;
|
private _roomDraggingAlwaysCenters: boolean = false;
|
||||||
private _roomAllowsDragging: boolean = true;
|
private _roomAllowsDragging: boolean = true;
|
||||||
private _roomDatas: Map<number, RoomData> = new Map();
|
private _roomDatas: Map<number, RoomData> = new Map();
|
||||||
@ -62,15 +63,11 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
private _skipFurnitureCreationForNextFrame: boolean = false;
|
private _skipFurnitureCreationForNextFrame: boolean = false;
|
||||||
private _mouseCursorUpdate: boolean = false;
|
private _mouseCursorUpdate: boolean = false;
|
||||||
private _badgeListenerObjects: Map<string, RoomObjectBadgeImageAssetListener[]> = new Map();
|
private _badgeListenerObjects: Map<string, RoomObjectBadgeImageAssetListener[]> = new Map();
|
||||||
|
private _areaSelectionManager: IRoomAreaSelectionManager = new RoomAreaSelectionManager(this);
|
||||||
constructor()
|
|
||||||
{
|
|
||||||
this.onBadgeImageReadyEvent = this.onBadgeImageReadyEvent.bind(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async init(): Promise<void>
|
public async init(): Promise<void>
|
||||||
{
|
{
|
||||||
GetRoomObjectLogicFactory().registerEventFunction(this.processRoomObjectEvent.bind(this));
|
GetRoomObjectLogicFactory().registerEventFunction(event => this.processRoomObjectEvent(event));
|
||||||
|
|
||||||
GetEventDispatcher().addEventListener<RoomSessionEvent>(RoomSessionEvent.STARTED, event => this.onRoomSessionEvent(event));
|
GetEventDispatcher().addEventListener<RoomSessionEvent>(RoomSessionEvent.STARTED, event => this.onRoomSessionEvent(event));
|
||||||
GetEventDispatcher().addEventListener<RoomSessionEvent>(RoomSessionEvent.ENDED, event => this.onRoomSessionEvent(event));
|
GetEventDispatcher().addEventListener<RoomSessionEvent>(RoomSessionEvent.ENDED, event => this.onRoomSessionEvent(event));
|
||||||
@ -548,6 +545,24 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public updateAreaHide(roomId: number, furniId: number, on: boolean, rootX: number, rootY: number, width: number, length: number, invert: boolean): boolean
|
||||||
|
{
|
||||||
|
const roomObject = this.getRoomOwnObject(roomId);
|
||||||
|
|
||||||
|
if(!roomObject || !roomObject.logic) return false;
|
||||||
|
|
||||||
|
GetEventDispatcher().dispatchEvent(new RoomEngineAreaHideStateEvent(roomId, furniId, RoomObjectCategory.FLOOR, on));
|
||||||
|
|
||||||
|
if(on)
|
||||||
|
{
|
||||||
|
roomObject.logic.processUpdateMessage(new ObjectRoomFloorHoleUpdateMessage(ObjectRoomFloorHoleUpdateMessage.ADD, furniId, rootX, rootY, width, length, invert));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
roomObject.logic.processUpdateMessage(new ObjectRoomFloorHoleUpdateMessage(ObjectRoomFloorHoleUpdateMessage.REMOVE, furniId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public updateObjectRoomColor(roomId: number, color: number, light: number, backgroundOnly: boolean): boolean
|
public updateObjectRoomColor(roomId: number, color: number, light: number, backgroundOnly: boolean): boolean
|
||||||
{
|
{
|
||||||
const roomObject = this.getRoomOwnObject(roomId);
|
const roomObject = this.getRoomOwnObject(roomId);
|
||||||
@ -685,7 +700,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
|
|
||||||
while((pendingData = instanceData.getNextPendingFurnitureFloor()))
|
while((pendingData = instanceData.getNextPendingFurnitureFloor()))
|
||||||
{
|
{
|
||||||
furnitureAdded = this.processPendingFurnitureFloor(instanceData.roomId, pendingData.id, pendingData);
|
furnitureAdded = this.addObjectFurnitureFromData(instanceData.roomId, pendingData.id, pendingData);
|
||||||
|
|
||||||
if(hasTickLimit)
|
if(hasTickLimit)
|
||||||
{
|
{
|
||||||
@ -705,7 +720,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
|
|
||||||
while(!this._skipFurnitureCreationForNextFrame && (pendingData = instanceData.getNextPendingFurnitureWall()))
|
while(!this._skipFurnitureCreationForNextFrame && (pendingData = instanceData.getNextPendingFurnitureWall()))
|
||||||
{
|
{
|
||||||
furnitureAdded = this.processPendingFurnitureWall(instanceData.roomId, pendingData.id, pendingData);
|
furnitureAdded = this.addObjectWallItemFromData(instanceData.roomId, pendingData.id, pendingData);
|
||||||
|
|
||||||
if(hasTickLimit)
|
if(hasTickLimit)
|
||||||
{
|
{
|
||||||
@ -734,7 +749,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private processPendingFurnitureFloor(roomId: number, id: number, data: RoomFurnitureData): boolean
|
private addObjectFurnitureFromData(roomId: number, id: number, data: RoomFurnitureData): boolean
|
||||||
{
|
{
|
||||||
if(!data)
|
if(!data)
|
||||||
{
|
{
|
||||||
@ -795,7 +810,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private processPendingFurnitureWall(roomId: number, id: number, data: RoomFurnitureData): boolean
|
private addObjectWallItemFromData(roomId: number, id: number, data: RoomFurnitureData): boolean
|
||||||
{
|
{
|
||||||
if(!data)
|
if(!data)
|
||||||
{
|
{
|
||||||
@ -1440,12 +1455,12 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
switch(category)
|
switch(category)
|
||||||
{
|
{
|
||||||
case RoomObjectCategory.FLOOR:
|
case RoomObjectCategory.FLOOR:
|
||||||
this.processPendingFurnitureFloor(this.getRoomIdFromString(roomId), objectId, null);
|
this.addObjectFurnitureFromData(this.getRoomIdFromString(roomId), objectId, null);
|
||||||
|
|
||||||
roomObject = (roomInstance.getRoomObject(objectId, category) as IRoomObjectController);
|
roomObject = (roomInstance.getRoomObject(objectId, category) as IRoomObjectController);
|
||||||
break;
|
break;
|
||||||
case RoomObjectCategory.WALL:
|
case RoomObjectCategory.WALL:
|
||||||
this.processPendingFurnitureWall(this.getRoomIdFromString(roomId), objectId, null);
|
this.addObjectWallItemFromData(this.getRoomIdFromString(roomId), objectId, null);
|
||||||
|
|
||||||
roomObject = (roomInstance.getRoomObject(objectId, category) as IRoomObjectController);
|
roomObject = (roomInstance.getRoomObject(objectId, category) as IRoomObjectController);
|
||||||
break;
|
break;
|
||||||
@ -2104,7 +2119,32 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
|
|
||||||
if(!this._badgeListenerObjects.size)
|
if(!this._badgeListenerObjects.size)
|
||||||
{
|
{
|
||||||
GetEventDispatcher().addEventListener(BadgeImageReadyEvent.IMAGE_READY, this.onBadgeImageReadyEvent);
|
const onBadgeImageReadyEvent = (event: BadgeImageReadyEvent) =>
|
||||||
|
{
|
||||||
|
const listeners = this._badgeListenerObjects && this._badgeListenerObjects.get(event.badgeId);
|
||||||
|
|
||||||
|
if(!listeners) return;
|
||||||
|
|
||||||
|
for(const listener of listeners)
|
||||||
|
{
|
||||||
|
if(!listener) continue;
|
||||||
|
|
||||||
|
this.putBadgeInObjectAssets(listener.object, event.badgeId, listener.groupBadge);
|
||||||
|
|
||||||
|
const badgeName = (listener.groupBadge) ? this._sessionDataManager.loadGroupBadgeImage(event.badgeId) : this._sessionDataManager.loadBadgeImage(event.badgeId);
|
||||||
|
|
||||||
|
if(listener.object && listener.object.logic) listener.object.logic.processUpdateMessage(new ObjectGroupBadgeUpdateMessage(event.badgeId, badgeName));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._badgeListenerObjects.delete(event.badgeId);
|
||||||
|
|
||||||
|
if(!this._badgeListenerObjects.size)
|
||||||
|
{
|
||||||
|
GetEventDispatcher().removeEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
GetEventDispatcher().addEventListener(BadgeImageReadyEvent.IMAGE_READY, onBadgeImageReadyEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
let listeners = this._badgeListenerObjects.get(badgeId);
|
let listeners = this._badgeListenerObjects.get(badgeId);
|
||||||
@ -2123,31 +2163,6 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
roomObject.logic.processUpdateMessage(new ObjectGroupBadgeUpdateMessage(badgeId, badgeName));
|
roomObject.logic.processUpdateMessage(new ObjectGroupBadgeUpdateMessage(badgeId, badgeName));
|
||||||
}
|
}
|
||||||
|
|
||||||
private onBadgeImageReadyEvent(k: BadgeImageReadyEvent): void
|
|
||||||
{
|
|
||||||
const listeners = this._badgeListenerObjects && this._badgeListenerObjects.get(k.badgeId);
|
|
||||||
|
|
||||||
if(!listeners) return;
|
|
||||||
|
|
||||||
for(const listener of listeners)
|
|
||||||
{
|
|
||||||
if(!listener) continue;
|
|
||||||
|
|
||||||
this.putBadgeInObjectAssets(listener.object, k.badgeId, listener.groupBadge);
|
|
||||||
|
|
||||||
const badgeName = (listener.groupBadge) ? this._sessionDataManager.loadGroupBadgeImage(k.badgeId) : this._sessionDataManager.loadBadgeImage(k.badgeId);
|
|
||||||
|
|
||||||
if(listener.object && listener.object.logic) listener.object.logic.processUpdateMessage(new ObjectGroupBadgeUpdateMessage(k.badgeId, badgeName));
|
|
||||||
}
|
|
||||||
|
|
||||||
this._badgeListenerObjects.delete(k.badgeId);
|
|
||||||
|
|
||||||
if(!this._badgeListenerObjects.size)
|
|
||||||
{
|
|
||||||
GetEventDispatcher().removeEventListener(BadgeImageReadyEvent.IMAGE_READY, this.onBadgeImageReadyEvent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private putBadgeInObjectAssets(object: IRoomObjectController, badgeId: string, groupBadge: boolean = false): void
|
private putBadgeInObjectAssets(object: IRoomObjectController, badgeId: string, groupBadge: boolean = false): void
|
||||||
{
|
{
|
||||||
const badgeName = (groupBadge) ? this._sessionDataManager.loadGroupBadgeImage(badgeId) : this._sessionDataManager.loadBadgeImage(badgeId);
|
const badgeName = (groupBadge) ? this._sessionDataManager.loadGroupBadgeImage(badgeId) : this._sessionDataManager.loadBadgeImage(badgeId);
|
||||||
@ -2173,33 +2188,37 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
sprite.y = (y - (rectangle.height / 2));
|
sprite.y = (y - (rectangle.height / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!this.handleRoomDragging(canvas, x, y, type, altKey, ctrlKey, shiftKey))
|
if(type === MouseEventType.MOUSE_CLICK && this._areaSelectionManager.finishSelecting())
|
||||||
{
|
{
|
||||||
if(!canvas.handleMouseEvent(x, y, type, altKey, ctrlKey, shiftKey, buttonDown))
|
this._areaSelectionManager.finishSelecting();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!this.handleRoomDragging(canvas, x, y, type, altKey, ctrlKey, shiftKey))
|
||||||
{
|
{
|
||||||
let eventType: string = null;
|
if(!canvas.handleMouseEvent(x, y, type, altKey, ctrlKey, shiftKey, buttonDown))
|
||||||
|
|
||||||
if(type === MouseEventType.MOUSE_CLICK)
|
|
||||||
{
|
{
|
||||||
if(GetEventDispatcher())
|
let eventType: string = null;
|
||||||
|
|
||||||
|
if(type === MouseEventType.MOUSE_CLICK)
|
||||||
{
|
{
|
||||||
GetEventDispatcher().dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, this._activeRoomId, -1, RoomObjectCategory.MINIMUM));
|
GetEventDispatcher().dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, this._activeRoomId, -1, RoomObjectCategory.MINIMUM));
|
||||||
|
|
||||||
|
eventType = RoomObjectMouseEvent.CLICK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(type === MouseEventType.MOUSE_MOVE) eventType = RoomObjectMouseEvent.MOUSE_MOVE;
|
||||||
|
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
eventType = RoomObjectMouseEvent.CLICK;
|
this._roomObjectEventHandler.handleRoomObjectEvent(new RoomObjectMouseEvent(eventType, this.getRoomObject(this._activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM), null, altKey), this._activeRoomId);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if(type === MouseEventType.MOUSE_MOVE) eventType = RoomObjectMouseEvent.MOUSE_MOVE;
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
this._roomObjectEventHandler.handleRoomObjectEvent(new RoomObjectMouseEvent(eventType, this.getRoomObject(this._activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM), null, altKey), this._activeRoomId);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2210,6 +2229,16 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
|
|
||||||
private handleRoomDragging(canvas: IRoomRenderingCanvas, x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean): boolean
|
private handleRoomDragging(canvas: IRoomRenderingCanvas, x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean): boolean
|
||||||
{
|
{
|
||||||
|
if(this.isPlayingGame()) return false;
|
||||||
|
|
||||||
|
if(this._areaSelectionManager.areaSelectionState === RoomAreaSelectionManager.SELECTING)
|
||||||
|
{
|
||||||
|
this._activeRoomIsDragged = false;
|
||||||
|
this._activeRoomWasDragged = false;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
let offsetX = (x - this._activeRoomActiveCanvasMouseX);
|
let offsetX = (x - this._activeRoomActiveCanvasMouseX);
|
||||||
let offsetY = (y - this._activeRoomActiveCanvasMouseY);
|
let offsetY = (y - this._activeRoomActiveCanvasMouseY);
|
||||||
|
|
||||||
@ -3004,7 +3033,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
|
|
||||||
while(index >= 0)
|
while(index >= 0)
|
||||||
{
|
{
|
||||||
const child = (container.getChildAt(index) as Sprite);
|
const child = (container.getChildAt(index));
|
||||||
|
|
||||||
if(child)
|
if(child)
|
||||||
{
|
{
|
||||||
@ -3014,7 +3043,7 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
|
|
||||||
if(child.children.length)
|
if(child.children.length)
|
||||||
{
|
{
|
||||||
const firstChild = (child.getChildAt(0) as Sprite);
|
const firstChild = (child.getChildAt(0));
|
||||||
|
|
||||||
firstChild.parent.removeChild(firstChild);
|
firstChild.parent.removeChild(firstChild);
|
||||||
|
|
||||||
@ -3039,11 +3068,11 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
|
|
||||||
while(index >= 0)
|
while(index >= 0)
|
||||||
{
|
{
|
||||||
const child = (container.getChildAt(index) as Sprite);
|
const child = (container.getChildAt(index));
|
||||||
|
|
||||||
if(child)
|
if(child)
|
||||||
{
|
{
|
||||||
if(child.label === label) return child;
|
if(child.label === label) return (child as Sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
index--;
|
index--;
|
||||||
@ -3228,6 +3257,11 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
this._roomManager = manager;
|
this._roomManager = manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get areaSelectionManager(): IRoomAreaSelectionManager
|
||||||
|
{
|
||||||
|
return this._areaSelectionManager;
|
||||||
|
}
|
||||||
|
|
||||||
public get objectEventHandler(): RoomObjectEventHandler
|
public get objectEventHandler(): RoomObjectEventHandler
|
||||||
{
|
{
|
||||||
return this._roomObjectEventHandler;
|
return this._roomObjectEventHandler;
|
||||||
@ -3263,4 +3297,24 @@ export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineService
|
|||||||
|
|
||||||
return this._roomManager.getRoomInstance(roomId.toString()).getRoomObjectsForCategory(categoryId).length;
|
return this._roomManager.getRoomInstance(roomId.toString()).getRoomObjectsForCategory(categoryId).length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get moveBlocked(): boolean
|
||||||
|
{
|
||||||
|
return this._moveBlocked;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set moveBlocked(flag: boolean)
|
||||||
|
{
|
||||||
|
this._moveBlocked = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public isAreaSelectionMode(): boolean
|
||||||
|
{
|
||||||
|
return this._areaSelectionManager.areaSelectionState !== RoomAreaSelectionManager.NOT_ACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public whereYouClickIsWhereYouGo(): boolean
|
||||||
|
{
|
||||||
|
return !this.isAreaSelectionMode();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,18 +17,24 @@ export class RoomManager implements IRoomManager, IRoomInstanceContainer
|
|||||||
private _pendingContentTypes: string[] = [];
|
private _pendingContentTypes: string[] = [];
|
||||||
private _skipContentProcessing: boolean = false;
|
private _skipContentProcessing: boolean = false;
|
||||||
|
|
||||||
constructor()
|
|
||||||
{
|
|
||||||
this.onRoomContentLoadedEvent = this.onRoomContentLoadedEvent.bind(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async init(listener: IRoomManagerListener): Promise<void>
|
public async init(listener: IRoomManagerListener): Promise<void>
|
||||||
{
|
{
|
||||||
this._listener = listener;
|
this._listener = listener;
|
||||||
|
|
||||||
GetEventDispatcher().addEventListener(RoomContentLoadedEvent.RCLE_SUCCESS, this.onRoomContentLoadedEvent);
|
const onRoomContentLoadedEvent = (event: RoomContentLoadedEvent) =>
|
||||||
GetEventDispatcher().addEventListener(RoomContentLoadedEvent.RCLE_FAILURE, this.onRoomContentLoadedEvent);
|
{
|
||||||
GetEventDispatcher().addEventListener(RoomContentLoadedEvent.RCLE_CANCEL, this.onRoomContentLoadedEvent);
|
if(!GetRoomContentLoader()) return;
|
||||||
|
|
||||||
|
const contentType = event.contentType;
|
||||||
|
|
||||||
|
if(this._pendingContentTypes.indexOf(contentType) >= 0) return;
|
||||||
|
|
||||||
|
this._pendingContentTypes.push(contentType);
|
||||||
|
};
|
||||||
|
|
||||||
|
GetEventDispatcher().addEventListener(RoomContentLoadedEvent.RCLE_SUCCESS, onRoomContentLoadedEvent);
|
||||||
|
GetEventDispatcher().addEventListener(RoomContentLoadedEvent.RCLE_FAILURE, onRoomContentLoadedEvent);
|
||||||
|
GetEventDispatcher().addEventListener(RoomContentLoadedEvent.RCLE_CANCEL, onRoomContentLoadedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
public getRoomInstance(roomId: string): IRoomInstance
|
public getRoomInstance(roomId: string): IRoomInstance
|
||||||
@ -276,17 +282,6 @@ export class RoomManager implements IRoomManager, IRoomInstanceContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onRoomContentLoadedEvent(event: RoomContentLoadedEvent): void
|
|
||||||
{
|
|
||||||
if(!GetRoomContentLoader()) return;
|
|
||||||
|
|
||||||
const contentType = event.contentType;
|
|
||||||
|
|
||||||
if(this._pendingContentTypes.indexOf(contentType) >= 0) return;
|
|
||||||
|
|
||||||
this._pendingContentTypes.push(contentType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public update(time: number, update: boolean = false): void
|
public update(time: number, update: boolean = false): void
|
||||||
{
|
{
|
||||||
this.processPendingContentTypes(time);
|
this.processPendingContentTypes(time);
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { AvatarGuideStatus, IConnection, IRoomCreator, IVector3D, LegacyDataType, ObjectRolling, PetType, RoomObjectType, RoomObjectUserType, RoomObjectVariable } from '@nitrots/api';
|
import { AvatarGuideStatus, IConnection, IRoomCreator, IVector3D, LegacyDataType, ObjectRolling, PetType, RoomObjectType, RoomObjectUserType, RoomObjectVariable } from '@nitrots/api';
|
||||||
import { DiceValueMessageEvent, FloorHeightMapEvent, FurnitureAliasesComposer, FurnitureAliasesEvent, FurnitureDataEvent, FurnitureFloorAddEvent, FurnitureFloorDataParser, FurnitureFloorEvent, FurnitureFloorRemoveEvent, FurnitureFloorUpdateEvent, FurnitureWallAddEvent, FurnitureWallDataParser, FurnitureWallEvent, FurnitureWallRemoveEvent, FurnitureWallUpdateEvent, GetCommunication, GetRoomEntryDataMessageComposer, GuideSessionEndedMessageEvent, GuideSessionErrorMessageEvent, GuideSessionStartedMessageEvent, IgnoreResultEvent, ItemDataUpdateMessageEvent, ObjectsDataUpdateEvent, ObjectsRollingEvent, OneWayDoorStatusMessageEvent, PetExperienceEvent, PetFigureUpdateEvent, RoomEntryTileMessageEvent, RoomEntryTileMessageParser, RoomHeightMapEvent, RoomHeightMapUpdateEvent, RoomPaintEvent, RoomReadyMessageEvent, RoomUnitChatEvent, RoomUnitChatShoutEvent, RoomUnitChatWhisperEvent, RoomUnitDanceEvent, RoomUnitEffectEvent, RoomUnitEvent, RoomUnitExpressionEvent, RoomUnitHandItemEvent, RoomUnitIdleEvent, RoomUnitInfoEvent, RoomUnitNumberEvent, RoomUnitRemoveEvent, RoomUnitStatusEvent, RoomUnitTypingEvent, RoomVisualizationSettingsEvent, UserInfoEvent, YouArePlayingGameEvent } from '@nitrots/communication';
|
import { AreaHideMessageEvent, DiceValueMessageEvent, FloorHeightMapEvent, FurnitureAliasesComposer, FurnitureAliasesEvent, FurnitureDataEvent, FurnitureFloorAddEvent, FurnitureFloorDataParser, FurnitureFloorEvent, FurnitureFloorRemoveEvent, FurnitureFloorUpdateEvent, FurnitureWallAddEvent, FurnitureWallDataParser, FurnitureWallEvent, FurnitureWallRemoveEvent, FurnitureWallUpdateEvent, GetCommunication, GetRoomEntryDataMessageComposer, GuideSessionEndedMessageEvent, GuideSessionErrorMessageEvent, GuideSessionStartedMessageEvent, IgnoreResultEvent, ItemDataUpdateMessageEvent, ObjectsDataUpdateEvent, ObjectsRollingEvent, OneWayDoorStatusMessageEvent, PetExperienceEvent, PetFigureUpdateEvent, RoomEntryTileMessageEvent, RoomEntryTileMessageParser, RoomHeightMapEvent, RoomHeightMapUpdateEvent, RoomPaintEvent, RoomReadyMessageEvent, RoomUnitChatEvent, RoomUnitChatShoutEvent, RoomUnitChatWhisperEvent, RoomUnitDanceEvent, RoomUnitEffectEvent, RoomUnitEvent, RoomUnitExpressionEvent, RoomUnitHandItemEvent, RoomUnitIdleEvent, RoomUnitInfoEvent, RoomUnitNumberEvent, RoomUnitRemoveEvent, RoomUnitStatusEvent, RoomUnitTypingEvent, RoomVisualizationSettingsEvent, UserInfoEvent, YouArePlayingGameEvent } from '@nitrots/communication';
|
||||||
import { GetRoomSessionManager, GetSessionDataManager } from '@nitrots/session';
|
import { GetRoomSessionManager, GetSessionDataManager } from '@nitrots/session';
|
||||||
import { Vector3d } from '@nitrots/utils';
|
import { Vector3d } from '@nitrots/utils';
|
||||||
import { GetRoomEngine } from './GetRoomEngine';
|
import { GetRoomEngine } from './GetRoomEngine';
|
||||||
@ -47,6 +47,7 @@ export class RoomMessageHandler
|
|||||||
this._connection.addMessageEvent(new FurnitureDataEvent(this.onFurnitureDataEvent.bind(this)));
|
this._connection.addMessageEvent(new FurnitureDataEvent(this.onFurnitureDataEvent.bind(this)));
|
||||||
this._connection.addMessageEvent(new ItemDataUpdateMessageEvent(this.onItemDataUpdateMessageEvent.bind(this)));
|
this._connection.addMessageEvent(new ItemDataUpdateMessageEvent(this.onItemDataUpdateMessageEvent.bind(this)));
|
||||||
this._connection.addMessageEvent(new OneWayDoorStatusMessageEvent(this.onOneWayDoorStatusMessageEvent.bind(this)));
|
this._connection.addMessageEvent(new OneWayDoorStatusMessageEvent(this.onOneWayDoorStatusMessageEvent.bind(this)));
|
||||||
|
this._connection.addMessageEvent(new AreaHideMessageEvent(this.onAreaHideMessageEvent.bind(this)));
|
||||||
this._connection.addMessageEvent(new RoomUnitDanceEvent(this.onRoomUnitDanceEvent.bind(this)));
|
this._connection.addMessageEvent(new RoomUnitDanceEvent(this.onRoomUnitDanceEvent.bind(this)));
|
||||||
this._connection.addMessageEvent(new RoomUnitEffectEvent(this.onRoomUnitEffectEvent.bind(this)));
|
this._connection.addMessageEvent(new RoomUnitEffectEvent(this.onRoomUnitEffectEvent.bind(this)));
|
||||||
this._connection.addMessageEvent(new RoomUnitEvent(this.onRoomUnitEvent.bind(this)));
|
this._connection.addMessageEvent(new RoomUnitEvent(this.onRoomUnitEvent.bind(this)));
|
||||||
@ -555,6 +556,16 @@ export class RoomMessageHandler
|
|||||||
this._roomEngine.updateRoomObjectFloor(this._currentRoomId, parser.itemId, null, null, parser.state, new LegacyDataType());
|
this._roomEngine.updateRoomObjectFloor(this._currentRoomId, parser.itemId, null, null, parser.state, new LegacyDataType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private onAreaHideMessageEvent(event: AreaHideMessageEvent): void
|
||||||
|
{
|
||||||
|
if(!(event instanceof AreaHideMessageEvent) || !event.connection || !this._roomEngine) return;
|
||||||
|
|
||||||
|
const parser = event.getParser();
|
||||||
|
const areaData = parser.areaData;
|
||||||
|
|
||||||
|
this._roomEngine.updateAreaHide(this._currentRoomId, areaData.furniId, areaData.on, areaData.rootX, areaData.rootY, areaData.width, areaData.length, areaData.invert);
|
||||||
|
}
|
||||||
|
|
||||||
private onDiceValueMessageEvent(event: DiceValueMessageEvent): void
|
private onDiceValueMessageEvent(event: DiceValueMessageEvent): void
|
||||||
{
|
{
|
||||||
if(!(event instanceof DiceValueMessageEvent) || !event.connection || !this._roomEngine) return;
|
if(!(event instanceof DiceValueMessageEvent) || !event.connection || !this._roomEngine) return;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { IFurnitureStackingHeightMap, ILegacyWallGeometry, IObjectData, IRoomCanvasMouseListener, IRoomEngineServices, IRoomGeometry, IRoomObject, IRoomObjectController, IRoomObjectEventManager, ISelectedRoomObjectData, IVector3D, MouseEventType, RoomObjectCategory, RoomObjectOperationType, RoomObjectPlacementSource, RoomObjectType, RoomObjectUserType, RoomObjectVariable } from '@nitrots/api';
|
import { IFurnitureStackingHeightMap, ILegacyWallGeometry, IObjectData, IRoomCanvasMouseListener, IRoomEngineServices, IRoomGeometry, IRoomObject, IRoomObjectController, IRoomObjectEventManager, ISelectedRoomObjectData, IVector3D, MouseEventType, RoomObjectCategory, RoomObjectOperationType, RoomObjectPlacementSource, RoomObjectType, RoomObjectUserType, RoomObjectVariable } from '@nitrots/api';
|
||||||
import { BotPlaceComposer, FurnitureColorWheelComposer, FurnitureDiceActivateComposer, FurnitureDiceDeactivateComposer, FurnitureFloorUpdateComposer, FurnitureGroupInfoComposer, FurnitureMultiStateComposer, FurnitureOneWayDoorComposer, FurniturePickupComposer, FurniturePlaceComposer, FurniturePostItPlaceComposer, FurnitureRandomStateComposer, FurnitureWallMultiStateComposer, FurnitureWallUpdateComposer, GetCommunication, GetItemDataComposer, GetResolutionAchievementsMessageComposer, PetMoveComposer, PetPlaceComposer, RemoveWallItemComposer, RoomUnitLookComposer, RoomUnitWalkComposer, SetItemDataMessageComposer, SetObjectDataMessageComposer } from '@nitrots/communication';
|
import { BotPlaceComposer, ClickFurniMessageComposer, FurnitureColorWheelComposer, FurnitureDiceActivateComposer, FurnitureDiceDeactivateComposer, FurnitureFloorUpdateComposer, FurnitureGroupInfoComposer, FurnitureMultiStateComposer, FurnitureOneWayDoorComposer, FurniturePickupComposer, FurniturePlaceComposer, FurniturePostItPlaceComposer, FurnitureRandomStateComposer, FurnitureWallMultiStateComposer, FurnitureWallUpdateComposer, GetCommunication, GetItemDataComposer, GetResolutionAchievementsMessageComposer, PetMoveComposer, PetPlaceComposer, RemoveWallItemComposer, RoomUnitLookComposer, RoomUnitWalkComposer, SetItemDataMessageComposer, SetObjectDataMessageComposer } from '@nitrots/communication';
|
||||||
import { GetConfiguration } from '@nitrots/configuration';
|
import { GetConfiguration } from '@nitrots/configuration';
|
||||||
import { GetEventDispatcher, RoomEngineDimmerStateEvent, RoomEngineObjectEvent, RoomEngineObjectPlacedEvent, RoomEngineObjectPlacedOnUserEvent, RoomEngineObjectPlaySoundEvent, RoomEngineRoomAdEvent, RoomEngineSamplePlaybackEvent, RoomEngineTriggerWidgetEvent, RoomEngineUseProductEvent, RoomObjectBadgeAssetEvent, RoomObjectDataRequestEvent, RoomObjectDimmerStateUpdateEvent, RoomObjectEvent, RoomObjectFloorHoleEvent, RoomObjectFurnitureActionEvent, RoomObjectHSLColorEnableEvent, RoomObjectHSLColorEnabledEvent, RoomObjectMouseEvent, RoomObjectMoveEvent, RoomObjectPlaySoundIdEvent, RoomObjectRoomAdEvent, RoomObjectSamplePlaybackEvent, RoomObjectSoundMachineEvent, RoomObjectStateChangedEvent, RoomObjectTileMouseEvent, RoomObjectWallMouseEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '@nitrots/events';
|
import { GetEventDispatcher, RoomEngineDimmerStateEvent, RoomEngineObjectEvent, RoomEngineObjectPlacedEvent, RoomEngineObjectPlacedOnUserEvent, RoomEngineObjectPlaySoundEvent, RoomEngineRoomAdEvent, RoomEngineSamplePlaybackEvent, RoomEngineTriggerWidgetEvent, RoomEngineUseProductEvent, RoomObjectBadgeAssetEvent, RoomObjectDataRequestEvent, RoomObjectDimmerStateUpdateEvent, RoomObjectEvent, RoomObjectFloorHoleEvent, RoomObjectFurnitureActionEvent, RoomObjectHSLColorEnableEvent, RoomObjectHSLColorEnabledEvent, RoomObjectMouseEvent, RoomObjectMoveEvent, RoomObjectPlaySoundIdEvent, RoomObjectRoomAdEvent, RoomObjectSamplePlaybackEvent, RoomObjectSoundMachineEvent, RoomObjectStateChangedEvent, RoomObjectTileMouseEvent, RoomObjectWallMouseEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '@nitrots/events';
|
||||||
import { GetRoomSessionManager, GetSessionDataManager } from '@nitrots/session';
|
import { GetRoomSessionManager, GetSessionDataManager } from '@nitrots/session';
|
||||||
@ -185,6 +185,7 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
case RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG:
|
case RoomObjectWidgetRequestEvent.MONSTERPLANT_SEED_PLANT_CONFIRMATION_DIALOG:
|
||||||
case RoomObjectWidgetRequestEvent.PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG:
|
case RoomObjectWidgetRequestEvent.PURCHASABLE_CLOTHING_CONFIRMATION_DIALOG:
|
||||||
case RoomObjectWidgetRequestEvent.BACKGROUND_COLOR:
|
case RoomObjectWidgetRequestEvent.BACKGROUND_COLOR:
|
||||||
|
case RoomObjectWidgetRequestEvent.AREA_HIDE:
|
||||||
case RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG:
|
case RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG:
|
||||||
case RoomObjectWidgetRequestEvent.EFFECTBOX_OPEN_DIALOG:
|
case RoomObjectWidgetRequestEvent.EFFECTBOX_OPEN_DIALOG:
|
||||||
case RoomObjectWidgetRequestEvent.MYSTERYTROPHY_OPEN_DIALOG:
|
case RoomObjectWidgetRequestEvent.MYSTERYTROPHY_OPEN_DIALOG:
|
||||||
@ -265,6 +266,11 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
{
|
{
|
||||||
if(!event || !event.type) return;
|
if(!event || !event.type) return;
|
||||||
|
|
||||||
|
if(event instanceof RoomObjectTileMouseEvent)
|
||||||
|
{
|
||||||
|
this._roomEngine.areaSelectionManager.handleTileMouseEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case RoomObjectMouseEvent.CLICK:
|
case RoomObjectMouseEvent.CLICK:
|
||||||
@ -291,10 +297,36 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private clickRoomObject(event: RoomObjectMouseEvent): void
|
||||||
|
{
|
||||||
|
if(!event || event.altKey || event.ctrlKey || event.shiftKey) return;
|
||||||
|
|
||||||
|
const objectId = event.objectId;
|
||||||
|
const objectType = event.objectType;
|
||||||
|
const category = this._roomEngine.getRoomObjectCategoryForType(objectType);
|
||||||
|
|
||||||
|
if(category === RoomObjectCategory.FLOOR)
|
||||||
|
{
|
||||||
|
GetCommunication().connection.send(new ClickFurniMessageComposer(objectId, category));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(category === RoomObjectCategory.WALL)
|
||||||
|
{
|
||||||
|
// This packet only sends a negative number to tell the server that its a wall item
|
||||||
|
GetCommunication().connection.send(new ClickFurniMessageComposer(-Math.abs(objectId), category));
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private handleRoomObjectMouseClickEvent(event: RoomObjectMouseEvent, roomId: number): void
|
private handleRoomObjectMouseClickEvent(event: RoomObjectMouseEvent, roomId: number): void
|
||||||
{
|
{
|
||||||
if(!event) return;
|
if(!event) return;
|
||||||
|
|
||||||
|
this.clickRoomObject(event);
|
||||||
|
|
||||||
let operation = RoomObjectOperationType.OBJECT_UNDEFINED;
|
let operation = RoomObjectOperationType.OBJECT_UNDEFINED;
|
||||||
|
|
||||||
const selectedData = this.getSelectedRoomObjectData(roomId);
|
const selectedData = this.getSelectedRoomObjectData(roomId);
|
||||||
@ -304,7 +336,7 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
let didWalk = false;
|
let didWalk = false;
|
||||||
let didMove = false;
|
let didMove = false;
|
||||||
|
|
||||||
if(this._whereYouClickIsWhereYouGo)
|
if(this.whereYouClickIsWhereYouGo())
|
||||||
{
|
{
|
||||||
if(!operation || (operation === RoomObjectOperationType.OBJECT_UNDEFINED))
|
if(!operation || (operation === RoomObjectOperationType.OBJECT_UNDEFINED))
|
||||||
{
|
{
|
||||||
@ -370,11 +402,20 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
case RoomObjectOperationType.OBJECT_UNDEFINED:
|
case RoomObjectOperationType.OBJECT_UNDEFINED:
|
||||||
if(category === RoomObjectCategory.ROOM)
|
if(category === RoomObjectCategory.ROOM)
|
||||||
{
|
{
|
||||||
if(!didWalk && (event instanceof RoomObjectTileMouseEvent)) this.onRoomObjectTileMouseEvent(roomId, event);
|
if(!didWalk && (event instanceof RoomObjectTileMouseEvent)) this.handleClickOnTile(roomId, event);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.setSelectedObject(roomId, event.objectId, category);
|
if(!this._roomEngine.isAreaSelectionMode() || (category === RoomObjectCategory.UNIT))
|
||||||
|
{
|
||||||
|
this.setSelectedObject(roomId, event.objectId, category);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.deselectObject(roomId);
|
||||||
|
|
||||||
|
GetEventDispatcher().dispatchEvent(new RoomEngineObjectEvent(RoomEngineObjectEvent.DESELECTED, roomId, -1, RoomObjectCategory.MINIMUM));
|
||||||
|
}
|
||||||
|
|
||||||
didMove = false;
|
didMove = false;
|
||||||
|
|
||||||
@ -507,7 +548,7 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
|
|
||||||
else if(event.object && (event.object.id !== -1))
|
else if(event.object && (event.object.id !== -1))
|
||||||
{
|
{
|
||||||
if(this._whereYouClickIsWhereYouGo)
|
if(this.whereYouClickIsWhereYouGo())
|
||||||
{
|
{
|
||||||
newEvent = this.handleMouseOverObject(category, roomId, event);
|
newEvent = this.handleMouseOverObject(category, roomId, event);
|
||||||
}
|
}
|
||||||
@ -758,6 +799,9 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
case RoomObjectWidgetRequestEvent.BACKGROUND_COLOR:
|
case RoomObjectWidgetRequestEvent.BACKGROUND_COLOR:
|
||||||
GetEventDispatcher().dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_BACKGROUND_COLOR, roomId, objectId, objectCategory));
|
GetEventDispatcher().dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_BACKGROUND_COLOR, roomId, objectId, objectCategory));
|
||||||
return;
|
return;
|
||||||
|
case RoomObjectWidgetRequestEvent.AREA_HIDE:
|
||||||
|
GetEventDispatcher().dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_AREA_HIDE, roomId, objectId, objectCategory));
|
||||||
|
return;
|
||||||
case RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG:
|
case RoomObjectWidgetRequestEvent.MYSTERYBOX_OPEN_DIALOG:
|
||||||
GetEventDispatcher().dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MYSTERYBOX_OPEN_DIALOG, roomId, objectId, objectCategory));
|
GetEventDispatcher().dispatchEvent(new RoomEngineTriggerWidgetEvent(RoomEngineTriggerWidgetEvent.REQUEST_MYSTERYBOX_OPEN_DIALOG, roomId, objectId, objectCategory));
|
||||||
return;
|
return;
|
||||||
@ -1017,13 +1061,15 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private onRoomObjectTileMouseEvent(roomId: number, event: RoomObjectTileMouseEvent): void
|
private handleClickOnTile(roomId: number, event: RoomObjectTileMouseEvent): void
|
||||||
{
|
{
|
||||||
|
if(!this._roomEngine || this._roomEngine.isDecorating) return;
|
||||||
|
|
||||||
const session = GetRoomSessionManager().getSession(roomId);
|
const session = GetRoomSessionManager().getSession(roomId);
|
||||||
|
|
||||||
if(!session || session.isSpectator) return;
|
if(!session || session.isSpectator) return;
|
||||||
|
|
||||||
this.sendWalkUpdate(event.tileXAsInt, event.tileYAsInt);
|
if(!this._roomEngine.moveBlocked) this.sendWalkUpdate(event.tileXAsInt, event.tileYAsInt);
|
||||||
}
|
}
|
||||||
|
|
||||||
private handleObjectMove(event: RoomObjectMouseEvent, roomId: number): void
|
private handleObjectMove(event: RoomObjectMouseEvent, roomId: number): void
|
||||||
@ -1480,14 +1526,12 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
|
|
||||||
private handleMoveTargetFurni(k: number, _arg_2: RoomObjectMouseEvent): boolean
|
private handleMoveTargetFurni(k: number, _arg_2: RoomObjectMouseEvent): boolean
|
||||||
{
|
{
|
||||||
if((_arg_2.objectType === RoomObjectUserType.USER) || (_arg_2.objectType === RoomObjectUserType.PET) || (_arg_2.objectType === RoomObjectUserType.BOT) || (_arg_2.objectType === RoomObjectUserType.RENTABLE_BOT) || (_arg_2.objectType === RoomObjectUserType.MONSTER_PLANT)) return;
|
const roomObject = this._roomEngine.getRoomObject(k, _arg_2.objectId, RoomObjectCategory.FLOOR);
|
||||||
|
const point = this.getActiveSurfaceLocation(roomObject, _arg_2);
|
||||||
|
|
||||||
const _local_3 = this._roomEngine.getRoomObject(k, _arg_2.objectId, RoomObjectCategory.FLOOR);
|
if(point && !this._roomEngine.moveBlocked)
|
||||||
const _local_4 = this.getActiveSurfaceLocation(_local_3, _arg_2);
|
|
||||||
|
|
||||||
if(_local_4)
|
|
||||||
{
|
{
|
||||||
this.sendWalkUpdate(_local_4.x, _local_4.y);
|
this.sendWalkUpdate(point.x, point.y);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1548,7 +1592,7 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
|
|
||||||
private handleMouseOverTile(k: RoomObjectTileMouseEvent, roomId: number): ObjectTileCursorUpdateMessage
|
private handleMouseOverTile(k: RoomObjectTileMouseEvent, roomId: number): ObjectTileCursorUpdateMessage
|
||||||
{
|
{
|
||||||
if(this._whereYouClickIsWhereYouGo)
|
if(this.whereYouClickIsWhereYouGo())
|
||||||
{
|
{
|
||||||
return new ObjectTileCursorUpdateMessage(new Vector3d(k.tileXAsInt, k.tileYAsInt, k.tileZAsInt), 0, true, k.eventId);
|
return new ObjectTileCursorUpdateMessage(new Vector3d(k.tileXAsInt, k.tileYAsInt, k.tileZAsInt), 0, true, k.eventId);
|
||||||
}
|
}
|
||||||
@ -1955,17 +1999,17 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
|
|
||||||
private placeObjectOnUser(roomId: number, objectId: number, category: number): void
|
private placeObjectOnUser(roomId: number, objectId: number, category: number): void
|
||||||
{
|
{
|
||||||
const _local_4 = this.getSelectedRoomObjectData(roomId);
|
const objectData = this.getSelectedRoomObjectData(roomId);
|
||||||
|
|
||||||
if(!_local_4) return;
|
if(!objectData) return;
|
||||||
|
|
||||||
const _local_5 = (this._roomEngine.getRoomObject(roomId, objectId, category) as IRoomObjectController);
|
const roomObjectController = this._roomEngine.getRoomObject(roomId, objectId, category);
|
||||||
|
|
||||||
if(!_local_5) return;
|
if(!roomObjectController) return;
|
||||||
|
|
||||||
if(!this._roomEngine || !GetEventDispatcher()) return;
|
if(!this._roomEngine || !GetEventDispatcher()) return;
|
||||||
|
|
||||||
GetEventDispatcher().dispatchEvent(new RoomEngineObjectPlacedOnUserEvent(RoomEngineObjectEvent.PLACED_ON_USER, roomId, objectId, category, _local_4.id, _local_4.category));
|
GetEventDispatcher().dispatchEvent(new RoomEngineObjectPlacedOnUserEvent(RoomEngineObjectEvent.PLACED_ON_USER, roomId, objectId, category, objectData.id, objectData.category));
|
||||||
}
|
}
|
||||||
|
|
||||||
public setSelectedObject(roomId: number, objectId: number, category: number): void
|
public setSelectedObject(roomId: number, objectId: number, category: number): void
|
||||||
@ -2187,4 +2231,9 @@ export class RoomObjectEventHandler implements IRoomCanvasMouseListener, IRoomOb
|
|||||||
{
|
{
|
||||||
return this._selectedAvatarId;
|
return this._selectedAvatarId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public whereYouClickIsWhereYouGo(): boolean
|
||||||
|
{
|
||||||
|
return this._roomEngine.whereYouClickIsWhereYouGo();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ import { IEventDispatcher, IRoomObjectEventHandler, IRoomObjectLogicFactory, Roo
|
|||||||
import { GetEventDispatcher, RoomObjectEvent } from '@nitrots/events';
|
import { GetEventDispatcher, RoomObjectEvent } from '@nitrots/events';
|
||||||
import { NitroLogger } from '@nitrots/utils';
|
import { NitroLogger } from '@nitrots/utils';
|
||||||
import { RoomObjectLogicBase } from '../../room';
|
import { RoomObjectLogicBase } from '../../room';
|
||||||
import { AvatarLogic, FurnitureAchievementResolutionLogic, FurnitureBadgeDisplayLogic, FurnitureChangeStateWhenStepOnLogic, FurnitureClothingChangeLogic, FurnitureCounterClockLogic, FurnitureCrackableLogic, FurnitureCraftingGizmoLogic, FurnitureCreditLogic, FurnitureCuckooClockLogic, FurnitureCustomStackHeightLogic, FurnitureDiceLogic, FurnitureEcotronBoxLogic, FurnitureEditableInternalLinkLogic, FurnitureEditableRoomLinkLogic, FurnitureEffectBoxLogic, FurnitureExternalImageLogic, FurnitureFireworksLogic, FurnitureFloorHoleLogic, FurnitureGroupForumTerminalLogic, FurnitureGuildCustomizedLogic, FurnitureHabboWheelLogic, FurnitureHighScoreLogic, FurnitureHockeyScoreLogic, FurnitureHweenLovelockLogic, FurnitureIceStormLogic, FurnitureInternalLinkLogic, FurnitureJukeboxLogic, FurnitureLogic, FurnitureLoveLockLogic, FurnitureMannequinLogic, FurnitureMonsterplantSeedLogic, FurnitureMultiHeightLogic, FurnitureMultiStateLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurnitureOneWayDoorLogic, FurniturePetCustomizationLogic, FurniturePlaceholderLogic, FurniturePlanetSystemLogic, FurniturePresentLogic, FurniturePurchaseableClothingLogic, FurniturePushableLogic, FurnitureRandomStateLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic, FurnitureRoomBackgroundColorLogic, FurnitureRoomBackgroundLogic, FurnitureRoomBillboardLogic, FurnitureRoomDimmerLogic, FurnitureScoreLogic, FurnitureSongDiskLogic, FurnitureSoundBlockLogic, FurnitureSoundMachineLogic, FurnitureStickieLogic, FurnitureTrophyLogic, FurnitureVoteCounterLogic, FurnitureVoteMajorityLogic, FurnitureWelcomeGiftLogic, FurnitureWindowLogic, FurnitureYoutubeLogic, PetLogic, RoomLogic, SelectionArrowLogic, TileCursorLogic } from './object';
|
import { AvatarLogic, FurnitureAchievementResolutionLogic, FurnitureAreaHideLogic, FurnitureBadgeDisplayLogic, FurnitureChangeStateWhenStepOnLogic, FurnitureClothingChangeLogic, FurnitureCounterClockLogic, FurnitureCrackableLogic, FurnitureCraftingGizmoLogic, FurnitureCreditLogic, FurnitureCuckooClockLogic, FurnitureCustomStackHeightLogic, FurnitureDiceLogic, FurnitureEcotronBoxLogic, FurnitureEditableInternalLinkLogic, FurnitureEditableRoomLinkLogic, FurnitureEffectBoxLogic, FurnitureExternalImageLogic, FurnitureFireworksLogic, FurnitureFloorHoleLogic, FurnitureGroupForumTerminalLogic, FurnitureGuildCustomizedLogic, FurnitureHabboWheelLogic, FurnitureHighScoreLogic, FurnitureHockeyScoreLogic, FurnitureHweenLovelockLogic, FurnitureIceStormLogic, FurnitureInternalLinkLogic, FurnitureJukeboxLogic, FurnitureLogic, FurnitureLoveLockLogic, FurnitureMannequinLogic, FurnitureMonsterplantSeedLogic, FurnitureMultiHeightLogic, FurnitureMultiStateLogic, FurnitureMysteryBoxLogic, FurnitureMysteryTrophyLogic, FurnitureOneWayDoorLogic, FurniturePetCustomizationLogic, FurniturePlaceholderLogic, FurniturePlanetSystemLogic, FurniturePresentLogic, FurniturePurchaseableClothingLogic, FurniturePushableLogic, FurnitureRandomStateLogic, FurnitureRandomTeleportLogic, FurnitureRentableSpaceLogic, FurnitureRoomBackgroundColorLogic, FurnitureRoomBackgroundLogic, FurnitureRoomBillboardLogic, FurnitureRoomDimmerLogic, FurnitureScoreLogic, FurnitureSongDiskLogic, FurnitureSoundBlockLogic, FurnitureSoundMachineLogic, FurnitureStickieLogic, FurnitureTrophyLogic, FurnitureVoteCounterLogic, FurnitureVoteMajorityLogic, FurnitureWelcomeGiftLogic, FurnitureWindowLogic, FurnitureYoutubeLogic, PetLogic, RoomLogic, SelectionArrowLogic, TileCursorLogic } from './object';
|
||||||
|
|
||||||
export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
|
export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
|
||||||
{
|
{
|
||||||
@ -293,6 +293,9 @@ export class RoomObjectLogicFactory implements IRoomObjectLogicFactory
|
|||||||
case RoomObjectLogicType.FURNITURE_HABBOWHEEL:
|
case RoomObjectLogicType.FURNITURE_HABBOWHEEL:
|
||||||
logic = FurnitureHabboWheelLogic;
|
logic = FurnitureHabboWheelLogic;
|
||||||
break;
|
break;
|
||||||
|
case RoomObjectLogicType.FURNITURE_AREA_HIDE:
|
||||||
|
logic = FurnitureAreaHideLogic;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
logic = FurnitureLogic;
|
logic = FurnitureLogic;
|
||||||
break;
|
break;
|
||||||
|
@ -36,7 +36,7 @@ export class RoomPreviewer
|
|||||||
private _automaticStateChange: boolean;
|
private _automaticStateChange: boolean;
|
||||||
private _previousAutomaticStateChangeTime: number;
|
private _previousAutomaticStateChangeTime: number;
|
||||||
private _addViewOffset: Point;
|
private _addViewOffset: Point;
|
||||||
private _backgroundColor: number = 305148561;
|
private _backgroundColor: number = 0x000000;
|
||||||
private _backgroundSprite: Sprite = null;
|
private _backgroundSprite: Sprite = null;
|
||||||
private _disableUpdate: boolean = false;
|
private _disableUpdate: boolean = false;
|
||||||
|
|
||||||
@ -431,7 +431,7 @@ export class RoomPreviewer
|
|||||||
{
|
{
|
||||||
if(this.isRoomEngineReady)
|
if(this.isRoomEngineReady)
|
||||||
{
|
{
|
||||||
const displayObject = (this._roomEngine.getRoomInstanceDisplay(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, width, height, this._currentPreviewScale) as Container);
|
const displayObject = this._roomEngine.getRoomInstanceDisplay(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, width, height, this._currentPreviewScale);
|
||||||
|
|
||||||
if(displayObject && (this._backgroundColor !== null))
|
if(displayObject && (this._backgroundColor !== null))
|
||||||
{
|
{
|
||||||
@ -446,7 +446,7 @@ export class RoomPreviewer
|
|||||||
|
|
||||||
backgroundSprite.width = width;
|
backgroundSprite.width = width;
|
||||||
backgroundSprite.height = height;
|
backgroundSprite.height = height;
|
||||||
//backgroundSprite.tint = this._backgroundColor;
|
backgroundSprite.tint = this._backgroundColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._roomEngine.setRoomInstanceRenderingCanvasMask(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, true);
|
this._roomEngine.setRoomInstanceRenderingCanvasMask(this._previewRoomId, RoomPreviewer.PREVIEW_CANVAS_ID, true);
|
||||||
|
@ -11,8 +11,9 @@ export class ObjectRoomFloorHoleUpdateMessage extends RoomObjectUpdateMessage
|
|||||||
private _y: number;
|
private _y: number;
|
||||||
private _width: number;
|
private _width: number;
|
||||||
private _height: number;
|
private _height: number;
|
||||||
|
private _invert: boolean;
|
||||||
|
|
||||||
constructor(type: string, id: number, x: number = 0, y: number = 0, width: number = 0, height: number = 0)
|
constructor(type: string, id: number, x: number = 0, y: number = 0, width: number = 0, height: number = 0, invert: boolean = false)
|
||||||
{
|
{
|
||||||
super(null, null);
|
super(null, null);
|
||||||
|
|
||||||
@ -22,6 +23,7 @@ export class ObjectRoomFloorHoleUpdateMessage extends RoomObjectUpdateMessage
|
|||||||
this._y = y;
|
this._y = y;
|
||||||
this._width = width;
|
this._width = width;
|
||||||
this._height = height;
|
this._height = height;
|
||||||
|
this._invert = invert;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get type(): string
|
public get type(): string
|
||||||
@ -53,4 +55,9 @@ export class ObjectRoomFloorHoleUpdateMessage extends RoomObjectUpdateMessage
|
|||||||
{
|
{
|
||||||
return this._height;
|
return this._height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get invert(): boolean
|
||||||
|
{
|
||||||
|
return this._invert;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ export class RoomMapData implements IRoomMapData
|
|||||||
private _wallHeight: number;
|
private _wallHeight: number;
|
||||||
private _fixedWallsHeight: number;
|
private _fixedWallsHeight: number;
|
||||||
private _tileMap: { height: number }[][];
|
private _tileMap: { height: number }[][];
|
||||||
private _holeMap: { id: number, x: number, y: number, width: number, height: number }[];
|
private _holeMap: { id: number, x: number, y: number, width: number, height: number, invert: boolean }[];
|
||||||
private _doors: { x: number, y: number, z: number, dir: number }[];
|
private _doors: { x: number, y: number, z: number, dir: number }[];
|
||||||
private _dimensions: { minX: number, maxX: number, minY: number, maxY: number };
|
private _dimensions: { minX: number, maxX: number, minY: number, maxY: number };
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ export class RoomMapData implements IRoomMapData
|
|||||||
return this._tileMap;
|
return this._tileMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get holeMap(): { id: number, x: number, y: number, width: number, height: number }[]
|
public get holeMap(): { id: number, x: number, y: number, width: number, height: number, invert: boolean }[]
|
||||||
{
|
{
|
||||||
return this._holeMap;
|
return this._holeMap;
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ export class RoomObjectModel implements IRoomObjectModel
|
|||||||
if(this._map.get(key) === value) return;
|
if(this._map.get(key) === value) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._map.set(key, (value as T));
|
this._map.set(key, value);
|
||||||
|
|
||||||
this._updateCounter++;
|
this._updateCounter++;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -413,12 +413,14 @@ export class RoomLogic extends RoomObjectLogicBase
|
|||||||
let eventType: string = null;
|
let eventType: string = null;
|
||||||
|
|
||||||
if((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.ROLL_OVER)) eventType = RoomObjectMouseEvent.MOUSE_MOVE;
|
if((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.ROLL_OVER)) eventType = RoomObjectMouseEvent.MOUSE_MOVE;
|
||||||
else if((event.type === MouseEventType.MOUSE_CLICK)) eventType = RoomObjectMouseEvent.CLICK;
|
else if(event.type === MouseEventType.MOUSE_CLICK) eventType = RoomObjectMouseEvent.CLICK;
|
||||||
|
else if(event.type === MouseEventType.MOUSE_DOWN) eventType = RoomObjectMouseEvent.MOUSE_DOWN;
|
||||||
|
|
||||||
switch(event.type)
|
switch(event.type)
|
||||||
{
|
{
|
||||||
case MouseEventType.MOUSE_MOVE:
|
case MouseEventType.MOUSE_MOVE:
|
||||||
case MouseEventType.ROLL_OVER:
|
case MouseEventType.ROLL_OVER:
|
||||||
|
case MouseEventType.MOUSE_DOWN:
|
||||||
case MouseEventType.MOUSE_CLICK: {
|
case MouseEventType.MOUSE_CLICK: {
|
||||||
let newEvent: RoomObjectEvent = null;
|
let newEvent: RoomObjectEvent = null;
|
||||||
|
|
||||||
|
@ -0,0 +1,96 @@
|
|||||||
|
import { IRoomGeometry, MouseEventType, NumberDataType, RoomObjectVariable } from '@nitrots/api';
|
||||||
|
import { RoomObjectEvent, RoomObjectStateChangedEvent, RoomObjectWidgetRequestEvent, RoomSpriteMouseEvent } from '@nitrots/events';
|
||||||
|
import { ObjectDataUpdateMessage, RoomObjectUpdateMessage } from '../../../messages';
|
||||||
|
import { FurnitureMultiStateLogic } from './FurnitureMultiStateLogic';
|
||||||
|
|
||||||
|
export class FurnitureAreaHideLogic extends FurnitureMultiStateLogic
|
||||||
|
{
|
||||||
|
public getEventTypes(): string[]
|
||||||
|
{
|
||||||
|
const types = [RoomObjectWidgetRequestEvent.AREA_HIDE];
|
||||||
|
|
||||||
|
return this.mergeTypes(super.getEventTypes(), types);
|
||||||
|
}
|
||||||
|
|
||||||
|
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||||
|
{
|
||||||
|
super.processUpdateMessage(message);
|
||||||
|
|
||||||
|
if(!this.object) return;
|
||||||
|
|
||||||
|
if(message instanceof ObjectDataUpdateMessage)
|
||||||
|
{
|
||||||
|
message.data.writeRoomObjectModel(this.object.model);
|
||||||
|
|
||||||
|
if(this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_REAL_ROOM_OBJECT) === 1)
|
||||||
|
{
|
||||||
|
this.setupObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private setupObject(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.object.model) return;
|
||||||
|
|
||||||
|
const numberData = new NumberDataType();
|
||||||
|
|
||||||
|
numberData.initializeFromRoomObjectModel(this.object.model);
|
||||||
|
|
||||||
|
const state = numberData.getValue(0);
|
||||||
|
const rootX = numberData.getValue(1);
|
||||||
|
const rootY = numberData.getValue(2);
|
||||||
|
const width = numberData.getValue(3);
|
||||||
|
const length = numberData.getValue(4);
|
||||||
|
const invisibility = (numberData.getValue(5) === 1);
|
||||||
|
const wallItems = (numberData.getValue(6) === 1);
|
||||||
|
const invert = (numberData.getValue(7) === 1);
|
||||||
|
|
||||||
|
this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_ROOT_X, rootX);
|
||||||
|
this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_ROOT_Y, rootY);
|
||||||
|
this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_WIDTH, width);
|
||||||
|
this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_LENGTH, length);
|
||||||
|
this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_INVISIBILITY, ((invisibility) ? 1 : 0));
|
||||||
|
this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_WALL_ITEMS, ((wallItems) ? 1 : 0));
|
||||||
|
this.object.model.setValue(RoomObjectVariable.FURNITURE_AREA_HIDE_INVERT, ((invert) ? 1 : 0));
|
||||||
|
this.object.setState(state, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public useObject(): void
|
||||||
|
{
|
||||||
|
if(!this.object || !this.eventDispatcher) return;
|
||||||
|
|
||||||
|
this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.AREA_HIDE, this.object));
|
||||||
|
}
|
||||||
|
|
||||||
|
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||||
|
{
|
||||||
|
if(!event || !geometry || !this.object) return;
|
||||||
|
|
||||||
|
let objectEvent: RoomObjectEvent = null;
|
||||||
|
|
||||||
|
switch(event.type)
|
||||||
|
{
|
||||||
|
case MouseEventType.DOUBLE_CLICK: {
|
||||||
|
if((event.spriteTag === 'turn_on') || (event.spriteTag === 'turn_off'))
|
||||||
|
{
|
||||||
|
objectEvent = new RoomObjectStateChangedEvent(RoomObjectStateChangedEvent.STATE_CHANGE, this.object);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
objectEvent = new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.AREA_HIDE, this.object);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.eventDispatcher && objectEvent)
|
||||||
|
{
|
||||||
|
this.eventDispatcher.dispatchEvent(objectEvent);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
super.mouseEvent(event, geometry);
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
export * from './FurnitureAchievementResolutionLogic';
|
export * from './FurnitureAchievementResolutionLogic';
|
||||||
|
export * from './FurnitureAreaHideLogic';
|
||||||
export * from './FurnitureBadgeDisplayLogic';
|
export * from './FurnitureBadgeDisplayLogic';
|
||||||
export * from './FurnitureChangeStateWhenStepOnLogic';
|
export * from './FurnitureChangeStateWhenStepOnLogic';
|
||||||
export * from './FurnitureClothingChangeLogic';
|
export * from './FurnitureClothingChangeLogic';
|
||||||
|
@ -26,6 +26,7 @@ export class RoomObjectSprite implements IRoomObjectSprite
|
|||||||
private _varyingDepth: boolean = false;
|
private _varyingDepth: boolean = false;
|
||||||
private _libraryAssetName: string = '';
|
private _libraryAssetName: string = '';
|
||||||
private _clickHandling: boolean = false;
|
private _clickHandling: boolean = false;
|
||||||
|
private _skipMouseHandling: boolean = false;
|
||||||
private _visible: boolean = true;
|
private _visible: boolean = true;
|
||||||
private _tag: string = '';
|
private _tag: string = '';
|
||||||
private _posture: string = null;
|
private _posture: string = null;
|
||||||
@ -352,4 +353,14 @@ export class RoomObjectSprite implements IRoomObjectSprite
|
|||||||
{
|
{
|
||||||
return this._updateCounter;
|
return this._updateCounter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get skipMouseHandling(): boolean
|
||||||
|
{
|
||||||
|
return this._skipMouseHandling;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set skipMouseHandling(flag: boolean)
|
||||||
|
{
|
||||||
|
this._skipMouseHandling = flag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ export class SizeData
|
|||||||
|
|
||||||
public getLayerColor(layerId: number, colorId: number): number
|
public getLayerColor(layerId: number, colorId: number): number
|
||||||
{
|
{
|
||||||
const existing = this._colors[colorId] as ColorData;
|
const existing = this._colors[colorId];
|
||||||
|
|
||||||
if(!existing) return ColorData.DEFAULT_COLOR;
|
if(!existing) return ColorData.DEFAULT_COLOR;
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ export class FurnitureFireworksVisualization extends FurnitureAnimatedVisualizat
|
|||||||
{
|
{
|
||||||
const particleSystem = this._particleSystems.getValue(scale);
|
const particleSystem = this._particleSystems.getValue(scale);
|
||||||
|
|
||||||
|
if(!particleSystem) return false;
|
||||||
|
|
||||||
particleSystem.copyStateFrom(this._currentParticleSystem);
|
particleSystem.copyStateFrom(this._currentParticleSystem);
|
||||||
|
|
||||||
if(this._currentParticleSystem) this._currentParticleSystem.reset();
|
if(this._currentParticleSystem) this._currentParticleSystem.reset();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { AlphaTolerance, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObjectSprite, RoomObjectVariable, RoomObjectVisualizationType } from '@nitrots/api';
|
import { AlphaTolerance, IGraphicAsset, IObjectVisualizationData, IRoomGeometry, IRoomObjectSprite, RoomObjectVariable, RoomObjectVisualizationType } from '@nitrots/api';
|
||||||
import { BLEND_MODES, Texture } from 'pixi.js';
|
import { BLEND_MODES, Filter, Texture } from 'pixi.js';
|
||||||
import { RoomObjectSpriteVisualization } from '../RoomObjectSpriteVisualization';
|
import { RoomObjectSpriteVisualization } from '../RoomObjectSpriteVisualization';
|
||||||
import { ColorData, LayerData } from '../data';
|
import { ColorData, LayerData } from '../data';
|
||||||
import { FurnitureVisualizationData } from './FurnitureVisualizationData';
|
import { FurnitureVisualizationData } from './FurnitureVisualizationData';
|
||||||
@ -38,8 +38,11 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
|||||||
protected _spriteXOffsets: number[];
|
protected _spriteXOffsets: number[];
|
||||||
protected _spriteYOffsets: number[];
|
protected _spriteYOffsets: number[];
|
||||||
protected _spriteZOffsets: number[];
|
protected _spriteZOffsets: number[];
|
||||||
|
protected _filters: Filter[] = [];
|
||||||
|
|
||||||
private _animationNumber: number;
|
private _animationNumber: number;
|
||||||
|
private _lookThrough: boolean;
|
||||||
|
private _needsLookThroughUpdate: boolean;
|
||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
@ -75,6 +78,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
|||||||
this._spriteZOffsets = [];
|
this._spriteZOffsets = [];
|
||||||
|
|
||||||
this._animationNumber = 0;
|
this._animationNumber = 0;
|
||||||
|
this._lookThrough = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public initialize(data: IObjectVisualizationData): boolean
|
public initialize(data: IObjectVisualizationData): boolean
|
||||||
@ -104,6 +108,7 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
|||||||
this._spriteXOffsets = null;
|
this._spriteXOffsets = null;
|
||||||
this._spriteYOffsets = null;
|
this._spriteYOffsets = null;
|
||||||
this._spriteZOffsets = null;
|
this._spriteZOffsets = null;
|
||||||
|
this._filters = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
protected reset(): void
|
protected reset(): void
|
||||||
@ -160,6 +165,12 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
|||||||
|
|
||||||
if(this.updateModel(scale)) updateSprites = true;
|
if(this.updateModel(scale)) updateSprites = true;
|
||||||
|
|
||||||
|
if(this._needsLookThroughUpdate)
|
||||||
|
{
|
||||||
|
updateSprites = true;
|
||||||
|
this._needsLookThroughUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
let number = 0;
|
let number = 0;
|
||||||
|
|
||||||
if(skipUpdate)
|
if(skipUpdate)
|
||||||
@ -313,11 +324,15 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
|||||||
relativeDepth = 1;
|
relativeDepth = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(this._lookThrough) sprite.alpha *= 0.2;
|
||||||
|
|
||||||
sprite.relativeDepth = (relativeDepth * FurnitureVisualization.DEPTH_MULTIPLIER);
|
sprite.relativeDepth = (relativeDepth * FurnitureVisualization.DEPTH_MULTIPLIER);
|
||||||
sprite.name = assetName;
|
sprite.name = assetName;
|
||||||
sprite.libraryAssetName = this.getLibraryAssetNameForSprite(assetData, sprite);
|
sprite.libraryAssetName = this.getLibraryAssetNameForSprite(assetData, sprite);
|
||||||
sprite.posture = this.getPostureForAsset(scale, assetData.source);
|
sprite.posture = this.getPostureForAsset(scale, assetData.source);
|
||||||
sprite.clickHandling = this._clickHandling;
|
sprite.clickHandling = this._clickHandling;
|
||||||
|
|
||||||
|
if(sprite.blendMode !== 'add') sprite.filters = this._filters;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -582,6 +597,14 @@ export class FurnitureVisualization extends RoomObjectSpriteVisualization
|
|||||||
return asset?.texture ?? null;
|
return asset?.texture ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public set lookThrough(flag: boolean)
|
||||||
|
{
|
||||||
|
if(this._lookThrough == flag) return;
|
||||||
|
|
||||||
|
this._lookThrough = flag;
|
||||||
|
this._needsLookThroughUpdate = true;
|
||||||
|
}
|
||||||
|
|
||||||
protected get direction(): number
|
protected get direction(): number
|
||||||
{
|
{
|
||||||
return this._direction;
|
return this._direction;
|
||||||
|
@ -70,7 +70,7 @@ export class FurnitureVisualizationData implements IObjectVisualizationData
|
|||||||
{
|
{
|
||||||
if(!visualizations) return false;
|
if(!visualizations) return false;
|
||||||
|
|
||||||
for(const visualizationId in visualizations)
|
for(const visualizationId of Object.keys(visualizations))
|
||||||
{
|
{
|
||||||
const visualization = visualizations[visualizationId];
|
const visualization = visualizations[visualizationId];
|
||||||
|
|
||||||
|
@ -50,6 +50,8 @@ export class RoomPlane implements IRoomPlane
|
|||||||
private _hasTexture: boolean = true;
|
private _hasTexture: boolean = true;
|
||||||
private _canBeVisible: boolean = true;
|
private _canBeVisible: boolean = true;
|
||||||
private _geometryUpdateId: number = -1;
|
private _geometryUpdateId: number = -1;
|
||||||
|
private _extraDepth: number = 0;
|
||||||
|
private _isHighlighter: boolean = false;
|
||||||
|
|
||||||
private _useMask: boolean;
|
private _useMask: boolean;
|
||||||
private _bitmapMasks: RoomPlaneBitmapMask[] = [];
|
private _bitmapMasks: RoomPlaneBitmapMask[] = [];
|
||||||
@ -569,7 +571,12 @@ export class RoomPlane implements IRoomPlane
|
|||||||
|
|
||||||
public get relativeDepth(): number
|
public get relativeDepth(): number
|
||||||
{
|
{
|
||||||
return this._relativeDepth;
|
return (this._relativeDepth + this._extraDepth);
|
||||||
|
}
|
||||||
|
|
||||||
|
public set extraDepth(value: number)
|
||||||
|
{
|
||||||
|
this._extraDepth = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get color(): number
|
public get color(): number
|
||||||
@ -633,4 +640,14 @@ export class RoomPlane implements IRoomPlane
|
|||||||
{
|
{
|
||||||
this._hasTexture = flag;
|
this._hasTexture = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get isHighlighter(): boolean
|
||||||
|
{
|
||||||
|
return this._isHighlighter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set isHighlighter(flag: boolean)
|
||||||
|
{
|
||||||
|
this._isHighlighter = flag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
import { AlphaTolerance, IObjectVisualizationData, IPlaneVisualization, IRoomGeometry, IRoomObjectModel, IRoomObjectSprite, IRoomPlane, RoomObjectSpriteType, RoomObjectVariable } from '@nitrots/api';
|
||||||
import { ToInt32, Vector3d } from '@nitrots/utils';
|
import { ToInt32, Vector3d } from '@nitrots/utils';
|
||||||
import { Rectangle, Texture } from 'pixi.js';
|
import { Filter, Rectangle, Texture } from 'pixi.js';
|
||||||
import { AlphaTolerance, IObjectVisualizationData, IPlaneVisualization, IRoomGeometry, IRoomObjectModel, IRoomObjectSprite, IRoomPlane, RoomObjectSpriteType, RoomObjectVariable } from '../../../../../api';
|
|
||||||
import { RoomMapData } from '../../RoomMapData';
|
import { RoomMapData } from '../../RoomMapData';
|
||||||
import { RoomMapMaskData } from '../../RoomMapMaskData';
|
import { RoomMapMaskData } from '../../RoomMapMaskData';
|
||||||
import { RoomPlaneBitmapMaskData } from '../../RoomPlaneBitmapMaskData';
|
import { RoomPlaneBitmapMaskData } from '../../RoomPlaneBitmapMaskData';
|
||||||
@ -13,16 +13,16 @@ import { RoomVisualizationData } from './RoomVisualizationData';
|
|||||||
|
|
||||||
export class RoomVisualization extends RoomObjectSpriteVisualization implements IPlaneVisualization
|
export class RoomVisualization extends RoomObjectSpriteVisualization implements IPlaneVisualization
|
||||||
{
|
{
|
||||||
public static FLOOR_COLOR: number = 0xFFFFFF;
|
private static FLOOR_COLOR: number = 0xFFFFFF;
|
||||||
public static FLOOR_COLOR_LEFT: number = 0xDDDDDD;
|
private static FLOOR_COLOR_LEFT: number = 0xDDDDDD;
|
||||||
public static FLOOR_COLOR_RIGHT: number = 0xBBBBBB;
|
private static FLOOR_COLOR_RIGHT: number = 0xBBBBBB;
|
||||||
private static WALL_COLOR_TOP: number = 0xFFFFFF;
|
private static WALL_COLOR_TOP: number = 0xFFFFFF;
|
||||||
private static WALL_COLOR_SIDE: number = 0xCCCCCC;
|
private static WALL_COLOR_SIDE: number = 0xCCCCCC;
|
||||||
private static WALL_COLOR_BOTTOM: number = 0x999999;
|
private static WALL_COLOR_BOTTOM: number = 0x999999;
|
||||||
private static WALL_COLOR_BORDER: number = 0x999999;
|
private static WALL_COLOR_BORDER: number = 0x999999;
|
||||||
public static LANDSCAPE_COLOR_TOP: number = 0xFFFFFF;
|
private static LANDSCAPE_COLOR_TOP: number = 0xFFFFFF;
|
||||||
public static LANDSCAPE_COLOR_SIDE: number = 0xCCCCCC;
|
private static LANDSCAPE_COLOR_SIDE: number = 0xCCCCCC;
|
||||||
public static LANDSCAPE_COLOR_BOTTOM: number = 0x999999;
|
private static LANDSCAPE_COLOR_BOTTOM: number = 0x999999;
|
||||||
private static ROOM_DEPTH_OFFSET: number = 1000;
|
private static ROOM_DEPTH_OFFSET: number = 1000;
|
||||||
|
|
||||||
protected _data: RoomVisualizationData = null;
|
protected _data: RoomVisualizationData = null;
|
||||||
@ -54,6 +54,13 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements
|
|||||||
private _maskData: RoomMapMaskData = null;
|
private _maskData: RoomMapMaskData = null;
|
||||||
private _isPlaneSet: boolean = false;
|
private _isPlaneSet: boolean = false;
|
||||||
|
|
||||||
|
private _highlightAreaX: number = 0;
|
||||||
|
private _highlightAreaY: number = 0;
|
||||||
|
private _highlightAreaWidth: number = 0;
|
||||||
|
private _highlightAreaHeight: number = 0;
|
||||||
|
private _highlightFilter: Filter = null;
|
||||||
|
private _highlightPlaneOffsets: number[] = [];
|
||||||
|
|
||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
@ -86,6 +93,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements
|
|||||||
this._planes = null;
|
this._planes = null;
|
||||||
this._visiblePlanes = null;
|
this._visiblePlanes = null;
|
||||||
this._visiblePlaneSpriteNumbers = null;
|
this._visiblePlaneSpriteNumbers = null;
|
||||||
|
this._highlightPlaneOffsets = [];
|
||||||
|
|
||||||
if(this._roomPlaneParser)
|
if(this._roomPlaneParser)
|
||||||
{
|
{
|
||||||
@ -321,6 +329,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._planes = [];
|
this._planes = [];
|
||||||
|
this._highlightPlaneOffsets = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
this._isPlaneSet = false;
|
this._isPlaneSet = false;
|
||||||
@ -336,19 +345,29 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements
|
|||||||
if(!isNaN(this._floorThickness)) this._roomPlaneParser.floorThicknessMultiplier = this._floorThickness;
|
if(!isNaN(this._floorThickness)) this._roomPlaneParser.floorThicknessMultiplier = this._floorThickness;
|
||||||
if(!isNaN(this._wallThickness)) this._roomPlaneParser.wallThicknessMultiplier = this._wallThickness;
|
if(!isNaN(this._wallThickness)) this._roomPlaneParser.wallThicknessMultiplier = this._wallThickness;
|
||||||
|
|
||||||
|
this._roomPlaneParser.clearHighlightArea();
|
||||||
|
|
||||||
const mapData = this.object.model.getValue<RoomMapData>(RoomObjectVariable.ROOM_MAP_DATA);
|
const mapData = this.object.model.getValue<RoomMapData>(RoomObjectVariable.ROOM_MAP_DATA);
|
||||||
|
|
||||||
if(!this._roomPlaneParser.initializeFromMapData(mapData)) return;
|
if(!this._roomPlaneParser.initializeFromMapData(mapData)) return;
|
||||||
|
|
||||||
|
this._roomPlaneParser.initializeHighlightArea(this._highlightAreaX, this._highlightAreaY, this._highlightAreaWidth, this._highlightAreaHeight);
|
||||||
|
|
||||||
|
this.createPlanesAndSprites();
|
||||||
|
}
|
||||||
|
|
||||||
|
private createPlanesAndSprites(offset: number = 0): void
|
||||||
|
{
|
||||||
const maxX = this.getLandscapeWidth();
|
const maxX = this.getLandscapeWidth();
|
||||||
const maxY = this.getLandscapeHeight();
|
const maxY = this.getLandscapeHeight();
|
||||||
|
|
||||||
let landscapeOffsetX = 0;
|
let landscapeOffsetX = 0;
|
||||||
let randomSeed = this.object.model.getValue<number>(RoomObjectVariable.ROOM_RANDOM_SEED);
|
let randomSeed = this.object.model.getValue<number>(RoomObjectVariable.ROOM_RANDOM_SEED);
|
||||||
let index = 0;
|
let index = offset;
|
||||||
|
|
||||||
while(index < this._roomPlaneParser.planeCount)
|
while(index < this._roomPlaneParser.planeCount)
|
||||||
{
|
{
|
||||||
|
this._highlightPlaneOffsets[index] = -1;
|
||||||
const location = this._roomPlaneParser.getPlaneLocation(index);
|
const location = this._roomPlaneParser.getPlaneLocation(index);
|
||||||
const leftSide = this._roomPlaneParser.getPlaneLeftSide(index);
|
const leftSide = this._roomPlaneParser.getPlaneLeftSide(index);
|
||||||
const rightSide = this._roomPlaneParser.getPlaneRightSide(index);
|
const rightSide = this._roomPlaneParser.getPlaneRightSide(index);
|
||||||
@ -414,6 +433,7 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements
|
|||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._highlightPlaneOffsets[index] = this._planes.length;
|
||||||
this._planes.push(plane);
|
this._planes.push(plane);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -429,6 +449,53 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements
|
|||||||
this.defineSprites();
|
this.defineSprites();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public initializeHighlightArea(highlightAreaX: number, highlightAreaY: number, highlightAreaWidth: number, highlightAreaHeight: number, highlightFilter: Filter): void
|
||||||
|
{
|
||||||
|
this.clearHighlightArea();
|
||||||
|
|
||||||
|
this._highlightAreaX = highlightAreaX;
|
||||||
|
this._highlightAreaY = highlightAreaY;
|
||||||
|
this._highlightAreaWidth = highlightAreaWidth;
|
||||||
|
this._highlightAreaHeight = highlightAreaHeight;
|
||||||
|
this._highlightFilter = highlightFilter;
|
||||||
|
|
||||||
|
this._roomPlaneParser.initializeHighlightArea(highlightAreaX, highlightAreaY, highlightAreaWidth, highlightAreaHeight);
|
||||||
|
|
||||||
|
this.createPlanesAndSprites(this._planes.length);
|
||||||
|
this.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public clearHighlightArea(): void
|
||||||
|
{
|
||||||
|
this._highlightAreaX = 0;
|
||||||
|
this._highlightAreaY = 0;
|
||||||
|
this._highlightAreaWidth = 0;
|
||||||
|
this._highlightAreaHeight = 0;
|
||||||
|
|
||||||
|
const totalHighlightedPlanes = this._roomPlaneParser.clearHighlightArea();
|
||||||
|
let _local_4 = 0;
|
||||||
|
|
||||||
|
let _local_1 = this._roomPlaneParser.planeCount;
|
||||||
|
|
||||||
|
while(_local_1 < (this._roomPlaneParser.planeCount + totalHighlightedPlanes))
|
||||||
|
{
|
||||||
|
const _local_2 = this._highlightPlaneOffsets[_local_1];
|
||||||
|
|
||||||
|
if(_local_2 !== -1)
|
||||||
|
{
|
||||||
|
_local_4 = (_local_4 + 1);
|
||||||
|
this._highlightPlaneOffsets[_local_1] = -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
_local_1 = (_local_1 + 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
this._planes = this._planes.slice(0, (this._planes.length - _local_4));
|
||||||
|
this.createSprites(this._planes.length);
|
||||||
|
|
||||||
|
this.reset();
|
||||||
|
}
|
||||||
|
|
||||||
protected defineSprites(): void
|
protected defineSprites(): void
|
||||||
{
|
{
|
||||||
this.createSprites(this._planes.length);
|
this.createSprites(this._planes.length);
|
||||||
@ -467,6 +534,22 @@ export class RoomVisualization extends RoomObjectSpriteVisualization implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
sprite.spriteType = RoomObjectSpriteType.ROOM_PLANE;
|
sprite.spriteType = RoomObjectSpriteType.ROOM_PLANE;
|
||||||
|
|
||||||
|
if(this._roomPlaneParser.isPlaneTemporaryHighlighter(planeIndex))
|
||||||
|
{
|
||||||
|
if(this._highlightFilter) sprite.filters = [ this._highlightFilter ];
|
||||||
|
|
||||||
|
sprite.skipMouseHandling = true;
|
||||||
|
plane.extraDepth = -100;
|
||||||
|
plane.isHighlighter = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sprite.filters = [];
|
||||||
|
sprite.skipMouseHandling = false;
|
||||||
|
plane.extraDepth = 0;
|
||||||
|
plane.isHighlighter = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
planeIndex++;
|
planeIndex++;
|
||||||
|
@ -102,7 +102,7 @@ export class RoomRenderer implements IRoomRenderer, IRoomSpriteCanvasContainer
|
|||||||
|
|
||||||
public createCanvas(id: number, width: number, height: number, scale: number): IRoomRenderingCanvas
|
public createCanvas(id: number, width: number, height: number, scale: number): IRoomRenderingCanvas
|
||||||
{
|
{
|
||||||
const existing = this._canvases.get(id) as IRoomRenderingCanvas;
|
const existing = this._canvases.get(id);
|
||||||
|
|
||||||
if(existing)
|
if(existing)
|
||||||
{
|
{
|
||||||
|
@ -84,7 +84,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
{
|
{
|
||||||
const display = new Container();
|
const display = new Container();
|
||||||
|
|
||||||
display.isRenderGroup = true;
|
display.isRenderGroup = false;
|
||||||
display.cullableChildren = false;
|
display.cullableChildren = false;
|
||||||
|
|
||||||
this._master.addChild(display);
|
this._master.addChild(display);
|
||||||
@ -475,11 +475,11 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
{
|
{
|
||||||
if((index < 0) || (index >= this._spriteCount)) return null;
|
if((index < 0) || (index >= this._spriteCount)) return null;
|
||||||
|
|
||||||
const sprite = (this._display.getChildAt(index) as ExtendedSprite);
|
const sprite = (this._display.getChildAt(index));
|
||||||
|
|
||||||
if(!sprite) return null;
|
if(!sprite) return null;
|
||||||
|
|
||||||
return sprite;
|
return (sprite as ExtendedSprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getExtendedSpriteIdentifier(sprite: ExtendedSprite): string
|
protected getExtendedSpriteIdentifier(sprite: ExtendedSprite): string
|
||||||
@ -528,6 +528,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
extendedSprite.label = sprite.name;
|
extendedSprite.label = sprite.name;
|
||||||
extendedSprite.varyingDepth = objectSprite.varyingDepth;
|
extendedSprite.varyingDepth = objectSprite.varyingDepth;
|
||||||
extendedSprite.clickHandling = objectSprite.clickHandling;
|
extendedSprite.clickHandling = objectSprite.clickHandling;
|
||||||
|
extendedSprite.skipMouseHandling = objectSprite.skipMouseHandling;
|
||||||
extendedSprite.filters = objectSprite.filters;
|
extendedSprite.filters = objectSprite.filters;
|
||||||
|
|
||||||
const alpha = (objectSprite.alpha / 255);
|
const alpha = (objectSprite.alpha / 255);
|
||||||
@ -604,6 +605,7 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
extendedSprite.label = sprite.name;
|
extendedSprite.label = sprite.name;
|
||||||
extendedSprite.varyingDepth = sprite.varyingDepth;
|
extendedSprite.varyingDepth = sprite.varyingDepth;
|
||||||
extendedSprite.clickHandling = sprite.clickHandling;
|
extendedSprite.clickHandling = sprite.clickHandling;
|
||||||
|
extendedSprite.skipMouseHandling = sprite.skipMouseHandling;
|
||||||
extendedSprite.blendMode = sprite.blendMode;
|
extendedSprite.blendMode = sprite.blendMode;
|
||||||
extendedSprite.filters = sprite.filters;
|
extendedSprite.filters = sprite.filters;
|
||||||
|
|
||||||
@ -757,61 +759,64 @@ export class RoomSpriteCanvas implements IRoomRenderingCanvas
|
|||||||
|
|
||||||
if(extendedSprite && extendedSprite.containsPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y))))
|
if(extendedSprite && extendedSprite.containsPoint(new Point((x - extendedSprite.x), (y - extendedSprite.y))))
|
||||||
{
|
{
|
||||||
if(extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK)))
|
if(!extendedSprite.skipMouseHandling)
|
||||||
{
|
{
|
||||||
//
|
if(extendedSprite.clickHandling && ((type === MouseEventType.MOUSE_CLICK) || (type === MouseEventType.DOUBLE_CLICK)))
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const identifier = this.getExtendedSpriteIdentifier(extendedSprite);
|
|
||||||
|
|
||||||
if(checkedSprites.indexOf(identifier) === -1)
|
|
||||||
{
|
{
|
||||||
const tag = extendedSprite.tag;
|
//
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
const identifier = this.getExtendedSpriteIdentifier(extendedSprite);
|
||||||
|
|
||||||
let mouseData = this._mouseActiveObjects.get(identifier);
|
if(checkedSprites.indexOf(identifier) === -1)
|
||||||
|
|
||||||
if(mouseData)
|
|
||||||
{
|
{
|
||||||
if(mouseData.spriteTag !== tag)
|
const tag = extendedSprite.tag;
|
||||||
{
|
|
||||||
mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, mouseData.spriteTag, altKey, ctrlKey, shiftKey, buttonDown);
|
|
||||||
|
|
||||||
|
let mouseData = this._mouseActiveObjects.get(identifier);
|
||||||
|
|
||||||
|
if(mouseData)
|
||||||
|
{
|
||||||
|
if(mouseData.spriteTag !== tag)
|
||||||
|
{
|
||||||
|
mouseEvent = this.createMouseEvent(0, 0, 0, 0, MouseEventType.ROLL_OUT, mouseData.spriteTag, altKey, ctrlKey, shiftKey, buttonDown);
|
||||||
|
|
||||||
|
this.bufferMouseEvent(mouseEvent, identifier);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if((type === MouseEventType.MOUSE_MOVE) && (!mouseData || (mouseData.spriteTag !== tag)))
|
||||||
|
{
|
||||||
|
mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), MouseEventType.ROLL_OVER, tag, altKey, ctrlKey, shiftKey, buttonDown);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), type, tag, altKey, ctrlKey, shiftKey, buttonDown);
|
||||||
|
|
||||||
|
mouseEvent.spriteOffsetX = extendedSprite.offsetX;
|
||||||
|
mouseEvent.spriteOffsetY = extendedSprite.offsetY;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!mouseData)
|
||||||
|
{
|
||||||
|
mouseData = new ObjectMouseData();
|
||||||
|
|
||||||
|
mouseData.objectId = identifier;
|
||||||
|
this._mouseActiveObjects.set(identifier, mouseData);
|
||||||
|
}
|
||||||
|
|
||||||
|
mouseData.spriteTag = tag;
|
||||||
|
|
||||||
|
if(((type !== MouseEventType.MOUSE_MOVE) || (x !== this._mouseOldX)) || (y !== this._mouseOldY))
|
||||||
|
{
|
||||||
this.bufferMouseEvent(mouseEvent, identifier);
|
this.bufferMouseEvent(mouseEvent, identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkedSprites.push(identifier);
|
||||||
}
|
}
|
||||||
|
|
||||||
if((type === MouseEventType.MOUSE_MOVE) && (!mouseData || (mouseData.spriteTag !== tag)))
|
didHitSprite = true;
|
||||||
{
|
|
||||||
mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), MouseEventType.ROLL_OVER, tag, altKey, ctrlKey, shiftKey, buttonDown);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mouseEvent = this.createMouseEvent(x, y, (x - extendedSprite.x), (y - extendedSprite.y), type, tag, altKey, ctrlKey, shiftKey, buttonDown);
|
|
||||||
|
|
||||||
mouseEvent.spriteOffsetX = extendedSprite.offsetX;
|
|
||||||
mouseEvent.spriteOffsetY = extendedSprite.offsetY;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!mouseData)
|
|
||||||
{
|
|
||||||
mouseData = new ObjectMouseData();
|
|
||||||
|
|
||||||
mouseData.objectId = identifier;
|
|
||||||
this._mouseActiveObjects.set(identifier, mouseData);
|
|
||||||
}
|
|
||||||
|
|
||||||
mouseData.spriteTag = tag;
|
|
||||||
|
|
||||||
if(((type !== MouseEventType.MOUSE_MOVE) || (x !== this._mouseOldX)) || (y !== this._mouseOldY))
|
|
||||||
{
|
|
||||||
this.bufferMouseEvent(mouseEvent, identifier);
|
|
||||||
}
|
|
||||||
|
|
||||||
checkedSprites.push(identifier);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
didHitSprite = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { AlphaTolerance } from '@nitrots/api';
|
import { AlphaTolerance } from '@nitrots/api';
|
||||||
import { GetRenderer, TextureUtils } from '@nitrots/utils';
|
import { GetRenderer, TextureUtils } from '@nitrots/utils';
|
||||||
import { GlRenderTarget, Point, RendererType, Sprite, Texture, TextureSource, WebGPURenderer } from 'pixi.js';
|
import { Point, RendererType, Sprite, Texture, TextureSource, WebGPURenderer } from 'pixi.js';
|
||||||
|
|
||||||
const BYTES_PER_PIXEL = 4;
|
const BYTES_PER_PIXEL = 4;
|
||||||
|
|
||||||
@ -12,6 +12,7 @@ export class ExtendedSprite extends Sprite
|
|||||||
private _alphaTolerance: number = AlphaTolerance.MATCH_OPAQUE_PIXELS;
|
private _alphaTolerance: number = AlphaTolerance.MATCH_OPAQUE_PIXELS;
|
||||||
private _varyingDepth: boolean = false;
|
private _varyingDepth: boolean = false;
|
||||||
private _clickHandling: boolean = false;
|
private _clickHandling: boolean = false;
|
||||||
|
private _skipMouseHandling: boolean = false;
|
||||||
|
|
||||||
private _updateId1: number = -1;
|
private _updateId1: number = -1;
|
||||||
private _updateId2: number = -1;
|
private _updateId2: number = -1;
|
||||||
@ -43,7 +44,7 @@ export class ExtendedSprite extends Sprite
|
|||||||
|
|
||||||
public containsPoint(point: Point): boolean
|
public containsPoint(point: Point): boolean
|
||||||
{
|
{
|
||||||
if(!point || (this.alphaTolerance > 255) || !this.texture || (this.texture === Texture.EMPTY) || (this.blendMode !== 'normal')) return false;
|
if(!point || (this.alphaTolerance > 255) || !this.texture || (this.texture === Texture.EMPTY)) return false;
|
||||||
|
|
||||||
point = new Point((point.x * this.scale.x), (point.y * this.scale.y));
|
point = new Point((point.x * this.scale.x), (point.y * this.scale.y));
|
||||||
|
|
||||||
@ -92,12 +93,12 @@ export class ExtendedSprite extends Sprite
|
|||||||
pixels = TextureUtils.getPixels(new Texture(textureSource))?.pixels ?? null;
|
pixels = TextureUtils.getPixels(new Texture(textureSource))?.pixels ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if(renderer.type === RendererType.WEBGL)
|
else if((renderer.type as RendererType) === RendererType.WEBGL)
|
||||||
{
|
{
|
||||||
pixels = new Uint8ClampedArray(BYTES_PER_PIXEL * width * height);
|
pixels = new Uint8ClampedArray(BYTES_PER_PIXEL * width * height);
|
||||||
|
|
||||||
const renderTarget = renderer.renderTarget.getRenderTarget(textureSource);
|
const renderTarget = renderer.renderTarget.getRenderTarget(textureSource);
|
||||||
const glRenderTarget = renderer.renderTarget.getGpuRenderTarget(renderTarget) as GlRenderTarget;
|
const glRenderTarget = renderer.renderTarget.getGpuRenderTarget(renderTarget);
|
||||||
|
|
||||||
const gl = renderer.gl;
|
const gl = renderer.gl;
|
||||||
|
|
||||||
@ -181,4 +182,14 @@ export class ExtendedSprite extends Sprite
|
|||||||
{
|
{
|
||||||
this._clickHandling = flag;
|
this._clickHandling = flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get skipMouseHandling(): boolean
|
||||||
|
{
|
||||||
|
return this._skipMouseHandling;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set skipMouseHandling(flag: boolean)
|
||||||
|
{
|
||||||
|
this._skipMouseHandling = flag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
248
packages/room/src/utils/RoomAreaSelectionManager.ts
Normal file
248
packages/room/src/utils/RoomAreaSelectionManager.ts
Normal file
@ -0,0 +1,248 @@
|
|||||||
|
import { IRoomAreaSelectionManager, IRoomEngine, IRoomObject } from '@nitrots/api';
|
||||||
|
import { GetEventDispatcher, RoomEngineObjectEvent, RoomObjectMouseEvent, RoomObjectTileMouseEvent } from '@nitrots/events';
|
||||||
|
import { ColorMatrixFilter } from 'pixi.js';
|
||||||
|
import { FurnitureVisualization, RoomVisualization } from '../object';
|
||||||
|
|
||||||
|
export class RoomAreaSelectionManager implements IRoomAreaSelectionManager
|
||||||
|
{
|
||||||
|
public static NOT_ACTIVE: number = 0;
|
||||||
|
public static NOT_SELECTING_AREA: number = 1;
|
||||||
|
public static AWAITING_MOUSE_DOWN: number = 2;
|
||||||
|
public static SELECTING: number = 3;
|
||||||
|
public static HIGHLIGHT_DARKEN = 'highlight_darken';
|
||||||
|
public static HIGHLIGHT_BRIGHTEN = 'highlight_brighten';
|
||||||
|
public static HIGHLIGHT_BLUE = 'highlight_blue';
|
||||||
|
|
||||||
|
private static HIGHLIGHT_FILTERS: { [key: string]: ColorMatrixFilter } = {};
|
||||||
|
|
||||||
|
private _roomEngine: IRoomEngine = null;
|
||||||
|
private _state: number = RoomAreaSelectionManager.NOT_ACTIVE;
|
||||||
|
private _tileXInit: number = 0;
|
||||||
|
private _tileYInit: number = 0;
|
||||||
|
private _tileXEnd: number = 0;
|
||||||
|
private _tileYEnd: number = 0;
|
||||||
|
private _highlightRootX: number = 0;
|
||||||
|
private _highlightRootY: number = 0;
|
||||||
|
private _highlightWidth: number = 0;
|
||||||
|
private _highlightHeight: number = 0;
|
||||||
|
private _callback: (rootX: number, rootY: number, width: number, height: number) => void;
|
||||||
|
private _highlightType: string = RoomAreaSelectionManager.HIGHLIGHT_BRIGHTEN;
|
||||||
|
|
||||||
|
constructor(roomEngine: IRoomEngine)
|
||||||
|
{
|
||||||
|
this._roomEngine = roomEngine;
|
||||||
|
|
||||||
|
GetEventDispatcher().addEventListener<RoomEngineObjectEvent>(RoomEngineObjectEvent.ADDED, event =>
|
||||||
|
{
|
||||||
|
if(this._state === RoomAreaSelectionManager.NOT_ACTIVE) return;
|
||||||
|
|
||||||
|
if(event.roomId !== this._roomEngine.activeRoomId) return;
|
||||||
|
|
||||||
|
if(event.category !== 10 && event.category !== 20) return;
|
||||||
|
|
||||||
|
const roomObject = this._roomEngine.getRoomObject(event.roomId, event.objectId, event.category);
|
||||||
|
|
||||||
|
if(roomObject.visualization instanceof FurnitureVisualization) roomObject.visualization.lookThrough = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
const brightenFilter = new ColorMatrixFilter();
|
||||||
|
|
||||||
|
brightenFilter.matrix = [
|
||||||
|
1.5, 0, 0, 0,
|
||||||
|
0, 1.5, 0, 0,
|
||||||
|
0, 0, 1.5, 0,
|
||||||
|
0, 0, 0, 1,
|
||||||
|
0, 0.0784, 0.0784, 0];
|
||||||
|
|
||||||
|
const blueFilter = new ColorMatrixFilter();
|
||||||
|
|
||||||
|
blueFilter.matrix = [
|
||||||
|
1.05, 0, 0, 0,
|
||||||
|
0, 1.3, 0, 0,
|
||||||
|
0, 0, 1.8, 0,
|
||||||
|
0, 0, 0, 1,
|
||||||
|
0, 0.0314, 0.0784, 0];
|
||||||
|
|
||||||
|
const darkenFilter = new ColorMatrixFilter();
|
||||||
|
|
||||||
|
darkenFilter.matrix = [
|
||||||
|
0.55, 0, 0, 0,
|
||||||
|
0, 0.55, 0, 0,
|
||||||
|
0, 0, 0.55, 0,
|
||||||
|
0, 0, 0, 1,
|
||||||
|
-0.0392, -0.0392, -0.0392, 0];
|
||||||
|
|
||||||
|
RoomAreaSelectionManager.HIGHLIGHT_FILTERS[RoomAreaSelectionManager.HIGHLIGHT_DARKEN] = darkenFilter;
|
||||||
|
RoomAreaSelectionManager.HIGHLIGHT_FILTERS[RoomAreaSelectionManager.HIGHLIGHT_BRIGHTEN] = brightenFilter;
|
||||||
|
RoomAreaSelectionManager.HIGHLIGHT_FILTERS[RoomAreaSelectionManager.HIGHLIGHT_BLUE] = blueFilter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private getAllFurniture(): IRoomObject[]
|
||||||
|
{
|
||||||
|
return this._roomEngine.getRoomObjects(this._roomEngine.activeRoomId, 20).concat(this._roomEngine.getRoomObjects(this._roomEngine.activeRoomId, 10));
|
||||||
|
}
|
||||||
|
|
||||||
|
public startSelecting(): void
|
||||||
|
{
|
||||||
|
if(this._state !== RoomAreaSelectionManager.NOT_SELECTING_AREA) return;
|
||||||
|
|
||||||
|
this.clearHighlightSilent();
|
||||||
|
this._state = RoomAreaSelectionManager.AWAITING_MOUSE_DOWN;
|
||||||
|
this._roomEngine.moveBlocked = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public handleTileMouseEvent(event: RoomObjectTileMouseEvent): void
|
||||||
|
{
|
||||||
|
let isWaitingForMouseDown = ((this._state === RoomAreaSelectionManager.AWAITING_MOUSE_DOWN) && (event.type == RoomObjectMouseEvent.MOUSE_DOWN));
|
||||||
|
|
||||||
|
if(event.shiftKey && (this._state === RoomAreaSelectionManager.NOT_SELECTING_AREA) && (event.type == RoomObjectMouseEvent.MOUSE_DOWN))
|
||||||
|
{
|
||||||
|
this.startSelecting();
|
||||||
|
|
||||||
|
isWaitingForMouseDown = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
if(isWaitingForMouseDown)
|
||||||
|
{
|
||||||
|
this._state = RoomAreaSelectionManager.SELECTING;
|
||||||
|
this._tileXInit = event.tileXAsInt;
|
||||||
|
this._tileYInit = event.tileYAsInt;
|
||||||
|
this._tileXEnd = event.tileXAsInt;
|
||||||
|
this._tileYEnd = event.tileYAsInt;
|
||||||
|
this.setHighlight(this._tileXInit, this._tileYInit, 1, 1);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if((this._state === RoomAreaSelectionManager.SELECTING) && (event.type === RoomObjectMouseEvent.MOUSE_MOVE))
|
||||||
|
{
|
||||||
|
if((event.tileXAsInt !== this._tileXEnd) || (event.tileYAsInt !== this._tileYEnd))
|
||||||
|
{
|
||||||
|
let rootX: number = 0;
|
||||||
|
let rootY: number = 0;
|
||||||
|
let width: number = 0;
|
||||||
|
let height: number = 0;
|
||||||
|
|
||||||
|
this._tileXEnd = event.tileXAsInt;
|
||||||
|
this._tileYEnd = event.tileYAsInt;
|
||||||
|
|
||||||
|
if(this._tileXEnd > this._tileXInit)
|
||||||
|
{
|
||||||
|
rootX = this._tileXInit;
|
||||||
|
width = ((this._tileXEnd - this._tileXInit) + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rootX = this._tileXEnd;
|
||||||
|
width = ((this._tileXInit - this._tileXEnd) + 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
if(this._tileYEnd > this._tileYInit)
|
||||||
|
{
|
||||||
|
rootY = this._tileYInit;
|
||||||
|
height = ((this._tileYEnd - this._tileYInit) + 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rootY = this._tileYEnd;
|
||||||
|
height = ((this._tileYInit - this._tileYEnd) + 1);
|
||||||
|
};
|
||||||
|
|
||||||
|
this.setHighlight(rootX, rootY, width, height);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public finishSelecting(): boolean
|
||||||
|
{
|
||||||
|
if(this._state !== RoomAreaSelectionManager.SELECTING) return false;
|
||||||
|
|
||||||
|
this._state = RoomAreaSelectionManager.NOT_SELECTING_AREA;
|
||||||
|
|
||||||
|
this._roomEngine.moveBlocked = false;
|
||||||
|
|
||||||
|
if(this._callback) this._callback(this._highlightRootX, this._highlightRootY, this._highlightWidth, this._highlightHeight);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private clearHighlightSilent():void
|
||||||
|
{
|
||||||
|
const roomObject = this._roomEngine.getRoomObject(this._roomEngine.activeRoomId, -1, 0);
|
||||||
|
|
||||||
|
if(!roomObject) return;
|
||||||
|
|
||||||
|
(roomObject.visualization as RoomVisualization)?.clearHighlightArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
public clearHighlight(): void
|
||||||
|
{
|
||||||
|
if(this._state === RoomAreaSelectionManager.NOT_ACTIVE) return;
|
||||||
|
|
||||||
|
this.clearHighlightSilent();
|
||||||
|
|
||||||
|
this._state = RoomAreaSelectionManager.NOT_SELECTING_AREA;
|
||||||
|
|
||||||
|
this._roomEngine.moveBlocked = false;
|
||||||
|
|
||||||
|
if(this._callback) this._callback(0, 0, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public setHighlight(rootX: number, rootY: number, width: number, height: number): void
|
||||||
|
{
|
||||||
|
if(this._state === RoomAreaSelectionManager.NOT_ACTIVE) return;
|
||||||
|
|
||||||
|
this._highlightRootX = rootX;
|
||||||
|
this._highlightRootY = rootY;
|
||||||
|
this._highlightWidth = width;
|
||||||
|
this._highlightHeight = height;
|
||||||
|
|
||||||
|
const roomObject = this._roomEngine.getRoomObject(this._roomEngine.activeRoomId, -1, 0);
|
||||||
|
|
||||||
|
if(!roomObject) return;
|
||||||
|
|
||||||
|
(roomObject.visualization as RoomVisualization)?.initializeHighlightArea(rootX, rootY, width, height, RoomAreaSelectionManager.HIGHLIGHT_FILTERS[this._highlightType]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public activate(callback: (rootX: number, rootY: number, width: number, height: number) => void, highlightType: string): boolean
|
||||||
|
{
|
||||||
|
if(this._state !== RoomAreaSelectionManager.NOT_ACTIVE) return false;
|
||||||
|
|
||||||
|
this._callback = callback;
|
||||||
|
this._highlightType = highlightType;
|
||||||
|
|
||||||
|
for(const roomObject of this.getAllFurniture())
|
||||||
|
{
|
||||||
|
const visualization = (roomObject.visualization as FurnitureVisualization);
|
||||||
|
|
||||||
|
if(visualization) visualization.lookThrough = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
this._state = RoomAreaSelectionManager.NOT_SELECTING_AREA;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public deactivate(): void
|
||||||
|
{
|
||||||
|
if(this._state === RoomAreaSelectionManager.NOT_ACTIVE) return;
|
||||||
|
|
||||||
|
this._callback = null;
|
||||||
|
|
||||||
|
for(const roomObject of this.getAllFurniture())
|
||||||
|
{
|
||||||
|
const visualization = (roomObject.visualization as FurnitureVisualization);
|
||||||
|
|
||||||
|
if(visualization) visualization.lookThrough = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.clearHighlight();
|
||||||
|
|
||||||
|
this._state = RoomAreaSelectionManager.NOT_ACTIVE;
|
||||||
|
}
|
||||||
|
|
||||||
|
public get areaSelectionState(): number
|
||||||
|
{
|
||||||
|
return this._state;
|
||||||
|
}
|
||||||
|
}
|
@ -1,453 +0,0 @@
|
|||||||
import { IPlaneDrawingData, IPlaneVisualization, IRoomObjectSpriteVisualization, IRoomPlane, IRoomRenderingCanvas, RoomObjectCategory, RoomObjectSpriteData } from '@nitrots/api';
|
|
||||||
import { GetStage, Vector3d } from '@nitrots/utils';
|
|
||||||
import { Point, Rectangle } from 'pixi.js';
|
|
||||||
import { RoomEngine } from '../RoomEngine';
|
|
||||||
import { PlaneDrawingData } from '../object';
|
|
||||||
|
|
||||||
export class SpriteDataCollector
|
|
||||||
{
|
|
||||||
private static MANNEQUIN_MAGIC_X_OFFSET: number = 1;
|
|
||||||
private static MANNEQUIN_MAGIC_Y_OFFSET: number = -16;
|
|
||||||
private static AVATAR_WATER_EFFECT_MAGIC_Y_OFFSET: number = -52;
|
|
||||||
private static MAX_EXTERNAL_IMAGE_COUNT: number = 30;
|
|
||||||
|
|
||||||
private maxZ: number;
|
|
||||||
private spriteCount: number = 0;
|
|
||||||
private externalImageCount: number = 0;
|
|
||||||
|
|
||||||
private static addMannequinSprites(k: RoomObjectSpriteData[], _arg_2: RoomEngine): RoomObjectSpriteData[]
|
|
||||||
{
|
|
||||||
const datas: RoomObjectSpriteData[] = [];
|
|
||||||
|
|
||||||
for(const data of k)
|
|
||||||
{
|
|
||||||
if(!data) continue;
|
|
||||||
|
|
||||||
if((data.type === 'boutique_mannequin1') && (data.name.indexOf('mannequin_') === 0))
|
|
||||||
{
|
|
||||||
const roomObject = _arg_2.getRoomObject(_arg_2.activeRoomId, data.objectId, RoomObjectCategory.FLOOR);
|
|
||||||
|
|
||||||
if(roomObject)
|
|
||||||
{
|
|
||||||
const spriteList = (roomObject.visualization as IRoomObjectSpriteVisualization).getSpriteList();
|
|
||||||
|
|
||||||
if(spriteList)
|
|
||||||
{
|
|
||||||
for(const sprite of spriteList)
|
|
||||||
{
|
|
||||||
sprite.x = (sprite.x + ((data.x + (data.width / 2)) + SpriteDataCollector.MANNEQUIN_MAGIC_X_OFFSET));
|
|
||||||
sprite.y = (sprite.y + ((data.y + data.height) + SpriteDataCollector.MANNEQUIN_MAGIC_Y_OFFSET));
|
|
||||||
sprite.z = (sprite.z + data.z);
|
|
||||||
datas.push(sprite);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
datas.push(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return datas;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static sortSpriteDataObjects(k: RoomObjectSpriteData, _arg_2: RoomObjectSpriteData): number
|
|
||||||
{
|
|
||||||
if(k.z < _arg_2.z) return 1;
|
|
||||||
|
|
||||||
if(k.z > _arg_2.z) return -1;
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static isSpriteInViewPort(k: RoomObjectSpriteData, _arg_2: Rectangle, _arg_3: IRoomRenderingCanvas): boolean
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
// var _local_4 = new Rectangle((k.x + _arg_3.screenOffsetX), (k.y + _arg_3.screenOffsetY), k.width, k.height);
|
|
||||||
// // intersects
|
|
||||||
// return _local_4.contains(_arg_2.x, _arg_2.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static sortQuadPoints(k: Point, _arg_2: Point, _arg_3: Point, _arg_4: Point): Point[]
|
|
||||||
{
|
|
||||||
const points: Point[] = [];
|
|
||||||
|
|
||||||
if(k.x == _arg_2.x)
|
|
||||||
{
|
|
||||||
points.push(k, _arg_3, _arg_2, _arg_4);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(k.x == _arg_3.x)
|
|
||||||
{
|
|
||||||
points.push(k, _arg_2, _arg_3, _arg_4);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if((((_arg_2.x < k.x) && (_arg_2.y > k.y)) || ((_arg_2.x > k.x) && (_arg_2.y < k.y))))
|
|
||||||
{
|
|
||||||
points.push(k, _arg_3, _arg_2, _arg_4);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
points.push(k, _arg_2, _arg_3, _arg_4);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(points[0].x < points[1].x)
|
|
||||||
{
|
|
||||||
let _local_6 = points[0];
|
|
||||||
|
|
||||||
points[0] = points[1];
|
|
||||||
points[1] = _local_6;
|
|
||||||
|
|
||||||
_local_6 = points[2];
|
|
||||||
|
|
||||||
points[2] = points[3];
|
|
||||||
points[3] = _local_6;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(points[0].y < points[2].y)
|
|
||||||
{
|
|
||||||
let _local_6 = points[0];
|
|
||||||
|
|
||||||
points[0] = points[2];
|
|
||||||
points[2] = _local_6;
|
|
||||||
|
|
||||||
_local_6 = points[1];
|
|
||||||
|
|
||||||
points[1] = points[3];
|
|
||||||
points[3] = _local_6;
|
|
||||||
}
|
|
||||||
|
|
||||||
return points;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public getFurniData(k: Rectangle, _arg_2: IRoomRenderingCanvas, _arg_3: RoomEngine, _arg_4: number): string
|
|
||||||
{
|
|
||||||
const _local_5: Object[] = [];
|
|
||||||
let _local_6 = _arg_2.getSortableSpriteList();
|
|
||||||
|
|
||||||
const _local_7 = _arg_3.getRoomObjects(_arg_3.activeRoomId, RoomObjectCategory.UNIT);
|
|
||||||
|
|
||||||
for(const _local_8 of _local_7)
|
|
||||||
{
|
|
||||||
if(_local_8.id !== _arg_4)
|
|
||||||
{
|
|
||||||
const _local_11 = (_local_8.visualization as IRoomObjectSpriteVisualization).getSpriteList();
|
|
||||||
|
|
||||||
if(_local_11)
|
|
||||||
{
|
|
||||||
let _local_12 = 0;
|
|
||||||
let _local_13 = 0;
|
|
||||||
|
|
||||||
for(const _local_14 of _local_6)
|
|
||||||
{
|
|
||||||
if(_local_14.name === ('avatar_' + _local_8.id))
|
|
||||||
{
|
|
||||||
_local_12 = _local_14.z;
|
|
||||||
_local_13 = ((_local_14.y + _local_14.height) - (_arg_2.geometry.scale / 4));
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const _local_15 = _arg_3.getRoomObjectScreenLocation(_arg_3.activeRoomId, _local_8.id, RoomObjectCategory.UNIT, _arg_2.id);
|
|
||||||
|
|
||||||
if(_local_15)
|
|
||||||
{
|
|
||||||
if(_local_13 === 0) _local_13 = _local_15.y;
|
|
||||||
|
|
||||||
for(const _local_16 of _local_11)
|
|
||||||
{
|
|
||||||
_local_16.x = (_local_16.x + (_local_15.x - _arg_2.screenOffsetX));
|
|
||||||
_local_16.y = (_local_16.y + _local_13);
|
|
||||||
_local_16.z = (_local_16.z + _local_12);
|
|
||||||
|
|
||||||
if(((_local_16.name.indexOf('h_std_fx29_') === 0) || (_local_16.name.indexOf('h_std_fx185_') === 0)))
|
|
||||||
{
|
|
||||||
_local_16.y = (_local_16.y + SpriteDataCollector.AVATAR_WATER_EFFECT_MAGIC_Y_OFFSET);
|
|
||||||
}
|
|
||||||
|
|
||||||
_local_6.push(_local_16);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_local_6 = SpriteDataCollector.addMannequinSprites(_local_6, _arg_3);
|
|
||||||
_local_6.sort(SpriteDataCollector.sortSpriteDataObjects);
|
|
||||||
|
|
||||||
for(const _local_9 of _local_6)
|
|
||||||
{
|
|
||||||
if((((((!(_local_9.name === null)) && (_local_9.name.length > 0)) && (!(_local_9.name.indexOf('tile_cursor_') === 0))) && (SpriteDataCollector.isSpriteInViewPort(_local_9, k, _arg_2))) && ((_arg_4 < 0) || (!(_local_9.objectId == _arg_4)))))
|
|
||||||
{
|
|
||||||
_local_5.push(this.getSpriteDataObject(_local_9, k, _arg_2, _arg_3));
|
|
||||||
|
|
||||||
if(!this.maxZ) this.maxZ = _local_9.z;
|
|
||||||
|
|
||||||
this.spriteCount++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return JSON.stringify(_local_5);
|
|
||||||
}
|
|
||||||
|
|
||||||
public getRoomRenderingModifiers(k: RoomEngine): string
|
|
||||||
{
|
|
||||||
return JSON.stringify(new Object());
|
|
||||||
}
|
|
||||||
|
|
||||||
private getSpriteDataObject(k: RoomObjectSpriteData, _arg_2: Rectangle, _arg_3: IRoomRenderingCanvas, _arg_4: RoomEngine): Object
|
|
||||||
{
|
|
||||||
let _local_7: string = null;
|
|
||||||
let _local_9: string[] = [];
|
|
||||||
|
|
||||||
const _local_5: {
|
|
||||||
name?: string,
|
|
||||||
x?: number,
|
|
||||||
y?: number,
|
|
||||||
z?: number,
|
|
||||||
alpha?: number,
|
|
||||||
flipH?: boolean,
|
|
||||||
skew?: number,
|
|
||||||
frame?: boolean,
|
|
||||||
color?: number,
|
|
||||||
blendMode?: string,
|
|
||||||
width?: number,
|
|
||||||
height?: number,
|
|
||||||
posture?: string
|
|
||||||
} = {};
|
|
||||||
|
|
||||||
let _local_6 = k.name;
|
|
||||||
|
|
||||||
if(k.name.indexOf('@') !== -1)
|
|
||||||
{
|
|
||||||
_local_9 = k.name.split('@');
|
|
||||||
_local_6 = _local_9[0];
|
|
||||||
_local_7 = _local_9[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
// if(((_local_7) && (k.type)))
|
|
||||||
// {
|
|
||||||
// const _local_10 = _arg_4.roomContentLoader.getCollection(k.type);
|
|
||||||
|
|
||||||
// if(_local_10)
|
|
||||||
// {
|
|
||||||
// const _local_11 = _local_10.getPalette(_local_7);
|
|
||||||
|
|
||||||
// if (((!(_local_11 == null)) && (!(_local_11.@source == null))))
|
|
||||||
// {
|
|
||||||
// _local_5.paletteSourceName = (_local_11.@source + '');
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var _local_8: string = _arg_4.configuration.getProperty('image.library.url');
|
|
||||||
// _local_6 = _local_6.replace('%image.library.url%', _local_8);
|
|
||||||
// if (_local_6.indexOf('%group.badge.url%') != -1)
|
|
||||||
// {
|
|
||||||
// _local_12 = _arg_4.configuration.getProperty('group.badge.url');
|
|
||||||
// _local_6 = _local_6.replace('%group.badge.url%', '');
|
|
||||||
// _local_13 = _local_12.replace('%imagerdata%', _local_6);
|
|
||||||
// _local_6 = _local_13;
|
|
||||||
// }
|
|
||||||
|
|
||||||
_local_5.name = _local_6;
|
|
||||||
_local_5.x = (k.x - _arg_2.x);
|
|
||||||
_local_5.y = (k.y - _arg_2.y);
|
|
||||||
_local_5.x = (_local_5.x + _arg_3.screenOffsetX);
|
|
||||||
_local_5.y = (_local_5.y + _arg_3.screenOffsetY);
|
|
||||||
_local_5.z = k.z;
|
|
||||||
|
|
||||||
if(k.alpha && (k.alpha.toString() !== '255')) _local_5.alpha = k.alpha;
|
|
||||||
|
|
||||||
if(k.flipH) _local_5.flipH = k.flipH;
|
|
||||||
|
|
||||||
if(k.skew) _local_5.skew = k.skew;
|
|
||||||
|
|
||||||
if(k.frame) _local_5.frame = k.frame;
|
|
||||||
|
|
||||||
if(k.color && (k.color.length > 0)) _local_5.color = parseInt(k.color);
|
|
||||||
|
|
||||||
if(k.blendMode && (k.blendMode !== 'normal')) _local_5.blendMode = k.blendMode;
|
|
||||||
|
|
||||||
if(_local_6.indexOf('http') === 0)
|
|
||||||
{
|
|
||||||
_local_5.width = k.width;
|
|
||||||
_local_5.height = k.height;
|
|
||||||
|
|
||||||
this.externalImageCount++;
|
|
||||||
|
|
||||||
if(this.externalImageCount > SpriteDataCollector.MAX_EXTERNAL_IMAGE_COUNT) _local_5.name = 'box';
|
|
||||||
}
|
|
||||||
|
|
||||||
if(k.posture) _local_5.posture = k.posture;
|
|
||||||
|
|
||||||
return _local_5;
|
|
||||||
}
|
|
||||||
|
|
||||||
private makeBackgroundPlane(k: Rectangle, _arg_2: number, _arg_3: IPlaneDrawingData[]): PlaneDrawingData
|
|
||||||
{
|
|
||||||
const _local_4 = new Point(0, 0);
|
|
||||||
const _local_5 = new Point(k.width, 0);
|
|
||||||
const _local_6 = new Point(0, k.height);
|
|
||||||
const _local_7 = new Point(k.width, k.height);
|
|
||||||
const _local_8 = SpriteDataCollector.sortQuadPoints(_local_4, _local_5, _local_6, _local_7);
|
|
||||||
|
|
||||||
let _local_9 = 0;
|
|
||||||
|
|
||||||
if(_arg_3.length > 0)
|
|
||||||
{
|
|
||||||
_local_9 = _arg_3[0].z;
|
|
||||||
|
|
||||||
if(this.maxZ) _local_9 = Math.max(this.maxZ, _local_9);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_local_9 = ((this.maxZ) ? this.maxZ : 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
_local_9 = (_local_9 + ((this.spriteCount * 1.776104) + (_arg_3.length * 2.31743)));
|
|
||||||
|
|
||||||
const _local_10 = new PlaneDrawingData(null, _arg_2);
|
|
||||||
|
|
||||||
_local_10.cornerPoints = _local_8;
|
|
||||||
_local_10.z = _local_9;
|
|
||||||
|
|
||||||
return _local_10;
|
|
||||||
}
|
|
||||||
|
|
||||||
private sortRoomPlanes(k: IRoomPlane[], _arg_2: IRoomRenderingCanvas, _arg_3: RoomEngine): { plane: IRoomPlane, z: number }[]
|
|
||||||
{
|
|
||||||
const _local_4: Map<number, { plane: IRoomPlane, z: number }> = new Map();
|
|
||||||
|
|
||||||
let _local_5 = 1;
|
|
||||||
|
|
||||||
if(this.maxZ)
|
|
||||||
{
|
|
||||||
_local_5 = (_local_5 + this.maxZ);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(const _local_6 of k)
|
|
||||||
{
|
|
||||||
const _local_10 = {
|
|
||||||
plane: _local_6,
|
|
||||||
z: _local_5
|
|
||||||
};
|
|
||||||
|
|
||||||
_local_4.set(_local_6.uniqueId, _local_10);
|
|
||||||
}
|
|
||||||
|
|
||||||
const sprites = _arg_2.getPlaneSortableSprites();
|
|
||||||
|
|
||||||
sprites.sort((a, b) =>
|
|
||||||
{
|
|
||||||
return (b.z - a.z);
|
|
||||||
});
|
|
||||||
|
|
||||||
sprites.reverse();
|
|
||||||
|
|
||||||
let _local_8: { plane: IRoomPlane, z: number }[] = [];
|
|
||||||
|
|
||||||
for(const sprite of sprites)
|
|
||||||
{
|
|
||||||
const objectSprite = sprite.sprite;
|
|
||||||
|
|
||||||
if(objectSprite)
|
|
||||||
{
|
|
||||||
const _local_10 = _local_4.get(objectSprite.id);
|
|
||||||
|
|
||||||
if(_local_10)
|
|
||||||
{
|
|
||||||
_local_4.delete(objectSprite.id);
|
|
||||||
|
|
||||||
_local_10.z = sprite.z;
|
|
||||||
|
|
||||||
_local_8.push(_local_10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_local_8 = _local_8.concat(Array.from(_local_4.values()));
|
|
||||||
|
|
||||||
return _local_8;
|
|
||||||
}
|
|
||||||
|
|
||||||
public getRoomPlanes(k: Rectangle, _arg_2: IRoomRenderingCanvas, _arg_3: RoomEngine, _arg_4: number): IPlaneDrawingData[]
|
|
||||||
{
|
|
||||||
const _local_5: IPlaneDrawingData[] = [];
|
|
||||||
|
|
||||||
const roomObject = _arg_3.getRoomObject(_arg_3.activeRoomId, RoomEngine.ROOM_OBJECT_ID, RoomObjectCategory.ROOM);
|
|
||||||
const visualization = (roomObject.visualization as unknown as IPlaneVisualization);
|
|
||||||
|
|
||||||
if(visualization)
|
|
||||||
{
|
|
||||||
const _local_8 = _arg_2.geometry;
|
|
||||||
const _local_9 = this.sortRoomPlanes(visualization.planes, _arg_2, _arg_3);
|
|
||||||
const _local_10 = GetStage();
|
|
||||||
|
|
||||||
for(const _local_11 of _local_9)
|
|
||||||
{
|
|
||||||
const _local_12 = _local_11.plane;
|
|
||||||
const _local_13: Point[] = [];
|
|
||||||
|
|
||||||
const _local_14 = Vector3d.sum(_local_12.location, _local_12.leftSide);
|
|
||||||
const _local_15 = _local_8.getScreenPoint(_local_12.location);
|
|
||||||
const _local_16 = _local_8.getScreenPoint(_local_14);
|
|
||||||
const _local_17 = _local_8.getScreenPoint(Vector3d.sum(_local_12.location, _local_12.rightSide));
|
|
||||||
const _local_18 = _local_8.getScreenPoint(Vector3d.sum(_local_14, _local_12.rightSide));
|
|
||||||
|
|
||||||
_local_13.push(_local_15, _local_16, _local_17, _local_18);
|
|
||||||
|
|
||||||
let _local_19 = 0;
|
|
||||||
let _local_20 = 0;
|
|
||||||
|
|
||||||
for(const _local_21 of _local_13)
|
|
||||||
{
|
|
||||||
_local_21.x += (_local_10.width / 2);
|
|
||||||
_local_21.y += (_local_10.height / 2);
|
|
||||||
|
|
||||||
_local_21.x += _arg_2.screenOffsetX;
|
|
||||||
_local_21.y += _arg_2.screenOffsetY;
|
|
||||||
|
|
||||||
_local_21.x += -(k.x);
|
|
||||||
_local_21.y += -(k.y);
|
|
||||||
|
|
||||||
if(_local_21.x < 0) _local_19--;
|
|
||||||
|
|
||||||
else if(_local_21.x >= k.width) _local_19++;
|
|
||||||
|
|
||||||
if(_local_21.y < 0) _local_20--;
|
|
||||||
|
|
||||||
else if(_local_21.y >= k.height) _local_20++;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(((Math.abs(_local_19) === 4) || (Math.abs(_local_20) === 4)))
|
|
||||||
{
|
|
||||||
//
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
const _local_22 = SpriteDataCollector.sortQuadPoints(_local_15, _local_16, _local_17, _local_18);
|
|
||||||
|
|
||||||
/* for(const _local_23 of _local_12.getDrawingDatas(_local_8))
|
|
||||||
{
|
|
||||||
_local_23.cornerPoints = _local_22;
|
|
||||||
_local_23.z = _local_11.z;
|
|
||||||
|
|
||||||
_local_5.push(_local_23);
|
|
||||||
} */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_local_5.unshift(this.makeBackgroundPlane(k, _arg_4, _local_5));
|
|
||||||
}
|
|
||||||
|
|
||||||
return _local_5;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
export * from './FurnitureStackingHeightMap';
|
export * from './FurnitureStackingHeightMap';
|
||||||
export * from './LegacyWallGeometry';
|
export * from './LegacyWallGeometry';
|
||||||
|
export * from './RoomAreaSelectionManager';
|
||||||
export * from './RoomCamera';
|
export * from './RoomCamera';
|
||||||
export * from './RoomData';
|
export * from './RoomData';
|
||||||
export * from './RoomEnterEffect';
|
export * from './RoomEnterEffect';
|
||||||
|
@ -25,7 +25,5 @@
|
|||||||
"ESNext"
|
"ESNext"
|
||||||
],
|
],
|
||||||
"module": "ES6"
|
"module": "ES6"
|
||||||
},
|
}
|
||||||
"include": [
|
|
||||||
"src" ]
|
|
||||||
}
|
}
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": [ "@nitrots/eslint-config" ]
|
|
||||||
}
|
|
@ -5,8 +5,7 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "GPL-3.0",
|
"license": "GPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"compile": "tsc --project ./tsconfig.json --noEmit false",
|
"compile": "tsc --project ./tsconfig.json --noEmit false"
|
||||||
"eslint": "eslint ./src --fix"
|
|
||||||
},
|
},
|
||||||
"main": "./index",
|
"main": "./index",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@ -14,10 +13,9 @@
|
|||||||
"@nitrots/assets": "1.0.0",
|
"@nitrots/assets": "1.0.0",
|
||||||
"@nitrots/communication": "1.0.0",
|
"@nitrots/communication": "1.0.0",
|
||||||
"@nitrots/configuration": "1.0.0",
|
"@nitrots/configuration": "1.0.0",
|
||||||
"@nitrots/eslint-config": "1.0.0",
|
|
||||||
"@nitrots/events": "1.0.0",
|
"@nitrots/events": "1.0.0",
|
||||||
"@nitrots/localization": "1.0.0",
|
"@nitrots/localization": "1.0.0",
|
||||||
"pixi.js": "^8.1.0"
|
"pixi.js": "^8.1.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "~5.4.2"
|
"typescript": "~5.4.2"
|
||||||
|
@ -50,8 +50,6 @@ export class SessionDataManager implements ISessionDataManager
|
|||||||
constructor()
|
constructor()
|
||||||
{
|
{
|
||||||
this.resetUserInfo();
|
this.resetUserInfo();
|
||||||
|
|
||||||
this.onNitroSettingsEvent = this.onNitroSettingsEvent.bind(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public async init(): Promise<void>
|
public async init(): Promise<void>
|
||||||
@ -86,7 +84,13 @@ export class SessionDataManager implements ISessionDataManager
|
|||||||
GetCommunication().registerMessageEvent(new AccountSafetyLockStatusChangeMessageEvent(this.onAccountSafetyLockStatusChangeMessageEvent.bind(this)));
|
GetCommunication().registerMessageEvent(new AccountSafetyLockStatusChangeMessageEvent(this.onAccountSafetyLockStatusChangeMessageEvent.bind(this)));
|
||||||
GetCommunication().registerMessageEvent(new EmailStatusResultEvent(this.onEmailStatus.bind(this)));
|
GetCommunication().registerMessageEvent(new EmailStatusResultEvent(this.onEmailStatus.bind(this)));
|
||||||
|
|
||||||
GetEventDispatcher().addEventListener(NitroSettingsEvent.SETTINGS_UPDATED, this.onNitroSettingsEvent);
|
GetEventDispatcher().addEventListener<NitroSettingsEvent>(NitroSettingsEvent.SETTINGS_UPDATED, event =>
|
||||||
|
{
|
||||||
|
this._isRoomCameraFollowDisabled = event.cameraFollow;
|
||||||
|
this._uiFlags = event.flags;
|
||||||
|
|
||||||
|
GetEventDispatcher().dispatchEvent(new SessionDataPreferencesEvent(this._uiFlags));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private resetUserInfo(): void
|
private resetUserInfo(): void
|
||||||
@ -256,14 +260,6 @@ export class SessionDataManager implements ISessionDataManager
|
|||||||
this._isEmailVerified = event?.getParser()?.isVerified ?? false;
|
this._isEmailVerified = event?.getParser()?.isVerified ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private onNitroSettingsEvent(event: NitroSettingsEvent): void
|
|
||||||
{
|
|
||||||
this._isRoomCameraFollowDisabled = event.cameraFollow;
|
|
||||||
this._uiFlags = event.flags;
|
|
||||||
|
|
||||||
GetEventDispatcher().dispatchEvent(new SessionDataPreferencesEvent(this._uiFlags));
|
|
||||||
}
|
|
||||||
|
|
||||||
public getFloorItemData(id: number): IFurnitureData
|
public getFloorItemData(id: number): IFurnitureData
|
||||||
{
|
{
|
||||||
const existing = this._floorItems.get(id);
|
const existing = this._floorItems.get(id);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { IFurnitureData } from '@nitrots/api';
|
import { FurnitureType, IFurnitureData } from '@nitrots/api';
|
||||||
|
|
||||||
export class FurnitureData implements IFurnitureData
|
export class FurnitureData implements IFurnitureData
|
||||||
{
|
{
|
||||||
private _type: string;
|
private _type: FurnitureType;
|
||||||
private _id: number;
|
private _id: number;
|
||||||
private _className: string;
|
private _className: string;
|
||||||
private _fullName: string;
|
private _fullName: string;
|
||||||
@ -32,7 +32,7 @@ export class FurnitureData implements IFurnitureData
|
|||||||
private _environment: string;
|
private _environment: string;
|
||||||
private _rare: boolean;
|
private _rare: boolean;
|
||||||
|
|
||||||
constructor(type: string, id: number, fullName: string, className: string, category: string, localizedName: string, description: string, revision: number, tileSizeX: number, tileSizeY: number, tileSizeZ: number, colors: number[], hadIndexedColor: boolean, colorIndex: number, adUrl: string, purchaseOfferId: number, purchaseCouldBeUsedForBuyout: boolean, rentOfferId: number, rentCouldBeUsedForBuyout: boolean, availableForBuildersClub: boolean, customParams: string, specialType: number, canStandOn: boolean, canSitOn: boolean, canLayOn: boolean, excludedfromDynamic: boolean, furniLine: string, environment: string, rare: boolean)
|
constructor(type: FurnitureType, id: number, fullName: string, className: string, category: string, localizedName: string, description: string, revision: number, tileSizeX: number, tileSizeY: number, tileSizeZ: number, colors: number[], hadIndexedColor: boolean, colorIndex: number, adUrl: string, purchaseOfferId: number, purchaseCouldBeUsedForBuyout: boolean, rentOfferId: number, rentCouldBeUsedForBuyout: boolean, availableForBuildersClub: boolean, customParams: string, specialType: number, canStandOn: boolean, canSitOn: boolean, canLayOn: boolean, excludedfromDynamic: boolean, furniLine: string, environment: string, rare: boolean)
|
||||||
{
|
{
|
||||||
this._type = type;
|
this._type = type;
|
||||||
this._id = id;
|
this._id = id;
|
||||||
@ -65,7 +65,7 @@ export class FurnitureData implements IFurnitureData
|
|||||||
this._rare = rare;
|
this._rare = rare;
|
||||||
}
|
}
|
||||||
|
|
||||||
public get type(): string
|
public get type(): FurnitureType
|
||||||
{
|
{
|
||||||
return this._type;
|
return this._type;
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user