2021-09-07 17:05:46 +08:00
|
|
|
WorldArenaManager = {};
|
2021-08-31 15:10:27 +08:00
|
|
|
local this = WorldArenaManager
|
2021-09-07 17:05:46 +08:00
|
|
|
local ArenaSetting = ConfigManager.GetConfig(ConfigName.MServerArenaSetting)
|
2021-09-07 18:27:23 +08:00
|
|
|
local rankConfig = ConfigManager.GetConfig(ConfigName.MServerRankConfig)
|
2021-08-31 15:10:27 +08:00
|
|
|
|
2021-09-09 23:01:23 +08:00
|
|
|
local oldScore=0
|
|
|
|
local newScore=0
|
|
|
|
local freeTimes
|
|
|
|
local myRankId=0
|
|
|
|
local challengeTime=0
|
|
|
|
local rewardList={}
|
2021-08-31 15:10:27 +08:00
|
|
|
function this.Initialize()
|
2021-09-09 23:01:23 +08:00
|
|
|
rewardList={}
|
2021-08-31 15:10:27 +08:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2021-09-09 23:01:23 +08:00
|
|
|
|
|
|
|
--添加奖励
|
|
|
|
function this.AddReward(drop)
|
|
|
|
if drop.itemlist 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.SetMyData(rank,free,time)
|
|
|
|
myRankId=rank
|
|
|
|
freeTimes=free
|
|
|
|
challengeTime=time
|
|
|
|
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
|
|
|
|
|
2021-09-09 11:48:09 +08:00
|
|
|
function this.SetFreeTime(num)
|
|
|
|
freeTimes=num
|
|
|
|
end
|
|
|
|
|
|
|
|
function this.GetFreeTime()
|
|
|
|
return freeTimes
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2021-09-07 17:05:46 +08:00
|
|
|
-- 获取竞技场剩余挑战次数
|
|
|
|
function this.GetArenaChallengeTimes()
|
|
|
|
local privilege = ArenaSetting[2].BattleFree
|
|
|
|
local allTimes = PrivilegeManager.GetPrivilegeNumber(privilege)
|
|
|
|
local leftTimes = PrivilegeManager.GetPrivilegeRemainValue(privilege)
|
2021-09-09 15:44:19 +08:00
|
|
|
return freeTimes, allTimes
|
2021-09-07 17:05:46 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
-- 获取竞技场挑战消耗
|
|
|
|
function this.GetArenaChallengeCost()
|
|
|
|
local itemId = ArenaSetting[2].Cost[1]
|
|
|
|
local itemNum = ArenaSetting[2].Cost[2]
|
|
|
|
return itemId, itemNum
|
|
|
|
end
|
|
|
|
|
2021-09-07 18:27:23 +08:00
|
|
|
--根据积分获取段位图标id
|
|
|
|
function this.GetRankImgByScore(num)
|
|
|
|
for k, v in ConfigPairs(rankConfig) do
|
|
|
|
if v.ScoreLow<num and v.ScoreUp>=num then
|
2021-09-09 15:44:19 +08:00
|
|
|
return v.RankGrade+1,v
|
2021-09-07 18:27:23 +08:00
|
|
|
end
|
|
|
|
end
|
2021-09-09 23:01:23 +08:00
|
|
|
return 1,rankConfig[1]
|
2021-09-07 18:27:23 +08:00
|
|
|
end
|
2021-08-31 15:10:27 +08:00
|
|
|
|
2021-09-09 16:22:35 +08:00
|
|
|
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
|
|
|
|
|
2021-08-31 15:10:27 +08:00
|
|
|
return this
|