--社团协助前往结算界面 GuildSupportResultView = GuildSupportResultView or BaseClass(BaseView) local GuildSupportResultView = GuildSupportResultView function GuildSupportResultView:__init() self.base_file = "guild" self.layout_file = "GuildSupportResultView" self.layer_name = "UI" self.destroy_imm = true self.use_background = true self.hide_maincancas = true --全屏界面需要放开隐藏主UI self.change_scene_close = true self.append_to_ctl_queue = false --是否要添加进界面堆栈 self.need_show_money = false --是否要显示顶部的金钱栏 self.model = GuildModel:getInstance() self.delay_time = 8 self.item_list = {} if SceneManager.Instance:IsBossMoneyScene() then self.delay_time = 18 BossController.Instance.listen_support_result = true--赏金幻魔协助者结算标记 end self.load_callback = function () self:LoadSuccess() self:AddEvent() end self.open_callback = function ( ) self:OpenSuccess() end self.destroy_callback = function ( ) self:DestroySuccess() end end function GuildSupportResultView:DestroySuccess() if self.timer_id then GlobalTimerQuest:CancelQuest(self.timer_id) self.timer_id = nil end for k, v in pairs(self.item_list) do v:DeleteMe() v = nil end self.item_list = {} --如果在赏金幻魔场景结算要退出界面 if SceneManager.Instance:IsBossMoneyScene() then BossModel:GetInstance():Fire(BossConst.REQ_QUIT_SCENE) end end function GuildSupportResultView:LoadSuccess() local nodes = { "insufficientText:tmp","award_con","buff_text:tmp","mask_bg:obj" ,"titlebg:raw","bg:raw","time_text:tmp","name:tmp", "awardImg:raw", } self:GetChildren(nodes) lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("default_result_bg1"),false) lua_resM:setOutsideRawImage(self, self.titlebg_raw, GameResPath.GetGuildImage("guild_support_title"),false) lua_resM:setOutsideRawImage(self, self.awardImg_raw, GameResPath.GetGuildImage("guild_support_result_award_img"),false) -- local guild_lv = self.model.base_info.guild_lv -- local honorInc = self.model:GetGuildBadgeInfo(GuildBadgeType.HonorInc) -- if honorInc and honorInc > 0 then -- self.buff_text_tmp.text = "当前社团名望券收益加成"..HtmlColorTxt(honorInc.."%", ColorUtil.GREEN_DARK) -- else -- self.buff_text_tmp.text = "恭喜您获得社团协助奖励!" -- end if self.need_refreshData then self:UpdateView( ) end end function GuildSupportResultView:AddEvent() local function onBtnClickHandler(target,x,y) if target == self.mask_bg_obj then--关闭 self:Close() end end AddClickEvent(self.mask_bg_obj,onBtnClickHandler, LuaSoundManager.SOUND_UI.NONE) end function GuildSupportResultView:Open( data ) self.data = data BaseView.Open(self) end function GuildSupportResultView:OpenSuccess( ) self:UpdateView() end function GuildSupportResultView:UpdateView( ) if self.is_loaded then self.need_refreshData = false else self.need_refreshData = true return end if not self.data then return end self.cfg = self.model:GetGuildSupportCfg(self.data.support_cfg_id) if not self.cfg then return end if self.cfg.module_id == 460 then self:UpdateBossInfo() elseif self.cfg.module_id == 500 then self.insufficientText_tmp.text = "协助护送成功" elseif self.cfg.module_id == 408 then self.insufficientText_tmp.text = "成功协助击杀裂隙首领" else self.insufficientText_tmp.text = "协助成功" end self.name_tmp.text = string.format("成功协助 %s",self.data.name) self:UpdateItemList() self:UpdateTime() end function GuildSupportResultView:UpdateBossInfo( ) --Boss形象 local monster = ConfigItemMgr.Instance:GetMonsterDataItem(self.data.value) if not monster then print('----HC GuildSupportResultView.lua -- 没有找到怪物配置=') return end local boss_type = BossModel:GetInstance():GetBossTypeByBossId( self.data.value ) local boss_type_name = self.model:GetSupportTypeName(boss_type) or "" local boss_str = boss_type_name..":"..HtmlColorTxt(monster.name, ColorUtil.PURPLE_DARK) self.insufficientText_tmp.text = string.format("击杀%s",boss_str) end function GuildSupportResultView:BtnCloseEvt()--关闭按钮回调 self:Close() end function GuildSupportResultView:UpdateItemList( ) local cfg = self.cfg if not cfg then return end for k,v in pairs(self.item_list) do v:SetVisible(false) end local guild_lv = self.model:GetGuildBaseInfo().guild_lv local item_list = {{0,100003,cfg.reward_reputation}} if not item_list or TableSize(item_list) == 0 then return end local offer_x = 0 local offer_y = 0 local x = 0 local y = 0 for i, v in ipairs(item_list) do local item = self.item_list[i] if item == nil then item = UIObjPool:getInstance():PopItem(UIObjPool.UIType.AwardItem,self.award_con) item:SetItemSize(78,78) self.item_list[i] = item end -- y = offer_y -- x = (78+offer_x) * (i-1) -- item:SetPosition(x,y) local goods_Id, lock = GoodsModel:getInstance():GetMappingTypeId(v[1], v[2]) local goodVo = GoodsModel:getInstance():GetGoodsBasicByTypeId(goods_Id) if goodVo then item:SetData(goods_Id, v[3], goodVo.color, 0, lock,true,nil) else -- error("没有找到物品信息 "..v.typeId) end item:SetVisible(true) end end function GuildSupportResultView:UpdateTime( ) local time = self.delay_time local function countDown() if self._use_delete_method then return end if not self.data then return end time = time - 1 if time > 0 then self.time_text_tmp.text = "点击任意处继续"..HtmlColorTxt("("..time.."s)", ColorUtil.GREEN_DARK) else self:Close() end end countDown() if not self.timer_id then self.timer_id = GlobalTimerQuest:AddPeriodQuest(countDown,1) end end