【牛气冲天】修改,待后端修改数据,待增加新活动类型
parent
b24cd4e168
commit
81166ae892
|
@ -8,16 +8,26 @@ local itemId = 0
|
|||
function this.Initialize()
|
||||
this.InitAllRewardData()
|
||||
Game.GlobalEvent:AddEvent(GameEvent.Mission.NiuQiChongTianTask,this.UpdateStatus)
|
||||
this.isOldNiuQiActivity = true
|
||||
end
|
||||
|
||||
--服务器发来的活动进度条数据
|
||||
function this.GetActData()
|
||||
return ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.NiuQi)
|
||||
if this.isOldNiuQiActivity then
|
||||
return ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.NiuQi)
|
||||
else
|
||||
return ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.NiuQi)
|
||||
end
|
||||
end
|
||||
|
||||
--牛气值
|
||||
function this.GetScore()
|
||||
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.NiuQi)
|
||||
local ActData = {}
|
||||
if this.isOldNiuQiActivity then
|
||||
return ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.NiuQi)
|
||||
else
|
||||
return ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.NiuQi)
|
||||
end
|
||||
if not (ActData and ActData.activityId) then return end
|
||||
if #this.configData == 0 then
|
||||
local config = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId",ActData.activityId)
|
||||
|
@ -84,55 +94,75 @@ end
|
|||
--需要显示的任务数据
|
||||
function this.GetNeedRewardData(sort)
|
||||
local needData = {}
|
||||
for i = 1, 2 do
|
||||
local tempdata = {}
|
||||
for k, v in pairs(this.rewardData) do
|
||||
if v.Sort == sort and v.Type == i and (v.state == 1 or v.state == 0) then
|
||||
if #tempdata < 1 then
|
||||
table.insert(tempdata,v)
|
||||
else
|
||||
table.insert(tempdata,v)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if #tempdata < 2 then
|
||||
for k = #this.rewardData, 1 , -1 do
|
||||
local v = this.rewardData[k]
|
||||
local data = nil
|
||||
if #tempdata == 0 then
|
||||
if v.Sort == sort and v.Type == i then
|
||||
data = v
|
||||
end
|
||||
else
|
||||
for j = 1, #tempdata do
|
||||
if tempdata[j].id ~= v.id and v.Sort == sort and v.Type == i then
|
||||
data = v
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if data then
|
||||
table.insert(tempdata,data)
|
||||
if #tempdata >= 2 then
|
||||
if this.isOldNiuQiActivity then--老的牛气冲天
|
||||
for i = 1, 2 do
|
||||
local tempdata = {}
|
||||
for k, v in pairs(this.rewardData) do
|
||||
if v.Sort == sort and v.Type == i and (v.state == 1 or v.state == 0) then
|
||||
if #tempdata < 1 then
|
||||
table.insert(tempdata,v)
|
||||
else
|
||||
table.insert(tempdata,v)
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if #tempdata < 2 then
|
||||
for k = #this.rewardData, 1 , -1 do
|
||||
local v = this.rewardData[k]
|
||||
local data = nil
|
||||
if #tempdata == 0 then
|
||||
if v.Sort == sort and v.Type == i then
|
||||
data = v
|
||||
end
|
||||
else
|
||||
for j = 1, #tempdata do
|
||||
if tempdata[j].id ~= v.id and v.Sort == sort and v.Type == i then
|
||||
data = v
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if data then
|
||||
table.insert(tempdata,data)
|
||||
if #tempdata >= 2 then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for j = 1,#tempdata do
|
||||
table.insert(needData,tempdata[j])
|
||||
end
|
||||
end
|
||||
|
||||
for j = 1,#tempdata do
|
||||
table.insert(needData,tempdata[j])
|
||||
table.sort(needData,function (a,b)
|
||||
return a.id < b.id
|
||||
end)
|
||||
else--新的牛气冲天
|
||||
for k, v in pairs(this.rewardData) do
|
||||
if v.Sort == sort then
|
||||
table.insert(needData,v)
|
||||
end
|
||||
end
|
||||
table.sort(needData,function (a,b)
|
||||
if a.state == b.state then
|
||||
return a.id < b.id
|
||||
else
|
||||
return a.state < b.state
|
||||
end
|
||||
end)
|
||||
end
|
||||
table.sort(needData,function (a,b)
|
||||
return a.id < b.id
|
||||
end)
|
||||
return needData
|
||||
end
|
||||
|
||||
function this.CheckNiuQiChongTianRedPoint(index)
|
||||
local id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.NiuQi)
|
||||
local id = 0
|
||||
if this.isOldNiuQiActivity then
|
||||
id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.NiuQi)
|
||||
else
|
||||
id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.NiuQi)
|
||||
end
|
||||
if not id or id < 1 then
|
||||
return false
|
||||
end
|
||||
|
|
|
@ -77,6 +77,11 @@ end
|
|||
--界面打开时调用(用于子类重写)
|
||||
function NiuQiChongTianPanel:OnOpen(_activityConfig,_index,parent)
|
||||
self.actConfig = _activityConfig
|
||||
if self.actConfig.ActiveType == ActivityTypeDef.NiuQi then
|
||||
NiuQiChongTianManager.isOldNiuQiActivity = true
|
||||
else
|
||||
NiuQiChongTianManager.isOldNiuQiActivity = false
|
||||
end
|
||||
self.pageIndex = _index
|
||||
self.parent = parent
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue