miduo_client/Assets/ManagedResources/~Lua/Modules/Guild/CarDelay/GuildCarDelayLootPopup.lua

152 lines
7.3 KiB
Lua
Raw Normal View History

2020-06-23 18:36:24 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
GuildCarDelayLootPopup = Inherit(BasePanel)
local this = GuildCarDelayLootPopup
local CarChallenegList--抢夺后端信息
2020-07-28 16:54:38 +08:00
local origilayer = 0
2020-05-09 13:31:21 +08:00
--初始化组件(用于子类重写)
function GuildCarDelayLootPopup:InitComponent()
this.ItemPre = Util.GetGameObject(self.gameObject, "ItemPre")
local v2 = Util.GetGameObject(self.gameObject, "ScrollParentView"):GetComponent("RectTransform").rect
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.gameObject, "ScrollParentView").transform,
2020-05-15 16:52:35 +08:00
this.ItemPre, nil, Vector2.New(-v2.x*2, -v2.y*2), 1, 1, Vector2.New(50,-3))
2020-05-09 13:31:21 +08:00
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
this.BackBtn = Util.GetGameObject(self.gameObject, "bg/btnBack")
this.myScore = Util.GetGameObject(self.gameObject, "Record/Rank1"):GetComponent("Text")
2020-05-11 09:38:52 +08:00
this.myGuildName = Util.GetGameObject(self.gameObject, "Record/Rank0"):GetComponent("Text")
this.titleText = Util.GetGameObject(self.gameObject, "bg/titleText"):GetComponent("Text")
this.mySortNum = Util.GetGameObject(self.gameObject, "Record/SortNum")
this.Record = Util.GetGameObject(self.gameObject, "Record")
this.emptyObj = Util.GetGameObject(self.gameObject, "emptyObj")
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function GuildCarDelayLootPopup:BindEvent()
Util.AddClick(this.BackBtn, function()
self:ClosePanel()
end)
end
--添加事件监听(用于子类重写)
function GuildCarDelayLootPopup:AddListener()
end
--移除事件监听(用于子类重写)
function GuildCarDelayLootPopup:RemoveListener()
end
--界面打开时调用(用于子类重写)
function GuildCarDelayLootPopup:OnOpen(_msg)
2020-05-15 16:52:35 +08:00
--CarChallenegList = _msg
2020-05-09 13:31:21 +08:00
end
2020-07-28 16:54:38 +08:00
function GuildCarDelayLootPopup:OnSortingOrderChange()
for i = 1, this.ScrollView.transform.childCount do
Util.AddParticleSortLayer(this.ScrollView.transform:GetChild(i - 1).gameObject, self.sortingOrder - origilayer)
end
origilayer = self.sortingOrder
end
2020-05-09 13:31:21 +08:00
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function GuildCarDelayLootPopup:OnShow()
2020-05-15 16:52:35 +08:00
NetManager.GetCarChallenegListResponse(function (msg)
--for i = 1, #msg.carChallengeItem do
-- LogError("uid "..msg.carChallengeItem[i].uid)
--end
CarChallenegList = msg
2020-06-23 18:36:24 +08:00
this.titleText.text = Language[11028]..ConfigManager.GetConfigData(ConfigName.WorldBossSetting,1).GrabPercent/100 ..Language[11029]
2020-05-15 16:52:35 +08:00
if CarChallenegList then
if CarChallenegList.myRank and CarChallenegList.myRank > 0 then
this.mySortNum:SetActive(true)
local sortNumTabs = {}
for i = 1, 4 do
sortNumTabs[i] = Util.GetGameObject(this.mySortNum, "SortNum ("..i..")")
sortNumTabs[i]:SetActive(false)
end
if CarChallenegList.myRank < 4 then
sortNumTabs[CarChallenegList.myRank]:SetActive(true)
else
sortNumTabs[4]:SetActive(true)
Util.GetGameObject(sortNumTabs[4], "TitleText"):GetComponent("Text").text = CarChallenegList.myRank
end
2020-05-11 09:38:52 +08:00
else
2020-05-15 16:52:35 +08:00
this.mySortNum:SetActive(false)
2020-05-11 09:38:52 +08:00
end
this.myGuildName.text = MyGuildManager.MyGuildInfo.name
2020-06-23 18:36:24 +08:00
this.myScore.text = CarChallenegList.myScore > 0 and CarChallenegList.myScore or Language[10148]
2020-05-11 09:38:52 +08:00
end
2020-05-15 16:52:35 +08:00
this.emptyObj:SetActive(not CarChallenegList.carChallengeItem or #CarChallenegList.carChallengeItem <= 0)
this.ScrollView:SetData(CarChallenegList.carChallengeItem, function (index, go)
this.SingleInfoDataShow(go, CarChallenegList.carChallengeItem[index])
end)
2020-05-09 13:31:21 +08:00
end)
end
--optional int32 uid = 1;
--optional string userName =2;
--optional int32 force =3;
--optional string guildName = 4;
--optional int32 score = 5;
--optional int32 hadChallenge =6; // 是否已挑战过1表示挑战过2未挑战过。
--optional int32 rank = 7;
--optional TeamOneInfo teamInfo = 8;
function this.SingleInfoDataShow(go,data)
local sortNumTabs = {}
for i = 1, 4 do
sortNumTabs[i] = Util.GetGameObject(go, "SortNum/SortNum ("..i..")")
sortNumTabs[i]:SetActive(false)
end
if data.rank < 4 then
sortNumTabs[data.rank]:SetActive(true)
else
sortNumTabs[4]:SetActive(true)
Util.GetGameObject(sortNumTabs[4], "TitleText"):GetComponent("Text").text = data.rank
end
Util.GetGameObject(go, "infoText/playerName"):GetComponent("Text").text = data.userName
Util.GetGameObject(go, "infoText/warPower"):GetComponent("Text").text = data.force
Util.GetGameObject(go, "infoText/guildName"):GetComponent("Text").text = data.guildName
Util.GetGameObject(go, "infoText/soreText"):GetComponent("Text").text = data.score
--LogError("#data.teamInfo "..#data.teamInfo)
--hadChallenge =6; // 是否已挑战过1表示挑战过2未挑战过。
2020-05-11 09:38:52 +08:00
local curHeroGoList = {}
2020-05-09 13:31:21 +08:00
for i = 1,6 do
2020-05-11 09:38:52 +08:00
curHeroGoList[i] = Util.GetGameObject(go, "Demons/heroPro ("..i..")")
Util.GetGameObject(curHeroGoList[i], "hero"):SetActive(false)
Util.GetGameObject(curHeroGoList[i], "frame"):GetComponent("Image").sprite = Util.LoadSprite("r_characterbg_gray")
end
for i = 1, #data.teamInfo do
local heroGo = Util.GetGameObject(curHeroGoList[data.teamInfo[i].position], "hero")
heroGo:SetActive(true)
local curHeroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig,data.teamInfo[i].heroTid)
Util.GetGameObject(heroGo, "icon"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(curHeroConfig.Icon))
Util.GetGameObject(curHeroGoList[data.teamInfo[i].position], "frame"):GetComponent("Image").sprite = Util.LoadSprite(GetHeroQuantityImageByquality(curHeroConfig.Star))
SetHeroStars(Util.GetGameObject(heroGo, "starGrid"), data.teamInfo[i].star)
2020-07-28 16:54:38 +08:00
if heroConfig.Star > 9 then
Util.GetGameObject(go,"UI_Effect_jinkuang_KaPai").gameObject:SetActive(true)
else
Util.GetGameObject(go,"UI_Effect_jinkuang_KaPai").gameObject:SetActive(false)
end
2020-05-11 09:38:52 +08:00
Util.GetGameObject(heroGo, "lvbg/levelText"):GetComponent("Text").text=data.teamInfo[i].level
local heroData = {}
Util.AddOnceClick(Util.GetGameObject(Util.GetGameObject(curHeroGoList[data.teamInfo[i].position], "frame"), "frame"), function()
NetManager.ViewHeroInfoRequest(data.uid,data.teamInfo[i].heroid,function(msg)
heroData= GoodFriendManager.GetHeroDatas(msg.hero,msg.force,msg.SpecialEffects)
GoodFriendManager.InitEquipData(msg.equip,heroData)
UIManager.OpenPanel(UIName.RoleInfoPopup, heroData,true)
end)
end)
2020-05-09 13:31:21 +08:00
end
--抢夺点击事件
Util.AddOnceClick(Util.GetGameObject(go, "lootBtn"), function()
GuildCarDelayManager.SetheroDid(data.uid)
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.GUILD_CAR_DELEAY)
2020-05-15 16:52:35 +08:00
this:ClosePanel()
2020-05-09 13:31:21 +08:00
end)
end
--界面关闭时调用(用于子类重写)
function GuildCarDelayLootPopup:OnClose()
end
--界面销毁时调用(用于子类重写)
function GuildCarDelayLootPopup:OnDestroy()
end
return GuildCarDelayLootPopup