147 lines
3.2 KiB
Lua
147 lines
3.2 KiB
Lua
WorldArenaManager = {};
|
|
local this = WorldArenaManager
|
|
local ArenaSetting = ConfigManager.GetConfig(ConfigName.MServerArenaSetting)
|
|
local rankConfig = ConfigManager.GetConfig(ConfigName.MServerRankConfig)
|
|
local PrivilegeConfig=ConfigManager.GetConfig(ConfigName.PrivilegeTypeConfig)
|
|
local oldScore=0
|
|
local newScore=0
|
|
local myRankId=0
|
|
local challengeTime=0
|
|
local rewardState = nil
|
|
local rewardList={}
|
|
function this.Initialize()
|
|
rewardList={}
|
|
|
|
end
|
|
|
|
|
|
function this.GetchallengeTimes()
|
|
return challengeTime
|
|
end
|
|
|
|
--添加奖励
|
|
function this.AddReward(drop)
|
|
if drop then
|
|
for i = 1, #drop do
|
|
for j = 1, #drop[i].itemlist do
|
|
local item={}
|
|
item.itemId=drop[i].itemlist[j].itemId
|
|
item.itemNum=drop[i].itemlist[j].itemNum
|
|
table.insert(rewardList,item)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
function this.GetReward()
|
|
return rewardList
|
|
end
|
|
function this.ClearReward()
|
|
rewardList={}
|
|
end
|
|
|
|
|
|
function this.SetMyData(rank,time)
|
|
myRankId=rank
|
|
challengeTime=time
|
|
end
|
|
|
|
function this.GetMyRank()
|
|
return myRankId
|
|
end
|
|
|
|
|
|
function this.SetRewardData(data,time)
|
|
rewardState=data
|
|
challengeTime=time
|
|
-- for i = 1, #data do
|
|
-- Log("宝箱状态========"..data[1])
|
|
-- end
|
|
end
|
|
|
|
|
|
function this.SetOldScore(num)
|
|
oldScore=num
|
|
end
|
|
|
|
function this.GetOldScore()
|
|
return oldScore
|
|
end
|
|
|
|
function this.SetNewScore(num)
|
|
newScore=num
|
|
end
|
|
|
|
function this.GetNewScore()
|
|
return newScore
|
|
end
|
|
|
|
function this.SetChallegeTime(num)
|
|
challengeTime=num
|
|
end
|
|
function this.GetFreeTime()
|
|
return PrivilegeManager.GetPrivilegeRemainValue(0)
|
|
end
|
|
|
|
|
|
-- 获取竞技场剩余挑战次数
|
|
function this.GetArenaChallengeTimes()
|
|
local ids=ArenaSetting[1].PrivId
|
|
local freeTime=PrivilegeConfig[ids[1]].Condition[2]
|
|
local maxTime=PrivilegeConfig[ids[2]].Condition[2]
|
|
return freeTime,maxTime
|
|
end
|
|
|
|
-- 获取竞技场挑战消耗
|
|
function this.GetArenaChallengeCost()
|
|
local itemId = ArenaSetting[2].Cost[1]
|
|
local itemNum = ArenaSetting[2].Cost[2]
|
|
return itemId, itemNum
|
|
end
|
|
|
|
--根据积分获取段位图标id
|
|
function this.GetRankImgByScore(num)
|
|
for k, v in ConfigPairs(rankConfig) do
|
|
if num>=v.ScoreLow and num<=v.ScoreUp then
|
|
return v.RankGrade+1,v
|
|
end
|
|
end
|
|
return 1,rankConfig[1]
|
|
end
|
|
|
|
local _StarShow = {
|
|
[0] = {0, 0, 0, 0, 0},
|
|
[1] = {0, 0, 1, 0, 0},
|
|
[2] = {0, 1, 0, 1, 0},
|
|
[3] = {0, 1, 1, 1, 0},
|
|
[4] = {1, 1, 0, 1, 1},
|
|
[5] = {1, 1, 1, 1, 1},
|
|
}
|
|
function this.SetStarShow(starList, starLv)
|
|
local ss = _StarShow[starLv]
|
|
for i = 1, #starList do
|
|
starList[i]:SetActive(ss[i] == 1)
|
|
end
|
|
end
|
|
|
|
--设置奖励状态
|
|
function this.SetRewardState(index,state)
|
|
if rewardState[index] then
|
|
rewardState[index]=state
|
|
end
|
|
end
|
|
--检测玉虚奖励的红点
|
|
function this.CheckRewardPoint()
|
|
local config=ConfigManager.GetConfigDataByKey(ConfigName.MServerRankConfig,1)
|
|
local rewards=config.DailyReward
|
|
for i = 1, #rewards do
|
|
if rewards[i] then
|
|
if challengeTime>=rewards[i][1] and rewardState[i]~=2 then
|
|
return true
|
|
end
|
|
end
|
|
end
|
|
return false
|
|
end
|
|
|
|
|
|
return this |