This commit is contained in:
yushijinhun 2020-03-26 16:57:35 +08:00
parent 26c3f3d382
commit ed22ce6953
No known key found for this signature in database
GPG Key ID: 5BC167F73EA558E4
1 changed files with 22 additions and 8 deletions

View File

@ -34,6 +34,8 @@ export class SkinViewer {
private _disposed: boolean = false;
private _renderPaused: boolean = false;
private _skinSet: boolean = false;
private _capeSet: boolean = false;
constructor(options: SkinViewerOptions) {
this.domElement = options.domElement;
@ -149,20 +151,32 @@ export class SkinViewer {
}
}
get skinUrl(): string {
return this.skinImg.src;
get skinUrl(): string | null {
return this._skinSet ? this.skinImg.src : null;
}
set skinUrl(url: string) {
this.skinImg.src = url;
set skinUrl(url: string | null) {
if (url === null) {
this._skinSet = false;
this.playerObject.skin.visible = false;
} else {
this._skinSet = true;
this.skinImg.src = url;
}
}
get capeUrl(): string {
return this.capeImg.src;
get capeUrl(): string | null {
return this._capeSet ? this.capeImg.src : null;
}
set capeUrl(url: string) {
this.capeImg.src = url;
set capeUrl(url: string | null) {
if (url === null) {
this._capeSet = false;
this.playerObject.cape.visible = false;
} else {
this._capeSet = true;
this.capeImg.src = url;
}
}
get width(): number {