UNPKG

commonui-lib-test

Version:

"#common ui lib test"

246 lines (245 loc) 8.29 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const Dialog_Setting_1 = require("../../dialog/Dialog_Setting"); const Dialog_Language_1 = require("../../dialog/Dialog_Language"); const Dialog_Error_1 = require("../../dialog/Dialog_Error"); const Dialog_Leave_1 = require("../../dialog/Dialog_Leave"); const Dialog_Reconnect_1 = require("../../dialog/Dialog_Reconnect"); const Dialog_Finish_1 = require("../../dialog/Dialog_Finish"); const Dialog_BetRecord_1 = require("../../dialog/Dialog_BetRecord"); const Dialog_Maintenance_1 = require("../../dialog/Dialog_Maintenance"); const Dialog_Match_1 = require("../../dialog/Dialog_Match"); /** * @api {class} DialogHandler * @apiName DialogHandler * @apiGroup DialogHandler * @apiDescription Dialog Handler */ class DialogHandler { constructor() { } static get Ins() { return DialogHandler._instance = DialogHandler._instance || new DialogHandler(); } get Setting() { return this._setting = this._setting || new Dialog_Setting_1.default(); } get Language() { return this._language = this._language || new Dialog_Language_1.default(); } get Error() { return this._error = this._error || new Dialog_Error_1.default(); } get Help() { return this._help = this._help; } get Leave() { return this._leave = this._leave || new Dialog_Leave_1.default(); } get Reconnect() { return this._reconnect = this._reconnect || new Dialog_Reconnect_1.default(); } get Finish() { return this._finish = this._finish || new Dialog_Finish_1.default(); } get BetRecord() { return this._betrecord = this._betrecord || new Dialog_BetRecord_1.default(); } get Maintenance() { return this._maintenance = this._maintenance || new Dialog_Maintenance_1.default(); } get Match() { return this._match = this._match || new Dialog_Match_1.default(); } set Help(help) { this._help = help; } /** * @api {function} initLocalSetting * @apiName initLocalSetting * @apiGroup DialogHandler * @apiDescription initLocalSetting */ initLocalSetting() { this._setting = new Dialog_Setting_1.default(); this._language = new Dialog_Language_1.default(); } /** * @api {function} dispose * @apiName dispose * @apiGroup DialogHandler * @apiDescription dispose */ dispose() { this.disposeDialog(); this.relaseDialog(); DialogHandler._instance = null; } disposeDialog() { this.Setting.dispose(); this.Language.dispose(); this.Error.dispose(); this.Help.dispose(); this.Leave.dispose(); this.Reconnect.dispose(); this.Finish.dispose(); this.BetRecord.dispose(); this.Maintenance.dispose(); this.Match.dispose(); } relaseDialog() { this._setting = null; this._language = null; this._error = null; this._help = null; this._leave = null; this._reconnect = null; this._finish = null; this._betrecord = null; this._maintenance = null; this._match = null; } /** * @api {function} setDialogOrder * @apiName setDialogOrder * @apiGroup DialogHandler * @apiDescription setDialogOrder */ setDialogOrder(targetView) { let targetViewIndex = fgui.GRoot.inst.getChildIndex(targetView); let hasModalWindow = fgui.GRoot.inst.hasModalWindow; if (hasModalWindow) { let topWindow = fgui.GRoot.inst.getTopWindow(); let topWindowIndex = fgui.GRoot.inst.getChildIndex(topWindow); targetViewIndex = fgui.GRoot.inst.setChildIndexBefore(targetView, topWindowIndex - 1); } return targetViewIndex; } /** * @api {function} initSystemDialog * @apiName initSystemDialog * @apiGroup DialogHandler * @apiDescription initSystemDialog */ initSystemDialog() { if (this.Leave.isShowing) this.Leave.hide(); if (this.Setting.isShowing) this.Setting.hide(); if (this.Language.isShowing) this.Language.hide(); if (this.Help && this.Help.isShowing) this.Help.hide(); } /** * @api {function} showSetting * @apiName showSetting * @apiGroup DialogHandler * @apiDescription show setting dialog window */ showSetting() { this.Setting.show(); } /** * @api {function} showLanguage * @apiName showLanguage * @apiGroup DialogHandler * @apiDescription show language dialog window */ showLanguage() { this.Language.show(); } /** * @api {function} hideLanguage * @apiName hideLanguage * @apiGroup DialogHandler * @apiDescription hideLanguage */ hideLanguage() { if (this.Language.isShowing) this.Language.hide(); } /** * @api {function} showNoMoreScore * @apiName showNoMoreScore * @apiGroup DialogHandler * @apiDescription show no more score dialog window */ showNoMoreScore(btnComfirm, target) { this.Error.setPlatformError("-11", "3030203"); this.Error.setGameServerError("-11"); this.Error.setBtnEvent(btnComfirm, target); this.Error.show(); } /** * @api {function} showLeave * @apiName showLeave * @apiGroup DialogHandler * @apiDescription show leave dialog window */ showLeave(btnComfirm, btnCancel, target) { this.Leave.setBtnEvent(btnComfirm, btnCancel, target); this.Leave.show(); } /** * @api {function} hideLeave * @apiName hideLeave * @apiGroup DialogHandler * @apiDescription hide leave dialog window */ hideLeave() { if (this.Leave.isShowing) this.Leave.hide(); } /** * @api {function} showReconnect * @apiName showReconnect * @apiGroup DialogHandler * @apiDescription show reconnect dialog window */ showReconnect(pingTimesType, btn1, btn2, target) { this.Reconnect.setPingTimesType(pingTimesType); this.Reconnect.setBtnEvent(btn1, btn2, target); this.Reconnect.show(); } /** * @api {function} showHelp * @apiName showHelp * @apiGroup DialogHandler * @apiDescription show help dialog window */ showHelp() { this.Help.show(); } /** * @api {function} showFinish * @apiName showFinish * @apiGroup DialogHandler * @apiDescription showFinish */ showFinish(btnComfirm, target) { this.Finish.setBtnEvent(btnComfirm, target); this.Finish.show(); } /** * @api {function} showBetReord * @apiName showBetReord * @apiGroup DialogHandler * @apiDescription showBetReord */ showBetReord(transactionsRecordList) { this.BetRecord.setTransactionsRecordList(transactionsRecordList); this.BetRecord.show(); } /** * @api {function} showMaintenance * @apiName showMaintenance * @apiGroup DialogHandler * @apiDescription showMaintenance */ showMaintenance(maintenType, btnComfirm, target) { this.Maintenance.setMaintenType(maintenType); this.Maintenance.setBtnEvent(btnComfirm, target); this.Maintenance.show(); } /** * @api {function} showMatch * @apiName showMatch * @apiGroup DialogHandler * @apiDescription showMatch, matchType: match = 0, rematch = 1 */ showMatch(matchType = 0, millisecondLeft = 0, btnComfirm, btnCancel, target) { this.Match.setMatchType(matchType, millisecondLeft); this.Match.setBtnEvent(btnComfirm, btnCancel, target); this.Match.show(); } /** * @api {function} hideMatch * @apiName hideMatch * @apiGroup DialogHandler * @apiDescription hideMatch */ hideMatch() { if (this.Match.isShowing) this.Match.hide(); } } exports.default = DialogHandler;