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

842 lines
37 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
RoleInfoPanel = Inherit(BasePanel)
local this = RoleInfoPanel
2020-11-03 15:17:48 +08:00
local _CurPageIndex = 1
local orginLayer
local tabsList = {}
local tabs = {
2021-10-20 18:02:09 +08:00
[RoleInfoPanelIndex.qingbao] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11093],rpType = -1,
2020-11-03 15:17:48 +08:00
},
2021-10-20 18:02:09 +08:00
[RoleInfoPanelIndex.shenhun] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = "神魂",rpType = -1,
2020-11-03 15:17:48 +08:00
},
2021-10-20 18:02:09 +08:00
[RoleInfoPanelIndex.jinjie] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11815],rpType = -1,
2020-11-03 15:17:48 +08:00
},
2021-10-20 18:02:09 +08:00
[RoleInfoPanelIndex.juexing] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[10373],rpType = -1,
2020-11-09 15:04:48 +08:00
},
2021-10-20 18:02:09 +08:00
[RoleInfoPanelIndex.chuanshuo] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11095],rpType = -1,
2020-11-03 15:17:48 +08:00
},
2021-10-20 18:02:09 +08:00
[RoleInfoPanelIndex.pifu] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = Language[11816],rpType = -1,
2021-10-18 10:36:32 +08:00
},
}
local tabPage = {
2021-10-20 18:02:09 +08:00
[RoleInfoPanelIndex.qingbao] = SubUIConfig.RoleInfoLayout,
[RoleInfoPanelIndex.shenhun] = SubUIConfig.RoleGodSoulLayout,
[RoleInfoPanelIndex.jinjie] = SubUIConfig.RoleUpStarLayout,
[RoleInfoPanelIndex.juexing] = SubUIConfig.RoleAwakelayout,
[RoleInfoPanelIndex.chuanshuo] = SubUIConfig.RoleStoryLayout,
[RoleInfoPanelIndex.pifu] = SubUIConfig.RoleSkinLayout,
2020-11-03 15:17:48 +08:00
}
2020-05-09 13:31:21 +08:00
local curHeroData--当前英雄信息
local leftHeroData--左边预加载英雄信息
local rightHeroData--右边预加载英雄信息
local curHeroPosition --
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
local heroDatas--所有英雄list信息
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local heroRankupConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
2020-11-03 15:17:48 +08:00
local heroSkinConfig = ConfigManager.GetConfig(ConfigName.HeroSkin)
2021-05-18 20:04:52 +08:00
local XiuXianSkillConfig = ConfigManager.GetConfig(ConfigName.XiuXianSkillConfig)
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
local index--当前英雄在 英雄列表中的索引
local soulPrintData={}--魂印数据
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
local isUpZhen = false--当前英雄是否上阵
local isClickLeftOrRightBtn = true--点击左右按钮切换英雄播放动画状态
local teamHero = {}--主线编队成员信息
local talismanIsOpen = false--法宝是否开启
local soulPrintIsOpen = false--魂印是否开启
--初始化组件(用于子类重写)
function RoleInfoPanel:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-11-03 15:17:48 +08:00
orginLayer = 0
this.BtnBack = Util.GetGameObject(self.transform, "btnBack")
2020-08-25 15:11:32 +08:00
this.bgImageList = {}
2020-08-24 23:38:17 +08:00
for i = 1, 4 do
2020-08-25 15:11:32 +08:00
this.bgImageList[i] = Util.GetGameObject(self.transform, "bg/di ("..i..")")
2020-08-24 23:38:17 +08:00
end
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
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")--角色定位按钮
2021-04-21 13:12:04 +08:00
this.posBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_dingweianniu_zh")
this.RecallBtn=Util.GetGameObject(this.optionUp,"RecallBtn")--角色归元按钮
2021-04-21 13:12:04 +08:00
this.RecallBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_fabao_guiyuan_zh")
2020-05-09 13:31:21 +08:00
this.shareBtn=Util.GetGameObject(this.optionUp,"shareBtn")--分享按钮
2020-11-03 15:17:48 +08:00
this.bg = Util.GetGameObject(self.gameObject, "bg")
screenAdapte(this.bg)
2020-05-09 13:31:21 +08:00
2020-11-03 15:17:48 +08:00
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")
2020-05-09 13:31:21 +08:00
2020-11-03 15:17:48 +08:00
this.rolePanelOp = Util.GetGameObject(self.transform, "rolePanel/layout")
2020-05-09 13:31:21 +08:00
--装备
this.equipBtn=Util.GetGameObject(self.transform,"option/equipBtn")
2021-04-21 13:12:04 +08:00
this.equipBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_zhuanbeianniu_zh")
2020-05-09 13:31:21 +08:00
this.soulPrintBtn=Util.GetGameObject(self.transform,"option/soulPrintBtn")
2021-04-21 13:12:04 +08:00
this.soulPrintBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_hunyinanniu_zh")
2020-05-09 13:31:21 +08:00
this.soulPrintBtnRedPoint=Util.GetGameObject(self.transform,"option/soulPrintBtn/redPoint")
this.equipBtnRedPoint=Util.GetGameObject(self.transform,"option/equipBtn/redPoint")
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
--法宝
2020-06-08 13:57:30 +08:00
this.talismanBtn=Util.GetGameObject(self.transform,"option/talismanBtn") --该按钮控制入口显隐
this.talismanClick=Util.GetGameObject(self.transform,"option/talismanBtn/panel") --控制按钮的点击事件 置灰
2021-04-21 13:12:04 +08:00
this.talismanClick:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_hero_fabaoanniu_zh")
2020-06-08 13:57:30 +08:00
this.talismanBtnRedPoint=Util.GetGameObject(self.transform,"option/talismanBtn/panel/redPoint")
this.talismanInfo=Util.GetGameObject(self.transform,"option/talismanBtn/info") --查看法宝特性按钮
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
--上锁
this.lockBtn=Util.GetGameObject(this.optionUp,"lockBtn")
2020-05-09 13:31:21 +08:00
this.lockImage=Util.GetGameObject(this.lockBtn.transform,"lock")
2021-04-21 13:12:04 +08:00
this.lockImage:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_tongyong_suoding_zh")
2020-05-09 13:31:21 +08:00
this.unlockImage=Util.GetGameObject(this.lockBtn.transform,"unlock")
2021-04-21 13:12:04 +08:00
this.unlockImage:GetComponent("Image").sprite = this.spLoader:LoadSprite("r_tongyong_jiesuo_zh")
2020-11-03 15:17:48 +08:00
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")
2021-05-18 20:04:52 +08:00
--神印
this.imprintBtn=Util.GetGameObject(self.transform,"imprintBtn")
this.imprintImg=Util.GetGameObject(self.transform,"imprintBtn/Image"):GetComponent("Image")
2020-11-03 15:17:48 +08:00
this.force = Util.GetGameObject(self.transform, "powerBtn/value"):GetComponent("Text")
2021-04-21 13:12:04 +08:00
Util.GetGameObject(self.transform, "powerBtn"):GetComponent("Image").sprite = this.spLoader:LoadSprite("t_tongyong-zhanli_zh")
2020-11-03 15:17:48 +08:00
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")
2020-05-09 13:31:21 +08:00
this.PageList = {}
2020-11-03 15:17:48 +08:00
this.dragView = SubUIManager.Open(SubUIConfig.DragView, self.gameObject.transform)
this.dragView.transform:SetSiblingIndex(1)
2020-05-09 13:31:21 +08:00
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
2020-11-03 15:17:48 +08:00
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})
2021-04-19 19:36:43 +08:00
this.btnMask = Util.GetGameObject(self.transform, "btnMask")
2021-04-19 19:36:43 +08:00
this.btnMask.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
--绑定事件(用于子类重写)
function RoleInfoPanel:BindEvent()
2020-11-03 15:17:48 +08:00
Util.AddClick(this.BtnBack, function()
2020-05-09 13:31:21 +08:00
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
--角色定位按钮
Util.AddClick(this.posBtn,function()
UIManager.OpenPanel(UIName.RolePosInfoPopup,curHeroData.heroConfig,curHeroData.star)
2020-05-09 13:31:21 +08:00
end)
2020-11-03 15:17:48 +08:00
--角色归元按钮
Util.AddClick(this.RecallBtn,function()
if curHeroData.lv <= 1 then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[12263])
return
end
if HarmonyManager.IsChangeColor(curHeroData.dynamicId) then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[12184])
return
end
if HarmonyManager:IsEnvoy(curHeroData.dynamicId) and HarmonyManager:HongMengTowerUpLimit() ~= 0 then
if HarmonyManager.GetSingleAdditionsData(HarmonyAddType.AddLv).heroTid == 0 then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[12184])
return
end
end
if curHeroData.lockState == 1 then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[12264])
2021-04-01 18:41:50 +08:00
-- MsgPanel.ShowTwo("此神将已被锁定,是否解除锁定状态?", nil, function()
-- NetManager.HeroLockEvent(curHeroData.dynamicId,0,function ()
2021-04-01 18:41:50 +08:00
-- 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)
2020-05-09 13:31:21 +08:00
end)
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
--左切换按钮
Util.AddClick(this.leftBtn, function()
this:LeftBtnOnClick()
end)
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
--右切换按钮
Util.AddClick(this.rightBtn, function()
this:RightBtnOnClick()
end)
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
Util.AddClick(this.dragView.gameObject, function()
local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
end)
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
--装备
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
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[10536]..NumToSimplenessFont[EquipSignUnlock[2][2]] .. Language[11817])
2020-05-09 13:31:21 +08:00
end
end)
--法宝
2020-06-08 13:57:30 +08:00
Util.AddClick(this.talismanClick,function()
2020-05-09 13:31:21 +08:00
if talismanIsOpen then
UIManager.OpenPanel(UIName.RoleTalismanPanelV2,curHeroData,heroDatas)
else
PopupTipPanel.ShowTip(TalismanManager.GetCurHeroIsOpenTalismanTip())
end
end)
2020-06-08 13:57:30 +08:00
--查看法宝特性按钮
Util.AddClick(this.talismanInfo,function()
UIManager.OpenPanel(UIName.TalismanInfoPopup,curHeroData.heroConfig,1,1)
end)
2020-05-09 13:31:21 +08:00
--上锁
Util.AddClick(this.lockBtn,function()
2020-11-03 15:17:48 +08:00
this:HeroLockEvent()
2020-05-09 13:31:21 +08:00
end)
Util.AddClick(this.talentBtn,function()
2020-11-09 20:05:51 +08:00
UIManager.OpenPanel(UIName.RoleTalentPopup,curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId)
2020-05-09 13:31:21 +08:00
end)
end
--添加事件监听(用于子类重写)
function RoleInfoPanel:AddListener()
2020-11-14 14:16:10 +08:00
Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateSkin, this.UpdateSkinShow)
Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateRoleInfoPanel, this.ResolveUpdateHeroInfoData,self)
2021-10-26 16:00:31 +08:00
Game.GlobalEvent:AddEvent(GameEvent.Role.UpdateSodSoulLayout, this.UpdateHeroInfoData,self)
2020-05-09 13:31:21 +08:00
end
--移除事件监听(用于子类重写)
2020-11-03 15:17:48 +08:00
function RoleInfoPanel:RemoveListener()
2020-11-14 14:16:10 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateSkin,this.UpdateSkinShow)
Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateRoleInfoPanel, this.ResolveUpdateHeroInfoData,self)
2021-10-26 16:00:31 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.Role.UpdateSodSoulLayout, this.UpdateHeroInfoData,self)
2020-05-09 13:31:21 +08:00
end
2020-11-14 14:16:10 +08:00
this.UpdateSkinShow = function()
2021-10-20 18:02:09 +08:00
if _CurPageIndex == RoleInfoPanelIndex.pifu then
2020-11-14 14:16:10 +08:00
this:OnPageTabChange(_CurPageIndex)
end
end
2020-05-09 13:31:21 +08:00
--界面打开时调用(用于子类重写)
2020-11-05 16:02:49 +08:00
function RoleInfoPanel:OnOpen(_curHeroData, _heroDatas,_isUpZhen,_index)
2020-05-09 13:31:21 +08:00
curHeroData, heroDatas,isUpZhen = _curHeroData, _heroDatas,_isUpZhen
2021-04-17 17:50:08 +08:00
2020-11-05 16:02:49 +08:00
if _index and _index > 0 then
_CurPageIndex = _index
else
_CurPageIndex = 1
end
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
-- 打开,重新打开时回调
2020-05-09 13:31:21 +08:00
function RoleInfoPanel:OnShow()
2020-11-03 15:17:48 +08:00
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.RoleInfo })
2020-05-09 13:31:21 +08:00
isClickLeftOrRightBtn = true
2020-11-03 15:17:48 +08:00
this.upLvEffect:SetActive(false)
2020-05-09 13:31:21 +08:00
for i = 1, #heroDatas do
2020-11-05 16:02:49 +08:00
if curHeroData.dynamicId == heroDatas[i].dynamicId then
2020-05-09 13:31:21 +08:00
index = i
end
end
2020-11-03 15:17:48 +08:00
teamHero = FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_NORMAL)
2020-05-09 13:31:21 +08:00
this:UpdateLiveList()--加载当前 和 左右数据
if this.leftLiveObj and leftHeroData then
poolManager:UnLoadLive(this.leftLiveObj.name, this.leftLiveObj)
2020-05-09 13:31:21 +08:00
this.leftLiveObj = nil
end
if this.rightLiveObj and rightHeroData then
poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj)
2020-05-09 13:31:21 +08:00
this.rightLiveObj = nil
end
if this.curLiveObj and curHeroData then
poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj)
2020-05-09 13:31:21 +08:00
this.curLiveObj = nil
end
2020-11-03 15:17:48 +08:00
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)
2020-08-03 13:37:21 +08:00
if this.curLiveObj then
2020-11-03 15:17:48 +08:00
this.dragView.gameObject:SetActive(true)
this.dragView:SetDragGO(this.curLiveObj)
2020-08-03 13:37:21 +08:00
else
2020-11-03 15:17:48 +08:00
this.dragView.gameObject:SetActive(false)
2020-08-03 13:37:21 +08:00
end
2020-11-03 15:17:48 +08:00
this:SetPanelBg(curHeroData.heroConfig)
this:UpdateHeroInfoData()--刷新界面方法
2020-05-09 13:31:21 +08:00
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
2020-11-03 15:17:48 +08:00
function this:SetPanelBg(heroData)
for i = 1, 4 do
if heroData.PropertyName == i then
this.bgImageList[i]:SetActive(true)
2020-05-09 13:31:21 +08:00
else
2020-11-03 15:17:48 +08:00
this.bgImageList[i]:SetActive(false)
2020-05-09 13:31:21 +08:00
end
2021-10-20 18:02:09 +08:00
end
2020-05-09 13:31:21 +08:00
end
--右切换按钮点击
function this:RightBtnOnClick()
-- 英雄长按升级时不再进行切换操作
if this.PageList[1] and this.PageList[1].isPressed then
return
end
2020-05-09 13:31:21 +08:00
if isClickLeftOrRightBtn == false then
return
end
isClickLeftOrRightBtn = false
2021-04-19 19:36:43 +08:00
this.btnMask.gameObject:SetActive(true)
2020-07-03 18:24:44 +08:00
local oldIndexConfigData = heroDatas[index]
2020-05-09 13:31:21 +08:00
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
2020-11-04 16:51:45 +08:00
this.curLiveObj.transform:SetParent(this.leftObj.transform)
2020-07-03 18:24:44 +08:00
this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(oldIndexConfigData.position[1],oldIndexConfigData.position[2]), 0.5, false):SetEase(Ease.Linear)
2020-11-04 16:51:45 +08:00
this.rightLiveObj.transform:SetParent(this.curObj.transform)
2020-05-09 13:31:21 +08:00
this.rightLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(rightHeroData.position[1],rightHeroData.position[2]), 0.5, false):OnComplete(function ()
2020-11-06 20:36:38 +08:00
this:UpdateLiveList()
2020-11-03 17:27:32 +08:00
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)
2020-05-09 13:31:21 +08:00
this.curLiveObj = this.rightLiveObj
2020-11-04 16:51:45 +08:00
this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData,this.rightObj)
2020-05-09 13:31:21 +08:00
local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
this.rightBtn:GetComponent("Button").enabled = true
isClickLeftOrRightBtn = true
2021-04-19 19:36:43 +08:00
this:UpdateHeroInfoData()
this.btnMask.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end):SetEase(Ease.Linear)
2020-11-03 17:27:32 +08:00
this:SetPanelBg(curHeroData.heroConfig)
2020-11-06 20:36:38 +08:00
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
--左切换按钮点击
function this:LeftBtnOnClick()
-- 英雄长按升级时不再进行切换操作
if this.PageList[1] and this.PageList[1].isPressed then
return
end
2020-05-09 13:31:21 +08:00
if isClickLeftOrRightBtn == false then
return
end
2021-04-19 19:36:43 +08:00
this.btnMask.gameObject:SetActive(true)
2020-05-09 13:31:21 +08:00
isClickLeftOrRightBtn = false
2020-11-03 17:27:32 +08:00
this.leftBtn:GetComponent("Button").enabled = false
2020-07-03 18:24:44 +08:00
local oldIndexConfigData = heroDatas[index]
2020-05-09 13:31:21 +08:00
index = (index - 1 > 0 and index - 1 or #heroDatas)
curHeroData = heroDatas[index]
if this.rightLiveObj then
2020-11-03 17:27:32 +08:00
poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj)
2020-05-09 13:31:21 +08:00
this.rightLiveObj = nil
end
2020-11-03 17:27:32 +08:00
this.curLiveObj.transform:SetParent(this.rightObj.transform)
2020-07-03 18:24:44 +08:00
this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(oldIndexConfigData.position[1],oldIndexConfigData.position[2]), 0.5, false):SetEase(Ease.Linear)
2020-11-03 17:27:32 +08:00
this.leftLiveObj.transform:SetParent(this.curObj.transform)
2020-05-09 13:31:21 +08:00
this.leftLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(leftHeroData.position[1],leftHeroData.position[2]), 0.5, false):OnComplete(function ()
this:UpdateLiveList()
2020-11-03 17:27:32 +08:00
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)
2020-05-09 13:31:21 +08:00
this.curLiveObj = this.leftLiveObj
2020-11-03 17:27:32 +08:00
this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData,this.leftObj)
2020-05-09 13:31:21 +08:00
local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
this.leftBtn:GetComponent("Button").enabled = true
isClickLeftOrRightBtn = true
2020-11-06 20:36:38 +08:00
this:UpdateHeroInfoData()
2021-04-19 19:36:43 +08:00
this.btnMask.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end):SetEase(Ease.Linear)
2020-11-03 17:27:32 +08:00
this:SetPanelBg(curHeroData.heroConfig)
2020-11-06 20:36:38 +08:00
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
function this:UpdateBtnList()
if not tabsList then
tabsList = {}
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
for k,v in pairs(tabsList) do
if IsNull(tabsList[k]) then
tabsList[k] = nil
else
tabsList[k].gameObject:SetActive(false)
end
2020-11-03 15:17:48 +08:00
end
for k,v in ipairs(tabs) do
if not tabsList[k] then
tabsList[k] = newObjToParent(this.btnPre,this.btnList)
2020-05-09 13:31:21 +08:00
end
2021-10-20 18:02:09 +08:00
if k == RoleInfoPanelIndex.pifu then
2020-11-03 15:17:48 +08:00
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.HeroSkin,"HeroId",curHeroData.id)
local HeoSkin = {}
for i = 1 ,#configs do
2021-06-03 10:59:54 +08:00
if not HeoSkin[configs[i].Type] and configs[i].Show == 1 then
2021-10-20 18:02:09 +08:00
HeoSkin[configs[i].Type] = configs[i]
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
end
if LengthOfTable(HeoSkin) > 1 then
tabsList[k].gameObject:SetActive(true)
2020-05-09 13:31:21 +08:00
else
2020-11-03 15:17:48 +08:00
tabsList[k].gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end
2021-10-20 18:02:09 +08:00
elseif k == RoleInfoPanelIndex.jinjie then
if curHeroData.star < 10 then
tabsList[k].gameObject:SetActive(true)
2021-10-27 17:04:33 +08:00
else
tabsList[k].gameObject:SetActive(false)
2021-10-20 18:02:09 +08:00
end
elseif k == RoleInfoPanelIndex.juexing then
if curHeroData.star == 10 and curHeroData.heroConfig.MaxRank > curHeroData.star and ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake) then
tabsList[k].gameObject:SetActive(true)
2021-10-27 17:04:33 +08:00
else
tabsList[k].gameObject:SetActive(false)
2021-10-20 18:02:09 +08:00
end
elseif k == RoleInfoPanelIndex.shenhun then
2021-10-27 17:04:33 +08:00
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.shenhun)
and curHeroData.heroConfig.IsSoulOpen == 1 and curHeroData.star > 10 then
2021-10-20 18:02:09 +08:00
tabsList[k].gameObject:SetActive(true)
2021-10-27 17:04:33 +08:00
else
tabsList[k].gameObject:SetActive(false)
2021-10-20 18:02:09 +08:00
end
2020-05-09 13:31:21 +08:00
else
2020-11-03 15:17:48 +08:00
tabsList[k].gameObject:SetActive(true)
end
local img = tabsList[k]:GetComponent("Image")
img.sprite = this.spLoader:LoadSprite("r_hero_xuanze_002")
2020-11-03 15:17:48 +08:00
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>"
2020-11-03 15:17:48 +08:00
-- 判断是否需要检测红点
redpot:SetActive(false)
2021-10-20 18:02:09 +08:00
if k == RoleInfoPanelIndex.qingbao then
2020-11-07 16:41:25 +08:00
local upLvRedpoint = HeroManager.LvUpBtnRedPoint(curHeroData)
redpot.gameObject:SetActive(upLvRedpoint)
2021-10-20 18:02:09 +08:00
elseif k == RoleInfoPanelIndex.jinjie then
2020-11-07 16:41:25 +08:00
local upStarRedPointState = HeroManager.IsShowUpStarRedPoint(curHeroData)
redpot.gameObject:SetActive(upStarRedPointState)
2021-10-20 18:02:09 +08:00
elseif k == RoleInfoPanelIndex.juexing then
2020-11-12 13:55:15 +08:00
local upStarRedPointState = HeroManager.IsShowUpStarRedPoint(curHeroData)
redpot.gameObject:SetActive(upStarRedPointState)
2021-10-20 18:02:09 +08:00
elseif k == RoleInfoPanelIndex.shenhun then
local upStarRedPointState = GodSoulManager.CheckRedPointGodSoul(curHeroData)
redpot.gameObject:SetActive(upStarRedPointState)
2020-11-07 16:41:25 +08:00
else
redpot.gameObject:SetActive(false)
2020-11-03 15:17:48 +08:00
end
Util.AddOnceClick(tabsList[k],function()
if k == _CurPageIndex then
2020-05-09 13:31:21 +08:00
else
2020-11-03 15:17:48 +08:00
this:SetSelectBtn(k)
this:OnPageTabChange(k)
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
end)
end
end
2020-11-07 16:41:25 +08:00
function this:CheckRedPointType(index,isShowRedPoint)
if tabsList[index] then
local redpot = Util.GetGameObject(tabsList[index], "redPoint")
redpot.gameObject:SetActive(isShowRedPoint)
2020-05-09 13:31:21 +08:00
end
end
2020-11-03 15:17:48 +08:00
2020-11-07 16:41:25 +08:00
-- 绑定数据
local _PageBindData = {}
2020-11-03 15:17:48 +08:00
--页签选中效果设置
function this:SetSelectBtn(index)
this.selectBtn.transform:SetParent(tabsList[index].transform)
this.selectBtn.transform.localScale = Vector3.one
this.selectBtn.transform.localPosition=Vector3.zero
2021-04-22 21:34:11 +08:00
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)
2021-10-20 18:02:09 +08:00
if index == RoleInfoPanelIndex.jinjie then
Util.GetGameObject(self.transform,"talentBtn/tipStr"):SetActive(true)
end
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
-- tab改变事件
function this:OnPageTabChange(index)
2020-11-06 20:36:38 +08:00
this:ChangeCurentHeroSkinLive()
if this.PageList[_CurPageIndex] then
this.PageList[_CurPageIndex]:OnHide()
end
2020-11-03 15:17:48 +08:00
_CurPageIndex = index
if not this.PageList[index] then
this.PageList[index] = SubUIManager.Open(tabPage[index],this.rolePanelOp.transform)
2020-05-09 13:31:21 +08:00
end
this.PageList[index]:OnShow()
this.PageList[index]:SetData(this.sortingOrder,this,curHeroData,isUpZhen,heroDatas)
2020-11-03 15:17:48 +08:00
end
function this:OnSortingOrderChange()
Util.AddParticleSortLayer(this.upLvEffect, this.sortingOrder - orginLayer)
orginLayer = this.sortingOrder
2020-11-03 15:17:48 +08:00
end
function this:UpdateHeroInfoData()
this:UpdateBtnList()
2021-04-17 17:50:08 +08:00
for k,v in pairs(this.PageList) do
v:OnHide()
end
2021-10-20 18:02:09 +08:00
if _CurPageIndex == RoleInfoPanelIndex.pifu then
2020-11-03 15:17:48 +08:00
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.HeroSkin,"HeroId",curHeroData.id)
local HeoSkin = {}
for i = 1 ,#configs do
2021-06-03 10:59:54 +08:00
if not HeoSkin[configs[i].Type] and configs[i].Show == 1 then
2020-11-03 15:17:48 +08:00
HeoSkin[configs[i].Type] = configs[i]
end
end
if LengthOfTable(HeoSkin) < 2 then
2020-11-06 20:36:38 +08:00
_CurPageIndex = 1
2020-11-03 15:17:48 +08:00
end
2021-10-20 18:02:09 +08:00
elseif _CurPageIndex == RoleInfoPanelIndex.jinjie then
if (curHeroData.star == 10 and curHeroData.heroConfig.MaxRank > curHeroData.star and ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.RoleAwake))
2021-10-27 17:04:33 +08:00
or (not (curHeroData.star < 10)) then
2021-10-20 18:02:09 +08:00
_CurPageIndex = 1
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 = 1
end
elseif _CurPageIndex == RoleInfoPanelIndex.shenhun then
2021-10-27 17:04:33 +08:00
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.shenhun)
and curHeroData.heroConfig.IsSoulOpen == 1 and curHeroData.star > 10 then
else
2021-10-20 18:02:09 +08:00
_CurPageIndex = 1
end
2020-11-03 15:17:48 +08:00
end
this:SetSelectBtn(_CurPageIndex)
this:OnPageTabChange(_CurPageIndex)
local EquipSignUnlock = ConfigManager.GetConfigData(ConfigName.GameSetting,1).EquipSignUnlock
2021-01-20 17:26:31 +08:00
local EquipSignUnlockTwo = ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,87).OpenRules[2]
2020-11-03 15:17:48 +08:00
if teamHero[curHeroData.dynamicId] then
isUpZhen = true
2021-07-24 19:36:34 +08:00
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
2021-07-26 17:16:29 +08:00
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))
2020-11-03 15:17:48 +08:00
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
--魂印按钮逻辑
2021-01-20 17:26:31 +08:00
-- print(EquipSignUnlockTwo,"@@@@@@@@@@@@@@")
2020-11-03 15:17:48 +08:00
if curHeroData.heroConfig.RankupConsumeMaterial then
2021-01-20 17:26:31 +08:00
this.soulPrintBtn:SetActive(PlayerManager.level>=EquipSignUnlockTwo and (#curHeroData.heroConfig.RankupConsumeMaterial + curHeroData.heroConfig.Star) >= EquipSignUnlock[2][2])
2020-11-03 15:17:48 +08:00
else
2021-01-20 17:26:31 +08:00
this.soulPrintBtn:SetActive(PlayerManager.level>=EquipSignUnlockTwo and curHeroData.heroConfig.Star >= EquipSignUnlock[2][2])
2020-11-03 15:17:48 +08:00
end
2020-11-06 20:36:38 +08:00
this:SetDragView()
2020-11-03 15:17:48 +08:00
local starSize = Vector2.New(60,60)
2021-10-26 16:00:31 +08:00
local star,starType = curHeroData.GetStar(2)
2021-10-27 12:50:15 +08:00
local starScale = -10
if starType == 3 then
starSize = Vector2.New(55.3,138.2)
starScale = -13.2
end
SetHeroStars(this.spLoader, this.starGrid, star,starType,starSize,starScale)--,Vector2.New(0.5,0.5))
2021-04-21 13:12:04 +08:00
this.posImage.sprite =this.spLoader:LoadSprite(curHeroData.professionIcon)
2020-11-03 15:17:48 +08:00
this.heroName.text = curHeroData.name
2021-04-21 13:12:04 +08:00
this.profession.sprite =this.spLoader:LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName))
2020-11-03 15:17:48 +08:00
--定位描述相关
2021-04-21 13:12:04 +08:00
this.posBgImage.sprite=this.spLoader:LoadSprite(GetHeroPosBgStr(curHeroData.heroConfig.Profession))
this.posImage.sprite=this.spLoader:LoadSprite(GetHeroPosStr(curHeroData.heroConfig.Profession))
2021-01-26 17:08:39 +08:00
this.posText.text=GetLanguageStrById(curHeroData.heroConfig.HeroLocation)
2021-03-03 17:45:34 +08:00
SetTextVerTial(this.posText.gameObject,Vector3.New(64,21,0),"MiddleLeft")
2020-11-03 15:17:48 +08:00
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
2021-04-09 12:26:35 +08:00
Util.GetGameObject(this.soulPrintBtn, "lock/Text"):GetComponent("Text").text= NumToSimplenessFont[EquipSignUnlock[2][2]]..Language[10535]
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
--天赋
this.talentBtn:SetActive(curHeroData.heroConfig.OpenPassiveSkillRules ~= nil)
2021-01-26 17:08:39 +08:00
local talentBtnImage = curHeroData.star == HeroManager.awakeNextStarIndex and "r_hero_tianfu2_zh" or "r_hero_tianfu1_zh"
2021-04-21 13:12:04 +08:00
this.talentBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite(talentBtnImage)
2020-11-10 18:35:37 +08:00
local OpenPassiveSkillRules = curHeroData.star == HeroManager.awakeNextStarIndex and curHeroData.heroConfig.Awaken or curHeroData.heroConfig.OpenPassiveSkillRules
if OpenPassiveSkillRules then
2020-11-03 15:17:48 +08:00
local openlists,compoundOpenNum,compoundNum,allUpStarOpenData = HeroManager.GetAllPassiveSkillIds(curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId)
2020-11-10 18:35:37 +08:00
this.talentProgress.text = #openlists - compoundOpenNum .."/"..#OpenPassiveSkillRules - compoundNum
2020-11-03 15:17:48 +08:00
if allUpStarOpenData[curHeroData.star + 1] then
2021-04-09 12:26:35 +08:00
this.talentTipStr.text = Language[11818].. NumToSimplenessFont[curHeroData.star + 1] ..Language[11819]
2020-11-03 15:17:48 +08:00
else
this.talentTipStr.text = ""
2020-05-09 13:31:21 +08:00
end
end
2021-01-22 16:53:50 +08:00
local WarPower = 0
2020-11-03 15:17:48 +08:00
if isUpZhen then
2021-01-22 16:53:50 +08:00
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
2020-05-09 13:31:21 +08:00
else
2021-01-22 16:53:50 +08:00
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
2020-05-09 13:31:21 +08:00
end
this.force.text = WarPower
2021-05-18 20:04:52 +08:00
--神印按钮
local imprintId = PracticeManager.CheckHeroWearImprint(curHeroData.dynamicId)
if imprintId then
this.imprintBtn:SetActive(true)
this.imprintImg.sprite = this.spLoader:LoadSprite(GetResourcePath(XiuXianSkillConfig[imprintId].Icon))
2021-05-18 20:04:52 +08:00
Util.AddOnceClick(this.imprintBtn,function ()
UIManager.OpenPanel(UIName.GeneralInfoPopup,GENERALINFO_TYPE.Imprint,imprintId,curHeroData.id)
end)
else
this.imprintBtn:SetActive(false)
end
2021-10-27 12:50:15 +08:00
ForceRebuildLayout(this.starGrid.transform)
2020-11-03 15:17:48 +08:00
end
2020-11-06 20:36:38 +08:00
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
2020-11-06 20:36:38 +08:00
else
2021-01-22 16:53:50 +08:00
local WarPower
2020-11-14 14:31:38 +08:00
if isUpZhen then
2021-01-22 16:53:50 +08:00
-- 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)
2020-11-14 14:31:38 +08:00
else
2021-01-22 16:53:50 +08:00
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
2020-11-14 14:31:38 +08:00
end
this.force.text = WarPower
2020-11-06 20:36:38 +08:00
this.curLiveObj=HeroManager.LoadHerolive(curHeroData,this.curObj)
-- 清空临时保存的皮肤位置
curHeroPosition = nil
2020-11-06 20:36:38 +08:00
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
2020-11-03 15:17:48 +08:00
local beginV3
local endV3
local distance
function RoleInfoPanel:OnBeginDrag(Pointgo, data)
beginV3=this.curLiveObj.transform.anchoredPosition
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
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)
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
distance=0
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
--界面关闭时调用(用于子类重写)
function RoleInfoPanel:OnClose()
if this.leftLiveObj and leftHeroData then
2020-11-06 21:05:39 +08:00
poolManager:UnLoadLive(this.leftLiveObj.name, this.leftLiveObj)
2020-05-09 13:31:21 +08:00
this.leftLiveObj = nil
end
if this.rightLiveObj and rightHeroData then
2020-11-06 21:05:39 +08:00
poolManager:UnLoadLive(this.rightLiveObj.name, this.rightLiveObj)
2020-05-09 13:31:21 +08:00
this.rightLiveObj = nil
end
if this.curLiveObj and curHeroData then
2020-11-06 21:05:39 +08:00
poolManager:UnLoadLive(this.curLiveObj.name, this.curLiveObj)
2020-05-09 13:31:21 +08:00
this.curLiveObj = nil
end
this.leftBtn:GetComponent("Button").enabled = true
this.rightBtn:GetComponent("Button").enabled = true
2020-11-06 21:05:39 +08:00
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)
2020-05-09 13:31:21 +08:00
end
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
--界面销毁时调用(用于子类重写)
function RoleInfoPanel:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-11-03 15:17:48 +08:00
tabsList = {}
2020-05-09 13:31:21 +08:00
SubUIManager.Close(this.UpView)
2020-11-03 15:17:48 +08:00
-- 这里管理全部子界面的销毁,保证子界面生命周期完整
for k,v in pairs(this.PageList) do
SubUIManager.Close(v)
2020-05-09 13:31:21 +08:00
end
end
2020-11-03 15:17:48 +08:00
2020-05-09 13:31:21 +08:00
--跳转显示新手提示圈
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
2020-06-08 13:57:30 +08:00
JumpManager.ShowGuide(UIName.RoleInfoPanel,this.talismanClick)
2020-05-09 13:31:21 +08:00
end
end
2020-11-03 15:17:48 +08:00
function this:HeroLockEvent()
2020-05-09 13:31:21 +08:00
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
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[11820])
2020-05-09 13:31:21 +08:00
elseif curHeroData.lockState == 0 then
2021-04-09 12:26:35 +08:00
PopupTipPanel.ShowTip(Language[11741])
2020-05-09 13:31:21 +08:00
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
2021-04-21 13:12:04 +08:00
return this