require("Base/BasePanel")
local listpanel = require("Modules/RoleInfo/RoleListPanel")
RoleInfoPanel = Inherit(BasePanel)
local this = RoleInfoPanel
local _CurPageIndex = 1
local orginLayer
local tabsList = {}
local tabs = {
[RoleInfoPanelIndex.qingbao] = {
default = "r_hero_fun_qingbao",
lock = "r_hero_fun_qingbao",
select =
"r_hero_fun_qingbao",
title = Language[11533],
rpType = -1,
},
[RoleInfoPanelIndex.shenhun] = {
default = "r_hero_fun_bg",
lock = "r_hero_fun_bg",
select = "r_hero_fun_bg",
title =
Language[11534],
rpType = -1,
},
[RoleInfoPanelIndex.jinjie] = {
default = "r_hero_fun_jinjie",
lock = "r_hero_fun_jinjie",
select =
"r_hero_fun_jinjie",
title = Language[12748],
rpType = -1,
},
[RoleInfoPanelIndex.juexing] = {
default = "r_hero_fun_bg",
lock = "r_hero_fun_bg",
select = "r_hero_fun_bg",
title =
Language[10434],
rpType = -1,
},
[RoleInfoPanelIndex.chuanshuo] = {
default = "r_hero_fun_chuanshuo",
lock = "r_hero_fun_chuanshuo",
select =
"r_hero_fun_chuanshuo",
title = Language[10997],
rpType = -1,
},
[RoleInfoPanelIndex.pifu] = {
default = "r_hero_fun_bg",
lock = "r_hero_fun_bg",
select = "r_hero_fun_bg",
title =
Language[11535],
rpType = -1,
},
[RoleInfoPanelIndex.feiSheng] = {
default = "r_hero_fun_feisheng",
lock = "r_hero_fun_feisheng",
select =
"r_hero_fun_feisheng",
title = Language[12737],
rpType = -1,
},
}
local tabPage = {
[RoleInfoPanelIndex.qingbao] = SubUIConfig.RoleInfoLayout,
[RoleInfoPanelIndex.shenhun] = SubUIConfig.RoleGodSoulLayout,
[RoleInfoPanelIndex.jinjie] = SubUIConfig.RoleUpStarLayout,
[RoleInfoPanelIndex.juexing] = SubUIConfig.RoleAwakelayout,
[RoleInfoPanelIndex.chuanshuo] = SubUIConfig.RoleStoryLayout,
[RoleInfoPanelIndex.pifu] = SubUIConfig.RoleSkinLayout,
[RoleInfoPanelIndex.feiSheng] = SubUIConfig.RoleFlyUpLayout,
}
local curHeroData --当前英雄信息
local leftHeroData --左边预加载英雄信息
local rightHeroData --右边预加载英雄信息
local curHeroPosition --
local heroDatas --所有英雄list信息
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local heroRankupConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
local heroSkinConfig = ConfigManager.GetConfig(ConfigName.HeroSkin)
local XiuXianSkillConfig = ConfigManager.GetConfig(ConfigName.XiuXianSkillConfig)
local index --当前英雄在 英雄列表中的索引
local soulPrintData = {} --魂印数据
local isUpZhen = false --当前英雄是否上阵
local isClickLeftOrRightBtn = true --点击左右按钮切换英雄播放动画状态
local teamHero = {} --主线编队成员信息
local talismanIsOpen = false --法宝是否开启
local soulPrintIsOpen = false --魂印是否开启
local isProChange = false
local isOpenGod
--初始化组件(用于子类重写)
function RoleInfoPanel:InitComponent()
this.spLoader = SpriteLoader.New()
this.bg = Util.GetGameObject(self.gameObject, "bg")
screenAdapte(this.bg)
orginLayer = 0
this.BtnBack = Util.GetGameObject(self.transform, "btnBack")
this.bgImageList = {}
for i = 1, 5 do
this.bgImageList[i] = Util.GetGameObject(self.transform, "bg/di (" .. i .. ")")
end
this.curObj = Util.GetGameObject(self.transform, "curObj")
this.leftObj = Util.GetGameObject(self.transform, "leftObj")
this.rightObj = Util.GetGameObject(self.transform, "rightObj")
this.leftBtn = Util.GetGameObject(self.transform, "leftBtn/GameObject")
this.rightBtn = Util.GetGameObject(self.transform, "rightBtn/GameObject")
this.roleInfoRoot = Util.GetGameObject(self.transform, "rolePanel")
this.rolePanelOp = Util.GetGameObject(this.roleInfoRoot, "layout")
this.nameInfo = Util.GetGameObject(this.roleInfoRoot, "info")
this.nameAndPossLayout = Util.GetGameObject(this.nameInfo, "nameAndPossLayout")
this.profession = Util.GetGameObject(this.nameAndPossLayout, "proImage"):GetComponent("Image")
this.proChangeBtn = Util.GetGameObject(this.nameInfo, "nameAndPossLayout/proImage/changeBtn")
this.heroName = Util.GetGameObject(this.nameAndPossLayout, "heroName"):GetComponent("Text")
this.starGrid = Util.GetGameObject(this.nameInfo, "sartAndLvLayout")
--上锁
this.lockBtn = Util.GetGameObject(this.roleInfoRoot, "lockBtn")
this.lockImage = Util.GetGameObject(this.lockBtn.transform, "lock")
-- this.lockImage:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_tongyong_suoding_zh")
this.unlockImage = Util.GetGameObject(this.lockBtn.transform, "unlock")
-- this.unlockImage:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_tongyong_jiesuo_zh")
this.pos = Util.GetGameObject(this.roleInfoRoot, "Pos")
this.posQuality = Util.GetGameObject(this.roleInfoRoot, "quality"):GetComponent("Image")
this.RecallBtn = Util.GetGameObject(this.roleInfoRoot, "RecallBtn") --角色归元按钮
-- this.RecallBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_fabao_guiyuan_zh")
this.reStarBtn = Util.GetGameObject(this.roleInfoRoot, "reStarBtn") --角色回退按钮
-- this.reStarBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_huitui")
this.powerBtn = Util.GetGameObject(this.roleInfoRoot, "powerBtn")
this.force = Util.GetGameObject(this.powerBtn, "value"):GetComponent("Text")
this.upLvEffect = Util.GetGameObject(this.powerBtn, "effect")
this.equipBtn = Util.GetGameObject(self.transform, "leftGrid/equipBtn")
local equipBtnImg = Util.GetGameObject(self.transform, "leftGrid/equipBtn/icon"):GetComponent("Image")
equipBtnImg.sprite = this.spLoader:LoadSprite("r_hero_zhuanbeianniu")
this.equipBtnRedPoint = Util.GetGameObject(this.equipBtn, "redPoint")
this.soulPrintBtn = Util.GetGameObject(self.transform, "rightGrid/soulPrintBtn")
local soulPrintBtnImg = Util.GetGameObject(this.soulPrintBtn, "icon"):GetComponent("Image")
soulPrintBtnImg.sprite = this.spLoader:LoadSprite("r_hero_hunyinanniu")
this.soulPrintBtnRedPoint = Util.GetGameObject(this.soulPrintBtn, "redPoint")
this.talismanBtn = Util.GetGameObject(self.transform, "rightGrid/talismanBtn") --该按钮控制入口显隐
this.talismanClick = Util.GetGameObject(this.talismanBtn, "panel") --控制按钮的点击事件 置灰
this.talismanClick:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_fabaoanniu")
this.talismanBtnRedPoint = Util.GetGameObject(this.talismanClick, "redPoint")
this.talismanInfo = Util.GetGameObject(this.talismanBtn, "info") --查看法宝特性按钮
this.imprintBtn = Util.GetGameObject(self.transform, "leftGrid/imprintBtn")
this.imprintImg = Util.GetGameObject(this.imprintBtn, "icon"):GetComponent("Image")
this.godPrintBtn = Util.GetGameObject(self.transform, "leftGrid/GodprintBtn")
this.godPrintImg = Util.GetGameObject(self.transform, "leftGrid/GodprintBtn/icon"):GetComponent("Image")
this.godPrintImg.sprite = this.spLoader:LoadSprite("r_fabao_godPrint")
this.godPrintBtnRedPoint = Util.GetGameObject(this.godPrintBtn, "redPoint")
this.giftBtn = Util.GetGameObject(self.transform, "leftGrid/giftBtn")
this.giftImg = Util.GetGameObject(self.transform, "leftGrid/giftBtn/icon"):GetComponent("Image")
this.giftImg.sprite = this.spLoader:LoadSprite("r_gift_hero")
this.giftRedPoint = Util.GetGameObject(this.giftBtn, "redPoint")
--潜能
this.potencyObj = Util.GetGameObject(self.transform, "rightGrid/potencyBtn")
this.potencyBtn = Util.GetGameObject(self.transform, "rightGrid/potencyBtn")
this.potencyImg = Util.GetGameObject(self.transform, "rightGrid/potencyBtn/icon"):GetComponent("Image")
this.potencyImg.sprite = this.spLoader:LoadSprite("r_hero_qianneng")
this.potencyRedPoint = Util.GetGameObject(self.transform, "rightGrid/potencyBtn/redPoint")
--特训
this.trainingClick = Util.GetGameObject(self.transform, "leftGrid/trainBtn")
this.trainingBtn = Util.GetGameObject(self.transform, "leftGrid/trainBtn")
this.trainBtnImg = Util.GetGameObject(self.transform, "leftGrid/trainBtn/icon"):GetComponent("Image")
this.trainBtnImg.sprite = this.spLoader:LoadSprite("r_hero_texun")
this.trainingBtnRedPoint = Util.GetGameObject(self.transform, "leftGrid/trainBtn/redPoint")
this.PageList = {}
this.GodSoulBtn = Util.GetGameObject(self.transform, "leftGrid/GodSoulBtn")
this.godSoulImg = Util.GetGameObject(self.transform, "leftGrid/GodSoulBtn"):GetComponent("Image")
this.godSoulImg.sprite = this.spLoader:LoadSprite("r_hero_shenhun")
this.godSoulBtnRedPoint = Util.GetGameObject(this.GodSoulBtn, "redPoint")
this.dragView = SubUIManager.Open(SubUIConfig.DragView, self.gameObject.transform)
this.dragView.transform:SetSiblingIndex(1)
this.trigger = Util.GetEventTriggerListener(self.dragView.gameObject)
this.trigger.onBeginDrag = this.trigger.onBeginDrag + this.OnBeginDrag
this.trigger.onDrag = this.trigger.onDrag + this.OnDrag
this.trigger.onEndDrag = this.trigger.onEndDrag + this.OnEndDrag
this.btnList = Util.GetGameObject(self.transform, "tab/btnList")
this.btnPre = Util.GetGameObject(self.transform, "tab/btnInfo")
this.selectBtn = Util.GetGameObject(self.transform, "tab/selectBtn")
-- 上部货币显示
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft })
this.btnMask = Util.GetGameObject(self.transform, "btnMask")
this.btnMask.gameObject:SetActive(false)
this.tianfuBtn = Util.GetGameObject(self.transform, "rightGrid/tianfuBtn") --该按钮控制入口显隐
this.tianfuClick = Util.GetGameObject(this.tianfuBtn, "panel") --控制按钮的点击事件 置灰
this.tianfuInfo = Util.GetGameObject(this.tianfuBtn, "info/Text"):GetComponent("Text") --查看法宝特性按钮
end
--绑定事件(用于子类重写)
function RoleInfoPanel:BindEvent()
Util.AddClick(this.BtnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
if listpanel and isProChange then
listpanel:ChangeProId(curHeroData.changeProId)
listpanel:GetCurSortHeroListData()
end
end)
--切换阵营按钮
Util.AddClick(this.proChangeBtn, function()
UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.ChangeHeroPro, curHeroData, function()
this.profession.sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(curHeroData.changeProId))
heroDatas = HeroManager.GetHeroDataByProperty(curHeroData.changeProId)
isProChange = true
RoleInfoPanel:OnShow()
end)
end)
--角色归元按钮
Util.AddClick(this.RecallBtn, function()
if curHeroData.lv <= 1 then
PopupTipPanel.ShowTip(Language[12749])
return
end
if HarmonyManager.IsChangeColor(curHeroData.dynamicId) then
PopupTipPanel.ShowTip(Language[10477])
return
end
if HarmonyManager:IsEnvoy(curHeroData.dynamicId) and HarmonyManager:HongMengTowerUpLimit() ~= 0 then
if HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv).heroTid == 0 then
PopupTipPanel.ShowTip(Language[10477])
return
end
end
if curHeroData.lockState == 1 then
PopupTipPanel.ShowTip(Language[12750])
-- MsgPanel.ShowTwo("此神将已被锁定,是否解除锁定状态?", nil, function()
-- NetManager.HeroLockEvent(curHeroData.dynamicId,0,function ()
-- PopupTipPanel.ShowTip("神将解锁成功")
-- HeroManager.UpdateSingleHeroLockState(curHeroData.dynamicId,0)
-- end)
-- end)
return
end
local selectHero = {}
selectHero[curHeroData.dynamicId] = curHeroData
UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.ResolveRecall,
HeroManager.GetHeroReturnItems(selectHero, GENERAL_POPUP_TYPE.ResolveRecall), selectHero)
end)
--角色归元按钮
Util.AddClick(this.reStarBtn, function()
if curHeroData.lv > 1 then
PopupTipPanel.ShowTip(Language[12751])
return
end
if CheckListIsContainValue1(HelpFightManager.upHeroList, curHeroData.dynamicId) then
PopupTipPanel.ShowTip(Language[12752])
return
end
if curHeroData.lockState == 1 then
PopupTipPanel.ShowTip(Language[12750])
return
end
local selectHero = {}
selectHero[curHeroData.dynamicId] = curHeroData
UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.ResolveReStar,
HeroManager.GetHeroReturnItems(selectHero, GENERAL_POPUP_TYPE.ResolveReStar), selectHero)
end)
--左切换按钮
Util.AddClick(this.leftBtn, function()
this:LeftBtnOnClick()
end)
Util.AddClick(this.GodSoulBtn, function()
UIManager.OpenPanel(UIName.RoleGodSoulLayout, heroConFigData, heroStar)
end)
--右切换按钮
Util.AddClick(this.rightBtn, function()
this:RightBtnOnClick()
end)
Util.AddClick(this.dragView.gameObject, function()
local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
end)
--礼物
Util.AddClick(this.giftBtn, function()
UIManager.OpenPanel(UIName.RoleGiftPanel, curHeroData, heroDatas)
end)
--潜能
Util.AddClick(this.potencyBtn, function()
UIManager.OpenPanel(UIName.HeroPotencyPanel, curHeroData, heroDatas)
end)
--装备
Util.AddClick(this.equipBtn, function()
UIManager.OpenPanel(UIName.RoleEquipPanel, curHeroData, heroDatas, this, isUpZhen)
end)
--天赋
Util.AddClick(this.tianfuClick, function()
UIManager.OpenPanel(UIName.RoleTalentPopup, curHeroData.heroConfig, curHeroData.breakId, curHeroData.upStarId)
end)
--特训
Util.AddClick(this.trainingClick, function()
UIManager.OpenPanel(UIName.SpecailTrainingInfoPopup, curHeroData, 1)
end)
--魂印
Util.AddClick(this.soulPrintBtn, function()
if soulPrintIsOpen then
UIManager.OpenPanel(UIName.SoulPrintPanel, curHeroData, heroDatas)
else
local EquipSignUnlock = ConfigManager.GetConfigData(ConfigName.GameSetting, 1).EquipSignUnlock
PopupTipPanel.ShowTip(Language[10649] .. NumToSimplenessFont[EquipSignUnlock[2][2]] .. Language[12753])
end
end)
Util.AddClick(this.godPrintBtn, function()
if not isOpenGod then
PopupTipPanel.ShowTip(Language[12754])
return
end
UIManager.OpenPanel(UIName.GodPrintPanel, curHeroData, heroDatas)
end)
--法宝
Util.AddClick(this.talismanClick, function()
if talismanIsOpen then
if curHeroData.baublesId == nil or curHeroData.baublesId == "" then
local list = FaLingManager.GetAllEquipDataNoBless()
local curSelectList = {}
UIManager.OpenPanel(UIName.FaLingListPanel, list, this, curSelectList, curHeroData, 1)
else
LogError("curHeroData.baublesId===" .. curHeroData.baublesId)
local data = FaLingManager.GetEquipDataByDid(curHeroData.baublesId)
UIManager.OpenPanel(UIName.FaLingSingleShowPopup, this, data, 2, false, false, curHeroData)
end
else
PopupTipPanel.ShowTip(TalismanManager.GetCurHeroIsOpenTalismanTip())
end
end)
--查看法宝特性按钮
Util.AddClick(this.talismanInfo, function()
UIManager.OpenPanel(UIName.TalismanInfoPopup, curHeroData.heroConfig, 1, 1)
end)
--上锁
Util.AddClick(this.lockBtn, function()
this:HeroLockEvent()
end)
end
--添加事件监听(用于子类重写)
function RoleInfoPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateSkin, this.UpdateSkinShow)
Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateRoleInfoPanel, this.ResolveUpdateHeroInfoData, self)
Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateSodSoulLayout, this.UpdateHeroInfoData, self)
end
--移除事件监听(用于子类重写)
function RoleInfoPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateSkin, this.UpdateSkinShow)
Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateRoleInfoPanel, this.ResolveUpdateHeroInfoData, self)
Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateSodSoulLayout, this.UpdateHeroInfoData, self)
end
this.UpdateSkinShow = function()
if _CurPageIndex == RoleInfoPanelIndex.pifu then
this:OnPageTabChange(_CurPageIndex)
end
end
--界面打开时调用(用于子类重写)
function RoleInfoPanel:OnOpen(_curHeroData, _heroDatas, _isUpZhen, _index)
curHeroData, heroDatas, isUpZhen = _curHeroData, _heroDatas, _isUpZhen
if _index and _index > 0 then
_CurPageIndex = _index
else
_CurPageIndex = RoleInfoPanelIndex.qingbao
end
LogError("herodatas len==" .. #_heroDatas)
end
-- 打开,重新打开时回调
function RoleInfoPanel:OnShow()
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.RoleInfo })
isClickLeftOrRightBtn = true
this.upLvEffect:SetActive(false)
for i = 1, #heroDatas do
if curHeroData.dynamicId == heroDatas[i].dynamicId then
index = i
end
end
teamHero = FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_NORMAL)
this:UpdateLiveList() --加载当前 和 左右数据
if this.leftLiveObj and leftHeroData then
poolManager:UnLoadLive(this.leftLiveObj.name, this.leftLiveObj)
this.leftLiveObj = nil
end
if this.rightLiveObj and rightHeroData then
poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj)
this.rightLiveObj = nil
end
if this.curLiveObj and curHeroData then
poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj)
this.curLiveObj = nil
end
Util.ClearChild(this.curObj.transform)
Util.ClearChild(this.leftObj.transform)
Util.ClearChild(this.rightObj.transform)
this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData, this.leftObj)
this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData, this.rightObj)
this.curLiveObj = HeroManager.LoadHerolive(curHeroData, this.curObj)
local t = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.Train, "HeroID", curHeroData.id)
this.trainingBtn:SetActive(CheckFunctionOpen(FUNCTION_OPEN_TYPE.Train) and #t ~= 0)
local leftToward = 0
if leftHeroData.skinId and leftHeroData.skinId ~= 0 then
local roleCon = ConfigManager.TryGetConfigData(ConfigName.RoleConfig, leftHeroData.skinId)
if roleCon then
leftToward = roleCon.Toward
end
else
leftToward = leftHeroData.heroConfig.Toward
end
SetHEeroLiveToward(this.leftLiveObj, leftToward, leftHeroData.position)
local rightToward = 0
if rightHeroData.skinId and rightHeroData.skinId ~= 0 then
local roleCon = ConfigManager.TryGetConfigData(ConfigName.RoleConfig, rightHeroData.skinId)
if roleCon then
rightToward = roleCon.Toward
end
else
rightToward = rightHeroData.heroConfig.Toward
end
SetHEeroLiveToward(this.rightLiveObj, rightToward, rightHeroData.position)
if this.curLiveObj then
this.dragView.gameObject:SetActive(true)
this.dragView:SetDragGO(this.curLiveObj)
else
this.dragView.gameObject:SetActive(false)
end
this:SetPanelBg(curHeroData.changeProId)
this:UpdateHeroInfoData() --刷新界面方法
end
--更新界面已存数据
function this:UpdateLiveList()
local leftIndex = (index - 1 > 0 and index - 1 or #heroDatas)
leftHeroData = heroDatas[leftIndex]
curHeroData = heroDatas[index]
local rightIndex = (index + 1 <= #heroDatas and index + 1 or 1)
rightHeroData = heroDatas[rightIndex]
end
function this:SetPanelBg(index)
for i = 1, 5 do
if index == i then
this.bgImageList[i]:SetActive(true)
else
this.bgImageList[i]:SetActive(false)
end
end
end
--右切换按钮点击
function this:RightBtnOnClick()
-- 英雄长按升级时不再进行切换操作
if this.PageList[1] and this.PageList[1].isPressed then
return
end
if isClickLeftOrRightBtn == false then
return
end
isClickLeftOrRightBtn = false
this.btnMask.gameObject:SetActive(true)
local oldIndexConfigData = heroDatas[index]
index = (index + 1 <= #heroDatas and index + 1 or 1)
curHeroData = heroDatas[index]
if this.leftLiveObj then
poolManager:UnLoadLive(leftHeroData.live, this.leftLiveObj)
this.leftLiveObj = nil
end
this.curLiveObj.transform:SetParent(this.leftObj.transform)
this.curLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0.2)
this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(
Vector2.New(oldIndexConfigData.position[1], oldIndexConfigData.position[2]), 0.5, false):SetEase(Ease.Linear)
this.rightLiveObj.transform:SetParent(this.curObj.transform)
this.rightLiveObj:GetComponent("RectTransform").anchoredPosition = Vector2.New(rightHeroData.position[1] + 200,
rightHeroData.position[2])
this.rightLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0)
this.rightLiveObj:GetComponent("SkeletonGraphic"):DOFade(1, 0.3):SetDelay(0.2)
this.rightLiveObj:GetComponent("RectTransform"):DOAnchorPos(
Vector2.New(rightHeroData.position[1], rightHeroData.position[2]), 0.3, false):SetDelay(0.2):OnComplete(function()
this:UpdateLiveList()
if this.curLiveObj then
Log("Recycle:" .. tostring(this.leftLiveObj))
poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj)
this.curLiveObj = nil
end
Util.ClearChild(this.leftObj.transform)
this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData, this.leftObj)
local leftToward = 0
if leftHeroData.skinId and leftHeroData.skinId ~= 0 then
local roleCon = ConfigManager.TryGetConfigData(ConfigName.RoleConfig, leftHeroData.skinId)
if roleCon then
leftToward = roleCon.Toward
end
else
leftToward = leftHeroData.heroConfig.Toward
end
SetHEeroLiveToward(this.leftLiveObj, leftToward, leftHeroData.position)
this.curLiveObj = this.rightLiveObj
local rightToward = 0
if rightHeroData.skinId and rightHeroData.skinId ~= 0 then
local roleCon = ConfigManager.TryGetConfigData(ConfigName.RoleConfig, rightHeroData.skinId)
if roleCon then
rightToward = roleCon.Toward
end
else
rightToward = rightHeroData.heroConfig.Toward
end
this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData, this.rightObj)
SetHEeroLiveToward(this.rightLiveObj, rightToward, rightHeroData.position)
local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
this.rightBtn:GetComponent("Button").enabled = true
isClickLeftOrRightBtn = true
this:UpdateHeroInfoData()
this.btnMask.gameObject:SetActive(false)
end):SetEase(Ease.Linear)
this:SetPanelBg(curHeroData.changeProId)
end
--左切换按钮点击
function this:LeftBtnOnClick()
-- 英雄长按升级时不再进行切换操作
if this.PageList[1] and this.PageList[1].isPressed then
return
end
if isClickLeftOrRightBtn == false then
return
end
this.btnMask.gameObject:SetActive(true)
isClickLeftOrRightBtn = false
this.leftBtn:GetComponent("Button").enabled = false
local oldIndexConfigData = heroDatas[index]
index = (index - 1 > 0 and index - 1 or #heroDatas)
curHeroData = heroDatas[index]
-- 卸载右侧角色
if this.rightLiveObj then
poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj)
this.rightLiveObj = nil
end
this.curLiveObj.transform:SetParent(this.rightObj.transform)
this.curLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0.2)
this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(
Vector2.New(oldIndexConfigData.position[1], oldIndexConfigData.position[2]), 0.5, false):SetEase(Ease.Linear)
this.leftLiveObj.transform:SetParent(this.curObj.transform)
this.leftLiveObj:GetComponent("RectTransform").anchoredPosition = Vector2.New(leftHeroData.position[1] - 200,
leftHeroData.position[2])
this.leftLiveObj:GetComponent("SkeletonGraphic"):DOFade(0, 0)
this.leftLiveObj:GetComponent("SkeletonGraphic"):DOFade(1, 0.3):SetDelay(0.2)
this.leftLiveObj:GetComponent("RectTransform"):DOAnchorPos(
Vector2.New(leftHeroData.position[1], leftHeroData.position[2]), 0.3, false):SetDelay(0.2):OnComplete(function()
this:UpdateLiveList()
if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj)
this.curLiveObj = nil
end
Util.ClearChild(this.rightObj.transform)
this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData, this.rightObj)
local rightToward = 0
if rightHeroData.skinId and rightHeroData.skinId ~= 0 then
local roleCon = ConfigManager.TryGetConfigData(ConfigName.RoleConfig, rightHeroData.skinId)
if roleCon then
rightToward = roleCon.Toward
end
else
rightToward = rightHeroData.heroConfig.Toward
end
SetHEeroLiveToward(this.rightLiveObj, rightToward, rightHeroData.position)
this.curLiveObj = this.leftLiveObj
this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData, this.leftObj)
local leftToward = 0
if leftHeroData.skinId and leftHeroData.skinId ~= 0 then
local roleCon = ConfigManager.TryGetConfigData(ConfigName.RoleConfig, leftHeroData.skinId)
if roleCon then
leftToward = roleCon.Toward
end
else
leftToward = leftHeroData.heroConfig.Toward
end
SetHEeroLiveToward(this.leftLiveObj, leftToward, leftHeroData.position)
local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
this.leftBtn:GetComponent("Button").enabled = true
isClickLeftOrRightBtn = true
this:UpdateHeroInfoData()
this.btnMask.gameObject:SetActive(false)
end):SetEase(Ease.Linear)
this:SetPanelBg(curHeroData.changeProId)
end
function this:UpdateBtnList()
if not tabsList then
tabsList = {}
end
for k, v in pairs(tabsList) do
if IsNull(tabsList[k]) then
tabsList[k] = nil
else
tabsList[k].gameObject:SetActive(false)
end
end
for k, v in ipairs(tabs) do
if not tabsList[k] then
tabsList[k] = newObjToParent(this.btnPre, this.btnList)
end
if k == RoleInfoPanelIndex.pifu then
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.HeroSkin, "HeroId", curHeroData.id)
local HeoSkin = {}
for i = 1, #configs do
if not HeoSkin[configs[i].Type] and configs[i].Show == 1 then
HeoSkin[configs[i].Type] = configs[i]
end
end
if LengthOfTable(HeoSkin) > 1 then
tabsList[k].gameObject:SetActive(true)
else
tabsList[k].gameObject:SetActive(false)
end
elseif k == RoleInfoPanelIndex.jinjie then
if curHeroData.star < 10 then
tabsList[k].gameObject:SetActive(true)
else
tabsList[k].gameObject:SetActive(false)
end
elseif k == RoleInfoPanelIndex.juexing then
-- if curHeroData.star == 10 and curHeroData.heroConfig.MaxRank > curHeroData.star then
-- tabsList[k].gameObject:SetActive(true)
-- else
tabsList[k].gameObject:SetActive(false)
-- end
elseif k == RoleInfoPanelIndex.shenhun then
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.shenhun)
and curHeroData.heroConfig.IsSoulOpen == 1 and curHeroData.star > 10 then
tabsList[k].gameObject:SetActive(false)
else
tabsList[k].gameObject:SetActive(false)
end
elseif k == RoleInfoPanelIndex.feiSheng then
local isopen = ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.FlyUp)
if curHeroData.heroConfig.MaxRank > 11 and curHeroData.star >= 10 and curHeroData.star < 15 then
tabsList[k].gameObject:SetActive(true)
else
tabsList[k].gameObject:SetActive(false)
end
else
tabsList[k].gameObject:SetActive(true)
end
local img = tabsList[k]:GetComponent("Image")
img.sprite = this.spLoader:LoadSprite(v.default)
local title = Util.GetGameObject(tabsList[k], "Text"):GetComponent("Text")
local redpot = Util.GetGameObject(tabsList[k], "redPoint")
local lock = Util.GetGameObject(tabsList[k], "lock")
lock.gameObject:SetActive(false)
title.text = GetCurLanguage() == -1 and v.title or "" .. v.title .. ""
-- 判断是否需要检测红点
redpot:SetActive(false)
if k == RoleInfoPanelIndex.qingbao then
local upLvRedpoint = HeroManager.LvUpBtnRedPoint(curHeroData)
redpot.gameObject:SetActive(upLvRedpoint)
elseif k == RoleInfoPanelIndex.jinjie then
local upStarRedPointState = HeroManager.IsShowUpStarRedPoint(curHeroData)
redpot.gameObject:SetActive(upStarRedPointState)
elseif k == RoleInfoPanelIndex.juexing then
local upStarRedPointState = HeroManager.IsShowUpStarRedPoint(curHeroData)
redpot.gameObject:SetActive(upStarRedPointState)
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake) then
lock.gameObject:SetActive(false)
else
lock.gameObject:SetActive(true)
end
elseif k == RoleInfoPanelIndex.shenhun then
-- local upStarRedPointState = GodSoulManager.CheckRedPointGodSoul(curHeroData)
-- redpot.gameObject:SetActive(upStarRedPointState)
-- else
redpot.gameObject:SetActive(false)
elseif k == RoleInfoPanelIndex.feiSheng then
local upStarRedPointState = HeroManager.IsShowFlyUpRedPoint(curHeroData)
redpot.gameObject:SetActive(upStarRedPointState)
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.FlyUp) then
lock.gameObject:SetActive(false)
else
lock.gameObject:SetActive(true)
end
end
Util.AddOnceClick(tabsList[k], function()
if k == _CurPageIndex then
else
if k == RoleInfoPanelIndex.feiSheng and not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.FlyUp) then
local globe = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig, FUNCTION_OPEN_TYPE.FlyUp)
if globe then
PopupTipPanel.ShowTip(Language[12755] .. globe.OpenRules[2] .. Language[11333])
end
return
elseif k == RoleInfoPanelIndex.juexing and not ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake) then
local globe = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig, FUNCTION_OPEN_TYPE
.RoleAwake)
if globe then
PopupTipPanel.ShowTip(Language[11156] .. globe.OpenRules[2] .. Language[11333])
end
return
end
this:SetSelectBtn(k)
this:OnPageTabChange(k)
end
end)
end
end
function this:CheckRedPointType(index, isShowRedPoint)
if tabsList[index] then
local redpot = Util.GetGameObject(tabsList[index], "redPoint")
redpot.gameObject:SetActive(isShowRedPoint)
end
end
-- 绑定数据
local _PageBindData = {}
--页签选中效果设置
function this:SetSelectBtn(index)
this.selectBtn.transform:SetParent(tabsList[index].transform)
this.selectBtn.transform.localScale = Vector3.one
this.selectBtn.transform.localPosition = Vector3.zero
this.selectBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite(tabs[index].select)
Util.GetGameObject(this.selectBtn.transform, "Text"):GetComponent("Text").text = -1 and
tabs[index].title or
"" ..
tabs[index].title ..
"" --tabs[index].title--
end
-- tab改变事件
function this:OnPageTabChange(index)
this:ChangeCurentHeroSkinLive()
if this.PageList[_CurPageIndex] then
this.PageList[_CurPageIndex]:OnHide()
end
_CurPageIndex = index
if not this.PageList[index] then
this.PageList[index] = SubUIManager.Open(tabPage[index], this.rolePanelOp.transform)
end
this.PageList[index]:OnShow()
this.PageList[index]:SetData(this.sortingOrder, this, curHeroData, isUpZhen, heroDatas)
end
function this:OnSortingOrderChange()
Util.AddParticleSortLayer(this.upLvEffect, this.sortingOrder - orginLayer)
orginLayer = this.sortingOrder
end
function this:UpdateHeroInfoData()
LogError("刷新界面-------------------------------------------------")
this:UpdateBtnList()
this.GodSoulBtn.gameObject:SetActive(CheckFunctionOpen(FUNCTION_OPEN_TYPE.shenhun) and
curHeroData.heroConfig.IsSoulOpen)
this.potencyObj:SetActive(CheckFunctionOpen(FUNCTION_OPEN_TYPE.Potency))
this.giftBtn.gameObject:SetActive(CheckFunctionOpen(FUNCTION_OPEN_TYPE.Gift))
for k, v in pairs(this.PageList) do
v:OnHide()
end
-- LogError("_CurPageIndex==".._CurPageIndex)
if _CurPageIndex == RoleInfoPanelIndex.pifu then
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.HeroSkin, "HeroId", curHeroData.id)
local HeoSkin = {}
for i = 1, #configs do
if not HeoSkin[configs[i].Type] and configs[i].Show == 1 then
HeoSkin[configs[i].Type] = configs[i]
end
end
if LengthOfTable(HeoSkin) < 2 then
_CurPageIndex = RoleInfoPanelIndex.qingbao
end
elseif _CurPageIndex == RoleInfoPanelIndex.jinjie then
if (curHeroData.star == 10 and curHeroData.heroConfig.MaxRank > curHeroData.star and ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake))
or (not (curHeroData.star < 10)) then
_CurPageIndex = RoleInfoPanelIndex.qingbao
end
elseif _CurPageIndex == RoleInfoPanelIndex.juexing then
if (curHeroData.star < 10) or
not (curHeroData.star == 10 and curHeroData.heroConfig.MaxRank > curHeroData.star and ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake)) then
_CurPageIndex = RoleInfoPanelIndex.qingbao
end
elseif _CurPageIndex == RoleInfoPanelIndex.shenhun then
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.shenhun)
and curHeroData.heroConfig.IsSoulOpen == 1 and curHeroData.star > 10 then
_CurPageIndex = RoleInfoPanelIndex.qingbao
else
_CurPageIndex = RoleInfoPanelIndex.qingbao
end
elseif _CurPageIndex == RoleInfoPanelIndex.feiSheng then
if curHeroData.heroConfig.MaxRank <= 11 or curHeroData.star == 15 then
_CurPageIndex = RoleInfoPanelIndex.qingbao
else
LogError("*********/////////////////222222")
end
end
this:SetSelectBtn(_CurPageIndex)
this:OnPageTabChange(_CurPageIndex)
local EquipSignUnlock = ConfigManager.GetConfigData(ConfigName.GameSetting, 1).EquipSignUnlock
if teamHero[curHeroData.dynamicId] then
isUpZhen = true
local isCanUpEquipTreasure
local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig, 40)
if config then
local limits = string.split(config.Value, "|")
if limits then
local heroConfig = curHeroData.heroConfig
local lvs = string.split(limits[1], "#")
local stars = string.split(limits[2], "#")
if PlayerManager.level >= tonumber(lvs[2]) and heroConfig ~= nil and heroConfig.MaxRank >= tonumber(stars[2]) then
isCanUpEquipTreasure = true
else
isCanUpEquipTreasure = false
end
else
isCanUpEquipTreasure = false
end
else
isCanUpEquipTreasure = false
end
this.equipBtnRedPoint:SetActive(#HeroManager.GetHeroIsUpEquip(curHeroData.dynamicId) > 0 or
(isCanUpEquipTreasure and #HeroManager.GetHeroIsUpTreasure(curHeroData.dynamicId, 0) > 0) or
HeroManager.CheckIsUpTreasure(curHeroData.jewels[1], 0) or
HeroManager.CheckIsUpTreasure(curHeroData.jewels[2], 0) or
FaXiangManager.CheckIsCanUpFaXiang(curHeroData) or
FaXiangManager.CheckIsShowRed(curHeroData.faxiang[1], 0) or
FaXiangManager.CheckIsShowRed(curHeroData.faxiang[2], 0))
this.talismanBtnRedPoint:SetActive(HeroManager.GetIsShowTalismanRedPoint(curHeroData))
this.giftRedPoint:SetActive(GiftManager.CheckRoleRedPointById(curHeroData.dynamicId))
this.soulPrintBtnRedPoint:SetActive(HeroManager.GetIsShowSoulPrintRedPoint(curHeroData))
this.godPrintBtnRedPoint:SetActive(HeroManager.GetIsShowGodPrintRedPoint(curHeroData))
this.potencyRedPoint:SetActive(HeroManager.CheckHeroPotencyRedPoint(curHeroData.dynamicId))
this.trainingBtnRedPoint:SetActive(HeroManager.RefreshRedShow(curHeroData))
else
isUpZhen = false
this.equipBtnRedPoint:SetActive(false)
this.talismanBtnRedPoint:SetActive(false)
this.soulPrintBtnRedPoint:SetActive(false)
this.godPrintBtnRedPoint:SetActive(false)
this.giftRedPoint:SetActive(false)
this.potencyRedPoint:SetActive(false)
this.trainingBtnRedPoint:SetActive(false)
end
--法宝按钮逻辑
this.talismanBtn.gameObject:SetActive(TalismanManager.CheckTalismanIsInConfig(curHeroData))
if TalismanManager.CheckTalismanIsInConfig(curHeroData) then
talismanIsOpen = TalismanManager.GetCurHeroIsOpenTalisman(curHeroData)
this.talismanInfo.gameObject:SetActive(not talismanIsOpen)
Util.SetGray(this.talismanClick, not talismanIsOpen)
Util.GetGameObject(this.talismanClick.transform, "lock"):SetActive(not talismanIsOpen)
if not talismanIsOpen then
Util.GetGameObject(this.talismanClick, "lock/Text"):GetComponent("Text").text = TalismanManager
.GetCurHeroIsOpenTalismanStr()
end
end
--魂印按钮逻辑
this.soulPrintBtn:SetActive(ActTimeCtrlManager.IsQualifiled(87) and
curHeroData.heroConfig.MaxRank >= EquipSignUnlock[2][2])
local config = ConfigManager.GetConfigData(ConfigName.SpecialConfig, 149)
if config then
local limits = string.split(config.Value, "#")
if limits then
this.godPrintBtn:SetActive(ActTimeCtrlManager.IsQualifiled(126) and curHeroData.heroConfig.MaxRank >= 6)
isOpenGod = curHeroData.star >= tonumber(limits[1])
Util.SetGray(this.godPrintBtn, not isOpenGod)
Util.GetGameObject(this.godPrintBtn, "lock"):SetActive(not isOpenGod)
if not isOpenGod then
Util.GetGameObject(this.godPrintBtn, "lock/Text"):GetComponent("Text").text = Language[12756]
end
else
this.godPrintBtn:SetActive(false)
end
else
this.godPrintBtn:SetActive(false)
end
this:SetDragView()
local starSize = Vector2.New(60, 60)
local star, starType = curHeroData.GetStar(1)
local starScale = -10
if starType == 3 then
starSize = Vector2.New(1.2, 1.84)
starScale = 7
end
SetHeroStars(this.spLoader, this.starGrid, star, starType, starSize, starScale) --,Vector2.New(0.5,0.5))
Util.SetParticleSortLayer(this.starGrid, this.sortingOrder + 1)
--使得神魂特效同步------------------------
this.starGrid:SetActive(false)
this.starGrid:SetActive(true)
------------------------------------------
this.heroName.text = curHeroData.name
this.profession.sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(curHeroData.changeProId))
this.posQuality.sprite = this.spLoader:LoadSprite(GetHeroQualityStr(curHeroData.heroConfig.Natural, curHeroData.star))
this.unlockImage:SetActive(curHeroData.lockState == 0)
this.lockImage:SetActive(curHeroData.lockState == 1)
if curHeroData.heroConfig.PropertyName == 5 then
this.proChangeBtn:SetActive(false)
else
this.proChangeBtn:SetActive(false)
end
--魂印
soulPrintIsOpen = SoulPrintManager.GetSoulPrintIsOpen(curHeroData)
Util.GetGameObject(this.soulPrintBtn, "lock"):SetActive(not soulPrintIsOpen)
Util.SetGray(this.soulPrintBtn, not soulPrintIsOpen)
if not soulPrintIsOpen then
Util.GetGameObject(this.soulPrintBtn, "lock/Text"):GetComponent("Text").text = NumToSimplenessFont
[EquipSignUnlock[2][2]] .. Language[10648]
end
local WarPower = 0
if isUpZhen then
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
else
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
end
this.force.text = WarPower
--神印按钮
local imprintId = PracticeManager.CheckHeroWearImprint(curHeroData.dynamicId)
if imprintId then
this.imprintBtn:SetActive(true)
this.imprintImg.sprite = this.spLoader:LoadSprite(GetResourcePath(XiuXianSkillConfig[imprintId].Icon))
Util.AddOnceClick(this.imprintBtn, function()
UIManager.OpenPanel(UIName.GeneralInfoPopup, GENERALINFO_TYPE.Imprint, imprintId, curHeroData.id)
end)
else
this.imprintBtn:SetActive(false)
end
ForceRebuildLayout(this.starGrid.transform)
this.reStarBtn.gameObject:SetActive(curHeroData.star > 5 and curHeroData.star < 10)
local OpenPassiveSkillRules = curHeroData.star >= HeroManager.awakeNextStarIndex and curHeroData.heroConfig.Awaken or
curHeroData.heroConfig.OpenPassiveSkillRules
OpenPassiveSkillRules = GetPassiveByMaxStar(curHeroData.heroConfig, OpenPassiveSkillRules)
local tianfuIcon
if curHeroData.star == 12 then
tianfuIcon = "r_tongyong_feisheng_icon1" --飞升一
elseif curHeroData.star == 13 then
tianfuIcon = "r_tongyong_feisheng_icon2" --飞升二
elseif curHeroData.star > 13 then
tianfuIcon = "r_tongyong_feisheng_icon3" --飞升三
elseif curHeroData.star == 11 then
tianfuIcon = "r_tongyong_tianfu_icon" --觉醒
elseif curHeroData.heroConfig.Natural <= 5 then
tianfuIcon = "r_tongyong_feisheng_icon" --9星以下
elseif curHeroData.heroConfig.Natural == 6 or curHeroData.heroConfig.Natural == 7 then
tianfuIcon = "r_tongyong_tianfu_icon" --10星
end
this.tianfuClick:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_tianfu")
LogError("breakid==" .. curHeroData.breakId .. " upstarid==" .. curHeroData.upStarId)
if OpenPassiveSkillRules then
this.tianfuBtn:SetActive(true)
local openlists, compoundOpenNum, compoundNum, allUpStarOpenData = HeroManager.GetAllPassiveSkillIds(
curHeroData.heroConfig, curHeroData.breakId, curHeroData.upStarId)
this.tianfuInfo.text = #openlists - compoundOpenNum .. "/" .. #OpenPassiveSkillRules - compoundNum
else
this.tianfuBtn:SetActive(false)
end
end
function this:ChangeCurentHeroSkinLive(herodata)
if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj)
this.curLiveObj = nil
end
if herodata then
this.curLiveObj = HeroManager.LoadHerolive1(herodata, this.curObj)
local toward = 0
local pos = nil
if herodata.Type ~= 0 then
LogError("type==" .. herodata.Type)
local roleCon = ConfigManager.TryGetConfigData(ConfigName.RoleConfig, herodata.Type)
if roleCon then
LogError("type=====" .. herodata.Type)
toward = roleCon.Toward
end
else
toward = herodata.heroConfig.Toward
end
SetHEeroLiveToward(this.curLiveObj, toward, herodata.Position)
-- 临时保存皮肤位置
curHeroPosition = herodata.Position
else
local WarPower
if isUpZhen then
-- local formationList = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
-- local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(formationList.teamHeroInfos,curHeroData.dynamicId)
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
else
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
end
this.force.text = WarPower
local toward = 0
if curHeroData.skinId and curHeroData.skinId ~= 0 then
local roleCon = ConfigManager.TryGetConfigData(ConfigName.RoleConfig, curHeroData.skinId)
if roleCon then
toward = roleCon.Toward
end
else
toward = curHeroData.heroConfig.Toward
end
this.curLiveObj = HeroManager.LoadHerolive(curHeroData, this.curObj)
SetHEeroLiveToward(this.curLiveObj, toward, curHeroData.position)
-- 清空临时保存的皮肤位置
curHeroPosition = nil
end
this:SetDragView()
end
function this:SetDragView()
if this.curLiveObj then
this.dragView.gameObject:SetActive(true)
this.dragView:SetDragGO(this.curLiveObj)
else
this.dragView.gameObject:SetActive(false)
end
end
local beginV3
local endV3
local distance
function RoleInfoPanel:OnBeginDrag(Pointgo, data)
beginV3 = this.curLiveObj.transform.anchoredPosition
end
function RoleInfoPanel:OnDrag(Pointgo, data)
distance = Vector2.Distance(beginV3, this.curLiveObj.transform.anchoredPosition)
end
function RoleInfoPanel:OnEndDrag(Pointgo, data)
endV3 = this.curLiveObj.transform.anchoredPosition
if distance > 250 and endV3.x < 0 then
this:RightBtnOnClick()
elseif distance > 250 and endV3.x > 0 then
this:LeftBtnOnClick()
else
local pos = curHeroPosition or curHeroData.position
this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(pos[1], pos[2]), 0.5, false):SetEase(Ease
.Linear)
end
distance = 0
end
--界面关闭时调用(用于子类重写)
function RoleInfoPanel:OnClose()
if this.leftLiveObj and leftHeroData then
poolManager:UnLoadLive(this.leftLiveObj.name, this.leftLiveObj)
this.leftLiveObj = nil
end
if this.rightLiveObj and rightHeroData then
poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj)
this.rightLiveObj = nil
end
if this.curLiveObj and curHeroData then
poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj)
this.curLiveObj = nil
end
this.leftBtn:GetComponent("Button").enabled = true
this.rightBtn:GetComponent("Button").enabled = true
Util.ClearChild(this.curObj.transform)
Util.ClearChild(this.leftObj.transform)
Util.ClearChild(this.rightObj.transform)
for k, v in pairs(this.PageList) do
v:OnHide()
end
this.btnMask.gameObject:SetActive(false)
end
--界面销毁时调用(用于子类重写)
function RoleInfoPanel:OnDestroy()
this.spLoader:Destroy()
tabsList = {}
SubUIManager.Close(this.UpView)
-- 这里管理全部子界面的销毁,保证子界面生命周期完整
for k, v in pairs(this.PageList) do
SubUIManager.Close(v)
end
isProChange = false
end
--跳转显示新手提示圈
function this.ShowGuideGo(type) --1 升级突破 2 进阶
if type == 1 then
JumpManager.ShowGuide(UIName.RoleInfoPanel, this.upLvBtn)
elseif type == 2 then
-- 我要变强跳转过来显示小手
elseif type == -1 then
JumpManager.ShowGuide(UIName.RoleInfoPanel, this.upLvBtn)
elseif type == -2 then
JumpManager.ShowGuide(UIName.RoleInfoPanel, this.equipBtn)
elseif type == -3 then
JumpManager.ShowGuide(UIName.RoleInfoPanel, this.soulPrintBtn)
elseif type == -4 then
JumpManager.ShowGuide(UIName.RoleInfoPanel, this.talismanClick)
end
end
function this:HeroLockEvent()
if curHeroData.lockState == 1 then
curHeroData.lockState = 0
elseif curHeroData.lockState == 0 then
curHeroData.lockState = 1
end
NetManager.HeroLockEvent(curHeroData.dynamicId, curHeroData.lockState, function()
if curHeroData.lockState == 1 then
PopupTipPanel.ShowTip(Language[12757])
elseif curHeroData.lockState == 0 then
PopupTipPanel.ShowTip(Language[12623])
end
HeroManager.UpdateSingleHeroLockState(curHeroData.dynamicId, curHeroData.lockState)
this.unlockImage:SetActive(curHeroData.lockState == 0)
this.lockImage:SetActive(curHeroData.lockState == 1)
for i, v in pairs(heroDatas) do
if curHeroData == v then
v.lockState = curHeroData.lockState
end
end
end)
end
function this:ResolveUpdateHeroInfoData()
curHeroData = HeroManager.GetSingleHeroData(curHeroData.dynamicId)
for i = 1, #heroDatas do
if curHeroData.dynamicId == heroDatas[i].dynamicId then
heroDatas[i] = curHeroData
end
end
this:UpdateHeroInfoData() --刷新界面方法
if isUpZhen then
FormationManager.UserPowerChanged()
end
end
return this