Spring774
2025-10-27 a621979f62588ed1a899d17c937dc3aee8670ec1
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
37
38
39
40
41
42
43
import EffectManager from "./EffectManager";
 
const {ccclass, property} = cc._decorator;
 
@ccclass
export default class ScoreNum extends cc.Component {
 
    label: cc.Label = null;
    manager: EffectManager;
 
    onLoad(){
        this.label = this.getComponent(cc.Label);
    }
 
    show(num:number, pos: cc.Vec2){
        this.label.string = num.toString();
        this.node.scale = 0.01;
        this.node.position = pos;
        //this.node.opacity = 50;
        this.node.runAction(
            cc.sequence(
                cc.scaleTo(0.4, 2).easing(cc.easeBackOut()),
                cc.moveBy(0.4, cc.v2(0, 35)),
                cc.fadeOut(0.1),
                cc.callFunc(this.hide, this)
            )
        );
    }
 
    hide(){
        this.node.active = false;
    }
 
    recycle(){
        if (this.manager){
            this.manager.recycleScoreNum(this);
        }
    }
 
    reuse(manager: EffectManager){
        this.manager = manager;
    }
}