77 lines
2.4 KiB
Lua
77 lines
2.4 KiB
Lua
----- --御剑行上轮排名 -----
|
|
local this = {}
|
|
local rankImg = {
|
|
[1] = "r_Dungeon_001",
|
|
[2] = "r_Dungeon_002",
|
|
[3] = "r_Dungeon_003",
|
|
[4] = "r_Dungeon_004",
|
|
}
|
|
local SwordImg = {
|
|
[1] = "y_yujianxing_banner01_01",
|
|
[2] = "y_yujianxing_banner02_01",
|
|
[3] = "y_yujianxing_banner03_01",
|
|
[4] = "y_yujianxing_banner04_01",
|
|
}
|
|
|
|
function this:InitComponent(gameObject)
|
|
self.spLoader = SpriteLoader.New()
|
|
self.grid = Util.GetGameObject(gameObject,"Grid")
|
|
self.SwordPre = Util.GetGameObject(self.grid,"SwordPre")
|
|
self.roundTime = Util.GetGameObject(gameObject,"tips (2)"):GetComponent("Text")
|
|
self.preList = {}
|
|
self.NoneImage = Util.GetGameObject(gameObject,"NoneImage")
|
|
end
|
|
|
|
function this:BindEvent()
|
|
end
|
|
|
|
function this:AddListener()
|
|
Game.GlobalEvent:AddEvent(GameEvent.YuJianXing.UpdateRank, self.Refresh,self)
|
|
end
|
|
|
|
function this:RemoveListener()
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.YuJianXing.UpdateRank, self.Refresh,self)
|
|
end
|
|
|
|
function this:OnShow(_parent,...)
|
|
self.parent = _parent
|
|
self:Refresh()
|
|
end
|
|
|
|
function this:Refresh()
|
|
NetManager.RidingSwardInfoRequest(function ()
|
|
if YuJianXingManager.lastResult.rankId > 0 then
|
|
self.NoneImage:SetActive(false)
|
|
local data = ConfigManager.GetConfigData(ConfigName.RidingSwardResult,YuJianXingManager.lastResult.rankId).Result
|
|
for i = 1, 4 do
|
|
for j = 1, #data do
|
|
if i == data[j][1] then
|
|
local go = self.preList[i]
|
|
if not go then
|
|
go = newObjToParent(self.SwordPre,self.grid)
|
|
self.preList[i] = go
|
|
end
|
|
local rank = Util.GetGameObject(go,"Image"):GetComponent("Image")
|
|
local Img = go:GetComponent("Image")
|
|
rank.sprite = self.spLoader:LoadSprite(rankImg[i])
|
|
Img.sprite = self.spLoader:LoadSprite(SwordImg[j])
|
|
go:SetActive(true)
|
|
end
|
|
end
|
|
end
|
|
self.roundTime.text = string.format("比赛场次: %s",TimeStampToDateStr4((YuJianXingManager.lastResult.rankTime)))
|
|
else
|
|
self.NoneImage:SetActive(true)
|
|
end
|
|
end)
|
|
end
|
|
|
|
function this:OnClose()
|
|
end
|
|
|
|
function this:OnDestroy()
|
|
self.preList = {}
|
|
self.spLoader:Destroy()
|
|
end
|
|
|
|
return this |