mirror of
https://github.com/billsonnn/nitro-renderer.git
synced 2025-01-31 03:12:35 +01:00
Fix GuildIsometricBadgeVisualization
This commit is contained in:
parent
de0e1aecc6
commit
7d75fdd1b3
@ -1,8 +1,8 @@
|
||||
import { SCALE_MODES } from '@pixi/constants';
|
||||
import { Texture } from '@pixi/core';
|
||||
import { FurnitureThumbnailVisualization } from './FurnitureThumbnailVisualization';
|
||||
import { IsometricImageFurniVisualization } from './IsometricImageFurniVisualization';
|
||||
|
||||
export class FurnitureDynamicThumbnailVisualization extends FurnitureThumbnailVisualization
|
||||
export class FurnitureDynamicThumbnailVisualization extends IsometricImageFurniVisualization
|
||||
{
|
||||
private _cachedUrl: string;
|
||||
|
||||
|
@ -40,8 +40,13 @@ export class FurnitureGuildCustomizedVisualization extends FurnitureAnimatedVisu
|
||||
}
|
||||
}
|
||||
|
||||
this._color1 = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_1);
|
||||
this._color2 = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_2);
|
||||
const color1 = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_1);
|
||||
|
||||
this._color1 = color1 ? color1: FurnitureGuildCustomizedVisualization.DEFAULT_COLOR_1;
|
||||
|
||||
const color2 = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_2);
|
||||
|
||||
this._color2 = color2 ? color2: FurnitureGuildCustomizedVisualization.DEFAULT_COLOR_2;
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
@ -1,6 +1,71 @@
|
||||
import { FurnitureThumbnailVisualization } from './FurnitureThumbnailVisualization';
|
||||
import { IGraphicAsset, IRoomObjectSprite } from '../../../../../room';
|
||||
import { RoomObjectVariable } from '../../RoomObjectVariable';
|
||||
import { IsometricImageFurniVisualization } from './IsometricImageFurniVisualization';
|
||||
|
||||
export class FurnitureGuildIsometricBadgeVisualization extends FurnitureThumbnailVisualization
|
||||
export class FurnitureGuildIsometricBadgeVisualization extends IsometricImageFurniVisualization
|
||||
{
|
||||
public static PRIMARY_COLOUR_SPRITE_TAG: string = 'COLOR1';
|
||||
public static SECONDARY_COLOUR_SPRITE_TAG: string = 'COLOR2';
|
||||
public static DEFAULT_COLOR_1: number = 0xEEEEEE;
|
||||
public static DEFAULT_COLOR_2: number = 0x4B4B4B;
|
||||
|
||||
}
|
||||
private _color1: number;
|
||||
private _color2: number;
|
||||
|
||||
protected updateModel(scale: number): boolean
|
||||
{
|
||||
const flag = super.updateModel(scale);
|
||||
|
||||
if(!this.hasThumbnailImage)
|
||||
{
|
||||
const assetName = this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME);
|
||||
|
||||
if(assetName && assetName.length) this.setThumbnailImages(this.getBitmapAsset(assetName));
|
||||
}
|
||||
|
||||
const color1 = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_1);
|
||||
|
||||
this._color1 = color1 ? color1: FurnitureGuildIsometricBadgeVisualization.DEFAULT_COLOR_1;
|
||||
|
||||
const color2 = this.object.model.getValue<number>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_COLOR_2);
|
||||
|
||||
this._color2 = color2 ? color2: FurnitureGuildIsometricBadgeVisualization.DEFAULT_COLOR_2;
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
protected getLayerColor(scale: number, layerId: number, colorId: number): number
|
||||
{
|
||||
const tag = this.getLayerTag(scale, this._direction, layerId);
|
||||
|
||||
switch(tag)
|
||||
{
|
||||
case FurnitureGuildIsometricBadgeVisualization.PRIMARY_COLOUR_SPRITE_TAG: return this._color1;
|
||||
case FurnitureGuildIsometricBadgeVisualization.SECONDARY_COLOUR_SPRITE_TAG: return this._color2;
|
||||
}
|
||||
|
||||
return super.getLayerColor(scale, layerId, colorId);
|
||||
}
|
||||
|
||||
protected getLibraryAssetNameForSprite(asset: IGraphicAsset, sprite: IRoomObjectSprite): string
|
||||
{
|
||||
if(sprite.tag === FurnitureGuildIsometricBadgeVisualization.THUMBNAIL)
|
||||
{
|
||||
if(this.object && this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME))
|
||||
{
|
||||
return '%group.badge.url%' + this.object.model.getValue<string>(RoomObjectVariable.FURNITURE_GUILD_CUSTOMIZED_ASSET_NAME);
|
||||
}
|
||||
}
|
||||
|
||||
return super.getLibraryAssetNameForSprite(asset, sprite);
|
||||
}
|
||||
|
||||
private getBitmapAsset(name: string)
|
||||
{
|
||||
const asset = this.asset.getAsset(name);
|
||||
|
||||
if(!asset || !asset.texture) return null;
|
||||
|
||||
return asset.texture;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import { IGraphicAsset } from '../../../../../room/object/visualization/utils/IG
|
||||
import { TextureUtils } from '../../../../../room/utils/TextureUtils';
|
||||
import { FurnitureAnimatedVisualization } from './FurnitureAnimatedVisualization';
|
||||
|
||||
export class FurnitureThumbnailVisualization extends FurnitureAnimatedVisualization
|
||||
export class IsometricImageFurniVisualization extends FurnitureAnimatedVisualization
|
||||
{
|
||||
protected static THUMBNAIL: string = 'THUMBNAIL';
|
||||
|
||||
@ -71,7 +71,7 @@ export class FurnitureThumbnailVisualization extends FurnitureAnimatedVisualizat
|
||||
|
||||
while(layerId < this.totalSprites)
|
||||
{
|
||||
if(this.getLayerTag(scale, this.direction, layerId) === FurnitureThumbnailVisualization.THUMBNAIL)
|
||||
if(this.getLayerTag(scale, this.direction, layerId) === IsometricImageFurniVisualization.THUMBNAIL)
|
||||
{
|
||||
const assetName = (this.cacheSpriteAssetName(scale, layerId, false) + this.getFrameNumber(scale, layerId));
|
||||
const asset = this.getAsset(assetName, layerId);
|
||||
@ -140,7 +140,7 @@ export class FurnitureThumbnailVisualization extends FurnitureAnimatedVisualizat
|
||||
|
||||
protected getSpriteAssetName(scale: number, layerId: number): string
|
||||
{
|
||||
if(this._thumbnailImageNormal && (this.getLayerTag(scale, this.direction, layerId) === FurnitureThumbnailVisualization.THUMBNAIL)) return this.getThumbnailAssetName(scale);
|
||||
if(this._thumbnailImageNormal && (this.getLayerTag(scale, this.direction, layerId) === IsometricImageFurniVisualization.THUMBNAIL)) return this.getThumbnailAssetName(scale);
|
||||
|
||||
return super.getSpriteAssetName(scale, layerId);
|
||||
}
|
@ -29,7 +29,6 @@ export * from './FurnitureRoomBackgroundVisualization';
|
||||
export * from './FurnitureScoreBoardVisualization';
|
||||
export * from './FurnitureSoundBlockVisualization';
|
||||
export * from './FurnitureStickieVisualization';
|
||||
export * from './FurnitureThumbnailVisualization';
|
||||
export * from './FurnitureValRandomizerVisualization';
|
||||
export * from './FurnitureVisualization';
|
||||
export * from './FurnitureVisualizationData';
|
||||
@ -37,3 +36,4 @@ export * from './FurnitureVoteCounterVisualization';
|
||||
export * from './FurnitureVoteMajorityVisualization';
|
||||
export * from './FurnitureWaterAreaVisualization';
|
||||
export * from './FurnitureYoutubeVisualization';
|
||||
export * from './IsometricImageFurniVisualization';
|
||||
|
Loading…
x
Reference in New Issue
Block a user