2024-07-03 18:38:10 +08:00
|
|
|
|
RankPanel = quick_class("RankPanel")
|
|
|
|
|
|
local this = RankPanel
|
|
|
|
|
|
local AcitvityShowTheme = ConfigManager.GetConfig(ConfigName.AcitvityShowTheme)
|
|
|
|
|
|
local GlobalActivity = ConfigManager.GetConfig(ConfigName.GlobalActivity)
|
|
|
|
|
|
local mainLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig)
|
|
|
|
|
|
|
|
|
|
|
|
local headList = {}
|
|
|
|
|
|
local activityId
|
|
|
|
|
|
local rewardList = {}
|
|
|
|
|
|
local titleTxt = {
|
|
|
|
|
|
[300] = GetLanguageStrById(50436),
|
|
|
|
|
|
[301] = GetLanguageStrById(50437),
|
|
|
|
|
|
[303] = GetLanguageStrById(50438),
|
|
|
|
|
|
[306] = GetLanguageStrById(50439),
|
|
|
|
|
|
[302] = GetLanguageStrById(50440),
|
|
|
|
|
|
[304] = GetLanguageStrById(50441),
|
|
|
|
|
|
[307] = GetLanguageStrById(50442),
|
|
|
|
|
|
[308] = GetLanguageStrById(50443),
|
|
|
|
|
|
[309] = GetLanguageStrById(50444),
|
|
|
|
|
|
[305] = GetLanguageStrById(50445),
|
|
|
|
|
|
}
|
|
|
|
|
|
local txt
|
|
|
|
|
|
local openType
|
|
|
|
|
|
function this:InitComponent(gameObject)
|
|
|
|
|
|
this.banner = Util.GetGameObject(gameObject, "banner"):GetComponent("Image")
|
|
|
|
|
|
this.expertDec = Util.GetGameObject(gameObject, "banner/Text"):GetComponent("Text")
|
|
|
|
|
|
this.firstReward = Util.GetGameObject(gameObject, "first/grid")
|
|
|
|
|
|
this.time = Util.GetGameObject(gameObject, "time/Text"):GetComponent("Text")
|
|
|
|
|
|
this.btnReward = Util.GetGameObject(gameObject, "btnReward")
|
|
|
|
|
|
this.scroll = Util.GetGameObject(gameObject, "scroll")
|
|
|
|
|
|
this.pro = Util.GetGameObject(gameObject, "scroll/pre")
|
|
|
|
|
|
local w = this.scroll.transform.rect.width
|
|
|
|
|
|
local h = this.scroll.transform.rect.height
|
|
|
|
|
|
this.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.scroll.transform, this.pro, nil,
|
2025-04-28 22:22:20 +08:00
|
|
|
|
Vector2.New(w, h), 1, 1, Vector2.New(0, 5))
|
2024-07-03 18:38:10 +08:00
|
|
|
|
this.scrollView.moveTween.MomentumAmount = 1
|
|
|
|
|
|
this.scrollView.moveTween.Strength = 2
|
|
|
|
|
|
this.myRank = Util.GetGameObject(gameObject, "myRank")
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this:BindEvent()
|
2025-04-28 22:22:20 +08:00
|
|
|
|
Util.AddClick(this.btnReward, function()
|
2024-07-03 18:38:10 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.ExpertRewardSortPanel, activityId, 4)
|
|
|
|
|
|
end)
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this:AddListener()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this:RemoveListener()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this:OnOpen()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--[[
|
|
|
|
|
|
{
|
|
|
|
|
|
ranks = {
|
|
|
|
|
|
uid
|
|
|
|
|
|
level
|
|
|
|
|
|
head
|
|
|
|
|
|
userName
|
|
|
|
|
|
rankInfo
|
|
|
|
|
|
headFrame
|
|
|
|
|
|
guildName
|
|
|
|
|
|
force
|
|
|
|
|
|
guildSign
|
|
|
|
|
|
sex
|
|
|
|
|
|
likeNum
|
|
|
|
|
|
serverName
|
|
|
|
|
|
serverId
|
|
|
|
|
|
heroTemplateId
|
|
|
|
|
|
heroLevel
|
|
|
|
|
|
heroStar
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
]]
|
|
|
|
|
|
|
|
|
|
|
|
function this:OnShow(go, activeType, netIndex)
|
|
|
|
|
|
activityId = ActivityGiftManager.GetActivityIdByType(activeType)
|
|
|
|
|
|
txt = titleTxt[activeType]
|
|
|
|
|
|
openType = activeType
|
|
|
|
|
|
this.banner.sprite = Util.LoadSprite(GetPictureFont(AcitvityShowTheme[activeType].Compent))
|
|
|
|
|
|
this.expertDec.text = GetLanguageStrById(GlobalActivity[activeType].ExpertDec)
|
2025-04-28 22:22:20 +08:00
|
|
|
|
NetManager.RequestRankInfo(netIndex, function(msg)
|
2024-07-03 18:38:10 +08:00
|
|
|
|
this.rankDatas = msg.ranks
|
|
|
|
|
|
this.scrollView:SetData(this.rankDatas, function(index, go)
|
|
|
|
|
|
this.SetPlayerRank(go, this.rankDatas[index])
|
|
|
|
|
|
end)
|
2025-04-28 22:22:20 +08:00
|
|
|
|
this.SetMyRank(msg.myRankInfo, msg.myHeroTemplateId)
|
2024-07-03 18:38:10 +08:00
|
|
|
|
end, activityId)
|
|
|
|
|
|
this.SetFirstReward()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this:OnSortingOrderChange()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this:OnClose()
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this:OnDestroy()
|
|
|
|
|
|
headList = {}
|
|
|
|
|
|
rewardList = {}
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this.SetPlayerRank(go, data)
|
|
|
|
|
|
this.SetPro(go, {
|
|
|
|
|
|
rank = data.rankInfo.rank,
|
|
|
|
|
|
score = data.rankInfo.param1,
|
|
|
|
|
|
name = data.userName,
|
|
|
|
|
|
head = data.head,
|
2025-04-28 22:22:20 +08:00
|
|
|
|
hero = data.heroTemplateId,
|
2024-07-03 18:38:10 +08:00
|
|
|
|
frame = data.headFrame,
|
|
|
|
|
|
level = data.level,
|
|
|
|
|
|
uid = data.uid,
|
|
|
|
|
|
})
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-28 22:22:20 +08:00
|
|
|
|
function this.SetMyRank(data,myHeroTemplateId)
|
2024-07-03 18:38:10 +08:00
|
|
|
|
this.SetPro(this.myRank, {
|
|
|
|
|
|
rank = data.rank,
|
|
|
|
|
|
score = data.param1,
|
2025-04-28 22:22:20 +08:00
|
|
|
|
hero = myHeroTemplateId,
|
2024-07-03 18:38:10 +08:00
|
|
|
|
name = PlayerManager.nickName,
|
|
|
|
|
|
head = PlayerManager.head,
|
|
|
|
|
|
frame = PlayerManager.frame,
|
|
|
|
|
|
level = PlayerManager.level,
|
|
|
|
|
|
uid = PlayerManager.uid,
|
|
|
|
|
|
})
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this.SetPro(go, data)
|
|
|
|
|
|
local bg = Util.GetGameObject(go, "bg"):GetComponent("Image")
|
|
|
|
|
|
local rank1 = Util.GetGameObject(go, "rank/rank1"):GetComponent("Image")
|
|
|
|
|
|
local rank2 = Util.GetGameObject(go, "rank/rank2")
|
|
|
|
|
|
local rank2Txt = Util.GetGameObject(go, "rank/rank2/Text"):GetComponent("Text")
|
|
|
|
|
|
local headpos = Util.GetGameObject(go, "headpos")
|
|
|
|
|
|
local name = Util.GetGameObject(go, "name"):GetComponent("Text")
|
|
|
|
|
|
local title = Util.GetGameObject(go, "title"):GetComponent("Text")
|
|
|
|
|
|
local value = Util.GetGameObject(go, "value"):GetComponent("Text")
|
|
|
|
|
|
local wangdian = Util.GetGameObject(go, "wangdian"):GetComponent("Image")
|
|
|
|
|
|
|
|
|
|
|
|
if data.rank > 0 and data.rank < 4 then
|
|
|
|
|
|
rank1.gameObject:SetActive(true)
|
|
|
|
|
|
rank2:SetActive(false)
|
|
|
|
|
|
rank1.sprite = SetRankNumFrame(data.rank)
|
|
|
|
|
|
else
|
|
|
|
|
|
rank1.gameObject:SetActive(false)
|
|
|
|
|
|
rank2:SetActive(true)
|
|
|
|
|
|
if data.rank < 1 then
|
2025-04-28 22:22:20 +08:00
|
|
|
|
rank2Txt.text = GetLanguageStrById(10041)
|
2024-07-03 18:38:10 +08:00
|
|
|
|
else
|
|
|
|
|
|
rank2Txt.text = data.rank
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
name.text = data.name
|
|
|
|
|
|
if data.score < 0 then data.score = 0 end
|
|
|
|
|
|
if openType == 300 and data.score > 0 then
|
|
|
|
|
|
value.text = mainLevelConfig[data.score].Name
|
|
|
|
|
|
else
|
|
|
|
|
|
value.text = data.score
|
|
|
|
|
|
end
|
|
|
|
|
|
title.text = txt
|
|
|
|
|
|
if not headList[go] then
|
|
|
|
|
|
headList[go] = SubUIManager.Open(SubUIConfig.PlayerHeadView, headpos.transform)
|
|
|
|
|
|
end
|
|
|
|
|
|
headList[go]:Reset()
|
|
|
|
|
|
headList[go]:SetScale(Vector3.one * 0.5)
|
2025-04-28 22:22:20 +08:00
|
|
|
|
LogError("开服冲榜herotemplateid:" .. data.hero)
|
|
|
|
|
|
if data.hero and data.hero ~= 0 and ConfigManager.GetConfigData(ConfigName.ItemConfig, data.hero) then
|
|
|
|
|
|
headList[go]:SetHead(nil, ConfigManager.GetConfigData(ConfigName.ItemConfig, data.hero).icon)
|
|
|
|
|
|
else
|
|
|
|
|
|
headList[go]:SetHead(data.head)
|
|
|
|
|
|
end
|
2024-07-03 18:38:10 +08:00
|
|
|
|
headList[go]:SetFrame(data.frame)
|
|
|
|
|
|
headList[go]:SetLevel(data.level)
|
|
|
|
|
|
headList[go]:SetUID(data.uid)
|
|
|
|
|
|
|
|
|
|
|
|
local spriteName, colorValue = this.GetBg(data.rank)
|
|
|
|
|
|
bg.sprite = Util.LoadSprite(spriteName)
|
|
|
|
|
|
wangdian.color = colorValue
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this.GetBg(rank)
|
|
|
|
|
|
local spriteName
|
|
|
|
|
|
local colorValue
|
|
|
|
|
|
if rank == 1 then
|
|
|
|
|
|
spriteName = "X1_tongyong_liebiao_02"
|
|
|
|
|
|
colorValue = Color.New(1, 0.7764706, 0.1568628, 1)
|
|
|
|
|
|
elseif rank == 2 then
|
|
|
|
|
|
spriteName = "X1_tongyong_liebiao_03"
|
|
|
|
|
|
colorValue = Color.New(1, 0.6627451, 0.3607843, 1)
|
|
|
|
|
|
elseif rank == 3 then
|
|
|
|
|
|
spriteName = "X1_tongyong_liebiao_04"
|
|
|
|
|
|
colorValue = Color.New(1, 0.6117647, 0.5803922, 1)
|
|
|
|
|
|
else
|
|
|
|
|
|
spriteName = "X1_tongyong_liebiao_05"
|
2025-04-28 22:22:20 +08:00
|
|
|
|
colorValue = Color.New(0.7803922, 0.5529412, 0.9960784, 1)
|
2024-07-03 18:38:10 +08:00
|
|
|
|
end
|
|
|
|
|
|
return spriteName, colorValue
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function this.SetFirstReward()
|
2025-04-28 22:22:20 +08:00
|
|
|
|
local config = ConfigManager.GetConfigDataByDoubleKey(ConfigName.ActivityRankingReward, "ActivityId", activityId,
|
|
|
|
|
|
"MinRank", 1)
|
|
|
|
|
|
LogError("activityId:" .. activityId)
|
2024-07-03 18:38:10 +08:00
|
|
|
|
for i = 1, #rewardList do
|
|
|
|
|
|
rewardList[i].gameObject:SetActive(false)
|
|
|
|
|
|
end
|
|
|
|
|
|
for i = 1, #config.RankingReward do
|
|
|
|
|
|
if not rewardList[i] then
|
|
|
|
|
|
rewardList[i] = SubUIManager.Open(SubUIConfig.ItemView, this.firstReward.transform)
|
|
|
|
|
|
end
|
|
|
|
|
|
rewardList[i]:OnOpen(false, config.RankingReward[i], 0.55)
|
|
|
|
|
|
rewardList[i].gameObject:SetActive(true)
|
|
|
|
|
|
end
|
|
|
|
|
|
end
|
|
|
|
|
|
|
2025-04-28 22:22:20 +08:00
|
|
|
|
return RankPanel
|