2021-10-08 20:49:25 +08:00
|
|
|
----- --御剑行上轮排名 -----
|
|
|
|
local this = {}
|
2021-10-13 15:39:47 +08:00
|
|
|
local rankImg = {
|
|
|
|
[1] = "d_dianfrngsai_guanjun_zh",
|
|
|
|
[2] = "d_dianfrngsai_yajun_zh",
|
|
|
|
[3] = "d_dianfrngsai_ji_zh",
|
|
|
|
[4] = "y_yujianxing_paimingsi",
|
|
|
|
}
|
|
|
|
local SwordImg = {
|
|
|
|
[1] = "y_yujianxing_banner01_01",
|
|
|
|
[2] = "y_yujianxing_banner02_01",
|
|
|
|
[3] = "y_yujianxing_banner03_01",
|
|
|
|
[4] = "y_yujianxing_banner04_01",
|
|
|
|
}
|
2021-10-08 20:49:25 +08:00
|
|
|
|
|
|
|
function this:InitComponent(gameObject)
|
|
|
|
self.spLoader = SpriteLoader.New()
|
2021-10-13 15:39:47 +08:00
|
|
|
self.grid = Util.GetGameObject(gameObject,"Grid")
|
|
|
|
self.SwordPre = Util.GetGameObject(self.grid,"SwordPre")
|
|
|
|
self.roundTime = Util.GetGameObject(gameObject,"tips (2)"):GetComponent("Text")
|
|
|
|
self.preList = {}
|
2021-10-08 20:49:25 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function this:BindEvent()
|
|
|
|
end
|
|
|
|
|
|
|
|
function this:AddListener()
|
2021-10-13 17:30:26 +08:00
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.YuJianXing.UpdateRank, self.Refresh,self)
|
2021-10-08 20:49:25 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function this:RemoveListener()
|
2021-10-13 17:30:26 +08:00
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.YuJianXing.UpdateRank, self.Refresh,self)
|
2021-10-08 20:49:25 +08:00
|
|
|
end
|
|
|
|
|
2021-10-13 17:30:26 +08:00
|
|
|
function this:OnShow(_parent,...)
|
|
|
|
self.parent = _parent
|
|
|
|
self:Refresh()
|
|
|
|
end
|
|
|
|
|
|
|
|
function this:Refresh()
|
2021-10-13 15:39:47 +08:00
|
|
|
NetManager.RidingSwardInfoRequest(function ()
|
|
|
|
local data = ConfigManager.GetConfigData(ConfigName.RidingSwardResult,YuJianXingManager.lastResult.rankId).Result
|
|
|
|
for i = 1, 4 do
|
|
|
|
local tempData = data[i][1]
|
|
|
|
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[tempData])
|
2021-10-13 17:30:26 +08:00
|
|
|
go:SetActive(true)
|
2021-10-13 15:39:47 +08:00
|
|
|
end
|
|
|
|
self.roundTime.text = string.format("比赛场次: %s",TimeStampToDateStr4((YuJianXingManager.lastResult.rankTime)/1000))
|
|
|
|
end)
|
2021-10-08 20:49:25 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
function this:OnClose()
|
|
|
|
end
|
|
|
|
|
|
|
|
function this:OnDestroy()
|
2021-10-13 17:30:26 +08:00
|
|
|
self.preList = {}
|
2021-10-08 20:49:25 +08:00
|
|
|
self.spLoader:Destroy()
|
|
|
|
end
|
|
|
|
|
|
|
|
return this
|