Lobby.js 41 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975
  1. cc.Class({
  2. extends: cc.BaseClass,
  3. properties: {
  4. },
  5. ctor: function () {
  6. this.m_BasicSound = new Array();
  7. this.m_BasicSound['BGM0'] = 'BGM0';
  8. this.m_BasicSound['BGM1'] = 'BGM1';
  9. this.m_BasicSound['BGM2'] = 'BGM2';
  10. this.m_BasicSound['Button'] = 'button';
  11. this.m_BasicSound['SendCard'] = 'sendcard';
  12. this.m_BasicSound['Jet'] = 'Jet';
  13. this.m_ClubRoomCnt = new Array();
  14. },
  15. onEnable: function () {
  16. cc.director.on('Lobby_InitShareInfo', this.OnInitShareInfo, this);
  17. },
  18. onDisable: function () {
  19. cc.director.off('Lobby_InitShareInfo', this.OnInitShareInfo, this);
  20. },
  21. onLoad: function () {
  22. cc.debug.setDisplayStats(false);
  23. FitSize(this.node);
  24. if (!this.m_Loading) this.m_Loading = this.$('loading');
  25. this.m_Loading.zIndex = 100;
  26. this.m_Loading.active = false;
  27. this.m_bTipGPS = false;
  28. window.g_CntGameGPS = 0;
  29. ShowO2I(this.node, 0.5);
  30. window.LoadSetting();
  31. cc.gSoundRes.LoadSoundArr(this.m_BasicSound, 'PublicAudio');
  32. if (cc.share.IsH5_WX()) {
  33. this.$('plazabg/NdButton/MenuBG/BtExit', this.m_MenuNode).active = false;
  34. }
  35. this.onSwitchBG();
  36. },
  37. start: function () {
  38. g_ServerListDataLast = null;
  39. g_ShowClubInfo = null;
  40. this.BindButtonInit();
  41. g_Launch = null;
  42. g_Login = null;
  43. g_Lobby = this;
  44. g_Table = null;
  45. g_CurScene = this;
  46. this.m_DlgNode = this.$('DlgFrame');
  47. this.m_MeUserCtrl = this.$('plazabg/NdButton/UserCtrl@UserCtrl');
  48. this.m_RoomCard = this.$('plazabg/NdButton/BtGetGold/L_RoomCard@Label');
  49. this.m_MenuNode = this.$('plazabg/NdButton/MenuBG');
  50. this.m_MenuNode.active == false;
  51. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  52. if (pGlobalUserData.dwUserID == 0) {
  53. this.ShowLoading();
  54. var AutoLogonAcc = getQueryString("AAcc");
  55. if (AutoLogonAcc) {
  56. window.g_PhpUserName = AutoLogonAcc;
  57. window.g_PhpPassword = getQueryString("APsw");
  58. }
  59. if (window.g_PhpUserName == '') window.g_PhpUserName = null;
  60. getLinkInfo();
  61. this.m_NeedLogin = true;
  62. } else {
  63. this.onGPLoginComplete();
  64. }
  65. if (window.POP_NOTICE > 0 && g_Table == null) {
  66. window.POP_NOTICE = 0;
  67. var ActivityPop = parseInt(cc.sys.localStorage.getItem(window.Key_ActivityPop));
  68. if (!ActivityPop) {
  69. this.scheduleOnce(this.OnClick_BtActivity, 0.5);
  70. } else {
  71. var last = new Date(ActivityPop);
  72. var cur = new Date();
  73. if (last.getFullYear() != cur.getFullYear() || last.getMonth() != cur.getMonth() || last.getDay() != cur.getDay()) {
  74. this.scheduleOnce(this.OnClick_BtActivity, 0.5);
  75. }
  76. }
  77. }
  78. this.scheduleOnce(this.ShowCustomClick, 0.5);
  79. },
  80. loginGiftDiamond: function () {
  81. console.log('loginGiftDiamond')
  82. let pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  83. let webUrl = window.PHP_HOME + '/SignIn.php?&GetMark=2&dwUserID=' + pGlobalUserData.dwUserID;
  84. WebCenter.GetData(webUrl, null, function (data) {
  85. if (data == null) return;
  86. let Res = JSON.parse(data);
  87. console.log('loginGiftDiamond--', Res)
  88. if (Res.RewardCard > 0) {
  89. this.ShowAlert(Res.Desc);
  90. //this.OnShowView(true);
  91. if (Res.Card != null) pGlobalUserData.llUserIngot = Res.Card;
  92. this.m_RoomCard.string = pGlobalUserData.llUserIngot;
  93. }
  94. }.bind(this));
  95. },
  96. ShowCustomClick: function () {
  97. this.loginGiftDiamond();
  98. this.ShowPrefabDLG('CustomClick', this.node, function (Js) {
  99. this.m_CustomClick = Js;
  100. //Js.node.zIndex = -1;
  101. }.bind(this));
  102. },
  103. OnAutoJoinClub: function (kind, allianceID) {
  104. this.ShowPrefabDLG('ClubFreeDLG', this.m_DlgNode, function (Js) {
  105. Js.ShowKind(kind)
  106. Js.AutoJoin(allianceID)
  107. });
  108. },
  109. OnInitShareInfo: function () {
  110. cc.share.InitShareInfo_H5_WX(this.GetShareInfo.bind(this));
  111. },
  112. //登陆成功
  113. onGPLoginComplete: function () {
  114. //播放背景音乐
  115. //var BGMIndex = cc.sys.localStorage.getItem(window.QPName+window.Key_TableBGM);
  116. var BGMIndex = window.g_Setting[window.SetKey_Lobby_Music]
  117. if (BGMIndex == null) BGMIndex = 0
  118. cc.gSoundRes.PlayMusic("BGM" + BGMIndex, false);
  119. //播放背景音乐
  120. this.StopLoading();
  121. //用户数据更新
  122. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  123. this.m_MeUserCtrl.SetUserByID(pGlobalUserData.dwUserID);
  124. this.m_MeUserCtrl.SetShowFullName(false, 6);
  125. this.OnBtRefeshRoomCard();
  126. if (ShowLobbyClub != 0) this.OnBtShowClub();
  127. //邀请链接房间查询
  128. // if(LinkInfo && LinkInfo.LinkRoom && LinkInfo.LinkRoom[0] != 0) {
  129. // this.OnQueryRoom(parseInt(LinkInfo.LinkRoom[0]), parseInt(LinkInfo.LinkRoom[1]));
  130. // }
  131. //微信H5分享链接
  132. if (cc.sys.browserType == cc.sys.BROWSER_TYPE_WECHAT || cc.sys.browserType == cc.sys.BROWSER_TYPE_MOBILE_QQ) {
  133. var ShareInfo = this.GetShareInfo();
  134. ThirdPartyShareMessage(ShareInfo, 0);
  135. ThirdPartyShareMessage(ShareInfo, 1);
  136. }
  137. if (!window.ClubPara) {
  138. var webUrl = window.PHP_HOME + '/League.php?&GetMark=16';
  139. WebCenter.GetData(webUrl, 999999, function (data) {
  140. window.ClubPara = JSON.parse(data);
  141. }.bind(this));
  142. }
  143. this.OnCheckLobbyShow();
  144. // this.m_bNeedUpdate = true;
  145. // this.m_FirstShare = this.m_FirstShareNode.getComponent('FirstShare');
  146. // var lasttime = cc.sys.localStorage.getItem(window.Key_ShareTime);
  147. // if(g_Lobby == null && DifDay(lasttime,new Date().getTime())) this.m_FirstShare.ShowView();
  148. //this.scheduleOnce(this.OnTimer_IDI_QueryParam, 0.001);
  149. cc.director.emit('Lobby_InitShareInfo');
  150. },
  151. OnQueryParam: function () {
  152. //邀请链接-
  153. if (!!!window.inviteRoom) {
  154. window.inviteRoom = cc.share.GetShareParam(cc.share.Type.InviteRoom);
  155. window.inviteClub = cc.share.GetShareParam(cc.share.Type.InviteClub);
  156. console.log('inviteRoom' + window.inviteRoom);
  157. console.log('inviteClub' + window.inviteClub);
  158. if (window.inviteRoom && window.inviteRoom.roomNum) { // 房间查询
  159. this.OnQueryRoom(window.inviteRoom.roomNum, window.inviteRoom.clubID);
  160. } else if (window.inviteClub && window.inviteClub.allianceID > 0) { // 联盟申请
  161. this.OnAutoJoinClub(window.inviteClub.kind, window.inviteClub.allianceID);
  162. ShowLobbyClub = 0;
  163. window.POP_NOTICE = 0;
  164. }
  165. }
  166. if (window.POP_NOTICE > 0 && g_Table == null) {
  167. window.POP_NOTICE = 0;
  168. var ActivityPop = parseInt(cc.sys.localStorage.getItem(window.Key_ActivityPop));
  169. if (!ActivityPop) {
  170. this.scheduleOnce(this.OnClick_BtActivity, 0.5);
  171. } else {
  172. var last = new Date(ActivityPop);
  173. var cur = new Date();
  174. if (last.getFullYear() != cur.getFullYear() || last.getMonth() != cur.getMonth() || last.getDay() != cur.getDay()) {
  175. this.scheduleOnce(this.OnClick_BtActivity, 0.5);
  176. }
  177. }
  178. }
  179. if (ShowLobbyClub != 0) this.OnBtShowClub();
  180. },
  181. GetLobbyShowArr: function () {
  182. var ClickArr = new Array(0, 0, 0, 0, 0, 0);
  183. var value = cc.sys.localStorage.getItem(window.QPName + 'LobbyShow');
  184. if (value != null) ClickArr = JSON.parse(value);
  185. return ClickArr;
  186. },
  187. UpdateLobbyShowArr: function (Index) {
  188. var ClickArr = this.GetLobbyShowArr();
  189. ClickArr[Index] = new Date().getTime();
  190. cc.sys.localStorage.setItem(window.QPName + 'LobbyShow', JSON.stringify(ClickArr));
  191. this.OnCheckLobbyShow();
  192. },
  193. // OnCheckLobbyShow:function(){
  194. // var pGlobalUserData=g_GlobalUserInfo.GetGlobalUserData();
  195. // var webUrl = window.PHP_HOME+'/UserFunc.php?GetMark=28&dwUserID='+pGlobalUserData.dwUserID;
  196. // WebCenter.GetData(webUrl, 3, function (data) {
  197. // var ShowList = JSON.parse(data);
  198. // var ClickArr = this.GetLobbyShowArr();
  199. // var Today = new Date().getTime();
  200. // this.$('plazabg/NdButton/BtRealName/point').active = (ShowList[0]==0 && DifDay(Today, ClickArr[0]));
  201. // // this.$('plazabg/NdButton/FirstGift').active = ShowList[1]==0;
  202. // // this.$('plazabg/NdButton/FirstGift/point').active = (ShowList[1]==0 && DifDay(Today, ClickArr[1]));
  203. // this.$('plazabg/NdButton/BtSign/point').active = (ShowList[2]==0 && DifDay(Today, ClickArr[2]));
  204. // this.$('plazabg/NdButton/BottomButton/BtInviteCode/point').active = (ShowList[3]==1 && DifDay(Today, ClickArr[3]));
  205. // // this.$('plazabg/NdButton/BtBindPhone/point').active = (ShowList[4]==0 && DifDay(Today, ClickArr[4]));
  206. // this.$('plazabg/NdButton/BtMail/point').active = ShowList[5]>0;
  207. // }.bind(this));
  208. // },
  209. OnCheckLobbyShow: function () {
  210. // 获取全局用户数据
  211. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  212. // 构建请求URL,用于获取用户在大厅的显示信息
  213. var webUrl = window.PHP_HOME + '/UserFunc.php?GetMark=28&dwUserID=' + pGlobalUserData.dwUserID;
  214. // 调用WebCenter的GetData方法,发送请求并设置回调函数以处理返回的数据
  215. WebCenter.GetData(webUrl, 3, function (data) {
  216. // 将返回的数据解析为JSON对象
  217. var ShowList = JSON.parse(data);
  218. // 获取用户在大厅中按钮的点击时间数组
  219. var ClickArr = this.GetLobbyShowArr();
  220. // 获取当前时间的时间戳
  221. var Today = new Date().getTime();
  222. // 设置实名认证按钮上的红点显示条件:当ShowList[0]为0且从上次点击时间到今天有至少一天的间隔时显示
  223. this.$('plazabg/NdButton/BtRealName/point').active = (ShowList[0] == 0 && DifDay(Today, ClickArr[0]));
  224. // 设置签到按钮上的红点显示条件:当ShowList[2]为0且从上次点击时间到今天有至少一天的间隔时显示
  225. this.$('plazabg/NdButton/BtSign/point').active = (ShowList[2] == 0 && DifDay(Today, ClickArr[2]));
  226. // 设置邀请码按钮上的红点显示条件:当ShowList[3]为1且从上次点击时间到今天有至少一天的间隔时显示
  227. this.$('plazabg/NdButton/BottomButton/BtInviteCode/point').active = (ShowList[3] == 1 && DifDay(Today, ClickArr[3]));
  228. // 设置邮件按钮上的红点显示条件:当ShowList[5]大于0时显示
  229. this.$('plazabg/NdButton/BottomButton/BtMail/point').active = ShowList[5] > 0;
  230. }.bind(this));
  231. },
  232. OnClick_BtBindPhone: function () {
  233. cc.gSoundRes.PlaySound('Button');
  234. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  235. var webUrl = window.PHP_HOME + '/UserFunc.php?GetMark=19&dwUserID=' + pGlobalUserData.dwUserID;
  236. WebCenter.GetData(webUrl, 3, function (data) {
  237. if (data == "") {
  238. this.ShowPrefabDLG('BindPhone', this.m_DlgNode);
  239. this.UpdateLobbyShowArr(4);
  240. } else {
  241. this.ShowAlert('您已綁定過手機!');
  242. }
  243. }.bind(this));
  244. },
  245. OnClick_BtSignIn: function () {
  246. cc.gSoundRes.PlaySound('Button');
  247. this.ShowPrefabDLG('Sign', this.m_DlgNode);
  248. this.UpdateLobbyShowArr(2);
  249. },
  250. OnClick_BtFirstBuy: function () {
  251. cc.gSoundRes.PlaySound('Button');
  252. this.ShowPrefabDLG('FirstBuy', this.m_DlgNode);
  253. this.UpdateLobbyShowArr(1);
  254. },
  255. GetShareInfo: function () {
  256. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  257. var ShareInfo = new Object();
  258. ShareInfo.title = `玩遊戲看這裡!`;
  259. ShareInfo.desc = `我和我身邊的朋友都在玩的競技平臺,快來一展身手!`;
  260. ShareInfo.imgUrl = `${window.PHP_HOME}/share.jpg`;
  261. ShareInfo.link = cc.share.MakeLink_Lobby();
  262. return ShareInfo;
  263. },
  264. OnClick_BtRealName: function () {
  265. cc.gSoundRes.PlaySound('Button');
  266. return;
  267. //提交
  268. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  269. var webUrl = window.PHP_HOME + '/UserFunc.php?GetMark=17&dwUserID=' + pGlobalUserData.dwUserID;
  270. this.ShowLoading();
  271. WebCenter.GetData(webUrl, null, function (data) {
  272. this.StopLoading();
  273. if (data == 1) return this.ShowAlert("無需重複認證!");
  274. this.ShowPrefabDLG('RealAuth', this.m_DlgNode);
  275. this.UpdateLobbyShowArr(0);
  276. }.bind(this));
  277. },
  278. //购买钻石按钮
  279. onClick_Bt_stone: function () {
  280. cc.gSoundRes.PlaySound('Button');
  281. this.ShowPrefabDLG("DiamondPolicy");
  282. //this.OnBtMoreStrong();
  283. return
  284. //提示信息
  285. this.ShowAlert("購買鑽石請聯系客服或代理.");
  286. },
  287. //商城按钮点击事件
  288. onClick_Bt_shop: function () {
  289. cc.gSoundRes.PlaySound('Button');
  290. //提示信息
  291. this.ShowAlert("請聯系客服微訊號:" + window.WX_SERVICE, Alert_Yes, function () {
  292. ThirdPartyCopyClipper(window.WX_SERVICE);
  293. this.ShowTips('已複製到剪貼簿')
  294. }.bind(this));
  295. },
  296. //显示商城
  297. OnBtMoreStrong: function () {
  298. cc.gSoundRes.PlaySound('Button');
  299. var self = this;
  300. self.ShowPrefabDLG('PayCountPre', self.m_DlgNode, function (Js) {
  301. Js.SetData();
  302. });
  303. return
  304. var webUrl = window.PHP_HOME + '/UserFunc.php?&GetMark=5&dwUserID=';
  305. this.ShowLoading();
  306. WebCenter.GetData(webUrl, 99999, function (data) {
  307. self.StopLoading();
  308. if (data == '') return;
  309. var res = JSON.parse(data);
  310. self.ShowPrefabDLG('PayCountPre', self.m_DlgNode, function (Js) {
  311. Js.SetData(res);
  312. });
  313. });
  314. },
  315. //商品购买按钮点击事件
  316. onClick_Buy_Good: function () {
  317. cc.gSoundRes.PlaySound('Button');
  318. let goodInfo = {
  319. itemID: "coin_99"
  320. };
  321. ThirdPartyBuyGood(JSON.stringify(goodInfo));
  322. },
  323. //设置按钮点击事件
  324. onClick_Bt_shezhi: function () {
  325. cc.gSoundRes.PlaySound('Button');
  326. this.ShowPrefabDLG('Setting', this.m_DlgNode);
  327. },
  328. //金币场入口
  329. SendTypeQuery: function (wKindID, wTypeID) {
  330. this.ShowLoading();
  331. //cc.log(wKindID,wTypeID)
  332. wKindID = 40107
  333. wTypeID = 1
  334. //预加载
  335. // cc.gPreLoader.LoadByGame(wKindID);
  336. var QueryT = new CMD_GP_C_Query_ByType();
  337. QueryT.wKindID = wKindID;
  338. QueryT.wType = wTypeID;
  339. QueryT.dwUserID = g_GlobalUserInfo.GetGlobalUserData().dwUserID;
  340. var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_QUERY_BYTYPE, QueryT);
  341. },
  342. //查询回连
  343. SendReLinkQuery: function () {
  344. //this.ShowLoading();
  345. var QueryRL = new CMD_GP_C_Relink();
  346. QueryRL.dwUserID = g_GlobalUserInfo.GetGlobalUserData().dwUserID;
  347. var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_QUERY_RELINK, QueryRL);
  348. },
  349. //创建&加入失败信息
  350. OnQueryFailed: function (FailedRes) {
  351. this.StopLoading();
  352. this.ShowTips(FailStr[FailedRes.byRes]);
  353. },
  354. //进入服务器信息
  355. OnQueryServerRes: function (ReturnServer) {
  356. this.StopLoading();
  357. if (ReturnServer.wKindID == 0) return
  358. if (!this.BeLoadRes(ReturnServer.wKindID)) return;
  359. g_ServerListDataLast = new CGameServerItem();
  360. g_ServerListDataLast.wKindID = ReturnServer.wKindID;
  361. g_ServerListDataLast.wServerPort = ReturnServer.wServerPort;
  362. g_ServerListDataLast.szServerAddr = ReturnServer.szServerAddr;
  363. g_ServerListDataLast.wServerType = ReturnServer.wServerType;
  364. g_ServerListDataLast.llEnterScore = ReturnServer.llEnterScore;
  365. g_ServerListDataLast.szServerName = "";
  366. if (ReturnServer.byTipsReturn) {
  367. var game = window.GameList[ReturnServer.wKindID];
  368. if (game == null) game = ReturnServer.wKindID;
  369. this.ShowAlert('您已在遊戲 ' + game + ' 內,點擊確定回到遊戲!', Alert_YesNo, 'EnterGameScene', this)
  370. } else {
  371. this.EnterGameScene(1);
  372. }
  373. },
  374. OnQueryRoomRes: function (ReturnServer) {
  375. this.StopLoading();
  376. if (ReturnServer.wKindID == 0) return
  377. if (!this.BeLoadRes(ReturnServer.wKindID)) return;
  378. g_ServerListDataLast = new CGameServerItem();
  379. g_ServerListDataLast.wKindID = ReturnServer.wKindID;
  380. g_ServerListDataLast.wServerPort = ReturnServer.wServerPort;
  381. g_ServerListDataLast.szServerAddr = ReturnServer.szServerAddr;
  382. g_ServerListDataLast.wServerType = ReturnServer.wServerType;
  383. g_ServerListDataLast.llEnterScore = ReturnServer.llEnterScore;
  384. g_ServerListDataLast.szServerName = "";
  385. window.g_dwRoomID = ReturnServer.dwRoomID;
  386. window.g_dwClubID = ReturnServer.dwClubID;
  387. //this.ShowLoading();
  388. this.EnterGameScene(1);
  389. },
  390. //游戏入口
  391. EnterGameScene: function (Res) {
  392. // 加载游戏
  393. if (Res && g_ServerListDataLast) {
  394. if (window.LOG_NET_DATA) console.log("地址:", g_ServerListDataLast.szServerAddr + ":" + g_ServerListDataLast.wServerPort);
  395. this.$('plazabg').active = false;
  396. this.$('DlgFrame').active = false;
  397. this.m_Loading.active = true;
  398. this.ShowPrefabDLG("UpdateManager", this.m_Loading, function (Js) {
  399. Js.StartPreload(0, g_ServerListDataLast.wKindID, function () {
  400. cc.gPreLoader.LoadRes(`Image_BG_BG${GameDef.BGIndex}`, '' + GameDef.KIND_ID, function (res) {
  401. window.gGameBG = 'loading';
  402. ChangeScene('Table');
  403. }.bind(this));
  404. }.bind(this));
  405. }.bind(this));
  406. }
  407. },
  408. //游戏资源预加载
  409. BeLoadRes: function (wKindID) {
  410. if (this.OnCheckGame(wKindID)) return false;
  411. try {
  412. //游戏自定义
  413. GameDef = new window['CMD_GAME_' + wKindID]();
  414. if (GameDef == null) {
  415. var game = window.GameList[wKindID];
  416. if (game == null) game = wKindID;
  417. this.ShowTips("本地沒有遊戲 " + game);
  418. return false;
  419. }
  420. //游戏桌布
  421. window.gGameBG = 'loading';
  422. window.LoadSetting();
  423. window.LoadSetting(wKindID);
  424. var pathInfo = window.Path_GameBG(wKindID, window.g_GameSetting[wKindID][window.SetKey_Table_BG], 0, true);
  425. GameDef.BGIndex = pathInfo.BGIndex;
  426. GameDef.BGPath = pathInfo.path;
  427. } catch (error) {
  428. this.ShowAlert("遊戲資源出錯!" + error);
  429. return false;
  430. }
  431. return true;
  432. },
  433. //显示战绩
  434. OnBtShowRecord: function () {
  435. cc.gSoundRes.PlaySound('Button');
  436. this.ShowLoading();
  437. this.ShowPrefabDLG('GameRecord', this.m_DlgNode);
  438. },
  439. //分享信息
  440. GetShareTex: function () {
  441. var TexUrl = window.PHP_HOME + '/app01/ShareRes.jpg'
  442. return TexUrl;
  443. },
  444. /////////////////////////////////////////////////////////////////////////房间
  445. //创建房间
  446. OnBtCreatRoom: function () {
  447. if (window.isAppVerSame() == false) {
  448. this.ShowAlert("請去下載最新的版本");
  449. return;
  450. }
  451. cc.gSoundRes.PlaySound('Button');
  452. // this.ShowPrefabDLG('CreateRoom', this.m_DlgNode);
  453. this.ShowPrefabDLG('SelectGame', this.m_DlgNode, function (Js) {
  454. Js.OnSetRoomType(0);
  455. }.bind(this));
  456. },
  457. //加入房间
  458. OnBtJoinRoom: function () {
  459. if (window.isAppVerSame() == false) {
  460. this.ShowAlert("請去下載最新的版本");
  461. return;
  462. }
  463. cc.gSoundRes.PlaySound('Button');
  464. this.SendReLinkQuery();
  465. this.ShowPrefabDLG('JoinRoom', this.m_DlgNode);
  466. },
  467. //俱乐部
  468. OnClick_BtClubMore: function (Tag, Kind) {
  469. if (window.isAppVerSame() == false) {
  470. this.ShowAlert("請去下載最新的版本");
  471. return;
  472. }
  473. cc.gSoundRes.PlaySound('Button');
  474. this.ShowPrefabDLG('ClubFreeDLG', this.m_DlgNode, function (Js) {
  475. Js.ShowKind(Kind)
  476. });
  477. },
  478. //俱乐部
  479. OnBtShowClub: function () {
  480. if (window.isAppVerSame() == false) {
  481. this.ShowAlert("請去下載最新的版本");
  482. return;
  483. }
  484. if (window.g_GlobalClubInfo.onGetClubInfoList().length > 0) {
  485. this.ShowPrefabDLG('ClubDLG', this.m_DlgNode, function (Js) {
  486. this.m_ClubCtrl = Js;
  487. Js.OnChangeClub(window.g_GlobalClubInfo.onGetClubInfo(ShowLobbyClub));
  488. }.bind(this));
  489. }
  490. },
  491. OnChangeClub: function (ClubInfo) {
  492. cc.gSoundRes.PlaySound('Button');
  493. ShowLobbyClub = ClubInfo.dwClubID;
  494. this.ShowPrefabDLG('ClubDLG', this.m_DlgNode, function (Js) {
  495. this.m_ClubCtrl = Js;
  496. Js.OnChangeClub(ClubInfo);
  497. }.bind(this));
  498. },
  499. OnBtShowTurntable: function () {
  500. if (window.isAppVerSame() == false) {
  501. this.ShowAlert("請去下載最新的版本");
  502. return;
  503. }
  504. cc.gSoundRes.PlaySound('Button');
  505. this.ShowPrefabDLG('TurnTable', this.m_DlgNode, function (Js) {
  506. Js.ShowView();
  507. }.bind(this));
  508. },
  509. OnShowLeague: function () {
  510. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  511. var self = this;
  512. var webUrl = window.PHP_HOME + '/League.php?&GetMark=15&dwUserID=' + pGlobalUserData.dwUserID;
  513. this.ShowLoading();
  514. WebCenter.GetData(webUrl, null, function (data) {
  515. self.StopLoading();
  516. var LeagueInfo = JSON.parse(data);
  517. if (LeagueInfo.LeagueID == null) {
  518. self.ShowPrefabDLG('LeagueFreeDLG-V', self.m_DlgNode);
  519. } else {
  520. self.ShowPrefabDLG('LeagueDLG-V', self.m_DlgNode, function (Js) {
  521. self.m_LeagueCtrl = Js;
  522. });
  523. }
  524. });
  525. },
  526. OnBtShowDlg: function (Tag, Data) {
  527. cc.gSoundRes.PlaySound('Button');
  528. this.ShowPrefabDLG(Data, this.m_DlgNode);
  529. },
  530. //加入房间
  531. OnQueryRoom: function (RoomNum, ClubID) {
  532. if (LinkInfo && LinkInfo.LinkRoom) LinkInfo.LinkRoom[0] = 0;
  533. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  534. var QueryGR = new CMD_GP_C_GetRoom();
  535. QueryGR.dwUserID = g_GlobalUserInfo.GetGlobalUserData().dwUserID;
  536. QueryGR.dwRoomID = parseInt(RoomNum);
  537. QueryGR.dwClubID = parseInt(ClubID);
  538. //var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_JOIN_ROOM, QueryGR);
  539. window.gClubClientKernel.OnSendJoinRoom(this, QueryGR);
  540. },
  541. //创建房间
  542. OnCreateRoom: function (wKindID, RulesArr, ServerRules, Name) {
  543. if (this.OnCheckGame(wKindID)) return
  544. //this.ShowLoading();
  545. var QueryGR = new CMD_GP_C_CreateRoom();
  546. QueryGR.dwUserID = g_GlobalUserInfo.GetGlobalUserData().dwUserID;
  547. QueryGR.wKindID = wKindID;
  548. for (var i = 0; i < 5; i++) {
  549. if (RulesArr[i] == null) RulesArr[i] = 0;
  550. QueryGR.dwRules[i] = RulesArr[i];
  551. }
  552. QueryGR.dwServerRules = ServerRules;
  553. QueryGR.szRoomName = Name;
  554. window.gClubClientKernel.OnSendCreateRoom(this, QueryGR);
  555. //var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_CREATE_ROOM, QueryGR);
  556. },
  557. OnCreatRoomRes: function (RoomSuc) {//CMD_GP_S_CreatSuccess
  558. this.ShowPrefabDLG('RoomRes', this.m_DlgNode, function (Js) {
  559. Js.OnShowData(RoomSuc.dwRoomID, RoomSuc.dwClubID, RoomSuc.wKindID);
  560. }.bind(this));
  561. },
  562. //查询占用钻石
  563. OnGetUsingCard: function () {
  564. this.ShowLoading();
  565. var QueryUC = new CMD_GP_C_Query_UsingCard();
  566. QueryUC.dwUserID = g_GlobalUserInfo.GetGlobalUserData().dwUserID;
  567. var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_QUERY_W_ROOMCARD, QueryUC);
  568. },
  569. //赠送钻石校验
  570. OnSendCardQuery: function (lUsingCard) {
  571. this.m_SendCardCtrl.SetUsingCard(lUsingCard);
  572. },
  573. OnClick_BtActivity: function () {
  574. cc.gSoundRes.PlaySound('Button');
  575. this.ShowPrefabDLG('Activity', this.m_DlgNode, function (Js) {
  576. Js.OnShowData(0, 0);
  577. }.bind(this));
  578. },
  579. /////////////////////////////////////////////////////////////////////////
  580. OnMsgRes: function (Msg) {
  581. this.StopLoading();
  582. WebCenter.SetDataOutTime('GetMark=10');//上下分 更新
  583. this.ShowAlert(Msg, Alert_Yes, function (Res) {
  584. if (this.m_ClubCtrl) this.m_ClubCtrl.OnShowView(true);
  585. }.bind(this));
  586. },
  587. /////////////////////////////////////////////////////////////////////////
  588. OnBtRefeshRoomCard: function () {
  589. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  590. var webUrl = window.PHP_HOME + '/UserFunc.php?&GetMark=5&dwUserID=' + pGlobalUserData.dwUserID;
  591. WebCenter.GetData(webUrl, 3, function (data) {
  592. var res = JSON.parse(data);
  593. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  594. if (res.UserMedal != null) pGlobalUserData.llUserIngot = res.UserMedal;
  595. this.m_RoomCard.string = pGlobalUserData.llUserIngot;
  596. }.bind(this));
  597. },
  598. /////////////////////////////////////////////////////////////////////////////////////
  599. //游戏单热更 未完成无效接口
  600. OnCheckGame: function (wKindID) {
  601. return false;
  602. if (!cc.sys.isNative || !window.HUversion) return false;
  603. var sub = cc.sys.localStorage.getItem(window.Key_HUKey + wKindID);
  604. if (sub == 'F') return false;
  605. if (sub == null || sub == 'L') {
  606. var UpdatePrefab = cc.instantiate(this.m_UpdatePrefab);
  607. var Update = UpdatePrefab.getComponent('UpdatePrefab');
  608. this.node.addChild(UpdatePrefab);
  609. Update.CheckUpdate(wKindID);
  610. return true;
  611. }
  612. },
  613. //首次登录分享赠送相关
  614. CheckFirstShare: function () {
  615. this.m_bChecking = true;
  616. },
  617. CheckShareFunc: function () {
  618. //cc.sys.localStorage.setItem(window.Key_ShareTime, new Date().getTime());
  619. //if(this.m_bChecking == null) return
  620. this.m_bChecking = null
  621. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  622. var webUrl = window.PHP_HOME + '/UserFunc.php?&GetMark=10&dwUserID=' + pGlobalUserData.dwUserID;
  623. WebCenter.GetData(webUrl, 0, function (data) {
  624. var res = JSON.parse(data);
  625. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  626. if (res.RoomCard != null) pGlobalUserData.llUserIngot = res.RoomCard;
  627. this.m_RoomCard.string = pGlobalUserData.llUserIngot;
  628. // this.m_FirstShare.HideView();
  629. }.bind(this));
  630. },
  631. //游戏回放
  632. OnRePlayGame: function (RecordID, KindID, LookUser, Progress) {
  633. if (!this.BeLoadRes(KindID)) return;
  634. this.ShowPrefabDLG('GameRePlay', this.node, function (Js) {
  635. this.m_GameRePlay = Js;
  636. if (this.m_GameRePlay.LoadGameRes(KindID)) {
  637. this.m_GameRePlay.LoadRePlayData(LookUser, RecordID, Progress);
  638. } else {
  639. this.$('plazabg').active = false;
  640. this.$('DlgFrame').active = false;
  641. this.m_Loading.active = true;
  642. this.ShowPrefabDLG("UpdateManager", this.m_Loading, function (Js) {
  643. Js.StartPreload(0, KindID, function () {
  644. cc.gPreLoader.LoadRes(`Image_BG_BG${GameDef.BGIndex}`, '' + GameDef.KIND_ID, function (res) {
  645. window.gGameBG = 'loading';
  646. this.$('plazabg').active = true;
  647. this.$('DlgFrame').active = true;
  648. this.m_Loading.active = false;
  649. this.ShowPrefabDLG('GameRePlay', this.node, function (Js1) {
  650. if (Js1.LoadGameRes(KindID) == false) {
  651. Js1.OnDestroy();
  652. this.ShowAlert('遊戲暫不支持重播!');
  653. return
  654. }
  655. Js1.LoadRePlayData(LookUser, RecordID, Progress);
  656. }.bind(this))
  657. }.bind(this));
  658. }.bind(this));
  659. }.bind(this));
  660. }
  661. }.bind(this))
  662. },
  663. ///////////////////////////////////////////////////////////////////////////////////////绑定邀请码
  664. //检查代理绑定
  665. OnBtNewPlayer: function () {
  666. cc.gSoundRes.PlaySound('Button');
  667. var pUserInfo = g_GlobalUserInfo.GetGlobalUserData();
  668. var webUrl = window.PHP_HOME + '/UserFunc.php?GetMark=15&dwUserID=' + pUserInfo.dwUserID;
  669. webUrl += '&LogonPass=' + pUserInfo.szPassword;
  670. if (this.m_CheckNewPlayer == null) this.m_CheckNewPlayer = 0;
  671. var self = this;
  672. this.ShowLoading();
  673. WebCenter.GetData(webUrl, this.m_CheckNewPlayer, function (data) {
  674. self.m_CheckNewPlayer = 999999;
  675. self.StopLoading();
  676. var UserInfo = JSON.parse(data);
  677. if (UserInfo.Status == null) return
  678. if (1 == UserInfo.Status) {
  679. self.UpdateLobbyShowArr(3);
  680. self.ShowPrefabDLG('NewPlayer', self.m_DlgNode, function (Js) {
  681. self.m_NewPlayer = Js;
  682. });
  683. } else {
  684. self.ShowAlert("您已經完成了綁定!");
  685. }
  686. });
  687. },
  688. OnBtUnFinished: function () {
  689. this.ShowAlert("敬請期待!");
  690. },
  691. LoginAccount: function (Account, Password) {
  692. gReLogin = false;
  693. var LogonAccounts = new CMD_GP_LogonAccounts();
  694. LogonAccounts.dwPlazaVersion = cc.VERSION_PLAZA;
  695. LogonAccounts.szAccounts = Account
  696. LogonAccounts.szPassword = Password;
  697. LogonAccounts.szPassPortID = "no";
  698. var LoginMission = new CGPLoginMission(this, MDM_GP_LOGON, SUB_GP_LOGON_ACCOUNTS, LogonAccounts);
  699. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  700. pGlobalUserData.szPassword = LogonAccounts.szPassword;
  701. cc.sys.localStorage.setItem('LoginAcc', Account);
  702. cc.sys.localStorage.setItem('LoginPswT', Password);
  703. },
  704. onGPLoginSuccess: function () { },
  705. //登陆成功
  706. onGetServerListFinish: function () { },
  707. //登录失败
  708. onGPLoginFailure: function (szDescription) {
  709. this.StopLoading();
  710. //提示信息
  711. this.ShowAlert(szDescription, Alert_Yes);
  712. },
  713. OnWXErr: function (err) {
  714. this.ShowAlert('OnWXErr ' + err)
  715. },
  716. //个人信息
  717. OnBtnSelfInfo: function () {
  718. cc.gSoundRes.PlaySound("Button");
  719. // this.m_bTipGPS = true;
  720. // Gps暂时未使用
  721. this.OnBtRefeshRoomCard();
  722. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  723. var Addr = g_GlobalUserInfo.GetUserAddress(pGlobalUserData.dwUserID);
  724. if (Addr.berror) {
  725. if (cc.sys.isNative) {
  726. // ThirdPartyGetAddress(1); //获取地址先关闭
  727. } else {
  728. // var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  729. // g_GlobalUserInfo.SetUserAddress(pGlobalUserData.dwUserID, 'H5登录暂时无法获取信息!', false);
  730. // this.scheduleOnce(function(){
  731. // this.UpdateGPS('{"berror":false,"longitude": 123.434104,"latitude": 41.814169,"code": 0,"address": "沈阳市","msg": "success"}');
  732. // }.bind(this),1);
  733. this.UpdateGPS('{"berror":false,"longitude": 123.434104,"latitude": 41.814169,"code": 0,"address": "臺北市","msg": "success"}');
  734. }
  735. }
  736. this.ShowPrefabDLG('SelfInfo', this.m_DlgNode, function (Js) {
  737. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  738. Js.SetInfo(pGlobalUserData.dwUserID, pGlobalUserData.szClientIP, pGlobalUserData.llUserIngot);
  739. this.m_SelfInfo = Js;
  740. }.bind(this));
  741. },
  742. //菜单列表
  743. OnBtClickedMenu: function () {
  744. // cc.gSoundRes.PlaySound('Button');
  745. this.m_MenuNode.active = !this.m_MenuNode.active;
  746. },
  747. //退出
  748. OnBtClickedExit: function () {
  749. cc.gSoundRes.PlaySound('Button');
  750. this.ShowAlert('確定退出遊戲!', Alert_YesNo, function (Res) {
  751. if (Res) {
  752. gReLogin = true;
  753. gClientKernel.destory();
  754. window.gClubClientKernel.shutdown();
  755. ChangeScene('Launch');
  756. }
  757. })
  758. },
  759. //加入俱乐部
  760. OnBtJoinClub: function () {
  761. this.ShowPrefabDLG('ClubFreeDLG', this.m_DlgNode, function (Js) {
  762. Js.OnBtShowJoin();
  763. }.bind(this))
  764. },
  765. OnClickRoomList: function () {
  766. this.ShowPrefabDLG('RoomList', this.m_DlgNode, function (Js) {
  767. this.m_RoomList = Js;
  768. }.bind(this));
  769. },
  770. ///////////////////////////////////////////////////////////////////////////////////////
  771. OnLoadOwnRoomList: function () {
  772. //房间记录
  773. var OR = new CMD_GP_C_OwnRoom();
  774. OR.dwUserID = g_GlobalUserInfo.GetGlobalUserData().dwUserID;
  775. var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_GET_OWN_ROOM, OR);
  776. },
  777. onOwnRoomList: function (OwnRoom) {//CMD_GP_S_OwnRoomInfo
  778. if (this.m_RoomList && this.m_RoomList.onOwnRoomList) this.m_RoomList.onOwnRoomList(OwnRoom);
  779. },
  780. OnLoadRoomHistory: function () {
  781. //房间记录
  782. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  783. var webUrl = window.PHP_HOME + '/League.php?&GetMark=6&dwUserID=' + pGlobalUserData.dwUserID;
  784. WebCenter.GetData(webUrl, 3, function (data) {
  785. var ClubList = JSON.parse(data);
  786. var GRE = new CMD_GP_C_GetRoomEx();
  787. for (var i = 0; i < 10; i++) {
  788. GRE.dwClubID[i] = 0;
  789. if (ClubList[i]) GRE.dwClubID[i] = ClubList[i].ClubID;
  790. }
  791. var TempStr = cc.sys.localStorage.getItem(window.QPName + 'RoomHistory');
  792. var TempArr = new Array();
  793. if (TempStr) TempArr = JSON.parse(TempStr);
  794. for (var i = 0; i < 40; i++) {
  795. GRE.dwRoomID[i] = 0;
  796. //if(TempArr[i]) GRE.dwRoomID[i]=TempArr[i];
  797. }
  798. var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_GET_ROOMEX, GRE);
  799. }.bind(this));
  800. },
  801. OnQueryLoadRoomHistory: function (ClubList) {
  802. if (!ClubList) return;
  803. var GRE = new CMD_GP_C_GetRoomEx();
  804. for (var i = 0; i < 10; i++) {
  805. GRE.dwClubID[i] = 0;
  806. if (ClubList[i]) GRE.dwClubID[i] = ClubList[i].ClubID;
  807. }
  808. var TempStr = cc.sys.localStorage.getItem(window.QPName + 'RoomHistory');
  809. var TempArr = new Array();
  810. if (TempStr) TempArr = JSON.parse(TempStr);
  811. for (var i = 0; i < 40; i++) {
  812. GRE.dwRoomID[i] = 0;
  813. //if(TempArr[i]) GRE.dwRoomID[i]=TempArr[i];
  814. }
  815. var LoginMission = new CGPLoginMission(this, MDM_GP_GET_SERVER, SUB_GP_GET_ROOMEX, GRE);
  816. },
  817. OnGetRoomExRes: function (Res) {//CMD_GP_C_GetRoomExRes
  818. this.m_RoomArr = Res;
  819. if (this.RoomList && this.RoomList.OnGetRoomExRes) this.RoomList.OnGetRoomExRes(Res);
  820. },
  821. update: function () {
  822. // var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  823. // if (pGlobalUserData.szNickName != this.m_MeUserCtrl.m_LabNick.string) this.m_MeUserCtrl.SetUserByID(pGlobalUserData.dwUserID);
  824. //微信H5 code登录
  825. if (this.m_NeedLogin) {
  826. this.m_NeedLogin = null;
  827. if (window.g_PhpUserName != null) {
  828. this.LoginAccount(window.g_PhpUserName, hex_md5(window.g_PhpPassword));
  829. } else {
  830. var WXCode = getQueryString("code");
  831. var webUrl = window.PHP_HOME + '/UserFunc.php?&GetMark=7&code=' + WXCode;
  832. WebCenter.GetData(webUrl, null, function (data) {
  833. var Login = JSON.parse(data);
  834. if (Login.errcode != null) return this.ShowAlert("ErrCode:" + Login.errcode, Alert_Yes, function () {
  835. ThirdPartyCopyClipper(data)
  836. ThirdPartyExitGame();
  837. });
  838. this.LoginAccount(Login.Accounts, Login.LogonPass);
  839. }.bind(this));
  840. }
  841. }
  842. //显示处理
  843. if (this.m_bNeedUpdate) {
  844. this.m_bNeedUpdate = false;
  845. } else {
  846. return;
  847. }
  848. // if(!this.m_LeagueList){
  849. // this.ShowPrefabDLG('LeagueList', this.m_DlgNode, function(Js){
  850. // this.m_LeagueList = Js;
  851. // this.m_LeagueList.node.zIndex = -1;
  852. // }.bind(this));
  853. // }
  854. // if (cc.sys.isNative) {
  855. // ThirdPartyGetAddress(1);
  856. // } else {
  857. // var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  858. // g_GlobalUserInfo.SetUserAddress(pGlobalUserData.dwUserID, 'H5登录暂时无法获取信息!', false);
  859. // }
  860. },
  861. OnUpdateCard: function (obj) {
  862. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  863. this.m_RoomCard.string = pGlobalUserData.llUserIngot;
  864. },
  865. OnUpload_Success: function () {
  866. this.ShowAlert('上传完成!', Alert_Yes, function (Res) {
  867. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  868. this.m_MeUserCtrl.SetUserByID(pGlobalUserData.dwUserID, true);
  869. if (this.m_SelfInfo && this.m_SelfInfo.node.active && this.m_SelfInfo.OnUpload_Finish) {
  870. this.m_SelfInfo.OnUpload_Finish();
  871. }
  872. if (this['m_JsClubDLG'] && this['m_JsClubDLG'].node.active && this['m_JsClubDLG'].OnUpload_Finish) {
  873. this['m_JsClubDLG'].OnUpload_Finish();
  874. }
  875. }.bind(this));
  876. },
  877. OnUpload_Faild: function () {
  878. this.OnUpload_Success();
  879. },
  880. UpdateGPS: function (Info) {
  881. if (!Info || Info.length <= 0) return
  882. var Obj = JSON.parse(Info);
  883. // if(Obj.berror == true || Obj.code != 0)return this.GetSelfGPSInfo();
  884. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  885. if (Obj.berror === true) g_GlobalUserInfo.SetUserAddress(pGlobalUserData.dwUserID, '用戶運行環境無法準確獲取地理位置!', Obj.berror);
  886. else
  887. g_GlobalUserInfo.SetUserAddress(pGlobalUserData.dwUserID, Obj.address, Obj.berror);
  888. if (this.m_SelfInfo && this.m_SelfInfo.node.active) {
  889. var pGlobalUserData = g_GlobalUserInfo.GetGlobalUserData();
  890. this.m_SelfInfo.SetInfo(pGlobalUserData.dwUserID, pGlobalUserData.szClientIP, pGlobalUserData.llUserIngot);
  891. }
  892. },
  893. onSwitchBG: function (index) {
  894. if (index == null) index = window.g_Setting[window.SetKey_Lobby_BG];
  895. var bg = this.$('plazabg@Sprite');
  896. cc.resources.load("Image/BG/BG" + index, cc.SpriteFrame, function (err, spriteFrame) {
  897. bg.spriteFrame = spriteFrame;
  898. });
  899. },
  900. onBuyGoodCallback() {
  901. this.ShowTips("购买商品成功,获得钻石99个!");
  902. },
  903. });