UNPKG

commonui-lib-test

Version:

"#common ui lib test"

72 lines (71 loc) 2.27 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class Dialog_Basic extends fgui.Window { constructor() { // console.warn("Dialog_Basic constructor"); super(); this.isMidBtnAutoHide = true; this.isRightBtnAutoHide = true; this.isLeftBtnAutoHide = true; } onInit() { // console.warn("Dialog_Basic onInit"); this.contentPane = this.view; this.modal = true; this.center(true); //弹出窗口的动效已中心为轴心 // this.setPivot(0.5, 0.5); } doShowAnimation() { // console.warn("Dialog_Basic doShowAnimation"); this.view.transZoomin.play(Laya.Handler.create(this, this.onShown)); } doHideAnimation() { // console.warn("Dialog_Basic doHideAnimation"); this.view.transZoomout.play(Laya.Handler.create(this, this.hideImmediately)); } onShown() { // console.warn("Dialog_Basic onShown"); } onHide() { // console.warn("Dialog_Basic onHide"); fgui.GRoot.inst.focus = null; } onMidBtn() { if (this._midBtnFunc) { if (this.isMidBtnAutoHide) this.hide(); this._midBtnFunc(); } } onRightBtn() { if (this._rightBtnFunc) { if (this.isRightBtnAutoHide) this.hide(); this._rightBtnFunc(); } } onLeftBtn() { if (this._leftBtnFunc) { if (this.isLeftBtnAutoHide) this.hide(); this._leftBtnFunc(); } } show() { // console.warn("Dialog_Basic show"); super.show(); } dispose() { if (this.view) this.view.dispose(); this.view = null; super.dispose(); } setBtnEvent(midBtnFunc, rightBtnFunc, leftBtnFunc, target) { this._midBtnFunc = midBtnFunc && target ? midBtnFunc.bind(target) : midBtnFunc; this._rightBtnFunc = rightBtnFunc && target ? rightBtnFunc.bind(target) : rightBtnFunc; this._leftBtnFunc = leftBtnFunc && target ? leftBtnFunc.bind(target) : leftBtnFunc; } } exports.default = Dialog_Basic;