2020-08-26 15:16:17 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
RoleListPanel = Inherit(BasePanel)
|
|
|
|
|
local this = RoleListPanel
|
|
|
|
|
local sortType = 1 -- 1:品阶 2:等级
|
|
|
|
|
local proId=0--0 全部 1 火 2风 3 水 4 地 5 光 6 暗
|
|
|
|
|
local tarHero = {}
|
|
|
|
|
local teamHero = {}
|
|
|
|
|
local roleDatas={}
|
|
|
|
|
this.isFirstOpen=true
|
|
|
|
|
local tabs = {}
|
|
|
|
|
local soulPrintData={}
|
|
|
|
|
local orginLayer = 0
|
2020-07-28 15:06:47 +08:00
|
|
|
|
local orginLayer2 = 0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local isFristOpenTime = Timer.New()
|
|
|
|
|
function RoleListPanel:InitComponent()
|
|
|
|
|
|
|
|
|
|
this.BtnBack = Util.GetGameObject(self.transform, "rightUp/btnBack")
|
2021-01-26 17:08:39 +08:00
|
|
|
|
this.cardPre = poolManager:LoadAsset("card", PoolManager.AssetType.GameObject)
|
|
|
|
|
UIManager.DoLanguageCheck(this.cardPre)
|
2020-07-28 15:06:47 +08:00
|
|
|
|
this.cardPre.transform:SetParent(self.transform)
|
|
|
|
|
this.cardPre:GetComponent("RectTransform").localScale = Vector3.New(1,1,1)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.btnPrant = Util.GetGameObject(self.gameObject, "Tabs")
|
|
|
|
|
for i = 0, 6 do
|
|
|
|
|
tabs[i] = Util.GetGameObject(self.transform, "Tabs/grid/Btn" .. i)
|
|
|
|
|
end
|
|
|
|
|
this.ShaiXuanBtn = Util.GetGameObject(self.gameObject, "ShaiXuanBtn")
|
|
|
|
|
this.ShaiXuanBtnLv = Util.GetGameObject(self.gameObject, "ShaiXuanBtn/Lv")
|
|
|
|
|
this.ShaiXuanBtnQu = Util.GetGameObject(self.gameObject, "ShaiXuanBtn/Qu")
|
|
|
|
|
this.selectBtn = Util.GetGameObject(self.gameObject, "Tabs/selectBtn")
|
|
|
|
|
this.heroNumText = Util.GetGameObject(self.gameObject, "heroNum")
|
|
|
|
|
this.ScrollBar = Util.GetGameObject(self.gameObject, "Scrollbar"):GetComponent("Scrollbar")
|
|
|
|
|
this.fenJieBtn = Util.GetGameObject(self.gameObject, "fenJieBtn")
|
|
|
|
|
--this.fenJieBtn:SetActive(false)
|
|
|
|
|
this.formationBtn = Util.GetGameObject(self.gameObject, "formationBtn")
|
|
|
|
|
|
|
|
|
|
this.BtView =SubUIManager.Open(SubUIConfig.BtView, self.gameObject.transform)
|
|
|
|
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
|
|
|
|
|
|
|
|
|
local v2 = Util.GetGameObject(self.gameObject, "scroll"):GetComponent("RectTransform").rect
|
|
|
|
|
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.transform, "scroll").transform,
|
2020-09-02 22:29:33 +08:00
|
|
|
|
this.cardPre, this.ScrollBar, Vector2.New(-v2.x*2, -v2.y*2), 1, 5, Vector2.New(8,5))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ScrollView.moveTween.MomentumAmount = 1
|
|
|
|
|
this.ScrollView.moveTween.Strength = 1
|
|
|
|
|
|
|
|
|
|
-- 嚣张的头像
|
|
|
|
|
this.level = Util.GetGameObject(self.gameObject, "LeftUp/headBox/lvFrame/lv"):GetComponent("Text")
|
|
|
|
|
this.playName = Util.GetGameObject(self.gameObject, "LeftUp/headBox/name"):GetComponent("Text")
|
|
|
|
|
this.expSliderValue = Util.GetGameObject(self.gameObject, "LeftUp/headBox/exp"):GetComponent("Slider")
|
2020-09-01 17:12:00 +08:00
|
|
|
|
this.expSliderValue.transform.localScale = Vector3.New(UIManager.adapterScale, 1, 1)
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.headBox = Util.GetGameObject(self.gameObject, "LeftUp/headBox")
|
|
|
|
|
this.headPos = Util.GetGameObject(self.gameObject, "LeftUp/headBox/headpos")
|
|
|
|
|
this.headRedpot = Util.GetGameObject(self.gameObject, "LeftUp/headBox/redpot")
|
|
|
|
|
this.teamPower = Util.GetGameObject(self.gameObject, "LeftUp/powerBtn/value"):GetComponent("Text")
|
|
|
|
|
this.maxk = Util.GetGameObject(self.gameObject, "maxk")
|
|
|
|
|
|
|
|
|
|
-- 特权
|
|
|
|
|
this.vipPrivilegeBtn = Util.GetGameObject(self.gameObject, "LeftUp/vipPrivilege/vipPrivilegeBtn")
|
|
|
|
|
this.vipLevelText = Util.GetGameObject(this.vipPrivilegeBtn, "bg/vip"):GetComponent("Image")
|
|
|
|
|
this.vipRedPoint = Util.GetGameObject(self.gameObject, "LeftUp/vipPrivilege/redPoint")
|
|
|
|
|
screenAdapte(this.vipPrivilegeBtn)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function RoleListPanel:BindEvent()
|
|
|
|
|
|
|
|
|
|
Util.AddClick(this.BtnBack, function()
|
|
|
|
|
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
|
|
|
|
|
HeroManager.heroListPanelSortID=SortTypeConst.Natural
|
|
|
|
|
HeroManager.heroListPanelProID=ProIdConst.All
|
|
|
|
|
UIManager.OpenPanel(UIName.MainPanel)
|
|
|
|
|
end)
|
|
|
|
|
for i = 0, 6 do
|
|
|
|
|
Util.AddClick(tabs[i], function()
|
|
|
|
|
if this.isFirstOpen == false then
|
|
|
|
|
if i == proId then
|
|
|
|
|
proId=ProIdConst.All
|
|
|
|
|
HeroManager.heroListPanelProID=ProIdConst.All
|
|
|
|
|
else
|
|
|
|
|
proId=i
|
|
|
|
|
HeroManager.heroListPanelProID=proId
|
|
|
|
|
end
|
|
|
|
|
this:GetCurSortHeroListData()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
Util.AddClick(this.ShaiXuanBtn, function()
|
|
|
|
|
if sortType == SortTypeConst.Lv then
|
|
|
|
|
sortType = SortTypeConst.Natural
|
|
|
|
|
HeroManager.heroListPanelSortID=SortTypeConst.Natural
|
|
|
|
|
else
|
|
|
|
|
sortType = SortTypeConst.Lv
|
|
|
|
|
HeroManager.heroListPanelSortID=SortTypeConst.Lv
|
|
|
|
|
end
|
|
|
|
|
this.ShaiXuanBtnLv:SetActive(sortType ~= SortTypeConst.Lv)
|
|
|
|
|
this.ShaiXuanBtnQu:SetActive(sortType ~= SortTypeConst.Natural)
|
|
|
|
|
this:GetCurSortHeroListData()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.fenJieBtn, function()
|
|
|
|
|
UIManager.OpenPanel(UIName.HandBookHeroAndEquipListPanel,1)
|
|
|
|
|
--if ActTimeCtrlManager.SingleFuncState(24) then
|
|
|
|
|
-- UIManager.OpenPanel(UIName.HeroAndEquipResolvePanel,1)
|
|
|
|
|
--else
|
|
|
|
|
-- PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(24))
|
|
|
|
|
--end
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.formationBtn, function()
|
|
|
|
|
if ActTimeCtrlManager.SingleFuncState(54) then
|
|
|
|
|
-- UIManager.OpenPanel(UIName.FormationSetPanel)
|
|
|
|
|
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.SAVE_FORMATION)
|
|
|
|
|
else
|
|
|
|
|
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(54))
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
-- 点击你的猪头
|
|
|
|
|
Util.AddClick(this.headBox, function ()
|
|
|
|
|
UIManager.OpenPanel(UIName.SettingPanel)
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
BindRedPointObject(RedPointType.Setting, this.headRedpot)
|
|
|
|
|
|
|
|
|
|
Util.AddClick(this.vipPrivilegeBtn, function()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.VipPanelV2)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
BindRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function RoleListPanel:AddListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function RoleListPanel:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnSortingOrderChange()
|
2020-07-28 15:06:47 +08:00
|
|
|
|
Util.AddParticleSortLayer(this.vipPrivilegeBtn, self.sortingOrder - orginLayer)
|
|
|
|
|
this.ScrollView:ForeachItemGO(function (index, go)
|
|
|
|
|
Util.AddParticleSortLayer(go, self.sortingOrder - orginLayer)
|
|
|
|
|
end)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
orginLayer = self.sortingOrder
|
2020-06-08 13:57:30 +08:00
|
|
|
|
this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder })
|
2020-07-28 15:06:47 +08:00
|
|
|
|
|
2020-09-25 21:19:01 +08:00
|
|
|
|
-- 头像层级
|
|
|
|
|
if this.playerHead then
|
|
|
|
|
this.playerHead:SetLayer(self.sortingOrder)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function RoleListPanel:OnShow()
|
|
|
|
|
|
2020-08-11 00:08:56 +08:00
|
|
|
|
--检测成员红点
|
|
|
|
|
CheckRedPointStatus(RedPointType.Role)
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
tarHero=HeroManager.GetAllHeroDatas()
|
|
|
|
|
teamHero=FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_NORMAL)
|
|
|
|
|
this.isFirstOpen=true
|
|
|
|
|
this.maxk:SetActive(true)
|
2021-03-02 15:49:02 +08:00
|
|
|
|
this.heroNumText:GetComponent("Text").text=string.format("神将数量:%s",#tarHero)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.RoleInfo })
|
|
|
|
|
this.BtView:OnOpen({sortOrder = self.sortingOrder,panelType = PanelTypeView.MemberPanel})
|
|
|
|
|
SoundManager.PlayMusic(SoundConfig.BGM_Main)
|
|
|
|
|
sortType = HeroManager.heroListPanelSortID
|
|
|
|
|
proId = HeroManager.heroListPanelProID
|
|
|
|
|
this:GetCurSortHeroListData()
|
|
|
|
|
--if ActTimeCtrlManager.SingleFuncState(24) then
|
|
|
|
|
-- Util.SetGray(this.fenJieBtn, false)
|
|
|
|
|
--else
|
|
|
|
|
--Util.SetGray(this.fenJieBtn, true)
|
|
|
|
|
--end
|
|
|
|
|
if ActTimeCtrlManager.SingleFuncState(54) then
|
|
|
|
|
Util.SetGray(this.formationBtn, false)
|
|
|
|
|
else
|
|
|
|
|
Util.SetGray(this.formationBtn, true)
|
|
|
|
|
end
|
2021-01-15 22:11:38 +08:00
|
|
|
|
-- if this.ScrollView then
|
|
|
|
|
-- this.ScrollView:SetIndex(1)
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
this.FreshPlayerInfo()
|
|
|
|
|
this.SetPlayerHead()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 刷新玩家信息显示
|
|
|
|
|
function this.FreshPlayerInfo()
|
|
|
|
|
this.vipLevelText.sprite = VipManager.SetVipLevelImg()
|
|
|
|
|
this.level.text = PlayerManager.level
|
|
|
|
|
this.expSliderValue.value = PlayerManager.exp / PlayerManager.userLevelData[PlayerManager.level].Exp
|
|
|
|
|
this.playName.text = PlayerManager.nickName
|
|
|
|
|
this.teamPower.text = FormationManager.GetFormationPower(FormationManager.curFormationIndex)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 设置头像
|
|
|
|
|
function this.SetPlayerHead()
|
|
|
|
|
if not this.playerHead then
|
|
|
|
|
this.playerHead = SubUIManager.Open(SubUIConfig.PlayerHeadView, this.headPos.transform)
|
|
|
|
|
end
|
|
|
|
|
this.playerHead:SetHead(PlayerManager.head)
|
2021-01-15 21:06:48 +08:00
|
|
|
|
this.playerHead:SetFrame(HeadManager.GetCurFrameId())
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.playerHead:SetScale(Vector3.one * 0.9)
|
2020-09-25 21:19:01 +08:00
|
|
|
|
this.playerHead:SetPosition(Vector3.New(-5, 8, 0))
|
|
|
|
|
this.playerHead:SetLayer(this.sortingOrder)
|
|
|
|
|
this.playerHead:SetEffectScale(0.85)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--组合当前选项数据
|
|
|
|
|
function this:GetCurSortHeroListData()
|
2020-07-25 17:08:20 +08:00
|
|
|
|
local heros = {}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if proId ~= ProIdConst.All then
|
|
|
|
|
heros = HeroManager.GetHeroDataByProperty(proId)
|
|
|
|
|
else
|
|
|
|
|
heros = tarHero
|
|
|
|
|
end
|
|
|
|
|
this:SetRoleList(heros)
|
2020-07-25 17:08:20 +08:00
|
|
|
|
this:SetSelectBtn()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-01-15 22:11:38 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--设置英雄列表数据
|
|
|
|
|
function this:SetRoleList(_roleDatas)
|
|
|
|
|
roleDatas=_roleDatas
|
|
|
|
|
this:SortHeroDatas(_roleDatas)
|
2020-07-21 16:04:07 +08:00
|
|
|
|
HeroManager.heroSortedDatas = roleDatas
|
2021-03-02 15:49:02 +08:00
|
|
|
|
this.heroNumText:GetComponent("Text").text=string.format("神将数量:%s",#_roleDatas)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ScrollView:SetData(_roleDatas, function (index, go)
|
2021-01-15 22:11:38 +08:00
|
|
|
|
-- if this.isFirstOpen then
|
|
|
|
|
-- go.gameObject:SetActive(false)
|
|
|
|
|
-- end
|
|
|
|
|
this.SingleHeroDataShow(go, roleDatas[index])
|
|
|
|
|
--Log("RoleListPanel::SetRoleList_HeroDataShow____")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
2021-01-15 22:11:38 +08:00
|
|
|
|
|
|
|
|
|
-- this.ScrollView:SetIndex(#roleDatas)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Log("RoleListPanel::SetRoleList____END")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if this.isFirstOpen then
|
2021-01-15 22:11:38 +08:00
|
|
|
|
-- this.ScrollView:ForeachItemGO(function (index, go)
|
|
|
|
|
-- Timer.New(function ()
|
|
|
|
|
-- go.gameObject:SetActive(true)
|
|
|
|
|
-- PlayUIAnim(go.gameObject)
|
|
|
|
|
-- --将原有同步的数据更新,修改为异步调用
|
|
|
|
|
-- -- this.SingleHeroDataShow(go, roleDatas[index])
|
|
|
|
|
-- end, 0.03*(index-1)):Start()
|
|
|
|
|
-- end)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if isFristOpenTime then
|
|
|
|
|
isFristOpenTime:Stop()
|
|
|
|
|
isFristOpenTime = nil
|
|
|
|
|
end
|
|
|
|
|
isFristOpenTime = Timer.New(function()
|
|
|
|
|
this.isFirstOpen = false
|
|
|
|
|
this.maxk:SetActive(false)
|
|
|
|
|
end, 0.8):Start()
|
|
|
|
|
end
|
2020-07-28 15:06:47 +08:00
|
|
|
|
this.ScrollView:ForeachItemGO(function (index, go)
|
|
|
|
|
Util.AddParticleSortLayer(go, self.sortingOrder - orginLayer2)
|
|
|
|
|
end)
|
|
|
|
|
orginLayer2 =self.sortingOrder
|
|
|
|
|
orginLayer = self.sortingOrder
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
function this.SingleHeroDataShow(_go,_heroData)
|
|
|
|
|
local heroData = _heroData
|
2020-07-25 13:21:30 +08:00
|
|
|
|
SetHeroBg(Util.GetGameObject(_go.transform, "card"),Util.GetGameObject(_go.transform, "card/bg"),_heroData.star,heroData.heroConfig.Quality)
|
2020-12-17 10:41:00 +08:00
|
|
|
|
|
|
|
|
|
if HarmonyManager.IsChangeColor(heroData.dynamicId) then
|
|
|
|
|
-- body
|
|
|
|
|
Util.GetGameObject(_go.transform, "card/lv/Text"):GetComponent("Text").text = "<color=#0f0>"..heroData.lv.."</color>"
|
2021-01-18 17:43:11 +08:00
|
|
|
|
elseif HarmonyManager:IsEnvoy(heroData.dynamicId) and HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv) then
|
|
|
|
|
local temp= HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv)
|
|
|
|
|
if temp.heroTid == 0 and temp.value > 0 then
|
2020-12-29 20:36:37 +08:00
|
|
|
|
-- body
|
|
|
|
|
Util.GetGameObject(_go.transform, "card/lv/Text"):GetComponent("Text").text = "<color=#ffbe22>"..heroData.lv.."</color>"
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
Util.GetGameObject(_go.transform, "card/lv/Text"):GetComponent("Text").text = heroData.lv
|
|
|
|
|
end
|
2020-12-17 10:41:00 +08:00
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
Util.GetGameObject(_go.transform, "card/lv/Text"):GetComponent("Text").text = heroData.lv
|
|
|
|
|
end
|
|
|
|
|
|
2021-01-26 17:08:39 +08:00
|
|
|
|
Util.GetGameObject(_go.transform, "card/name"):GetComponent("Text").text = GetLanguageStrById(heroData.heroConfig.ReadingName)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.GetGameObject(_go.transform, "card/icon"):GetComponent("Image").sprite = Util.LoadSprite(heroData.painting)
|
|
|
|
|
-- Util.GetGameObject(_go.transform, "card/pos/icon"):GetComponent("Image").sprite = Util.LoadSprite(heroData.professionIcon)
|
|
|
|
|
Util.GetGameObject(_go.transform, "card/pro/Image"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
|
|
|
|
|
Util.GetGameObject(_go.transform, "card/heroStage"):GetComponent("Image").sprite = Util.LoadSprite(HeroStageSprite[heroData.heroConfig.HeroStage])
|
|
|
|
|
local redPoint = Util.GetGameObject(_go.transform, "card/redAndLock/redPoint")
|
|
|
|
|
Util.GetGameObject(_go.transform, "card/redAndLock/lockImage"):SetActive(heroData.lockState == 1)
|
2020-09-02 22:29:33 +08:00
|
|
|
|
_go.transform.localScale = Vector3.one * 0.95
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local starGrid = Util.GetGameObject(_go.transform, "star")
|
|
|
|
|
local starPre = Util.GetGameObject(_go.transform, "starPre")
|
|
|
|
|
--Util.ClearChild(starGrid.transform)
|
2020-07-24 20:03:06 +08:00
|
|
|
|
SetHeroStars(starGrid, heroData.star,1,Vector2(32.5,32.5),-10)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--local cardBtn = Util.GetGameObject(_go.transform, "card(Clone)")
|
|
|
|
|
SoulPrintManager.UnLockSoulPrintPos(heroData)
|
|
|
|
|
local soulPrintIsOpen = table.nums(SoulPrintManager.hasUnlockPos)>=1
|
|
|
|
|
if teamHero[heroData.dynamicId]~=nil then
|
|
|
|
|
Util.GetGameObject(_go.transform, "card/choosed"):SetActive(true)
|
|
|
|
|
local isCanShowSoulPrintPoint = RedPointManager.PlayerPrefsGetStr(PlayerManager.uid .. heroData.dynamicId)
|
|
|
|
|
soulPrintData = SoulPrintManager.GetSoulPrintAndSort(SoulPrintManager.soulPrintData)
|
2020-06-03 19:09:01 +08:00
|
|
|
|
redPoint:SetActive(HeroManager.GetCurHeroIsShowRedPoint(heroData))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
redPoint:SetActive(false)
|
|
|
|
|
Util.GetGameObject(_go.transform, "card/choosed"):SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
--Util.GetGameObject(_go.transform, "card/choosed"):SetActive(teamHero[heroData
|
|
|
|
|
-- .dynamicId]~=nil)
|
|
|
|
|
Util.AddOnceClick(Util.GetGameObject(_go.transform, "card"), function()
|
2020-07-21 16:04:07 +08:00
|
|
|
|
this.OnClickEnterHeroInfo(heroData, HeroManager.heroSortedDatas,teamHero[heroData.dynamicId]~=nil)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
function this:SetSelectBtn()
|
2020-07-25 17:08:20 +08:00
|
|
|
|
this.selectBtn.transform:SetParent(tabs[proId].transform)
|
|
|
|
|
this.selectBtn:GetComponent("RectTransform").localPosition = Vector3.zero
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
function this:SortHeroDatas(_heroDatas)
|
|
|
|
|
--上阵最优先,星级优先,同星级等级优先,同星级同等级按sortId排序。排序时降序排序。
|
|
|
|
|
table.sort(_heroDatas, function(a, b)
|
2020-07-31 14:45:32 +08:00
|
|
|
|
if (teamHero[a.dynamicId] and teamHero[b.dynamicId]) or (not teamHero[a.dynamicId] and not teamHero[b.dynamicId]) then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if sortType==SortTypeConst.Lv then
|
|
|
|
|
if a.lv ==b.lv then
|
|
|
|
|
if a.heroConfig.Quality ==b.heroConfig.Quality then--Natural
|
|
|
|
|
if a.star == b.star then
|
2020-07-31 14:45:32 +08:00
|
|
|
|
if a.warPower == b.warPower then
|
|
|
|
|
if a.heroConfig.Natural ==b.heroConfig.Natural then--Natural
|
|
|
|
|
return a.heroConfig.Id < b.heroConfig.Id
|
|
|
|
|
else
|
|
|
|
|
return a.heroConfig.Natural > b.heroConfig.Natural
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2020-07-31 14:45:32 +08:00
|
|
|
|
return a.warPower > b.warPower
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.star > b.star
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.heroConfig.Quality > b.heroConfig.Quality
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.lv>b.lv
|
|
|
|
|
end
|
|
|
|
|
elseif sortType==SortTypeConst.Natural then
|
|
|
|
|
if a.heroConfig.Quality ==b.heroConfig.Quality then--Natural
|
|
|
|
|
if a.star == b.star then
|
|
|
|
|
if a.lv == b.lv then
|
2020-07-31 14:45:32 +08:00
|
|
|
|
if a.warPower == b.warPower then
|
|
|
|
|
if a.heroConfig.Natural ==b.heroConfig.Natural then--Natural
|
|
|
|
|
return a.heroConfig.Id < b.heroConfig.Id
|
|
|
|
|
else
|
|
|
|
|
return a.heroConfig.Natural > b.heroConfig.Natural
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.warPower > b.warPower
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
return a.lv > b.lv
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.star > b.star
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
return a.heroConfig.Quality > b.heroConfig.Quality
|
|
|
|
|
end
|
2020-07-31 14:45:32 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
|
|
|
|
return teamHero[a.dynamicId] and not teamHero[b.dynamicId]
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.OnClickEnterHeroInfo(_curhero, _heros,isUpZhen)
|
|
|
|
|
UIManager.OpenPanel(UIName.RoleInfoPanel, _curhero, _heros,isUpZhen)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetRoleItemByName(name)
|
|
|
|
|
local targetItem
|
|
|
|
|
this.ScrollView:ForeachItemGO(function (index, go)
|
|
|
|
|
local itemName = Util.GetGameObject(go.transform, "card/name"):GetComponent("Text").text
|
|
|
|
|
if Util.GetGameObject(go.transform, "card/choosed").activeInHierarchy then
|
|
|
|
|
if not targetItem and name == itemName then
|
|
|
|
|
targetItem = go
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if not targetItem and name == itemName then
|
|
|
|
|
targetItem = go
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
return targetItem
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function RoleListPanel:OnClose()
|
2020-07-06 18:37:29 +08:00
|
|
|
|
proId=0--面板关闭时 重置筛选按钮为全部
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if isFristOpenTime then
|
|
|
|
|
isFristOpenTime:Stop()
|
|
|
|
|
isFristOpenTime = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function RoleListPanel:OnDestroy()
|
|
|
|
|
|
|
|
|
|
SubUIManager.Close(this.UpView)
|
|
|
|
|
SubUIManager.Close(this.BtView)
|
|
|
|
|
ClearRedPointObject(RedPointType.Setting, this.headRedpot)
|
|
|
|
|
ClearRedPointObject(RedPointType.VipPrivilege, this.vipRedPoint)
|
|
|
|
|
|
|
|
|
|
this.ScrollView = nil
|
|
|
|
|
end
|
|
|
|
|
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return RoleListPanel
|