2025-05-28 18:47:51 +08:00
|
|
|
import { AutoDestroy } from "./common/AutoDestroy"
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
const { regClass, property } = Laya
|
2025-05-15 21:36:03 +08:00
|
|
|
|
|
|
|
|
@regClass()
|
|
|
|
|
export class ScoreAdd extends Laya.Script {
|
2025-05-28 18:47:51 +08:00
|
|
|
declare owner: Laya.Box
|
2025-05-15 21:36:03 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
@property(Laya.Label)
|
|
|
|
|
public label: Laya.Label
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
onAwake(): void {
|
|
|
|
|
this.label.scaleX = 0
|
|
|
|
|
this.label.skewY = 0
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
const d = this.owner.getComponent(AutoDestroy)
|
|
|
|
|
d.lifeTime = 2
|
|
|
|
|
}
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
onStart(): void {
|
|
|
|
|
let wait = 0
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
let duration = 300
|
|
|
|
|
Laya.Tween.to(this.label, { scaleX: 1, scaleY: 1 }, duration, Laya.Ease.strongIn, null, wait)
|
|
|
|
|
wait += duration
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
duration = 300
|
|
|
|
|
Laya.Tween.to(this.label, { y: -102 }, duration, Laya.Ease.strongIn, null, wait)
|
|
|
|
|
wait += duration
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
duration = 300
|
|
|
|
|
Laya.Tween.to(this.label, { alpha: 0 }, duration, Laya.Ease.strongIn, null, wait)
|
|
|
|
|
wait += duration
|
|
|
|
|
}
|
2025-05-27 14:59:33 +08:00
|
|
|
|
2025-05-28 18:47:51 +08:00
|
|
|
public onSetText(text: string): void {
|
|
|
|
|
this.label.text = text
|
|
|
|
|
}
|
|
|
|
|
}
|