// module g2.account_dep {
//     // 账号管理器
//     export class G2AccountMgr {
//         // 单例
//         private static s_inst:G2AccountMgr = null;
//         // 获取单例
//         public static inst():G2AccountMgr {
//             if(null == G2AccountMgr.s_inst){
//                 G2AccountMgr.s_inst = new G2AccountMgr();
//             }
//             return G2AccountMgr.s_inst;
//         }
//         // init
//         public init(){
//         }
//         public showError(_errorCode:number) {
//             if(null == _errorCode){
//                 return;
//             }
//             if(GErrors.OK == _errorCode){
//                 return;
//             }
//             // 获取错误提示
//             let errorMsg:string = G2DataMgr.inst().errorMsg(_errorCode);
//             // 显示信息框
//             G2ViewMgr.inst().showInfoDialog(TEXT(`@C_ACCOUNTMGR_ERROR1`),  //发生错误
//             TEXT_F(`@C_ACCOUNTMGR_ERROR2`,errorMsg), // `发生错误:${errorMsg}.`
//             TEXT(`@C_CONFIRM_SURE`));  //确定
//         }
//         // 错误处理
//         // 发生错误,返回true
//         public detectError(_data:any):boolean {
//             // 非空检查
//             if(null == _data){
//                 return false;
//             }
//             // 获取errorCode
//             let errorCode:number = _data.errorCode;
//             if(null == errorCode){
//                 return false;
//             }
//             if(GErrors.OK == errorCode){
//                 return false;
//             }
//             this.showError(errorCode);
//             // 返回true
//             return true;
//         }
//         // 显示accountScene
//         public showAccountScene(){
//             let accountScene:AccountView = new AccountView();
//             let viewMgr:G2ViewMgr = G2ViewMgr.inst();
//             viewMgr.showScene(accountScene);
//         }
//         // 显示gameListScene
//         public showGameListScene(){
//             let gameListScene:GameListView = new GameListView();
//             let viewMgr:G2ViewMgr = G2ViewMgr.inst();
//             viewMgr.showScene(gameListScene);
//         }
//         /**
//          * 通知底层,账号创建
//          * @param _accountInfo 
//          */
//         private accountRegNativeNotify(_accountInfo:InfoAccount) {
//             // 定义错误函数
//             let ERROR:Function = (_msg:string) => {
//                 Log.error(`AccountMgr.accountRegNativeNotify():${_msg}`);
//             }
//             // 校验参数
//             if(null == _accountInfo) {
//                 ERROR("null _accountInfo");
//                 return;
//             }
//             // 获取账号类型字符串
//             let accountTypeStr:string = "";
//             switch(_accountInfo.type){
//                 case Const.ACCOUNT_TYPE_GUEST:{
//                     accountTypeStr = "guest";
//                     break;
//                 }
//                 case Const.ACCOUNT_TYPE_MOBILE:{
//                     accountTypeStr = "mobile";
//                     break;
//                 }
//                 case Const.ACCOUNT_TYPE_WX:{
//                     accountTypeStr = "wx";
//                     break;
//                 }
//                 case Const.ACCOUNT_TYPE_QQ:{
//                     accountTypeStr = "qq";
//                     break;
//                 }
//                 case Const.ACCOUNT_TYPE_APL:{
//                     accountTypeStr = "apple";
//                     break;
//                 }
//                 case Const.ACCOUNT_TYPE_EMAIL:{
//                     accountTypeStr = "email";
//                     break;
//                 }
//                 default:{
//                     accountTypeStr = `unknown:${_accountInfo.type}`;
//                     break;
//                 }
//             }
//             // zjtd track
//             g2.track.ZJTD.logReg(accountTypeStr);
//             // tc track
//             g2.track.TC.logReg(accountTypeStr);
//             // umeng 事件
//             g2.track.UMeng.logEvent(g2.track.UMeng.EVENT_ACCOUNT_REG, {type:accountTypeStr});
//         }
//         /**
//          * 注册游客账号
//          */
//         public regGuestAccount(){
//             // 定义工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`G2AccountMgr.regGuestAccount():${_msg}`);
//             }
//             // 发起http请求
//             G2AccountHttp.httpRegGuestAccount(
//                 this.accountHost(),
//                 (_success:boolean, _errMsg:string, _rsp:any)=>{
//                     if(_success){
//                         // 错误处理
//                         if(this.detectError(_rsp)){
//                             return;
//                         }
//                         // 获取accountInfo
//                         let accountObj:any = _rsp.accountInfo;
//                         let accountInfo:InfoAccount = new InfoAccount();
//                         accountInfo.initFromObj(accountObj);
//                         // 添加账号存储
//                         let localStorageMgr:g2.localstorage.LocalStorageMgr = g2.localstorage.LocalStorageMgr.inst();
//                         let localStorageModel:g2.localstorage.ILocalStorage = localStorageMgr.getModel();
//                         localStorageModel.addAccount(
//                             accountInfo.id,
//                             accountInfo.type,
//                             accountInfo.deviceID,
//                             accountInfo.mobile,
//                             accountInfo.password,
//                             accountInfo.aplUserID,
//                             accountInfo.aplPassword);
//                         localStorageMgr.save();
//                         // 通知底层
//                         this.accountRegNativeNotify(accountInfo);
//                         // 调用登录接口
//                         // this.d_guestLogin(accountInfo.id);
//                         this.login(G2AccountMgr.makeGuestLoginReq(accountInfo.id));
//                     }else{
//                         G2ViewMgr.inst().tip(TEXT(`@C_ACCOUNTMGR_NETERROR3`));//网络连接失败.
//                     }
//                     // // 错误处理
//                     // if(this.detectError(_data)){
//                     //     return;
//                     // }
//                     // // 获取accountInfo
//                     // let accountObj:any = _data.accountInfo;
//                     // let accountInfo:InfoAccount = new InfoAccount();
//                     // accountInfo.initFromObj(accountObj);
//                     // // 添加账号存储
//                     // let localStorageMgr:g2.localstorage.LocalStorageMgr = g2.localstorage.LocalStorageMgr.inst();
//                     // let localStorageModel:g2.localstorage.ILocalStorage = localStorageMgr.getModel();
//                     // localStorageModel.addAccount(accountInfo.id,accountInfo.type,accountInfo.deviceID,accountInfo.mobile,accountInfo.password);
//                     // localStorageMgr.save();
//                     // // zjtd track
//                     // g2.track.ZJTD.logReg("guest");
//                     // // tc track
//                     // g2.track.TC.logReg("guest");
//                     // // umeng 事件
//                     // g2.track.UMeng.logEvent(g2.track.UMeng.EVENT_ACCOUNT_REG, {type:"guest"});
//                     // // 调用登录接口
//                     // this.guestLogin(accountInfo.id);
//                 })
//         }
//         // 游客按钮点击所使用的逻辑
//         public guest(){
//             // 工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`AccountMgr.guest():${_msg}`);
//             }
//             // 获取localStore中的guestAccount
//             let localStorageMgr:g2.localstorage.LocalStorageMgr = g2.localstorage.LocalStorageMgr.inst();
//             let localStorageModel:g2.localstorage.ILocalStorage = localStorageMgr.getModel();
//             let guestAccount:g2.localstorage.IAccount = localStorageModel.getGuestAccount();
//             // 如果guestAccount不存在,则请求创建新的guest账号
//             if(null == guestAccount){
//                 this.regGuestAccount();
//                 return;
//             }
//             // this.guestLogin(guestAccount.getID());
//             this.login(G2AccountMgr.makeGuestLoginReq(guestAccount.getID()));
//         }
//         // 注册手机账号
//         public regMobileAccount(_mobile:string, _validCode:string,_password){
//             // 定义工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`G2AccountMgr.regMobileAccount():${_msg}`);
//             }
//             // 发起http请求
//             G2AccountHttp.httpRegMobileAccount(
//                 this.accountHost(),
//                 _mobile,
//                 _validCode,
//                 _password,
//                 (_success:boolean, _errMsg:string, _rsp:any)=>{
//                     if(_success) {
//                         // 错误处理
//                         if(this.detectError(_rsp)){
//                             return;
//                         }
//                         // 获取accountInfo
//                         let accountObj:any = _rsp.accountInfo;
//                         let accountInfo:InfoAccount = new InfoAccount();
//                         accountInfo.initFromObj(accountObj);
//                         // 添加账号存储
//                         let localStorageMgr:g2.localstorage.LocalStorageMgr = g2.localstorage.LocalStorageMgr.inst();
//                         let localStorageModel:g2.localstorage.ILocalStorage = localStorageMgr.getModel();
//                         localStorageModel.addAccount(
//                             accountInfo.id,
//                             accountInfo.type,
//                             accountInfo.deviceID,
//                             accountInfo.mobile,
//                             accountInfo.password,
//                             accountInfo.aplUserID,
//                             accountInfo.aplPassword);
//                         localStorageMgr.save();
//                         // 通知底层
//                         this.accountRegNativeNotify(accountInfo);
//                         // 调用登录接口
//                         // this.d_passwordLogin(_mobile, _password);
//                         this.login(G2AccountMgr.makePasswordLoginReq(_mobile,_password));
//                     }else{
//                         G2ViewMgr.inst().tip(TEXT(`@C_ACCOUNTMGR_NETERROR3`));//网络连接失败.
//                     }
//                     // // 错误处理
//                     // if(this.detectError(_data)){
//                     //     return;
//                     // }
//                     // // 获取accountInfo
//                     // let accountObj:any = _data.accountInfo;
//                     // let accountInfo:InfoAccount = new InfoAccount();
//                     // accountInfo.initFromObj(accountObj);
//                     // // 添加账号存储
//                     // let localStorageMgr:g2.localstorage.LocalStorageMgr = g2.localstorage.LocalStorageMgr.inst();
//                     // let localStorageModel:g2.localstorage.ILocalStorage = localStorageMgr.getModel();
//                     // localStorageModel.addAccount(accountInfo.id,accountInfo.type,accountInfo.deviceID,accountInfo.mobile,accountInfo.password);
//                     // localStorageMgr.save();
//                     // // zjtd track
//                     // g2.track.ZJTD.logReg("mobile");
//                     // // tc track
//                     // g2.track.TC.logReg("mobile");
//                     // // umeng 事件
//                     // g2.track.UMeng.logEvent(g2.track.UMeng.EVENT_ACCOUNT_REG, {type:"mobile"});
//                     // // 调用登录接口
//                     // this.passwordLogin(_mobile, _password);
//                 })
//         }
//         /**
//          * 使用邮箱请求注册账号
//          * @param _email 
//          * @param _validCode 
//          * @param _password 
//          */
//         public regEmailAccount(_email:string, _validCode:string, _password:string) {
//             // 定义工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`G2AccountMgr.regEmailAccount():${_msg}`);
//             }
//             // 发起http请求
//             G2AccountHttp.httpRegEmailAccount(
//                 this.accountHost(),
//                 _email,
//                 _validCode,
//                 _password,
//                 (_success:boolean, _errMsg:string, _rsp:any)=>{
//                     if(_success) {
//                         // 错误处理
//                         if(this.detectError(_rsp)){
//                             return;
//                         }
//                         // 获取accountInfo
//                         let accountObj:any = _rsp.accountInfo;
//                         let accountInfo:InfoAccount = new InfoAccount();
//                         accountInfo.initFromObj(accountObj);
//                         // 添加账号存储
//                         let localStorageMgr:g2.localstorage.LocalStorageMgr = g2.localstorage.LocalStorageMgr.inst();
//                         let localStorageModel:g2.localstorage.ILocalStorage = localStorageMgr.getModel();
//                         localStorageModel.addAccount(
//                             accountInfo.id,
//                             accountInfo.type,
//                             accountInfo.deviceID,
//                             accountInfo.email,
//                             accountInfo.password,
//                             accountInfo.aplUserID,
//                             accountInfo.aplPassword);
//                         localStorageMgr.save();
//                         // 通知底层
//                         this.accountRegNativeNotify(accountInfo);
//                         // 调用登录接口
//                         this.login(G2AccountMgr.makeEmailLoginReq(_email,_password));
//                     }else{
//                         G2ViewMgr.inst().tip(TEXT(`@C_ACCOUNTMGR_NETERROR3`));//网络连接失败.
//                     }
//                 })
//         }
//         /**
//          * 绑定手机
//          * @param _accountID 
//          * @param _mobile 
//          * @param _validCode 
//          * @param _password 
//          * @param _complete 
//          */
//         public bindMobile(_accountID:string, _mobile:string, _validCode:string, _password:string, _complete:Function = null) {
//             // 定义工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`AccountMgr.bindMobile():${_msg}`);
//             }
//             // 发起http请求
//             G2AccountHttp.httpBindMobile(
//                 this.accountHost(),
//                 _accountID,
//                 _mobile,
//                 _validCode,
//                 _password,
//                 (_success:boolean, _errMsg:string, _rsp:any)=>{
//                     if(_success){
//                         // 错误处理
//                         if(this.detectError(_rsp)){
//                             return;
//                         }
//                         // 更新当前登录的accountInfo
//                         let loginAccountInfo:InfoAccount = this.getAccountInfo();
//                         if(null != loginAccountInfo && _accountID == loginAccountInfo.id){
//                             loginAccountInfo.type = Const.ACCOUNT_TYPE_MOBILE;
//                             loginAccountInfo.mobile = _mobile;
//                             loginAccountInfo.password = _password;
//                         }
//                         // 更新localStore中的信息
//                         let localStorageMgr:g2.localstorage.LocalStorageMgr = g2.localstorage.LocalStorageMgr.inst();
//                         let localStorageModel:g2.localstorage.ILocalStorage = localStorageMgr.getModel();
//                         localStorageModel.setAccountBind(loginAccountInfo.id, loginAccountInfo.mobile, loginAccountInfo.password);
//                         localStorageMgr.save();
//                         // 触发事件
//                         let eventMgr:G2EventMgr = G2EventMgr.inst();
//                         eventMgr.event(G2EventMgr.EVENT_ID_ACCOUNT_BIND_MOBILE, [_accountID, _mobile]);
//                         // 调用回调
//                         if(_complete != null){
//                             _complete();
//                         }
//                     }else{
//                         G2ViewMgr.inst().tip(TEXT(`@C_ACCOUNTMGR_NETERROR3`));//网络连接失败.
//                     }
//                 }
//             )
//         }
//         /**
//          * 修改密码
//          * @param _mobile 
//          * @param _validCode 
//          * @param _password 
//          * @param _complete 
//          */
//         public resetPassword(_mobile:string, _validCode:string, _password:string, _complete:Function = null){
//             // 定义工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`AccountMgr.resetPassword():${_msg}`);
//             }
//             // 发起http请求
//             G2AccountHttp.httpResetPassword(
//                 this.accountHost(),
//                 _mobile,
//                 _validCode,
//                 _password,
//                 (_success:boolean, _errMsg:string, _rsp:any)=> {
//                     if(_success){
//                         // 错误检测
//                         if(this.detectError(_rsp)){
//                             return;
//                         }
//                         // 获取accountID
//                         let accountID:string = _rsp.accountID;
//                         // 更新当前loginAccount和localStore
//                         let loginAccount:InfoAccount = this.getAccountInfo();
//                         if(null != loginAccount && loginAccount.mobile == _mobile){
//                             loginAccount.password = _password;
//                         }
//                         // 更新本地记录
//                         let localStorageMgr:g2.localstorage.LocalStorageMgr = g2.localstorage.LocalStorageMgr.inst();
//                         let localStorageModel:g2.localstorage.ILocalStorage = localStorageMgr.getModel();
//                         localStorageModel.setAccountPassword(accountID, _password);
//                         localStorageMgr.save();
//                         // 回调
//                         if(null != _complete){
//                             _complete();
//                         }
//                     }else{
//                         G2ViewMgr.inst().tip(TEXT(`@C_ACCOUNTMGR_NETERROR3`));//网络连接失败.
//                     }
//                 })
//         }
//         // 账号成功登录回调
//         private onAccountLogin(_data:any){
//             // 错误处理
//             if(this.detectError(_data)){
//                 return;
//             }
//             // 获得accountInfo和loginToken
//             let accountObj:any = _data.accountInfo;
//             let loginToken:string = _data.loginToken;
//             let accountInfo:InfoAccount = new InfoAccount();
//             accountInfo.initFromObj(accountObj);
//             let isNew:boolean = _data.isNew;
//             // 写入cache
//             let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//             cacheMgr.set(G2CacheMgr.CACHE_ID_ACCOUNT_INFO, accountInfo);
//             cacheMgr.set(G2CacheMgr.CACHE_ID_ACCOUNT_LOGIN_TOKEN, loginToken);
//             // 新新账号,则通知底层
//             if(isNew){
//                 this.accountRegNativeNotify(accountInfo);
//             }
//             // 跳转到gameList界面
//             this.showGameListScene();
//         }
//         /**
//          * 获取游客登录请求对象
//          * @param _accountID 
//          */
//         public static makeGuestLoginReq(_accountID:string):any {
//             return {
//                 loginType:Const.ACCOUNT_LOGIN_TYPE_GUEST,
//                 accountID:_accountID
//             };
//         }
//         /**
//          * 获取手机 - 密码登录请求对象
//          * @param _mobile 
//          * @param _password 
//          */
//         public static makePasswordLoginReq(_mobile:string,_password:string):any {
//             return {
//                 loginType:Const.ACCOUNT_LOGIN_TYPE_PASSWORD,
//                 mobile:_mobile,
//                 password:_password
//             };
//         }
//         /**
//          * 获取邮箱 - 密码登录请求对象
//          * @param _email 
//          * @param _password 
//          */
//         public static makeEmailLoginReq(_email:string,_password:string):any {
//             return {
//                 loginType:Const.ACCOUNT_LOGIN_TYPE_EMAIL,
//                 email:_email,
//                 password:_password
//             };
//         }
//         /**
//          * 获取微信登录请求
//          * @param _wxCode 
//          */
//         public static makeWXLoginReq(_wxCode:string):any {
//             return {
//                 loginType:Const.ACCOUNT_LOGIN_TYPE_WX,
//                 wxCode:_wxCode
//             };
//         }
//         /**
//          * 获取qq登录请求
//          * @param _qqAccessToken 
//          * @param _qqOpenID
//          */
//         public static makeQQLoginReq(_qqAccessToken:string,_qqOpenID:string):any {
//             return {
//                 loginType:Const.ACCOUNT_LOGIN_TYPE_QQ,
//                 qqAccessToken:_qqAccessToken,
//                 qqOpenID:_qqOpenID
//             };
//         }
//         /**
//          * 创建一个苹果登录request
//          * @param _userID 
//          * @param _authorizationCode 
//          * @param _identityToken 
//          * @param _aplPassword 
//          */
//         public static makeAplLoginReq(  _userID:string,
//                                         _authorizationCode:string,
//                                         _identityToken:string,
//                                         _aplPassword:string = null):any{
//             return {
//                 loginType:Const.ACCOUNT_LOGIN_TYPE_APL,
//                 aplUserID:_userID,
//                 aplAuthorizationCode:_authorizationCode,
//                 aplIdentityCode:_identityToken,
//                 aplPassword:_aplPassword
//             };                                    
//         }
//         /**
//          * 登录请求
//          * * 参数req的字段:
//          *  accountType 登录类型,参见 Const.ACCOUNT_TYPE_XXX
//          *  accountID 账号ID accountType = Const.ACCOUNT_TYPE_GUEST 时填写
//          *  mobile : 手机号 accountType = Const.ACCOUNT_TYPE_MOBILE 时填写
//          *  password : 密码 accountType = Const.ACCOUNT_TYPE_MOBILE 时填写
//          *  wxCode : 微信code accountType = Const.ACCOUNT_TYPE_WX 时填写
//          * 参考 makeXXXLoginReq接口,支持:
//          *  游客登录
//          *  账号密码登录
//          *  微信登录
//          */
//         public login(_req:any,_complete:Function = null){
//             // 定义错误函数
//             let ERROR:Function = (_msg:string) => {
//                 Log.error(`AccountMgr.login():${_msg}`);
//             }
//             // 检查参数
//             if(null == _req) {
//                 ERROR("null _req");
//                 return;
//             }
//             // 发起登录请求
//             G2AccountHttp.httpLogin(
//                 this.accountHost(),
//                 _req,
//                 (_success:boolean, _errMsg:string, _rsp:any) => {
//                 if(_success){
//                     this.onAccountLogin(_rsp);
//                     // 调用回调函数
//                     if(null != _complete){
//                         _complete();
//                     }
//                 }else{
//                     G2ViewMgr.inst().tip(TEXT(`@C_ACCOUNTMGR_NETERROR3`));//网络连接失败.
//                 }
//             });
//         }
//         // 发送校验码
//         public sendValidCode(_mobile:string, _usage:number, _complete:Function) {
//             // 定义工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`G2AccountMgr.sendValidCode():${_msg}`);
//             }
//             // 发起http请求
//             G2AccountHttp.httpSendValidCode(
//                 this.accountHost(),
//                 _mobile,
//                 _usage,
//                 (_success:boolean, _errMsg:string, _rsp:any)=>{
//                     if(_success){
//                         // 错误处理
//                         if(this.detectError(_rsp)){
//                             return;
//                         }
//                         // 回调函数
//                         if(null != _complete){
//                             _complete();
//                         }
//                     }else{
//                         G2ViewMgr.inst().tip(TEXT(`@C_ACCOUNTMGR_NETERROR3`));//网络连接失败.
//                     }
//                     // // 错误处理
//                     // if(this.detectError(_data)){
//                     //     return;
//                     // }
//                     // // 回调函数
//                     // if(null != _complete){
//                     //     _complete();
//                     // }
//                 }
//             );
//         }
//         /**
//          * 
//          * @param _complete 参数:InfoAccountServer
//          */
//         public s(_complete:Function) {
//             // 获取host
//             let host:string = this.accountHost();
//             // 错误处理
//             let viewMgr:G2ViewMgr = G2ViewMgr.inst();
//             let hostMgr:G2HostMgr = G2HostMgr.inst();
//             // 请求
//             G2AccountHttp.httpS(
//                 host,
//                 (_success:boolean, _errMsg:string, _rsp:any) => {
//                     if(_success){
//                         // nail
//                         hostMgr.nail();
//                         // 错误处理
//                         let errorCode:number = _rsp.errorCode;
//                         if(GErrors.OK != errorCode){
//                             viewMgr.hideLoading();
//                             // 特殊处理:资源版本问题
//                             if(G2Errors.ERR_ACCOUNT_RV_LIMIT == errorCode) {
//                                 g2.common.Common.showNetError(g2.common.Common.NET_ERROR_CAUSE_SHAKEHAND_RV_LIMIT);
//                                 return;
//                             }
//                             let errorMsg:string = G2DataMgr.inst().errorMsg(errorCode);
//                             viewMgr.showBlockInfoDialog(TEXT(`@C_ACCOUNTMGR_ERROR1`),  //发生错误
//                              errorMsg);
//                             return;
//                         }
//                         // 获得accountServiceInfo
//                         let accountServerInfo:InfoAccountServer = new InfoAccountServer();
//                         accountServerInfo.initFromObj(_rsp.accountServerInfo);
//                         let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//                         cacheMgr.set(G2CacheMgr.CACHE_ID_ACCOUNT_SERVER_INFO, accountServerInfo);
//                         // 回调
//                         if(null != _complete){
//                             viewMgr.hideLoading();
//                             _complete(accountServerInfo);
//                         }
//                     }else{
//                         let hasHost:boolean = hostMgr.next();
//                         if(!hasHost) {
//                             // 显示错误
//                             viewMgr.hideLoading();
//                             g2.common.Common.showNetError(g2.common.Common.NET_ERROR_CAUSE_NET_FAILED);
//                             return;
//                         }else{
//                             this.s(_complete);
//                         }
//                     }
//                 }
//             )
//         }
//         /**
//          * debug函数
//          */
//         private static printRsp(_name:string, _success:boolean, _errMsg:string, _rsp:any){
//             Log.debug(`########################### ${_name} ########################`);
//             let rspJson:string = JSON.stringify(_rsp);
//             Log.debug(`是否成功:${_success} 错误消息:${_errMsg} 响应数据:${rspJson}`);
//             Log.debug("##################################################################");
//         }
//         /**
//          * 获取游戏列表
//          * @param _complete 
//          */
//         public accountGameList(_complete:Function) {
//             // 请求http
//             G2AccountHttp.httpAccountGameList(
//                 this.accountHost(),
//                 (_success:boolean, _errMsg:string, _rsp:any)=> {
//                     // 错误处理
//                     if(!_success){
//                         G2ViewMgr.inst().showBlockInfoDialog("错误", "未能获得游戏列表,请重新启动游戏.");
//                         return;
//                     }
//                     // 成功处理
//                     let gameListInfo:InfoGameList = new InfoGameList();
//                     gameListInfo.initFromObj(_rsp);
//                     let accountInfo:g2.account.InfoAccount = g2.account.G2AccountMgr.inst().getAccountInfo();
//                     // if(null != accountInfo) {
//                     //     if("18615725337" == accountInfo.mobile || "19983395660" == accountInfo.mobile) {
//                     //         let gsInfo:InfoGameServer = new InfoGameServer();
//                     //         gsInfo.id = "G6";
//                     //         gsInfo.host = "ws://120.55.92.201:9999";
//                     //         gsInfo.name = "6号营地";
//                     //         gsInfo.bmartURL = "http://120.55.92.201:8088";
//                     //         gsInfo.status = 1;
//                     //         gsInfo.isNew = true;
//                     //         gsInfo.hideAccountTime = 0;
//                     //         gameListInfo.addGameServer(gsInfo);
//                     //     }
//                     // }
//                     let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//                     cacheMgr.set(G2CacheMgr.CACHE_ID_ACCOUNT_GAMELIST, gameListInfo);
//                     // 回调
//                     if(null != _complete){
//                         _complete(gameListInfo);
//                     }
//                 }
//             )
//             // // 请求http
//             // G2AccountHttp.httpAccountGameList(
//             //     (_data:any)=> {
//             //         // 装入cache
//             //         let gameListInfo:InfoGameList = new InfoGameList();
//             //         gameListInfo.initFromObj(_data);
//             //         let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//             //         cacheMgr.set(G2CacheMgr.CACHE_ID_ACCOUNT_GAMELIST, gameListInfo);
//             //         // // 为了测试4服添加的特殊代码
//             //         // let accountInfo:g2.account.InfoAccount = this.getAccountInfo();
//             //         // if(null != accountInfo) {
//             //         //     if("5e1e8fc7e3b287627b0601f3" == accountInfo.id) {
//             //         //         Log.debug(`************* 识别到账号${accountInfo.id} 启动追加gameserver`);
//             //         //         let gameServerInfo:g2.account.InfoGameServer = new g2.account.InfoGameServer();
//             //         //         gameServerInfo.id = "G4";
//             //         //         gameServerInfo.host = "ws://121.196.36.186:9999";
//             //         //         gameServerInfo.bmartURL = "http://121.196.36.186:8088";
//             //         //         gameServerInfo.name = "4号营地";
//             //         //         gameServerInfo.status = Const.GAME_STATUS_KX;
//             //         //         gameServerInfo.isNew = true;
//             //         //         gameServerInfo.hideAccountTime = 0;
//             //         //         gameListInfo.addGameServer(gameServerInfo);
//             //         //     }
//             //         // }
//             //         // 回调
//             //         if(null != _complete){
//             //             _complete(gameListInfo);
//             //         }
//             //     }
//             // )
//         }
//         private static LOCAL_ANNO:string = TEXT(`@C_ACCOUNTMGR_WELCOME`);//`<br><br>欢迎来到重建家园的世界!`;
//         // 获取公告数据
//         public getAnnoHTML(_complete:Function){
//             // 定义错误日志
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`AccountMgr.getAnnoHTML():${_msg}`);
//             }
//             // 定义回调
//             let COMPLETE:Function = (_html:string) => {
//                 if(null != _complete){
//                     _complete(_html);
//                 }
//             }
//             if(true == G2Config.CONFIG_LOCAL_ANNO){
//                 COMPLETE(G2AccountMgr.LOCAL_ANNO);
//             }else{
//                 let accountServerInfo:g2.account.InfoAccountServer = this.getAccountServerInfo();
//                 if(null == accountServerInfo){
//                     LOG_ERROR("null accountServerInfo");
//                     COMPLETE("error");
//                     return;
//                 }
//                 let annoURL:string = accountServerInfo.annoURL;
//                 if(null == annoURL || "" == annoURL){
//                     LOG_ERROR(`invalid annoURL:${annoURL}`);
//                     COMPLETE("error");
//                     return;
//                 }
//                 g.common.Common.getHTML(annoURL, COMPLETE);
//             }
//         }
//         // 获取accountInfo
//         public getAccountInfo():InfoAccount {
//             let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//             return cacheMgr.get(G2CacheMgr.CACHE_ID_ACCOUNT_INFO);
//         }
//         // 获取GameListInfo
//         public getGameListInfo():InfoGameList {
//             let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//             return cacheMgr.get(G2CacheMgr.CACHE_ID_ACCOUNT_GAMELIST);
//         }
//         // 获取loginToken
//         public getLoginToken():string {
//             let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//             return cacheMgr.get(G2CacheMgr.CACHE_ID_ACCOUNT_LOGIN_TOKEN);
//         }
//         // 获取accountServerInfo
//         public getAccountServerInfo():InfoAccountServer {
//             let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//             return cacheMgr.get(G2CacheMgr.CACHE_ID_ACCOUNT_SERVER_INFO);
//         }
//         // 设置选中游戏
//         public setSelectedGameID(_gameID:string){
//             let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//             cacheMgr.set(G2CacheMgr.CACHE_ID_ACCOUNT_SELECTED_GAME, _gameID);
//         }
//         /**
//          * 获取当前选中游戏id
//          */
//         public getSelectedGameID():string {
//             return G2CacheMgr.inst().get(G2CacheMgr.CACHE_ID_ACCOUNT_SELECTED_GAME);
//         }
//         // 获取选中游戏对象
//         public getSelectedGameInfo():InfoGameServer {
//             // 定义工具函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`G2AccountMgr.getSelectedGameInfo():${_msg}`);
//             }
//             // 获取accountServerInfo
//             let gameListInfo:InfoGameList = this.getGameListInfo();
//             if(null == gameListInfo){
//                 LOG_ERROR("null gameListInfo.");
//                 return;
//             }
//             let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//             let selectedGameID:string = cacheMgr.get(G2CacheMgr.CACHE_ID_ACCOUNT_SELECTED_GAME);
//             return gameListInfo.getGameServerByID(selectedGameID);
//         }
//         // 获取验证码下一个可用时间
//         public getValidCodeNextAvaliableTime(_usage:number):number {
//             let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//             let table:Dictionary = cacheMgr.get(G2CacheMgr.CACHE_ID_VALID_CODE_NEXT_AVALIABLE_TIME);
//             if(null == table){
//                 return 0;
//             }
//             let time:number = table.get(_usage);
//             if(null == time){
//                 return 0;
//             }
//             return time;
//         }
//         // 设置验证码下一个可用时间
//         public setValidCodeNextAvaliableTime(_usage:number, _time:number) {
//             // 确保容器存在
//             let cacheMgr:G2CacheMgr = G2CacheMgr.inst();
//             let table:Dictionary = cacheMgr.get(G2CacheMgr.CACHE_ID_VALID_CODE_NEXT_AVALIABLE_TIME);
//             if(null == table){
//                 table = new Dictionary();
//                 cacheMgr.set(G2CacheMgr.CACHE_ID_VALID_CODE_NEXT_AVALIABLE_TIME, table);
//             }
//             // 写入
//             table.set(_usage, _time);
//         }
//         // 显示手机绑定对话框
//         public showBindMobileDialog(){
//             let dialog:g2.account.BindMobileDialog = new g2.account.BindMobileDialog();
//             let viewMgr:G2ViewMgr = G2ViewMgr.inst();
//             viewMgr.showDialog(dialog);
//         }
//         // 显示忘记密码对话框
//         public showForgetPasswordDialog() {
//             let dialog:g2.account.ForgetPasswordDialog = new g2.account.ForgetPasswordDialog();
//             let viewMgr:G2ViewMgr = G2ViewMgr.inst();
//             viewMgr.showDialog(dialog);
//         }
//         public isAplTest():boolean {
//             // 获取info
//             let accountInfo:g2.account.InfoAccount = this.getAccountInfo();
//             if(null == accountInfo) {
//                 Log.error("AccountMgr.isAplTest():null accountInfo.");
//                 return false;
//             }
//             // 返回
//             return accountInfo.aplTest;
//         }
//         /**
//          * 
//          */
//         public accountHost():string {
//             return G2HostMgr.inst().host(G2HostMgr.HOST_ACCOUNT);
//         }
//         /**
//          * 显示隐私协议对话框
//          */
//         public showPrivacyView(){
//             // 获取是否已同意隐私协议,如果已同意则不会显示
//             let privacyAgree:boolean = g2.localstorage.LocalStorageMgr.inst().getModel().getPrivacyAgree();
//             if(privacyAgree){
//                 return;
//             }
//             // 显示view
//             let view:g2.account.PrivacyView = new g2.account.PrivacyView();
//             G2ViewMgr.inst().showNode(view, G2ViewMgr.LAYER_DIALOG);
//         }
//         /**
//          * 同意隐私协议
//          */
//         public agreePrivacy(){
//             // 定义错误函数
//             let LOG_ERROR:Function = (_msg:string) => {
//                 Log.error(`AccountMgr.agreePrivacy():${_msg}`);
//             }
//             // 写入localStorage
//             let lsMgr:g2.localstorage.LocalStorageMgr = g2.localstorage.LocalStorageMgr.inst();
//             let model:g2.localstorage.ILocalStorage = lsMgr.getModel();
//             if(null == model) {
//                 LOG_ERROR("null model");
//                 return;
//             }
//             model.setPrivacyAgree(true);
//             lsMgr.save();
//             // 通知native
//             g.appbridge.GAppBridge.send({msgID:GDefine.APP_MSG_AGREE_PRIVACY});
//         }
//     }
// }
//# sourceMappingURL=AccountMgr.js.map