|
|
-
- EmpowerResetTipView = EmpowerResetTipView or BaseClass(BaseView)
- function EmpowerResetTipView:__init()
- self.base_file = "empower"
- self.layout_file = "EmpowerResetTipView"
- self.layer_name = "Top"
- self.use_background = true
- self.is_set_zdepth = true
- self.count = 1
-
- self.model = EmpowerModel:GetInstance()
- self.load_callback = function ()
- self:LoadSuccess()
- self:InitEvent()
- end
- self.open_callback = function ()
- self:SetData()
- end
- self.close_callback = function ()
- self:Remove()
- end
- end
-
- function EmpowerResetTipView:Remove()
- end
-
-
- function EmpowerResetTipView:LoadSuccess()
- local nodes = {
- "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",
- "bg_1:raw", "vip_next:img", "vip_cur:img", "label_reword:tmp",
- }
- self:GetChildren(nodes)
-
- lua_resM:setOutsideRawImage(self, self.Window_raw, GameResPath.GetViewBigBg("tips_comm_bg6"))
- -- lua_resM:setOutsideRawImage(self, self.bg_1_raw, GameResPath.GetEmpowerIcon("grid_walk_reset_tip_bg1"))
- end
-
- function EmpowerResetTipView:InitEvent()
- local function onClickHandler(target)
- if self.confirmBtn_obj == target then
- self.model:Fire(EmpowerConst.EMPOWER_REQ_EVENT, 41411)
- self:Close()
- elseif self.windowCloseBtn_obj == target then
- self:Close()
- elseif self.vipBtn_obj == target then
- OpenFun.Open(158, 0)
- self:Close()
- end
- end
-
- AddClickEvent(self.confirmBtn_obj,onClickHandler)
- AddClickEvent(self.vipBtn_obj,onClickHandler)
- AddClickEvent(self.windowCloseBtn_obj,onClickHandler)
-
-
- end
-
- function EmpowerResetTipView:SetData(data)
- --data = data or self.model.times_info
- self.game_info = self.game_info or self.model:GetGridGameInfo()
- local vip = RoleManager.Instance.mainRoleInfo.vip_flag
- ----------重置奖励txt:
-
- local reset_info = Config.Latticeresetinfo[self.game_info.reset_count+1] or Config.Latticeresetinfo[self.game_info.reset_count]
- local reset_good_list = stringtotable(reset_info.reward)[1]
- local goods_name = GoodsModel:getInstance():getGoodsName(reset_good_list[2], true)
- self.label_reword_tmp.text = "重置奖励:"..goods_name.."X".. reset_good_list[3]
-
- ------------重置金额
- local resetInfo = stringtotable(Config.Latticekv["reset_lattice_cost"].val)
- self.reset_cost = resetInfo[self.game_info.reset_count+1] and resetInfo[self.game_info.reset_count+1][2][3] or 100
- local color = RoleManager.Instance.mainRoleInfo:GetRealJin() < self.reset_cost and ColorUtil.RED_DARK or ColorUtil.GREEN_DARK
- self.cost_label_tmp.text = "<color="..color..">"..self.reset_cost.."</color>".." 重置升品之路"--钻石
-
- ------------可重置次数
- local can_reset_num = 0
- local vip_reset_table = stringtotable(Config.Latticekv["lattice_vip_point"].val)
- for k,v in pairs(vip_reset_table) do
- if v[1] <= vip and can_reset_num < v[2] then
- can_reset_num = v[2]
- end
- end
- local left_reset_num = math.max(0, can_reset_num-self.game_info.reset_count)
- 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"))
- ---------中间条
- local reset_limit,reset_next_vip,reset_next_limit = self.model:GetResetLimitNumWalk()--重置上限
-
- 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)
-
- print("============>>> YiRan:EmpowerResetTipView [start:94] can_reset_num :",can_reset_num)
- print("============>>> YiRan:EmpowerResetTipView [start:95] reset_next_limit :",reset_next_limit)
- if not reset_next_vip then
- self.next_can_buy_label_tmp.text = "当前可重置次数已达最大"
- lua_resM:setImageSprite(self, self.vip_next_img, "vipExtra_asset", "vip_"..vip, true)
- else
- self.next_can_buy_label_tmp.text = string.format("每日可重置%s次", HtmlColorTxt(reset_next_limit , ColorUtil.GREEN_DARK) )
- lua_resM:setImageSprite(self, self.vip_next_img, "vipExtra_asset", "vip_"..reset_next_vip, true)
- end
-
- lua_resM:setImageSprite(self, self.vip_cur_img, "vipExtra_asset", "vip_"..vip, true)
-
- end
-
|