miduo_client/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua

819 lines
35 KiB
Lua

require("Base/BasePanel")
RoleInfoPanel = Inherit(BasePanel)
local this = RoleInfoPanel
local _CurPageIndex = 1
local orginLayer
local tabsList = {}
local tabs = {
[1] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11093],rpType = -1,
},
[2] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11815],rpType = -1,
},
[3] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[10373],rpType = -1,
},
[4] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11095],rpType = -1,
},
[5] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11816],rpType = -1,
},
}
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--魂印是否开启
--初始化组件(用于子类重写)
function RoleInfoPanel:InitComponent()
this.spLoader = SpriteLoader.New()
orginLayer = 0
this.BtnBack = Util.GetGameObject(self.transform, "btnBack")
this.bgImageList = {}
for i = 1, 4 do
this.bgImageList[i] = Util.GetGameObject(self.transform, "bg/di ("..i..")")
end
this.optionUp=Util.GetGameObject(self.gameObject,"optionUp")--上部按钮组
this.helpBtn = Util.GetGameObject(this.optionUp, "helpBtn")
this.helpPosition=this.helpBtn:GetComponent("RectTransform").localPosition
this.posBtn=Util.GetGameObject(this.optionUp,"posBtn")--角色定位按钮
this.posBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_dingweianniu_zh")
this.RecallBtn=Util.GetGameObject(this.optionUp,"RecallBtn")--角色归元按钮
this.RecallBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_fabao_guiyuan_zh")
this.shareBtn=Util.GetGameObject(this.optionUp,"shareBtn")--分享按钮
this.bg = Util.GetGameObject(self.gameObject, "bg")
screenAdapte(this.bg)
this.starGrid = Util.GetGameObject(self.transform, "rolePanel/info/sartAndLvLayout")
this.profession = Util.GetGameObject(self.transform, "rolePanel/info/nameAndPossLayout/proImage/proImage"):GetComponent("Image")
this.heroName = Util.GetGameObject(self.transform, "rolePanel/info/nameAndPossLayout/heroName"):GetComponent("Text")
this.level = Util.GetGameObject(self.transform, "rolePanel/info/sartAndLvLayout/lvText"):GetComponent("Text")
this.rolePanelOp = Util.GetGameObject(self.transform, "rolePanel/layout")
--装备
this.equipBtn=Util.GetGameObject(self.transform,"option/equipBtn")
this.equipBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_zhuanbeianniu_zh")
this.soulPrintBtn=Util.GetGameObject(self.transform,"option/soulPrintBtn")
this.soulPrintBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_hunyinanniu_zh")
this.soulPrintBtnRedPoint=Util.GetGameObject(self.transform,"option/soulPrintBtn/redPoint")
this.equipBtnRedPoint=Util.GetGameObject(self.transform,"option/equipBtn/redPoint")
--法宝
this.talismanBtn=Util.GetGameObject(self.transform,"option/talismanBtn") --该按钮控制入口显隐
this.talismanClick=Util.GetGameObject(self.transform,"option/talismanBtn/panel") --控制按钮的点击事件 置灰
this.talismanClick:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_fabaoanniu_zh")
this.talismanBtnRedPoint=Util.GetGameObject(self.transform,"option/talismanBtn/panel/redPoint")
this.talismanInfo=Util.GetGameObject(self.transform,"option/talismanBtn/info") --查看法宝特性按钮
--上锁
this.lockBtn=Util.GetGameObject(this.optionUp,"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.talentBtn=Util.GetGameObject(self.transform,"talentBtn")
this.talentProgress=Util.GetGameObject(self.transform,"talentBtn/progress"):GetComponent("Text")
this.talentTipStr=Util.GetGameObject(self.transform,"talentBtn/tipStr"):GetComponent("Text")
this.talentTipStrGo=Util.GetGameObject(self.transform,"talentBtn/tipStr")
--神印
this.imprintBtn=Util.GetGameObject(self.transform,"imprintBtn")
this.imprintImg=Util.GetGameObject(self.transform,"imprintBtn/Image"):GetComponent("Image")
this.force = Util.GetGameObject(self.transform, "powerBtn/value"):GetComponent("Text")
Util.GetGameObject(self.transform, "powerBtn"):GetComponent("Image").sprite = this.spLoader:LoadSprite("t_tongyong-zhanli_zh")
this.upLvEffect = Util.GetGameObject(self.transform,"powerBtn/effect")
this.posBgImage=Util.GetGameObject(self.transform,"powerBtn/Pos"):GetComponent("Image")
this.posImage=Util.GetGameObject(self.transform,"powerBtn/Pos/PosImage"):GetComponent("Image")
this.posText=Util.GetGameObject(self.transform,"powerBtn/Pos/PosText"):GetComponent("Text")
this.curObj= Util.GetGameObject(self.transform, "curObj")
this.leftObj= Util.GetGameObject(self.transform, "leftObj")
this.rightObj= Util.GetGameObject(self.transform, "rightObj")
this.PageList = {}
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,"rolePanel/btnList")
this.btnPre = Util.GetGameObject(self.transform,"rolePanel/btnInfo")
this.selectBtn = Util.GetGameObject(self.transform, "rolePanel/selectBtn")
this.leftBtn = Util.GetGameObject(self.transform, "leftBtn/GameObject")
this.rightBtn = Util.GetGameObject(self.transform, "rightBtn/GameObject")
-- 上部货币显示
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft})
this.btnMask = Util.GetGameObject(self.transform, "btnMask")
this.btnMask.gameObject:SetActive(false)
end
--绑定事件(用于子类重写)
function RoleInfoPanel:BindEvent()
Util.AddClick(this.BtnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
--角色定位按钮
Util.AddClick(this.posBtn,function()
UIManager.OpenPanel(UIName.RolePosInfoPopup,curHeroData.heroConfig,curHeroData.star)
end)
--角色归元按钮
Util.AddClick(this.RecallBtn,function()
if curHeroData.lv <= 1 then
PopupTipPanel.ShowTip(Language[12263])
return
end
if HarmonyManager.IsChangeColor(curHeroData.dynamicId) then
PopupTipPanel.ShowTip(Language[12184])
return
end
if HarmonyManager:IsEnvoy(curHeroData.dynamicId) and HarmonyManager:HongMengTowerUpLimit() ~= 0 then
if HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv).heroTid == 0 then
PopupTipPanel.ShowTip(Language[12184])
return
end
end
if curHeroData.lockState == 1 then
PopupTipPanel.ShowTip(Language[12264])
-- 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.leftBtn, function()
this:LeftBtnOnClick()
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.equipBtn, function()
UIManager.OpenPanel(UIName.RoleEquipPanel,curHeroData,heroDatas,this,isUpZhen)
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[10536]..NumToSimplenessFont[EquipSignUnlock[2][2]] .. Language[11817])
end
end)
--法宝
Util.AddClick(this.talismanClick,function()
if talismanIsOpen then
UIManager.OpenPanel(UIName.RoleTalismanPanelV2,curHeroData,heroDatas)
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)
Util.AddClick(this.talentBtn,function()
UIManager.OpenPanel(UIName.RoleTalentPopup,curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId)
end)
end
--添加事件监听(用于子类重写)
function RoleInfoPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateSkin, this.UpdateSkinShow)
Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateRoleInfoPanel, this.ResolveUpdateHeroInfoData,self)
end
--移除事件监听(用于子类重写)
function RoleInfoPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateSkin,this.UpdateSkinShow)
Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateRoleInfoPanel, this.ResolveUpdateHeroInfoData,self)
end
this.UpdateSkinShow = function()
if _CurPageIndex == 5 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 = 1
end
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)
if this.curLiveObj then
this.dragView.gameObject:SetActive(true)
this.dragView:SetDragGO(this.curLiveObj)
else
this.dragView.gameObject:SetActive(false)
end
this:SetPanelBg(curHeroData.heroConfig)
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(heroData)
for i = 1, 4 do
if heroData.PropertyName == i then
this.bgImageList[i]:SetActive(true)
else
this.bgImageList[i]:SetActive(false)
end
end
end
--右切换按钮点击
function this:RightBtnOnClick()
-- 英雄长按升级时不再进行切换操作
if 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("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"):DOAnchorPos(Vector2.New(rightHeroData.position[1],rightHeroData.position[2]), 0.5, false):OnComplete(function ()
this:UpdateLiveList()
if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.leftLiveObj)
this.curLiveObj = nil
end
Util.ClearChild(this.leftObj.transform)
this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData,this.leftObj)
this.curLiveObj = this.rightLiveObj
this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData,this.rightObj)
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.heroConfig)
end
--左切换按钮点击
function this:LeftBtnOnClick()
-- 英雄长按升级时不再进行切换操作
if 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("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"):DOAnchorPos(Vector2.New(leftHeroData.position[1],leftHeroData.position[2]), 0.5, false):OnComplete(function ()
this:UpdateLiveList()
if this.curLiveObj then
poolManager:UnLoadLive(this.curLiveObj.name, this.rightLiveObj)
this.curLiveObj = nil
end
Util.ClearChild(this.rightObj.transform)
this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData,this.rightObj)
this.curLiveObj = this.leftLiveObj
this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData,this.leftObj)
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.heroConfig)
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 == 5 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
else
tabsList[k].gameObject:SetActive(true)
end
local img = tabsList[k]:GetComponent("Image")
img.sprite = this.spLoader:LoadSprite("r_hero_xuanze_002")
local title = Util.GetGameObject(tabsList[k], "Text"):GetComponent("Text")
local redpot = Util.GetGameObject(tabsList[k], "redPoint")
title.text = GetCurLanguage() == 0 and v.title or "<size=45>"..v.title.."</size>"
-- 判断是否需要检测红点
redpot:SetActive(false)
if k == 1 then
local upLvRedpoint = HeroManager.LvUpBtnRedPoint(curHeroData)
redpot.gameObject:SetActive(upLvRedpoint)
elseif k == 2 then
local upStarRedPointState = HeroManager.IsShowUpStarRedPoint(curHeroData)
redpot.gameObject:SetActive(upStarRedPointState)
elseif k == 3 then
local upStarRedPointState = HeroManager.IsShowUpStarRedPoint(curHeroData)
redpot.gameObject:SetActive(upStarRedPointState)
else
redpot.gameObject:SetActive(false)
end
Util.AddOnceClick(tabsList[k],function()
if k == _CurPageIndex then
else
this:SetSelectBtn(k)
this:OnPageTabChange(k)
end
end)
end
--根据星级决定叶签现隐
if tabsList[2] and tabsList[3] then
if curHeroData.star < 10 then
if _CurPageIndex == 3 then
_CurPageIndex = 1
this:OnPageTabChange(_CurPageIndex)
end
tabsList[2].gameObject:SetActive(true)
tabsList[3].gameObject:SetActive(false)
elseif curHeroData.star == 10 and curHeroData.heroConfig.Awaken and #curHeroData.heroConfig.Awaken > 0 and ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake) then
if _CurPageIndex == 2 then
_CurPageIndex = 1
this:OnPageTabChange(_CurPageIndex)
end
tabsList[2].gameObject:SetActive(false)
tabsList[3].gameObject:SetActive(true)
else
if _CurPageIndex == 2 or _CurPageIndex == 3 then
_CurPageIndex = 1
this:OnPageTabChange(_CurPageIndex)
end
tabsList[2].gameObject:SetActive(false)
tabsList[3].gameObject:SetActive(false)
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("r_hero_xuanze_001")
Util.GetGameObject(this.selectBtn.transform, "Text"):GetComponent("Text").text = GetCurLanguage() == 0 and tabs[index].title or "<size=45>"..tabs[index].title.."</size>"--tabs[index].title--
Util.GetGameObject(self.transform,"talentBtn/tipStr"):SetActive(false)
if index == 2 then
Util.GetGameObject(self.transform,"talentBtn/tipStr"):SetActive(true)
end
end
local tabPage = {
[1] = SubUIConfig.RoleInfoLayout,
[2] = SubUIConfig.RoleUpStarLayout,
[3] = SubUIConfig.RoleAwakelayout,
[4] = SubUIConfig.RoleStoryLayout,
[5] = SubUIConfig.RoleSkinLayout,
}
-- 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()
this:UpdateBtnList()
for k,v in pairs(this.PageList) do
v:OnHide()
end
if _CurPageIndex == 5 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 = 1
end
end
this:SetSelectBtn(_CurPageIndex)
this:OnPageTabChange(_CurPageIndex)
local EquipSignUnlock = ConfigManager.GetConfigData(ConfigName.GameSetting,1).EquipSignUnlock
local EquipSignUnlockTwo = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,87).OpenRules[2]
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))
this.talismanBtnRedPoint:SetActive(HeroManager.GetIsShowTalismanRedPoint(curHeroData))
this.soulPrintBtnRedPoint:SetActive(HeroManager.GetIsShowSoulPrintRedPoint(curHeroData))
else
isUpZhen = false
this.equipBtnRedPoint:SetActive(false)
this.talismanBtnRedPoint:SetActive(false)
this.soulPrintBtnRedPoint:SetActive(false)
end
--角色定位按钮
this.posBtn.gameObject:SetActive(curHeroData.heroConfig.ShowHeroLocation==1)
--法宝按钮逻辑
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
--魂印按钮逻辑
-- print(EquipSignUnlockTwo,"@@@@@@@@@@@@@@")
if curHeroData.heroConfig.RankupConsumeMaterial then
this.soulPrintBtn:SetActive(PlayerManager.level>=EquipSignUnlockTwo and (#curHeroData.heroConfig.RankupConsumeMaterial + curHeroData.heroConfig.Star) >= EquipSignUnlock[2][2])
else
this.soulPrintBtn:SetActive(PlayerManager.level>=EquipSignUnlockTwo and curHeroData.heroConfig.Star >= EquipSignUnlock[2][2])
end
this:SetDragView()
local starSize = Vector2.New(60,60)
SetHeroStars(this.spLoader, this.starGrid, curHeroData.star,2,starSize,-10,Vector2.New(0.5,0.5))
this.posImage.sprite =this.spLoader:LoadSprite(curHeroData.professionIcon)
this.heroName.text = curHeroData.name
this.profession.sprite =this.spLoader:LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName))
--定位描述相关
this.posBgImage.sprite=this.spLoader:LoadSprite(GetHeroPosBgStr(curHeroData.heroConfig.Profession))
this.posImage.sprite=this.spLoader:LoadSprite(GetHeroPosStr(curHeroData.heroConfig.Profession))
this.posText.text=GetLanguageStrById(curHeroData.heroConfig.HeroLocation)
SetTextVerTial(this.posText.gameObject,Vector3.New(64,21,0),"MiddleLeft")
this.unlockImage:SetActive(curHeroData.lockState == 0)
this.lockImage:SetActive(curHeroData.lockState == 1)
--魂印
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[10535]
end
--天赋
this.talentBtn:SetActive(curHeroData.heroConfig.OpenPassiveSkillRules ~= nil)
local talentBtnImage = curHeroData.star == HeroManager.awakeNextStarIndex and "r_hero_tianfu2_zh" or "r_hero_tianfu1_zh"
this.talentBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite(talentBtnImage)
local OpenPassiveSkillRules = curHeroData.star == HeroManager.awakeNextStarIndex and curHeroData.heroConfig.Awaken or curHeroData.heroConfig.OpenPassiveSkillRules
if OpenPassiveSkillRules then
local openlists,compoundOpenNum,compoundNum,allUpStarOpenData = HeroManager.GetAllPassiveSkillIds(curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId)
this.talentProgress.text = #openlists - compoundOpenNum .."/"..#OpenPassiveSkillRules - compoundNum
if allUpStarOpenData[curHeroData.star + 1] then
this.talentTipStr.text = Language[11818].. NumToSimplenessFont[curHeroData.star + 1] ..Language[11819]
else
this.talentTipStr.text = ""
end
end
local allAddProVal = {}
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)
else
allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
end
this.force.text =allAddProVal[HeroProType.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
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)
-- 临时保存皮肤位置
curHeroPosition = herodata.Position
else
local allAddProVal = {}
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)
else
allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
end
this.force.text =allAddProVal[HeroProType.WarPower]
this.curLiveObj=HeroManager.LoadHerolive(curHeroData,this.curObj)
-- 清空临时保存的皮肤位置
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
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[11820])
elseif curHeroData.lockState == 0 then
PopupTipPanel.ShowTip(Language[11741])
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