添加弹窗动画
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { respath } from "../constants/respath"
|
||||
import { ResourceManager } from "../models/ResourceManager"
|
||||
import { UIManager } from "../models/UIManager"
|
||||
import { Utility_EaseOut, Utility_EaseOut_2 } from "../utils/utility"
|
||||
|
||||
|
||||
const { regClass, property } = Laya
|
||||
|
||||
@@ -36,6 +38,30 @@ export class CommonTips extends Laya.Script {
|
||||
|
||||
private isChecked = false
|
||||
|
||||
private mask: Laya.Image
|
||||
private center: Laya.Box
|
||||
|
||||
onAwake(): void {
|
||||
this.mask = this.owner.getChildByName("Image") as Laya.Image
|
||||
this.mask.alpha = 0
|
||||
Laya.Tween.to(this.mask, {alpha: 0.6}, 400, Utility_EaseOut)
|
||||
|
||||
this.center = this.owner.getChildByName("center") as Laya.Box
|
||||
this.center.scaleX = 0.8
|
||||
this.center.scaleY = 0.8
|
||||
Laya.Tween.to(this.center, {scaleX: 1, scaleY: 1}, 400, Utility_EaseOut)
|
||||
this.center.alpha = 0
|
||||
Laya.Tween.to(this.center, {alpha: 1}, 400, Utility_EaseOut)
|
||||
}
|
||||
|
||||
destroyUI(): void {
|
||||
Laya.Tween.to(this.mask, {alpha: 0}, 400, Utility_EaseOut_2)
|
||||
Laya.Tween.to(this.center, {scaleX: 0.8, scaleY: 0.8}, 400, Utility_EaseOut_2)
|
||||
Laya.Tween.to(this.center, {alpha: 0}, 400, Utility_EaseOut_2, Laya.Handler.create(this, () => {
|
||||
this.owner.destroy()
|
||||
}))
|
||||
}
|
||||
|
||||
public showCommonTips(title: string, content: string, showToggle: boolean, func: any): void {
|
||||
this.label_title.text = title
|
||||
this.label_content.text = content
|
||||
@@ -50,13 +76,16 @@ export class CommonTips extends Laya.Script {
|
||||
if (func) {
|
||||
func(true, this.isChecked)
|
||||
}
|
||||
this.owner.destroy()
|
||||
this.destroyUI()
|
||||
})
|
||||
this.btn_cancel.on(Laya.Event.CLICK, this, () => {
|
||||
if (func) {
|
||||
func(false, this.isChecked)
|
||||
}
|
||||
this.owner.destroy()
|
||||
this.destroyUI()
|
||||
})
|
||||
this.mask.on(Laya.Event.CLICK, this, () => {
|
||||
this.destroyUI()
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user