Merge branch 'dev' into 'dev'

Fix group badge disconnects in v2

See merge request nitro/nitro-renderer!12
This commit is contained in:
Bill 2022-03-16 21:21:53 +00:00
commit d3e7356b4b

View File

@ -1,4 +1,4 @@
import { Resource, Texture } from '@pixi/core'; import { Resource, Texture } from '@pixi/core';
import { NitroContainer, NitroTexture } from '../../..'; import { NitroContainer, NitroTexture } from '../../..';
import { IAssetManager } from '../../../core/asset/IAssetManager'; import { IAssetManager } from '../../../core/asset/IAssetManager';
import { IMessageEvent } from '../../../core/communication/messages/IMessageEvent'; import { IMessageEvent } from '../../../core/communication/messages/IMessageEvent';
@ -202,24 +202,27 @@ export class BadgeImageManager implements IDisposable
const partNames = ((part.type === 'b') ? this._groupBases.get(part.key) : this._groupSymbols.get(part.key)); const partNames = ((part.type === 'b') ? this._groupBases.get(part.key) : this._groupSymbols.get(part.key));
for(const partName of partNames) if(partNames)
{ {
if(!partName || !partName.length) continue; for(const partName of partNames)
{
const texture = this._assets.getTexture(`badgepart_${ partName }`); if(!partName || !partName.length) continue;
if(!texture) continue; const texture = this._assets.getTexture(`badgepart_${ partName }`);
const { x, y } = part.calculatePosition(texture); if(!texture) continue;
const sprite = new NitroSprite(texture);
const { x, y } = part.calculatePosition(texture);
sprite.position.set(x, y); const sprite = new NitroSprite(texture);
if(isFirst) sprite.tint = parseInt(this._groupPartColors.get(part.color), 16); sprite.position.set(x, y);
isFirst = false; if(isFirst) sprite.tint = parseInt(this._groupPartColors.get(part.color), 16);
container.addChild(sprite); isFirst = false;
container.addChild(sprite);
}
} }
} }