源战役客户端
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

104 righe
4.2 KiB

4 settimane fa
  1. EmpowerResetTipView = EmpowerResetTipView or BaseClass(BaseView)
  2. function EmpowerResetTipView:__init()
  3. self.base_file = "empower"
  4. self.layout_file = "EmpowerResetTipView"
  5. self.layer_name = "Top"
  6. self.use_background = true
  7. self.is_set_zdepth = true
  8. self.count = 1
  9. self.model = EmpowerModel:GetInstance()
  10. self.load_callback = function ()
  11. self:LoadSuccess()
  12. self:InitEvent()
  13. end
  14. self.open_callback = function ()
  15. self:SetData()
  16. end
  17. self.close_callback = function ()
  18. self:Remove()
  19. end
  20. end
  21. function EmpowerResetTipView:Remove()
  22. end
  23. function EmpowerResetTipView:LoadSuccess()
  24. local nodes = {
  25. "Window:raw", "confirmBtn:obj","number_con","Window/windowCloseBtn:obj","vipBtn:obj","next_can_buy_label:tmp","cost_label:tmp","cur_can_buy_label:tmp","title_label:tmp",
  26. "bg_1:raw", "vip_next:img", "vip_cur:img", "label_reword:tmp",
  27. }
  28. self:GetChildren(nodes)
  29. lua_resM:setOutsideRawImage(self, self.Window_raw, GameResPath.GetViewBigBg("tips_comm_bg6"))
  30. -- lua_resM:setOutsideRawImage(self, self.bg_1_raw, GameResPath.GetEmpowerIcon("grid_walk_reset_tip_bg1"))
  31. end
  32. function EmpowerResetTipView:InitEvent()
  33. local function onClickHandler(target)
  34. if self.confirmBtn_obj == target then
  35. self.model:Fire(EmpowerConst.EMPOWER_REQ_EVENT, 41411)
  36. self:Close()
  37. elseif self.windowCloseBtn_obj == target then
  38. self:Close()
  39. elseif self.vipBtn_obj == target then
  40. OpenFun.Open(158, 0)
  41. self:Close()
  42. end
  43. end
  44. AddClickEvent(self.confirmBtn_obj,onClickHandler)
  45. AddClickEvent(self.vipBtn_obj,onClickHandler)
  46. AddClickEvent(self.windowCloseBtn_obj,onClickHandler)
  47. end
  48. function EmpowerResetTipView:SetData(data)
  49. --data = data or self.model.times_info
  50. self.game_info = self.game_info or self.model:GetGridGameInfo()
  51. local vip = RoleManager.Instance.mainRoleInfo.vip_flag
  52. ----------重置奖励txt:
  53. local reset_info = Config.Latticeresetinfo[self.game_info.reset_count+1] or Config.Latticeresetinfo[self.game_info.reset_count]
  54. local reset_good_list = stringtotable(reset_info.reward)[1]
  55. local goods_name = GoodsModel:getInstance():getGoodsName(reset_good_list[2], true)
  56. self.label_reword_tmp.text = "重置奖励:"..goods_name.."X".. reset_good_list[3]
  57. ------------重置金额
  58. local resetInfo = stringtotable(Config.Latticekv["reset_lattice_cost"].val)
  59. self.reset_cost = resetInfo[self.game_info.reset_count+1] and resetInfo[self.game_info.reset_count+1][2][3] or 100
  60. local color = RoleManager.Instance.mainRoleInfo:GetRealJin() < self.reset_cost and ColorUtil.RED_DARK or ColorUtil.GREEN_DARK
  61. self.cost_label_tmp.text = "<color="..color..">"..self.reset_cost.."</color>".." 重置升品之路"--钻石
  62. ------------可重置次数
  63. local can_reset_num = 0
  64. local vip_reset_table = stringtotable(Config.Latticekv["lattice_vip_point"].val)
  65. for k,v in pairs(vip_reset_table) do
  66. if v[1] <= vip and can_reset_num < v[2] then
  67. can_reset_num = v[2]
  68. end
  69. end
  70. local left_reset_num = math.max(0, can_reset_num-self.game_info.reset_count)
  71. self.title_label_tmp.text = string.format("您今日还可重置%s次 %s", HtmlColorTxt(left_reset_num ,left_reset_num == 0 and ColorUtil.RED_DARK or ColorUtil.GREEN_DARK), HtmlColorTxt("(提升VIP可增加重置次数)", "#d322ff"))
  72. ---------中间条
  73. local reset_limit,reset_next_vip,reset_next_limit = self.model:GetResetLimitNumWalk()--重置上限
  74. self.cur_can_buy_label_tmp.text = string.format("每日可重置%s%s次", HtmlColorTxt(left_reset_num ,left_reset_num == 0 and ColorUtil.RED_DARK or ColorUtil.GREEN_DARK), "/" .. can_reset_num)
  75. print("============>>> YiRan:EmpowerResetTipView [start:94] can_reset_num :",can_reset_num)
  76. print("============>>> YiRan:EmpowerResetTipView [start:95] reset_next_limit :",reset_next_limit)
  77. if not reset_next_vip then
  78. self.next_can_buy_label_tmp.text = "当前可重置次数已达最大"
  79. lua_resM:setImageSprite(self, self.vip_next_img, "vipExtra_asset", "vip_"..vip, true)
  80. else
  81. self.next_can_buy_label_tmp.text = string.format("每日可重置%s次", HtmlColorTxt(reset_next_limit , ColorUtil.GREEN_DARK) )
  82. lua_resM:setImageSprite(self, self.vip_next_img, "vipExtra_asset", "vip_"..reset_next_vip, true)
  83. end
  84. lua_resM:setImageSprite(self, self.vip_cur_img, "vipExtra_asset", "vip_"..vip, true)
  85. end