破阵诛仙 提交

dev_chengFeng
ZhangBiao 2020-08-21 18:30:44 +08:00
parent 3e35b2bbff
commit 7058d73193
8 changed files with 733 additions and 399 deletions

View File

@ -1021,7 +1021,8 @@ ActivityTypeDef = {
SignInfo = 57,--三日七日签到
pozhenzhuxian_task = 20000,--破阵诛仙任务
pozhenzhuxian_recharge = 58,--破阵诛仙累充
pozhenzhuxian_TimeLimitShop = 20001,--破阵诛仙限时商市
pozhenzhuxian_Treasure = 20002,--破阵诛仙珍奇宝阁
}
--活动结束需要处理面板关闭类型
ActivityTypePanel = {

View File

@ -1,10 +1,10 @@
local LeiJiChongZhiPage = quick_class("LeiJiChongZhiPage")
local allData={}
local itemsGrid = {}--item重复利用
local singleTaskPre = {}
local this=LeiJiChongZhiPage
local parent
local endtime = 0
local rechargeNum
function LeiJiChongZhiPage:ctor(mainPanel, gameObject)
self.mainPanel = mainPanel
self.gameObject = gameObject
@ -13,13 +13,12 @@ function LeiJiChongZhiPage:ctor(mainPanel, gameObject)
end
function LeiJiChongZhiPage:InitComponent(gameObject)
this.time = Util.GetGameObject(gameObject, "content/tiao/time")
this.itemPre = Util.GetGameObject(gameObject, "content/ItemPre")
this.scrollItem = Util.GetGameObject(gameObject, "content/grid")
local rootHight = this.scrollItem.transform.rect.height
local width = this.scrollItem.transform.rect.width
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:GetComponent("RectTransform").sizeDelta
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.scrollItem.transform,
this.itemPre, nil, Vector2.New(width, rootHight), 1, 1, Vector2.New(0, 30))
this.itemPre, nil, Vector2.New(rootHight.x, rootHight.y), 1, 1, Vector2.New(0, 10))
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 2
end
@ -30,10 +29,12 @@ end
--添加事件监听(用于子类重写)
function LeiJiChongZhiPage:AddListener()
end
--移除事件监听(用于子类重写)
function LeiJiChongZhiPage:RemoveListener()
end
local sortingOrder = 0
--界面打开时调用(用于子类重写)
@ -43,9 +44,10 @@ end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function LeiJiChongZhiPage:OnShow(_sortingOrder,_parent)
rechargeNum= VipManager.GetChargedNum()--已经充值的金额
sortingOrder = _sortingOrder
parent = _parent
this:OnShowData()
this.Refresh()
end
function this.Refresh()
@ -58,37 +60,27 @@ function LeiJiChongZhiPage:SetTime()
self.timer:Stop()
self.timer = nil
end
local timeDown = endtime - GetTimeStamp()
this.time.text = "剩余时间:"..TimeToDHMS(timeDown)
self.timer = Timer.New(function()
local timeDown
for i = 1,#allData do
if allData[i].type == 1 then
timeDown = CalculateSecondsNowTo_N_OClock(5)
singleTaskPre[allData[i].id].text = "剩余:"..TimeToHMS(timeDown)
else
timeDown = endtime - GetTimeStamp()
singleTaskPre[allData[i].id].text = "剩余:"..TimeToDHMS(timeDown)
end
if timeDown < 1 then
this.Refresh()
return
end
timeDown = timeDown - 1
if timeDown < 1 then
parent:ClosePanel()
return
end
timeDown = endtime - GetTimeStamp()
this.time.text = "剩余时间:"..TimeToDHMS(timeDown)
this.time.text = "剩余时间:"..TimeToDHMS(timeDown)
end, 1, -1, true)
self.timer:Start()
end
function LeiJiChongZhiPage:OnShowData()
allData = OperatingManager:InitPoZhenZhuXianData()
allData =OperatingManager.InitLeiJiChongZhiData()
if allData then
endtime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.pozhenzhuxian_task)
endtime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.pozhenzhuxian_recharge)
this.SortData(allData)
this.ScrollView:SetData(allData, function (index, go)
this.SingleDataShow(go, allData[index])
singleTaskPre[allData[index].id] = Util.GetGameObject(go,"btn/Text"):GetComponent("Text")
end)
LogError(#allData)
else
parent.OnPageTabChange(1)
PopupTipPanel.ShowTip("活动已结束")
@ -96,16 +88,21 @@ function LeiJiChongZhiPage:OnShowData()
end
end
local typeIndex = {
[0] = 2,
[1] = 3,
[2] = 1,
}
function LeiJiChongZhiPage:SortData()
if allData==nil then
return
end
table.sort(allData, function(a,b)
if a.type == b.type then
if typeIndex[a.state] == typeIndex[b.state] then
return a.id < b.id
else
return a.type < b.type
end
else
return typeIndex[a.state] < typeIndex[b.state]
end
end)
end
local type={
@ -123,41 +120,46 @@ function this.SingleDataShow(pre,value)
activityRewardGo:SetActive(true)
local sConFigData = value
local titleText = Util.GetGameObject(activityRewardGo, "title"):GetComponent("Text")
titleText.text = sConFigData.title
local missionText = Util.GetGameObject(activityRewardGo, "mission"):GetComponent("Text")
missionText.text = sConFigData.content.."("..(sConFigData.progress > sConFigData.value and sConFigData.value or sConFigData.progress) .."/"..sConFigData.value..")"
local num = Util.GetGameObject(activityRewardGo, "context/num"):GetComponent("Text")
num.text = sConFigData.value
local progress = Util.GetGameObject(activityRewardGo, "context/progress"):GetComponent("Text")
progress.text ="可领取".."("..(sConFigData.progress > sConFigData.value and sConFigData.value or sConFigData.progress) .."/"..sConFigData.value..")"
local reward = Util.GetGameObject(activityRewardGo.gameObject, "reward")
local reward = Util.GetGameObject(activityRewardGo.gameObject, "scrollView/grid")
if (not itemsGrid) then
itemsGrid = {}
end
if not itemsGrid[pre] then
itemsGrid[pre] = SubUIManager.Open(SubUIConfig.ItemView,reward.transform)
itemsGrid[pre] = {}
end
for k,v in ipairs(sConFigData.reward) do
if not itemsGrid[pre][k] then
itemsGrid[pre][k] = SubUIManager.Open(SubUIConfig.ItemView,reward.transform)
end
itemsGrid[pre][k]:OnOpen(false, {v[1],v[2]}, 0.9, false)
end
itemsGrid[pre]:OnOpen(false, sConFigData.reward, 0.9, false)
local lingquButton = Util.GetGameObject(activityRewardGo.gameObject, "btn")
local state = sConFigData.state == 1 and sConFigData.state or (sConFigData.progress >= sConFigData.value and 2 or 0) -- 0 前往 1已领奖 2领奖
local lingquButton = Util.GetGameObject(activityRewardGo.gameObject, "btnBuy")
LogYellow("sConFigData.progress:"..sConFigData.progress)
local state = sConFigData.state
local red = Util.GetGameObject(lingquButton.gameObject, "redPoint")
red:SetActive(state == 2)
Util.GetGameObject(lingquButton.gameObject, "Button/Text"):GetComponent("Text").text = type[state].text
Util.GetGameObject(lingquButton.gameObject, "Button"):GetComponent("Image").sprite = Util.LoadSprite(type[state].sprite)
Util.GetGameObject(lingquButton.gameObject, "Button").gameObject:SetActive(state ~= 1)
Util.GetGameObject(lingquButton.gameObject, "image").gameObject:SetActive(state == 1)
Util.GetGameObject(lingquButton.gameObject, "price"):GetComponent("Text").text = type[state].text
lingquButton:GetComponent("Image").sprite = Util.LoadSprite(type[state].sprite)
lingquButton:GetComponent("Button").enabled = (state ~= 1)
Util.AddOnceClick(Util.GetGameObject(lingquButton.gameObject, "Button"), function()
Util.AddOnceClick(lingquButton, function()
if state == 2 then
local curActivityId = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.pozhenzhuxian_task)
local curActivityId = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.pozhenzhuxian_recharge)
NetManager.GetActivityRewardRequest(sConFigData.id, curActivityId,function(respond)
UIManager.OpenPanel(UIName.RewardItemPopup, respond, 1)
UIManager.OpenPanel(UIName.RewardItemPopup, respond.drop, 1)
this.Refresh()
end)
elseif state == 0 then
if sConFigData.jump then
JumpManager.GoJump(sConFigData.jump[1])
JumpManager.GoJump(sConFigData.jump)
end
end
end)
@ -170,9 +172,7 @@ function LeiJiChongZhiPage:OnOpen()
end
function this.RechargeSuccessFunc(id)
FirstRechargeManager.RefreshAccumRechargeValue(id)
--OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.GiftBuy, id)
this.OnShowData()
end
function LeiJiChongZhiPage:OnClose()
@ -182,6 +182,8 @@ end
--界面销毁时调用(用于子类重写)
function LeiJiChongZhiPage:OnDestroy()
sortingOrder = 0
allData={}
itemsGrid = {}
end
function LeiJiChongZhiPage:OnHide()

View File

@ -75,10 +75,14 @@ function PoZhenZhuXianPage:SetTime()
self.timer = Timer.New(function()
five_timeDown = five_timeDown - 1
week_timeDown = week_timeDown - 1
if five_timeDown <= 0 or week_timeDown <= 0 then
if five_timeDown <= 0 then
this.Refresh()
return
end
if week_timeDown <= 0 then
parent:ClosePanel()
return
end
for k,v in pairs(singleTaskPre) do
v.com.gameObject:SetActive(true)
if v and v.data.type == 1 then

View File

@ -2,6 +2,7 @@ local XianShiShangShi = quick_class("XianShiShangShi")
local allData={}
local itemsGrid = {}--item重复利用
local this=XianShiShangShi
local parent
function XianShiShangShi:ctor(mainPanel, gameObject)
self.mainPanel = mainPanel
self.gameObject = gameObject
@ -10,7 +11,7 @@ function XianShiShangShi:ctor(mainPanel, gameObject)
end
function XianShiShangShi:InitComponent(gameObject)
this.time = Util.GetGameObject(gameObject, "tiao/time"):GetComponent("Text")
this.itemPre = Util.GetGameObject(gameObject, "ItemPre3")
this.scrollItem = Util.GetGameObject(gameObject, "scrollItem")
local rootHight = this.scrollItem.transform.rect.height
@ -41,9 +42,11 @@ function XianShiShangShi:OnOpen()
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function XianShiShangShi:OnShow(_sortingOrder)
function XianShiShangShi:OnShow(_sortingOrder,_parent)
sortingOrder = _sortingOrder
parent = _parent
this:OnShowData()
XianShiShangShi:SetTime()
end
function XianShiShangShi:OnShowData()
allData = ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.RechargeCommodityConfig, "ShowType", 22, "Type", GoodsTypeDef.DirectPurchaseGift)
@ -55,6 +58,26 @@ function XianShiShangShi:OnShowData()
end
end
function XianShiShangShi:SetTime()
if self.timer then
self.timer:Stop()
self.timer = nil
end
local endTime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.pozhenzhuxian_TimeLimitShop)
local timeDown = endTime - GetTimeStamp()
this.time.text = "剩余时间:"..TimeToDHMS(timeDown)
self.timer = Timer.New(function()
timeDown = timeDown - 1
if timeDown < 1 then
parent:ClosePanel()
end
this.time.text = "剩余时间:"..TimeToDHMS(timeDown)
end, 1, -1, true)
self.timer:Start()
end
function XianShiShangShi:SortData()
if allData==nil then
return

View File

@ -2,6 +2,7 @@ local ZhenQiYiBaoPage = quick_class("ZhenQiYiBaoPage")
local allData={}
local itemsGrid = {}--item重复利用
local this=ZhenQiYiBaoPage
local parent
function ZhenQiYiBaoPage:ctor(mainPanel, gameObject)
self.mainPanel = mainPanel
self.gameObject = gameObject
@ -10,7 +11,7 @@ function ZhenQiYiBaoPage:ctor(mainPanel, gameObject)
end
function ZhenQiYiBaoPage:InitComponent(gameObject)
this.time = Util.GetGameObject(gameObject, "tiao/time"):GetComponent("Text")
this.itemPre = Util.GetGameObject(gameObject, "ItemPre3")
this.scrollItem = Util.GetGameObject(gameObject, "scrollItem")
local rootHight = this.scrollItem.transform.rect.height
@ -41,9 +42,11 @@ function ZhenQiYiBaoPage:OnOpen()
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function ZhenQiYiBaoPage:OnShow(_sortingOrder)
function ZhenQiYiBaoPage:OnShow(_sortingOrder,_parent)
parent = _parent
sortingOrder = _sortingOrder
this:OnShowData()
ZhenQiYiBaoPage:SetTime()
end
function ZhenQiYiBaoPage:OnShowData()
allData = ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.RechargeCommodityConfig, "ShowType", 23, "Type", GoodsTypeDef.DirectPurchaseGift)
@ -55,6 +58,25 @@ function ZhenQiYiBaoPage:OnShowData()
end
end
function ZhenQiYiBaoPage:SetTime()
if self.timer then
self.timer:Stop()
self.timer = nil
end
local endTime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.pozhenzhuxian_Treasure)
local timeDown = endTime - GetTimeStamp()
this.time.text = "剩余时间:"..TimeToDHMS(timeDown)
self.timer = Timer.New(function()
timeDown = timeDown - 1
if timeDown < 1 then
parent:ClosePanel()
end
this.time.text = "剩余时间:"..TimeToDHMS(timeDown)
end, 1, -1, true)
self.timer:Start()
end
function ZhenQiYiBaoPage:SortData()
if allData==nil then
return

View File

@ -776,25 +776,38 @@ function this.InitLeiJiChongZhiData()
if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.pozhenzhuxian_recharge) then
return nil
end
this.allData = {}
this.LeiJiChongZhiData = {}
local allListData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig, "ActivityId", id)
LogBlue("#allListData:"..#allListData)
local allMissionData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.pozhenzhuxian_recharge).mission
local allMissionData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.pozhenzhuxian_recharge)
LogYellow(allMissionData.value)
LogBlue("#allMissionData"..#allMissionData)
for i=1,#allListData do
for j=1,#allMissionData do
if allListData[i].Id == allMissionData[j].missionId then
for j=1,#allMissionData.mission do
if allListData[i].Id == allMissionData.mission[j].missionId then
local data = {}
data.id = allMissionData[j].missionId
data.progress = allMissionData[j].progress
data.state = allMissionData[j].state
data.id = allMissionData.mission[j].missionId
data.progress = allMissionData.value
data.value = allListData[i].Values[1][1]
data.state = allMissionData.mission[j].state == 1 and allMissionData.mission[j].state or (data.progress>= data.value and 2 or 0) -- 0 前往 1已领奖 2领奖
data.reward = allListData[i].Reward
data.jump = allListData[i].Jump[1]
table.insert(this.allData,data)
table.insert(this.LeiJiChongZhiData,data)
end
end
end
return this.allData
return this.LeiJiChongZhiData
end
function this.CheckLeiJiChongZhiRedData()
local mission = this.InitLeiJiChongZhiData()
if not mission or #mission < 1 then
return false
end
for j = 1,#mission do
if mission.state == 2 then
return true
end
end
return false
end
return this

View File

@ -32,9 +32,12 @@ function this.InitTypeTaskList(_userMissionList)
userMissionList.type = _userMissionList[i].type
userMissionList.takeTimes = _userMissionList[i].takeTimes
userMissionList.heroId = _userMissionList[i].heroId
-- if userMissionList.type == 1 then
-- LogRed("任务 类型:"..userMissionList.type.." 类型:"..userMissionList.missionId.." 状态:"..userMissionList.state)
-- end
if userMissionList.type == 1 then
-- LogRed("任务 类型:"..userMissionList.type.." ID:"..userMissionList.missionId.." 状态:"..userMissionList.state)
end
if not TypeTaskData[_userMissionList[i].type] then
TypeTaskData[_userMissionList[i].type] = {}
end
table.insert(TypeTaskData[_userMissionList[i].type], userMissionList)
--this.AddTypeData(_userMissionList[i].type, userMissionList)
end