2021-04-21 13:12:04 +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 = {}
|
2022-03-28 18:18:19 +08:00
|
|
|
|
local tabsImg = {"z_icon_01_zh", "r_hero_huo 1_zh", "r_hero_feng 1_zh", "r_hero_shui 1_zh", "r_hero_dadi 1_zh","z_icon_qingjinbao"}
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
this.BtnBack = Util.GetGameObject(self.transform, "rightUp/btnBack")
|
2022-01-07 10:08:55 +08:00
|
|
|
|
this.cardPre = poolManager:LoadAsset("card", PoolManager.AssetType.GameObject)
|
2021-04-22 17:54:03 +08:00
|
|
|
|
UIManager.DoLanguageCheck(this.spLoader, 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)
|
2022-01-12 16:41:51 +08:00
|
|
|
|
local starPre = poolManager:LoadAsset("starGrid", PoolManager.AssetType.GameObject)
|
|
|
|
|
starPre.transform:SetParent(Util.GetGameObject(self.transform, "card(Clone)/card/star").transform)
|
|
|
|
|
local particles1=starPre:GetComponentsInChildren(typeof(UnityEngine.ParticleSystem))
|
|
|
|
|
for key, value in pairs(particles1:ToTable()) do
|
|
|
|
|
local mat=value:GetComponent(typeof(UnityEngine.Renderer))
|
|
|
|
|
if mat.material.shader.name=="CGwell FX/Additive Lv1" then
|
|
|
|
|
mat.material.shader=poolManager:LoadAsset("Add Lv1_1",poolManager.AssetType.Other)
|
|
|
|
|
elseif mat.material.shader.name=="UI Particles/Additive" then
|
|
|
|
|
mat.material.shader=poolManager:LoadAsset("UI-Particle-Add_1",poolManager.AssetType.Other)
|
|
|
|
|
end
|
|
|
|
|
end
|
2022-01-07 10:08:55 +08:00
|
|
|
|
local particles=this.cardPre:GetComponentsInChildren(typeof(UnityEngine.ParticleSystem))
|
|
|
|
|
for key, value in pairs(particles:ToTable()) do
|
|
|
|
|
local mat=value:GetComponent(typeof(UnityEngine.Renderer))
|
|
|
|
|
if mat.material.shader.name=="CGwell FX/Additive Lv1" then
|
|
|
|
|
mat.material.shader=poolManager:LoadAsset("Add Lv1_1",poolManager.AssetType.Other)
|
2022-01-12 16:41:51 +08:00
|
|
|
|
elseif mat.material.shader.name=="UI Particles/Additive" then
|
|
|
|
|
mat.material.shader=poolManager:LoadAsset("UI-Particle-Add_1",poolManager.AssetType.Other)
|
2022-01-19 15:29:47 +08:00
|
|
|
|
elseif mat.material.shader.name=="YXZ/Effect/Mix Masking(Without Moving)_alphablend" then
|
|
|
|
|
mat.material.shader=poolManager:LoadAsset("YXZ_MixMaskingWithoutMoving_alphablend_1",poolManager.AssetType.Other)
|
2022-01-07 10:08:55 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local meshs=this.cardPre:GetComponentsInChildren(typeof(UnityEngine.MeshRenderer))
|
|
|
|
|
for key, value in pairs(meshs:ToTable()) do
|
|
|
|
|
if value.material.shader.name=="Custom/S_03_UV_alpha_add" then
|
|
|
|
|
value.material.shader=poolManager:LoadAsset("S_03_uv_alpha_add_1",poolManager.AssetType.Other)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local meshs2=this.cardPre:GetComponentsInChildren(typeof(UnityEngine.SkinnedMeshRenderer))
|
|
|
|
|
for key, value in pairs(meshs2:ToTable()) do
|
|
|
|
|
if value.material.shader.name=="YXZ/Effect/TransparentRim" then
|
|
|
|
|
value.material.shader=poolManager:LoadAsset("YXZ_Effect_TransparentRim_1",poolManager.AssetType.Other)
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.btnPrant = Util.GetGameObject(self.gameObject, "Tabs")
|
|
|
|
|
for i = 0, 6 do
|
2023-08-04 18:58:14 +08:00
|
|
|
|
tabs[i] = Util.GetGameObject(self.transform, "Tabs/grid/box/Btn" .. i)
|
|
|
|
|
-- if tabsImg[i + 1] then
|
|
|
|
|
-- Util.GetGameObject(tabs[i], "Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite(tabsImg[i + 1])
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
this.ShaiXuanBtn = Util.GetGameObject(self.gameObject, "ShaiXuanBtn")
|
|
|
|
|
this.ShaiXuanBtnLv = Util.GetGameObject(self.gameObject, "ShaiXuanBtn/Lv")
|
2021-04-22 18:26:48 +08:00
|
|
|
|
this.ShaiXuanBtnLv:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_tongyong_dengjiqiehuan_zh")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ShaiXuanBtnQu = Util.GetGameObject(self.gameObject, "ShaiXuanBtn/Qu")
|
2021-04-22 18:26:48 +08:00
|
|
|
|
this.ShaiXuanBtnQu:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_tongyong_pingjieqiehuan_zh")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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")
|
2021-09-22 20:47:13 +08:00
|
|
|
|
this.haogandu = Util.GetGameObject(self.gameObject, "haogandu")
|
2021-09-26 21:32:04 +08:00
|
|
|
|
this.haoganduLv = Util.GetGameObject(this.haogandu, "lv"):GetComponent("Text")
|
|
|
|
|
--this.haogandu.gameObject:SetActive(false)
|
2021-09-27 10:58:41 +08:00
|
|
|
|
this.haoganduRed = Util.GetGameObject(this.haogandu, "redPoint")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2021-03-30 18:42:30 +08:00
|
|
|
|
if not this.playerInfoView then
|
|
|
|
|
this.playerInfoView = SubUIManager.Open(SubUIConfig.PlayerInfoView, this.transform)
|
2022-01-19 16:57:17 +08:00
|
|
|
|
-- this.playerInfoView.gameObject:AddComponent(typeof(UnityEngine.Canvas)).overrideSorting=true
|
2022-01-07 10:08:55 +08:00
|
|
|
|
--this.playerInfoView.overrideSorting=true
|
2021-03-30 18:42:30 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.BtView =SubUIManager.Open(SubUIConfig.BtView, self.gameObject.transform)
|
|
|
|
|
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
|
2022-01-07 10:08:55 +08:00
|
|
|
|
--this.UpView.gameObject:AddComponent(typeof(UnityEngine.Canvas)).overrideSorting=true
|
2022-01-05 18:17:44 +08:00
|
|
|
|
--this.UpView.overrideSorting=true
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local v2 = Util.GetGameObject(self.gameObject, "scroll"):GetComponent("RectTransform").rect
|
|
|
|
|
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.transform, "scroll").transform,
|
2023-08-04 18:58:14 +08:00
|
|
|
|
this.cardPre, this.ScrollBar, Vector2.New(-v2.x*2, -v2.y*2+20), 1, 5, Vector2.New(25,8))
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ScrollView.moveTween.MomentumAmount = 1
|
|
|
|
|
this.ScrollView.moveTween.Strength = 1
|
|
|
|
|
|
|
|
|
|
this.maxk = Util.GetGameObject(self.gameObject, "maxk")
|
2022-01-07 10:08:55 +08:00
|
|
|
|
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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)
|
2021-09-26 21:32:04 +08:00
|
|
|
|
-- if ActTimeCtrlManager.SingleFuncState(24) then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- UIManager.OpenPanel(UIName.HeroAndEquipResolvePanel,1)
|
2021-09-26 21:32:04 +08:00
|
|
|
|
-- else
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(24))
|
2021-09-26 21:32:04 +08:00
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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)
|
2021-08-27 18:39:45 +08:00
|
|
|
|
|
2021-09-22 20:47:13 +08:00
|
|
|
|
Util.AddClick(this.haogandu, function()
|
2021-09-27 09:45:57 +08:00
|
|
|
|
--UIManager.OpenPanel(UIName.LikeAbilityPanel)
|
|
|
|
|
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.LikeAbility) then
|
2021-09-27 14:22:23 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.LikeAbilityPanel)
|
2021-09-27 09:45:57 +08:00
|
|
|
|
else
|
|
|
|
|
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.LikeAbility))
|
|
|
|
|
end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
end)
|
2021-09-27 10:58:41 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.LikeabilityRed)
|
2021-09-22 20:47:13 +08:00
|
|
|
|
BindRedPointObject(RedPointType.LikeabilityRed,this.haoganduRed)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function RoleListPanel:AddListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function RoleListPanel:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:OnSortingOrderChange()
|
2023-08-04 18:58:14 +08:00
|
|
|
|
if this.ScrollView then
|
2020-07-28 15:06:47 +08:00
|
|
|
|
this.ScrollView:ForeachItemGO(function (index, go)
|
2022-01-12 16:41:51 +08:00
|
|
|
|
Util.SetParticleSortLayer(go, self.sortingOrder)
|
2020-07-28 15:06:47 +08:00
|
|
|
|
end)
|
2023-08-04 18:58:14 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
orginLayer = self.sortingOrder
|
2023-08-04 18:58:14 +08:00
|
|
|
|
if this.BtView then
|
2020-06-08 13:57:30 +08:00
|
|
|
|
this.BtView:SetOrderStatus({ sortOrder = self.sortingOrder })
|
2023-08-04 18:58:14 +08:00
|
|
|
|
end
|
2022-01-07 10:08:55 +08:00
|
|
|
|
-- -- 头像层级
|
2021-03-30 18:42:30 +08:00
|
|
|
|
if this.playerInfoView then
|
2022-01-19 16:57:17 +08:00
|
|
|
|
--this.playerInfoView:SetLayer(self.sortingOrder+2)
|
|
|
|
|
--SetParticleSortLayer(this.playerInfoView,self.sortingOrder+2)
|
2022-01-05 18:17:44 +08:00
|
|
|
|
end
|
2022-01-07 10:08:55 +08:00
|
|
|
|
-- if this.UpView then
|
|
|
|
|
-- SetParticleSortLayer(this.UpView,self.sortingOrder+2)
|
|
|
|
|
-- end
|
2021-11-03 18:11:08 +08:00
|
|
|
|
|
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 16:53:12 +08:00
|
|
|
|
this.heroNumText:GetComponent("Text").text=string.format(Language[11821],#tarHero)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.RoleInfo })
|
2021-04-22 13:40:04 +08:00
|
|
|
|
this.BtView:OnOpen(self, {sortOrder = self.sortingOrder,panelType = PanelTypeView.MemberPanel})
|
2020-05-09 13:31:21 +08:00
|
|
|
|
SoundManager.PlayMusic(SoundConfig.BGM_Main)
|
|
|
|
|
sortType = HeroManager.heroListPanelSortID
|
|
|
|
|
proId = HeroManager.heroListPanelProID
|
|
|
|
|
this:GetCurSortHeroListData()
|
2021-09-26 21:32:04 +08:00
|
|
|
|
-- if ActTimeCtrlManager.SingleFuncState(24) then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
-- Util.SetGray(this.fenJieBtn, false)
|
2021-09-26 21:32:04 +08:00
|
|
|
|
-- else
|
|
|
|
|
-- Util.SetGray(this.fenJieBtn, true)
|
|
|
|
|
-- end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2021-03-30 20:46:47 +08:00
|
|
|
|
-- 刷新一次编队战斗力
|
|
|
|
|
FormationManager.RefreshMainFormationPower()
|
2021-09-27 09:45:57 +08:00
|
|
|
|
this.haogandu.gameObject:SetActive(ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.LikeAbility))
|
2021-09-26 21:32:04 +08:00
|
|
|
|
local totalCurNum,totalLv,totalNum = LikabilityManager.GetTotalHeroLikeLv(-1)
|
|
|
|
|
this.haoganduLv.text = totalLv
|
2021-09-27 09:45:57 +08:00
|
|
|
|
--this.haogandu.gameObject:SetActive(true)--ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.LikeAbility))
|
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
|
|
|
|
|
|
2022-03-28 18:18:19 +08:00
|
|
|
|
function this:ChangeProId(id)
|
|
|
|
|
proId=id
|
|
|
|
|
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 16:53:12 +08:00
|
|
|
|
this.heroNumText:GetComponent("Text").text=string.format(Language[11821],#_roleDatas)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.ScrollView:SetData(_roleDatas, function (index, go)
|
2021-01-15 22:11:38 +08:00
|
|
|
|
this.SingleHeroDataShow(go, roleDatas[index])
|
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
|
|
|
|
if this.isFirstOpen then
|
|
|
|
|
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
|
|
|
|
orginLayer2 =self.sortingOrder
|
|
|
|
|
orginLayer = self.sortingOrder
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
function this.SingleHeroDataShow(_go,_heroData)
|
|
|
|
|
local heroData = _heroData
|
2022-01-05 18:17:44 +08:00
|
|
|
|
SetHeroBg(this.spLoader, Util.GetGameObject(_go.transform, "card"),Util.GetGameObject(_go.transform, "card/bg"),_heroData.star,heroData.heroConfig.Quality,this.sortingOrder + 1)
|
2020-12-17 10:41:00 +08:00
|
|
|
|
if HarmonyManager.IsChangeColor(heroData.dynamicId) then
|
|
|
|
|
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
|
|
|
|
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)
|
2023-08-15 20:25:06 +08:00
|
|
|
|
Util.GetGameObject(_go.transform, "card/icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(heroData.heroConfig.ShowLive))
|
2023-06-30 00:13:43 +08:00
|
|
|
|
|
2023-08-04 18:58:14 +08:00
|
|
|
|
SetHEeroLiveToward(Util.GetGameObject(_go.transform, "card/icon"):GetComponent("Image"),heroData.heroConfig.Toward)
|
|
|
|
|
Util.GetGameObject(_go.transform, "card/pos/icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(heroData.professionIcon)
|
|
|
|
|
local imageCom=Util.GetGameObject(_go.transform, "card/pro/Image"):GetComponent("RectTransform")
|
|
|
|
|
if heroData.changeProId == 1 or heroData.changeProId == 2 or heroData.changeProId == 3 or heroData.changeProId == 4 then
|
|
|
|
|
imageCom.sizeDelta=Vector2.New(30,30)
|
|
|
|
|
else
|
|
|
|
|
imageCom.sizeDelta=Vector2.New(60,30)
|
|
|
|
|
end
|
|
|
|
|
imageCom.gameObject:GetComponent("Image").sprite= this.spLoader:LoadSprite(GetProStrImageByProNum(heroData.changeProId))
|
2021-04-21 13:12:04 +08:00
|
|
|
|
Util.GetGameObject(_go.transform, "card/heroStage"):GetComponent("Image").sprite = this.spLoader:LoadSprite(HeroStageSprite[heroData.heroConfig.HeroStage])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local redPoint = Util.GetGameObject(_go.transform, "card/redAndLock/redPoint")
|
|
|
|
|
Util.GetGameObject(_go.transform, "card/redAndLock/lockImage"):SetActive(heroData.lockState == 1)
|
2023-08-04 18:58:14 +08:00
|
|
|
|
Util.GetGameObject(_go.transform, "card/starnum"):GetComponent("Text").text=_heroData.star.."/".._heroData.maxStar
|
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)
|
2021-10-26 16:00:31 +08:00
|
|
|
|
local star,starType = heroData.GetStar(1)
|
2021-10-27 12:50:15 +08:00
|
|
|
|
local starSize = Vector2.New(32.5,32.5)
|
|
|
|
|
local starScale = -10
|
|
|
|
|
if starType == 3 then
|
2021-11-03 18:11:08 +08:00
|
|
|
|
starSize = Vector2.New(1,-16.12)
|
2021-10-27 12:50:15 +08:00
|
|
|
|
starScale = -13.2
|
2021-11-03 10:13:44 +08:00
|
|
|
|
elseif starType == 2 then
|
|
|
|
|
starSize = Vector2.New(60,57)
|
2021-10-27 12:50:15 +08:00
|
|
|
|
end
|
2023-08-04 18:58:14 +08:00
|
|
|
|
-- SetHeroStars(this.spLoader, starGrid, star,starType,starSize,starScale)
|
2021-11-05 10:18:10 +08:00
|
|
|
|
Util.SetParticleSortLayer(starGrid, this.sortingOrder + 1)
|
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
|
2021-08-23 15:45:10 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function this:SortHeroDatas(_heroDatas)
|
|
|
|
|
table.sort(_heroDatas, function(a, b)
|
2021-08-23 15:45:10 +08:00
|
|
|
|
--如果都在编队或都不在编队
|
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
|
2021-08-23 15:45:10 +08:00
|
|
|
|
--根据等级排列
|
|
|
|
|
if sortType == SortTypeConst.Lv then
|
|
|
|
|
--判断等级是否相同
|
|
|
|
|
if a.lv == b.lv then
|
|
|
|
|
--判断战力是否相同
|
|
|
|
|
if a.warPower == b.warPower then
|
2021-11-08 10:30:12 +08:00
|
|
|
|
local aGodLv = GodSoulManager.GetGodSoulLv(a.dynamicId)
|
|
|
|
|
local bGodLv = GodSoulManager.GetGodSoulLv(b.dynamicId)
|
|
|
|
|
if aGodLv == bGodLv then
|
|
|
|
|
---判断星级是否相同
|
|
|
|
|
if a.star == b.star then
|
|
|
|
|
--返回图鉴排序
|
|
|
|
|
return a.heroConfig.Sort < b.heroConfig.Sort
|
|
|
|
|
else
|
|
|
|
|
return a.star > b.star
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2021-11-08 10:30:12 +08:00
|
|
|
|
return aGodLv >bGodLv
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2021-08-23 15:45:10 +08:00
|
|
|
|
return a.warPower > b.warPower
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-08-23 15:45:10 +08:00
|
|
|
|
return a.lv > b.lv
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-08-23 15:45:10 +08:00
|
|
|
|
--根据品阶排列
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif sortType==SortTypeConst.Natural then
|
2021-11-08 10:30:12 +08:00
|
|
|
|
local aGodLv = GodSoulManager.GetGodSoulLv(a.dynamicId)
|
|
|
|
|
local bGodLv = GodSoulManager.GetGodSoulLv(b.dynamicId)
|
|
|
|
|
if aGodLv == bGodLv then
|
|
|
|
|
--是否星级相同
|
|
|
|
|
if a.star == b.star then
|
|
|
|
|
--判断战力是否相同
|
|
|
|
|
if a.warPower == b.warPower then
|
|
|
|
|
--判断等级是否相同
|
|
|
|
|
if a.lv == b.lv then
|
|
|
|
|
--返回图鉴排序
|
|
|
|
|
return a.heroConfig.Sort < b.heroConfig.Sort
|
|
|
|
|
else
|
|
|
|
|
return a.lv > b.lv
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2021-11-08 10:30:12 +08:00
|
|
|
|
return a.warPower > b.warPower
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-11-08 10:30:12 +08:00
|
|
|
|
return a.star > b.star
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-11-08 10:30:12 +08:00
|
|
|
|
return aGodLv >bGodLv
|
|
|
|
|
end
|
2021-08-23 15:45:10 +08:00
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2021-08-23 15:45:10 +08:00
|
|
|
|
--一个在一个不在先返回在的+不在的
|
2020-05-09 13:31:21 +08:00
|
|
|
|
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
|
2021-08-27 18:39:45 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function RoleListPanel:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
SubUIManager.Close(this.UpView)
|
|
|
|
|
SubUIManager.Close(this.BtView)
|
|
|
|
|
this.ScrollView = nil
|
2021-03-30 18:42:30 +08:00
|
|
|
|
|
|
|
|
|
if this.playerInfoView then
|
|
|
|
|
SubUIManager.Close(this.playerInfoView)
|
|
|
|
|
this.playerInfoView = nil
|
|
|
|
|
end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
ClearRedPointObject(RedPointType.LikeabilityRed,this.haoganduRed)
|
2021-08-27 18:39:45 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-04-21 13:12:04 +08:00
|
|
|
|
return RoleListPanel
|
|
|
|
|
|