You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1315 lines
39 KiB

  1. require("luaScript.test")
  2. --主界面
  3. local MainView = class("MainView", cc.UIView)
  4. local PluginConfig = require("preload.PluginConfig")
  5. local targetPlatform = cc.Application:getInstance():getTargetPlatform()
  6. local IS_FIRST_LOGIN = true
  7. local IS_FIRST_TanHongBao = true
  8. local IS_FIRST_Change = true
  9. --openData是json decode后数据
  10. --原来的subGameID和roomid弃用,为了能打开俱乐部,原有的打开方式不变
  11. function MainView:ctor(openData)
  12. MainView.super.ctor(self)
  13. if type(openData) == "number" then
  14. self.openData = {gameId = openData}
  15. else
  16. self.openData = openData
  17. end
  18. self._lastAddressCode = cc.UserDefault:getInstance():getIntegerForKey("address_code_" .. getCurrentPlatform())
  19. self:loadUI()
  20. end
  21. function MainView:loadUI()
  22. local ui = loadUI("res/ui/ui_dating/ui_dating.ui")
  23. self.ui = ui
  24. self:addChild(ui)
  25. self.bgpropid = nil
  26. --设置默认背景
  27. self:setDefaultBG()
  28. end
  29. function MainView:onEnter()
  30. MainView.super.onEnter(self)
  31. setInClubRoom(false)
  32. self:initClubName()
  33. self:initButton()
  34. self:initBottomBar();
  35. -- 版本信息
  36. self:initVersion()
  37. -- 玩家信息
  38. self:initPlayerInfo()
  39. -- 滚动公告
  40. startScrollTips(self.ui.Items.Text, 80, app.user.scroll, self.ui.Items.Layout_Text)
  41. -- 子游戏列表获取成功后更新列表
  42. self:initSubGameList()
  43. self:initOpenClub()
  44. self:initOpenCoin()
  45. self:initOpenMatch()
  46. self:initBindEvent()
  47. self:initTopBar();
  48. -- 请求活动数据
  49. if not isReviewVersion() then
  50. if app.config.ModuleConfig.IsSupportHongBaoKa then
  51. app.php:requestGetActivityInfo()
  52. end
  53. end
  54. --请求茶馆列表数据
  55. app.club_php:requestClubList()
  56. --获取活动数据
  57. if not isReviewVersion() then
  58. self:initActivity()
  59. end
  60. -- 针对审核版本的特殊处理,软著/苹果审核
  61. self:initReviewVersion()
  62. -- 显示项目自己的公告
  63. self:showProjectNotice(IS_FIRST_LOGIN)
  64. self:showForceIdentity();
  65. end
  66. function MainView:initNewWetChat(endCallback)
  67. if tonumber(app.user.authorize) == 0 then
  68. if not app.plugin:isSupportWeiXin() then
  69. logD("未安装【微信】,不需要绑定二次授权")
  70. return;
  71. end
  72. logD("MainView:initNewWetChat()")
  73. --绑定标志
  74. app.user.bindWeiXinTwice = true
  75. PluginConfig.WeiXin = PluginConfig.WeiXinNew
  76. logD(table.tostring(PluginConfig.WeiXin))
  77. --启动登录微信
  78. app.plugin:loginWeiXin()
  79. else
  80. if endCallback then
  81. endCallback()
  82. end
  83. end
  84. --如果是二次授权,去掉队列继续
  85. self:bindEvent(app, "showConfirmDialogNotClose",function ()
  86. if endCallback then
  87. endCallback()
  88. end
  89. end)
  90. end
  91. function MainView:onWetChatBindRequest(event)
  92. local request = event.request
  93. if request then
  94. logD("MainView:onWetChatBindRequest:",table.tostring(request))
  95. self.ui:sendMsg(app.user, "requestBindPhoneNum", request)
  96. end
  97. end
  98. function MainView:onExit()
  99. MainView.super.onExit(self)
  100. IS_FIRST_LOGIN = false
  101. end
  102. -- 软著/苹果审核
  103. function MainView:initReviewVersion()
  104. if not isReviewVersion() then
  105. return
  106. end
  107. -- 左侧按钮全部隐藏
  108. self.ui.Items.Layout_Left:setVisible(false)
  109. end
  110. --初始化是否打开俱乐部界面
  111. function MainView:initOpenClub()
  112. -- 是否打开茶馆大厅
  113. if app.club_php.clubID and app.club_php.clubID > 0 then
  114. local view = import("luaScript.Views.Club.ClubMain"):new();
  115. view:setAnchorPoint(cc.p(0.5, 0.5))
  116. app:showWaitDialog(view)
  117. end
  118. cc.UserDefault:getInstance():setBoolForKey("firstLogin",false)
  119. end
  120. --打开金币场
  121. function MainView:initOpenCoin()
  122. if self.openData and self.openData.isCoin then
  123. local view = import("luaScript.Views.Coin.CoinView"):new(self.openData.gameId,self.openData.gameRule)
  124. view:setAnchorPoint(cc.p(0.5, 0.5))
  125. app:showWaitDialog(view)
  126. end
  127. end
  128. --打开比赛场
  129. function MainView:initOpenMatch()
  130. if self.openData and self.openData.isMatch then
  131. local view = import("luaScript.Views.Match.MatchMainView"):new(self.openData.gameId,self.openData.gameRule)
  132. view:setAnchorPoint(cc.p(0.5, 0.5))
  133. app:showWaitDialog(view)
  134. end
  135. end
  136. --初始化事件绑定
  137. function MainView:initBindEvent()
  138. self:bindEvent(app.user, "onBindResponse", handler(self, self.onPhoneBindResponse))
  139. -- 监听APP从后台回来的消息
  140. logD("MainView add onMainViewLoginSuccessed")
  141. self:bindEvent(app.user, "onMainViewLoginSuccessed" , handler(self, self.onLoginSuccessed))
  142. self:bindEvent(app, "applicationWillEnterForeground" , handler(self, self.onLoginSuccessed))
  143. --收到禁止同桌结果事件
  144. self:bindEvent(app.club , "onClubNotSameDeskResponse" , handler(self , self.onClubNotSameDeskResponse))
  145. --绑定消息通知回调
  146. self:bindEvent(app.club_php , GAME_EVENT.CLUB_INVITE , handler(self , self.onClubIniteEvent))
  147. --整点领取奖励
  148. self:bindEvent(app, "onResponseGetJiangli", handler(self, self.onResponseGetJiangli));
  149. self:bindEvent(app, "onGetHongBaoKaInfoResponse", handler(self, self.onGetHongBaoKaInfoResponse));
  150. --背景发生变化
  151. self:bindEvent(app , "onBagOperateResponse" , handler(self , self.onLoadDTBG));
  152. self:bindEvent(app,"PHP_LGIN_SUCCESSED",handler(self , self.onLoadDTBG))
  153. --注销账号提醒
  154. self:bindEvent(app,"LOGOUT_TIPS",handler(self , self.onLogOutTips))
  155. -- 玩家自行修改地区
  156. self:bindEvent(app, GAME_EVENT.EVENT_CHANGE_ADDRESS, handler(self, self.onEventChangeAddress))
  157. --绑定获取茶馆列表消息
  158. self:bindEvent(app.club_php , GAME_EVENT.CLUB_LIST , handler(self , self.onGetClubResult));
  159. --监听退出,更新按钮信息
  160. self:bindEvent(app , GAME_EVENT.CLUB_MAIN_CLOSE , handler(self , self.onUpdateBtnInfo));
  161. --绑定微信
  162. self:bindEvent(app.user, "onWetChatBindRequest", handler(self, self.onWetChatBindRequest))
  163. end
  164. --初始按钮事件
  165. function MainView:initButton()
  166. -- 点击玩家头像
  167. self.ui.Items.ImageView_Head:registerClick(handler(self, self.onClickPlayerHead))
  168. -- 按钮 - 兑换金币
  169. self.ui.Items.Button_AddGold:registerClick(handler(self, self.OnClickButtonAddGold))
  170. -- 暂不提供兑换金币服务
  171. self.ui.Items.Button_AddGold:setVisible(false)
  172. -- 按钮 -兑换红包券
  173. self.ui.Items.ImageView_HongBao:registerClick(handler(self, self.OnClickButtonAddHB))
  174. self.ui.Items.Button_AddHongBao:registerClick(handler(self, self.OnClickButtonAddHB))
  175. self.ui.Items.Layout_HongBaoKa:setVisible(app.config.ModuleConfig.IsSupportHongBaoKa)
  176. if isReviewVersion() then
  177. self.ui.Items.Layout_HongBaoKa:setVisible(false)
  178. end
  179. -- 按钮 - 向右滑动
  180. self.ui.Items.Button_Right:registerClick(handler(self , self.onClickButtonRight))
  181. self.ui.Items.Button_Right:setVisible(false)
  182. -- 按钮 - 邀请码
  183. self.ui.Items.Button_Yaoqing:registerClick(handler(self , self.onClickButtonInviteCode))
  184. self.ui.Items.Button_Yaoqing:setVisible(false)
  185. -- 按钮 - 绑定手机号码
  186. self.ui.Items.Button_PhoneNum:registerClick(handler(self , self.onClickButtonBindPhone))
  187. self.ui.Items.Button_PhoneNum:setVisible(false)
  188. self:onPhoneBindResponse()
  189. self.ui.Items.Button_daili:registerClick(handler(self, self.onClickButtonDaiLi))
  190. -- 按钮 - 茶馆
  191. self.ui.Items.Button_Club:registerClick(handler(self , self.onClickButtonClub))
  192. self.ui.Items.Button_Club_Join:registerClick(handler(self , self.onClickButtonJoinClub))
  193. self.ui.Items.Button_Club_Show:registerClick(handler(self , self.onEnterClub))
  194. self.ui.Items.Button_Club_Show:setVisible(false)
  195. -- 按钮 - 金币场
  196. self.ui.Items.Button_Gold:registerClick(handler(self , self.onClickButtonGold))
  197. -- 按钮 - 测试
  198. self.ui.Items.Button_test:registerClick(handler(self , self.onClickTest))
  199. self.ui.Items.Button_test:setVisible(isDebug())
  200. --领取现金
  201. self.ui.Items.Button_PrizeCash:registerClick(handler(self , self.onClickPrizeCash))
  202. self.ui.Items.Button_PrizeCash:setVisible(app.config.ModuleConfig.IsSupportInviteNewFriend);
  203. --创建房间
  204. self.ui.Items.Button_Create:registerClick(handler(self , self.onClickMoreGame))
  205. --复制ID
  206. self.ui.Items.Button_copy:registerClick(handler(self , self.onCopyID))
  207. -- 兑换金币
  208. self.ui.Items.ImageView_Gold:setVisible(false)
  209. --按钮 --倒计时
  210. self.ui.Items.ImageView_Daojishi:registerClick(handler(self,self.onClickLingQu))
  211. self:initDaojishi()
  212. self.ui.Items.Button_Back:setVisible(false)
  213. self.ui.Items.Layout_Touch:setVisible(false)
  214. self:initDiamondButtons();
  215. self.ui.Items.Layout__:registerClick(function()
  216. self:onClickButtonDiamondArrow(false);
  217. end)
  218. self.ui.Items.Layout_Top_Right:requestDoLayout();
  219. self.ui.Items.Layout_Top_Right:doLayout();
  220. -- self.ui.Items.Layout_menu:requestDoLayout()
  221. -- self.ui.Items.Layout_menu:doLayout()
  222. self:initMainViewAnimMation();
  223. end
  224. -- ========================================== 专用钻石、房卡 start =======================================================
  225. --- MainView:isOpenSpecialDiamond 专用钻石/房卡
  226. function MainView:isOpenSpecialDiamond()
  227. return false;
  228. end
  229. --- MainView:initDiamondButtons 初始化专用房卡
  230. function MainView:initDiamondButtons()
  231. self.ui.Items.Layout_Diamond:setTouchEnabled(true);
  232. self.ui.Items.Layout_Diamond:setVisible(false)
  233. self.ui.Items.ListView_Game_Diamond:setAutoSize(true)
  234. self.ui.Items.ListView_Game_Diamond:hideAllBar()
  235. self.ui.Items.Button_AddDiamand:setVisible(false)
  236. self.ui.Items.Button_Diamond_Arrow:setVisible(false)
  237. self.ui.Items.Item_Diamond:setVisible(false)
  238. self.ui.Items.Text_Tip:setVisible(false)
  239. local isOpenSpecialDiamond = self:isOpenSpecialDiamond()
  240. self.ui.Items.Button_AddDiamand:setVisible(not isOpenSpecialDiamond)
  241. self.ui.Items.Button_Diamond_Arrow:setVisible(isOpenSpecialDiamond)
  242. if isOpenSpecialDiamond then
  243. -- 开启专用钻石,点击弹出专用钻石框
  244. self.ui.Items.Button_Diamond_Arrow:registerClick(handler(self, self.onClickButtonDiamondArrow));
  245. self.ui.Items.ImageView_Diamand:registerClick(handler(self, self.onClickButtonDiamondArrow));
  246. else
  247. -- 未开启专用钻石,点击进入商城
  248. self.ui.Items.Button_AddDiamand:registerClick(handler(self, self.OnClickButtonAddDiamand))
  249. self.ui.Items.ImageView_Diamand:registerClick(handler(self, self.OnClickButtonAddDiamand))
  250. end
  251. end
  252. --- MainView:onClickButtonDiamondArrow 显示专用钻石
  253. -- @param isShow 是否显示,可选参数
  254. function MainView:onClickButtonDiamondArrow(isShow)
  255. local diamondLayout = self.ui.Items.Layout_Diamond;
  256. if type(isShow) == "boolean" then
  257. diamondLayout:setVisible(isShow);
  258. else
  259. local isVisible = diamondLayout:isVisible();
  260. diamondLayout:setVisible(not isVisible);
  261. if not isVisible then
  262. -- 打开的时候请求数据
  263. app.php:requestDiamondSpecial(handler(self, self.updateGameDiamond));
  264. end
  265. end
  266. end
  267. --- MainView:updateGameDiamond 更新专用钻石
  268. -- @param data = {
  269. -- {gameName ="红中麻将",diamond = 100 },
  270. -- {gameName ="来宾麻将",diamond = 100 },
  271. -- }
  272. function MainView:updateGameDiamond(data)
  273. self.ui.Items.ListView_Game_Diamond:removeAllItems()
  274. if not (data and #data > 0) then
  275. self.ui.Items.Text_Tip:setVisible(true)
  276. return ;
  277. end
  278. self.ui.Items.Text_Tip:setVisible(false)
  279. for k,v in pairs(data) do
  280. local gameConfig = app.serverConfigs.subGameList[v.game_id]
  281. if gameConfig then
  282. local item = self.ui.Items.Item_Diamond:getCopied()
  283. local items = getUIItems(item)
  284. items.Text_Game_Name:setText(gameConfig.gameName)
  285. items.Text_Game_Diamond:setText(v.roomcard)
  286. item:setVisible(true)
  287. self.ui.Items.ListView_Game_Diamond:pushBackCustomItem(item)
  288. end
  289. end
  290. end
  291. -- ========================================== 专用钻石、房卡 end =======================================================
  292. function MainView:setDefaultBG()
  293. if not app.config.ModuleConfig.IsSupportPropShop then
  294. return
  295. end
  296. local bgpid = cc.UserDefault:getInstance():getIntegerForKey("mybgpropid")
  297. if bgpid and bgpid > 99 then
  298. self.bgpropid = bgpid
  299. self.ui.Items.ImageView_BG:loadTexture(string.format("res/ui/zy_dating/dating/dating_di_%d.jpg",bgpid))
  300. end
  301. end
  302. --更换桌面背景
  303. function MainView:onLoadDTBG()
  304. if not app.php.mypropdata then
  305. return
  306. end
  307. local ischange = false
  308. for k,v in pairs(app.php.mypropdata) do
  309. if v.prop_id and v.prop_id >= 200 and v.prop_id < 300 then
  310. self.bgpropid = v.prop_id
  311. cc.UserDefault:getInstance():setIntegerForKey("mybgpropid",self.bgpropid)
  312. cc.UserDefault:getInstance():flush()
  313. self.ui.Items.ImageView_BG:loadTexture(string.format("res/ui/zy_dating/dating/dating_di_%d.jpg",v.prop_id))
  314. ischange = true
  315. end
  316. end
  317. if not ischange then
  318. self.bgpropid = nil
  319. cc.UserDefault:getInstance():setIntegerForKey("mybgpropid",0)
  320. cc.UserDefault:getInstance():flush()
  321. self.ui.Items.ImageView_BG:loadTexture("res/ui/zy_dating/dating/img_dating_bg.jpg") --原来的底图
  322. end
  323. end
  324. ---
  325. -- 初始化顶部工具栏
  326. --
  327. function MainView:initTopBar()
  328. if not app.config.ModuleConfig.IsSupportAddressSelector then
  329. return
  330. end
  331. if isReviewVersion() then
  332. return
  333. end
  334. local AddressSelector = require("luaScript.Views.Main.AddressSelector.AddressSelector")
  335. if AddressSelector and not self.addressSelector then
  336. self.addressSelector = AddressSelector:new(self.ui.Items.Layout_Top_Right)
  337. end
  338. end
  339. --- MainView:initBottomBar 初始化底部工具栏
  340. function MainView:initBottomBar()
  341. if self.bottomBarView then
  342. return ;
  343. end
  344. local BottomBarView = require("luaScript.Views.Main.BottomBar.BottomView");
  345. if BottomBarView then
  346. self.bottomBarView = BottomBarView:new();
  347. self:addChild(self.bottomBarView);
  348. end
  349. end
  350. --- MainView:initMainViewAnimMation 初始化主界面动画
  351. function MainView:initMainViewAnimMation()
  352. -- self:initRechargeViewAnimation();
  353. self:initMoreGameAnimation();
  354. self:initBindPhoneAnimation();
  355. self:initHongBaoKaAnimation();
  356. end
  357. -- --- MainView:initRechargeViewAnimation 初始化商城动画
  358. -- function MainView:initRechargeViewAnimation ()
  359. -- local effect = createAnimationByPlist("res/ui/zy_dating/dating/shop_animation.plist","dt_shangcheng-animation3_%d.png",0,40,0.5)
  360. -- self.ui.Items.Button_ShangCheng:addChild(effect)
  361. -- local size = self.ui.Items.Button_ShangCheng:getContentSize()
  362. -- effect:setPosition(cc.p(size.width/2+20,size.height/2+10))
  363. -- end
  364. --- MainView:initMoreGameAnimation 初始化更多游戏提示动画
  365. function MainView:initMoreGameAnimation ()
  366. local seq = cc.Sequence:create(
  367. cc.ScaleTo:create(0.16,0.95),
  368. cc.ScaleTo:create(0.16,1),
  369. cc.ScaleTo:create(0.16,0.95),
  370. cc.ScaleTo:create(0.16,1),
  371. cc.ScaleTo:create(0.16,0.95),
  372. cc.ScaleTo:create(0.16,1),
  373. cc.DelayTime:create(3.0)
  374. )
  375. self.ui.Items.ImageView_More_Tip:runAction(cc.RepeatForever:create(seq))
  376. end
  377. --- MainView:initBindPhoneAnimation 初始化绑定手机提示动画(送18888红包券)
  378. function MainView:initBindPhoneAnimation ()
  379. if not app.config.ModuleConfig.IsSupportHongBaoKa then
  380. self.ui.Items.ImageView_phone_tip:setVisible(false);
  381. self.ui.Items.Button_PhoneNum:loadTextureNormal("res/ui/zy_dating/dating/btn_phone_old.png", 0);
  382. return ;
  383. end
  384. local seq2 = cc.Sequence:create(
  385. cc.RotateTo:create(0.15,0),
  386. cc.RotateTo:create(0.15,-6),
  387. cc.RotateTo:create(0.16,0),
  388. cc.RotateTo:create(0.16,-6),
  389. cc.DelayTime:create(1.5)
  390. )
  391. self.ui.Items.ImageView_phone_tip:runAction(cc.RepeatForever:create(seq2))
  392. end
  393. --- MainView:initHongBaoKaAnimation 红包券动画
  394. function MainView:initHongBaoKaAnimation ()
  395. local seq2 = cc.Sequence:create(
  396. cc.RotateTo:create(0.05,0),
  397. cc.RotateTo:create(0.05,-6),
  398. cc.RotateTo:create(0.06,0),
  399. cc.RotateTo:create(0.06,6),
  400. cc.RotateTo:create(0.05,0),
  401. cc.RotateTo:create(0.05,-6),
  402. cc.RotateTo:create(0.06,0),
  403. cc.RotateTo:create(0.06,6),
  404. cc.RotateTo:create(0.05,0),
  405. cc.DelayTime:create(1)
  406. )
  407. self.ui.Items.ImageView_HongBaoKa:runAction(cc.RepeatForever:create(seq2))
  408. --整点领取
  409. self.ui.Items.Image_ZhengDianLingQu:runAction(
  410. cc.RepeatForever:create(
  411. cc.Sequence:create(
  412. cc.ScaleTo:create(0.16,0.95),
  413. cc.ScaleTo:create(0.16,1),
  414. cc.ScaleTo:create(0.16,0.95),
  415. cc.ScaleTo:create(0.16,1),
  416. cc.ScaleTo:create(0.16,0.95),
  417. cc.ScaleTo:create(0.16,1),
  418. cc.DelayTime:create(3.0)
  419. )
  420. )
  421. )
  422. end
  423. --监听是否切换到后台
  424. function MainView:onApplicationWillEnterForeground()
  425. -- 请求活动数据
  426. if app.config.ModuleConfig.IsSupportHongBaoKa then
  427. app.php:requestGetActivityInfo()
  428. end
  429. --重新初始化倒计时
  430. self:initDaojishi()
  431. end
  432. function MainView:initDaojishi()
  433. local Text_offtime = self.ui.Items.Text_time
  434. Text_offtime:setText("可领取")
  435. self.singtype = 1 --是否可领取 1 可领取 3不可领取
  436. if not self.actiyData then
  437. self.ui.Items.ImageView_Daojishi:setVisible(false)
  438. return
  439. end
  440. self.ui.Items.ImageView_Daojishi:setVisible(true)
  441. self.singtype = self.actiyData.active
  442. if self.singtype == 1 or self.singtype == 2 then
  443. return
  444. end
  445. if Text_offtime then
  446. Text_offtime:stopAllActions()
  447. Text_offtime:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.CallFunc:create(function()
  448. local curM=tonumber(os.date("%M",os.time()))
  449. local curS=tonumber(os.date("%S",os.time()))
  450. local limit = 3600 - (curM*60 + curS)
  451. Text_offtime:setText(formatTimeToStr(limit))
  452. if limit <= 1 then
  453. Text_offtime:setText("可领取")
  454. self.singtype = 1
  455. Text_offtime:stopAllActions()
  456. else
  457. Text_offtime:setText(formatTimeToStr(limit))
  458. end
  459. end),cc.DelayTime:create(1))))
  460. end
  461. end
  462. -- 初始化游戏版本信息
  463. function MainView:initVersion()
  464. if isReviewVersion() then
  465. self.ui.Items.Layout_Version:setVisible(false)
  466. return
  467. end
  468. self.ui.Items.Text_Type:setVisible(isDebug())
  469. local appVersionNum = getAppVersionNum()
  470. local resVersion = loadVersion()
  471. self.ui.Items.Text_Version:setText("文明游戏,拒绝赌博 "..appVersionNum.."."..resVersion)
  472. end
  473. function MainView:initPlayerInfo()
  474. -- 初始化头像大小
  475. local nodeHeadImage = self.ui.Items.ImageView_Head;
  476. self.head = {}
  477. self.head.width = nodeHeadImage:getContentSize().width
  478. self.head.height = nodeHeadImage:getContentSize().height
  479. logD("self.head = ", table.tostring(self.head));
  480. logD("MainView:initPlayerInfo() userInfo = ", tostring(app.user.userInfo))
  481. local userInfo = json.decode(app.user.userInfo);
  482. -- 昵称
  483. local nickname = getSubStringNickname(userInfo.nickname)
  484. self.ui.Items.Text_Name:setText(nickname or tostring("未知昵称"))
  485. -- ID
  486. local id = tonumber(app.user.loginInfo.uid) or 0
  487. self.ui.Items.Text_ID:setText(string.format("ID:%07d", id))
  488. if app.user.loginInfo.curCardNum then
  489. -- 房卡数量
  490. self.ui.Items.Text_Diamand:bind(app.user.loginInfo, "curCardNum", function()
  491. self.ui.Items.Text_Diamand:setString(tostring(app.user.loginInfo.curCardNum))
  492. end)
  493. end
  494. --金币数量
  495. self.ui.Items.Text_Gold:bind(app.user.loginInfo, "curJingbiNum", function()
  496. local num = tonumber(app.user.loginInfo.curJingbiNum) or 0
  497. num = num + 2000
  498. local str
  499. if num > 100000 then
  500. str = tostring(math.floor(num / 1000) / 10).."W"
  501. else
  502. str = tostring(num)
  503. end
  504. self.ui.Items.Text_Gold:setString(str)
  505. end)
  506. --红包卡数量
  507. self.ui.Items.Text_HongBao:bind(app.user.loginInfo, "curLiquanNum", function()
  508. local strLiquanNum = tonumber(app.user.loginInfo.curLiquanNum)
  509. if strLiquanNum >= 10000 then
  510. local num = string.format("%.2f",app.user.loginInfo.curLiquanNum/10000)
  511. strLiquanNum = ""..num.."万"
  512. end
  513. self.ui.Items.Text_HongBao:setString(tostring(strLiquanNum))
  514. end)
  515. -- 头像
  516. local nodeHead = self.ui.Items.ImageView_Head;
  517. setPlayerHeadImage(app.user.loginInfo.uid, userInfo.headimgurl, nodeHead)
  518. end
  519. -- 初始化活动信息
  520. function MainView:initActivity()
  521. --默认弹出活动界面
  522. self:bindEvent(app, "onGetActivityInfoResponse", handler(self, self.showActivityOnEnter));
  523. -- 分享成功后通知此层关闭分享界面
  524. -- self:bindEvent(app , "shareSuccCallback" , handler(self , self.shareSuccCallback));
  525. --关闭通知界面后弹出活动界面
  526. -- self:bindEvent(app, "onCloseTongZhiSucc", handler(self, self.onCloseTongZhiSucc));
  527. --关闭代理招募后弹出活动界面
  528. -- self:bindEvent(app, "onCloseDaiLiZhaoMu", handler(self, self.onCloseDaiLiZhaoMu));
  529. self:bindEvent(app, GAME_EVENT.ACTIVITY_CLOSE, handler(self, self.onActivityClose));
  530. -- 请求活动数据
  531. app.serverConfigs:requestMissionList()
  532. end
  533. -- 初始化游戏列表
  534. function MainView:initSubGameList()
  535. self:bindEvent(app.serverConfigs, "getSubGameListSuccessed", handler(self, self.updateSubGameList))
  536. self:updateSubGameList()
  537. end
  538. function MainView:updateSubGameList()
  539. local page = self.ui.Items.Layout_Page
  540. page:removeAllChildren()
  541. local regionCode = cc.UserDefault:getInstance():getIntegerForKey("address_code_" .. app.config.RomSetting.Platform)
  542. local gameList = app.serverConfigs:getGameList(regionCode)
  543. if isReviewVersion() then
  544. gameList = self:getSubGameListReview()
  545. end
  546. --logD(table.tostring(gameList))
  547. for i = 1, 10 do
  548. local game = gameList[i]
  549. if game then
  550. if game.gameType=="sub" then
  551. local gameGroupConfig = app.serverConfigs:getGameGroupConfig(game.gameId, regionCode)
  552. if gameGroupConfig then
  553. gameGroupConfig.games = {}
  554. if game.data then
  555. for k,v in ipairs(game.data) do
  556. table.insert(gameGroupConfig.games,v.gameId)
  557. end
  558. end
  559. local uiSubGame = import("luaScript.Views.Main.MainViewGameIconGroup"):new(gameGroupConfig)
  560. page:addChild(uiSubGame.ui)
  561. else
  562. local uiSubGame = import("luaScript.Views.Main.MainViewGameIcon"):new(game.gameId)
  563. page:addChild(uiSubGame.ui)
  564. end
  565. else
  566. local gameGroupConfig = app.serverConfigs:getWebGameGroupConfig(game.gameId)
  567. if gameGroupConfig then
  568. if game.data then
  569. for k,v in ipairs(game.data) do
  570. table.insert(gameGroupConfig.games,v.gameId)
  571. end
  572. end
  573. local uiSubGame = import("luaScript.Views.Main.MainViewGameIconGroup"):new(gameGroupConfig)
  574. page:addChild(uiSubGame.ui)
  575. else
  576. local isInGroup = app.serverConfigs:isWebGameInGroup(game.gameId)
  577. if not isInGroup then
  578. -- 如果已经在合集里了,就不再显示了
  579. self:createWebGameItem(game)
  580. end
  581. end
  582. end
  583. end
  584. end
  585. end
  586. function MainView:createWebGameItem(webGame)
  587. local gameLayout = cc.Layout:create()
  588. gameLayout:setSize(cc.size(152,188))
  589. local webGameIcon = cc.ImageView:create()
  590. webGameIcon:setAutoSize(false)
  591. webGameIcon:setSize(cc.size(134,156))
  592. setImageFromUrl(webGameIcon,webGame.icon)
  593. webGameIcon:registerClick(function()
  594. playBtnEffect()
  595. if not app.serverConfigs:isOpenWebGame(webGame.gameId) then
  596. showTooltip("敬请期待!")
  597. return
  598. end
  599. webGameIcon:setTouchEnabled(false)
  600. app.serverConfigs:requestWebGameUrl(webGame.gameId,function (url, orientation)
  601. if webGameIcon and not tolua.isnull(webGameIcon) then
  602. webGameIcon:setTouchEnabled(true)
  603. if not url or url =="" then
  604. showTooltip("敬请期待!")
  605. return
  606. end
  607. local function openWebGame ()
  608. local targetPlatform = cc.Application:getInstance():getTargetPlatform()
  609. if targetPlatform == 3 then
  610. --判断是V开头的手机,一般是VIVO,比如V1901A
  611. local machineType = getLocalizedModel()
  612. if string.find(machineType,"V") == 1 then
  613. local index = string.find(url,"sc")
  614. if index then
  615. local params=string.sub(url,1,index-2)
  616. app.plugin:callUrl(params);
  617. else
  618. app.plugin:callUrl(url);
  619. end
  620. else
  621. logD("lwq_testtest_", webGame.gameId)
  622. if webGame.gameId == 10010 then -- 热爱三国
  623. app.plugin:callUrl(url)
  624. else
  625. local view = import("luaScript.Views.Main.WebViews.WebGameView"):new(webGame.gameId, url, orientation)
  626. view:setAnchorPoint(cc.p(0.5, 0.5))
  627. app:showWaitDialog(view,nil,true)
  628. end
  629. end
  630. else
  631. if webGame.gameId == 10010 then -- 热爱三国
  632. app.plugin:callUrl(url)
  633. else
  634. local view = import("luaScript.Views.Main.WebViews.WebGameView"):new(webGame.gameId, url, orientation)
  635. view:setAnchorPoint(cc.p(0.5, 0.5))
  636. app:showWaitDialog(view,nil,true)
  637. end
  638. end
  639. end
  640. if webGame.gameId == 10006 then
  641. local str = "根据剑荡江湖运营合作计划,公司将于3月10日停服,届时游戏将无法登录。给您带了的不便,深表歉意。点击确定继续游戏。";
  642. showConfirmDialog(str, function ()
  643. openWebGame()
  644. end)
  645. elseif webGame.gameId == 10009 then
  646. if isWin32Platform() then
  647. showTooltip("请在手机上操作")
  648. return
  649. end
  650. app.plugin:callUrl(url);
  651. else
  652. openWebGame()
  653. end
  654. end
  655. end)
  656. end)
  657. if app.serverConfigs:isNewWebGame(webGame.gameId) then
  658. local newIcon = cc.ImageView:create()
  659. newIcon:loadTexture("res/ui/zy_dating/dating/img_newTag.png")
  660. webGameIcon:addChild(newIcon)
  661. newIcon:setPosition(cc.p(40,125))
  662. end
  663. local size = gameLayout:getContentSize()
  664. webGameIcon:setPosition(cc.p(size.width/2,size.height/2))
  665. gameLayout:addChild(webGameIcon)
  666. self.ui.Items.Layout_Page:addChild(gameLayout)
  667. end
  668. -- 进入子游戏
  669. function MainView:onClickSubGame(gameId)
  670. --[[if gameId == GAME_IDS.More or gameId == GAME_IDS.hejiangDaEr then--暂时屏蔽合江大贰
  671. showTooltip("开发中...")
  672. return
  673. end--]]
  674. cc.UserDefault:getInstance():setBoolForKey("firstLogin",false)
  675. -- 打开对应的创建界面
  676. local gameConfig = getSubGameConfig(gameId)
  677. if not gameConfig then
  678. showTooltip("开发中")
  679. return
  680. end
  681. app.gameId = gameId
  682. -- app.subGameManager:saveToFile(gameId)
  683. local gameData = {}
  684. gameData.gameId = gameId
  685. gameData.defaultPlayType = nil
  686. local createView = import("luaScript.Views.CreateRoom.CreateRoomBase"):new(gameData)
  687. createView:setAnchorPoint(cc.p(0.5, 0.5))
  688. app:showWaitDialog(createView)
  689. -- self:updateSubGameList()
  690. end
  691. -- 兑换金币
  692. function MainView:OnClickButtonAddGold()
  693. playBtnEffect()
  694. local view = import("luaScript.Views.Main.ExchangeView"):new()
  695. view:setAnchorPoint(cc.p(0.5, 0.5))
  696. app:showWaitDialog(view)
  697. end
  698. -- 充值房卡
  699. function MainView:OnClickButtonAddDiamand()
  700. playBtnEffect()
  701. local view = import("luaScript.Views.Main.RechargeView"):new(nil,nil,nil,self.bgpropid)
  702. view:setAnchorPoint(cc.p(0.5, 0.5))
  703. app:showWaitDialog(view)
  704. end
  705. --- MainView:onClickLingQu 倒计时领取红包券
  706. function MainView:onClickLingQu()
  707. --已经领取
  708. playBtnEffect()
  709. if self.singtype == 3 then
  710. local view = import("luaScript.Views.Main.HongBaoKa.HongBaoKaSDJLView"):new()
  711. view:setAnchorPoint(cc.p(0.5, 0.5))
  712. app:showWaitDialog(view)
  713. return
  714. end
  715. if not self.actiyData then
  716. return
  717. end
  718. if not app.php.islogin then
  719. return
  720. end
  721. --请求整点奖励
  722. app.php:requestZhengDianJiangli()
  723. self.actiyData.active = 3
  724. --开启倒计时
  725. self:initDaojishi()
  726. end
  727. --- MainView:onResponseGetJiangli 领取奖励回复
  728. -- @param result
  729. function MainView:onResponseGetJiangli(result)
  730. local addNum = result.data.add
  731. --显示获得红包卡动画
  732. local view = import("luaScript.Views.Main.HongBaoKa.GetHongBaoKaEffect"):new(addNum,1)
  733. view:setAnchorPoint(cc.p(0.5, 0.5))
  734. app:showWaitDialog(view, 200, true)
  735. end
  736. --- MainView:onGetHongBaoKaInfoResponse 收到红包券数据
  737. function MainView:onGetHongBaoKaInfoResponse ()
  738. if not app.php.activityData then
  739. return
  740. end
  741. self.actiyData = app.php.activityData[""..11]
  742. --再初始化一遍时间
  743. self:initDaojishi()
  744. end
  745. --兑换红包卡
  746. function MainView:OnClickButtonAddHB()
  747. playBtnEffect()
  748. local view = import("luaScript.Views.Main.HongBaoKa.MainHongBaoKaView"):new()
  749. view:setAnchorPoint(cc.p(0.5, 0.5))
  750. app:showWaitDialog(view)
  751. end
  752. --活动分享成功
  753. function MainView:shareSuccCallback()
  754. if (not tolua.isnull(self.activityshareview)) then
  755. self.activityshareview:removeFromParent()
  756. self.activityshareview = nil
  757. end
  758. end
  759. -- 设置
  760. function MainView:onClickButtonEmail()
  761. playBtnEffect()
  762. showTooltip("开发中...")
  763. end
  764. -- 快速开始
  765. function MainView:onClickButtonStart()
  766. playBtnEffect()
  767. local view = import("luaScript.Views.Main.JoinRoomView"):new()
  768. view:setAnchorPoint(cc.p(0.5, 0.5))
  769. app:showWaitDialog(view)
  770. --从大厅进入游戏时清空保存的茶馆id及桌子下标
  771. app.club_php.clubID = 0;
  772. app.club_php.tableIdx = 0
  773. if cc.Application:getInstance():getTargetPlatform() == 0 then
  774. showTooltip("PC版快速进入房间")
  775. view:onClickTest();
  776. end
  777. end
  778. -- 向右滑动
  779. function MainView:onClickButtonRight()
  780. self.ui.Items.ScrollView:scrollBy(cc.p(-480,0),0.5,true)
  781. end
  782. -- 邀请码
  783. function MainView:onClickButtonInviteCode()
  784. playBtnEffect()
  785. local view = import("luaScript.Views.Main.InviteCodeView"):new()
  786. view:setAnchorPoint(cc.p(0.5, 0.5))
  787. app:showWaitDialog(view)
  788. end
  789. -- 绑定手机号
  790. function MainView:onClickButtonBindPhone()
  791. playBtnEffect()
  792. local view = import("luaScript.Views.Main.PhoneBindView"):new()
  793. view:setAnchorPoint(cc.p(0.5, 0.5))
  794. app:showWaitDialog(view)
  795. end
  796. function MainView:onClickButtonDaiLi()
  797. playBtnEffect()
  798. local view = import("luaScript.Views.Main.DaiLiView"):new()
  799. view:setAnchorPoint(cc.p(0.5, 0.5))
  800. app:showWaitDialog(view)
  801. end
  802. -- 显示玩家信息的界面
  803. function MainView:onClickPlayerHead()
  804. playBtnEffect()
  805. local view = import("luaScript.Views.Main.MainSettingView"):new()
  806. view:setAnchorPoint(cc.p(0.5, 0.5))
  807. app:showWaitDialog(view)
  808. end
  809. --进入茶馆
  810. function MainView:onEnterClub()
  811. local clubId = self.ui.Items.Button_Club_Show:getTag()
  812. if app.club_php:getCestIsOpen(clubId) then
  813. showTooltip("赛事结束,下一轮敬请期待!")
  814. return
  815. end
  816. --[[local view = import("luaScript.Views.Club.ClubTable"):new(clubId)
  817. view:setAnchorPoint(cc.p(0.5, 0.5))
  818. app:showWaitDialog(view)--]]
  819. -- 是否打开茶馆大厅
  820. app.club_php.clubID = clubId
  821. local view = import("luaScript.Views.Club.ClubMain"):new();
  822. view:setAnchorPoint(cc.p(0.5, 0.5))
  823. app:showWaitDialog(view)
  824. end
  825. -- 茶馆
  826. function MainView:onClickButtonClub()
  827. playBtnEffect()
  828. local view = import("luaScript.Views.Club.ClubMain"):new();
  829. view:setAnchorPoint(cc.p(0.5, 0.5))
  830. app:showWaitDialog(view)
  831. --重新进入茶馆大厅时清空保存的茶馆id及桌子下标
  832. app.club_php.clubID = 0;
  833. app.club_php.tableIdx = 0
  834. cc.UserDefault:getInstance():setBoolForKey("firstLogin",false)
  835. end
  836. -- 茶馆
  837. function MainView:onClickButtonJoinClub()
  838. playBtnEffect()
  839. local view = import("luaScript.Views.Club.ClubJoin"):new()
  840. view:setAnchorPoint(cc.p(0.5, 0.5))
  841. app:showWaitDialog(view)
  842. cc.UserDefault:getInstance():setBoolForKey("firstLogin",false)
  843. end
  844. --获取茶馆列表结果
  845. function MainView:onGetClubResult()
  846. local clubList = app.club_php.clubList
  847. if clubList and table.nums(clubList) > 0 and table.nums(self.operClubList) >= 0 then
  848. -- 排序
  849. local tNewOperTimeList = {}
  850. for clubID,operTime in pairs(self.operClubList) do
  851. tNewOperTimeList[operTime] = clubID;
  852. end
  853. if table.nums(tNewOperTimeList) > 0 then
  854. for time, gid in pairsByKeysEx(tNewOperTimeList) do
  855. local curClub = clubList[tonumber(gid)]
  856. if curClub then
  857. local strClubName = getShortNameByLength(curClub.clubName, 6)
  858. self.ui.Items.Text_clubname:setText(strClubName)
  859. self.ui.Items.Button_Club_Show:setVisible(true)
  860. self.ui.Items.Button_Club_Show:setTag(tonumber(gid))
  861. self.ui.Items.Button_Club_Join:setVisible(false)
  862. break
  863. end
  864. end
  865. else
  866. for k,v in pairsByKeys(clubList) do
  867. self.ui.Items.Button_Club_Show:setVisible(true)
  868. self.ui.Items.Button_Club_Show:setTag(tonumber(v.clubId))
  869. self.ui.Items.Button_Club_Join:setVisible(false)
  870. local strClubName = getShortNameByLength(v.clubName, 6)
  871. if strClubName then
  872. self.ui.Items.Text_clubname:setText(strClubName)
  873. end
  874. break
  875. end
  876. end
  877. else
  878. self.ui.Items.Button_Club_Show:setVisible(false)
  879. self.ui.Items.Button_Club_Join:setVisible(true)
  880. end
  881. end
  882. -- 金币场
  883. function MainView:onClickButtonGold()
  884. playBtnEffect()
  885. if not app.config.ModuleConfig.IsSupportCoin then
  886. showTooltip("敬请期待")
  887. return ;
  888. end
  889. local view = import("luaScript.Views.Coin.CoinView"):new();
  890. view:setAnchorPoint(cc.p(0.5, 0.5));
  891. app:showWaitDialog(view);
  892. end
  893. -- 启动游戏时弹出活动界面
  894. function MainView:showActivityOnEnter()
  895. --如果是亲友圈房间内解散回来,再次打开俱乐部的情况则不弹窗了
  896. if app.club_php.clubID and app.club_php.clubID > 0 then
  897. return
  898. end
  899. --每次登陆弹出通知弹窗
  900. -- local firstLogin = cc.UserDefault:getInstance():getBoolForKey("firstLogin")
  901. if IS_FIRST_LOGIN then
  902. -- if cc.Application:getInstance():getTargetPlatform() ~= 0 then
  903. local viewName = app.serverConfigs:popConfig()
  904. if viewName then
  905. local viewClass = import(viewName)
  906. if viewClass then
  907. -- view存在,正常弹出
  908. execInMainViewQueue(function(endCallback)
  909. local view = viewClass:new(endCallback)
  910. view:setAnchorPoint(cc.p(0.5, 0.5))
  911. app:showWaitDialog(view)
  912. end)
  913. else
  914. -- view不存在,继续弹出下一个窗口
  915. app:dispatchEvent(GAME_EVENT.ACTIVITY_CLOSE)
  916. end
  917. end
  918. -- end
  919. end
  920. end
  921. function MainView:onActivityClose()
  922. local viewName = app.serverConfigs:popConfig()
  923. if viewName then
  924. local view = import(viewName):new()
  925. view:setAnchorPoint(cc.p(0.5, 0.5))
  926. app:showWaitDialog(view)
  927. end
  928. end
  929. function MainView:onLoginSuccessed()
  930. logD("MainView:onMainViewLoginSuccessed()")
  931. local roomId = nil
  932. local code = nil --"9024926188961793" --回放码
  933. local str = copyStringFromClipboard()
  934. logD("MainView:onMainViewLoginSuccessed() str = ", str)
  935. -- showTooltip(str)
  936. --如果第一个是~!开头则代表是浏览器传的参数
  937. if string.find(str,"~!")==1 then
  938. local baseStr=string.sub(str,3,string.len(str))
  939. baseStr=base64.decode(baseStr)
  940. local params=json.decode(decodeURI(baseStr))
  941. dump(params,"MainView:onMainViewLoginSuccessed params")
  942. if params then
  943. logD("do somthing!")
  944. if params.tableId then
  945. roomId = params.tableId
  946. end
  947. if params.code then
  948. code = params.code
  949. end
  950. end
  951. -- return
  952. else
  953. -- 检测玩家剪贴板里面是否有房间号,
  954. --如果有,查询这个房间号对应的游戏ID
  955. --如果没查到则不处理
  956. --如果查到了,则判断游戏是否已安装
  957. --未安装则提示安装,已安装则直接进入
  958. roomId = getRoomIdFromCopyString(str)
  959. end
  960. -- local roomId = getRoomIdFromCopyString(str)
  961. logD("MainView:onMainViewLoginSuccessed() roomId = ", roomId)
  962. if roomId then
  963. local function onQueryRoomResponse(gameId, roomId)
  964. logD("MainView:onQueryRoomResponse() gameId = ", gameId)
  965. logD("MainView:onQueryRoomResponse() roomId = ", roomId)
  966. if not gameId or tonumber(gameId) <= 0 then
  967. return
  968. end
  969. copyStringToClipboard("")
  970. -- 检查这个子游戏是否已安装
  971. if app.subGameManager then
  972. local function requestJoinRoom()
  973. app.hall:requestJoinRoom(gameId, roomId)
  974. end
  975. if not app.subGameManager:isInstaller(gameId) then
  976. requestDownloadSubGame(gameId, requestJoinRoom, true)
  977. else
  978. requestJoinRoom();
  979. end
  980. end
  981. end
  982. app.hall:queryRoomId(tonumber(roomId), onQueryRoomResponse);
  983. end
  984. if code then
  985. copyStringToClipboard("")
  986. local view = import("luaScript.Views.ZhanJi.ZhanJiViewBase"):new(-1,nil,code)
  987. view:setAnchorPoint(cc.p(0.5, 0.5))
  988. app:showWaitDialog(view)
  989. end
  990. --重新初始化倒计时
  991. self:initDaojishi()
  992. end
  993. function MainView:onPhoneBindResponse(event)
  994. local phonenum = app.user.phonenum
  995. if phonenum and phonenum ~= "" then
  996. self.ui.Items.Button_PhoneNum:setVisible(false)
  997. end
  998. logD("MainView:onPhoneBindResponse")
  999. if not event then
  1000. logD("MainView:onPhoneBindResponse not even")
  1001. return
  1002. end
  1003. local response = event.response;
  1004. local errCode = response.ret
  1005. logD("MainView:onPhoneBindResponse errCode:",errCode);
  1006. if errCode == BIND_TYPE_RESULT.WEIXIN or errCode == BIND_TYPE_RESULT.WEIXIN_TWICE_BIND then
  1007. self:initPlayerInfo()
  1008. end
  1009. end
  1010. function MainView:onClickTest()
  1011. local view = import("luaScript.Views.TestView"):new()
  1012. view:setAnchorPoint(cc.p(0.5, 0.5))
  1013. app:showWaitDialog(view)
  1014. end
  1015. function MainView:onClubNotSameDeskResponse(event)
  1016. local playerInfo = json.decode(event.userInfo)
  1017. setIsRoomGamedata(nil)
  1018. local str = string.format("管理员已设置该牌桌 %s 玩家与您禁止同桌!",playerInfo.nickname)
  1019. showConfirmDialog(str)
  1020. end
  1021. function MainView:onClubIniteEvent(event)
  1022. --房间邀请通知
  1023. local content = event.content
  1024. local clubId = event.clubId
  1025. local viewType = type(self.inviteView)
  1026. if self.inviteView and viewType == "userdata" then
  1027. --提示框已存在
  1028. return
  1029. end
  1030. local function closeCallback()
  1031. --关闭提示框时清空数据,用于下次弹出
  1032. self.inviteView = nil
  1033. end
  1034. self.inviteView = import("luaScript.Views.Club.ClubInviteRoomNew"):new(clubId, content, closeCallback)
  1035. self.inviteView:setAnchorPoint(cc.p(0.5, 0.5))
  1036. -- app:showView(self.inviteView)
  1037. app:showWaitDialog(self.inviteView,0)
  1038. end
  1039. function MainView:onClickMoreGame()
  1040. playBtnEffect()
  1041. --showTooltip("开发中...")
  1042. local createView = import("luaScript.Views.CreateRoom.CreateRoomBase"):new()
  1043. createView:setAnchorPoint(cc.p(0.5, 0.5))
  1044. app:showWaitDialog(createView)
  1045. end
  1046. function MainView:onCopyID()
  1047. playBtnEffect()
  1048. copyStringToClipboard(tostring(app.user.loginInfo.uid))
  1049. showTooltip("复制成功!")
  1050. end
  1051. --增加地区按钮
  1052. function MainView:onClickDiqu()
  1053. showTooltip("开发中...")
  1054. end
  1055. function MainView:onClickPrizeCash()
  1056. playBtnEffect()
  1057. local view = import("luaScript.Views.Main.MainInviteNewFriend"):new();
  1058. view:setAnchorPoint(cc.p(0.5, 0.5))
  1059. app:showWaitDialog(view)
  1060. end
  1061. function MainView:onEventChangeAddress(event)
  1062. local data = event.data;
  1063. if not data then
  1064. return
  1065. end
  1066. local address = data.address
  1067. local addressCode = data.addressCode
  1068. if self._lastAddressCode ~= addressCode or IS_FIRST_Change then
  1069. IS_FIRST_Change = false
  1070. self._lastAddressCode = addressCode
  1071. app.waitDialogManager:showWaitNetworkDialog("请稍等...")
  1072. app.serverConfigs:requestGameList(addressCode)
  1073. -- self:updateSubGameList()
  1074. end
  1075. end
  1076. ---
  1077. -- 初始化上次使用俱乐部的名字
  1078. --
  1079. function MainView:initClubName()
  1080. self:loadOperClubList()
  1081. self.ui.Items.Text_clubname:setText("未加入" .. (app.club_php:getCestIsOpen(app.club_php.clubID) and PLN.CLUB_CEST_NAME or PLN.CLUB_NAME))
  1082. end
  1083. function MainView:getSubGameListReview()
  1084. local gameList = {}
  1085. return gameList;
  1086. end
  1087. -- 从本地读取玩家上次的选择
  1088. function MainView:loadOperClubList()
  1089. local fileName = "OperateClubList.data"
  1090. local fileString = loadStringFromFile(fileName)
  1091. if fileString then
  1092. self.operClubList = json.decode(fileString) or {}
  1093. else
  1094. self.operClubList = {}
  1095. end
  1096. end
  1097. function MainView:onUpdateBtnInfo()
  1098. self:loadOperClubList()
  1099. self:onGetClubResult()
  1100. end
  1101. -- 显示项目自己的公告,每个项目的公告可能是不一样的
  1102. -- isFirstLogin : 是否首次进入大厅
  1103. function MainView:showProjectNotice(isFirstLogin)
  1104. end
  1105. function MainView:showForceIdentity()
  1106. if not isWin32Platform() then
  1107. local isRealname = app.user.isRealname;
  1108. if isRealname == 0 then
  1109. local view = import("luaScript.Views.Main.ForceShiMingView"):new()
  1110. view:setAnchorPoint(cc.p(0.5, 0.5))
  1111. app:showWaitDialog(view, 255, nil, 999)
  1112. else
  1113. --实名后判断是否满18岁
  1114. local isAdult = app.user.isAdult;
  1115. if isAdult == 0 then
  1116. local view = import("luaScript.Views.Main.ShiMingRejectView"):new()
  1117. view:setAnchorPoint(cc.p(0.5, 0.5))
  1118. app:showWaitDialog(view, 255, nil, 999)
  1119. end
  1120. end
  1121. end
  1122. end
  1123. function MainView:onLogOutTips()
  1124. local view = import("luaScript.Views.Main.LogOut.LogOutTips"):new()
  1125. view:setAnchorPoint(cc.p(0.5,0.5))
  1126. app:showWaitDialog(view,nil,false)
  1127. end
  1128. return MainView