-- <*
|
|
-- @Author: Saber
|
|
-- @Description: 社团拼单界面
|
|
-- *>
|
|
GuildSpellListView = GuildSpellListView or BaseClass(BaseItem)
|
|
local GuildSpellListView = GuildSpellListView
|
|
local PetModel = PetModel
|
|
|
|
function GuildSpellListView:__init(parent_wnd,prefab_asset,layer_name)
|
|
self.base_file = "guild"
|
|
self.layout_file = "GuildSpellListView"
|
|
self.parent_wnd = parent_wnd
|
|
self.layer_name = layer_name
|
|
self.base_ratio = 0 -- 基础收益
|
|
self.cur_profit = 0 -- 当前收益
|
|
self.sl_item = {} -- 拼单列表
|
|
-- 奖励item节点
|
|
self.launch_reward_list = {}
|
|
self.accept_reward_list = {}
|
|
-- 参与玩家头像信息
|
|
self.attend_head_list = {}
|
|
self.main_vo = RoleManager.Instance.mainRoleInfo
|
|
self.model = GuildModel:getInstance()
|
|
self:Load()
|
|
end
|
|
|
|
function GuildSpellListView:Load_callback()
|
|
local nodes = {
|
|
"go_btn:obj:imgex",
|
|
-- 拼单发起奖励
|
|
"launch_scroll", "launch_scroll/Viewport/launch_con",
|
|
-- 拼单接受奖励
|
|
"accept_scroll", "accept_scroll/Viewport/accept_con",
|
|
-- 刷新扣费节点
|
|
"refresh_btn:obj", "refresh_cost_con",
|
|
"refresh_cost_con/r_cost_icon:img",
|
|
"refresh_cost_con/r_cost_lb1:tmp",
|
|
"refresh_cost_con/r_cost_lb2:tmp",
|
|
-- 拼单容器
|
|
"list_con",
|
|
-- 头像容器
|
|
"head_con",
|
|
-- 拼单品质和描述
|
|
"qua_title_bg:img", "spell_tip:tmp", "list_cond:tmp",
|
|
"list_desc:tmp", "list_name:tmp",
|
|
"spell_time:tmp", "profit_pec:tmp",
|
|
-- 邀请弹窗
|
|
"invite_window:obj:raw", "invite_window/invite_close:obj",
|
|
"invite_window/invite_scroll",
|
|
"invite_window/invite_scroll/Viewport/invite_con",
|
|
"invite_window/invite_tips:tmp",
|
|
--拼单BUFF相关节点
|
|
"buffBtn:obj:img",
|
|
}
|
|
self:GetChildren(nodes)
|
|
self.go_btn_lb_tmp = self:GetChild("go_btn/Text"):GetComponent(typeof(TMPro.TextMeshProUGUI))
|
|
|
|
lua_resM:setOutsideRawImage(self, self.invite_window_raw, GameResPath.GetViewBigBg("guild_spellList_invite_bg"))
|
|
self.invite_tips_tmp.text = string.format("仅能邀请<color=#fdffc2>本社团在线玩家</color>,对方可在%s秒内回应", self.model:GetGuildKvByKey("order_receive_time").val)
|
|
self:ReCheckGuildOrderRed()
|
|
self:AddEvents()
|
|
self:UpdateView()
|
|
end
|
|
|
|
-- 进入界面时,判断一次拼单的红点是否需要隐藏
|
|
function GuildSpellListView:ReCheckGuildOrderRed( )
|
|
if self.model.guild_order_login_red then
|
|
self.model.guild_order_login_red = false
|
|
self.model:CheckGuildRedDot(Config.ConfigGuild.TabId.Order, true)
|
|
end
|
|
end
|
|
|
|
function GuildSpellListView:AddEvents( )
|
|
local function click_event(target)
|
|
if target == self.invite_close_obj then
|
|
self.invite_window_obj:SetActive(false)
|
|
elseif target == self.refresh_btn_obj then -- 刷新
|
|
self:OnRefreshBtnClick()
|
|
elseif target == self.go_btn_obj then -- 上号,开冲!
|
|
local data = self.model:GetCurSelectedSpellListData()
|
|
local sl_data = self.model:GetGuildSpellListData()
|
|
if not data or not sl_data then return end
|
|
local total_num = self.model:GetGuildKvByKey("accept_limit").val
|
|
if total_num - sl_data.ordered <= 0 then
|
|
Message.show("今日拼单次数已用完", "fault")
|
|
return
|
|
end
|
|
-- 获取订单配置
|
|
local sl_cfg = Config.Guildorder[data.cfg]
|
|
if data then
|
|
if data.state == 3 then
|
|
self.model:Fire(GuildModel.OPEN_GUILD_SUPPORT_IFNO_VIEW, GuildModel.SupportTab.Thank)
|
|
-- self.model:OpenGuildSLThankView(data.order)
|
|
elseif data.state == 4 then
|
|
local has_red = self.model:GetGuildRedDotCache(Config.ConfigGuild.TabId.Order)
|
|
Message.show(has_red and "该拼单已完成,请选择其他的吧" or "今日次数不足", "fault")
|
|
else
|
|
local max_member = TableSize(data.teams) >= (sl_cfg.max_num - 1)
|
|
if not max_member then -- 人数没有满就要弹出二次确认界面
|
|
if self.cur_profit == self.base_ratio then -- 没有邀请成员
|
|
Message.show("至少需要1位协助者才可发起拼单")
|
|
return
|
|
end
|
|
local function ok( ... )
|
|
self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40036, 1, data.order)
|
|
end
|
|
local ask_str = string.format("邀请人数越多,奖励越多,您当前的收益为<color=%s>%s%%</color>,是否确认发起拼单?",
|
|
ColorUtil.GREEN_DARK, self.cur_profit+self.act_buff_add_ridio)
|
|
if not self.go_btn_imgex.gray then -- 置灰了就不需要二次弹窗
|
|
Alert.show(ask_str, Alert.Type.Two, ok, nil, "确定", "取消")
|
|
end
|
|
else
|
|
self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40036, 1, data.order)
|
|
end
|
|
end
|
|
end
|
|
elseif target == self.buffBtn_obj then--buff相关
|
|
local buff_kind = OperateActivityModel.MaterialSubmitBuffKind.GUILD_SPORT --触发加成后,玩家赏金幻魔/专属幻魔掉落概率+100%
|
|
local buff_cfg,buff_info,dot = OperateActivityModel:getInstance():GetMaterialBuffInfoByKind(buff_kind)
|
|
if buff_cfg and buff_info then
|
|
local abs_pos = target.transform:TransformPoint(Vector3.zero)
|
|
local sub_type = CustomActivityModel:getInstance():getActMinSubType(CustomActivityModel.CustomActBaseType.MATERIAL_SUBMIT)
|
|
local act_list = CustomActivityModel:getInstance():getActList(CustomActivityModel.CustomActBaseType.MATERIAL_SUBMIT, sub_type)
|
|
if act_list then
|
|
local buff_data = nil
|
|
for k,v in pairs(act_list.condition_list) do--[{role_lv,80},{sub,1},{cost,30},{group,5}]
|
|
if v[1] == "suit" then--全服进度套件ID
|
|
buff_data = OperateActivityModel:getInstance():GetMaterialSubmitServerCfg(tonumber(v[2]),dot)
|
|
break
|
|
end
|
|
end
|
|
if buff_data then
|
|
local data = {
|
|
sub_type = sub_type,
|
|
buff_data = buff_data,
|
|
pos_x = abs_pos.x,
|
|
pos_y = abs_pos.y,
|
|
is_outside = true,
|
|
}
|
|
OperateActivityModel:getInstance():Fire(OperateActivityModel.OPEN_MATERIAL_SUBMIT_BUFF_VIEW,data)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
end
|
|
AddClickEvent(self.invite_close_obj, click_event)
|
|
AddClickEvent(self.refresh_btn_obj, click_event)
|
|
AddClickEvent(self.go_btn_obj, click_event)
|
|
AddClickEvent(self.buffBtn_obj, click_event)
|
|
|
|
|
|
local function updateSpellListData() -- 更新拼单数据
|
|
self:UpdateSpellListItem()
|
|
self:UpdateCurSpellListData()
|
|
self:UpdateRefreshCost()
|
|
end
|
|
self:BindEvent(self.model, GuildModel.UPDATE_GUILD_SL_DATA, updateSpellListData)
|
|
|
|
local function updateSelectedSLData(opty) -- 更新选中的拼单数据
|
|
self:UpdateCurSpellListData()
|
|
if opty and opty == 1 then -- 如果是拼单完成了,则关闭拼单邀请弹窗
|
|
self.invite_window_obj:SetActive(false)
|
|
end
|
|
end
|
|
self:BindEvent(self.model, GuildModel.UPDATE_SELECTED_GUILD_SL_DATA, updateSelectedSLData)
|
|
|
|
local function updateGuildMember() -- 社团内成员变动要刷一次邀请界面
|
|
self:UpdateInviteMenItem()
|
|
end
|
|
self:BindEvent(self.model, GuildModel.RefreshMainViewMemberInfoEvt, updateGuildMember)
|
|
|
|
local function updata_buff_state(id)
|
|
if id == KfActivityModel.TabID.MaterialSubmit and self.is_loaded then
|
|
self:UpdateInviteMenItem()
|
|
self:UpdateSpellListItem()
|
|
end
|
|
end
|
|
self:BindEvent(KfActivityModel:getInstance(), KfActivityModel.ANS_UPDATE_VIEW, updata_buff_state)
|
|
end
|
|
|
|
function GuildSpellListView:UpdateView( )
|
|
self:UpdateSpellListItem() -- 更新当前拼单item节点
|
|
self:UpdateCurSpellListData()
|
|
self:UpdateInviteMenItem()
|
|
self:UpdateRefreshCost()
|
|
end
|
|
|
|
function GuildSpellListView:UpdateSpellListItem( )
|
|
local sl_data = self.model:GetGuildSpellListData()
|
|
if not sl_data or not sl_data.guild_orders then return end
|
|
|
|
local buff_kind = OperateActivityModel.MaterialSubmitBuffKind.GUILD_SPORT --触发加成后,玩家赏金幻魔/专属幻魔掉落概率+100%
|
|
local buff_cfg,buff_info = OperateActivityModel:getInstance():GetMaterialBuffInfoByKind(buff_kind)
|
|
-- buff_info = {etime = TimeUtil:getServerTime( )+300,used = {{kdata=1,vdata = 0}}}
|
|
-- buff_cfg = {data = 100}
|
|
self.have_buff_time = 0
|
|
self.buff_add_percent = 0
|
|
self.buffBtn_obj:SetActive(false)
|
|
if buff_cfg and buff_info then
|
|
local sec = buff_info.etime - TimeUtil:getServerTime( )
|
|
if sec > 0 then
|
|
self.have_buff_time = 1
|
|
local buff_drop_times = buff_cfg.data
|
|
for k,v in pairs(buff_info.used) do
|
|
if v.kdata == 1 then--次数是否用完
|
|
if v.vdata > 0 then
|
|
self.have_buff_time = 0
|
|
end
|
|
break
|
|
end
|
|
end
|
|
self.buff_add_percent = buff_cfg.data
|
|
self.buffBtn_obj:SetActive(true)
|
|
lua_resM:setOutsideImageSprite(self, self.buffBtn_img, GameResPath.GetOperateActImage("ms_buff_btn_kind_16"), true)
|
|
self:ActBuffTimeLate(sec)
|
|
end
|
|
end
|
|
|
|
local total_num = self.model:GetGuildKvByKey("accept_limit").val + self.have_buff_time
|
|
self.spell_time_tmp.text = string.format("今日次数:<color=%s>%s</color>/%s%s",
|
|
total_num > sl_data.ordered and ColorUtil.GREEN_DARK or ColorUtil.RED_DARK,
|
|
total_num - sl_data.ordered, total_num, self.have_buff_time>0 and HtmlColorTxt("(+1)", ColorUtil.YELLOW_DARK) or "")
|
|
for k, v in ipairs(sl_data.guild_orders) do
|
|
self.sl_item[k] = self.sl_item[k] or GuildSpellListItem.New(self.list_con)
|
|
local x_index = k % 3
|
|
x_index = x_index == 0 and 3 or x_index
|
|
local y_index = math.floor((k - 1) / 3)
|
|
self.sl_item[k]:SetAnchoredPosition((x_index - 1) * 234 + 0.5, y_index * -277 - 2)
|
|
self.sl_item[k]:SetData(v)
|
|
end
|
|
end
|
|
|
|
--活动BUFF时间倒计时
|
|
function GuildSpellListView:ActBuffTimeLate( sec )
|
|
if self.is_loaded then
|
|
if self.act_buff_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.act_buff_timer_id)
|
|
self.act_buff_timer_id = nil
|
|
end
|
|
if self.buff_btn_act_sec == sec then
|
|
return
|
|
else
|
|
self.buff_btn_act_sec = sec
|
|
end
|
|
local sec = sec or 0
|
|
if sec > 0 then
|
|
local function onTimer()
|
|
sec = sec - 1
|
|
if sec > 0 then
|
|
else
|
|
self:UpdateSpellListItem()
|
|
if self.act_buff_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.act_buff_timer_id)
|
|
self.act_buff_timer_id = nil
|
|
end
|
|
end
|
|
end
|
|
if not self.act_buff_timer_id then
|
|
self.act_buff_timer_id = GlobalTimerQuest:AddPeriodQuest(onTimer, 1, -1)
|
|
end
|
|
onTimer()
|
|
else
|
|
self:UpdateSpellListItem()
|
|
end
|
|
end
|
|
end
|
|
|
|
-- 加载邀请的社团成员列表
|
|
function GuildSpellListView:UpdateInviteMenItem( )
|
|
local mem_list = self.model:GetGuildMemberListForInviteView(1)
|
|
self.mem_item_creator = self.mem_item_creator or self:AddUIComponent(UI.ItemListCreator)
|
|
local info = {
|
|
data_list = mem_list,
|
|
item_con = self.invite_con,
|
|
scroll_view = self.invite_scroll,
|
|
item_class = GuildSpellListInviteItem,
|
|
item_height = 89,
|
|
start_y = 3,
|
|
create_frequency = 0.01,
|
|
alignment = UnityEngine.TextAnchor.UpperLeft,
|
|
on_update_item = function(item, i, v)
|
|
item:SetData(v, i, self.buff_add_percent)
|
|
end,
|
|
}
|
|
self.mem_item_creator:UpdateItems(info)
|
|
end
|
|
|
|
-- 更新当前选中的拼单数据
|
|
function GuildSpellListView:UpdateCurSpellListData()
|
|
local data = self.model:GetCurSelectedSpellListData()
|
|
local sl_data = self.model:GetGuildSpellListData()
|
|
if not data or not sl_data then return end
|
|
-- 获取订单配置
|
|
local sl_cfg = Config.Guildorder[data.cfg]
|
|
local total_num = self.model:GetGuildKvByKey("accept_limit").val
|
|
lua_resM:setImageSprite(self, self.qua_title_bg_img, "guild_asset", "g_sl_title" .. sl_cfg.color)
|
|
self.list_name_tmp.text = string.format("<color=%s>%s</color>", GuildModel.SpellListColor[sl_cfg.color], Trim(sl_cfg.name))
|
|
self.list_desc_tmp.text = Trim(sl_cfg.desc)
|
|
self.list_cond_tmp.text = string.format("所需拼单人数:<color=#fdffc2>%s</color>人", sl_cfg.max_num)
|
|
-- 加载拼单奖励
|
|
-- 发起奖励
|
|
self:UpdateRewards(stringtotable(sl_cfg.awards), self.launch_reward_list, self.launch_scroll, self.launch_con)
|
|
-- 参与奖励
|
|
self:UpdateRewards(stringtotable(sl_cfg.order_reward), self.accept_reward_list, self.accept_scroll, self.accept_con)
|
|
-- 更新参与玩家头像信息
|
|
for k, v in ipairs(self.attend_head_list) do
|
|
v:SetVisible(false)
|
|
end
|
|
local function click_callback()
|
|
if data and data.state < 3 then -- 未完成
|
|
self.invite_window_obj:SetActive(true)
|
|
else
|
|
Message.show("该拼单已完成", "fault")
|
|
end
|
|
end
|
|
local offset_x = (self.head_con.sizeDelta.x - sl_cfg.max_num * 85)/2 + 5
|
|
local base_reward = self.model:GetGuildKvByKey("base_reward")
|
|
self.base_ratio = base_reward and base_reward.val or 0 -- 基础收益率
|
|
self.cur_profit = self.base_ratio
|
|
local base_reward_pec = self.cur_profit
|
|
local role_data
|
|
local life_skill_active = PetModel:getInstance():IsLifeSkillActived(PetConst.LifeSkill.GuildSpellAssitRewardUp)
|
|
local life_skill_ratio = PetModel:getInstance():GetPetLifeSkillRatio(PetConst.LifeSkill.GuildSpellAssitRewardUp)
|
|
for i = 1, sl_cfg.max_num do -- 拼单需要几个人就加载几个头像
|
|
self.attend_head_list[i] = self.attend_head_list[i] or GuildSpellListHeadItem.New(self.head_con)
|
|
self.attend_head_list[i]:SetAnchoredPosition(offset_x + (i-1) * 85, -3.5)
|
|
-- i=1的时候用自己的头像,从2开始用i-1的头像数据
|
|
role_data = i > 1 and data.teams[i-1] or nil
|
|
self.attend_head_list[i]:SetData(i, sl_cfg, role_data, click_callback)
|
|
self.attend_head_list[i]:SetVisible(true)
|
|
self.attend_head_list[i]:StartAddBtnAnim()
|
|
-- 累计收益率
|
|
if role_data then
|
|
local is_ai = role_data.role_id < 10
|
|
|
|
--宠物生活技能 拼单邀请社团助手时额外增加收益
|
|
local ai_ratio = sl_cfg.ai_ratio
|
|
if life_skill_active then
|
|
ai_ratio = ai_ratio + life_skill_ratio
|
|
end
|
|
|
|
self.cur_profit = self.cur_profit + (is_ai and ai_ratio or sl_cfg.people_ratio)
|
|
end
|
|
end
|
|
self.act_buff_add_ridio = self.buff_add_percent*#data.teams
|
|
local buff_str = self.buff_add_percent>0 and #data.teams>0 and "+"..self.buff_add_percent*#data.teams.."%" or ""
|
|
buff_str = HtmlColorTxt(buff_str, ColorUtil.YELLOW_DARK)
|
|
self.profit_pec_tmp.text = string.format("邀请人数越多,奖励越多(当前收益<color=%s>%s%%</color>%s)",
|
|
self.cur_profit > 0 and ColorUtil.GREEN_DARK or ColorUtil.RED_DARK, self.cur_profit,buff_str)
|
|
self.spell_tip_tmp.text = string.format("可向社团成员请求拼单(<color=%s>%s</color>/%s)",
|
|
ColorUtil.GREEN_DARK, #data.teams + 1, sl_cfg.max_num)
|
|
-- 更新按钮表现
|
|
if total_num - sl_data.ordered > 0 then
|
|
if data.state == 3 then
|
|
self.go_btn_lb_tmp.text = "前往感谢"
|
|
self.go_btn_imgex.gray = false
|
|
SetTMPSharedMaterial(self.go_btn_lb_tmp, ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkOrangeBtn)
|
|
elseif data.state == 4 then
|
|
self.go_btn_lb_tmp.text = "拼单已完成"
|
|
self.go_btn_imgex.gray = true
|
|
SetTMPSharedMaterial(self.go_btn_lb_tmp, ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkGrayBtn)
|
|
else
|
|
self.go_btn_lb_tmp.text = "发起拼单"
|
|
-- 没有收益率时置灰
|
|
self.go_btn_imgex.gray = self.cur_profit == base_reward_pec
|
|
SetTMPSharedMaterial(self.go_btn_lb_tmp, self.cur_profit == base_reward_pec and ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkGrayBtn
|
|
or ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkOrangeBtn)
|
|
end
|
|
else
|
|
-- 没次数的表现
|
|
self.go_btn_lb_tmp.text = "发起拼单"
|
|
self.go_btn_imgex.gray = true
|
|
SetTMPSharedMaterial(self.go_btn_lb_tmp, ShaderTools.TMPSharedMaterialType.FZZZOutlineDarkGrayBtn)
|
|
end
|
|
end
|
|
-- 加载奖励 data:数据 list:节点列表 scrollRect:滚动容器 node:滚动容器内的content
|
|
function GuildSpellListView:UpdateRewards(data, list, scrollRect, node)
|
|
if not list or not scrollRect or not node then return end
|
|
data = data or {}
|
|
-- 隐藏多余的奖励item
|
|
for k, v in ipairs(list) do
|
|
v:SetVisible(false)
|
|
end
|
|
local count = #data
|
|
local offer_x = 8
|
|
for k, v in ipairs(data) do
|
|
list[k] = list[k] or UIObjPool:getInstance():PopItem(UIObjPool.UIType.AwardItem, node)
|
|
|
|
list[k]:SetPosition((78+offer_x)*(k - 1), -2)
|
|
list[k]:SetItemSize(78, 78)
|
|
list[k]:SetVisible(true)
|
|
local typeId, lock = GoodsModel:getInstance():GetMappingTypeId(v[1], v[2])
|
|
list[k]:SetData(typeId, v[3], nil, nil, lock)
|
|
end
|
|
node.sizeDelta = Vector2((78+offer_x) * count, 88)
|
|
-- 做居中效果判断
|
|
local sum_x = (78+offer_x) * count
|
|
local size_x = scrollRect.sizeDelta.x
|
|
if sum_x < size_x then
|
|
local offset_x = (size_x - sum_x)/2
|
|
for i=1, TableSize(list) do
|
|
local pos = list[i]:GetAnchoredPosition()
|
|
list[i]:SetAnchoredPosition(pos.x + offset_x, pos.y)
|
|
end
|
|
end
|
|
-- 如果奖励没有超框,则不给滚动,空表也可以避免横向滚动
|
|
scrollRect:GetComponent(typeof(UnityEngine.UI.ScrollRect)).enabled = sum_x >= size_x
|
|
end
|
|
|
|
-- 更新刷新花费
|
|
function GuildSpellListView:UpdateRefreshCost( )
|
|
local sl_data = self.model:GetGuildSpellListData()
|
|
local free_refresh_time = self.model:GetGuildKvByKey("order_refresh_free").val
|
|
local cost_cfg = stringtotable(self.model:GetGuildKvByKey("order_refresh_cost").val)[1]
|
|
self.refresh_cost = cost_cfg
|
|
if sl_data and sl_data.refreshed < free_refresh_time then -- 还能免费刷新
|
|
self.r_cost_icon_img.enabled = false
|
|
self.r_cost_lb1_tmp.text = string.format("刷新(今日免费:<color=%s>%s</color>/%s)", ColorUtil.GREEN_DARK,
|
|
free_refresh_time - sl_data.refreshed, free_refresh_time)
|
|
self.r_cost_lb2_tmp.text = ""
|
|
else
|
|
local icon_ab, icon_res = WordManager:GetCommonMoneyIcon(cost_cfg[1])
|
|
self.r_cost_icon_img.enabled = true
|
|
lua_resM:setImageSprite(self, self.r_cost_icon_img, icon_ab, icon_res, true)
|
|
self.r_cost_lb1_tmp.text = "刷新("
|
|
self.r_cost_lb2_tmp.text = string.format("<color=#fdffc2>x %s</color>)", cost_cfg[3])
|
|
end
|
|
local len1 = self.r_cost_icon.sizeDelta.x
|
|
local len2 = self.r_cost_lb1_tmp.preferredWidth
|
|
local len3 = self.r_cost_lb2_tmp.preferredWidth
|
|
SetAnchoredPositionX(self.r_cost_lb1, 0)
|
|
SetAnchoredPositionX(self.r_cost_icon, len1 + 5)
|
|
SetAnchoredPositionX(self.r_cost_lb2, len1 + len2 + 10)
|
|
end
|
|
|
|
-- 刷新按钮逻辑
|
|
function GuildSpellListView:OnRefreshBtnClick( )
|
|
local sl_data = self.model:GetGuildSpellListData()
|
|
local free_refresh_time = self.model:GetGuildKvByKey("order_refresh_free").val
|
|
local jin = self.main_vo.jin
|
|
-- 判断是否有进行中的拼单和高品质未完成拼单
|
|
local has_invited, has_high_quality = false, false
|
|
for k, v in ipairs(sl_data.guild_orders) do
|
|
if v.state < 3 and TableSize(v.teams) > 0 then
|
|
has_invited = true
|
|
end
|
|
if Config.Guildorder[v.cfg].color >= 3 and v.state < 3 then -- 有未完成的高品质拼单
|
|
has_high_quality = true
|
|
end
|
|
end
|
|
|
|
local function ok_callback()
|
|
-- 刷新拼单数据
|
|
self.model:Fire(GuildModel.REQUEST_CCMD_EVENT, 40066)
|
|
end
|
|
local function toggle_function(bool)
|
|
self.model._dont_check_sl_refresh = bool
|
|
end
|
|
local function use_function( toggle_tip_data, call_fun_sum )
|
|
GlobalEventSystem:Fire(EventName.OPEN_COM_TOGGLE_TIP_VIEW, toggle_tip_data)
|
|
end
|
|
local function ok_quality_check(comfirm_callback)
|
|
local function ok_callback_final(bool)
|
|
self.model._dont_check_sl_high_quality = bool
|
|
if comfirm_callback then
|
|
comfirm_callback()
|
|
else
|
|
ok_callback()
|
|
end
|
|
end
|
|
local ask_str2 = "当前存在高品质的拼单,是否确定刷新?"
|
|
Alert.show(ask_str2, Alert.Type.Four, ok_callback_final, nil, "确定", "取消")
|
|
end
|
|
|
|
local function ok_check_func(comfirm_callback)
|
|
if has_invited and not self.model._dont_check_sl_invited then -- 存在已邀请拼单同时允许检测
|
|
local function ok_callback_extra(bool)
|
|
self.model._dont_check_sl_invited = bool
|
|
if has_high_quality and not self.model._dont_check_sl_high_quality then
|
|
ok_quality_check(comfirm_callback)
|
|
else
|
|
if comfirm_callback then
|
|
comfirm_callback()
|
|
else
|
|
ok_callback()
|
|
end
|
|
end
|
|
end
|
|
local ask_str1 = "是否确定刷新拼单列表?\n(当前有进行中的拼单,其数据也会一并清除)"
|
|
Alert.show(ask_str1, Alert.Type.Two, ok_callback_extra, nil, "确定", "取消")
|
|
else
|
|
if has_high_quality and not self.model._dont_check_sl_high_quality then -- 存在高品质未完成拼单同时允许检测
|
|
ok_quality_check(comfirm_callback)
|
|
else
|
|
if comfirm_callback then
|
|
comfirm_callback()
|
|
else
|
|
ok_callback()
|
|
end
|
|
end
|
|
end
|
|
end
|
|
local skip_quality_check = false
|
|
local function jump_buy_tips()
|
|
local data = {
|
|
gold_type = tonumber(self.refresh_cost[1]),
|
|
cost_price = tonumber(self.refresh_cost[3]),
|
|
ok_callback = skip_quality_check and ok_callback or ok_check_func,
|
|
toggle_function = toggle_function,
|
|
togglePriceStr = string.format("<color=%s>%s</color> 刷新拼单列表?",
|
|
ColorUtil.YELLOW_DARK, self.refresh_cost[3]),
|
|
use_function = use_function,
|
|
}
|
|
CustomActivityModel:getInstance():BuyTips(data)
|
|
end
|
|
-- 套娃弹窗
|
|
if sl_data and sl_data.refreshed < free_refresh_time then -- 还能免费刷新
|
|
ok_check_func() -- 免费刷新,则不检测货币
|
|
else
|
|
if not self.model._dont_check_sl_refresh then
|
|
skip_quality_check = true
|
|
ok_check_func(jump_buy_tips) -- 需要先判断拼单等级,通过拼单等级得二次确认之后再弹出彩钻充值
|
|
else
|
|
jump_buy_tips() -- 直接走彩钻判断
|
|
end
|
|
end
|
|
end
|
|
|
|
function GuildSpellListView:__delete( )
|
|
if self.act_buff_timer_id then
|
|
GlobalTimerQuest:CancelQuest(self.act_buff_timer_id)
|
|
self.act_buff_timer_id = nil
|
|
end
|
|
|
|
for k, v in pairs(self.sl_item) do
|
|
v:DeleteMe()
|
|
v = nil
|
|
end
|
|
self.sl_item = nil
|
|
|
|
for k, v in pairs(self.attend_head_list) do
|
|
v:DeleteMe()
|
|
v = nil
|
|
end
|
|
self.attend_head_list = nil
|
|
|
|
for k, v in pairs(self.launch_reward_list) do
|
|
UIObjPool:getInstance():PushItem(UIObjPool.UIType.AwardItem, v)
|
|
v = nil
|
|
end
|
|
self.launch_reward_list = nil
|
|
|
|
for k, v in pairs(self.accept_reward_list) do
|
|
UIObjPool:getInstance():PushItem(UIObjPool.UIType.AwardItem, v)
|
|
v = nil
|
|
end
|
|
self.accept_reward_list = nil
|
|
end
|