123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- import { _decorator, Component, Label, Node, tween, Vec3 } from 'cc';
- import { Clips } from './Enums';
- import { AudioMgr } from './AudioMgr';
- import { Global } from './Global';
- const { ccclass, property } = _decorator;
- @ccclass('TipsAction')
- export class TipsAction extends Component {
- @property({type:Label})
- level_label:Label = null;
- msg:string[] = [];
- running = false;
- start() {
- this.set_default();
- }
- set_default(){
- this.node.setPosition(0,-1000)
- }
- update(deltaTime: number) {
-
- }
- public show(str:string){
- this.msg.push(str);
- // console.log("TipsAction>>>",str,this.level_label);
- if(!this.running){
- this.play();
- }
- }
- private play(){
- let self = this;
- if(self.msg.length == 0){
- self.running = false;
- return;
- }
- self.running = true;
- self.level_label.string = self.msg.shift();
- self.set_default();
- tween(self.node)
- .to(0.35,{position:new Vec3(0,0,0)},Global.our_easing)
- .delay(1)
- .to(0.1,{position:new Vec3(0,1000,0)},Global.our_easing)
- .call(()=>{
- AudioMgr.ins.playSound(Clips.reng);
- // this.set_default();
- self.play();
- })
- .start();
- }
- }
|