mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 14:40:50 +01:00
Fix avatar editor failing to load some parts
This commit is contained in:
parent
a4af61392e
commit
4025f41ddf
@ -1,10 +1,10 @@
|
|||||||
import { AvatarEditorFigureCategory, AvatarScaleType, AvatarSetType, IAvatarImageListener } from '@nitrots/nitro-renderer';
|
import { AvatarEditorFigureCategory, AvatarScaleType, AvatarSetType } from '@nitrots/nitro-renderer';
|
||||||
import { GetAvatarRenderManager } from '../../../api';
|
import { GetAvatarRenderManager } from '../../../api';
|
||||||
import { AvatarEditorUtilities } from './AvatarEditorUtilities';
|
import { AvatarEditorUtilities } from './AvatarEditorUtilities';
|
||||||
import { CategoryBaseModel } from './CategoryBaseModel';
|
import { CategoryBaseModel } from './CategoryBaseModel';
|
||||||
import { FigureData } from './FigureData';
|
import { FigureData } from './FigureData';
|
||||||
|
|
||||||
export class BodyModel extends CategoryBaseModel implements IAvatarImageListener
|
export class BodyModel extends CategoryBaseModel
|
||||||
{
|
{
|
||||||
private _imageCallBackHandled: boolean = false;
|
private _imageCallBackHandled: boolean = false;
|
||||||
|
|
||||||
@ -43,8 +43,10 @@ export class BodyModel extends CategoryBaseModel implements IAvatarImageListener
|
|||||||
|
|
||||||
for(const part of category.parts)
|
for(const part of category.parts)
|
||||||
{
|
{
|
||||||
const figure = AvatarEditorUtilities.CURRENT_FIGURE.getFigureStringWithFace(part.id);
|
const resetFigure = (figure: string) =>
|
||||||
const avatarImage = GetAvatarRenderManager().createAvatarImage(figure, AvatarScaleType.LARGE, null, this);
|
{
|
||||||
|
const figureString = AvatarEditorUtilities.CURRENT_FIGURE.getFigureStringWithFace(part.id);
|
||||||
|
const avatarImage = GetAvatarRenderManager().createAvatarImage(figureString, AvatarScaleType.LARGE, null, { resetFigure, dispose: null, disposed: false });
|
||||||
|
|
||||||
const sprite = avatarImage.getImageAsSprite(AvatarSetType.HEAD);
|
const sprite = avatarImage.getImageAsSprite(AvatarSetType.HEAD);
|
||||||
|
|
||||||
@ -58,16 +60,8 @@ export class BodyModel extends CategoryBaseModel implements IAvatarImageListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (this._Str_2271) this._Str_2271._Str_5614(k, _local_4.length);
|
resetFigure(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public resetFigure(figure: string): void
|
|
||||||
{
|
|
||||||
if(this._imageCallBackHandled) return;
|
|
||||||
|
|
||||||
this._imageCallBackHandled = true;
|
|
||||||
|
|
||||||
this.updateSelectionsFromFigure(FigureData.FACE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public get canSetGender(): boolean
|
public get canSetGender(): boolean
|
||||||
|
@ -26,7 +26,7 @@ export const AvatarEditorFigureSetItemView: FC<AvatarEditorFigureSetItemViewProp
|
|||||||
{
|
{
|
||||||
partItem.notify = null;
|
partItem.notify = null;
|
||||||
}
|
}
|
||||||
})
|
}, [ partItem, rerender ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LayoutGridItem itemImage={ (partItem.isClear ? undefined : partItem.imageUrl) } itemActive={ partItem.isSelected } { ...rest }>
|
<LayoutGridItem itemImage={ (partItem.isClear ? undefined : partItem.imageUrl) } itemActive={ partItem.isSelected } { ...rest }>
|
||||||
|
Loading…
Reference in New Issue
Block a user