12345678910111213141516171819202122232425262728293031323334353637 |
- cc.Class({
- extends: cc.Component,
- properties: {
- label: cc.Label,
- },
- onLoad() {
- this.node.on(cc.Node.EventType.TOUCH_END, () => {
- // this.close();
- });
- },
- show(message) {
- this.label.string = message;
- this.node.active = true;
- this.node.y = - this.node.height;
- let anim = cc.spawn(cc.moveBy(0.3, 0, this.node.height), cc.fadeOut(0.3));
- this.node.runAction(anim);
- this.timer = setInterval(() => {
- this.close();
- }, 1000);
- },
- // update (dt) {},
- close() {
- clearInterval(this.timer);
- let anim = cc.spawn(cc.moveBy(0.3, 0, this.node.height), cc.fadeOut(0.3));
- let end = cc.callFunc(() => {
- this.node.active = false;
- });
- this.node.runAction(cc.sequence(anim, end));
- },
- });
|