FlyShoeBuyTip = FlyShoeBuyTip or BaseClass(BaseView) local FlyShoeBuyTip = FlyShoeBuyTip function FlyShoeBuyTip:__init() self.base_file = "task" self.layout_file = "FlyShoeBuyTip" self.layer_name = "Activity" self.destroy_imm = true self.change_scene_close = true self.append_to_ctl_queue = false --是否要添加进界面堆栈 self.need_show_money = false --是否要显示顶部的金钱栏 self.is_set_zdepth = true self.click_bg_toClose = false ------------------------ -- 一级全屏界面: self.hide_maincancas = false --隐藏主界面 self.use_background = true --不一定显示遮罩 ------------------------ self.model = TaskModel:getInstance() self.load_callback = function () self:LoadSuccess() self:AddEvent() end self.open_callback = function ( ) self:OpenSuccess() end self.close_win_callback = function ( ) self:Close() end self.destroy_callback = function ( ) self:DestroySuccess() end end function FlyShoeBuyTip:Open( buy_call ) self.buy_call = buy_call BaseView.Open(self) end function FlyShoeBuyTip:LoadSuccess() local nodes = { "cancelBtn:obj", "Window:raw", "windowCloseBtn:obj", "confirmBtn:obj", "contenText:tmp", "descText:tmp:obj", } self:GetChildren(nodes) lua_resM:setOutsideRawImage(self, self.Window_raw, GameResPath.GetViewBigBg("tips_comm_bg6"), false) self.descText_tmp.text = string.format("( %s 可免费全图飞行 提升VIP )",HtmlColorTxt( " VIP" .. VipModel:getInstance():GetFreeShoeVip( ) , ColorUtil.PURPLE_DARK),ColorUtil.GREEN_DARK) end function FlyShoeBuyTip:AddEvent() local function onBtnClickHandler(target) if target == self.confirmBtn_obj then local data = ShopModel:getInstance():GetShopTypeIdBuyCFG( AutoFightManager.FlyGoodsID ) if data and data[ShopType.BindGold] then ShopModel:getInstance():Fire(ShopModel.BUY_GOODS, data[ShopType.BindGold].key_id, 1) end elseif target == self.cancelBtn_obj then self:Close() elseif target == self.windowCloseBtn_obj then self:Close() elseif target == self.descText_obj then GlobalEventSystem:Fire(EventName.OPEN_VIP_VIEW, VipModel.TabType.Recharge) self:Close() end end AddClickEvent(self.windowCloseBtn_obj,onBtnClickHandler ) AddClickEvent(self.cancelBtn_obj,onBtnClickHandler,LuaSoundManager.SOUND_UI.SWITCH) AddClickEvent(self.confirmBtn_obj,onBtnClickHandler,LuaSoundManager.SOUND_UI.SWITCH) AddClickEvent(self.descText_obj,onBtnClickHandler,LuaSoundManager.SOUND_UI.SWITCH) local function BUY_SHOE_TO_FLY_SUCCESS( ) if self.buy_call then self.buy_call() end self:Close() end self:BindEvent(GlobalEventSystem, EventName.BUY_SHOE_TO_FLY_SUCCESS, BUY_SHOE_TO_FLY_SUCCESS) end function FlyShoeBuyTip:OpenSuccess() self:UpdateView() end function FlyShoeBuyTip:UpdateView() local goods_price_data = Config.Goodsprice[AutoFightManager.FlyGoodsID] if not goods_price_data then return end self.contenText_tmp.text = string.format("小飞鞋不足,是否花费 %s 购买小飞鞋*1 ?",HtmlColorTxt(goods_price_data.price , ColorUtil.GREEN_DARK),'#10aaf1') end function FlyShoeBuyTip:DestroySuccess( ) end