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.

79 lines
2.1 KiB

  1. -- 主界面子游戏图标
  2. --[[
  3. 从 subGameManger 获取版本号、更新地址、更新状态
  4. 并使用 subGameManger 进行更新
  5. --]]
  6. local MainViewGameIconGroup = class("MainViewGameIconGroup")
  7. function MainViewGameIconGroup:ctor(groupConfig)
  8. local ui = loadUI("res/ui/ui_dating/ui_dating_icon_group.ui")
  9. self.ui = ui
  10. self.groupConfig = groupConfig
  11. dump(self.groupConfig, "MainViewGameIconGroup:ctor groupConfig")
  12. self:init()
  13. end
  14. function MainViewGameIconGroup:init()
  15. -- 默认不显示下载相关的节点
  16. self.ui.Items.ImageView_RedPoint:setVisible(false)
  17. -- 图标点击事件
  18. self.ui.Items.ImageView_Icon:registerClick(handler(self, self.onClickIcon))
  19. --免费标签
  20. -- local gameFangKaConfig = app.user:getGameConfig(self.gameId);
  21. -- if gameFangKaConfig then
  22. -- --isFree 1表示免费 0: 收费
  23. -- local isFree = gameFangKaConfig.isFree == 1
  24. -- self.ui.Items.ImageView_FreeTag:setVisible(isFree)
  25. -- else
  26. self.ui.Items.ImageView_FreeTag:setVisible(false)
  27. -- end
  28. -- 设置icon
  29. setImageFromUrl(self.ui.Items.ImageView_Icon,self.groupConfig.icon)
  30. if self.groupConfig.webgame then
  31. for k,gameId in pairs(self.groupConfig.games or {}) do
  32. local item = self.ui.Items.Layout_Item:getCopied()
  33. local icon = item:getChildByName("ImageView_Icon_Small")
  34. local gameConfig = app.serverConfigs:getWebGameConfig(gameId)
  35. if gameConfig then
  36. setImageFromUrl(icon,gameConfig.icon)
  37. end
  38. self.ui.Items.Layout_Content:addChild(item)
  39. end
  40. else
  41. for k,gameId in pairs(self.groupConfig.games or {}) do
  42. local item = self.ui.Items.Layout_Item:getCopied()
  43. local icon = item:getChildByName("ImageView_Icon_Small")
  44. local gameConfig = app.serverConfigs.subGameList[gameId]
  45. if gameConfig then
  46. setImageFromUrl(icon,gameConfig.gameIcon)
  47. end
  48. self.ui.Items.Layout_Content:addChild(item)
  49. end
  50. end
  51. end
  52. -- 点击事件 - 图标
  53. function MainViewGameIconGroup:onClickIcon()
  54. playBtnEffect()
  55. local view = import("luaScript.Views.Main.MainViewGameGroupView"):new(self.groupConfig)
  56. view:setAnchorPoint(cc.p(0.5, 0.5))
  57. app:showWaitDialog(view,nil,true)
  58. end
  59. return MainViewGameIconGroup