--社团协助任务接受界面
|
|
GuildSupportAcceptView = GuildSupportAcceptView or BaseClass(BaseView)
|
|
local GuildSupportAcceptView = GuildSupportAcceptView
|
|
|
|
GuildSupportAcceptView.TITLE_1 = "恭喜您在完成跑环任务时,获得了1个<color=@3>协助任务</color>\n系统已自动帮您发放至<color=@3>协助列表</color>中"
|
|
GuildSupportAcceptView.TITLE_2 = "TA人完成您的协助任务后,您将获得以下奖励:"
|
|
|
|
GuildSupportAcceptView.ViewDepth = 395
|
|
|
|
function GuildSupportAcceptView:__init()
|
|
self.base_file = "guild"
|
|
self.layout_file = "GuildSupportAcceptView"
|
|
self.layer_name = "Main"
|
|
self.destroy_imm = true
|
|
self.use_background = true
|
|
self.hide_maincancas = false
|
|
self.change_scene_close = true
|
|
self.append_to_ctl_queue = false --是否要添加进界面堆栈
|
|
self.need_show_money = false --是否要显示顶部的金钱栏
|
|
self.blur_activity_bg = true
|
|
self.model = GuildModel:getInstance()
|
|
self.item_list = {}
|
|
|
|
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 GuildSupportAcceptView:DestroySuccess()
|
|
for k, v in pairs(self.item_list) do
|
|
v:DeleteMe()
|
|
v = nil
|
|
end
|
|
self.item_list = {}
|
|
if self.timer_countdown then
|
|
TimerQuest.CancelQuest(GlobalTimerQuest, self.timer_countdown)
|
|
self.timer_countdown = nil
|
|
end
|
|
end
|
|
|
|
function GuildSupportAcceptView:LoadSuccess()
|
|
local nodes = {
|
|
"title_1:tmp",
|
|
"title_2:tmp",
|
|
"btnOK:obj",
|
|
"Window/windowCloseBtn:obj",
|
|
"award_con:obj",
|
|
"bg:img",
|
|
"time_lb:tmp",
|
|
}
|
|
self:GetChildren(nodes)
|
|
lua_resM:setOutsideImageSprite(self, self.bg_img, GameResPath.GetViewBigBg("guild_support_accept_bg"))
|
|
if self.need_refreshData then
|
|
self:UpdateView( )
|
|
end
|
|
self.title_1_tmp.text = ChuanWenManager:getInstance():FormatColorTag2(GuildSupportAcceptView.TITLE_1)
|
|
self.title_2_tmp.text = ChuanWenManager:getInstance():FormatColorTag2(GuildSupportAcceptView.TITLE_2)
|
|
|
|
GlobalEventSystem:Fire(EventName.STOP_AUTO_DO_TASK) --停止自动任务
|
|
UIDepth.SetUIDepth(self.gameObject,true,GuildSupportAcceptView.ViewDepth) --强制设置层级
|
|
end
|
|
|
|
function GuildSupportAcceptView:AddEvent()
|
|
local function onBtnClickHandler(target,x,y)
|
|
if target == self.windowCloseBtn_obj then--关闭
|
|
self:Close()
|
|
elseif target == self.btnOK_obj then--确认
|
|
self:Close()
|
|
end
|
|
end
|
|
AddClickEvent(self.windowCloseBtn_obj,onBtnClickHandler)
|
|
AddClickEvent(self.btnOK_obj,onBtnClickHandler)
|
|
|
|
end
|
|
|
|
function GuildSupportAcceptView:Open( data )
|
|
self.data = data
|
|
BaseView.Open(self)
|
|
end
|
|
|
|
function GuildSupportAcceptView:OpenSuccess( )
|
|
self:UpdateView()
|
|
end
|
|
|
|
function GuildSupportAcceptView: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:UpdateItemList()
|
|
self:CheckLeftTime()
|
|
end
|
|
|
|
|
|
function GuildSupportAcceptView:Close( )
|
|
GlobalEventSystem:Fire(EventName.START_AUTO_DO_TASK) --启动自动任务
|
|
BaseView.Close(self)
|
|
end
|
|
|
|
|
|
function GuildSupportAcceptView:UpdateItemList( )
|
|
local cfg = Config.Guildsupport[self.data.id]
|
|
if not cfg then return end
|
|
self.cfg = cfg
|
|
for k,v in pairs(self.item_list) do
|
|
v:SetVisible(false)
|
|
end
|
|
local item_list = stringtotable( cfg.thank_reward)
|
|
|
|
|
|
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(62,62)
|
|
self.item_list[i] = item
|
|
end
|
|
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 GuildSupportAcceptView:CheckLeftTime()
|
|
if self.timer_countdown then
|
|
TimerQuest.CancelQuest(GlobalTimerQuest, self.timer_countdown)
|
|
self.timer_countdown = nil
|
|
end
|
|
local leftTime = 10
|
|
local function timer_func()
|
|
leftTime = leftTime - 1
|
|
if leftTime <= 0 then
|
|
self:Close()
|
|
else
|
|
self.time_lb_tmp.text = string.format("%sS 后自动关闭界面", HtmlColorTxt(tostring(leftTime) , "#2cf86f"))
|
|
end
|
|
end
|
|
self.time_lb_tmp.text = string.format("%sS 后自动关闭界面", HtmlColorTxt(tostring(leftTime) , "#2cf86f"))
|
|
self.timer_countdown = TimerQuest.AddPeriodQuest(GlobalTimerQuest, timer_func, 1)
|
|
timer_func()
|
|
end
|