| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- cc.Class({
- extends: cc.BaseClass, // 继承自cc.BaseClass
- properties: {
- m_BtSwitch: cc.Button, // 切换账号按钮
- m_SliderMusic: cc.Node, // 音乐滑块节点
- m_SliderSound: cc.Node, // 音效滑块节点
- m_AgreeNode: cc.Node, // 同意条款节点
- },
- onLoad: function () {
- // 根据是否为H5或微信环境设置切换账号按钮的显示状态
- // this.$('New Node/BtSwitchAcc').active = !cc.share.IsH5_WX();
- },
- OnShowView: function () {
- // 加载设置信息
- window.LoadSetting();
- // 如果音乐控制对象未初始化,则通过$方法获取并初始化
- if (!this.m_CumMusic) this.m_CumMusic = this.$('Music@SettingMusic');
- // 如果音效控制对象未初始化,则通过$方法获取并初始化
- if (!this.m_CumSound) this.m_CumSound = this.$('Sound@SettingSound');
- // 加载音乐设置
- this.m_CumMusic.Load();
- // 加载音效设置
- this.m_CumSound.Load();
- },
- OnBtShowDlg: function () {
- cc.gSoundRes.PlaySound('Button');
- this.ShowPrefabDLG("RoomRules", this.m_DlgNode);
- },
- OnBtSwitchAcc: function () {
- // 播放按钮点击音效
- cc.gSoundRes.PlaySound('Button');
- // 设置重新登录标志
- gReLogin = true;
- // 如果存在切换账号的钩子函数,则调用
- if (this.m_Hook.OnSwitchAcc) this.m_Hook.OnSwitchAcc();
- // 销毁客户端核心对象
- gClientKernel.destory();
- // 切换到启动场景
- ChangeScene('Launch');
- // 关闭俱乐部客户端核心对象
- window.gClubClientKernel.shutdown();
- },
- OnBtExit: function () {
- // 播放按钮点击音效
- cc.gSoundRes.PlaySound('Button');
- // 显示退出游戏确认弹窗
- this.ShowAlert("確認退出遊戲?", Alert_YesNo, function (Res) {
- // 根据用户选择决定是否调用第三方退出游戏函数
- if (Res) ThirdPartyExitGame();
- // 关闭俱乐部客户端核心对象
- window.gClubClientKernel.shutdown();
- });
- },
- OnShowAgreeNode: function () {
- // 播放按钮点击音效
- cc.gSoundRes.PlaySound('Button');
- // 显示用户协议弹窗
- this.ShowPrefabDLG('AgreeMent');
- },
- OnBtShowDiamond: function () {
- cc.gSoundRes.PlaySound('Button');
- this.ShowPrefabDLG("DiamondPolicy");
- },
- //注销
- OnBtShowLogOff: function () {
- cc.gSoundRes.PlaySound('Button');
- this.ShowAlert("清空該帳號信息且無法復原,點擊'確定'則永久刪除帳號!", Alert_All, function (Res) {
- if (Res) {
- console.log("注销----")
- let pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
- let webUrl = window.PHP_HOME + '/UserFunc.php?&GetMark=400&dwUserID=' + pGlobalUserData.dwUserID;
- WebCenter.GetData(webUrl, null, function (res) {
- console.log("删除返回", res)
- let jsonData = JSON.parse(res);
- if (jsonData.Code == "1") {
- console.log("删除成功")
- cc.sys.localStorage.clear();//cc.sys.localStorage.removeItem(key)
- this.ShowAlert('刪除帳戶成功!');
- gReLogin = true;
- // 如果存在切换账号的钩子函数,则调用
- if (this.m_Hook.OnSwitchAcc) this.m_Hook.OnSwitchAcc();
- // 销毁客户端核心对象
- gClientKernel.destory();
- // 切换到启动场景
- ChangeScene('Launch');
- // 关闭俱乐部客户端核心对象
- window.gClubClientKernel.shutdown();
- } else {
- console.log("删除失败")
- this.ShowAlert('刪除帳戶失敗!');
- }
- // if (Login.errcode != null) return this.ShowAlert("ErrCode:" + Login.errcode, Alert_Yes, function () {
- // });
- }.bind(this));
- } else {
- console.log("不注销----")
- }
- }.bind(this));
- },
- });
|