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