44 lines
1012 B
TypeScript
44 lines
1012 B
TypeScript
import { config } from "../constants/config";
|
|
import { AutoDestroy } from "./common/AutoDestroy";
|
|
|
|
const { regClass, property } = Laya;
|
|
|
|
@regClass()
|
|
export class ScoreAdd extends Laya.Script {
|
|
declare owner : Laya.Box;
|
|
|
|
@property(Laya.Label)
|
|
public label: Laya.Label
|
|
|
|
onAwake(): void {
|
|
this.label.scaleX = 0
|
|
this.label.skewY = 0
|
|
|
|
var d = this.owner.getComponent(AutoDestroy)
|
|
d.lifeTime = 2
|
|
}
|
|
|
|
onStart(): void {
|
|
|
|
var wait = 0
|
|
|
|
var duration = 300
|
|
Laya.Tween.to(this.label, {scaleX: 1, scaleY: 1}, duration, Laya.Ease.strongIn, null, wait)
|
|
wait += duration
|
|
|
|
duration = 300
|
|
Laya.Tween.to(this.label, {y:-102}, duration, Laya.Ease.strongIn, null, wait)
|
|
wait += duration
|
|
|
|
duration = 300
|
|
Laya.Tween.to(this.label, {alpha:0}, duration, Laya.Ease.strongIn, null, wait)
|
|
wait += duration
|
|
|
|
}
|
|
|
|
public onSetText(text: string): void {
|
|
this.label.text = text
|
|
}
|
|
|
|
|
|
} |