【破阵诛仙】点金达人任务,跳转点金,不计数
parent
24f6333726
commit
c5ffb7cb23
|
|
@ -3,41 +3,66 @@ local DynamicActivityPanel = Inherit(BasePanel)
|
|||
local this = DynamicActivityPanel
|
||||
-- Tab管理器
|
||||
local TabBox = require("Modules/Common/TabBox")
|
||||
local GlobalActConfig = ConfigManager.GetConfig(ConfigName.GlobalActivity)
|
||||
this._CurPageIndex =1
|
||||
local orginLayer
|
||||
local _PageInfo = {--后期可以做成tableInsert,icon名字都去读表
|
||||
local tabs = {
|
||||
[1] = { --破阵诛仙
|
||||
default = "p_pozhengzhuxian_anniu_02", lock = "p_pozhengzhuxian_anniu_02", select = "p_pozhengzhuxian_anniu_01",
|
||||
rpType = RedPointType.PoZhenZhuXianTask,panelType = PanelType.Main,
|
||||
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
||||
},
|
||||
[2] = { --限时召唤
|
||||
[2] = { --勇冠三军
|
||||
default = "c_ydsj_anniu_02", lock = "c_ydsj_anniu_02", select = "c_ydsj_anniu_01",
|
||||
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
||||
},
|
||||
[3] = { --叱咤风云
|
||||
default = "c_ccfy_icon2", lock = "c_ccfy_icon2", select = "c_ccfy_icon1",
|
||||
rpType = RedPointType.DynamicActTask,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct
|
||||
},
|
||||
[4] = { --限时召唤
|
||||
default = "x_xianshizaohuan_02", lock = "x_xianshizaohuan_02", select = "x_xianshizaohuan_01",
|
||||
rpType = RedPointType.TimeLimited,panelType = PanelType.TimelimitCall,
|
||||
rpType = RedPointType.TimeLimited,panelType = PanelType.TimelimitCall,ActType = ActivityTypeDef.FindFairy
|
||||
},
|
||||
[3] = { --乾坤宝盒
|
||||
[5] = { --乾坤宝盒
|
||||
default = "q_qiankun_baoheanniu_02", lock = "q_qiankun_baoheanniu_02", select = "q_qiankun_baoheanniu_01",
|
||||
rpType = RedPointType.QianKunBox,panelType = PanelType.QianKunBox,
|
||||
rpType = RedPointType.QianKunBox,panelType = PanelType.QianKunBox,ActType = ActivityTypeDef.QianKunBox
|
||||
},
|
||||
[4] = { --珍奇礼包
|
||||
[6] = { --珍奇礼包
|
||||
default = "z_zhenqibaoge_anniu_02", lock = "z_zhenqibaoge_anniu_02", select = "z_zhenqibaoge_anniu_01",
|
||||
rpType = "",panelType = PanelType.Main,
|
||||
rpType = "",panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct_Treasure
|
||||
},
|
||||
[5] = { --累计充值
|
||||
[7] = { --累计充值
|
||||
default = "r_huodong_leijichengzhianniu_01", lock = "r_huodong_leijichengzhianniu_01", select = "r_huodong_leijichengzhianniu",
|
||||
rpType = RedPointType.PoZhenZhuXianRecharge,panelType = PanelType.Main,
|
||||
rpType = RedPointType.DynamicActRecharge,panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct_recharge
|
||||
},
|
||||
[6] = { --限时商市
|
||||
[8] = { --限时商市
|
||||
default = "x_xianshishangshi_anniu_02", lock = "x_xianshishangshi_anniu_02", select = "x_xianshishangshi_anniu_01",
|
||||
rpType = "",panelType = PanelType.Main,
|
||||
rpType = "",panelType = PanelType.Main,ActType = ActivityTypeDef.DynamicAct_TimeLimitShop
|
||||
},
|
||||
[9] = { --限时兑换
|
||||
default = "r_xianshiduihuan_anniu_01", lock = "r_xianshiduihuan_anniu_01", select = "r_xianshiduihuan_anniu",
|
||||
rpType = "",panelType = PanelType.Main,ActType = ActivityTypeDef.LimitExchange
|
||||
},
|
||||
}
|
||||
local _PageInfo = {--后期可以做成tableInsert,icon名字都去读表
|
||||
[1] = 1,
|
||||
[2] = 1,
|
||||
[3] = 1,
|
||||
[4] = 2,
|
||||
[5] = 3,
|
||||
[6] = 4,
|
||||
[7] = 5,
|
||||
[8] = 6,
|
||||
[9] = 7,
|
||||
}
|
||||
|
||||
local TimeLimitedCall = require("Modules/DynamicActivity/TimeLimitedCall")
|
||||
local QianKunBox = require("Modules/DynamicActivity/QianKunBox")
|
||||
local PoZhenZhuXianPage=require("Modules/DynamicActivity/PoZhenZhuXianPage")
|
||||
local DynamicActPage=require("Modules/DynamicActivity/DynamicTaskPage")
|
||||
local ZhenQiYiBaoPage=require("Modules/DynamicActivity/ZhenQiYiBaoPage")
|
||||
local LeiJiChongZhiPage=require("Modules/DynamicActivity/LeiJiChongZhiPage")
|
||||
local XianShiShangShi=require("Modules/DynamicActivity/XianShiShangShi")
|
||||
local XianShiDuiHuan=require("Modules/Expert/ExChange")
|
||||
|
||||
--初始化组件(用于子类重写)
|
||||
function DynamicActivityPanel:InitComponent()
|
||||
|
|
@ -47,12 +72,13 @@ function DynamicActivityPanel:InitComponent()
|
|||
this.content = Util.GetGameObject(self.gameObject, "bg/pageContent")
|
||||
|
||||
this.PageList = {
|
||||
[1] = PoZhenZhuXianPage.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_3")),
|
||||
[1] = DynamicActPage.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_3")),
|
||||
[2] = TimeLimitedCall.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_1")),
|
||||
[3] = QianKunBox.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_2")),
|
||||
[4] = ZhenQiYiBaoPage.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_4")),
|
||||
[5] = LeiJiChongZhiPage.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_5")),
|
||||
[6] = XianShiShangShi.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_6")),
|
||||
[7] = XianShiDuiHuan.new(self, Util.GetGameObject(self.transform, "bg/pageContent/page_7")),
|
||||
}
|
||||
|
||||
-- 上部货币显示
|
||||
|
|
@ -65,7 +91,6 @@ function DynamicActivityPanel:BindEvent()
|
|||
this.PageTabCtrl:SetTabAdapter(this.PageTabAdapter)
|
||||
this.PageTabCtrl:SetTabIsLockCheck(this.PageTabIsLockCheck)
|
||||
this.PageTabCtrl:SetChangeTabCallBack(this.OnPageTabChange)
|
||||
|
||||
-- 关闭界面打开主城
|
||||
Util.AddClick(this.btnBack, function()
|
||||
this:ClosePanel()
|
||||
|
|
@ -75,15 +100,26 @@ end
|
|||
|
||||
--添加事件监听(用于子类重写)
|
||||
function DynamicActivityPanel:AddListener()
|
||||
for i = 1, #this.PageList do
|
||||
if this.PageList[i] then
|
||||
this.PageList[i]:AddListener()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function DynamicActivityPanel:RemoveListener()
|
||||
for i = 1, #this.PageList do
|
||||
if this.PageList[i] then
|
||||
this.PageList[i]:RemoveListener()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--界面打开时调用(用于子类重写)
|
||||
function DynamicActivityPanel:OnOpen(chooseIndex)
|
||||
-- 初始化tab数据
|
||||
this.PageTabCtrl:Init(this.tabbox, _PageInfo)
|
||||
this.PageTabCtrl:Init(this.tabbox, tabs)
|
||||
this._CurPageIndex = chooseIndex or 1
|
||||
|
||||
end
|
||||
|
|
@ -102,7 +138,7 @@ function this.PageTabAdapter(tab, index, status)
|
|||
local lock = Util.GetGameObject(tab, "lock")
|
||||
local redpot = Util.GetGameObject(tab, "redpot")
|
||||
|
||||
img.sprite = Util.LoadSprite(_PageInfo[index][status])
|
||||
img.sprite = Util.LoadSprite(tabs[index][status])
|
||||
img:SetNativeSize()
|
||||
local islock = status == "lock"
|
||||
Util.SetGray(img.gameObject, islock)
|
||||
|
|
@ -114,6 +150,21 @@ function this.PageTabAdapter(tab, index, status)
|
|||
this.ClearPageRedpot(index)
|
||||
this.BindPageRedpot(index, redpot)
|
||||
end
|
||||
local id = ActivityGiftManager.IsActivityTypeOpen(tabs[index].ActType)
|
||||
if id and id > 0 then
|
||||
if GlobalActConfig[id].ShowArt and GlobalActConfig[id].ShowArt > 0 then
|
||||
tab:SetActive(GlobalActConfig[id].ShowArt == index)
|
||||
else
|
||||
tab.gameObject:SetActive(true)
|
||||
end
|
||||
|
||||
--限时兑换特殊处理
|
||||
if GlobalActConfig[id].Type == ActivityTypeDef.LimitExchange then
|
||||
tab.gameObject:SetActive(GlobalActConfig[id].ShowArt ~= 1)
|
||||
end
|
||||
else
|
||||
tab.gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
|
||||
-- tab可用性检测
|
||||
|
|
@ -130,18 +181,17 @@ function this.OnPageTabChange(index)
|
|||
this.PageList[i]:OnHide()
|
||||
this.PageList[i].gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
end
|
||||
this.PageList[index]:OnShow(this.sortingOrder,this)
|
||||
this.PageList[index].gameObject:SetActive(true)
|
||||
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = _PageInfo[index].panelType })
|
||||
this.PageList[_PageInfo[index]]:OnShow(this.sortingOrder,this)
|
||||
this.PageList[_PageInfo[index]].gameObject:SetActive(true)
|
||||
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = tabs[index].panelType })
|
||||
end
|
||||
|
||||
-- 绑定数据
|
||||
local _PageBindData = {}
|
||||
local _TabBindData = {}
|
||||
function this.BindPageRedpot(page, redpot)
|
||||
local rpType = _PageInfo[page].rpType
|
||||
local rpType = tabs[page].rpType
|
||||
if not rpType then return end
|
||||
BindRedPointObject(rpType, redpot)
|
||||
_PageBindData[rpType] = redpot
|
||||
|
|
@ -149,7 +199,7 @@ end
|
|||
function this.ClearPageRedpot(page)
|
||||
-- 清除红点绑定
|
||||
if page then -- 清除某个
|
||||
local rpType = _PageInfo[page].rpType
|
||||
local rpType = tabs[page].rpType
|
||||
if not rpType then return end
|
||||
ClearRedPointObject(rpType, _PageBindData[rpType])
|
||||
_PageBindData[rpType] = nil
|
||||
|
|
@ -164,8 +214,8 @@ end
|
|||
--界面关闭时调用(用于子类重写)
|
||||
function DynamicActivityPanel:OnClose()
|
||||
if this._CurPageIndex then
|
||||
this.PageList[this._CurPageIndex]:OnHide()
|
||||
this.PageList[this._CurPageIndex].gameObject:SetActive(false)
|
||||
this.PageList[_PageInfo[this._CurPageIndex]]:OnHide()
|
||||
this.PageList[_PageInfo[this._CurPageIndex]].gameObject:SetActive(false)
|
||||
end
|
||||
end
|
||||
--界面销毁时调用(用于子类重写)
|
||||
|
|
|
|||
|
|
@ -1,62 +1,76 @@
|
|||
local PoZhenZhuXianPage = quick_class("PoZhenZhuXianPage")
|
||||
local DynamicTaskPage = quick_class("DynamicTaskPage")
|
||||
local allData={}
|
||||
local itemsGrid = {}--item重复利用
|
||||
local singleTaskPre = {}
|
||||
local this=PoZhenZhuXianPage
|
||||
local this=DynamicTaskPage
|
||||
local parent
|
||||
local endtime = 0
|
||||
function PoZhenZhuXianPage:ctor(mainPanel, gameObject)
|
||||
local bannerType = {
|
||||
[1] = "bg1",
|
||||
[2] = "bg2",
|
||||
[3] = "bg3",
|
||||
}
|
||||
local GlobalActConfig = ConfigManager.GetConfig(ConfigName.GlobalActivity)
|
||||
function DynamicTaskPage:ctor(mainPanel, gameObject)
|
||||
self.mainPanel = mainPanel
|
||||
self.gameObject = gameObject
|
||||
self:InitComponent(gameObject)
|
||||
self:BindEvent()
|
||||
end
|
||||
|
||||
function PoZhenZhuXianPage:InitComponent(gameObject)
|
||||
function DynamicTaskPage:InitComponent(gameObject)
|
||||
itemsGrid = {}--item重复利用
|
||||
singleTaskPre = {}
|
||||
this.time = Util.GetGameObject(gameObject, "content/tiao/time"):GetComponent("Text")
|
||||
this.itemPre = Util.GetGameObject(gameObject, "content/itempre")
|
||||
this.scrollItem = Util.GetGameObject(gameObject, "content/grid")
|
||||
this.time = Util.GetGameObject(gameObject, "tiao/time"):GetComponent("Text")
|
||||
this.itemPre = Util.GetGameObject(gameObject, "itempre")
|
||||
this.scrollItem = Util.GetGameObject(gameObject, "grid")
|
||||
local rootHight = this.scrollItem.transform.rect.height
|
||||
local width = this.scrollItem.transform.rect.width
|
||||
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.scrollItem.transform,
|
||||
this.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, 30))
|
||||
this.ScrollView.moveTween.MomentumAmount = 1
|
||||
this.ScrollView.moveTween.Strength = 2
|
||||
this.gameObject = gameObject
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
function PoZhenZhuXianPage:BindEvent()
|
||||
function DynamicTaskPage:BindEvent()
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function PoZhenZhuXianPage:AddListener()
|
||||
function this:AddListener()
|
||||
Game.GlobalEvent:AddEvent(GameEvent.DynamicTask.OnMissionChange, this.Refresh)
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function PoZhenZhuXianPage:RemoveListener()
|
||||
function this:RemoveListener()
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.DynamicTask.OnMissionChange, this.Refresh)
|
||||
end
|
||||
|
||||
local sortingOrder = 0
|
||||
--界面打开时调用(用于子类重写)
|
||||
function PoZhenZhuXianPage:OnOpen()
|
||||
function DynamicTaskPage:OnOpen()
|
||||
|
||||
end
|
||||
|
||||
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||||
function PoZhenZhuXianPage:OnShow(_sortingOrder,_parent)
|
||||
function DynamicTaskPage:OnShow(_sortingOrder,_parent)
|
||||
local id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.DynamicAct)
|
||||
local curindex = GlobalActConfig[id].ShowArt
|
||||
for k,v in pairs(bannerType) do
|
||||
Util.GetGameObject(this.gameObject, v):SetActive(false)
|
||||
end
|
||||
Util.GetGameObject(this.gameObject, bannerType[curindex]):SetActive(true)
|
||||
sortingOrder = _sortingOrder
|
||||
parent = _parent
|
||||
this.Refresh()
|
||||
end
|
||||
|
||||
function this.Refresh()
|
||||
allData = OperatingManager:InitPoZhenZhuXianData()
|
||||
allData = OperatingManager:InitDynamicActData()
|
||||
this:OnShowData()
|
||||
this:SetTime()
|
||||
end
|
||||
|
||||
function PoZhenZhuXianPage:SetTime()
|
||||
function DynamicTaskPage:SetTime()
|
||||
if self.timer then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
|
|
@ -98,9 +112,9 @@ function PoZhenZhuXianPage:SetTime()
|
|||
self.timer:Start()
|
||||
end
|
||||
|
||||
function PoZhenZhuXianPage:OnShowData()
|
||||
function DynamicTaskPage:OnShowData()
|
||||
if allData then
|
||||
endtime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.pozhenzhuxian_task)
|
||||
endtime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.DynamicAct)
|
||||
this.SortData(allData)
|
||||
this.ScrollView:SetData(allData, function (index, go)
|
||||
this.SingleDataShow(go, allData[index])
|
||||
|
|
@ -122,7 +136,7 @@ local typeIndex = {
|
|||
[1] = 0,
|
||||
[2] = 2,
|
||||
}
|
||||
function PoZhenZhuXianPage:SortData()
|
||||
function DynamicTaskPage:SortData()
|
||||
if allData==nil then
|
||||
return
|
||||
end
|
||||
|
|
@ -184,10 +198,10 @@ function this.SingleDataShow(pre,value)
|
|||
|
||||
Util.AddOnceClick(Util.GetGameObject(lingquButton.gameObject, "Button"), function()
|
||||
if state == 1 then
|
||||
NetManager.TakeMissionRewardRequest(TaskTypeDef.PoZhenZhuXianTask,sConFigData.id, function(respond)
|
||||
NetManager.TakeMissionRewardRequest(TaskTypeDef.DynamicActTask,sConFigData.id, function(respond)
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup, respond.drop, 1,function ()
|
||||
this.Refresh()
|
||||
CheckRedPointStatus(RedPointType.PoZhenZhuXianTask)
|
||||
CheckRedPointStatus(RedPointType.DynamicActTask)
|
||||
end)
|
||||
end)
|
||||
elseif state == 0 then
|
||||
|
|
@ -199,7 +213,7 @@ function this.SingleDataShow(pre,value)
|
|||
end
|
||||
|
||||
--界面打开时调用(用于子类重写)
|
||||
function PoZhenZhuXianPage:OnOpen()
|
||||
function DynamicTaskPage:OnOpen()
|
||||
|
||||
end
|
||||
|
||||
|
|
@ -209,12 +223,12 @@ function this.RechargeSuccessFunc(id)
|
|||
this.Refresh()
|
||||
end
|
||||
|
||||
function PoZhenZhuXianPage:OnClose()
|
||||
function DynamicTaskPage:OnClose()
|
||||
|
||||
end
|
||||
|
||||
--界面销毁时调用(用于子类重写)
|
||||
function PoZhenZhuXianPage:OnDestroy()
|
||||
function DynamicTaskPage:OnDestroy()
|
||||
if self.timer then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
|
|
@ -224,14 +238,14 @@ function PoZhenZhuXianPage:OnDestroy()
|
|||
itemsGrid = {}
|
||||
end
|
||||
|
||||
function PoZhenZhuXianPage:OnHide()
|
||||
function DynamicTaskPage:OnHide()
|
||||
if self.timer then
|
||||
self.timer:Stop()
|
||||
self.timer = nil
|
||||
end
|
||||
end
|
||||
--- 将一段时间转换为天时分秒
|
||||
function PoZhenZhuXianPage:TimeToDHMS(second)
|
||||
function DynamicTaskPage:TimeToDHMS(second)
|
||||
local day = math.floor(second / (24 * 3600))
|
||||
local minute = math.floor(second / 60) % 60
|
||||
local sec = second % 60
|
||||
|
|
@ -243,4 +257,4 @@ function PoZhenZhuXianPage:TimeToDHMS(second)
|
|||
end
|
||||
end
|
||||
|
||||
return PoZhenZhuXianPage
|
||||
return DynamicTaskPage
|
||||
|
|
@ -280,4 +280,14 @@ function QianKunBox:OnHide()
|
|||
end
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function QianKunBox:AddListener()
|
||||
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function QianKunBox:RemoveListener()
|
||||
|
||||
end
|
||||
|
||||
return QianKunBox
|
||||
|
|
@ -367,4 +367,14 @@ function TimeLimitedCall:OnDestroy()
|
|||
end
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function TimeLimitedCall:AddListener()
|
||||
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function TimeLimitedCall:RemoveListener()
|
||||
|
||||
end
|
||||
|
||||
return TimeLimitedCall
|
||||
|
|
@ -136,6 +136,8 @@ function this.SetTypeTaskState(type, Id, state, progress, takeTimes,heroId)
|
|||
end
|
||||
this.SetDirty()
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.MissionDaily.OnMissionDailyChanged)
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.DynamicTask.OnMissionChange)
|
||||
|
||||
end
|
||||
|
||||
function this.SetMissionIdState(type, Id, state)
|
||||
|
|
@ -200,6 +202,8 @@ function this.RefreshTypeTaskInfo(taskInfoList)
|
|||
this.SetTypeTaskInfo(taskInfo.type, taskInfo.missionId, taskInfo.state, taskInfo.progress, taskInfo.takeTimes,taskInfo.heroId)
|
||||
end
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.MissionDaily.OnMissionDailyChanged)
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.DynamicTask.OnMissionChange)
|
||||
|
||||
this.SetDirty()
|
||||
end
|
||||
|
||||
|
|
@ -305,6 +309,8 @@ function this.ResetTreasureTaskInfo(taskList)
|
|||
end
|
||||
table.insert(TypeTaskData[TaskTypeDef.TreasureOfSomeBody], taskList[i].tasks[i])
|
||||
end
|
||||
Game.GlobalEvent:DispatchEvent(GameEvent.DynamicTask.OnMissionChange)
|
||||
|
||||
CheckRedPointStatus(RedPointType.QinglongSerectTreasureTrail)
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue