Spring774
2025-10-28 c612f86f2f11b6fe9506f5c4e6fb491c975dbffc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
const {ccclass, property} = cc._decorator;
 
@ccclass
export class TipPanel extends cc.Component {
 
    @property(cc.Label)
    label: cc.Label = null;
 
    showLabel(str: string, delayTime = 0.6){
        this.label.string = str;
        this.node.zIndex = 10000;
 
        this.node.active = true;
 
        this.node.scale = 0.25;
        this.node.opacity = 0;
        this.node.runAction(
            cc.sequence(
                cc.fadeIn(0.01),
                cc.scaleTo(0.5, 1).easing(cc.easeElasticOut(0.5)),
                cc.delayTime(delayTime),
                cc.spawn(
                    cc.moveBy(0.5, cc.v2(0, 100)),
                    cc.fadeOut(0.5)
                ),
                cc.callFunc(this.hide, this)
            )
        );
    }
 
    hide(){
        this.node.removeFromParent();
        this.node.destroy();
    }
}