mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-22 23:50:52 +01:00
Updates
This commit is contained in:
parent
cbc9689409
commit
4641857a06
@ -1,6 +1,5 @@
|
||||
import { IDisposable } from './IDisposable';
|
||||
|
||||
export interface IUpdateReceiver extends IDisposable
|
||||
export interface IUpdateReceiver
|
||||
{
|
||||
update(time: number): void;
|
||||
}
|
||||
|
@ -94,7 +94,6 @@ export interface IRoomEngine
|
||||
logicFactory: IRoomObjectLogicFactory;
|
||||
roomContentLoader: IRoomContentLoader;
|
||||
activeRoomId: number;
|
||||
disposed: boolean;
|
||||
selectedAvatarId: number;
|
||||
isDecorating: boolean;
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { IDisposable } from '../../common';
|
||||
import { IConnection } from '../communication';
|
||||
import { IRoomModerationSettings } from './IRoomModerationSettings';
|
||||
import { IUserDataManager } from './IUserDataManager';
|
||||
|
||||
export interface IRoomSession extends IDisposable
|
||||
export interface IRoomSession
|
||||
{
|
||||
dispose(): void;
|
||||
openGift(objectId: number): void;
|
||||
setConnection(connection: IConnection): void;
|
||||
setControllerLevel(level: number): void;
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { IDisposable } from '../../api';
|
||||
import { IRoomInstanceContainer } from './IRoomInstanceContainer';
|
||||
import { IRoomObjectManager } from './IRoomObjectManager';
|
||||
import { IRoomObject, IRoomObjectModel } from './object';
|
||||
import { IRoomRendererBase } from './renderer';
|
||||
|
||||
export interface IRoomInstance extends IDisposable
|
||||
export interface IRoomInstance
|
||||
{
|
||||
dispose(): void;
|
||||
setRenderer(renderer: IRoomRendererBase): void;
|
||||
getManager(category: number): IRoomObjectManager;
|
||||
getTotalObjectsForManager(category: number): number;
|
||||
|
@ -1,11 +1,11 @@
|
||||
import { IDisposable } from '../../common';
|
||||
import { IVector3D } from '../IVector3D';
|
||||
import { IRoomObjectModel } from './IRoomObjectModel';
|
||||
import { IRoomObjectMouseHandler } from './logic';
|
||||
import { IRoomObjectVisualization } from './visualization';
|
||||
|
||||
export interface IRoomObject extends IDisposable
|
||||
export interface IRoomObject
|
||||
{
|
||||
dispose(): void;
|
||||
getLocation(): IVector3D;
|
||||
getDirection(): IVector3D;
|
||||
getState(index?: number): number;
|
||||
|
@ -1,11 +1,12 @@
|
||||
import { IDisposable, IEventDispatcher } from '../../../common';
|
||||
import { IEventDispatcher } from '../../../common';
|
||||
import { IRoomObjectUpdateMessage } from '../../IRoomObjectUpdateMessage';
|
||||
import { IRoomObjectController } from '../IRoomObjectController';
|
||||
import { IRoomObjectMouseHandler } from './IRoomObjectMouseHandler';
|
||||
|
||||
export interface IRoomObjectEventHandler extends IRoomObjectMouseHandler, IDisposable
|
||||
export interface IRoomObjectEventHandler extends IRoomObjectMouseHandler
|
||||
{
|
||||
initialize(data: unknown): void;
|
||||
dispose(): void;
|
||||
update(totalTimeRunning: number): void;
|
||||
processUpdateMessage(message: IRoomObjectUpdateMessage): void;
|
||||
getEventTypes(): string[];
|
||||
|
@ -1,66 +0,0 @@
|
||||
import { IEventDispatcher, INitroManager } from '../api';
|
||||
import { Disposable } from './Disposable';
|
||||
import { EventDispatcher } from './EventDispatcher';
|
||||
|
||||
export class NitroManager extends Disposable implements INitroManager
|
||||
{
|
||||
private _events: IEventDispatcher;
|
||||
|
||||
private _isLoaded: boolean;
|
||||
private _isLoading: boolean;
|
||||
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
|
||||
this._events = new EventDispatcher();
|
||||
|
||||
this._isLoaded = false;
|
||||
this._isLoading = false;
|
||||
}
|
||||
|
||||
public init(): void
|
||||
{
|
||||
if(this._isLoaded || this._isLoading || this.isDisposing) return;
|
||||
|
||||
this._isLoading = true;
|
||||
|
||||
this.onInit();
|
||||
|
||||
this._isLoaded = true;
|
||||
this._isLoading = false;
|
||||
}
|
||||
|
||||
protected onInit(): void
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
protected onDispose(): void
|
||||
{
|
||||
if(this._events) this._events.dispose();
|
||||
|
||||
super.onDispose();
|
||||
}
|
||||
|
||||
public reload(): void
|
||||
{
|
||||
this.dispose();
|
||||
this.init();
|
||||
}
|
||||
|
||||
public get events(): IEventDispatcher
|
||||
{
|
||||
return this._events;
|
||||
}
|
||||
|
||||
public get isLoaded(): boolean
|
||||
{
|
||||
return this._isLoaded;
|
||||
}
|
||||
|
||||
public get isLoading(): boolean
|
||||
{
|
||||
return this._isLoading;
|
||||
}
|
||||
}
|
@ -1,3 +1,2 @@
|
||||
export * from './Disposable';
|
||||
export * from './EventDispatcher';
|
||||
export * from './NitroManager';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { Matrix, Point, Rectangle, RenderTexture, Resource, Texture } from '@pixi/core';
|
||||
import { Container, DisplayObject } from '@pixi/display';
|
||||
import { ICommunicationManager, IConnection, IFurnitureStackingHeightMap, IGetImageListener, IImageResult, ILegacyWallGeometry, IMessageComposer, IObjectData, IPetColorResult, IPetCustomPart, IRoomContentListener, IRoomContentLoader, IRoomCreator, IRoomEngine, IRoomEngineServices, IRoomGeometry, IRoomInstance, IRoomManager, IRoomManagerListener, IRoomObject, IRoomObjectController, IRoomObjectLogicFactory, IRoomObjectVisualizationFactory, IRoomRenderer, IRoomRendererFactory, IRoomRenderingCanvas, IRoomSessionManager, ISelectedRoomObjectData, ISessionDataManager, ITileObjectMap, IUpdateReceiver, IVector3D, LegacyDataType, MouseEventType, NitroConfiguration, NitroLogger, ObjectDataFactory, RoomControllerLevel, RoomObjectCategory, RoomObjectUserType, RoomObjectVariable, ToolbarIconEnum, Vector3d } from '../../api';
|
||||
import { NitroManager } from '../../common';
|
||||
import { BadgeImageReadyEvent, NitroEventDispatcher, NitroToolbarAnimateIconEvent, RoomBackgroundColorEvent, RoomDragEvent, RoomEngineEvent, RoomEngineObjectEvent, RoomObjectEvent, RoomObjectFurnitureActionEvent, RoomObjectMouseEvent, RoomSessionEvent, RoomToObjectOwnAvatarMoveEvent } from '../../events';
|
||||
import { GetTicker, GetTickerTime, NitroSprite, TextureUtils } from '../../pixi-proxy';
|
||||
import { NumberBank, RoomEnterEffect, RoomGeometry, RoomInstance, RoomManager, RoomObjectUpdateMessage, RoomRendererFactory } from '../../room';
|
||||
@ -19,7 +18,7 @@ import { ObjectAvatarCarryObjectUpdateMessage, ObjectAvatarChatUpdateMessage, Ob
|
||||
import { RoomLogic, RoomMapData, RoomObjectVisualizationFactory } from './object';
|
||||
import { RoomCamera, RoomData, RoomFurnitureData, RoomInstanceData, RoomObjectBadgeImageAssetListener, SpriteDataCollector } from './utils';
|
||||
|
||||
export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreator, IRoomEngineServices, IRoomManagerListener, IRoomContentListener, IUpdateReceiver
|
||||
export class RoomEngine implements IRoomEngine, IRoomCreator, IRoomEngineServices, IRoomManagerListener, IRoomContentListener, IUpdateReceiver
|
||||
{
|
||||
public static ROOM_OBJECT_ID: number = -1;
|
||||
public static ROOM_OBJECT_TYPE: string = 'room';
|
||||
@ -70,8 +69,6 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
|
||||
|
||||
constructor(communication: ICommunicationManager, sessionDataManager: ISessionDataManager)
|
||||
{
|
||||
super();
|
||||
|
||||
this._communication = communication;
|
||||
this._sessionDataManager = sessionDataManager;
|
||||
this._roomSessionManager = new RoomSessionManager(this._communication, this);
|
||||
|
@ -1,52 +1,29 @@
|
||||
import { IConnection, IRoomSession, RoomControllerLevel, RoomTradingLevelEnum } from '../../api';
|
||||
import { Disposable } from '../../common';
|
||||
import { RoomSessionEvent } from '../../events';
|
||||
import { BotRemoveComposer, ChangeQueueMessageComposer, CompostPlantMessageComposer, FurnitureMultiStateComposer, GetPetCommandsComposer, HarvestPetMessageComposer, MoodlightSettingsComposer, MoodlightSettingsSaveComposer, MoodlightTogggleStateComposer, NewUserExperienceScriptProceedComposer, OpenPetPackageMessageComposer, OpenPresentComposer, PeerUsersClassificationMessageComposer, PetMountComposer, PetRemoveComposer, PollAnswerComposer, PollRejectComposer, PollStartComposer, RemovePetSaddleComposer, RoomAmbassadorAlertComposer, RoomBanUserComposer, RoomDoorbellAccessComposer, RoomEnterComposer, RoomGiveRightsComposer, RoomKickUserComposer, RoomModerationSettings, RoomMuteUserComposer, RoomTakeRightsComposer, RoomUnitActionComposer, RoomUnitChatComposer, RoomUnitChatShoutComposer, RoomUnitChatWhisperComposer, RoomUnitDanceComposer, RoomUnitPostureComposer, RoomUnitSignComposer, RoomUnitTypingStartComposer, RoomUnitTypingStopComposer, RoomUsersClassificationMessageComposer, SetClothingChangeDataMessageComposer, TogglePetBreedingComposer, TogglePetRidingComposer, UsePetProductComposer, UserMottoComposer, VotePollCounterMessageComposer } from '../communication';
|
||||
import { UserDataManager } from './UserDataManager';
|
||||
|
||||
export class RoomSession extends Disposable implements IRoomSession
|
||||
export class RoomSession implements IRoomSession
|
||||
{
|
||||
private _connection: IConnection;
|
||||
private _userData: UserDataManager;
|
||||
private _connection: IConnection = null;
|
||||
private _userData: UserDataManager = new UserDataManager();
|
||||
|
||||
private _roomId: number;
|
||||
private _password: string;
|
||||
private _state: string;
|
||||
private _tradeMode: number;
|
||||
private _doorMode: number;
|
||||
private _allowPets: boolean;
|
||||
private _controllerLevel: number;
|
||||
private _ownRoomIndex: number;
|
||||
private _isGuildRoom: boolean;
|
||||
private _isRoomOwner: boolean;
|
||||
private _isDecorating: boolean;
|
||||
private _isSpectator: boolean;
|
||||
private _roomId: number = 0;
|
||||
private _password: string = null;
|
||||
private _state: string = RoomSessionEvent.CREATED;
|
||||
private _tradeMode: number = RoomTradingLevelEnum.NO_TRADING;
|
||||
private _doorMode: number = 0;
|
||||
private _allowPets: boolean = false;
|
||||
private _controllerLevel: number = RoomControllerLevel.NONE;
|
||||
private _ownRoomIndex: number = -1;
|
||||
private _isGuildRoom: boolean = false;
|
||||
private _isRoomOwner: boolean = false;
|
||||
private _isDecorating: boolean = false;
|
||||
private _isSpectator: boolean = false;
|
||||
|
||||
private _moderationSettings: RoomModerationSettings;
|
||||
private _moderationSettings: RoomModerationSettings = null;
|
||||
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
|
||||
this._connection = null;
|
||||
this._userData = new UserDataManager();
|
||||
|
||||
this._roomId = 0;
|
||||
this._password = null;
|
||||
this._state = RoomSessionEvent.CREATED;
|
||||
this._tradeMode = RoomTradingLevelEnum.NO_TRADING;
|
||||
this._doorMode = 0;
|
||||
this._controllerLevel = RoomControllerLevel.NONE;
|
||||
this._ownRoomIndex = -1;
|
||||
this._isGuildRoom = false;
|
||||
this._isRoomOwner = false;
|
||||
this._isDecorating = false;
|
||||
this._isSpectator = false;
|
||||
|
||||
this._moderationSettings = null;
|
||||
}
|
||||
|
||||
protected onDispose(): void
|
||||
public dispose(): void
|
||||
{
|
||||
if(this._userData)
|
||||
{
|
||||
|
@ -1,32 +1,20 @@
|
||||
import { IConnection, IRoomUserData } from '../../api';
|
||||
import { Disposable } from '../../common';
|
||||
import { RequestPetInfoComposer, UserCurrentBadgesComposer } from '../communication';
|
||||
|
||||
export class UserDataManager extends Disposable
|
||||
export class UserDataManager
|
||||
{
|
||||
private static TYPE_USER: number = 1;
|
||||
private static TYPE_PET: number = 2;
|
||||
private static TYPE_BOT: number = 3;
|
||||
private static TYPE_RENTABLE_BOT: number = 4;
|
||||
|
||||
private _connection: IConnection;
|
||||
private _connection: IConnection = null;
|
||||
|
||||
private _userDataByType: Map<number, Map<number, IRoomUserData>>;
|
||||
private _userDataByRoomIndex: Map<number, IRoomUserData>;
|
||||
private _userBadges: Map<number, string[]>;
|
||||
private _userDataByType: Map<number, Map<number, IRoomUserData>> = new Map();
|
||||
private _userDataByRoomIndex: Map<number, IRoomUserData> = new Map();
|
||||
private _userBadges: Map<number, string[]> = new Map();
|
||||
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
|
||||
this._connection = null;
|
||||
|
||||
this._userDataByType = new Map();
|
||||
this._userDataByRoomIndex = new Map();
|
||||
this._userBadges = new Map();
|
||||
}
|
||||
|
||||
protected onDispose(): void
|
||||
public dispose(): void
|
||||
{
|
||||
this._connection = null;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { IConnection, IRoomHandlerListener } from '../../../api';
|
||||
import { Disposable } from '../../../common';
|
||||
|
||||
export class BaseHandler extends Disposable
|
||||
export class BaseHandler
|
||||
{
|
||||
private _connection: IConnection;
|
||||
private _listener: IRoomHandlerListener;
|
||||
@ -9,14 +8,12 @@ export class BaseHandler extends Disposable
|
||||
|
||||
constructor(connection: IConnection, listener: IRoomHandlerListener)
|
||||
{
|
||||
super();
|
||||
|
||||
this._connection = connection;
|
||||
this._listener = listener;
|
||||
this._roomId = 0;
|
||||
}
|
||||
|
||||
protected onDispose(): void
|
||||
public dispose(): void
|
||||
{
|
||||
this._connection = null;
|
||||
this._listener = null;
|
||||
|
@ -1,29 +1,22 @@
|
||||
import { IRoomInstance, IRoomInstanceContainer, IRoomObject, IRoomObjectController, IRoomObjectManager, IRoomObjectModel, IRoomRendererBase } from '../api';
|
||||
import { Disposable } from '../common';
|
||||
import { RoomObjectModel } from './object';
|
||||
|
||||
export class RoomInstance extends Disposable implements IRoomInstance
|
||||
export class RoomInstance implements IRoomInstance
|
||||
{
|
||||
private _id: string;
|
||||
private _container: IRoomInstanceContainer;
|
||||
private _renderer: IRoomRendererBase;
|
||||
private _managers: Map<number, IRoomObjectManager>;
|
||||
private _updateCategories: number[];
|
||||
private _model: IRoomObjectModel;
|
||||
private _renderer: IRoomRendererBase = null;
|
||||
private _managers: Map<number, IRoomObjectManager> = new Map();
|
||||
private _updateCategories: number[] = [];
|
||||
private _model: IRoomObjectModel = new RoomObjectModel();
|
||||
|
||||
constructor(id: string, container: IRoomInstanceContainer)
|
||||
{
|
||||
super();
|
||||
|
||||
this._id = id;
|
||||
this._container = container;
|
||||
this._renderer = null;
|
||||
this._managers = new Map();
|
||||
this._updateCategories = [];
|
||||
this._model = new RoomObjectModel();
|
||||
}
|
||||
|
||||
protected onDispose(): void
|
||||
public dispose(): void
|
||||
{
|
||||
this.removeAllManagers();
|
||||
|
||||
|
@ -1,46 +1,31 @@
|
||||
import { IRoomObjectController, IRoomObjectEventHandler, IRoomObjectModel, IRoomObjectMouseHandler, IRoomObjectUpdateMessage, IRoomObjectVisualization, IVector3D, Vector3d } from '../../api';
|
||||
import { Disposable } from '../../common';
|
||||
import { RoomObjectModel } from './RoomObjectModel';
|
||||
|
||||
export class RoomObject extends Disposable implements IRoomObjectController
|
||||
export class RoomObject implements IRoomObjectController
|
||||
{
|
||||
private static OBJECT_COUNTER: number = 0;
|
||||
|
||||
private _id: number;
|
||||
private _instanceId: number;
|
||||
private _type: string;
|
||||
private _model: IRoomObjectModel;
|
||||
private _model: IRoomObjectModel = new RoomObjectModel();
|
||||
|
||||
private _location: IVector3D;
|
||||
private _direction: IVector3D;
|
||||
private _states: number[];
|
||||
private _location: IVector3D = new Vector3d();
|
||||
private _direction: IVector3D = new Vector3d();
|
||||
private _states: number[] = [];
|
||||
|
||||
private _visualization: IRoomObjectVisualization;
|
||||
private _logic: IRoomObjectEventHandler;
|
||||
private _pendingLogicMessages: IRoomObjectUpdateMessage[];
|
||||
private _visualization: IRoomObjectVisualization = null;
|
||||
private _logic: IRoomObjectEventHandler = null;
|
||||
private _pendingLogicMessages: IRoomObjectUpdateMessage[] = [];
|
||||
|
||||
private _updateCounter: number;
|
||||
private _isReady: boolean;
|
||||
private _updateCounter: number = 0;
|
||||
private _isReady: boolean = false;
|
||||
|
||||
constructor(id: number, stateCount: number, type: string)
|
||||
{
|
||||
super();
|
||||
|
||||
this._id = id;
|
||||
this._instanceId = RoomObject.OBJECT_COUNTER++;
|
||||
this._type = type;
|
||||
this._model = new RoomObjectModel();
|
||||
|
||||
this._location = new Vector3d();
|
||||
this._direction = new Vector3d();
|
||||
this._states = [];
|
||||
|
||||
this._visualization = null;
|
||||
this._logic = null;
|
||||
this._pendingLogicMessages = [];
|
||||
|
||||
this._updateCounter = 0;
|
||||
this._isReady = false;
|
||||
|
||||
let i = (stateCount - 1);
|
||||
|
||||
@ -52,7 +37,7 @@ export class RoomObject extends Disposable implements IRoomObjectController
|
||||
}
|
||||
}
|
||||
|
||||
protected onDispose(): void
|
||||
public dispose(): void
|
||||
{
|
||||
this._pendingLogicMessages = [];
|
||||
|
||||
@ -60,8 +45,6 @@ export class RoomObject extends Disposable implements IRoomObjectController
|
||||
this.setLogic(null);
|
||||
|
||||
if(this._model) this._model.dispose();
|
||||
|
||||
super.onDispose();
|
||||
}
|
||||
|
||||
public getLocation(): IVector3D
|
||||
|
@ -1,30 +1,18 @@
|
||||
import { IEventDispatcher, IRoomGeometry, IRoomObjectController, IRoomObjectEventHandler, IRoomObjectUpdateMessage } from '../../../api';
|
||||
import { Disposable } from '../../../common';
|
||||
import { RoomSpriteMouseEvent } from '../../../events';
|
||||
|
||||
export class RoomObjectLogicBase extends Disposable implements IRoomObjectEventHandler
|
||||
export class RoomObjectLogicBase implements IRoomObjectEventHandler
|
||||
{
|
||||
private _events: IEventDispatcher;
|
||||
private _object: IRoomObjectController;
|
||||
|
||||
private _time: number;
|
||||
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
|
||||
this._object = null;
|
||||
this._events = null;
|
||||
|
||||
this._time = 0;
|
||||
}
|
||||
private _events: IEventDispatcher = null;
|
||||
private _object: IRoomObjectController = null;
|
||||
private _time: number = 0;
|
||||
|
||||
public initialize(data: unknown): void
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
protected onDispose(): void
|
||||
public dispose(): void
|
||||
{
|
||||
this._object = null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user