WaterControl/assets/Script/Window.ts
2024-08-02 17:23:01 +08:00

46 lines
1.2 KiB
TypeScript

// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
const {ccclass, property} = cc._decorator;
@ccclass
export default class NewClass extends cc.Component {
// LIFE-CYCLE CALLBACKS:
// onLoad () {}
start () {
}
init(data){
this.node.getChildByName("win").active = false;
this.node.getChildByName("lose").active = false;
this.node.getChildByName("finishi").active = false;
this.node.getChildByName(data).active = true;
var target = this.node.getChildByName(data);
target.opacity = 0; target.scale = 2;
cc.tween(target)
.delay(0.2)
.to(0.4,{opacity:255,scale:1})
.delay(1.3)
.call(()=>{
cc.tween(this.node)
.to(0.3,{opacity:0})
.call(() =>{
this.node.active = false;
cc.director.loadScene("GameScene");
})
.start();
})
.start();
}
// update (dt) {}
}