CurrencyWishCriticalView = CurrencyWishCriticalView or BaseClass(BaseView) local CurrencyWishCriticalView = CurrencyWishCriticalView function CurrencyWishCriticalView:__init() self.base_file = "currencyWish" self.layout_file = "CurrencyWishCriticalView" self.layer_name = "Top" self.destroy_imm = true self.use_background = true self.is_set_zdepth = true self.hide_maincancas = true --全屏界面需要隐藏主UI --self.change_scene_close = true --是否切换场景时关闭(弹出界面使用) self.append_to_ctl_queue = false --是否要添加进界面堆栈 self.model = CurrencyWishModel:getInstance() self.load_callback = function() self:LoadSuccess() self:AddEvent() end self.open_callback = function( ) self:UpdateView() end self.destroy_callback = function ( ) self:DestroySuccess() end end function CurrencyWishCriticalView:Open( ) --self.data = data BaseView.Open(self) end function CurrencyWishCriticalView:LoadSuccess() local nodes = { "close_btn:obj", "reward_num:tmp", "confirm_btn:obj", "desc_text:tmp", "bg:img", "reward_num/reward_icon:img", } self:GetChildren(nodes) lua_resM:setOutsideImageSprite(self, self.bg_img, GameResPath.GetViewBigBg("currency_wish_critical_bg"), false) self:UpdateView() end function CurrencyWishCriticalView:AddEvent() local function click_event(target) if target == self.close_btn_obj then self:Close() elseif target == self.confirm_btn_obj then self:Close() end end AddClickEvent(self.close_btn_obj, click_event) AddClickEvent(self.confirm_btn_obj, click_event) end function CurrencyWishCriticalView:SetData(data) self.data = data self:UpdateView() -- if self.need_refresh_data then -- self.need_refresh_data = false -- self:UpdateView() -- end end function CurrencyWishCriticalView:UpdateView() if not self.is_loaded or not self.data then self.need_refresh_view = true return end local money_str if self.data.wishtype == CurrencyWishConst.CURRENCY_WISH_TYPE.SPECIAL then -- money_str = WordManager:GetMoneyFaceStr(3) lua_resM:setImageSprite(self, self.reward_icon_img, "uiComponent_asset", "ui_momey_icon_3", true) -- SetLocalScale(self.reward_icon, 1, 1, 1) elseif self.data.wishtype == CurrencyWishConst.CURRENCY_WISH_TYPE.EXP then -- money_str = WordManager:GetMoneyFaceStr(5) lua_resM:setImageSprite(self, self.reward_icon_img, "currencyWish_asset", "currency_wish_exp_word_icon", true) SetLocalScale(self.reward_icon, 1.2, 1.2, 1) local pos_x = GetAnchoredPosition(self.reward_icon) SetAnchoredPositionX(self.reward_icon, pos_x + 10) end self.reward_num_tmp.text = string.format("获得 %s", self.data.award_num) self.desc_text_tmp.text = string.format("本次祈愿获得 %s倍 暴击!!!\n奖励直翻 %s倍!", self.data.crit_rate, self.data.crit_rate) end function CurrencyWishCriticalView:DestroySuccess() end