// module g2.account_dep {
//     // game server item view
//     class GameItemView extends ui.account.GameItemViewUI {
//         // userData
//         private m_userData:InfoGameServer;
//         // 构造函数
//         constructor(){
//             super();
//         }
//         // 设置userData
//         public setUserData(_userData:InfoGameServer) {
//             this.m_userData = _userData;
//             this.refreshView();
//         }
//         // 获取userData
//         public getUserData():InfoGameServer {
//             return this.m_userData;
//         }
//         // 刷新显示
//         private refreshView(){
//             // 定义工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`GameItemView.refreshView():${_msg}`);
//             }
//             // 校验参数
//             if(null == this.m_userData){
//                 LOG_ERROR("null userData");
//                 return;
//             }
//             // 显示名称
//             this.m_name.text = this.m_userData.name;
//             this.ui_status.skin = Const.getGameStatusIconPath(this.m_userData.status);
//             // 显示NewTag
//             this.ui_newTag.visible = this.m_userData.isNew;
//         }
//     }
//     // 游戏列表界面
//     export class GameListView extends ui.account.GameListViewUI {
//         // gameListItemViews
//         private m_gameItemViews:Array<GameItemView> = new Array();
//         // 构造函数
//         constructor(){
//             super();
//             this.on(laya.events.Event.DISPLAY, this, this.onEnter);
//             this.on(laya.events.Event.UNDISPLAY, this, this.onExit);
//             // 初始化公告div
//             G2Theme.initHtmlDivElement(this.m_annoDiv);
//             this.m_annoDiv.style.fontSize = 20;
//             this.m_annoDiv.style.leading = 15;
//             // 公告按钮
//             this.m_btnAnno.on(laya.events.Event.CLICK, this, this.onAnnoBtnClick);
//             // 关闭公告按钮
//             this.m_btnCloseAnno.on(laya.events.Event.CLICK, this, this.onCloseAnnoBtnClick);
//             // 账号登录按钮
//             this.m_btnLogin.on(laya.events.Event.CLICK, this, this.onLoginBtnClick);
//             // 点击选服按钮
//             this.m_btnGameList.on(laya.events.Event.CLICK, this, this.onGameListBtnClick);
//             // 关闭gameList按钮
//             this.m_btnCloseGameList.on(laya.events.Event.CLICK, this, this.onCloseGameListBtnClick);
//             // 进入游戏点击
//             this.m_btnEnterGame.on(laya.events.Event.CLICK, this, this.onEnterGameBtnClick);
//             this.m_bindMobileBtn.on(Laya.Event.CLICK, this, this.onBindMobileBtnClick);
//         }
//         private onGuestNoticeConfirm(_selection:boolean){
//             if(!_selection){
//                 let accountMgr:G2AccountMgr = G2AccountMgr.inst();
//                 accountMgr.showBindMobileDialog();
//             }
//         }
//         private onEnter(){
//             // xh:2020.10.10:尝试解决clientinfo监控到的错误信息
//             // 在game list 没有正确返回的情况下,玩家点击了进入游戏,导致exception
//             // 解决方案:
//             //  1、添加loading
//             //  2、监听错误消息,发送bigdata
//             let viewMgr:G2ViewMgr = G2ViewMgr.inst();
//             viewMgr.showLoading();
//             // 获取服务器信息
//             let accountMgr:G2AccountMgr = G2AccountMgr.inst();
//             accountMgr.accountGameList(
//                 (_gameList:any) =>{
//                     // 取消loading显示
//                     viewMgr.hideLoading();
//                     // 刷新gameListView
//                     this.refreshGameListView();
//                     // 刷新选中服务器
//                     this.refreshSelectedGameView();
//                     // 默认显示公告
//                     this.showAnno();
//                     // 如果当前登录账号为游客账号,引导绑定账号
//                     let loginAccount:g2.account.InfoAccount = accountMgr.getAccountInfo();
//                     if(null != loginAccount && loginAccount.type == Const.ACCOUNT_TYPE_GUEST){
//                         let viewMgr:G2ViewMgr = G2ViewMgr.inst();
//                         viewMgr.showConfirmDialog("提示", 
//                         "<font style='fontSize:24'>您正在使用游客模式登录游戏，该模式下的游戏账号信息在卸载游戏、更换设备后将被清空，且无法找回。请尽快绑定手机，保障自身权益。"
//                         +"<br><font color='#ff4141'>应相关政策要求，我们将在9月9日之后停止游客登录服务，请用游客账号登录的玩有在9月9日前绑定手机号</font></font>",
//                         "游客模式", "绑定手机",null,
//                         new Handler(this, this.onGuestNoticeConfirm));
//                     }
//                 }
//             )
//             this.refreshBindMobileBtn();
//             // 绑定事件
//             let eventMgr:G2EventMgr = G2EventMgr.inst();
//             eventMgr.on(G2EventMgr.EVENT_ID_ACCOUNT_BIND_MOBILE, this, this.onEventAccountBindMobile);
//         }
//         private onExit(){
//             // 解除事件
//             let eventMgr:G2EventMgr = G2EventMgr.inst();
//             eventMgr.on(G2EventMgr.EVENT_ID_ACCOUNT_BIND_MOBILE, this, this.onEventAccountBindMobile);
//         }
//         // 这个代码很恶心! todo
//         private onEventEnterNodeRsp(){
//             // 场景数据已加载进入游戏
//             let sceneMgr:G2ViewMgr = G2ViewMgr.inst();
//             let nodeScene:g2.view.node.NodeScene = new g2.view.node.NodeScene();
//             sceneMgr.showScene(nodeScene);
//         }
//         // 清除gameListView
//         private clearGameListView(){
//             let count:number = this.m_gameItemViews.length;
//             for(let i:number = 0; i < count; i ++){
//                 let gameItemView:GameItemView = this.m_gameItemViews[i];
//                 gameItemView.off(laya.events.Event.CLICK, this, this.onGameItemClick);
//                 gameItemView.removeSelf();
//             }
//             this.m_gameItemViews.splice(0, count);
//         }
//         // 显示GameList
//         private refreshGameListView(){
//             // 定义工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`GameListView.refreshGameListView():${_msg}`);
//             }
//             // 清空
//             this.clearGameListView();
//             // 获取列表数据
//             let accountMgr:G2AccountMgr = G2AccountMgr.inst();
//             let gameListInfo:InfoGameList = accountMgr.getGameListInfo();
//             if(null == gameListInfo){
//                 LOG_ERROR("null gameListInfo.");
//                 return;
//             }
//             // 获取游戏列表
//             let list:Array<InfoGameServer> = gameListInfo.getGameList();
//             // 进行过滤
//             let gameList:Array<InfoGameServer> = new Array();
//             // 获取当前账号,创建时间
//             let accountInfo:g2.account.InfoAccount = g2.account.G2AccountMgr.inst().getAccountInfo();
//             let accountCreateTime:number = accountInfo.createTime;
//             for(let i:number = 0; i < list.length; i ++) {
//                 let gsInfo:g2.account.InfoGameServer = list[i];
//                 if(gsInfo.hideAccountTime > 0 && accountCreateTime > gsInfo.hideAccountTime) {
//                     continue;
//                 }
//                 gameList.push(gsInfo);
//             }
//             // 进行layout
//             let gameCount:number = gameList.length;
//             let layout:any = g.common.Common.tableLayout(
//                 11,15,
//                 0,0,
//                 50,60,
//                 282, 63,
//                 2,
//                 gameCount,
//                 this.ui_gameListPanel.width, this.ui_gameListPanel.height
//             );
//             let poss:Array<any> = layout.poss;
//             let width:number = layout.width;
//             let height:number = layout.height;
//             // 创建item
//             for(let i:number = 0; i < gameCount; i ++){
//                 let gameServerInfo:InfoGameServer = gameList[i];
//                 let pos:any = poss[i];
//                 let gameItemView:GameItemView = new GameItemView();
//                 gameItemView.setUserData(gameServerInfo);
//                 gameItemView.pos(pos.x, pos.y);
//                 gameItemView.on(laya.events.Event.CLICK, this, this.onGameItemClick, [gameServerInfo]);
//                 this.m_gameItemsView.addChild(gameItemView);
//                 this.m_gameItemViews.push(gameItemView);
//             }
//             // 更新尺寸
//             this.m_gameItemsView.size(width, height);
//         }
//         private getRecommandGame():g2.account.InfoGameServer {
//             // 定义日志函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`GameListView.getRecommandGame():${_msg}`);
//             }
//             // 获取gameList
//             let accountMgr:g2.account.G2AccountMgr = g2.account.G2AccountMgr.inst();
//             let gameListInfo:InfoGameList = accountMgr.getGameListInfo();
//             if(null == gameListInfo || 0 == gameListInfo.getGameList().length){
//                 LOG_ERROR("null or empty gameListInfo");
//                 return null;
//             }
//             // 尝试获取缓存数据
//             let gameID:string = G2CacheMgr.inst().get(G2CacheMgr.CACHE_ID_ACCOUNT_SELECTED_GAME);
//             if(null != gameID && "" != gameID){
//                 let gameInfo:g2.account.InfoGameServer = gameListInfo.getGameServerByID(gameID);
//                 if(null != gameInfo){
//                     return gameInfo;
//                 }
//             }
//             // 根据上次登录游戏
//             let localStorageMgr:g2.localstorage.LocalStorageMgr = g2.localstorage.LocalStorageMgr.inst();
//             let localStorage:g2.localstorage.ILocalStorage = localStorageMgr.getModel();
//             if(null != localStorage){
//                 let gameID:string = localStorage.getLatestLoginGameID();
//                 if(null != gameID && "" != gameID){
//                     let gameInfo:g2.account.InfoGameServer = gameListInfo.getGameServerByID(gameID);
//                     if(null != gameInfo){
//                         return gameInfo;
//                     }
//                 }
//             }
//             // 都未找到,返回推荐服务器
//             let recommandGameID:string = gameListInfo.recommandGameID;
//             if(null != recommandGameID){
//                 let gameInfo:g2.account.InfoGameServer = gameListInfo.getGameServerByID(recommandGameID);
//                 if(null != gameInfo){
//                     return gameInfo;
//                 }
//             }
//             // 都未找到,直接返回第一个gameServer
//             let gameInfo:g2.account.InfoGameServer = gameListInfo.getGameList()[0];
//             return gameInfo;
//         }
//         // 刷新默认选中服务器
//         private refreshSelectedGameView(){
//             // 显示默认游戏服的逻辑
//             // 获取推荐gameInfo
//             let recommandGameInfo:g2.account.InfoGameServer = this.getRecommandGame();
//             // 检查是否成功获得
//             if(null == recommandGameInfo){
//                 G2ViewMgr.inst().tip("无法获取游戏服信息.");
//                 return;
//             }
//             // 显示服务器名字
//             this.m_defaultGameName.text = recommandGameInfo.name;
//             this.ui_defaultGameStatus.skin = Const.getGameStatusIconPath(recommandGameInfo.status);
//             // 设置NewTag的visible
//             this.ui_selectedGameNewTag.visible = recommandGameInfo.isNew;
//             // 将选中的gameID写入到cache中
//             G2AccountMgr.inst().setSelectedGameID(recommandGameInfo.id);
//         }
//         // 显示公告
//         private showAnno(){
//             // 定义工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`GameListView.showAnno():${_msg}`);
//             }
//             // 获取公告数据
//             let accountMgr:G2AccountMgr = G2AccountMgr.inst();
//             accountMgr.getAnnoHTML((_html:string) => {
//                     this.m_annoView.visible = true;
//                     this.m_annoDiv.size(this.m_annoDiv.width,0);
//                     g2.common.Common.safeSetInnerHTML(this.m_annoDiv, _html);
//                     this.m_annoPanel.refresh();
//                 });
//         }
//         // 公告按钮点击
//         private onAnnoBtnClick(){
//             this.showAnno();
//         }
//         // 关闭公告按钮点击
//         private onCloseAnnoBtnClick(){
//             this.m_annoView.visible = false;
//         }
//         // 账号登录按钮点击
//         // 回到登录界面
//         private onLoginBtnClick(){
//             let accountMgr:G2AccountMgr = G2AccountMgr.inst();
//             accountMgr.showAccountScene();
//         }
//         // 点击选服按钮点击
//         private onGameListBtnClick(){
//             this.m_gameListView.visible = true;
//         }
//         // 关闭选服按钮点击
//         private onCloseGameListBtnClick(){
//             this.m_gameListView.visible = false;
//         }
//         // gameItemClick
//         private onGameItemClick(_gameInfo:InfoGameServer){
//             let accountMgr:G2AccountMgr = G2AccountMgr.inst();
//             accountMgr.setSelectedGameID(_gameInfo.id);
//             this.m_gameListView.visible = false;
//             this.refreshSelectedGameView();
//         }
//         // 进入游戏点击
//         private onEnterGameBtnClick(){
//             // 检查,当前选中的gameserver不能处于维护状态,否则显示对话框
//             let accountMgr:g2.account.G2AccountMgr = g2.account.G2AccountMgr.inst();
//             let selectedGameInfo:g2.account.InfoGameServer = accountMgr.getSelectedGameInfo();
//             if(Const.GAME_STATUS_WH == selectedGameInfo.status) {
//                 G2ViewMgr.inst().showInfoDialog(TEXT(`@C_ACCOUNTMGR_ERROR5`),//"错误"
//                 TEXT_F(`@C_ACCOUNTMGR_ERROR6`,selectedGameInfo.name),//服务器${selectedGameInfo.name}当前处于维护状态,暂时无法登录,请稍后重试.
//                 TEXT(`@C_CONFIRM_SURE`));//确定
//                 return;
//             }
//             // 实名认证
//             let smrzMgr:g2.smrz.G2SMRZMgr = g2.smrz.G2SMRZMgr.inst();
//             smrzMgr.start(()=>{
//                 // 启动加载界面
//                 let gameLoader:GameLoader = new GameLoader(new Handler(this, this.onGameLoadOk));
//                 Laya.stage.addChild(gameLoader);
//             });
//         }
//         private onGameLoadOk(_loader:GameLoader) {
//             // 绑定事件
//             let eventMgr:G2EventMgr = G2EventMgr.inst();
//             eventMgr.once(G2EventMgr.EVENT_ID_ENTER_NODE, this, this.onEventEnterNodeRsp);
//             // 登录游戏
//             let accountMgr:g2.account.G2AccountMgr = g2.account.G2AccountMgr.inst();
//             let accountInfo:g2.account.InfoAccount = accountMgr.getAccountInfo();
//             let loginToken:string = accountMgr.getLoginToken();
//             let gameMgr:G2GameMgr = G2GameMgr.inst();
//             gameMgr.login(accountInfo, loginToken,
//                 (_errorCode:number) => {
//                     // 删除gameLoader
//                     _loader.removeSelf();
//                     // 判定错误
//                     if(G2NetMgr.detectError(_errorCode)){
//                         // 关闭连接
//                         let netMgr:G2NetMgr = G2NetMgr.inst();
//                         netMgr.closeGateway();
//                         return;
//                     }
//                     // ------------------------------------------------------------
//                     // 写入上次登录账号数据到本地缓存
//                     // ------------------------------------------------------------
//                     let selectedGameInfo:g2.account.InfoGameServer = accountMgr.getSelectedGameInfo();
//                     let localStorageMgr:g2.localstorage.LocalStorageMgr = g2.localstorage.LocalStorageMgr.inst();
//                     let localStorageModel:g2.localstorage.ILocalStorage = localStorageMgr.getModel();
//                     localStorageModel.setLatestLogin(accountInfo, selectedGameInfo.id);
//                     localStorageMgr.save();
//                     // 删除自己
//                     this.removeSelf();
//                     // 进入角色列表场景
//                     let roleListScene:g2.view.role_list.RoleListScene = new g2.view.role_list.RoleListScene();
//                     let viewMgr:G2ViewMgr = G2ViewMgr.inst();
//                     viewMgr.showScene(roleListScene);
//                 });
//         }
//         // 刷新BindMobileBtn
//         private refreshBindMobileBtn(){
//             // 定义工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`GameListView.refreshBindMobileBtn():${_msg}`);
//             }
//             // 获取当前登录的账号
//             let accountMgr:g2.account.G2AccountMgr = g2.account.G2AccountMgr.inst();
//             let loginAccount:g2.account.InfoAccount = accountMgr.getAccountInfo();
//             if(null == loginAccount){
//                 LOG_ERROR("null loginAccount.")
//                 return;
//             }
//             // 如果账号类型为guest,显示绑定按钮,否则不显示
//             let accountType:number = loginAccount.type;
//             if(Const.ACCOUNT_TYPE_GUEST == accountType){
//                 this.m_bindMobileBtn.visible = true;
//             }else{
//                 this.m_bindMobileBtn.visible = false;
//             }
//         }
//         private onEventAccountBindMobile(){
//             this.refreshBindMobileBtn();
//         }
//         // 游客绑定按钮点击
//         private onBindMobileBtnClick(){
//             let accountMgr:g2.account.G2AccountMgr = g2.account.G2AccountMgr.inst();
//             accountMgr.showBindMobileDialog();
//         }
//     }
// }
//# sourceMappingURL=GameListView.js.map