Fix busted badge displays

This commit is contained in:
Bill 2021-07-25 03:40:03 -04:00
parent 5d4aeec1ab
commit 37f5bf6a10
3 changed files with 10 additions and 6 deletions

View File

@ -316,13 +316,13 @@ export class RoomContentLoader implements IFurnitureDataListener
return image;
}
public addAssetToCollection(collectionName: string, assetName: string, texture: Texture<Resource>): boolean
public addAssetToCollection(collectionName: string, assetName: string, texture: Texture<Resource>, override: boolean = true): boolean
{
const collection = this.getCollection(collectionName);
if(!collection) return false;
return collection.addAsset(assetName, texture, true, 0, 0, false, false);
return collection.addAsset(assetName, texture, override, 0, 0, false, false);
}
private createCollection(data: IAssetData, spritesheet: Spritesheet): GraphicAssetCollection

View File

@ -2438,7 +2438,7 @@ export class RoomEngine extends NitroManager implements IRoomEngine, IRoomCreato
const badgeName = (groupBadge) ? this._sessionDataManager.loadGroupBadgeImage(badgeId) : this._sessionDataManager.loadBadgeImage(badgeId);
const badgeImage = (groupBadge) ? this._sessionDataManager.getGroupBadgeImage(badgeId) : this._sessionDataManager.getBadgeImage(badgeId);
if(badgeImage) this._roomContentLoader.addAssetToCollection(object.type, badgeName, badgeImage);
if(badgeImage) this._roomContentLoader.addAssetToCollection(object.type, badgeName, badgeImage, false);
}
public dispatchMouseEvent(canvasId: number, x: number, y: number, type: string, altKey: boolean, ctrlKey: boolean, shiftKey: boolean, buttonDown: boolean): void

View File

@ -5,6 +5,7 @@ export class FurnitureBadgeDisplayVisualization extends FurnitureAnimatedVisuali
{
private static BADGE: string = 'BADGE';
private _badgeId: string;
private _badgeAssetNameNormalScale: string;
private _badgeAssetNameSmallScale: string;
private _badgeVisibleInState: number;
@ -13,6 +14,7 @@ export class FurnitureBadgeDisplayVisualization extends FurnitureAnimatedVisuali
{
super();
this._badgeId = '';
this._badgeAssetNameNormalScale = '';
this._badgeAssetNameSmallScale = '';
this._badgeVisibleInState = -1;
@ -22,7 +24,8 @@ export class FurnitureBadgeDisplayVisualization extends FurnitureAnimatedVisuali
{
let updateModel = super.updateModel(scale);
const badgeStatus = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS);
const badgeStatus = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_BADGE_IMAGE_STATUS);
const badgeId = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_BADGE_ASSET_NAME);
if(badgeStatus === -1)
{
@ -30,9 +33,10 @@ export class FurnitureBadgeDisplayVisualization extends FurnitureAnimatedVisuali
this._badgeAssetNameSmallScale = '';
}
else if(badgeStatus === 1 && (this._badgeAssetNameNormalScale === ''))
else if((badgeStatus === 1) && (badgeId !== this._badgeId))
{
this._badgeAssetNameNormalScale = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_BADGE_ASSET_NAME);
this._badgeId = badgeId;
this._badgeAssetNameNormalScale = this._badgeId;
if(this._badgeAssetNameSmallScale === '') this._badgeAssetNameSmallScale = this._badgeAssetNameNormalScale + '_32';