2020-08-25 15:46:38 +08:00
require ( " Base/BasePanel " )
2020-05-09 13:31:21 +08:00
local spcialConfig = ConfigManager.GetConfig ( ConfigName.SpecialConfig )
2020-07-06 20:35:39 +08:00
local equipConfig = ConfigManager.GetConfig ( ConfigName.EquipConfig )
2020-05-09 13:31:21 +08:00
RoleEquipPanel = Inherit ( BasePanel )
2020-12-17 10:41:00 +08:00
local isGonming = 0
2020-05-09 13:31:21 +08:00
--local SortTypeConst = {
-- Natural = 1,--品阶 ur+ --> r 6 --> 1
-- Lv = 2
--}
local PosIdConst = {
2020-07-06 20:35:39 +08:00
All = 0 ,
--全部
WuQi = 1 ,
--武器
ZhanFu = 2 ,
--战服
TouShi = 3 ,
--头饰
ZhanXue = 4 ,
--战靴
Hun = 5 ,
--魂宝
Ling = 6
--灵宝
2020-05-09 13:31:21 +08:00
}
2020-07-06 20:35:39 +08:00
local this = RoleEquipPanel
--当前英雄穿的装备
local curHeroEquipDatas = { }
--当前英雄
2020-05-09 13:31:21 +08:00
local curHeroData
2020-07-06 20:35:39 +08:00
2020-05-09 13:31:21 +08:00
local heroListData
local curSelectEquipData
local index
2021-07-21 18:27:03 +08:00
local indexBtnNum = 1
2020-12-28 16:25:38 +08:00
local typeTab = {
2021-04-09 12:26:35 +08:00
[ 0 ] = Language [ 10175 ] ,
[ 1 ] = Language [ 10391 ] ,
[ 2 ] = Language [ 10392 ] ,
[ 3 ] = Language [ 10393 ] ,
[ 4 ] = Language [ 10394 ] ,
2023-02-17 19:43:00 +08:00
[ 5 ] = " 宝物 " ,
[ 6 ] = " 法相 " }
2020-05-09 13:31:21 +08:00
local tabs = { }
2021-07-27 18:34:37 +08:00
local redTabs = { }
2020-05-09 13:31:21 +08:00
local openThisPanel
2020-07-06 20:35:39 +08:00
local effectList = { }
2020-05-09 13:31:21 +08:00
local orginLayer1
local orginLayer
local isUpZhen = false
local teamHero = { }
local itemConfig = ConfigManager.GetConfig ( ConfigName.ItemConfig )
local jewerConfigs = ConfigManager.GetConfig ( ConfigName.JewelConfig )
2023-02-17 19:43:00 +08:00
local faXiangConfigs = ConfigManager.GetConfig ( ConfigName.FaxiangConfig )
2020-07-06 20:35:39 +08:00
local currPageIndex = 0
2020-05-09 13:31:21 +08:00
local curEquipTreasureDatas = { }
2023-02-17 19:43:00 +08:00
local curFaXiangDatas = { }
2020-06-13 11:47:13 +08:00
local isCanUpEquipTreasure = false
2023-02-19 20:08:48 +08:00
local isCanUpFaXiang = false
2020-12-24 18:57:19 +08:00
local isPlayAnim = true
local isFristOpenTime
2020-05-09 13:31:21 +08:00
--初始化组件( 用于子类重写) RoleEquipChangePopup
function RoleEquipPanel : InitComponent ( )
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New ( )
2020-05-09 13:31:21 +08:00
orginLayer = 10
2023-02-17 19:43:00 +08:00
orginLayer1 = { 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 }
2020-07-06 20:35:39 +08:00
this.bg2 = Util.GetGameObject ( self.transform , " bg2 " )
2020-05-09 13:31:21 +08:00
screenAdapte ( this.bg2 )
2020-07-06 20:35:39 +08:00
this.UpView = SubUIManager.Open ( SubUIConfig.UpView , self.gameObject . transform , { showType = UpViewOpenType.ShowLeft } )
this.btnBack = Util.GetGameObject ( self.transform , " btnBack/btnBack " )
2020-05-09 13:31:21 +08:00
--英雄
this.heroBg = Util.GetGameObject ( self.transform , " bg/heroInfo/bg " ) : GetComponent ( " Image " )
this.heroLv = Util.GetGameObject ( self.transform , " bg/heroInfo/lv/Text " ) : GetComponent ( " Text " )
this.heroIcon = Util.GetGameObject ( self.transform , " bg/heroInfo/icon " ) : GetComponent ( " Image " )
2020-06-28 17:48:49 +08:00
Util.GetGameObject ( self.transform , " bg/heroInfo/pos " ) : SetActive ( false )
--this.heroPosIcon = Util.GetGameObject(self.transform, "bg/heroInfo/pos/icon"):GetComponent("Image")
2020-05-09 13:31:21 +08:00
this.heroProIcon = Util.GetGameObject ( self.transform , " bg/heroInfo/pro/Image " ) : GetComponent ( " Image " )
--this.heroStage = Util.GetGameObject(self.transform, "bg/heroInfo/heroStage"):GetComponent("Image")
Util.GetGameObject ( self.transform , " bg/heroInfo/heroStage " ) : SetActive ( false )
this.heroStarGrid = Util.GetGameObject ( self.transform , " bg/heroInfo/star " )
this.heroStarPre = Util.GetGameObject ( self.transform , " bg/heroInfo/starPre " )
--英雄身上的装备
2020-07-06 20:35:39 +08:00
this.equipGrid = Util.GetGameObject ( self.transform , " bg/equipInfo " )
2020-05-09 13:31:21 +08:00
local scale = ( Screen.width / Screen.height / 1080 * 1920 + 1 ) / 2
if scale < 1 then
for i = 1 , this.equipGrid . transform.childCount do
2020-07-06 20:35:39 +08:00
Util.SetParticleScale ( Util.GetGameObject ( this.equipGrid . transform : GetChild ( i - 1 ) , " effect " ) , scale )
2020-05-09 13:31:21 +08:00
end
end
--装备list
2020-07-06 20:35:39 +08:00
this.effect = Util.GetGameObject ( self.transform , " bg/effect " )
2021-07-21 18:27:03 +08:00
for i = 1 , 6 do
2020-05-09 13:31:21 +08:00
tabs [ i ] = Util.GetGameObject ( self.transform , " Tabs/Btn " .. i )
2023-08-11 19:03:48 +08:00
Util.GetGameObject ( tabs [ i ] , " Text " ) : GetComponent ( " Text " ) . fontSize = 36
2021-07-27 18:34:37 +08:00
redTabs [ i ] = Util.GetGameObject ( tabs [ i ] , " red " )
2020-07-06 20:35:39 +08:00
effectList [ i ] = Util.GetGameObject ( self.transform , " bg/equipInfo/equip " .. i .. " /effect " )
2020-05-09 13:31:21 +08:00
end
this.selectBtn = Util.GetGameObject ( self.gameObject , " selectBtn " )
this.btnPrant = Util.GetGameObject ( self.gameObject , " Tabs " )
2021-08-31 17:02:22 +08:00
this.equipPreList2 = { }
this.equipPreList = { }
2020-05-09 13:31:21 +08:00
this.equipPre = Util.GetGameObject ( self.gameObject , " equipPre " )
this.grid = Util.GetGameObject ( self.gameObject , " scroll/grid " )
2020-07-06 20:35:39 +08:00
this.selsectSkillImage = Util.GetGameObject ( self.gameObject , " selsectSkillImage " )
2020-05-09 13:31:21 +08:00
this.ShaiXuanBtn = Util.GetGameObject ( self.gameObject , " ShaiXuanBtn " )
this.ShaiXuanBtn : SetActive ( false )
this.ShaiXuanBtnLv = Util.GetGameObject ( self.gameObject , " ShaiXuanBtn/Lv " )
2021-04-21 13:12:04 +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-21 13:12:04 +08:00
this.ShaiXuanBtnQu : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( " r_tongyong_pingjieqiehuan_zh " )
2020-05-09 13:31:21 +08:00
this.leftBtn = Util.GetGameObject ( self.transform , " leftBtn/GameObject " )
this.rightBtn = Util.GetGameObject ( self.transform , " rightBtn/GameObject " )
this.allEquipUp = Util.GetGameObject ( self.transform , " allEquipUp " )
this.allEquipDown = Util.GetGameObject ( self.transform , " allEquipDown " )
2020-07-06 20:35:39 +08:00
this.allEquipUpRedPoint = Util.GetGameObject ( self.transform , " allEquipUp/redPoint " )
2020-05-09 13:31:21 +08:00
2020-07-06 20:35:39 +08:00
this.ScrollBar = Util.GetGameObject ( self.gameObject , " Scrollbar " ) : GetComponent ( " Scrollbar " )
2020-05-09 13:31:21 +08:00
local v2 = Util.GetGameObject ( self.gameObject , " scroll " ) : GetComponent ( " RectTransform " ) . rect
2022-01-17 18:22:45 +08:00
this.ScrollView = SubUIManager.Open ( SubUIConfig.ScrollCycleView , Util.GetGameObject ( self.transform , " scroll " ) . transform ,
2023-08-11 19:03:48 +08:00
this.equipPre , this.ScrollBar , Vector2.New ( v2.width , v2.height ) , 1 , 5 , Vector2.New ( 20 , 20 ) )
2020-05-09 13:31:21 +08:00
this.ScrollView . moveTween.MomentumAmount = 1
this.ScrollView . moveTween.Strength = 1
2022-01-17 18:22:45 +08:00
2023-08-11 19:03:48 +08:00
2020-05-09 13:31:21 +08:00
this.force = Util.GetGameObject ( self.transform , " powerBtn/value " ) : GetComponent ( " Text " )
this.itemNumText = Util.GetGameObject ( self.transform , " itemNumText " ) : GetComponent ( " Text " )
2020-07-06 20:35:39 +08:00
this.upLvEffect = Util.GetGameObject ( self.transform , " powerBtn/effect " )
this.equipTreasureBtn = Util.GetGameObject ( self.transform , " equipTreasureBtn " )
2021-04-21 13:12:04 +08:00
this.equipTreasureBtn : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( " b_baowuxitong_gongmin_zh " )
2023-02-18 13:31:36 +08:00
this.handBookBtn = Util.GetGameObject ( self.transform , " handBookBtn " )
2020-07-06 20:35:39 +08:00
this.treasure1 = Util.GetGameObject ( self.transform , " bg/equipInfo/equip5 " )
this.treasure2 = Util.GetGameObject ( self.transform , " bg/equipInfo/equip6 " )
2023-02-19 20:08:48 +08:00
this.faXiang1 = Util.GetGameObject ( self.transform , " bg/equipInfo/equip7 " )
this.faXiang2 = Util.GetGameObject ( self.transform , " bg/equipInfo/equip8 " )
2020-07-06 20:35:39 +08:00
this.treasurePage1 = Util.GetGameObject ( self.transform , " Tabs/Btn5 " )
2023-02-19 20:08:48 +08:00
this.faXiangPage = Util.GetGameObject ( self.transform , " Tabs/Btn6 " )
2020-07-06 20:35:39 +08:00
this.emptyObj = Util.GetGameObject ( self.transform , " emptyObj " )
2020-05-09 13:31:21 +08:00
this.emptyObj . gameObject : SetActive ( false )
2020-12-24 18:57:19 +08:00
this.mask = Util.GetGameObject ( self.gameObject , " mask " )
2020-12-25 09:57:32 +08:00
this.equipBtn5 = Util.GetGameObject ( self.gameObject , " bg/equipInfo/equip5/Image " )
this.equipBtn6 = Util.GetGameObject ( self.gameObject , " bg/equipInfo/equip6/Image " )
2021-07-28 13:49:04 +08:00
this.equipBTn5Add = Util.GetGameObject ( self.gameObject , " bg/equipInfo/equip5/red " )
this.equipBtn6Add = Util.GetGameObject ( self.gameObject , " bg/equipInfo/equip6/red " )
2023-02-20 17:38:59 +08:00
this.equipBTn7Add = Util.GetGameObject ( self.gameObject , " bg/equipInfo/equip7/red " )
this.equipBtn8Add = Util.GetGameObject ( self.gameObject , " bg/equipInfo/equip8/red " )
2023-02-17 19:43:00 +08:00
for i = 1 , 8 do
2021-04-21 13:12:04 +08:00
Util.GetGameObject ( self.gameObject , " bg/equipInfo/equip " .. i .. " /mask " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( EquipPositionIcon [ i ] )
2021-02-23 10:51:52 +08:00
end
2021-08-31 20:22:59 +08:00
this.treeBtn = Util.GetGameObject ( self.gameObject , " treeBtn " )
2021-09-16 17:10:39 +08:00
Util.GetGameObject ( this.treeBtn , " treebtn " ) : GetComponent ( " Image " ) . sprite = this.spLoader : LoadSprite ( " j_jianmushenshu_anniu_01_zh " )
2021-08-31 20:22:59 +08:00
Util.AddClick ( this.treeBtn , function ( )
if ActTimeCtrlManager.SingleFuncState ( FUNCTION_OPEN_TYPE.SACREDTREE ) then
UIManager.OpenPanel ( UIName.SacredTreePanel )
end
end )
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function RoleEquipPanel : BindEvent ( )
2022-01-17 18:22:45 +08:00
Util.AddClick ( this.btnBack , function ( )
PlaySoundWithoutClick ( SoundConfig.Sound_UICancel )
if openThisPanel.RefreshHeroDatas then
openThisPanel : RefreshHeroDatas ( curHeroData , HeroManager.heroSortedDatas )
2020-07-06 20:35:39 +08:00
end
2022-01-17 18:22:45 +08:00
self : ClosePanel ( )
end )
Util.AddClick ( this.leftBtn , function ( )
isPlayAnim = true
this : LeftBtnOnClick ( )
end )
2020-05-09 13:31:21 +08:00
2022-01-17 18:22:45 +08:00
Util.AddClick ( this.rightBtn , function ( )
isPlayAnim = true
this : RightBtnOnClick ( )
end )
Util.AddOnceClick ( this.allEquipUp , function ( )
this : AllEquipUpBtnOnClick ( )
end )
2020-05-09 13:31:21 +08:00
2022-01-17 18:22:45 +08:00
Util.AddOnceClick ( this.allEquipDown , function ( )
if HarmonyManager : IsShowGongMingEqiup ( curHeroData.dynamicId ) and curHeroData.harmonyGongMing then
PopupTipPanel.ShowTip ( Language [ 12222 ] )
else
this : AllEquipDownBtnOnClick ( )
2020-07-06 20:35:39 +08:00
end
2022-01-17 18:22:45 +08:00
end )
2021-07-21 18:27:03 +08:00
for i = 1 , 6 do
2022-01-17 18:22:45 +08:00
Util.AddClick ( tabs [ i ] , function ( )
isPlayAnim = true
if i == indexBtnNum then
2020-07-06 20:35:39 +08:00
return
end
2022-01-17 18:22:45 +08:00
indexBtnNum = i
this : OnClickTabBtn ( indexBtnNum )
end )
end
Util.AddClick ( this.equipTreasureBtn , function ( )
if LengthOfTable ( curEquipTreasureDatas ) < 2 then
PopupTipPanel.ShowTip ( Language [ 11797 ] )
return
2020-05-09 13:31:21 +08:00
end
2022-01-17 18:22:45 +08:00
UIManager.OpenPanel ( UIName.EquipTreasureResonancePanel , curHeroData )
end )
2023-02-18 13:31:36 +08:00
Util.AddClick ( this.handBookBtn , function ( )
UIManager.OpenPanel ( UIName.FaXiangHandBook )
end )
2020-05-09 13:31:21 +08:00
end
--添加事件监听(用于子类重写)
function RoleEquipPanel : AddListener ( )
Game.GlobalEvent : AddEvent ( GameEvent.Treasure . TreasureLvUp , this.CurrEquipDataChange )
end
--移除事件监听(用于子类重写)
function RoleEquipPanel : RemoveListener ( )
Game.GlobalEvent : RemoveEvent ( GameEvent.Treasure . TreasureLvUp , this.CurrEquipDataChange )
end
function this . CurrEquipDataChange ( )
this.ShowHeroEquip ( )
2021-07-21 18:27:03 +08:00
this : OnClickTabBtn ( indexBtnNum )
2021-07-27 18:34:37 +08:00
this.CheckRedTab ( )
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
2020-05-09 13:31:21 +08:00
--界面打开时调用(用于子类重写)
function RoleEquipPanel : OnOpen ( ... )
2020-07-06 20:35:39 +08:00
local data = { ... }
2020-05-09 13:31:21 +08:00
if data [ 1 ] then
2020-07-06 20:35:39 +08:00
curHeroData = data [ 1 ]
HeroManager.roleEquipPanelCurHeroData = data [ 1 ]
2020-05-09 13:31:21 +08:00
else
2020-07-06 20:35:39 +08:00
curHeroData = HeroManager.roleEquipPanelCurHeroData
2020-05-09 13:31:21 +08:00
end
if data [ 2 ] then
2020-07-06 20:35:39 +08:00
heroListData = data [ 2 ]
HeroManager.roleEquipPanelHeroListData = data [ 2 ]
2020-05-09 13:31:21 +08:00
else
2020-07-06 20:35:39 +08:00
heroListData = HeroManager.GetAllHeroDatas ( )
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
openThisPanel = data [ 3 ]
2020-05-09 13:31:21 +08:00
isUpZhen = data [ 4 ]
end
function RoleEquipPanel : OnShow ( )
2021-08-31 20:22:59 +08:00
this.treeBtn : SetActive ( ActTimeCtrlManager.SingleFuncState ( FUNCTION_OPEN_TYPE.SACREDTREE ) )
2022-09-06 10:16:57 +08:00
this.treeBtn : SetActive ( false )
2020-12-24 18:57:19 +08:00
isPlayAnim = true
2020-05-09 13:31:21 +08:00
for i = 1 , # heroListData do
if curHeroData == heroListData [ i ] then
index = i
end
end
for i = 1 , 6 do
2020-07-06 20:35:39 +08:00
if ( effectList [ i ] ~= nil ) then
2020-05-09 13:31:21 +08:00
effectList [ i ] : SetActive ( false )
end
end
2021-07-21 18:27:03 +08:00
indexBtnNum = PosIdConst.WuQi
2020-09-03 16:03:14 +08:00
teamHero = FormationManager.GetAllMainFormationHeroId ( )
2020-05-09 13:31:21 +08:00
this.ShowHeroEquip ( true )
2021-07-21 18:27:03 +08:00
this : OnClickTabBtn ( indexBtnNum )
2021-07-27 18:34:37 +08:00
this.CheckRedTab ( )
2020-07-06 20:35:39 +08:00
this.UpView : OnOpen ( { showType = UpViewOpenType.ShowLeft , panelType = PanelType.Main } )
2023-02-19 20:08:48 +08:00
local list = FaXiangManager.GetOneKeyUpFaXiangByType ( curHeroData )
LogError ( " list len== " .. # list )
2020-05-09 13:31:21 +08:00
end
function this : OnSortingOrderChange ( )
Util.AddParticleSortLayer ( this.effect , this.sortingOrder - orginLayer )
2021-11-04 10:46:25 +08:00
Util.SetParticleSortLayer ( this.heroStarGrid , this.sortingOrder + 1 )
2020-05-09 13:31:21 +08:00
orginLayer = this.sortingOrder
end
--右切换按钮点击
function this : RightBtnOnClick ( )
index = ( index + 1 <= # heroListData and index + 1 or 1 )
curHeroData = heroListData [ index ]
this.ShowHeroEquip ( )
2021-07-21 18:27:03 +08:00
this : OnClickTabBtn ( indexBtnNum )
2021-07-27 18:34:37 +08:00
this.CheckRedTab ( )
2020-05-09 13:31:21 +08:00
end
--左切换按钮点击
function this : LeftBtnOnClick ( )
index = ( index - 1 > 0 and index - 1 or # heroListData )
curHeroData = heroListData [ index ]
this.ShowHeroEquip ( )
2021-07-21 18:27:03 +08:00
this : OnClickTabBtn ( indexBtnNum )
2021-07-27 18:34:37 +08:00
this.CheckRedTab ( )
2020-05-09 13:31:21 +08:00
end
2020-07-07 16:35:57 +08:00
2020-05-09 13:31:21 +08:00
--一键装备
function this : AllEquipUpBtnOnClick ( )
2020-07-06 20:35:39 +08:00
local allEquipIds = { }
local allTreasureIds = { }
2023-02-19 20:08:48 +08:00
local allFaXiang = { }
2020-05-09 13:31:21 +08:00
--计算英雄身上的所有装备位的装备
2020-07-06 20:35:39 +08:00
local curHeroEquipDatas = { }
2020-12-17 10:41:00 +08:00
local curHeroDataequipIdList = curHeroData.equipIdList
for k , v in ipairs ( curHeroDataequipIdList ) do
2020-07-06 20:35:39 +08:00
local equipData = EquipManager.GetSingleHeroSingleEquipData ( v , curHeroData.dynamicId )
if equipData ~= nil then
curHeroEquipDatas [ equipData.equipConfig . Position ] = equipData
else
2021-01-09 14:20:06 +08:00
LogBlue ( " 没有得到equipData " )
2020-05-09 13:31:21 +08:00
end
end
2020-07-06 20:35:39 +08:00
2020-05-09 13:31:21 +08:00
--宝物数据
2020-07-06 20:35:39 +08:00
for k , v in ipairs ( curHeroData.jewels ) do
local equipData = EquipTreasureManager.GetSingleTreasureByIdDyn ( v )
if equipData ~= nil then
curHeroEquipDatas [ equipData.equipType + 4 ] = equipData
2020-05-09 13:31:21 +08:00
end
end
2023-02-19 20:08:48 +08:00
--法相数据
for k , v in ipairs ( curHeroData.faxiang ) do
local equipData = FaXiangManager.GetSingleTreasureByIdDyn ( v )
if equipData ~= nil then
curHeroEquipDatas [ equipData.equipType + 7 ] = equipData
end
end
2020-07-06 20:35:39 +08:00
local equipEffectPos = { }
local treasureEffectPos = { }
2020-05-09 13:31:21 +08:00
for i = 1 , 6 do
2020-07-06 20:35:39 +08:00
local curPosEquip = { }
local index = i
2020-08-25 16:23:41 +08:00
if ( index == 5 or index == 6 ) and isCanUpEquipTreasure then
2023-04-19 13:49:21 +08:00
local pro = curHeroData.changeProId
if curHeroData.changeProId == 5 then
pro = 0
end
curPosEquip = EquipTreasureManager.GetAllTreasuresByLocation ( index - 4 , pro )
2020-05-09 13:31:21 +08:00
else
2020-07-06 20:35:39 +08:00
--获取到所有未装备的装备
curPosEquip = BagManager.GetEquipDataByEquipPosition ( curHeroData.heroConfig . Profession , index )
2020-05-09 13:31:21 +08:00
end
2020-08-26 10:16:16 +08:00
-- LogBlue("i:"..index.." #curPosEquip:".. #curPosEquip)
-- LogBlue("计算每个位置可装备的装备战力")-- 取战力最大的装备
2020-07-06 20:35:39 +08:00
if curPosEquip and # curPosEquip > 0 then
local equiData = { }
local indexMaxPower = 0
if curHeroEquipDatas [ index ] then
equiData = curHeroEquipDatas [ index ]
2020-08-25 16:23:41 +08:00
--获取到宝物战力
if index == 5 or index == 6 then
2020-07-06 20:35:39 +08:00
indexMaxPower = EquipTreasureManager.CalculateWarForce ( curHeroEquipDatas [ index ] . idDyn )
2020-08-26 10:16:16 +08:00
--LogBlue("宝物id: "..curHeroEquipDatas[index].idDyn.." id:"..curHeroEquipDatas[index].id.." indexMaxPower:"..indexMaxPower)
2020-07-06 20:35:39 +08:00
else
2020-08-25 16:23:41 +08:00
--获取到装备战力
2020-07-06 20:35:39 +08:00
indexMaxPower = EquipManager.CalculateWarForce ( curHeroEquipDatas [ index ] . id )
2020-08-26 10:16:16 +08:00
--LogBlue("装备id: "..curHeroEquipDatas[index].id.." indexMaxPower:"..indexMaxPower)
2020-07-06 20:35:39 +08:00
end
end
2020-08-26 10:16:16 +08:00
--LogGreen("循环计算每个装备的战力")
2020-05-09 13:31:21 +08:00
for i = 1 , # curPosEquip do
2020-07-06 20:35:39 +08:00
local addPower = 0
local curEquip = curPosEquip [ i ]
2020-05-09 13:31:21 +08:00
if curEquip then
2020-08-25 16:23:41 +08:00
if index == 5 or index == 6 then
2020-07-06 20:35:39 +08:00
addPower = EquipTreasureManager.CalculateWarForce ( curEquip.idDyn )
2020-08-26 10:16:16 +08:00
--LogGreen("宝物id: "..curEquip.idDyn.." id:"..curEquip.id.." addPower:"..addPower)
2020-05-09 13:31:21 +08:00
else
2020-07-06 20:35:39 +08:00
addPower = EquipManager.CalculateWarForce ( curEquip.id )
2020-08-26 10:16:16 +08:00
--LogGreen("装备id: "..curEquip.id.." addPower:"..addPower)
2020-05-09 13:31:21 +08:00
end
end
2020-08-25 16:23:41 +08:00
if addPower > indexMaxPower then
2020-07-06 20:35:39 +08:00
indexMaxPower = addPower
equiData = curEquip
2020-05-09 13:31:21 +08:00
end
end
2020-08-25 16:23:41 +08:00
if ( index == 5 or index == 6 ) then
if ( ( curHeroEquipDatas [ index ] and equiData.idDyn ~= curHeroEquipDatas [ index ] . idDyn )
or ( not curHeroEquipDatas [ index ] ) ) then
table.insert ( allTreasureIds , equiData.idDyn )
end
2020-05-09 13:31:21 +08:00
else
2020-08-25 16:23:41 +08:00
if ( not curHeroEquipDatas [ index ] or tonumber ( equiData.id ) ~= tonumber ( curHeroEquipDatas [ index ] . id ) ) then
2020-07-06 20:35:39 +08:00
table.insert ( allEquipIds , tostring ( equiData.id ) )
end
2020-05-09 13:31:21 +08:00
end
2020-08-25 16:23:41 +08:00
2020-05-09 13:31:21 +08:00
--特效
if curHeroEquipDatas [ equiData.position ] then
if equiData.idDyn then
if equiData.idDyn ~= curHeroEquipDatas [ equiData.position ] . idDyn then
2020-07-06 20:35:39 +08:00
table.insert ( treasureEffectPos , i )
2020-05-09 13:31:21 +08:00
end
else
2020-07-06 20:35:39 +08:00
if equiData.id ~= curHeroEquipDatas [ equiData.position ] . id then
table.insert ( equipEffectPos , i )
2020-05-09 13:31:21 +08:00
end
end
else
--table.insert(showEffectPos,i)
end
end
end
2021-08-31 20:22:59 +08:00
LogYellow ( " 装备: " .. # allEquipIds )
LogYellow ( " 宝物: " .. # allTreasureIds )
2023-02-19 20:08:48 +08:00
local list = { }
if isCanUpFaXiang then
list = FaXiangManager.GetOneKeyUpFaXiangByType ( curHeroData )
for i = 1 , # curHeroData.faxiang do
local isCon = BattleUtil.ChecklistIsContainValue ( list , curHeroData.faxiang [ i ] )
if isCon then
table.removebyvalue ( list , curHeroData.faxiang [ i ] )
end
end
end
2021-08-31 20:22:59 +08:00
LogYellow ( " isCanUpEquipTreasure: " .. tostring ( isCanUpEquipTreasure ) )
2023-02-19 20:08:48 +08:00
if ( allEquipIds and # allEquipIds > 0 ) or ( isCanUpEquipTreasure and allTreasureIds and # allTreasureIds > 0 ) or ( isCanUpFaXiang and list and # list > 0 ) then
2021-01-08 17:29:54 +08:00
if allEquipIds and # allEquipIds > 0 and not curHeroData.harmonyGongMing then
2020-07-07 16:35:57 +08:00
--穿装备协议
2022-01-17 18:22:45 +08:00
NetManager.EquipWearRequest ( curHeroData.dynamicId , allEquipIds , 1 , function ( )
this.UpdateEquipPosHeroData ( 1 , 4 , allEquipIds )
--特效播放
if equipEffectPos then
for i = 1 , # equipEffectPos do
effectList [ equipEffectPos [ i ] ] : SetActive ( false )
effectList [ equipEffectPos [ i ] ] : SetActive ( true )
2020-06-13 11:47:13 +08:00
end
2020-07-07 16:35:57 +08:00
end
2022-01-17 18:22:45 +08:00
end )
2020-07-07 16:35:57 +08:00
end
2021-01-08 17:29:54 +08:00
if curHeroData.harmonyGongMing then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 12223 ] )
2021-01-08 17:29:54 +08:00
end
2020-07-07 16:35:57 +08:00
--穿戴宝物
2020-08-24 15:08:21 +08:00
if isCanUpEquipTreasure and allTreasureIds and # allTreasureIds > 0 then
2020-07-07 16:35:57 +08:00
--穿装备协议
2022-01-17 18:22:45 +08:00
NetManager.EquipWearRequest ( curHeroData.dynamicId , allTreasureIds , 2 , function ( )
this.UpdateEquipPosHeroData ( 2 , 4 , allTreasureIds )
--特效播放
for i , v in pairs ( treasureEffectPos ) do
effectList [ v ] : SetActive ( false )
effectList [ v ] : SetActive ( true )
2020-07-07 16:35:57 +08:00
end
2022-01-17 18:22:45 +08:00
end )
2020-07-07 16:35:57 +08:00
end
2023-02-19 20:08:48 +08:00
if isCanUpFaXiang and list and # list > 0 then
NetManager.WearFaxiangEquipRequest ( curHeroData.dynamicId , list , 1 , function ( )
this.UpdateEquipPosHeroData ( 3 , 4 , list )
2023-02-20 14:46:37 +08:00
HeroPropManager.SetDirtyByType ( curHeroData.dynamicId , Hero_Prop_Type.FaXiang )
2023-02-19 20:08:48 +08:00
end )
end
2020-07-07 16:35:57 +08:00
else
if not allEquipIds or # allEquipIds < 1 then
2020-12-23 16:46:41 +08:00
if # curHeroData.equipIdList <= 0 then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 11798 ] )
2020-12-23 16:46:41 +08:00
else
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 12137 ] )
2020-12-23 16:46:41 +08:00
end
2020-07-07 16:35:57 +08:00
else
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 11799 ] )
2020-05-15 16:52:35 +08:00
end
2020-05-09 13:31:21 +08:00
end
PlaySoundWithoutClick ( SoundConfig.Sound_Wear )
this.ShowHeroEquip ( )
end
--一键卸下
function this : AllEquipDownBtnOnClick ( )
2023-02-19 20:08:48 +08:00
if ( curHeroData.equipIdList and # curHeroData.equipIdList > 0 ) or ( curHeroData.jewels and # curHeroData.jewels > 0 and isCanUpEquipTreasure ) or ( curHeroData.faxiang and # curHeroData.faxiang > 0 and isCanUpFaXiang ) then
2020-07-06 20:35:39 +08:00
if curHeroData.equipIdList and # curHeroData.equipIdList > 0 then
2022-01-17 18:22:45 +08:00
NetManager.EquipUnLoadOptRequest ( curHeroData.dynamicId , curHeroData.equipIdList , 1 , function ( )
this.UpdateEquipPosHeroData ( 1 , 5 , curHeroData.equipIdList )
end )
2020-07-06 20:35:39 +08:00
end
--寶物
if curHeroData.jewels and # curHeroData.jewels > 0 then
-- 一键卸下音效
2022-01-17 18:22:45 +08:00
NetManager.EquipUnLoadOptRequest ( curHeroData.dynamicId , curHeroData.jewels , 2 , function ( )
this.UpdateEquipPosHeroData ( 2 , 5 , curHeroData.jewels )
end )
2020-07-06 20:35:39 +08:00
end
2023-02-19 20:08:48 +08:00
if curHeroData.faxiang and # curHeroData.faxiang > 0 then
-- 一键卸下音效
NetManager.WearFaxiangEquipRequest ( curHeroData.dynamicId , curHeroData.faxiang , 2 , function ( )
this.UpdateEquipPosHeroData ( 3 , 5 , curHeroData.faxiang )
2023-02-20 14:46:37 +08:00
HeroPropManager.SetDirtyByType ( curHeroData.dynamicId , Hero_Prop_Type.FaXiang )
2023-02-19 20:08:48 +08:00
end )
end
2020-05-09 13:31:21 +08:00
else
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip ( Language [ 11800 ] )
2020-05-09 13:31:21 +08:00
end
PlaySoundWithoutClick ( SoundConfig.Sound_TakeOff )
this.ShowHeroEquip ( )
2021-07-28 16:52:41 +08:00
this.CheckRedTab ( )
2020-05-09 13:31:21 +08:00
end
2020-07-07 16:35:57 +08:00
2020-05-09 13:31:21 +08:00
function this . ShowHeroEquip ( )
--装备
if curHeroData and spcialConfig then
2020-07-06 20:35:39 +08:00
local config = spcialConfig [ 40 ]
2020-05-09 13:31:21 +08:00
if config then
local limits = string.split ( config.Value , " | " )
if limits then
2020-07-06 20:35:39 +08:00
local heroConfig = ConfigManager.GetConfigData ( ConfigName.HeroConfig , curHeroData.id )
local lvs = string.split ( limits [ 1 ] , " # " )
local stars = string.split ( limits [ 2 ] , " # " )
2020-12-17 10:41:00 +08:00
--LogBlue("tonumber(lvs[2]):" ..lvs[2].."PlayerManager.level:"..PlayerManager.level)
2020-07-06 20:35:39 +08:00
if
PlayerManager.level >= tonumber ( lvs [ 2 ] ) and heroConfig ~= nil and
heroConfig.MaxRank >= tonumber ( stars [ 2 ] )
then
2020-06-13 11:47:13 +08:00
isCanUpEquipTreasure = true
2023-10-30 10:30:39 +08:00
--屏蔽宝物共鸣
this.equipTreasureBtn . gameObject : SetActive ( false )
2020-05-09 13:31:21 +08:00
this.treasure1 . gameObject : SetActive ( true )
this.treasure2 . gameObject : SetActive ( true )
this.treasurePage1 . gameObject : SetActive ( true )
else
2020-06-13 11:47:13 +08:00
isCanUpEquipTreasure = false
2020-05-09 13:31:21 +08:00
this.equipTreasureBtn . gameObject : SetActive ( false )
this.treasure1 . gameObject : SetActive ( false )
this.treasure2 . gameObject : SetActive ( false )
this.treasurePage1 . gameObject : SetActive ( false )
2023-02-19 20:08:48 +08:00
2020-05-09 13:31:21 +08:00
end
end
end
2023-02-19 20:08:48 +08:00
isCanUpFaXiang = CheckFunctionOpen ( FUNCTION_OPEN_TYPE.FaXiang )
this.faXiangPage . gameObject : SetActive ( isCanUpFaXiang )
this.faXiang1 : SetActive ( isCanUpFaXiang )
this.faXiang2 : SetActive ( isCanUpFaXiang )
2020-05-09 13:31:21 +08:00
end
2022-01-05 18:17:44 +08:00
SetHeroBg ( this.spLoader , Util.GetGameObject ( this.transform , " bg/heroInfo " ) , Util.GetGameObject ( this.transform , " bg/heroInfo/bg " ) , curHeroData.star , 0 , orginLayer )
2020-05-09 13:31:21 +08:00
this.heroLv . text = curHeroData.lv
2023-09-01 18:27:39 +08:00
this.heroIcon . sprite = this.spLoader : LoadSprite ( GetResourcePath ( curHeroData.heroConfig . ShowLive ) )
2021-11-27 13:17:36 +08:00
--SetHEeroLiveToward(this.heroIcon,curHeroData.heroConfig.Toward)
2022-03-28 18:18:19 +08:00
this.heroProIcon . sprite = this.spLoader : LoadSprite ( GetProStrImageByProNum ( curHeroData.changeProId ) )
2021-10-26 16:00:31 +08:00
local star , starType = curHeroData.GetStar ( 1 )
2021-10-27 12:50:15 +08:00
local starScale = - 10
if starType == 3 then
starScale = - 13.2
end
2023-08-11 19:03:48 +08:00
Util.GetGameObject ( this.transform , " bg/heroInfo/starnum " ) : GetComponent ( " Text " ) . text = curHeroData.star .. " / " .. curHeroData.maxStar
Util.GetGameObject ( this.transform , " bg/heroInfo/name " ) : GetComponent ( " Text " ) . text = GetLanguageStrById ( curHeroData.heroConfig . ReadingName )
Util.GetGameObject ( this.transform , " bg/heroInfo/redAndLock " ) : SetActive ( false )
-- SetHeroStars(this.spLoader, this.heroStarGrid, star,starType,nil,starScale)
-- Util.SetParticleSortLayer(this.heroStarGrid,this.sortingOrder + 1)
2020-05-09 13:31:21 +08:00
--装备的数据
2020-07-06 20:35:39 +08:00
curHeroEquipDatas = { }
2020-05-09 13:31:21 +08:00
for i = 1 , # curHeroData.equipIdList do
2020-07-06 20:35:39 +08:00
local equipData = EquipManager.GetSingleHeroSingleEquipData ( curHeroData.equipIdList [ i ] , curHeroData.dynamicId )
if equipData ~= nil then
curHeroEquipDatas [ equipData.equipConfig . Position ] = equipData
2020-05-09 13:31:21 +08:00
end
end
--宝器的数据
2020-07-06 20:35:39 +08:00
curEquipTreasureDatas = { }
2020-05-09 13:31:21 +08:00
for i = 1 , # curHeroData.jewels do
2020-07-06 20:35:39 +08:00
local treasureData = EquipTreasureManager.GetSingleEquipTreasreData ( curHeroData.jewels [ i ] )
if treasureData ~= nil then
local id = treasureData.id
local pos = jewerConfigs [ id ] . Location + 4
curEquipTreasureDatas [ pos ] = treasureData
2020-05-09 13:31:21 +08:00
end
end
2023-02-17 19:43:00 +08:00
--法相的数据
curFaXiangDatas = { }
for i = 1 , # curHeroData.faxiang do
local treasureData = FaXiangManager.GetSingleEquipTreasreData ( curHeroData.faxiang [ i ] )
if treasureData ~= nil then
local id = treasureData.id
local pos = faXiangConfigs [ id ] . Type + 7
curFaXiangDatas [ pos ] = treasureData
end
end
2021-08-31 17:02:22 +08:00
for k , v in pairs ( this.equipPreList2 ) do
v.gameObject : SetActive ( false )
end
2020-05-09 13:31:21 +08:00
for i = 1 , this.equipGrid . transform.childCount do
2020-07-06 20:35:39 +08:00
local go = this.equipGrid . transform : GetChild ( i - 1 ) . gameObject
2021-08-31 17:02:22 +08:00
this : SingleDataShow ( go , i )
2020-05-09 13:31:21 +08:00
end
2020-08-31 11:03:16 +08:00
local allAddProVal
--计算面板属性
2021-09-27 17:02:43 +08:00
local WarPower = 0
if isUpZhen then
2021-01-29 15:04:07 +08:00
WarPower = HeroPowerManager.GetHeroPower ( curHeroData.dynamicId , FormationTypeDef.FORMATION_NORMAL )
2020-08-31 11:03:16 +08:00
else
2021-01-29 15:04:07 +08:00
WarPower = HeroPowerManager.GetHeroPower ( curHeroData.dynamicId )
2020-08-31 11:03:16 +08:00
end
2021-01-29 15:04:07 +08:00
this.force . text = WarPower
2020-05-09 13:31:21 +08:00
end
2020-07-07 16:35:57 +08:00
2021-08-31 17:02:22 +08:00
function this : SingleDataShow ( go , index )
local effect = Util.GetGameObject ( go.transform , " effect " )
screenAdapte ( effect )
Util.AddParticleSortLayer ( effect , this.sortingOrder - orginLayer1 [ index ] )
orginLayer1 [ index ] = this.sortingOrder
effectList [ index ] = effect
local pos = Util.GetGameObject ( go.transform , " pos " )
if not this.equipPreList2 [ go ] then
this.equipPreList2 [ go ] = SubUIManager.Open ( SubUIConfig.ItemView , pos.transform )
this.equipPreList2 [ go ] . gameObject : SetActive ( false )
end
local mask = Util.GetGameObject ( go.transform , " mask " )
if curHeroEquipDatas [ index ] then
this.equipPreList2 [ go ] . gameObject : SetActive ( true )
mask.gameObject : SetActive ( false )
2022-01-17 18:22:45 +08:00
-- if curHeroEquipDatas[index].homeEquipLv then
-- LogRed("LV:"..tostring(curHeroEquipDatas[index].homeEquipLv[1]).." "..tostring(curHeroEquipDatas[index].homeEquipLv[2]))
-- else
-- LogError("无homeEquipLv")
-- end
2022-06-15 10:31:10 +08:00
this.equipPreList2 [ go ] : OnOpen ( false , { curHeroEquipDatas [ index ] . id , 0 } , 1 , false , false , false , orginLayer , nil , curHeroEquipDatas [ index ] )
2021-08-31 17:02:22 +08:00
if HarmonyManager : IsShowGongMingEqiup ( curHeroData.dynamicId ) and curHeroData.harmonyGongMing then
-- body
Util.GetGameObject ( go.transform , " HongMenging " ) : SetActive ( true )
else
Util.GetGameObject ( go.transform , " HongMenging " ) : SetActive ( false )
end
elseif curEquipTreasureDatas [ index ] then
this.equipPreList2 [ go ] . gameObject : SetActive ( true )
mask.gameObject : SetActive ( false )
2022-06-15 10:31:10 +08:00
this.equipPreList2 [ go ] : OnOpen ( false , { curEquipTreasureDatas [ index ] . id , 0 } , 1 , false , false , false , orginLayer , curEquipTreasureDatas [ index ] . idDyn )
2021-08-31 17:02:22 +08:00
--鸿蒙阵 共享数据判断
2021-09-13 16:17:38 +08:00
if HarmonyManager.IsInfo ( curEquipTreasureDatas [ index ] . upHeroDid ) and curEquipTreasureDatas [ index ] . equipType == 1 then
2021-08-31 17:02:22 +08:00
Util.GetGameObject ( go.transform , " HongMenging " ) : SetActive ( true )
2021-09-13 16:17:38 +08:00
elseif HarmonyManager.IsInfo ( curEquipTreasureDatas [ index ] . upHeroDid ) and curEquipTreasureDatas [ index ] . equipType == 2 then
2021-08-31 17:02:22 +08:00
Util.GetGameObject ( go.transform , " HongMenging " ) : SetActive ( true )
else
Util.GetGameObject ( go.transform , " HongMenging " ) : SetActive ( false )
end
2023-02-17 19:43:00 +08:00
elseif curFaXiangDatas [ index ] then
this.equipPreList2 [ go ] . gameObject : SetActive ( true )
mask.gameObject : SetActive ( false )
this.equipPreList2 [ go ] : OnOpen ( false , { curFaXiangDatas [ index ] . id , 0 } , 1 , false , false , false , orginLayer , curFaXiangDatas [ index ] . idDyn )
2021-08-31 17:02:22 +08:00
else
2023-02-17 19:43:00 +08:00
-- body
2021-08-31 17:02:22 +08:00
this.equipPreList2 [ go ] . gameObject : SetActive ( false )
mask.gameObject : SetActive ( true )
end
local iconBtn = Util.GetGameObject ( go.transform , " btn " )
2022-01-17 18:22:45 +08:00
Util.AddOnceClick ( iconBtn , function ( )
if curHeroEquipDatas [ index ] then
curSelectEquipData = curHeroEquipDatas [ index ]
UIManager.OpenPanel ( UIName.RewardEquipSingleShowPopup2 , this , curHeroEquipDatas [ index ] , 2 , false , nil , curHeroData )
elseif curEquipTreasureDatas [ index ] then
if itemConfig [ curEquipTreasureDatas [ index ] . id ] . ItemType == ItemType.EquipTreasure then
local pos = 0
local jewerConfig =
ConfigManager.TryGetConfigData ( ConfigName.JewelConfig , curEquipTreasureDatas [ index ] . id )
if jewerConfig then
if jewerConfig.Location == 1 then
pos = 5
elseif jewerConfig.Location == 2 then
pos = 6
2021-08-31 17:02:22 +08:00
end
2022-01-17 18:22:45 +08:00
-- UIManager.OpenPanel(UIName.RoleEquipTreasureChangePopup,this,2,curHeroData,curEquipTreasureDatas[index],nil,pos)--以前的,现在不用了
UIManager.OpenPanel ( UIName.RewardTalismanSingleShowPopup2 , this , curEquipTreasureDatas [ index ] , 2 , false , nil , curHeroData , pos )
2021-08-31 17:02:22 +08:00
end
end
2023-02-17 19:43:00 +08:00
elseif curFaXiangDatas [ index ] then
UIManager.OpenPanel ( UIName.RewardTalismanSingleShowPopup2 , this , curFaXiangDatas [ index ] , 2 , false , nil , curHeroData , index )
2021-08-31 17:02:22 +08:00
end
2022-01-17 18:22:45 +08:00
end )
2021-08-31 17:02:22 +08:00
end
2020-05-09 13:31:21 +08:00
function this : SetSelectBtn ( )
2020-12-28 16:25:38 +08:00
this.selectBtn : SetActive ( true )
this.selectBtn . transform : SetParent ( tabs [ indexBtnNum ] . transform )
2023-08-11 19:03:48 +08:00
this.selectBtn : GetComponent ( " RectTransform " ) . anchoredPosition3D = Vector3 ( 0 , 0 , 0 )
2021-07-27 18:34:37 +08:00
this.selectBtn . transform : SetSiblingIndex ( 1 )
2020-12-28 16:25:38 +08:00
--this.selectBtn.transform.localScale = Vector3.one
--this.selectBtn:GetComponent("Image"):SetNativeSize()
2023-08-11 19:03:48 +08:00
Util.GetGameObject ( this.selectBtn . transform , " Text " ) : GetComponent ( " Text " ) . text = GetCurLanguage ( ) == 0 and typeTab [ indexBtnNum ] or " <size=36> " .. typeTab [ indexBtnNum ] .. " </size> " --typeTab[indexBtnNum]
2020-05-09 13:31:21 +08:00
end
2020-12-17 10:41:00 +08:00
function this : OpenTips ( nextEquipData , pos )
2021-04-09 12:26:35 +08:00
local content = Language [ 12224 ]
2020-12-17 10:41:00 +08:00
MsgPanel.ShowTwo ( content , function ( )
end , function ( )
local equipIdList = { }
local equipDataList = { }
table.insert ( equipIdList , tostring ( nextEquipData.id ) )
table.insert ( equipDataList , nextEquipData )
NetManager.EquipWearRequest ( curHeroData.dynamicId , equipIdList , 1 , function ( )
this.UpdateEquipPosHeroData ( 1 , 3 , equipDataList , nextEquipData , pos )
end )
2021-04-09 12:26:35 +08:00
end , Language [ 10731 ] , Language [ 11934 ] )
2021-04-09 20:31:45 +08:00
end
2020-07-06 20:35:39 +08:00
2020-05-09 13:31:21 +08:00
--点击装备按钮
function this : OnClickTabBtn ( _index )
this : SetSelectBtn ( )
if _index < 5 then
2020-07-06 20:35:39 +08:00
local allEquip = BagManager.GetEquipDataByEquipPosition ( curHeroData.heroConfig . Profession , _index )
2020-05-09 13:31:21 +08:00
this : SortEquipDatas ( allEquip )
2020-07-09 10:53:15 +08:00
local count = 0
for i = 1 , # allEquip do
2021-02-19 15:13:38 +08:00
count = count + 1 --allEquip[i].num
2020-07-09 10:53:15 +08:00
end
2021-02-20 16:55:28 +08:00
--"装备数量:"
2021-04-09 12:26:35 +08:00
this.itemNumText . text = Language [ 12181 ] .. count
2020-05-09 13:31:21 +08:00
this : SetItemData ( allEquip )
2023-02-17 19:43:00 +08:00
elseif _index == 5 then
-- body
2020-05-09 13:31:21 +08:00
local allEquipTreasure
2023-04-19 13:49:21 +08:00
local pro = curHeroData.changeProId
if pro == 5 then
pro = 0
end
allEquipTreasure = EquipTreasureManager.GetAllTreasures ( pro )
2021-07-27 18:34:37 +08:00
this : SortEquipDatas1 ( allEquipTreasure )
2021-02-20 16:55:28 +08:00
--"装备数量:"
2021-04-09 12:26:35 +08:00
this.itemNumText . text = Language [ 12181 ] .. LengthOfTable ( allEquipTreasure )
2023-02-17 19:43:00 +08:00
this : SetItemData ( allEquipTreasure )
elseif _index == 6 then
local allEquipTreasure
2023-02-20 16:20:17 +08:00
allEquipTreasure = FaXiangManager.GetAllTreasuresCanUp ( curHeroData )
2023-02-17 19:43:00 +08:00
this : SortEquipDatas1 ( allEquipTreasure )
--"装备数量:"
this.itemNumText . text = Language [ 12181 ] .. LengthOfTable ( allEquipTreasure )
this : SetItemData ( allEquipTreasure )
2020-05-09 13:31:21 +08:00
end
2021-07-27 18:34:37 +08:00
this.CheckRedTab ( )
2020-05-09 13:31:21 +08:00
end
2020-07-07 16:35:57 +08:00
2020-05-09 13:31:21 +08:00
--设置背包列表数据
local curHeroCanUpEquipTabs = { }
2021-07-27 18:34:37 +08:00
local curHeroCanUpEquipTreasuresTabs = { }
2020-07-09 10:53:15 +08:00
function this : SetItemData ( _itemDatas )
2020-07-06 20:35:39 +08:00
if LengthOfTable ( _itemDatas ) == 0 then
2020-05-09 13:31:21 +08:00
this.emptyObj . gameObject : SetActive ( true )
else
this.emptyObj . gameObject : SetActive ( false )
end
2021-08-31 17:02:22 +08:00
for k , v in pairs ( this.equipPreList ) do
v.gameObject : SetActive ( false )
end
2020-07-06 20:35:39 +08:00
this.ScrollView : SetData (
_itemDatas ,
function ( index , go )
this.SingleItemDataShow ( go , _itemDatas [ index ] )
end
)
2022-01-17 18:22:45 +08:00
if isPlayAnim then
2020-12-24 18:57:19 +08:00
if isFristOpenTime then
isFristOpenTime : Stop ( )
isFristOpenTime = nil
end
isFristOpenTime = Timer.New ( function ( )
this.mask : SetActive ( false )
2022-01-17 18:22:45 +08:00
end , 0.3 ) : Start ( )
this.mask : SetActive ( true )
2020-12-24 18:57:19 +08:00
SecTorPlayAnimByScroll ( this.ScrollView )
isPlayAnim = false
2022-01-17 18:22:45 +08:00
end
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
function this . SingleItemDataShow ( _go , _itemData )
if not itemConfig [ _itemData.id ] then
return
end
2021-08-31 17:02:22 +08:00
if not this.equipPreList [ _go ] then
this.equipPreList [ _go ] = SubUIManager.Open ( SubUIConfig.ItemView , _go.transform )
2020-05-09 13:31:21 +08:00
end
2021-08-31 17:02:22 +08:00
local redPoint = Util.GetGameObject ( _go.transform , " redPoint " )
this.equipPreList [ _go ] . gameObject : SetActive ( true )
this.equipPreList [ _go ] . transform : SetAsFirstSibling ( )
2020-05-09 13:31:21 +08:00
if itemConfig [ _itemData.id ] . ItemType == ItemType.EquipTreasure then
2022-06-15 10:31:10 +08:00
this.equipPreList [ _go ] : OnOpen ( false , { _itemData.id , 0 } , 1.1 , true , false , false , orginLayer , _itemData.idDyn )
2021-07-27 18:34:37 +08:00
if curHeroCanUpEquipTreasuresTabs and # curHeroCanUpEquipTreasuresTabs > 0 then
local isShow = false
for i = 1 , # curHeroCanUpEquipTreasuresTabs do
if curHeroCanUpEquipTreasuresTabs [ i ] == _itemData.idDyn then
isShow = true
end
end
if isShow then
redPoint : SetActive ( true )
else
redPoint : SetActive ( false )
end
2020-05-09 13:31:21 +08:00
else
2021-07-27 18:34:37 +08:00
redPoint : SetActive ( false )
2020-05-09 13:31:21 +08:00
end
-- 0.查看属性 1.穿戴 2.卸下 3.交换
2020-07-06 20:35:39 +08:00
--宝物界面
2021-08-31 17:02:22 +08:00
Util.AddOnceClick ( Util.GetGameObject ( _go.transform , " mask " ) , function ( )
if curEquipTreasureDatas [ jewerConfigs [ _itemData.id ] . Location + 4 ] then
2021-11-09 17:06:47 +08:00
-- UIManager.OpenPanel(UIName.RoleEquipTreasureChangePopup,this,3,curHeroData,curEquipTreasureDatas[jewerConfigs[_itemData.id].Location + 4],_itemData,jewerConfigs[_itemData.id].Location + 4)
UIManager.OpenPanel ( UIName.RewardTalismanSingleShowPopup2 , this , _itemData , 4 , false , nil , curHeroData , jewerConfigs [ _itemData.id ] . Location + 4 , curEquipTreasureDatas [ jewerConfigs [ _itemData.id ] . Location + 4 ] )
2020-07-06 20:35:39 +08:00
else
2021-11-09 17:06:47 +08:00
-- UIManager.OpenPanel(UIName.RoleEquipTreasureChangePopup, this, 1, curHeroData, _itemData, nil, jewerConfigs[_itemData.id].Location + 4)
UIManager.OpenPanel ( UIName.RewardTalismanSingleShowPopup2 , this , _itemData , 3 , false , nil , curHeroData , jewerConfigs [ _itemData.id ] . Location + 4 )
2020-07-06 20:35:39 +08:00
end
end
)
2023-02-17 19:43:00 +08:00
elseif itemConfig [ _itemData.id ] . ItemType == ItemType.FaXiang then
this.equipPreList [ _go ] : OnOpen ( false , { _itemData.id , 0 } , 1.1 , true , false , false , orginLayer , _itemData.idDyn )
if curHeroCanUpEquipTreasuresTabs and # curHeroCanUpEquipTreasuresTabs > 0 then
local isShow = false
for i = 1 , # curHeroCanUpEquipTreasuresTabs do
if curHeroCanUpEquipTreasuresTabs [ i ] == _itemData.idDyn then
isShow = true
end
end
if isShow then
redPoint : SetActive ( true )
else
redPoint : SetActive ( false )
end
else
redPoint : SetActive ( false )
end
-- 0.查看属性 1.穿戴 2.卸下 3.交换
--宝物界面
Util.AddOnceClick ( Util.GetGameObject ( _go.transform , " mask " ) , function ( )
local pos = faXiangConfigs [ _itemData.id ] . Type + 7
if curFaXiangDatas [ pos ] then
UIManager.OpenPanel ( UIName.RewardTalismanSingleShowPopup2 , this , _itemData , 4 , false , nil , curHeroData , pos , curFaXiangDatas [ pos ] )
else
UIManager.OpenPanel ( UIName.RewardTalismanSingleShowPopup2 , this , _itemData , 3 , false , nil , curHeroData , pos )
end
end
)
2020-05-09 13:31:21 +08:00
else
2023-02-17 19:43:00 +08:00
-- body
2022-06-15 10:31:10 +08:00
this.equipPreList [ _go ] : OnOpen ( false , { _itemData.id , _itemData.num } , 1 , true , false , false , orginLayer )
2020-05-09 13:31:21 +08:00
if curHeroCanUpEquipTabs and # curHeroCanUpEquipTabs > 0 then
local isShow = false
for i = 1 , # curHeroCanUpEquipTabs do
2020-07-06 20:35:39 +08:00
if curHeroCanUpEquipTabs [ i ] == _itemData.id then
2020-05-09 13:31:21 +08:00
isShow = true
end
end
if isShow then
redPoint : SetActive ( true )
else
redPoint : SetActive ( false )
end
else
redPoint : SetActive ( false )
end
2021-08-31 17:02:22 +08:00
Util.AddOnceClick ( Util.GetGameObject ( _go.transform , " mask " ) , function ( )
2020-07-06 20:35:39 +08:00
if curHeroEquipDatas [ equipConfig [ _itemData.id ] . Position ] then
2021-11-09 18:24:38 +08:00
local nextEquipData = curHeroEquipDatas [ equipConfig [ _itemData.id ] . Position ]
2020-12-17 10:41:00 +08:00
if curHeroData.harmonyGongMing then
this : OpenTips ( nextEquipData , equipConfig [ _itemData.id ] . Position )
else
2021-11-17 12:34:39 +08:00
-- Log("当前装备:"..tostring(nextEquipData.id).." 准备替换装备:"..tostring(_itemData.id))
2021-11-09 10:22:16 +08:00
UIManager.OpenPanel ( UIName.RewardEquipSingleShowPopup2 , this , _itemData , 4 , false , nil , curHeroData , equipConfig [ _itemData.id ] . Position , nextEquipData )
2021-04-09 20:31:45 +08:00
end
2020-07-06 20:35:39 +08:00
else
2021-11-09 10:22:16 +08:00
UIManager.OpenPanel ( UIName.RewardEquipSingleShowPopup2 , this , _itemData , 3 , false , nil , curHeroData , equipConfig [ _itemData.id ] . Position )
2020-07-06 20:35:39 +08:00
end
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
)
2020-05-09 13:31:21 +08:00
end
end
--刷新当前英雄装备坑位的信息
2020-07-06 20:35:39 +08:00
function this . UpdateEquipPosHeroData ( _equipOrTreasure , _type , _selectEquipDataList , _oldSelectEquip , position ) --type
2021-11-17 12:34:39 +08:00
-- if _selectEquipDataList then
-- LogYellow("_type: "..tostring(_type).." 新装备:"..tostring(_selectEquipDataList[1].id))
-- end
-- if _oldSelectEquip then
-- LogYellow("旧装备:"..tostring(_oldSelectEquip.id))
-- end
2020-05-09 13:31:21 +08:00
--1 穿单件装备 2 卸单件装备 3 替换单件装备 4 一键穿装备 5一键脱装备
2020-07-06 20:35:39 +08:00
if _type == 1 then
2020-05-09 13:31:21 +08:00
effectList [ position ] : SetActive ( false )
effectList [ position ] : SetActive ( true )
2023-02-17 19:43:00 +08:00
if _equipOrTreasure == 1 then --装备
2020-07-06 20:35:39 +08:00
curSelectEquipData = _selectEquipDataList [ 1 ]
2020-05-09 13:31:21 +08:00
--装备绑英雄
2020-07-06 20:35:39 +08:00
EquipManager.SetEquipUpHeroDid ( curSelectEquipData.id , curHeroData.dynamicId )
2020-05-09 13:31:21 +08:00
--英雄加装备
2020-07-06 20:35:39 +08:00
table.insert ( curHeroData.equipIdList , curSelectEquipData.id )
HeroManager.SetHeroEquipIdList ( curHeroData.dynamicId , curHeroData.equipIdList )
2023-02-17 19:43:00 +08:00
elseif _equipOrTreasure == 2 then --宝物
-- body
2020-07-06 20:35:39 +08:00
curEquipTreasureDatas = _selectEquipDataList [ 1 ]
2020-05-09 13:31:21 +08:00
--装备绑英雄
2020-07-06 20:35:39 +08:00
EquipTreasureManager.SetEquipTreasureUpHeroDid ( curEquipTreasureDatas.idDyn , curHeroData.dynamicId )
2020-05-09 13:31:21 +08:00
--英雄加装备
2020-07-06 20:35:39 +08:00
table.insert ( curHeroData.jewels , curEquipTreasureDatas.idDyn )
2023-02-17 19:43:00 +08:00
elseif _equipOrTreasure == 3 then --法相
curEquipTreasureDatas = _selectEquipDataList [ 1 ]
--装备绑英雄
FaXiangManager.SetEquipTreasureUpHeroDid ( curEquipTreasureDatas.idDyn , curHeroData.dynamicId )
--英雄加装备
table.insert ( curHeroData.faxiang , curEquipTreasureDatas.idDyn )
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
elseif _type == 2 then
2020-05-09 13:31:21 +08:00
if _equipOrTreasure == 1 then
2020-12-17 10:41:00 +08:00
if not curHeroData.harmonyGongMing then
--装备解绑英雄
curSelectEquipData = _selectEquipDataList [ 1 ]
EquipManager.DeleteSingleEquip ( curSelectEquipData.id , curHeroData.dynamicId )
for i = 1 , # curHeroData.equipIdList do
if tonumber ( curHeroData.equipIdList [ i ] ) == tonumber ( curSelectEquipData.id ) then
--英雄删除装备
table.remove ( curHeroData.equipIdList , i )
break
end
end
local a = curHeroData.equipIdList
if not curHeroData.harmonyGongMing then
HeroManager.SetHeroEquipIdList ( curHeroData.dynamicId , curHeroData.equipIdList )
else
HeroManager.SetHeroEquipIdList ( curHeroData.dynamicId , { } )
2020-05-09 13:31:21 +08:00
end
end
2023-02-17 19:43:00 +08:00
elseif _equipOrTreasure == 2 then
-- body
2020-05-09 13:31:21 +08:00
curEquipTreasureDatas = _selectEquipDataList [ 1 ]
2020-07-06 20:35:39 +08:00
EquipTreasureManager.SetEquipTreasureUpHeroDid ( curEquipTreasureDatas.idDyn , " " )
2020-05-09 13:31:21 +08:00
for i = 1 , # curHeroData.jewels do
2020-07-06 20:35:39 +08:00
if curHeroData.jewels [ i ] == curEquipTreasureDatas.idDyn then
2020-05-09 13:31:21 +08:00
--英雄删除装备
2020-07-06 20:35:39 +08:00
table.remove ( curHeroData.jewels , i )
2020-05-09 13:31:21 +08:00
break
end
end
2023-02-17 19:43:00 +08:00
elseif _equipOrTreasure == 3 then
curEquipTreasureDatas = _selectEquipDataList [ 1 ]
FaXiangManager.SetEquipTreasureUpHeroDid ( curEquipTreasureDatas.idDyn , " " )
for i = 1 , # curHeroData.faxiang do
if curHeroData.faxiang [ i ] == curEquipTreasureDatas.idDyn then
--英雄删除装备
table.remove ( curHeroData.faxiang , i )
break
end
end
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
elseif _type == 3 then
2020-05-09 13:31:21 +08:00
effectList [ position ] : SetActive ( false )
effectList [ position ] : SetActive ( true )
if _equipOrTreasure == 1 then
2020-12-17 10:41:00 +08:00
local a = curHeroData.equipIdList
if not curHeroData.harmonyGongMing then
curSelectEquipData = _selectEquipDataList [ 1 ]
EquipManager.SetEquipUpHeroDid ( curSelectEquipData.id , curHeroData.dynamicId )
--穿
if _oldSelectEquip and tonumber ( _oldSelectEquip.id ) ~= tonumber ( curSelectEquipData.id ) then
EquipManager.DeleteSingleEquip ( _oldSelectEquip.id , curHeroData.dynamicId )
end
2020-07-06 20:35:39 +08:00
2020-12-17 10:41:00 +08:00
--英雄替换新选择装备
2021-11-17 12:34:39 +08:00
if curHeroEquipDatas [ equipConfig [ curSelectEquipData.id ] . Position ] then
2020-12-17 10:41:00 +08:00
for i = 1 , # curHeroData.equipIdList do
if
tonumber ( curHeroData.equipIdList [ i ] ) ==
2021-11-17 12:34:39 +08:00
tonumber ( curHeroEquipDatas [ equipConfig [ curSelectEquipData.id ] . Position ] . id )
2020-12-17 10:41:00 +08:00
then
curHeroData.equipIdList [ i ] = curSelectEquipData.id
break
end
2020-05-09 13:31:21 +08:00
end
end
2020-12-17 10:41:00 +08:00
HeroManager.SetHeroEquipIdList ( curHeroData.dynamicId , curHeroData.equipIdList )
else
curSelectEquipData = _selectEquipDataList [ 1 ]
HeroManager.SetHeroEquipIdList ( curHeroData.dynamicId , { curSelectEquipData.id } )
EquipManager.SetEquipUpHeroDid ( curSelectEquipData.id , curHeroData.dynamicId )
2020-05-09 13:31:21 +08:00
end
2023-02-17 19:43:00 +08:00
elseif _equipOrTreasure == 2 then
-- body
2020-07-06 20:35:39 +08:00
curEquipTreasureDatas = _selectEquipDataList [ 1 ]
2020-05-09 13:31:21 +08:00
--新装备绑英雄
2020-07-06 20:35:39 +08:00
EquipTreasureManager.SetEquipTreasureUpHeroDid ( curEquipTreasureDatas.idDyn , curHeroData.dynamicId )
2020-05-09 13:31:21 +08:00
if _oldSelectEquip then
--被替换装备解绑英雄
2020-07-06 20:35:39 +08:00
EquipTreasureManager.SetEquipTreasureUpHeroDid ( _oldSelectEquip.idDyn , " " )
2020-05-09 13:31:21 +08:00
end
--英雄替换新选择装备
2020-07-06 20:35:39 +08:00
for i = 1 , # curHeroData.jewels do
if curHeroData.jewels [ i ] == _oldSelectEquip.idDyn then
curHeroData.jewels [ i ] = curEquipTreasureDatas.idDyn
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
end
2023-02-17 19:43:00 +08:00
elseif _equipOrTreasure == 3 then
curFaXiangDatas = _selectEquipDataList [ 1 ]
--新装备绑英雄
FaXiangManager.SetEquipTreasureUpHeroDid ( curFaXiangDatas.idDyn , curHeroData.dynamicId )
if _oldSelectEquip then
--被替换装备解绑英雄
FaXiangManager.SetEquipTreasureUpHeroDid ( _oldSelectEquip.idDyn , " " )
end
--英雄替换新选择装备
for i = 1 , # curHeroData.faxiang do
if curHeroData.faxiang [ i ] == _oldSelectEquip.idDyn then
curHeroData.faxiang [ i ] = curFaXiangDatas.idDyn
end
end
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
elseif _type == 4 then
2020-05-09 13:31:21 +08:00
--一键穿 把身上装备解绑英雄id
2020-07-06 20:35:39 +08:00
if _equipOrTreasure == 1 then
2020-12-17 10:41:00 +08:00
if not curHeroData.harmonyGongMing then
local isadd
for n , m in ipairs ( _selectEquipDataList ) do
isadd = true
for i = 1 , # curHeroData.equipIdList do
if equipConfig [ tonumber ( curHeroData.equipIdList [ i ] ) ] . Position == equipConfig [ tonumber ( m ) ] . Position then
EquipManager.DeleteSingleEquip ( curHeroData.equipIdList [ i ] , curHeroData.dynamicId )
curHeroData.equipIdList [ i ] = m
HeroManager.GetHeroEquipIdList1 ( curHeroData.dynamicId , m )
isadd = false
break
end
end
if isadd then
table.insert ( curHeroData.equipIdList , m )
2020-07-06 20:35:39 +08:00
end
end
2020-12-17 10:41:00 +08:00
EquipManager.UpdateEquipData ( _selectEquipDataList , curHeroData.dynamicId )
else
local curEquilist = { }
for n , m in ipairs ( _selectEquipDataList ) do
table.insert ( curEquilist , m )
2020-07-06 20:35:39 +08:00
end
2020-12-17 10:41:00 +08:00
curHeroData.equipIdList = curEquilist
HeroManager.SetHeroEquipIdList ( curHeroData.dynamicId , curHeroData.equipIdList )
EquipManager.UpdateEquipData ( _selectEquipDataList , curHeroData.dynamicId )
2020-07-06 20:35:39 +08:00
end
2023-02-19 20:08:48 +08:00
elseif _equipOrTreasure == 2 then
-- body
2020-08-26 10:16:16 +08:00
local isadd
2020-05-09 13:31:21 +08:00
for i = 1 , # _selectEquipDataList do
2020-08-26 10:16:16 +08:00
isadd = true
for j = 1 , # curHeroData.jewels do
2020-08-25 18:17:15 +08:00
--如果英雄身上有和选中的宝物的位置相同的,就替换
2020-08-26 10:16:16 +08:00
if EquipTreasureManager.GetSingleTreasureByIdDyn ( curHeroData.jewels [ j ] ) . equipType ==
2020-08-25 18:17:15 +08:00
EquipTreasureManager.GetSingleTreasureByIdDyn ( _selectEquipDataList [ i ] ) . equipType then
2020-08-26 10:16:16 +08:00
EquipTreasureManager.SetTreasureUpOrDown ( curHeroData.jewels [ j ] , " 0 " )
2020-08-25 18:17:15 +08:00
EquipTreasureManager.SetTreasureUpOrDown ( _selectEquipDataList [ i ] , curHeroData.dynamicId )
2020-08-26 10:18:46 +08:00
curHeroData.jewels [ j ] = _selectEquipDataList [ i ]
2020-08-25 18:17:15 +08:00
isadd = false
break
end
end
if isadd then
EquipTreasureManager.SetTreasureUpOrDown ( _selectEquipDataList [ i ] , curHeroData.dynamicId )
table.insert ( curHeroData.jewels , _selectEquipDataList [ i ] )
2020-08-26 10:16:16 +08:00
end
2020-05-09 13:31:21 +08:00
end
2023-02-19 20:08:48 +08:00
elseif _equipOrTreasure == 3 then
local isadd
for i = 1 , # _selectEquipDataList do
isadd = true
for j = 1 , # curHeroData.faxiang do
--如果英雄身上有和选中的宝物的位置相同的,就替换
if FaXiangManager.GetSingleTreasureByIdDyn ( curHeroData.faxiang [ j ] ) . equipType ==
FaXiangManager.GetSingleTreasureByIdDyn ( _selectEquipDataList [ i ] ) . equipType then
FaXiangManager.SetTreasureUpOrDown ( curHeroData.faxiang [ j ] , " 0 " )
2023-02-20 14:25:44 +08:00
FaXiangManager.SetTreasureUpOrDown ( _selectEquipDataList [ i ] , curHeroData.dynamicId )
curHeroData.faxiang [ j ] = _selectEquipDataList [ i ]
2023-02-19 20:08:48 +08:00
isadd = false
break
end
end
if isadd then
FaXiangManager.SetTreasureUpOrDown ( _selectEquipDataList [ i ] , curHeroData.dynamicId )
table.insert ( curHeroData.faxiang , _selectEquipDataList [ i ] )
end
end
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
elseif _type == 5 then
2020-05-09 13:31:21 +08:00
--一键脱 把身上装备英雄id置为“0” 再把英雄装备list清空
2020-07-06 20:35:39 +08:00
if _equipOrTreasure == 1 then
2020-05-09 13:31:21 +08:00
if _selectEquipDataList then
for i = 1 , # _selectEquipDataList do
2020-07-06 20:35:39 +08:00
EquipManager.DeleteSingleEquip ( _selectEquipDataList [ i ] , curHeroData.dynamicId )
2020-05-09 13:31:21 +08:00
end
end
2020-07-06 20:35:39 +08:00
curHeroData.equipIdList = { }
HeroManager.SetHeroEquipIdList ( curHeroData.dynamicId , { } )
curHeroData.equipIdList = { }
2023-02-19 20:08:48 +08:00
elseif _equipOrTreasure == 2 then
-- body
2020-05-09 13:31:21 +08:00
if _selectEquipDataList then
for i = 1 , # _selectEquipDataList do
2020-07-06 20:35:39 +08:00
EquipTreasureManager.SetTreasureUpOrDown ( _selectEquipDataList [ i ] , " " )
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
curHeroData.jewels = { }
2020-05-09 13:31:21 +08:00
end
2023-02-19 20:08:48 +08:00
elseif _equipOrTreasure == 3 then
if _selectEquipDataList then
for i = 1 , # _selectEquipDataList do
FaXiangManager.SetTreasureUpOrDown ( _selectEquipDataList [ i ] , " " )
end
curHeroData.faxiang = { }
end
2020-05-09 13:31:21 +08:00
end
end
--刷新界面
this.ShowHeroEquip ( )
--上阵刷新红点
2021-07-29 14:33:52 +08:00
this.allEquipUpRedPoint : SetActive ( isUpZhen and
2021-09-13 16:17:38 +08:00
--((#HeroManager.GetHeroIsUpEquip(curHeroData.dynamicId) > 0 and not (HarmonyManager.IsInfo(curHeroData.dynamicId) and HarmonyManager.GetSingleAdditions(HarmonyAddType.AddEquip) ~= -1)) or
( ( # HeroManager.GetHeroIsUpEquip ( curHeroData.dynamicId ) > 0 and not ( HarmonyManager.IsInfo ( curHeroData.dynamicId ) ) ) or
2021-07-29 14:33:52 +08:00
( isCanUpEquipTreasure and # HeroManager.GetHeroIsUpTreasure ( curHeroData.dynamicId , 0 ) > 0 )
) )
2021-07-21 18:27:03 +08:00
this : OnClickTabBtn ( indexBtnNum )
-- --刷新当前英雄可穿装备
-- if indexBtnNum == PosIdConst.All then
-- this:OnClickAllBtn()
-- else
-- this:OnClickTabBtn(indexBtnNum)
-- end
2020-05-09 13:31:21 +08:00
--对比战力并更新战力值 播放战力变更动画
HeroManager.CompareWarPower ( curHeroData.dynamicId )
2021-07-27 18:34:37 +08:00
this.CheckRedTab ( )
end
function this . CheckRedTab ( )
for i = 1 , # redTabs do
if i < 5 then
2021-07-28 16:52:41 +08:00
local allEquip = BagManager.GetEquipDataByEquipPosition ( curHeroData.heroConfig . Profession , i )
this : SortEquipDatas ( allEquip )
2021-07-27 18:34:37 +08:00
local showRed = false
if curHeroCanUpEquipTabs and # curHeroCanUpEquipTabs > 0 then
for j = 1 , # curHeroCanUpEquipTabs do
if equipConfig [ curHeroCanUpEquipTabs [ j ] ] . Position == i then
showRed = true
break
end
end
else
showRed = false
end
redTabs [ i ] . gameObject : SetActive ( showRed )
2023-02-20 17:38:59 +08:00
elseif i == 5 then
-- body
local isRed
for j = 1 , 2 do
2023-02-20 22:24:28 +08:00
local canEquips = HeroManager.GetHeroIsUpTreasure ( curHeroData.dynamicId , j )
2023-02-20 17:38:59 +08:00
if canEquips and # canEquips > 0 then
isRed = true
end
end
redTabs [ i ] . gameObject : SetActive ( isCanUpEquipTreasure and isUpZhen and isRed )
elseif i == 6 then
2023-02-20 22:24:28 +08:00
redTabs [ i ] . gameObject : SetActive ( FaXiangManager.CheckIsCanUpFaXiang ( curHeroData ) )
--redTabs[i].gameObject:SetActive(false)
2021-07-27 18:34:37 +08:00
end
end
2021-07-28 13:49:04 +08:00
this.equipBTn5Add . gameObject : SetActive ( curEquipTreasureDatas [ 5 ] and curEquipTreasureDatas [ 5 ] . idDyn and HeroManager.CheckIsUpTreasure ( curEquipTreasureDatas [ 5 ] . idDyn , 0 ) )
this.equipBtn6Add . gameObject : SetActive ( curEquipTreasureDatas [ 6 ] and curEquipTreasureDatas [ 6 ] . idDyn and HeroManager.CheckIsUpTreasure ( curEquipTreasureDatas [ 6 ] . idDyn , 0 ) )
2023-02-20 17:38:59 +08:00
this.equipBTn7Add . gameObject : SetActive ( curFaXiangDatas [ 7 ] and curFaXiangDatas [ 7 ] . idDyn and FaXiangManager.CheckIsShowRed ( curFaXiangDatas [ 7 ] . idDyn , 0 ) )
this.equipBtn8Add . gameObject : SetActive ( curFaXiangDatas [ 8 ] and curFaXiangDatas [ 8 ] . idDyn and FaXiangManager.CheckIsShowRed ( curFaXiangDatas [ 8 ] . idDyn , 0 ) )
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
2020-05-09 13:31:21 +08:00
--选择图片设置父级
function this . SelectImageSetParent ( _objPoint )
this.selsectSkillImage : SetActive ( false )
this.selsectSkillImage . transform : SetParent ( _objPoint.transform )
this.selsectSkillImage . transform.localScale = Vector3.one
this.selsectSkillImage . transform.localPosition = Vector3.zero
end
--界面关闭时调用(用于子类重写)
function RoleEquipPanel : OnClose ( )
2020-12-24 18:57:19 +08:00
if isFristOpenTime then
isFristOpenTime : Stop ( )
isFristOpenTime = nil
end
2020-05-09 13:31:21 +08:00
end
function this : AddRedPointVale ( _equipDatas )
for j = 1 , # _equipDatas do
_equipDatas [ j ] . isRedPointShow = 1
for i = 1 , # curHeroCanUpEquipTabs do
2020-07-06 20:35:39 +08:00
if curHeroCanUpEquipTabs [ i ] == _equipDatas [ j ] . id then
2020-05-09 13:31:21 +08:00
_equipDatas [ j ] . isRedPointShow = 2
end
end
end
end
2021-07-27 18:34:37 +08:00
function this : SortEquipDatas1 ( _equipDatas )
if teamHero [ curHeroData.dynamicId ] then
curHeroCanUpEquipTreasuresTabs = HeroManager.GetHeroIsUpTreasure ( curHeroData.dynamicId , 0 )
else
curHeroCanUpEquipTreasuresTabs = { }
end
for j = 1 , # _equipDatas do
_equipDatas [ j ] . isRedPointShow = 1
2021-09-01 12:47:30 +08:00
for i = 1 , # curHeroCanUpEquipTreasuresTabs do
if curHeroCanUpEquipTreasuresTabs [ i ] == _equipDatas [ j ] . idDyn then
2021-07-27 18:34:37 +08:00
_equipDatas [ j ] . isRedPointShow = 2
end
end
end
table.sort ( _equipDatas , function ( a , b )
if a.isRedPointShow == b.isRedPointShow then
if a.refineLv == b.refineLv then
if a.lv == b.lv then
return a.id > b.id
else
return a.lv > b.lv
end
else
return a.refineLv > b.refineLv
end
else
return a.isRedPointShow > b.isRedPointShow
end
end
)
end
2020-05-09 13:31:21 +08:00
function this : SortEquipDatas ( _equipDatas )
if teamHero [ curHeroData.dynamicId ] then
isUpZhen = true
2021-07-29 14:33:52 +08:00
--上阵刷新红点
this.allEquipUpRedPoint : SetActive ( isUpZhen and
( ( # HeroManager.GetHeroIsUpEquip ( curHeroData.dynamicId ) > 0 and not ( HarmonyManager.IsInfo ( curHeroData.dynamicId ) and HarmonyManager.GetSingleAdditions ( HarmonyAddType.AddEquip ) ~= - 1 ) ) or
( isCanUpEquipTreasure and # HeroManager.GetHeroIsUpTreasure ( curHeroData.dynamicId , 0 ) > 0 )
) )
2020-05-09 13:31:21 +08:00
curHeroCanUpEquipTabs = HeroManager.GetHeroIsUpEquip ( curHeroData.dynamicId )
else
isUpZhen = false
this.allEquipUpRedPoint : SetActive ( false )
curHeroCanUpEquipTabs = { }
end
this : AddRedPointVale ( _equipDatas )
2020-07-06 20:35:39 +08:00
table.sort (
_equipDatas ,
function ( a , b )
if a.isRedPointShow == b.isRedPointShow then
if a.itemConfig . Quantity == b.itemConfig . Quantity then
if equipConfig [ a.id ] . Position == equipConfig [ b.id ] . Position then
2021-12-13 10:14:54 +08:00
return itemConfig [ a.id ] . Sort > itemConfig [ b.id ] . Sort
2020-07-06 20:35:39 +08:00
else
return equipConfig [ a.id ] . Position < equipConfig [ b.id ] . Position
end
2020-05-09 13:31:21 +08:00
else
2020-07-06 20:35:39 +08:00
return a.itemConfig . Quantity > b.itemConfig . Quantity
2020-05-09 13:31:21 +08:00
end
else
2020-07-06 20:35:39 +08:00
return a.isRedPointShow > b.isRedPointShow
2020-05-09 13:31:21 +08:00
end
end
2020-07-06 20:35:39 +08:00
)
2020-05-09 13:31:21 +08:00
end
2020-07-06 20:35:39 +08:00
2020-05-09 13:31:21 +08:00
--界面销毁时调用(用于子类重写)
function RoleEquipPanel : OnDestroy ( )
2021-04-21 13:12:04 +08:00
this.spLoader : Destroy ( )
2020-05-09 13:31:21 +08:00
SubUIManager.Close ( this.UpView )
this.ScrollView = nil
2021-08-31 17:02:22 +08:00
for k , v in pairs ( this.equipPreList ) do
SubUIManager.Close ( v )
end
this.equipPreList = { }
for k , v in pairs ( this.equipPreList2 ) do
SubUIManager.Close ( v )
end
this.equipPreList2 = { }
2020-05-09 13:31:21 +08:00
end
2021-04-21 13:12:04 +08:00
return RoleEquipPanel