2019-02-26 15:59:50 +08:00

32 lines
618 B
JavaScript

cc.Class({
extends: cc.Component,
properties: {
box: {
default: null,
type: cc.Sprite
},
type: 'wood',
status: 'c'
},
// LIFE-CYCLE CALLBACKS:
onLoad () {
this.updateShow('c');
},
start () {
},
// update (dt) {},
updateShow(status) {
this.status = status;
let url = `textures/part1/bar_cube_${this.type}_${this.status}`;
let self = this;
cc.loader.loadRes(url, cc.SpriteFrame, function (err, spriteFrame) {
self.box.spriteFrame = spriteFrame;
});
}
});