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

63 lines
1.5 KiB
Lua

WorldArenaManager = {};
local this = WorldArenaManager
local ArenaSetting = ConfigManager.GetConfig(ConfigName.MServerArenaSetting)
local rankConfig = ConfigManager.GetConfig(ConfigName.MServerRankConfig)
function this.Initialize()
this.rank=0
this.star=0
end
local freeTimes
function this.SetFreeTime(num)
freeTimes=num
end
function this.GetFreeTime()
return freeTimes
end
-- 获取竞技场剩余挑战次数
function this.GetArenaChallengeTimes()
local privilege = ArenaSetting[2].BattleFree
local allTimes = PrivilegeManager.GetPrivilegeNumber(privilege)
local leftTimes = PrivilegeManager.GetPrivilegeRemainValue(privilege)
return freeTimes, allTimes
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
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