--[[@------------------------------------------------------------------ @description:协助主界面 @author:huangcong ----------------------------------------------------------------------]] GuildSupportInfoMainView = GuildSupportInfoMainView or BaseClass(BaseView) GuildSupportInfoMainView.TabData = { {id = GuildModel.SupportTab.List, name = "协助列表", module_id = 400, sub_id = 6, sort_id = 1}, {id = GuildModel.SupportTab.Thank, name = "发送感谢", module_id = 400, sub_id = 6, sort_id = 2}, {id = GuildModel.SupportTab.Gift, name = "接受感谢", module_id = 400, sub_id = 6, sort_id = 3}, } local GuildSupportInfoMainView = GuildSupportInfoMainView function GuildSupportInfoMainView:__init() self.base_file = "guild" self.layout_file = "GuildSupportInfoMainView" self.layer_name = "UI" self.need_show_money = false self.destroy_imm = true self.use_background = true self.hide_maincancas = false --全屏界面需要放开隐藏主UI self.append_to_ctl_queue = true --添加进入控制队列 self.change_scene_close = true -- self.fire_change_visible_event = true -- self.is_set_zdepth = true self.blur_activity_bg = true self.model = GuildModel:getInstance() self.tab_list = {} self.tab_index = GuildModel.SupportTab.List self.mainVo = RoleManager.Instance.mainRoleInfo self.tab_list = {} self.sub_view_list = {} self.load_callback = function () self:LoadSuccess() self:InitEvent() end self.open_callback = function () self:OpenCallBack() end self.close_callback = function () self:Remove() end end function GuildSupportInfoMainView:Open(id,speaciel_data) self.tab_index = id or self.tab_index self.speaciel_data = speaciel_data or self.speaciel_data BaseView.Open(self) -- print("huangcong:GuildSupportInfoMainView [start:61] :", self.speaciel_data) -- PrintTable(self.speaciel_data) -- print("huangcong:GuildSupportInfoMainView [end]") end function GuildSupportInfoMainView:OpenCallBack( ) end function GuildSupportInfoMainView:Remove() if self.delay_id then GlobalTimerQuest:CancelQuest(self.delay_id) self.delay_id = nil end for k,v in pairs(self.tab_list) do v:DeleteMe() end self.tab_list = {} for k,v in pairs(self.sub_view_list) do v:DeleteMe() end self.sub_view_list = {} end function GuildSupportInfoMainView:LoadSuccess() self.nodes = { "bg:raw", "closeBtn:obj", "container", "titleNameText:tmp", "tabCon", --下方名望券相关节点 "horCon/goodsCon/goods_icon:img","horCon/pro_value:tmp","horCon/lb1:tmp", "horCon/help:obj","horCon:obj", } self:GetChildren(self.nodes) self.titleNameText_tmp.text = "社团协助" self.cost_goods_id = WordManager:GetPriceTypeId(4) self.goods_name = GoodsModel:getInstance():getGoodsName(self.cost_goods_id, true) self.lb1_tmp.text = string.format("每日协助获得%s上限:",self.goods_name) local res_asset, res_name = WordManager:GetCommonMoneyIcon(Config.ConfigNotNormalGoods[4].type) lua_resM:setImageSprite(self, self.goods_icon_img, res_asset, res_name) self:UpdateView() end function GuildSupportInfoMainView:InitEvent() local function onBtnClickHandler(target,x,y) if target == self.help_obj then--帮助 EventSystem.Fire(GlobalEventSystem,EventName.OPEN_INSTRUCTION_VIEW, 40006) elseif target == self.closeBtn_obj then--关闭 self:Close() end end AddClickEvent(self.closeBtn_obj, onBtnClickHandler, LuaSoundManager.SOUND_UI.NONE) AddClickEvent(self.help_obj, onBtnClickHandler, LuaSoundManager.SOUND_UI.NONE) local function updateDataInfo( ) if not self.is_loaded then return end self:UpdateReputation() end self:BindEvent(self.model, GuildModel.UPDATE_GUILD_SUPPOR_INFO, updateDataInfo)--刷新协助信息列表 end function GuildSupportInfoMainView:UpdateView( id,speaciel_data ) self.tab_index = id or self.tab_index self.speaciel_data = speaciel_data or self.speaciel_data self:UpdateTabList() self:UpdateReputation() end function GuildSupportInfoMainView:UpdateTabList( )--页签数据更新 local tab_list = GuildSupportInfoMainView.TabData if not tab_list or TableSize(tab_list) == 0 then return end local function callback( index,force ) self:SwitchView(index,force) end local offer_x = 2 local offer_y = 0 local x = 0 local y = 0 for i, v in ipairs(tab_list) do local item = self.tab_list[i] if item == nil then item = GuildSupportInfoMainTab.New(self.tabCon, nil, self.layer_name) self.tab_list[i] = item y = -(GuildSupportInfoMainTab.Height + offer_y)* (i-1) x = 0 item:SetPosition(x,y) item:SetCallBack(callback) end item:SetData(v,i,self.tab_index) end callback(self.tab_index,true) self:UpdateTabRedDot() end function GuildSupportInfoMainView:SwitchView(id,force) if self.tab_index == id and not force then return end for k,v in ipairs(self.tab_list) do v:SetSelect(id) end if id == GuildModel.SupportTab.List then--协助列表 if self.sub_view_list[id] == nil then self.sub_view_list[id] = GuildSupportInfoMainListView.New(self.container,nil,self.layer_name) end self.sub_view_list[id]:SetData(self.speaciel_data) lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("guild_support_bg"),false) elseif id == GuildModel.SupportTab.Thank then--协助感谢 if self.sub_view_list[id] == nil then self.sub_view_list[id] = GuildSupportInfoMainThankView.New(self.container,nil,self.layer_name) end self.sub_view_list[id]:SetData(self.speaciel_data) lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("guild_support_bg2"),false) elseif id == GuildModel.SupportTab.Gift then--协助礼物收下 if self.sub_view_list[id] == nil then self.sub_view_list[id] = GuildSupportInfoMainGiftView.New(self.container,nil,self.layer_name) end self.sub_view_list[id]:SetData(self.speaciel_data) lua_resM:setOutsideRawImage(self, self.bg_raw, GameResPath.GetViewBigBg("guild_support_bg2"),false) end self:PopUpChild(self.sub_view_list[id]) self.tab_index = id self.speaciel_data = nil end function GuildSupportInfoMainView:CancelHide( ) BaseView.CancelHide(self) if self.is_loaded then end end function GuildSupportInfoMainView:UpdateTabRedDot(id)--更新页签红点 local red_data = self.model.support_red_list if not id then for k,v in ipairs(self.tab_list) do v:SetRedDot(red_data[k] or false) end else for k,v in ipairs(self.tab_list) do if k == id then v:SetRedDot(red_data[k] or false) break end end end end function GuildSupportInfoMainView:UpdateReputation( )--更新名望券 local max_num = GoodsModel:getInstance():GetReputationMaxNum() or 0 --宠物生活技能 每日名望获取上限额外提高 local life_skill_active = PetModel:getInstance():IsLifeSkillActived(PetConst.LifeSkill.FameDailyLimitUp) local life_skill_ratio = PetModel:getInstance():GetPetLifeSkillRatio(PetConst.LifeSkill.FameDailyLimitUp) if life_skill_active then max_num = max_num + life_skill_ratio end local cur_num = GoodsModel:getInstance():GetDaliyReputation() or 0 local guild_position = RoleManager.Instance.mainRoleInfo.position local cfg = Config.Guildpos[guild_position] local add_str = " (普通成员以上获得上限加成," if cfg and cfg.reputation_add then add_str = " (社团"..Trim(cfg.name)..HtmlColorTxt("+"..cfg.reputation_add, ColorUtil.GREEN_DARK).."上限," end local cur_str = HtmlColorTxt(cur_num, max_num <= cur_num and ColorUtil.RED_DARK or ColorUtil.GREEN_DARK) local str = "" if guild_position ~= 0 then str = string.format("%s/%s%s%s",cur_str,max_num,add_str,"每天"..HtmlColorTxt("4:00", ColorUtil.GREEN_DARK).."重置)") else str = string.format("%s/%s%s",cur_str,max_num," (社团普通成员以上提高上限,每天"..HtmlColorTxt("4:00", ColorUtil.GREEN_DARK).."重置)") end if self.delay_id then GlobalTimerQuest:CancelQuest(self.delay_id) self.delay_id = nil end local function callback( ... ) self.pro_value_tmp.text = str SetSizeDeltaX(self.pro_value,self.pro_value_tmp.preferredWidth+2) end self.delay_id = setTimeout(callback,0.01) -- 下一帧再加载 end