CommonAuctionTips = CommonAuctionTips or BaseClass(BaseView) local CommonAuctionTips = CommonAuctionTips --[[ CommonAuctionTips.TabData = { [1] = {name = "人物", level = MainRoleModel.TabOpenLevel[1]}, } --]] function CommonAuctionTips:__init() self.base_file = "mainui" self.layout_file = "CommonAuctionTips" self.layer_name = "Top" self.destroy_imm = true self.use_background = false --全屏界面默认使用这个参数 --self.hide_maincancas = true --全屏界面需要放开隐藏主UI self.change_scene_close = false self.append_to_ctl_queue = false --是否要添加进界面堆栈 self.need_show_money = false --是否要显示顶部的金钱栏 -- self.base_x = -108 self.base_x = ScreenWidth/2-377--377是对右边的值 -- self.base_y = 60 self.base_y = -ScreenHeight/2+195--177是对下边的值 self.model = MarketModel:GetInstance() self.load_callback = function () self:LoadSuccess() self:AddEvent() end self.open_callback = function ( ) self:OpenSuccess() end self.switch_callback = function(index) self:SwitchTab(index) end self.destroy_callback = function ( ) self:DestroySuccess() end end function CommonAuctionTips:Open(data) self.data = data BaseView.Open(self) end function CommonAuctionTips:ReOpen( data ) self.data = data self:UpdateView() end function CommonAuctionTips:LoadSuccess() local nodes = { "layout/auction_btn:obj", "layout/bg:raw", "layout/tip_text:tmp", "layout/close_btn:obj", "layout/item_con", "layout", } self:GetChildren(nodes) self.awardItem = UIObjPool:getInstance():PopItem(UIObjPool.UIType.AwardItem, self.item_con) self.awardItem:SetItemSize(78,78) self.awardItem:SetEnableClick(false) end function CommonAuctionTips:AddEvent() local function on_click( target ) if target == self.close_btn_obj then self:Close() elseif target == self.auction_btn_obj then OpenFun.Open(155,3) self:Close() end end AddClickEvent(self.close_btn_obj, on_click) AddClickEvent(self.auction_btn_obj, on_click) local function onOrientationChange() self:ChangeUiPosition() end self.orientation_change_id = GlobalEventSystem:Bind(EventName.ORIENTATION_DID_CHANGE, onOrientationChange) end function CommonAuctionTips:OpenSuccess() self:UpdateView() end function CommonAuctionTips:ChangeUiPosition( ) if GuildModel:getInstance().is_open_auctiontip then -- SetAnchoredPosition(self.layout, self.base_x + ClientConfig.iphone_x_offset_left, self.base_y) SetAnchoredPosition(self.layout, self.base_x - ClientConfig.iphone_x_offset_right - 200, self.base_y) else -- SetAnchoredPosition(self.layout, -304 + ClientConfig.iphone_x_offset_left, self.base_y) SetAnchoredPosition(self.layout, self.base_x - ClientConfig.iphone_x_offset_right, self.base_y) end end function CommonAuctionTips:UpdateView() self:ChangeUiPosition() self.awardItem:SetData(self.data.goods_id) local goodsVo = GoodsModel:getInstance():GetGoodsBasicByTypeId(self.data.goods_id) if goodsVo and goodsVo.type == GoodsModel.TYPE.EQUIP then goodsVo.goods_num = 1 local can_tip, flag = EquipModel:getInstance():EquipCanShowGoodsTip(goodsVo) self.awardItem:ChangeEquipState(flag) else self.awardItem:ChangeEquipState(nil) end local goods_name = GoodsModel:getInstance():getGoodsName(self.data.goods_id, true) if self.data.is_show_time then self.tip_text_tmp.text = string.format("您关注的 %s 已经可以竞价了!", goods_name) else self.tip_text_tmp.text = string.format("您对 %s 的竞价已被超过", goods_name) end end function CommonAuctionTips:SwitchTab( index ) end function CommonAuctionTips:DestroySuccess( ) if self.awardItem then UIObjPool:getInstance():PushItem(UIObjPool.UIType.AwardItem, self.awardItem) self.awardItem = nil end if self.orientation_change_id then GlobalEventSystem:UnBind(self.orientation_change_id) self.orientation_change_id = nil end end