miduo_client/Assets/ManagedResources/~Lua/Modules/WorldArena/WorldArenaManager.lua

112 lines
2.4 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 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
LogError("添加奖励物品")
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.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 v.ScoreLow<num and v.ScoreUp>=num 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
return this