mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2024-11-22 23:50:52 +01:00
Merge branch 'fix/variable-cleanup' of https://git.krews.org/nitro/nitro-renderer into fix/variable-cleanup
This commit is contained in:
commit
3b361550bb
@ -1,5 +1,5 @@
|
||||
import { IMessageConfiguration } from '../../core/communication/messages/IMessageConfiguration';
|
||||
import { ApproveNameMessageComposer, BonusRareInfoMessageEvent, CatalogApproveNameResultEvent, ChangeUserNameResultMessageEvent, FurnitureGuildInfoComposer, GetBonusRareInfoMessageComposer, MysteryBoxKeysEvent, PetExperienceEvent, PetMountComposer, PetSupplementComposer, RemovePetSaddleComposer, RoomUnitGiveHandItemPetComposer, RoomWidgetCameraPublishedEvent, RoomWidgetCameraPurchaseComposer, SellablePetPalettesEvent, TogglePetBreedingComposer, TogglePetRidingComposer, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer } from './messages';
|
||||
import { ApproveNameMessageComposer, BadgeReceivedEvent, BonusRareInfoMessageEvent, CatalogApproveNameResultEvent, ChangeUserNameResultMessageEvent, FurnitureGuildInfoComposer, GetBonusRareInfoMessageComposer, MysteryBoxKeysEvent, PetExperienceEvent, PetMountComposer, PetSupplementComposer, RemovePetSaddleComposer, RoomUnitGiveHandItemPetComposer, RoomWidgetCameraPublishedEvent, RoomWidgetCameraPurchaseComposer, SellablePetPalettesEvent, TogglePetBreedingComposer, TogglePetRidingComposer, UnseenResetCategoryComposer, UnseenResetItemsComposer, UsePetProductComposer } from './messages';
|
||||
import { AvailabilityStatusMessageEvent } from './messages/incoming/availability/AvailabilityStatusMessageEvent';
|
||||
import { CatalogClubEvent } from './messages/incoming/catalog/CatalogClubEvent';
|
||||
import { CatalogClubGiftsEvent } from './messages/incoming/catalog/CatalogClubGiftsEvent';
|
||||
@ -717,6 +717,7 @@ export class NitroMessages implements IMessageConfiguration
|
||||
|
||||
// BADGES
|
||||
this._events.set(IncomingHeader.USER_BADGES, BadgesEvent);
|
||||
this._events.set(IncomingHeader.USER_BADGES_ADD, BadgeReceivedEvent);
|
||||
|
||||
// ACCESS
|
||||
this._events.set(IncomingHeader.USER_PERKS, UserPerksEvent);
|
||||
|
@ -3,7 +3,7 @@ import { IMessageParser } from '../../../../../../core/communication/messages/IM
|
||||
|
||||
export class UserWardrobePageParser implements IMessageParser
|
||||
{
|
||||
private _looks: Map<number, string[]>;
|
||||
private _looks: Map<number, [ string, string ]>;
|
||||
|
||||
public flush(): boolean
|
||||
{
|
||||
@ -26,7 +26,7 @@ export class UserWardrobePageParser implements IMessageParser
|
||||
const look = wrapper.readString();
|
||||
const gender = wrapper.readString();
|
||||
|
||||
this._looks.set(slotId, [look, gender]);
|
||||
this._looks.set(slotId, [ look, gender ]);
|
||||
|
||||
totalLooks--;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ import { RoomUnitWalkComposer } from '../communication/messages/outgoing/room/un
|
||||
import { Nitro } from '../Nitro';
|
||||
import { MouseEventType } from '../ui/MouseEventType';
|
||||
import { RoomObjectPlacementSource } from './enums/RoomObjectPlacementSource';
|
||||
import { RoomEngineUseProductEvent } from './events';
|
||||
import { RoomEngineRoomAdEvent, RoomEngineUseProductEvent, RoomObjectRoomAdEvent } from './events';
|
||||
import { RoomEngineDimmerStateEvent } from './events/RoomEngineDimmerStateEvent';
|
||||
import { RoomEngineObjectEvent } from './events/RoomEngineObjectEvent';
|
||||
import { RoomEngineObjectPlacedEvent } from './events/RoomEngineObjectPlacedEvent';
|
||||
@ -299,6 +299,13 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
||||
case RoomObjectFloorHoleEvent.REMOVE_HOLE:
|
||||
this.onRoomObjectFloorHoleEvent(event as RoomObjectFloorHoleEvent, roomId);
|
||||
return;
|
||||
case RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK:
|
||||
case RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK:
|
||||
case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW:
|
||||
case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE:
|
||||
case RoomObjectRoomAdEvent.ROOM_AD_LOAD_IMAGE:
|
||||
this.onRoomObjectRoomAdEvent(event as RoomObjectRoomAdEvent, roomId);
|
||||
return;
|
||||
case RoomObjectBadgeAssetEvent.LOAD_BADGE:
|
||||
this.onRoomObjectBadgeAssetEvent(event as RoomObjectBadgeAssetEvent, roomId);
|
||||
return;
|
||||
@ -867,6 +874,48 @@ export class RoomObjectEventHandler extends Disposable implements IRoomCanvasMou
|
||||
}
|
||||
}
|
||||
|
||||
private onRoomObjectRoomAdEvent(event: RoomObjectRoomAdEvent, roomId: number): void
|
||||
{
|
||||
if(!event) return;
|
||||
|
||||
let eventType: string = null;
|
||||
|
||||
switch(event.type)
|
||||
{
|
||||
case RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK:
|
||||
this._roomEngine.events.dispatchEvent(event);
|
||||
|
||||
if(event.clickUrl && (event.clickUrl.length > 0))
|
||||
{
|
||||
Nitro.instance.createLinkEvent(event.clickUrl);
|
||||
}
|
||||
|
||||
eventType = RoomEngineRoomAdEvent.FURNI_CLICK;
|
||||
break;
|
||||
case RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK:
|
||||
if(event.clickUrl && (event.clickUrl.length > 0))
|
||||
{
|
||||
const catalogPage = 'CATALOG_PAGE';
|
||||
|
||||
if(event.clickUrl.indexOf(catalogPage) === 0)
|
||||
{
|
||||
Nitro.instance.createLinkEvent(event.clickUrl.substr(catalogPage.length));
|
||||
}
|
||||
}
|
||||
|
||||
eventType = RoomEngineRoomAdEvent.FURNI_DOUBLE_CLICK;
|
||||
break;
|
||||
case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW:
|
||||
eventType = RoomEngineRoomAdEvent.TOOLTIP_SHOW;
|
||||
break;
|
||||
case RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE:
|
||||
eventType = RoomEngineRoomAdEvent.TOOLTIP_HIDE;
|
||||
break;
|
||||
}
|
||||
|
||||
if(eventType) this._roomEngine.events.dispatchEvent(new RoomEngineObjectEvent(eventType, roomId, event.objectId, this._roomEngine.getRoomObjectCategoryForType(event.objectType)));
|
||||
}
|
||||
|
||||
private onRoomObjectBadgeAssetEvent(event: RoomObjectBadgeAssetEvent, roomId: number): void
|
||||
{
|
||||
if(!event || !this._roomEngine) return;
|
||||
|
9
src/nitro/room/events/RoomEngineRoomAdEvent.ts
Normal file
9
src/nitro/room/events/RoomEngineRoomAdEvent.ts
Normal file
@ -0,0 +1,9 @@
|
||||
import { RoomEngineObjectEvent } from './RoomEngineObjectEvent';
|
||||
|
||||
export class RoomEngineRoomAdEvent extends RoomEngineObjectEvent
|
||||
{
|
||||
public static FURNI_CLICK: string = 'RERAE_FURNI_CLICK';
|
||||
public static FURNI_DOUBLE_CLICK: string = 'RERAE_FURNI_DOUBLE_CLICK';
|
||||
public static TOOLTIP_SHOW: string = 'RERAE_TOOLTIP_SHOW';
|
||||
public static TOOLTIP_HIDE: string = 'RERAE_TOOLTIP_HIDE';
|
||||
}
|
31
src/nitro/room/events/RoomObjectRoomAdEvent.ts
Normal file
31
src/nitro/room/events/RoomObjectRoomAdEvent.ts
Normal file
@ -0,0 +1,31 @@
|
||||
import { IRoomObject, RoomObjectEvent } from '../../../room';
|
||||
|
||||
export class RoomObjectRoomAdEvent extends RoomObjectEvent
|
||||
{
|
||||
public static ROOM_AD_LOAD_IMAGE: string = 'RORAE_ROOM_AD_LOAD_IMAGE';
|
||||
public static ROOM_AD_FURNI_CLICK: string = 'RORAE_ROOM_AD_FURNI_CLICK';
|
||||
public static ROOM_AD_FURNI_DOUBLE_CLICK: string = 'RORAE_ROOM_AD_FURNI_DOUBLE_CLICK';
|
||||
public static ROOM_AD_TOOLTIP_SHOW: string = 'RORAE_ROOM_AD_TOOLTIP_SHOW';
|
||||
public static ROOM_AD_TOOLTIP_HIDE: string = 'RORAE_ROOM_AD_TOOLTIP_HIDE';
|
||||
|
||||
private _imageUrl: string = '';
|
||||
private _clickUrl: string = '';
|
||||
|
||||
constructor(type: string, object: IRoomObject, imageUrl: string = '', clickUrl: string = '')
|
||||
{
|
||||
super(type, object);
|
||||
|
||||
this._imageUrl = imageUrl;
|
||||
this._clickUrl = clickUrl;
|
||||
}
|
||||
|
||||
public get imageUrl(): string
|
||||
{
|
||||
return this._imageUrl;
|
||||
}
|
||||
|
||||
public get clickUrl(): string
|
||||
{
|
||||
return this._clickUrl;
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ export * from './RoomEngineEvent';
|
||||
export * from './RoomEngineObjectEvent';
|
||||
export * from './RoomEngineObjectPlacedEvent';
|
||||
export * from './RoomEngineObjectPlacedOnUserEvent';
|
||||
export * from './RoomEngineRoomAdEvent';
|
||||
export * from './RoomEngineSamplePlaybackEvent';
|
||||
export * from './RoomEngineTriggerWidgetEvent';
|
||||
export * from './RoomEngineUseProductEvent';
|
||||
@ -16,6 +17,7 @@ export * from './RoomObjectFurnitureActionEvent';
|
||||
export * from './RoomObjectHSLColorEnabledEvent';
|
||||
export * from './RoomObjectHSLColorEnableEvent';
|
||||
export * from './RoomObjectMoveEvent';
|
||||
export * from './RoomObjectRoomAdEvent';
|
||||
export * from './RoomObjectSamplePlaybackEvent';
|
||||
export * from './RoomObjectStateChangedEvent';
|
||||
export * from './RoomObjectTileMouseEvent';
|
||||
|
@ -57,6 +57,11 @@ export class FurnitureBadgeDisplayLogic extends FurnitureLogic
|
||||
{
|
||||
if(badgeId === '') return;
|
||||
|
||||
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectBadgeAssetEvent(RoomObjectBadgeAssetEvent.LOAD_BADGE, this.object, badgeId, false));
|
||||
if(this.eventDispatcher)
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS, -1);
|
||||
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectBadgeAssetEvent(RoomObjectBadgeAssetEvent.LOAD_BADGE, this.object, badgeId, false));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ import { IRoomGeometry } from '../../../../../room/utils/IRoomGeometry';
|
||||
import { IVector3D } from '../../../../../room/utils/IVector3D';
|
||||
import { Vector3d } from '../../../../../room/utils/Vector3d';
|
||||
import { MouseEventType } from '../../../../ui/MouseEventType';
|
||||
import { RoomObjectRoomAdEvent } from '../../../events';
|
||||
import { RoomObjectStateChangedEvent } from '../../../events/RoomObjectStateChangedEvent';
|
||||
import { RoomObjectWidgetRequestEvent } from '../../../events/RoomObjectWidgetRequestEvent';
|
||||
import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage';
|
||||
@ -62,7 +63,15 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
|
||||
public getEventTypes(): string[]
|
||||
{
|
||||
const types = [ RoomObjectStateChangedEvent.STATE_CHANGE, RoomObjectMouseEvent.CLICK, RoomObjectMouseEvent.MOUSE_DOWN, RoomObjectMouseEvent.MOUSE_DOWN_LONG ];
|
||||
const types = [
|
||||
RoomObjectStateChangedEvent.STATE_CHANGE,
|
||||
RoomObjectMouseEvent.CLICK,
|
||||
RoomObjectMouseEvent.MOUSE_DOWN,
|
||||
RoomObjectMouseEvent.MOUSE_DOWN_LONG,
|
||||
RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW,
|
||||
RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE,
|
||||
RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK,
|
||||
RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK ];
|
||||
|
||||
if(this.widget) types.push(RoomObjectWidgetRequestEvent.OPEN_WIDGET, RoomObjectWidgetRequestEvent.CLOSE_WIDGET);
|
||||
|
||||
@ -133,6 +142,13 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
return model.getValue<string>(RoomObjectVariable.FURNITURE_AD_URL);
|
||||
}
|
||||
|
||||
protected handleAdClick(objectId: number, objectType: string, clickUrl: string):void
|
||||
{
|
||||
if(!this.eventDispatcher) return;
|
||||
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK, this.object));
|
||||
}
|
||||
|
||||
public update(time: number): void
|
||||
{
|
||||
super.update(time);
|
||||
@ -256,6 +272,11 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
{
|
||||
if(this.eventDispatcher)
|
||||
{
|
||||
if(adUrl && (adUrl.indexOf('http') === 0))
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_SHOW, this.object));
|
||||
}
|
||||
|
||||
const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_ENTER, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
|
||||
|
||||
mouseEvent.localX = event.localX;
|
||||
@ -274,6 +295,11 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
{
|
||||
if(this.eventDispatcher)
|
||||
{
|
||||
if(adUrl && (adUrl.indexOf('http') === 0))
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE, this.object));
|
||||
}
|
||||
|
||||
const mouseEvent = new RoomObjectMouseEvent(RoomObjectMouseEvent.MOUSE_LEAVE, this.object, event.eventId, event.altKey, event.ctrlKey, event.shiftKey, event.buttonDown);
|
||||
|
||||
mouseEvent.localX = event.localX;
|
||||
@ -301,6 +327,13 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
mouseEvent.spriteOffsetY = event.spriteOffsetY;
|
||||
|
||||
this.eventDispatcher.dispatchEvent(mouseEvent);
|
||||
|
||||
if(adUrl && (adUrl.indexOf('http') === 0))
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_TOOLTIP_HIDE, this.object));
|
||||
}
|
||||
|
||||
if(adUrl && adUrl.length) this.handleAdClick(this.object.id, this.object.type, adUrl);
|
||||
}
|
||||
return;
|
||||
case MouseEventType.MOUSE_DOWN:
|
||||
@ -355,7 +388,12 @@ export class FurnitureLogic extends MovingObjectLogic
|
||||
{
|
||||
if(!this.object || !this.eventDispatcher) return;
|
||||
|
||||
const adUrl = this.getAdClickUrl(this.object.model);
|
||||
const clickUrl = this.getAdClickUrl(this.object.model);
|
||||
|
||||
if(clickUrl && clickUrl.length)
|
||||
{
|
||||
this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_DOUBLE_CLICK, this.object, null, clickUrl));
|
||||
}
|
||||
|
||||
if(this.widget) this.eventDispatcher.dispatchEvent(new RoomObjectWidgetRequestEvent(RoomObjectWidgetRequestEvent.OPEN_WIDGET, this.object));
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
import { IRoomObjectModel } from '../../../../../room/object/IRoomObjectModel';
|
||||
import { HabboWebTools } from '../../../../utils';
|
||||
import { RoomObjectRoomAdEvent } from '../../../events';
|
||||
import { RoomObjectVariable } from '../../RoomObjectVariable';
|
||||
import { FurnitureRoomBrandingLogic } from './FurnitureRoomBrandingLogic';
|
||||
|
||||
@ -15,4 +17,16 @@ export class FurnitureRoomBillboardLogic extends FurnitureRoomBrandingLogic
|
||||
{
|
||||
return model.getValue<string>(RoomObjectVariable.FURNITURE_BRANDING_URL);
|
||||
}
|
||||
}
|
||||
|
||||
protected handleAdClick(objectId: number, objectType: string, clickUrl: string):void
|
||||
{
|
||||
if(clickUrl.indexOf('http') === 0)
|
||||
{
|
||||
HabboWebTools.openWebPage(clickUrl);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(this.eventDispatcher) this.eventDispatcher.dispatchEvent(new RoomObjectRoomAdEvent(RoomObjectRoomAdEvent.ROOM_AD_FURNI_CLICK, this.object, '', clickUrl));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,10 @@
|
||||
import { IAssetData } from '../../../../../core';
|
||||
import { IRoomGeometry, RoomSpriteMouseEvent } from '../../../../../room';
|
||||
import { RoomObjectUpdateMessage } from '../../../../../room/messages/RoomObjectUpdateMessage';
|
||||
import { Nitro } from '../../../../Nitro';
|
||||
import { MouseEventType } from '../../../../ui';
|
||||
import { RoomWidgetEnumItemExtradataParameter } from '../../../../ui/widget/enums/RoomWidgetEnumItemExtradataParameter';
|
||||
import { RoomObjectRoomAdEvent } from '../../../events';
|
||||
import { ObjectAdUpdateMessage } from '../../../messages/ObjectAdUpdateMessage';
|
||||
import { ObjectDataUpdateMessage } from '../../../messages/ObjectDataUpdateMessage';
|
||||
import { MapDataType } from '../../data/type/MapDataType';
|
||||
@ -16,15 +20,34 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
public static OFFSETY_KEY: string = 'offsetY';
|
||||
public static OFFSETZ_KEY: string = 'offsetZ';
|
||||
|
||||
protected _disableFurnitureSelection: boolean;
|
||||
protected _hasClickUrl: boolean;
|
||||
|
||||
constructor()
|
||||
{
|
||||
super();
|
||||
|
||||
this._disableFurnitureSelection = true;
|
||||
this._hasClickUrl = false;
|
||||
}
|
||||
|
||||
public getEventTypes(): string[]
|
||||
{
|
||||
const types = [ RoomObjectRoomAdEvent.ROOM_AD_LOAD_IMAGE ];
|
||||
|
||||
return this.mergeTypes(super.getEventTypes(), types);
|
||||
}
|
||||
|
||||
public initialize(asset: IAssetData): void
|
||||
{
|
||||
super.initialize(asset);
|
||||
|
||||
if(this._disableFurnitureSelection)
|
||||
{
|
||||
this.object.model.setValue(RoomObjectVariable.FURNITURE_SELECTION_DISABLED, 1);
|
||||
}
|
||||
}
|
||||
|
||||
public processUpdateMessage(message: RoomObjectUpdateMessage): void
|
||||
{
|
||||
super.processUpdateMessage(message);
|
||||
@ -106,6 +129,15 @@ export class FurnitureRoomBrandingLogic extends FurnitureLogic
|
||||
}
|
||||
}
|
||||
|
||||
public mouseEvent(event: RoomSpriteMouseEvent, geometry: IRoomGeometry): void
|
||||
{
|
||||
if(!event || !geometry) return;
|
||||
|
||||
if((event.type === MouseEventType.MOUSE_MOVE) || (event.type === MouseEventType.DOUBLE_CLICK)) return;
|
||||
|
||||
super.mouseEvent(event, geometry);
|
||||
}
|
||||
|
||||
private downloadBackground(): void
|
||||
{
|
||||
const model = this.object && this.object.model;
|
||||
|
@ -22,22 +22,25 @@ export class FurnitureBadgeDisplayVisualization extends FurnitureAnimatedVisuali
|
||||
{
|
||||
let updateModel = super.updateModel(scale);
|
||||
|
||||
if(!isNaN(this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS)))
|
||||
const badgeStatus = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS);
|
||||
|
||||
if(badgeStatus === -1)
|
||||
{
|
||||
const status = (this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS) !== 0);
|
||||
this._badgeAssetNameNormalScale = '';
|
||||
this._badgeAssetNameSmallScale = '';
|
||||
}
|
||||
|
||||
if(status && this._badgeAssetNameNormalScale === '')
|
||||
{
|
||||
this._badgeAssetNameNormalScale = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_BADGE_ASSET_NAME);
|
||||
else if(badgeStatus === 1 && (this._badgeAssetNameNormalScale === ''))
|
||||
{
|
||||
this._badgeAssetNameNormalScale = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_BADGE_ASSET_NAME);
|
||||
|
||||
if(this._badgeAssetNameSmallScale === '') this._badgeAssetNameSmallScale = this._badgeAssetNameNormalScale + '_32';
|
||||
if(this._badgeAssetNameSmallScale === '') this._badgeAssetNameSmallScale = this._badgeAssetNameNormalScale + '_32';
|
||||
|
||||
const visibleInState = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_BADGE_VISIBLE_IN_STATE);
|
||||
const visibleInState = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_BADGE_VISIBLE_IN_STATE);
|
||||
|
||||
if(!isNaN) this._badgeVisibleInState = visibleInState;
|
||||
if(!isNaN(visibleInState)) this._badgeVisibleInState = visibleInState;
|
||||
|
||||
updateModel = true;
|
||||
}
|
||||
updateModel = true;
|
||||
}
|
||||
|
||||
return updateModel;
|
||||
|
@ -6,6 +6,10 @@ import { FurnitureVisualization } from './FurnitureVisualization';
|
||||
export class FurnitureBrandedImageVisualization extends FurnitureVisualization
|
||||
{
|
||||
private static BRANDED_IMAGE: string = 'branded_image';
|
||||
private static STATE_0: number = 0;
|
||||
private static STATE_1: number = 1;
|
||||
private static STATE_2: number = 2;
|
||||
private static STATE_3: number = 3;
|
||||
|
||||
protected _imageUrl: string;
|
||||
protected _shortUrl: string;
|
||||
@ -139,7 +143,42 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization
|
||||
|
||||
if(!texture) return;
|
||||
|
||||
this.asset.addAsset(this._imageUrl, texture, true, 0, 0, false, false);
|
||||
const state = this.object.getState(0);
|
||||
|
||||
let x = 0;
|
||||
let y = 0;
|
||||
let flipH = false;
|
||||
let flipV = false;
|
||||
|
||||
switch(state)
|
||||
{
|
||||
case FurnitureBrandedImageVisualization.STATE_0:
|
||||
x = 0;
|
||||
y = 0;
|
||||
flipH = false;
|
||||
flipV = false;
|
||||
break;
|
||||
case FurnitureBrandedImageVisualization.STATE_1:
|
||||
x = -(texture.width);
|
||||
y = 0;
|
||||
flipH = true;
|
||||
flipV = false;
|
||||
break;
|
||||
case FurnitureBrandedImageVisualization.STATE_2:
|
||||
x = -(texture.width);
|
||||
y = -(texture.height);
|
||||
flipH = true;
|
||||
flipV = true;
|
||||
break;
|
||||
case FurnitureBrandedImageVisualization.STATE_3:
|
||||
x = 0;
|
||||
y = -(texture.height);
|
||||
flipH = false;
|
||||
flipV = true;
|
||||
break;
|
||||
}
|
||||
|
||||
this.asset.addAsset(this._imageUrl, texture, true, x, y, flipH, flipV);
|
||||
}
|
||||
|
||||
protected getSpriteAssetName(scale: number, layerId: number): string
|
||||
@ -150,13 +189,4 @@ export class FurnitureBrandedImageVisualization extends FurnitureVisualization
|
||||
|
||||
return super.getSpriteAssetName(scale, layerId);
|
||||
}
|
||||
|
||||
protected getLayerIgnoreMouse(scale: number, direction: number, layerId: number): boolean
|
||||
{
|
||||
const tag = this.getLayerTag(scale, direction, layerId);
|
||||
|
||||
if(tag !== FurnitureBrandedImageVisualization.BRANDED_IMAGE) return super.getLayerIgnoreMouse(scale, direction, layerId);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -387,6 +387,11 @@ export class RoomPreviewer
|
||||
if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectUserAction(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, action, value, parameter);
|
||||
}
|
||||
|
||||
public updateObjectStuffData(stuffData: IObjectData): void
|
||||
{
|
||||
if(this.isRoomEngineReady) this._roomEngine.updateRoomObjectFloor(this._previewRoomId, RoomPreviewer.PREVIEW_OBJECT_ID, null, null, stuffData.state, stuffData);
|
||||
}
|
||||
|
||||
public changeRoomObjectState(): void
|
||||
{
|
||||
if(this.isRoomEngineReady)
|
||||
|
@ -26,7 +26,7 @@ export class BadgeImageManager
|
||||
this._assets = null;
|
||||
}
|
||||
|
||||
public getBadgeImage(badgeName: string, type: string = 'normal_badge', load: boolean = true): Texture<Resource>
|
||||
public getBadgeImage(badgeName: string, type: string = BadgeImageManager.NORMAL_BADGE, load: boolean = true): Texture<Resource>
|
||||
{
|
||||
let badge = this.getBadgeTexture(badgeName, type);
|
||||
|
||||
@ -42,25 +42,25 @@ export class BadgeImageManager
|
||||
return (badge) ? new BadgeInfo(badge, false) : new BadgeInfo(this.getBadgePlaceholder(), true);
|
||||
}
|
||||
|
||||
public loadBadgeImage(badgeName: string, type: string = 'normal_badge'): string
|
||||
public loadBadgeImage(badgeName: string, type: string = BadgeImageManager.NORMAL_BADGE): string
|
||||
{
|
||||
if(this._assets.getTexture(badgeName)) return badgeName;
|
||||
if(this._assets.getTexture(this.getBadgeUrl(badgeName, type))) return badgeName;
|
||||
|
||||
this.getBadgeTexture(badgeName, type);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private getBadgeTexture(badgeName: string, type: string = 'normal_badge'): Texture<Resource>
|
||||
private getBadgeTexture(badgeName: string, type: string = BadgeImageManager.NORMAL_BADGE): Texture<Resource>
|
||||
{
|
||||
const existing = this._assets.getTexture(badgeName);
|
||||
const url = this.getBadgeUrl(badgeName, type);
|
||||
|
||||
const existing = this._assets.getTexture(url);
|
||||
|
||||
if(existing) return existing.clone();
|
||||
|
||||
if(this._requestedBadges.get(badgeName)) return null;
|
||||
|
||||
const url = this.getBadgeUrl(badgeName, type);
|
||||
|
||||
if(url)
|
||||
{
|
||||
this._requestedBadges.set(badgeName, true);
|
||||
@ -69,7 +69,7 @@ export class BadgeImageManager
|
||||
{
|
||||
if(flag)
|
||||
{
|
||||
const texture = this._assets.getTexture(badgeName);
|
||||
const texture = this._assets.getTexture(url);
|
||||
|
||||
if(texture && this._events) this._events.dispatchEvent(new BadgeImageReadyEvent(badgeName, texture.clone()));
|
||||
}
|
||||
@ -81,14 +81,15 @@ export class BadgeImageManager
|
||||
|
||||
private getBadgePlaceholder(): Texture<Resource>
|
||||
{
|
||||
const existing = this._assets.getTexture('loading_icon');
|
||||
const url = (Nitro.instance.getConfiguration<string>('images.url') + '/loading_icon.png');
|
||||
const existing = this._assets.getTexture(url);
|
||||
|
||||
if(!existing) return null;
|
||||
|
||||
return existing.clone();
|
||||
}
|
||||
|
||||
public getBadgeUrl(badge: string, type: string = 'normal_badge'): string
|
||||
public getBadgeUrl(badge: string, type: string = BadgeImageManager.NORMAL_BADGE): string
|
||||
{
|
||||
let url = null;
|
||||
|
||||
|
@ -43,6 +43,11 @@ export class HabboWebTools
|
||||
}
|
||||
}
|
||||
|
||||
public static openWebPage(pageUrl: string): void
|
||||
{
|
||||
window.open(pageUrl);
|
||||
}
|
||||
|
||||
public static sendHeartBeat(): void
|
||||
{
|
||||
try
|
||||
@ -330,4 +335,4 @@ export class HabboWebTools
|
||||
NitroLogger.log('External interface not working. Could not update figure.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user