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

623 lines
25 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

require("Base/BasePanel")
RoleInfoPanel = Inherit(BasePanel)
local this = RoleInfoPanel
local RoleSkinPanel = require("Modules/RoleInfo/RoleSkinPanel")
local RoleInfoLayout = require("Modules/RoleInfo/RoleInfoLayout")
local RoleUpStarLayout = require("Modules/RoleInfo/RoleUpStarLayout")
local RoleStoryLayout = require("Modules/RoleInfo/RoleStoryLayout")
-- Tab管理器
local TabBox = require("Modules/Common/TabBox")
local _CurPageIndex = 1
local orginLayer
local tabs = {
[1] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = "情报",rpType = RedPointType.DynamicActTask,
},
[2] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = "进阶",rpType = RedPointType.DynamicActTask,
},
[3] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = "传说",rpType = -1,
},
[4] = {default = "r_hero_xuanze_002", lock = "r_hero_xuanze_002", select = "r_hero_xuanze_001",title = "皮肤",rpType = -1,
},
}
local curHeroData--当前英雄信息
local leftHeroData--左边预加载英雄信息
local rightHeroData--右边预加载英雄信息
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 index--当前英雄在 英雄列表中的索引
local soulPrintData={}--魂印数据
local isUpZhen = false--当前英雄是否上阵
local isClickLeftOrRightBtn = true--点击左右按钮切换英雄播放动画状态
local teamHero = {}--主线编队成员信息
local talismanIsOpen = false--法宝是否开启
local soulPrintIsOpen = false--魂印是否开启
--初始化组件(用于子类重写)
function RoleInfoPanel:InitComponent()
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.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.posImage = Util.GetGameObject(self.transform, "rolePanel/info/nameAndPossLayout/posImage/posImage/posImage"):GetComponent("Image")
this.posText = Util.GetGameObject(self.transform, "rolePanel/info/nameAndPossLayout/posText/posText"):GetComponent("Text")
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.force = Util.GetGameObject(self.transform, "powerBtn/value"):GetComponent("Text")
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.PageList = {
[1] = RoleInfoLayout.InitComponent(Util.GetGameObject(self.transform, "rolePanel/layout/roleInfoLayout")),
[2] = RoleUpStarLayout.InitComponent(Util.GetGameObject(self.transform, "rolePanel/layout/roleUpStarLayout")),
[3] = RoleStoryLayout.InitComponent(Util.GetGameObject(self.transform, "rolePanel/layout/roleStoryLayout")),
[4] = RoleSkinPanel.InitComponent(Util.GetGameObject(self.transform, "rolePanel/layout/roleSkinLayout")),
}
this.selectBtn = Util.GetGameObject(self.transform, "rolePanel/btnList/selectBtn")
-- 上部货币显示
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft})
end
--绑定事件(用于子类重写)
function RoleInfoPanel:BindEvent()
-- 初始化Tab管理器
this.PageTabCtrl = TabBox.New()
this.PageTabCtrl:SetTabAdapter(this.PageTabAdapter)
this.PageTabCtrl:SetTabIsLockCheck(this.PageTabIsLockCheck)
this.PageTabCtrl:SetChangeTabCallBack(this.OnPageTabChange)
Util.AddClick(this.BtnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
--角色定位按钮
Util.AddClick(this.posBtn,function()
UIManager.OpenPanel(UIName.RolePosInfoPopup,curHeroData.heroConfig)
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[11753]..NumToSimplenessFont[EquipSignUnlock[2][2]] .. Language[11832])
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)
for i = 1, #this.PageList do
if this.PageList[i] then
this.PageList[i]:BindEvent()
end
end
end
-- tab按钮自定义显示设置
function this.PageTabAdapter(tab, index, status)
local title = Util.GetGameObject(tab, "Text"):GetComponent("Text")
local ima = tab:GetComponent("Image")
local redpot = Util.GetGameObject(tab, "redPoint")
title.text = tabs[index].title
ima.sprite = Util.LoadSprite(tabs[index][status])
ima:SetNativeSize()
-- 判断是否需要检测红点
redpot:SetActive(false)
if tabs[index].rpType > 0 then
this.ClearPageRedpot(index)
this.BindPageRedpot(index, redpot)
end
if tabs[index].title == "皮肤" then
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.HeroSkin,"HeroId",curHeroData.id)
local HeoSkin = {}
for i = 1 ,#configs do
if not HeoSkin[configs[i].Type] then
HeoSkin[configs[i].Type] = configs[i]
end
end
if LengthOfTable(HeoSkin) > 1 then
tabs[index].gameObject:SetActive(true)
else
tabs[index].gameObject:SetActive(false)
end
end
end
-- tab可用性检测
function this.PageTabIsLockCheck(index)
return false
end
-- tab改变事件
function this.OnPageTabChange(index)
_CurPageIndex = index
for i = 1, #this.PageList do
if this.PageList[i] then
this.PageList[i]:OnHide()
end
end
this.PageList[index]:OnShow(this.sortingOrder,this,curHeroData)
end
-- 绑定数据
local _PageBindData = {}
function this.BindPageRedpot(page, redpot)
local rpType = tabs[page].rpType
if not rpType then return end
BindRedPointObject(rpType, redpot)
_PageBindData[rpType] = redpot
end
function this.ClearPageRedpot(page)
for rpt, redpot in pairs(_PageBindData) do
ClearRedPointObject(rpt, redpot)
end
_PageBindData = {}
end
--添加事件监听(用于子类重写)
function RoleInfoPanel:AddListener()
for i = 1, #this.PageList do
if this.PageList[i] then
this.PageList[i]:AddListener()
end
end
end
--移除事件监听(用于子类重写)
function RoleInfoPanel:RemoveListener()
for i = 1, #this.PageList do
if this.PageList[i] then
this.PageList[i]:RemoveListener()
end
end
end
--界面打开时调用(用于子类重写)
function RoleInfoPanel:OnOpen(_curHeroData, _heroDatas,_isUpZhen)
curHeroData, heroDatas,isUpZhen = _curHeroData, _heroDatas,_isUpZhen
this.PageTabCtrl:Init(this.tabbox, tabs,_CurPageIndex)
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 == heroDatas[i] then
index = i
end
end
teamHero = FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_NORMAL)
this:UpdateLiveList()--加载当前 和 左右数据
if this.leftLiveObj and leftHeroData then
LogError(Language[11833])
poolManager:UnLoadLive(leftHeroData.live, this.leftLiveObj)
this.leftLiveObj = nil
end
if this.rightLiveObj and rightHeroData then
LogError(Language[11834])
poolManager:UnLoadLive(rightHeroData.live, this.rightLiveObj)
this.rightLiveObj = nil
end
if this.curLiveObj and curHeroData then
LogError(Language[11835])
poolManager:UnLoadLive(curHeroData.live, 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 isClickLeftOrRightBtn == false then
return
end
isClickLeftOrRightBtn = false
this.rightBtn:GetComponent("Button").enabled = false
local oldIndexConfigData = heroDatas[index]
index = (index + 1 <= #heroDatas and index + 1 or 1)
curHeroData = heroDatas[index]
this.SetPanelBg(curHeroData.heroConfig)
if this.leftLiveObj then
poolManager:UnLoadLive(leftHeroData.live, this.leftLiveObj)
this.leftLiveObj = nil
end
this.curLiveObj.transform:SetParent(self.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(self.curObj.transform)
this.rightLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(rightHeroData.position[1],rightHeroData.position[2]), 0.5, false):OnComplete(function ()
this:UpdateLiveList()
this.leftLiveObj = this.curLiveObj
this.curLiveObj = this.rightLiveObj
this.rightLiveObj = HeroManager.LoadHerolive(rightHeroData,self.rightObj)
this:UpdateHeroInfoData()
local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
this.rightBtn:GetComponent("Button").enabled = true
isClickLeftOrRightBtn = true
end):SetEase(Ease.Linear)
end
--左切换按钮点击
function this:LeftBtnOnClick()
if isClickLeftOrRightBtn == false then
return
end
isClickLeftOrRightBtn = false
this.leftBtn:GetComponent("Button").enabled = false
local oldIndexConfigData = heroDatas[index]
index = (index - 1 > 0 and index - 1 or #heroDatas)
curHeroData = heroDatas[index]
this.SetPanelBg(curHeroData.heroConfig)
if this.rightLiveObj then
poolManager:UnLoadLive(rightHeroData.live, this.rightLiveObj)
this.rightLiveObj = nil
end
this.curLiveObj.transform:SetParent(self.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(self.curObj.transform)
this.leftLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(leftHeroData.position[1],leftHeroData.position[2]), 0.5, false):OnComplete(function ()
this:UpdateLiveList()
this.rightLiveObj = this.curLiveObj
this.curLiveObj = this.leftLiveObj
this.leftLiveObj = HeroManager.LoadHerolive(leftHeroData,self.leftObj)
this:UpdateHeroInfoData()
local SkeletonGraphic = this.curLiveObj:GetComponent("SkeletonGraphic")
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
this.leftBtn:GetComponent("Button").enabled = true
isClickLeftOrRightBtn = true
end):SetEase(Ease.Linear)
end
function this:UpdateHeroInfoData()
local EquipSignUnlock = ConfigManager.GetConfigData(ConfigName.GameSetting,1).EquipSignUnlock
if teamHero[curHeroData.dynamicId] then
isUpZhen = true
this.equipBtnRedPoint:SetActive(#HeroManager.GetHeroIsUpEquip(curHeroData.dynamicId) > 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
--魂印按钮逻辑
if curHeroData.heroConfig.RankupConsumeMaterial then
this.soulPrintBtn:SetActive(PlayerManager.level>=EquipSignUnlock[1][2] and (#curHeroData.heroConfig.RankupConsumeMaterial + curHeroData.heroConfig.Star) >= EquipSignUnlock[2][2])
else
this.soulPrintBtn:SetActive(PlayerManager.level>=EquipSignUnlock[1][2] and curHeroData.heroConfig.Star >= EquipSignUnlock[2][2])
end
if this.curLiveObj then
self.dragView.gameObject:SetActive(true)
self.dragView:SetDragGO(this.curLiveObj)
else
self.dragView.gameObject:SetActive(false)
end
local starSize = Vector2.New(60,60)
SetHeroStars(self.starGrid, curHeroData.star,2,starSize,-10,Vector2.New(0.5,0.5))
self.posImage.sprite =Util.LoadSprite(curHeroData.professionIcon)
self.posText.text = GetJobStrByJobNum(curHeroData.profession)
self.heroName.text = curHeroData.name
self.profession.sprite =Util.LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName))
--定位描述相关
this.posBgImage.sprite=Util.LoadSprite(GetHeroPosBgStr(curHeroData.heroConfig.Profession))
this.posImage.sprite=Util.LoadSprite(GetHeroPosStr(curHeroData.heroConfig.Profession))
this.posText.text=curHeroData.heroConfig.HeroLocation
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[10488]
end
--天赋
this.talentBtn:SetActive(curHeroData.heroConfig.OpenPassiveSkillRules ~= nil)
if curHeroData.heroConfig.OpenPassiveSkillRules then
local openlists,compoundOpenNum,compoundNum,allUpStarOpenData = HeroManager.GetAllPassiveSkillIds(curHeroData.heroConfig,curHeroData.breakId,curHeroData.upStarId)
this.talentProgress.text = #openlists - compoundOpenNum .."/"..#curHeroData.heroConfig.OpenPassiveSkillRules - compoundNum
if allUpStarOpenData[curHeroData.star + 1] then
this.talentTipStr.text = Language[11837].. NumToSimplenessFont[curHeroData.star + 1] ..Language[11838]
else
this.talentTipStr.text = ""
end
end
this.PageTabCtrl:ChangeTab(_CurPageIndex)
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
this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(Vector2.New(curHeroData.position[1],curHeroData.position[2]), 0.5, false):SetEase(Ease.Linear)
end
distance=0
end
--界面关闭时调用(用于子类重写)
function RoleInfoPanel:OnClose()
if _CurPageIndex then
this.PageList[_CurPageIndex]:OnHide()
this.PageList[_CurPageIndex].gameObject:SetActive(false)
end
end
--界面销毁时调用(用于子类重写)
function RoleInfoPanel:OnDestroy()
SubUIManager.Close(this.UpView)
-- 清除红点
this.ClearPageRedpot()
-- 这里管理全部子界面的销毁,保证子界面生命周期完整
for _, page in pairs(this.PageList) do
if page.OnDestroy then
page:OnDestroy()
end
end
end
--情报按钮点击
function RoleInfoPanel:OnClickBtnInfo()
this.roleInfoLayout:SetActive(true)
this.talentTipStrGo:SetActive(false)
RoleInfoPanel:SetSelectBtn(this.btnInfo, Language[11836])
end
--进阶按钮点击
function RoleInfoPanel:OnClickBtnUpStar()
if curHeroData.heroConfig.GrowthSwitch then
PopupTipPanel.ShowTip(Language[11844])
return
end
RoleInfoPanel.HideAllLayout()
this.roleUpStarLayout:SetActive(true)
this.talentTipStrGo:SetActive(true)
RoleInfoPanel:SetSelectBtn(this.btnUpStar, Language[11845])
end
--传记按钮点击
function RoleInfoPanel:OnClickBtnStory()
RoleInfoPanel.HideAllLayout()
this.roleStoryLayout:SetActive(true)
RoleInfoPanel:SetSelectBtn(this.btnStory, Language[12158])
--PopupTipPanel.ShowTip("内容未开放")
end
--皮肤按钮点击
function RoleInfoPanel:OnClickBtnSkin()
RoleInfoPanel.HideAllLayout()
this.roleSkinLayout:SetActive(true)
RoleInfoPanel:SetSelectBtn(this.btnSkin, "皮肤")
end
function this:SortHeroDatas(_heroDatas)
--上阵最优先星级优先同星级等级优先同星级同等级按sortId排序。排序时降序排序。
table.sort(_heroDatas, function(a, b)
if (teamHero[a.dynamicId] and teamHero[b.dynamicId]) or
(not teamHero[a.dynamicId] and not teamHero[b.dynamicId])
then
if a.heroConfig.Natural ==b.heroConfig.Natural then
if a.star == b.star then
if a.lv == b.lv then
return a.heroConfig.Id < b.heroConfig.Id
else
return a.lv > b.lv
end
else
return a.star > b.star
end
else
return a.heroConfig.Natural > b.heroConfig.Natural
end
else
return teamHero[a.dynamicId] and not teamHero[b.dynamicId]
end
end)
end
--跳转显示新手提示圈
function this.ShowGuideGo(type)--1 升级突破 2 进阶
if type == 1 then
JumpManager.ShowGuide(UIName.RoleInfoPanel,this.upLvBtn)
elseif type == 2 then
--local btn = Util.GetGameObject(this.upStarGrid.transform, "upStarPre3")
--JumpManager.ShowGuide(UIName.RoleInfoPanel,btn)
-- 我要变强跳转过来显示小手
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[11853])
elseif curHeroData.lockState == 0 then
PopupTipPanel.ShowTip(Language[11791])
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 RoleInfoPanel:HeroReturnEvent()
if isUpZhen then
PopupTipPanel.ShowTip(Language[11854])
return
end
if curHeroData.lockState == 1 then
PopupTipPanel.ShowTip(Language[11855])
return
end
UIManager.OpenPanel(UIName.RoleReturnPanel,curHeroData,isUpZhen)
end
function this:SortHeroDatas(_heroDatas)
--上阵最优先星级优先同星级等级优先同星级同等级按sortId排序。排序时降序排序。
table.sort(_heroDatas, function(a, b)
if (teamHero[a.dynamicId] and teamHero[b.dynamicId]) or
(not teamHero[a.dynamicId] and not teamHero[b.dynamicId])
then
if a.heroConfig.Natural ==b.heroConfig.Natural then
if a.star == b.star then
if a.lv == b.lv then
return a.heroConfig.Id < b.heroConfig.Id
else
return a.lv > b.lv
end
else
return a.star > b.star
end
else
return a.heroConfig.Natural > b.heroConfig.Natural
end
else
return teamHero[a.dynamicId] and not teamHero[b.dynamicId]
end
end)
end
return this