mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
fix ts errors
This commit is contained in:
@@ -6,11 +6,8 @@ const { ccclass, property } = _decorator;
|
||||
|
||||
@ccclass('cc.RenderableComponent')
|
||||
export default class RenderableComponent extends Component {
|
||||
/**
|
||||
* @type {Material[]}
|
||||
*/
|
||||
@property([Material])
|
||||
public _materials = [];
|
||||
private _materials: Material[] = [];
|
||||
|
||||
constructor () {
|
||||
super();
|
||||
@@ -39,7 +36,7 @@ export default class RenderableComponent extends Component {
|
||||
*/
|
||||
get materials () {
|
||||
for (let i = 0; i < this._materials.length; i++) {
|
||||
this._materials[i] = this.getMaterial(i);
|
||||
this._materials[i] = this.getMaterial(i)!;
|
||||
}
|
||||
return this._materials;
|
||||
}
|
||||
@@ -86,10 +83,6 @@ export default class RenderableComponent extends Component {
|
||||
return this.getMaterial(0);
|
||||
}
|
||||
|
||||
get sharedMaterial () {
|
||||
return this.getSharedMaterial(0);
|
||||
}
|
||||
|
||||
set material (val) {
|
||||
if (this._materials.length === 1 && this._materials[0] === val) {
|
||||
return;
|
||||
@@ -97,6 +90,10 @@ export default class RenderableComponent extends Component {
|
||||
this.setMaterial(val, 0);
|
||||
}
|
||||
|
||||
get sharedMaterial () {
|
||||
return this.getSharedMaterial(0);
|
||||
}
|
||||
|
||||
public setMaterial (material, index) {
|
||||
this._materials[index] = material;
|
||||
this._onMaterialModified(index, material);
|
||||
|
||||
Reference in New Issue
Block a user