神将界面结构修改
parent
837d7d8886
commit
d040e4dded
|
|
@ -86,6 +86,7 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook)
|
|||
heroData.breakId = _msgHeroData.breakId
|
||||
-- LogGreen("heroData.id:"..heroData.id.." heroData.breakId:"..heroData.breakId)
|
||||
heroData.upStarId = _msgHeroData.starBreakId
|
||||
heroData.skinId = _msgHeroData.skinId
|
||||
heroData.createTime = _msgHeroData.createTimelocal
|
||||
heroData.lockState = _msgHeroData.lockState
|
||||
heroData.createtype = _msgHeroData.createtype
|
||||
|
|
@ -130,7 +131,21 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook)
|
|||
heroData.pDef = _configData.PhysicalDefence
|
||||
heroData.mDef = _configData.MagicDefence
|
||||
heroData.speed = _configData.Speed
|
||||
heroData.live = GetResourcePath(_configData.Live)
|
||||
if heroData.skinId == 0 then
|
||||
heroData.skinConfig = _configData
|
||||
heroData.live = GetResourcePath(_configData.Live)
|
||||
heroData.painting = GetResourcePath(_configData.Painting)
|
||||
heroData.icon = GetResourcePath(_configData.Icon)
|
||||
heroData.scale = _configData.Scale
|
||||
heroData.position = _configData.Position
|
||||
else
|
||||
heroData.skinConfig = ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin,"Type",heroData.skinId)
|
||||
heroData.live = GetResourcePath(heroData.skinConfig.Live)
|
||||
heroData.painting = GetResourcePath(heroData.skinConfig.Painting)
|
||||
heroData.icon = GetResourcePath(heroData.skinConfig.Icon)
|
||||
heroData.scale = heroData.skinConfig.Scale
|
||||
heroData.position = heroData.skinConfig.Position
|
||||
end
|
||||
heroData.profession = _configData.Profession
|
||||
heroData.ProfessionResourceId = _configData.ProfessionResourceId
|
||||
if GetJobSpriteStrByJobNum(_configData.Profession) then
|
||||
|
|
@ -138,11 +153,7 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook)
|
|||
else
|
||||
heroData.professionIcon = GetJobSpriteStrByJobNum(1)
|
||||
end
|
||||
heroData.name = _configData.ReadingName
|
||||
heroData.painting = GetResourcePath(_configData.Painting)
|
||||
heroData.icon = GetResourcePath(_configData.Icon)
|
||||
heroData.scale = _configData.Scale
|
||||
heroData.position = _configData.Position
|
||||
heroData.name = _configData.ReadingName
|
||||
heroData.property = _configData.PropertyName
|
||||
heroData.sortId = #heroDatas + 1
|
||||
table.insert(this.heroDataLists, heroData)
|
||||
|
|
@ -162,6 +173,20 @@ function this.UpdateHeroDatas(_msgHeroData, isFindHandBook)
|
|||
--ExpeditionManager.InitHeroHpValue(heroData)
|
||||
end
|
||||
|
||||
function this.ChangeSkinId(heroId,skinId)
|
||||
heroDatas[heroId].skinId = skinId
|
||||
if skinId == 0 then
|
||||
heroDatas[heroId].skinConfig = heroConfig[heroDatas[heroId].id]
|
||||
else
|
||||
heroDatas[heroId].skinConfig = ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin,"Type",heroDatas[heroId].skinId)
|
||||
end
|
||||
heroDatas[heroId].live = GetResourcePath(heroDatas[heroId].skinConfig.Live)
|
||||
heroDatas[heroId].painting = GetResourcePath(heroDatas[heroId].skinConfig.Painting)
|
||||
heroDatas[heroId].icon = GetResourcePath(heroDatas[heroId].skinConfig.Icon)
|
||||
heroDatas[heroId].scale = heroDatas[heroId].skinConfig.Scale
|
||||
heroDatas[heroId].position = heroDatas[heroId].skinConfig.Position
|
||||
end
|
||||
|
||||
function this.SetHeroFormationList(heroDid,teamId,isAddOrDel)
|
||||
if heroDatas[heroDid] then
|
||||
-- LogRed("this.heroResolveLicence[teamId]:"..tostring(this.heroResolveLicence[teamId]))
|
||||
|
|
@ -3183,4 +3208,42 @@ function this.RemoveTreasure(dId, jId)
|
|||
end
|
||||
end
|
||||
|
||||
--根据界面数据加载动态立绘
|
||||
function this.LoadHerolive(_heroData, _objPoint)
|
||||
--TODO:动态加载立绘
|
||||
local testLive = poolManager:LoadLive(_heroData.live, _objPoint.transform,
|
||||
Vector3.one * _heroData.scale, Vector3.New(_heroData.position[1], _heroData.position[2], 0))
|
||||
local SkeletonGraphic = testLive:GetComponent("SkeletonGraphic")
|
||||
local idle = function() SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true) end
|
||||
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idle
|
||||
poolManager:SetLiveClearCall(_heroData.live, testLive, function ()
|
||||
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idle
|
||||
end)
|
||||
return testLive
|
||||
end
|
||||
function this.SortHeroDatas(_heroDatas)
|
||||
local teamHero = FormationManager.GetWuJinFormationHeroIds(FormationTypeDef.FORMATION_NORMAL)
|
||||
--上阵最优先,星级优先,同星级等级优先,同星级同等级按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
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
HeroSkinManager = {}
|
||||
local this = HeroSkinManager
|
||||
this.skinDatas = {}
|
||||
function this.Initialize()
|
||||
|
||||
end
|
||||
function this.InitialSkin(msg,index)
|
||||
if not index or index == 0 then
|
||||
this.skinDatas = {}
|
||||
for i = 1, #msg.skinInfo do
|
||||
this.skinDatas[msg.skinInfo[i].skinId] = {}
|
||||
this.skinDatas[msg.skinInfo[i].skinId].id = msg.skinInfo[i].skinId
|
||||
this.skinDatas[msg.skinInfo[i].skinId].overTime = msg.skinInfo[i].overTime
|
||||
end
|
||||
else
|
||||
this.skinDatas[msg.skinInfo.skinId] = {}
|
||||
this.skinDatas[msg.skinInfo.skinId].id = msg.skinInfo.skinId
|
||||
this.skinDatas[msg.skinInfo.skinId].overTime = msg.skinInfo.overTime
|
||||
end
|
||||
this.UpdateSkinDatasOverTime()
|
||||
end
|
||||
|
||||
function this.UpdateSkinDatasOverTime()
|
||||
if this.timer then
|
||||
this.timer:Stop()
|
||||
this.timer = nil
|
||||
end
|
||||
this.timer = Timer.New(function()
|
||||
for k,v in pairs(this.skinDatas) do
|
||||
if v and v.overTime > 0 then
|
||||
v.overTime = v.overTime - 1
|
||||
if v.overTime == 0 then
|
||||
this.RemoveSkin(v.id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end, 1, -1, true)
|
||||
this.timer:Start()
|
||||
end
|
||||
|
||||
function this.RemoveSkin(id)
|
||||
this.skinDatas[id] = nil
|
||||
end
|
||||
|
||||
function this.IsExist(id)
|
||||
if this.skinDatas[id] then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
return this
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 10666cc6e48afdb45a2a941fa4217732
|
||||
timeCreated: 1546488170
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,582 @@
|
|||
require("Base/BasePanel")
|
||||
RoleInfoLayout = Inherit(BasePanel)
|
||||
local this = RoleInfoLayout
|
||||
|
||||
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 costItemList--升级突破静态材料
|
||||
local isUpLvMaterials=true--升级 突破 材料是否充足
|
||||
local allAddProVal={}--所有属性加成值
|
||||
local lvUpShowProList={}--升级后展示的属性提升list
|
||||
local isHeroUpTuPo=false--是否可突破
|
||||
local upTuPoRankUpConfig={}--即将要突破的数据
|
||||
local upStarRankUpConfig={}--即将要升星的数据
|
||||
local curStarRankUpConfig={}--当前升星的数据
|
||||
local curTuPoRankUpConfig={}--当前突破的数据
|
||||
--长按升级状态
|
||||
local _isClicked = false
|
||||
local _isReqLvUp = false
|
||||
local _isLongPress = false
|
||||
RoleInfoLayout.timePressStarted = 0--监听长按事件
|
||||
this.priThread = nil--协同程序播放升级属性提升值动画用
|
||||
local isTriggerLongClick = false--长按是否升过级
|
||||
local pinjieImage={"r_hero_pinjiebiao_01","r_hero_pinjiebiao_02"} --该死的品阶图片 1是未激活 2是激活
|
||||
local oldLv = 0
|
||||
local curHeroData--当前英雄信息
|
||||
local parent = {}
|
||||
local isUpZhen = false--当前英雄是否上阵
|
||||
local isHeroUpStar
|
||||
local herodatas = {}
|
||||
--初始化组件(用于子类重写)
|
||||
function RoleInfoLayout:InitComponent(gameObject)
|
||||
--情报
|
||||
this.gameObject = gameObject
|
||||
this.atkPro=Util.GetGameObject(gameObject,"pro/atk")
|
||||
this.hpPro=Util.GetGameObject(gameObject,"pro/hp")
|
||||
this.phyDef=Util.GetGameObject(gameObject,"pro/phyDef")
|
||||
this.magDef=Util.GetGameObject(gameObject,"pro/magDef")
|
||||
this.lv = Util.GetGameObject(gameObject,"pro/lv/proValue"):GetComponent("Text")
|
||||
this.skillGrid=Util.GetGameObject(gameObject,"skill")
|
||||
this.selsectSkillImage=Util.GetGameObject(gameObject,"selsectSkillImage")
|
||||
this.allProButton=Util.GetGameObject(gameObject,"allProButton")
|
||||
this.pinjieList={}--品阶预设容器
|
||||
this.pinjieRoot=Util.GetGameObject(gameObject,"Pinjie")
|
||||
this.pinjiePre=Util.GetGameObject(gameObject,"Pre")
|
||||
|
||||
--升级
|
||||
this.itemPre=Util.GetGameObject(gameObject,"upLv/itemPre")
|
||||
this.itemGrid=Util.GetGameObject(gameObject,"upLv/itemGrid")
|
||||
this.upLvBtn=Util.GetGameObject(gameObject,"upLvBtn")
|
||||
this.upLvBtnRedPoint=Util.GetGameObject(gameObject,"upLvBtn/redPoint")
|
||||
this.upLvTrigger = Util.GetEventTriggerListener(this.upLvBtn)
|
||||
|
||||
this.upLvBtnText=Util.GetGameObject(gameObject,"upLvBtn/Text"):GetComponent("Text")
|
||||
this.upLvBtnImage=Util.GetGameObject(gameObject,"upLvBtn"):GetComponent("Image")
|
||||
this.upLvBtnTiShiText=Util.GetGameObject(gameObject,"upLv/Image/Text"):GetComponent("Text")
|
||||
this.upLvGoldBtn=Util.GetGameObject(gameObject,"upLv/gold")
|
||||
this.upLvGoldText=Util.GetGameObject(gameObject,"upLv/gold/Text"):GetComponent("Text")
|
||||
this.tipUpLv=Util.GetGameObject(gameObject,"upLv/tip")
|
||||
this.noUpLvText=Util.GetGameObject(gameObject,"noUpLvText")
|
||||
this.upLv=Util.GetGameObject(gameObject,"upLv")
|
||||
this.lvUpGo=Util.GetGameObject(gameObject,"lvUpGo")
|
||||
this.lvUpGoImage=Util.GetGameObject(gameObject,"lvUpGo/Image")
|
||||
|
||||
for i = 1, 5 do
|
||||
lvUpShowProList[i]=Util.GetGameObject(this.lvUpGo.transform,"proPreParent/proPre"..i)
|
||||
end
|
||||
lvUpShowProList[5]:SetActive(false)
|
||||
return this
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
function RoleInfoLayout:BindEvent()
|
||||
--升级
|
||||
Util.AddClick(this.upLvBtn, function()
|
||||
if Time.realtimeSinceStartup - RoleInfoLayout.timePressStarted <= 0.4 then
|
||||
-- LogGreen("upLvBtn ")
|
||||
this:LvUpClick(true)
|
||||
end
|
||||
end)
|
||||
--长按升级按下状态
|
||||
this._onPointerDown = function(Pointgo, data)
|
||||
isTriggerLongClick = false
|
||||
_isClicked = true
|
||||
RoleInfoLayout.timePressStarted = Time.realtimeSinceStartup
|
||||
oldLv = curHeroData.lv
|
||||
end
|
||||
--长按升级抬起状态
|
||||
this._onPointerUp = function(Pointgo, data)
|
||||
if _isLongPress and isTriggerLongClick then
|
||||
--连续升级抬起请求升级
|
||||
this:LongLvUpClick(oldLv)
|
||||
end
|
||||
_isClicked = false
|
||||
_isLongPress = false
|
||||
end
|
||||
this.upLvTrigger.onPointerDown = this.upLvTrigger.onPointerDown + this._onPointerDown
|
||||
this.upLvTrigger.onPointerUp = this.upLvTrigger.onPointerUp + this._onPointerUp
|
||||
|
||||
|
||||
--显示所有属性
|
||||
Util.AddClick(this.allProButton, function()
|
||||
UIManager.OpenPanel(UIName.RoleProInfoPopup,allAddProVal,curHeroData.heroConfig,true)
|
||||
end)
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function RoleInfoLayout:AddListener()
|
||||
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.UpdateHeroUpLvAndBreakMaterialShow)
|
||||
end
|
||||
--移除事件监听(用于子类重写)
|
||||
function RoleInfoLayout:RemoveListener()
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold,this.UpdateHeroUpLvAndBreakMaterialShow)
|
||||
end
|
||||
|
||||
function RoleInfoLayout:OnShow(_sortinglayer,_parent,_curHerodata,_isUpZhen,_heroDatas)
|
||||
this.gameObject:SetActive(true)
|
||||
FixedUpdateBeat:Add(this.OnUpdate, self)--长按方法注册
|
||||
this.sortingOrder = _sortinglayer
|
||||
curHeroData = _curHerodata
|
||||
parent = _parent
|
||||
isUpZhen = _isUpZhen
|
||||
herodatas = _heroDatas
|
||||
this:UpdateHeroInfoData()
|
||||
this:GetCurHeroUpLvOrUpStarSData()
|
||||
this:UpdateHeroUpLvAndBreakData()--升级
|
||||
end
|
||||
|
||||
--更新英雄情报数据
|
||||
function this:UpdateHeroInfoData()
|
||||
curTuPoRankUpConfig = heroRankupConfig[curHeroData.breakId]
|
||||
local EquipSignUnlock = ConfigManager.GetConfigData(ConfigName.GameSetting,1).EquipSignUnlock
|
||||
--动态品阶
|
||||
local pId=0 --当前突破的阶数
|
||||
if curHeroData.breakId~=0 then
|
||||
pId= heroRankupConfig[curHeroData.breakId].Phase[2]
|
||||
end
|
||||
local hruConfig= ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.HeroRankupConfig,"Star",curHeroData.heroConfig.Star,"Show",1) --动态获取不同英雄最大突破等阶
|
||||
for i = 1, #hruConfig do --动态生成
|
||||
local item=this.pinjieList[i]
|
||||
if not item then
|
||||
item= newObjToParent(this.pinjiePre,this.pinjieRoot)
|
||||
item.name="Pre"..i
|
||||
this.pinjieList[i]=item
|
||||
end
|
||||
this.pinjieList[i]:GetComponent("Image").sprite=Util.LoadSprite(i<=pId and pinjieImage[2] or pinjieImage[1])
|
||||
end
|
||||
for n = 0, this.pinjieRoot.transform.childCount-1 do --超过品阶关闭显示
|
||||
this.pinjieRoot.transform:GetChild(n).gameObject:SetActive(n+1<=#hruConfig)
|
||||
end
|
||||
|
||||
--计算面板属性
|
||||
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:ProShow(this.atkPro,allAddProVal,HeroProType.Attack)
|
||||
this:ProShow(this.hpPro,allAddProVal,HeroProType.Hp)
|
||||
this:ProShow(this.phyDef,allAddProVal,HeroProType.PhysicalDefence)
|
||||
this:ProShow(this.magDef,allAddProVal,HeroProType.MagicDefence)
|
||||
local curLvEnd = 30
|
||||
if curHeroData.breakId > 0 then
|
||||
curLvEnd = heroRankupConfig[curHeroData.breakId].OpenLevel
|
||||
end
|
||||
if curHeroData.upStarId > 0 then
|
||||
if heroRankupConfig[curHeroData.upStarId].OpenLevel > curLvEnd then
|
||||
curLvEnd = heroRankupConfig[curHeroData.upStarId].OpenLevel
|
||||
end
|
||||
end
|
||||
this.lv.text= curHeroData.lv.."/"..curLvEnd
|
||||
--技能点击特殊处理
|
||||
this.selsectSkillImage:SetActive(false)
|
||||
this.UpdateHeroUpStarProUpSkillShow(this.skillGrid,curHeroData.skillIdList,curHeroData.passiveSkillList)
|
||||
end
|
||||
function this:ProShow(go,allAddProVal,HeroProType,nextallAddProVal)
|
||||
local curProSConFig = ConfigManager.GetConfigData(ConfigName.PropertyConfig,HeroProType)
|
||||
Util.GetGameObject(go,"proName"):GetComponent("Text").text = curProSConFig.Info..":"
|
||||
Util.GetGameObject(go,"proValue"):GetComponent("Text").text = allAddProVal[HeroProType]
|
||||
Util.GetGameObject(go,"Image"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(propertyConfig[HeroProType].PropertyIcon))
|
||||
if nextallAddProVal then
|
||||
Util.GetGameObject(go,"nextproValue"):GetComponent("Text").text = nextallAddProVal[HeroProType]
|
||||
end
|
||||
end
|
||||
--更新英雄升级 和 突破 的材料显示
|
||||
function this:UpdateHeroUpLvAndBreakMaterialShow()
|
||||
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
costItemList=upTuPoRankUpConfig.ConsumeMaterial
|
||||
else
|
||||
costItemList=ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv).Consume
|
||||
end
|
||||
if curHeroData.lv>=HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then
|
||||
this.noUpLvText:SetActive(true)
|
||||
this.upLv:SetActive(false)
|
||||
this.upLvBtn:GetComponent("RectTransform").anchoredPosition = Vector2.New(2098, -42.00134 )
|
||||
else
|
||||
Util.ClearChild(this.itemGrid.transform)
|
||||
this.noUpLvText:SetActive(fFightEndLvUpPanelalse)
|
||||
this.upLv:SetActive(true)
|
||||
this.upLvBtn:GetComponent("RectTransform").anchoredPosition = Vector2.New(605, -42.00134 )
|
||||
isUpLvMaterials=true
|
||||
for i = 1, #costItemList do
|
||||
if costItemList[i][1]~=14 then
|
||||
local go=newObject(this.itemPre)
|
||||
go.transform:SetParent(this.itemGrid.transform)
|
||||
go.transform.localScale = Vector3.one
|
||||
go.transform.localPosition=Vector3.zero;
|
||||
go:SetActive(true)
|
||||
--Log("costItemList[i][1] "..costItemList[i][1])
|
||||
if BagManager.GetItemCountById(costItemList[i][1])<costItemList[i][2] then
|
||||
isUpLvMaterials=false
|
||||
go.transform:Find("Image").gameObject:SetActive(true)--显示加号
|
||||
Util.GetGameObject(go.transform,"Text"):GetComponent("Text").text=string.format("<color=#FF0000FF>%s/%s</color>",PrintWanNum2(BagManager.GetItemCountById(costItemList[i][1])),PrintWanNum2(costItemList[i][2]))
|
||||
else
|
||||
go.transform:Find("Image").gameObject:SetActive(false)--隐藏加号
|
||||
Util.GetGameObject(go.transform,"Text"):GetComponent("Text").text=string.format("<color=#FFFFFFFF>%s/%s</color>",PrintWanNum2(BagManager.GetItemCountById(costItemList[i][1])),PrintWanNum2(costItemList[i][2]))
|
||||
end
|
||||
|
||||
Util.GetGameObject(go.transform, "icon"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(itemConfig[costItemList[i][1]].ResourceID))
|
||||
go.transform:GetComponent("Image").sprite = Util.LoadSprite(GetQuantityImageByquality(itemConfig[costItemList[i][1]].Quantity))
|
||||
Util.AddOnceClick(Util.GetGameObject(go.transform,"icon"),function ()
|
||||
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,costItemList[i][1])
|
||||
end)
|
||||
else
|
||||
if BagManager.GetItemCountById(costItemList[i][1])<costItemList[i][2] then
|
||||
isUpLvMaterials=false
|
||||
this.upLvGoldText.text=string.format("<color=#FF0000FF>%s</color>",costItemList[i][2])
|
||||
else
|
||||
this.upLvGoldText.text=string.format("<color=#FFFFFFFF>%s</color>",costItemList[i][2])
|
||||
end
|
||||
Util.AddOnceClick(this.upLvGoldBtn,function()
|
||||
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,costItemList[i][1])
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--单个技能显示
|
||||
function this.UpdateHeroUpStarProUpSkillShow(skillGridGO,skillTabs,passiveSkills)
|
||||
skillGridGO:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
|
||||
local triggerCallBack
|
||||
for i = 1, skillGridGO.transform.childCount do
|
||||
local go= skillGridGO.transform:GetChild(i-1).gameObject
|
||||
local skillType = Util.GetGameObject(go.transform,"skillType")
|
||||
if #skillTabs>=i then--(#passiveSkills+#skillTabs)>=i then
|
||||
local curSkillData = skillTabs[i]
|
||||
if curSkillData and curSkillData.skillConfig and curSkillData.skillConfig.Name then
|
||||
go:SetActive(true)
|
||||
local skillTypeImage = Util.GetGameObject(go.transform,"skillImage/Image"):GetComponent("Image")
|
||||
--if skillType then
|
||||
if curSkillData.skillConfig.Type == SkillType.Pu then
|
||||
--skillType:GetComponent("Text").text=SkillTypeStr[SkillType.Pu]
|
||||
skillTypeImage.sprite=Util.LoadSprite(SkillIconType[SkillType.Pu])--普技
|
||||
elseif curSkillData.skillConfig.Type == SkillType.Jue then
|
||||
--skillType:GetComponent("Text").text=SkillTypeStr[SkillType.Jue]
|
||||
skillTypeImage.sprite=Util.LoadSprite(SkillIconType[SkillType.Jue])--绝技
|
||||
elseif curSkillData.skillConfig.Type == SkillType.Bei then
|
||||
--skillType:GetComponent("Text").text=SkillTypeStr[SkillType.Bei]
|
||||
skillTypeImage.sprite=Util.LoadSprite(SkillIconType[SkillType.Bei])--被动技
|
||||
end
|
||||
--end
|
||||
local upGo = Util.GetGameObject(go.transform,"up")
|
||||
if upGo then
|
||||
if curSkillData.isShowUpImage ~= nil and curSkillData.isShowUpImage == false then
|
||||
upGo:SetActive(false)
|
||||
else
|
||||
upGo:SetActive(true)
|
||||
end
|
||||
end
|
||||
Util.GetGameObject(go.transform,"icon"):GetComponent("Image").sprite=Util.LoadSprite(GetResourcePath(curSkillData.skillConfig.Icon))--"i_act_ygmd2_2")
|
||||
Util.GetGameObject(go.transform,"skillImage/skillName"):GetComponent("Text").text=curSkillData.skillConfig.Name--(curSkillData.skillId % 10)
|
||||
else
|
||||
go:SetActive(false)
|
||||
end
|
||||
Util.AddOnceClick(Util.GetGameObject(go.transform,"icon"), function()
|
||||
if Game.GlobalEvent:HasEvent(GameEvent.UI.OnClose, triggerCallBack) then
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
|
||||
end
|
||||
|
||||
this.selsectSkillImage:SetActive(true)
|
||||
this.selsectSkillImage.transform.position=Util.GetGameObject(go.transform,"icon").transform.position
|
||||
|
||||
|
||||
local maxLv= HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id,curSkillData.skillConfig.Type)
|
||||
local panel = UIManager.OpenPanel(UIName.SkillInfoPopup,curSkillData,1,10,maxLv,i)
|
||||
skillGridGO:GetComponent("Canvas").sortingOrder = panel.sortingOrder + 1
|
||||
triggerCallBack = function (panelType, p)
|
||||
if panelType == UIName.SkillInfoPopup and panel == p then --监听到SkillInfoPopup关闭,把层级设回去
|
||||
skillGridGO:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack)
|
||||
this.selsectSkillImage:SetActive(false)
|
||||
end
|
||||
end
|
||||
Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack)
|
||||
end)
|
||||
else
|
||||
go:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--获取当前英雄的下一突破 和 升星 静态数据
|
||||
function RoleInfoLayout:GetCurHeroUpLvOrUpStarSData()
|
||||
isHeroUpTuPo = false
|
||||
isHeroUpStar = false
|
||||
upTuPoRankUpConfig = {}
|
||||
upStarRankUpConfig = {}
|
||||
local heroRankUpConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
|
||||
for i, v in ConfigPairs(heroRankUpConfig) do
|
||||
if v.Star==curHeroData.heroConfig.Star then--初始星级相等
|
||||
if v.Show==1 then -- 1 突破
|
||||
if v.Id ~= curHeroData.breakId and curHeroData.lv == v.LimitLevel then--and curHeroData.star == v.LimitStar
|
||||
--Log("突破 "..v.Id)
|
||||
isHeroUpTuPo = true
|
||||
upTuPoRankUpConfig = v
|
||||
end
|
||||
end
|
||||
if v.Show==2 then -- 2 升星
|
||||
if v.Id ~= curHeroData.upStarId and curHeroData.star == v.LimitStar then
|
||||
--Log("升星 "..v.Id)
|
||||
upStarRankUpConfig=v
|
||||
isHeroUpStar=true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--更新英雄升级 和 突破数据
|
||||
function this:UpdateHeroUpLvAndBreakData()
|
||||
-- 升级获取突破 和 升星相应heroRankUpConfig静态数据
|
||||
-- LogError("curHeroData "..curHeroData.breakId)
|
||||
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
this.tipUpLv:GetComponent("Text").text=Language[11839]
|
||||
this.tipUpLv:SetActive(true)
|
||||
this.upLvBtnText.text=Language[11840]
|
||||
this.upLvBtnImage.sprite = Util.LoadSprite("r_hero_button_001")--r_chouka_button_004
|
||||
this.upLvBtnTiShiText.text=Language[11841]
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
else
|
||||
if curHeroData.lv < 30 then--策划规定三十级之前一直显示持续长按可快速升级
|
||||
this.tipUpLv:SetActive(true)
|
||||
this.tipUpLv:GetComponent("Text").text = Language[11842]
|
||||
else
|
||||
this.tipUpLv:SetActive(false)
|
||||
end
|
||||
this.upLvBtnText.text=Language[11090]
|
||||
this.upLvBtnImage.sprite = Util.LoadSprite("r_hero_button_002")
|
||||
this.upLvBtnTiShiText.text=Language[11843]
|
||||
if isHeroUpStar and upStarRankUpConfig and curTuPoRankUpConfig and curTuPoRankUpConfig.JudgeClass==1 and curHeroData.lv >= curTuPoRankUpConfig.OpenLevel then--当前突破全部完成
|
||||
if curStarRankUpConfig then--进阶过处理
|
||||
if curHeroData.lv == curStarRankUpConfig.OpenLevel then
|
||||
this.tipUpLv:GetComponent("Text").text=Language[11839]
|
||||
this.tipUpLv:SetActive(true)
|
||||
end
|
||||
else--从未进阶过处理
|
||||
this.tipUpLv:GetComponent("Text").text=Language[11839]
|
||||
this.tipUpLv:SetActive(true)
|
||||
end
|
||||
end
|
||||
end
|
||||
this:UpdateHeroUpLvAndBreakMaterialShow()
|
||||
local upLvRedpoint = HeroManager.LvUpBtnRedPoint(curHeroData)
|
||||
end
|
||||
|
||||
function RoleInfoLayout:OnSortingOrderChange()
|
||||
|
||||
end
|
||||
--升级按钮点击事件处理
|
||||
function RoleInfoLayout:LvUpClick(isSingleLvUp)
|
||||
--是否为最大等级
|
||||
-- LogGreen("isSingleLvUp "..tostring(isSingleLvUp))
|
||||
if curHeroData.lv>=HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then
|
||||
PopupTipPanel.ShowTip(Language[11846])
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
return
|
||||
end
|
||||
--如果此时需要进阶 每次都要跳转
|
||||
if isHeroUpStar and upStarRankUpConfig and curTuPoRankUpConfig and curTuPoRankUpConfig.JudgeClass==1 and curHeroData.lv >= curTuPoRankUpConfig.OpenLevel then--当前突破全部完成
|
||||
if curStarRankUpConfig then--进阶过处理
|
||||
if curHeroData.lv == curStarRankUpConfig.OpenLevel then
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
MsgPanel.ShowTwo(Language[11847], nil, function()
|
||||
parent:SetSelectBtn(2)
|
||||
parent:OnPageTabChange(2)
|
||||
end,Language[10719],Language[11848])
|
||||
else
|
||||
if isUpLvMaterials then
|
||||
if isSingleLvUp then--是否是单次升级
|
||||
NetManager.HeroLvUpEvent(curHeroData.dynamicId,curHeroData.lv + 1,curHeroData.lv,function (msg)
|
||||
this:DeleteLvUpMaterials(isSingleLvUp,msg)
|
||||
end)
|
||||
else
|
||||
isTriggerLongClick = true
|
||||
this:DeleteLvUpMaterials(isSingleLvUp)
|
||||
end
|
||||
else
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
if isHeroUpTuPo and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
PopupTipPanel.ShowTip(Language[11849])
|
||||
else
|
||||
PopupTipPanel.ShowTip(Language[11850])
|
||||
end
|
||||
end
|
||||
end
|
||||
else--从未进阶过处理
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
MsgPanel.ShowTwo(Language[11847], nil, function()
|
||||
parent:SetSelectBtn(2)
|
||||
parent:OnPageTabChange(2)
|
||||
end,Language[10719],Language[11848])
|
||||
end
|
||||
else
|
||||
if isUpLvMaterials then
|
||||
if isSingleLvUp then--是否是单次升级
|
||||
local curUpLv = curHeroData.lv
|
||||
if isHeroUpTuPo and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
curUpLv = curHeroData.lv
|
||||
else
|
||||
curUpLv = curHeroData.lv + 1
|
||||
end
|
||||
-- LogGreen("isSingleLvUp "..tostring(isSingleLvUp))
|
||||
NetManager.HeroLvUpEvent(curHeroData.dynamicId,curUpLv,curHeroData.lv,function (msg)
|
||||
this:DeleteLvUpMaterials(isSingleLvUp,msg)
|
||||
end)
|
||||
else
|
||||
isTriggerLongClick = true
|
||||
this:DeleteLvUpMaterials(isSingleLvUp)
|
||||
end
|
||||
else
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
if isHeroUpTuPo and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
PopupTipPanel.ShowTip(Language[11849])
|
||||
else
|
||||
PopupTipPanel.ShowTip(Language[11850])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--长按升级结束后请求协议
|
||||
function RoleInfoLayout:LongLvUpClick(oldLv)
|
||||
NetManager.HeroLvUpEvent(curHeroData.dynamicId,curHeroData.lv,oldLv,function (msg)
|
||||
this:DeleteLvUpMaterials2(msg)
|
||||
end)
|
||||
end
|
||||
--扣除升级 突破 消耗的材料 更新英雄数据
|
||||
function RoleInfoLayout:DeleteLvUpMaterials(isSingleLvUp,msg)
|
||||
if isSingleLvUp == false then--连续升级的时候需要自己先扣除
|
||||
for i = 1, #costItemList do
|
||||
--Log(string.format("扣除id=%s 数量=%s",costItemList[i][1],costItemList[i][2]))
|
||||
BagManager.HeroLvUpUpdateItemsNum(costItemList[i][1],costItemList[i][2])
|
||||
end
|
||||
end
|
||||
-- for i, v in pairs(heroDatas) do
|
||||
-- if curHeroData == v then
|
||||
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
UIManager.OpenPanel(UIName.RoleUpLvBreakSuccessPanel,curHeroData,upTuPoRankUpConfig.Id,upTuPoRankUpConfig.OpenLevel)
|
||||
curHeroData.breakId=upTuPoRankUpConfig.Id
|
||||
curHeroData.breakId=curHeroData.breakId
|
||||
--突破有可能会升星
|
||||
if curHeroData.star<upTuPoRankUpConfig.OpenStar then
|
||||
curHeroData.star=upTuPoRankUpConfig.OpenStar
|
||||
curHeroData.star=curHeroData.star
|
||||
end
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
else
|
||||
if msg then
|
||||
curHeroData.lv=msg.targetLevel
|
||||
--Log("后端更新猎妖师技术前端刷新界面 "..msg.targetLevel)
|
||||
else
|
||||
curHeroData.lv=curHeroData.lv + 1
|
||||
end
|
||||
-- curHeroData.lv=curHeroData.lv
|
||||
--PopupTipPanel.ShowTip("升级成功!")
|
||||
end
|
||||
-- end
|
||||
-- end
|
||||
--Log("刷新英雄库里单个英雄数据 "..curHeroData.dynamicId.." "..curHeroData.lv.." "..curHeroData.star.." "..curHeroData.breakId.." "..curHeroData.upStarId)
|
||||
--刷新英雄库里单个英雄数据
|
||||
if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
this.lvUpGoImage:SetActive(false)
|
||||
-- 突破音效
|
||||
PlaySoundWithoutClick(SoundConfig.Sound_Breach)
|
||||
else
|
||||
this.lvUpGoImage:SetActive(true)
|
||||
-- 升级音效
|
||||
PlaySoundWithoutClick(SoundConfig.Sound_Upgrade)
|
||||
end
|
||||
HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId,curHeroData.lv,curHeroData.star,curHeroData.breakId,curHeroData.upStarId,isSingleLvUp)
|
||||
local allAddProValOld = allAddProVal
|
||||
parent:UpdateHeroInfoData()--刷新界面
|
||||
this.ShowProAddVal(allAddProValOld)
|
||||
|
||||
parent.upLvEffect:SetActive(false)
|
||||
parent.upLvEffect:SetActive(true)
|
||||
_isReqLvUp = false
|
||||
end
|
||||
|
||||
--连续升级更新后端英雄数据
|
||||
function RoleInfoLayout:DeleteLvUpMaterials2(msg)
|
||||
for i, v in pairs(herodatas) do
|
||||
if curHeroData == v then
|
||||
if msg then
|
||||
curHeroData.lv=msg.targetLevel
|
||||
--Log("后端更新猎妖师技术前端刷新界面 "..msg.targetLevel)
|
||||
end
|
||||
v.lv=curHeroData.lv
|
||||
end
|
||||
end
|
||||
HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId,curHeroData.lv,curHeroData.star,curHeroData.breakId,curHeroData.upStarId,true)
|
||||
parent:UpdateHeroInfoData()--刷新界面
|
||||
end
|
||||
--长按升级处理
|
||||
function this.OnUpdate()
|
||||
if _isClicked then
|
||||
if Time.realtimeSinceStartup - RoleInfoLayout.timePressStarted > 0.4 then
|
||||
_isLongPress = true
|
||||
if not _isReqLvUp then
|
||||
_isReqLvUp = true
|
||||
this:LvUpClick(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--播放升级 属性提升动画
|
||||
function this.ShowProAddVal(allAddProValOld)
|
||||
this.lvUpGo:SetActive(true)
|
||||
Util.GetGameObject(lvUpShowProList[1], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.Attack]-allAddProValOld[HeroProType.Attack]
|
||||
Util.GetGameObject(lvUpShowProList[2], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.Hp]-allAddProValOld[HeroProType.Hp]
|
||||
Util.GetGameObject(lvUpShowProList[3], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.PhysicalDefence]-allAddProValOld[HeroProType.PhysicalDefence]
|
||||
Util.GetGameObject(lvUpShowProList[4], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.MagicDefence]-allAddProValOld[HeroProType.MagicDefence]
|
||||
--Util.GetGameObject(lvUpShowProList[5], "proPre/vale"):GetComponent("Text").text="+"..allAddProVal[HeroProType.Speed]-allAddProValOld[HeroProType.Speed]
|
||||
this.ThreadShowProAddVal()
|
||||
end
|
||||
function this.ThreadShowProAddVal()
|
||||
if this.priThread then
|
||||
coroutine.stop(this.priThread)
|
||||
this.priThread = nil
|
||||
end
|
||||
table.walk(lvUpShowProList, function(privilegeItem)
|
||||
privilegeItem:SetActive(false)
|
||||
end)
|
||||
this.priThread = coroutine.start(function()
|
||||
for i = 1, 4 do
|
||||
lvUpShowProList[i]:SetActive(false)
|
||||
PlayUIAnims(lvUpShowProList[i])
|
||||
coroutine.wait(0.04)
|
||||
lvUpShowProList[i]:SetActive(true)
|
||||
coroutine.wait(0.08)
|
||||
end
|
||||
this.lvUpGo:SetActive(false)
|
||||
end)
|
||||
end
|
||||
function RoleInfoLayout:OnHide()
|
||||
this.gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
function RoleInfoLayout:OnClose()
|
||||
FixedUpdateBeat:Remove(this.OnUpdate, self)
|
||||
if this.priThread then
|
||||
coroutine.stop(this.priThread)
|
||||
this.priThread = nil
|
||||
end
|
||||
end
|
||||
|
||||
function RoleInfoLayout:OnDestroy()
|
||||
this.pinjieList={}
|
||||
end
|
||||
return RoleInfoLayout
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2c7478fc02575d246905c4035d39c134
|
||||
timeCreated: 1545907222
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dddbd933727a93e47a8b47ad5771fa5b
|
||||
guid: 21ee34cbd887ead468ebc4062ad6c8ef
|
||||
timeCreated: 1545907222
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,623 @@
|
|||
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
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: c2e3cbf6886c5e74a8b1c3ee29ff52ef
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: dddbd933727a93e47a8b47ad5771fa5b
|
||||
timeCreated: 1545907222
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,128 @@
|
|||
require("Base/BasePanel")
|
||||
RoleSkinPanel = Inherit(BasePanel)
|
||||
local this = RoleSkinPanel
|
||||
local porpertyConfigs = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
||||
local artResConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
||||
local skinPres = {}
|
||||
local porpertys = {}
|
||||
local curHeroData = {}
|
||||
local skins = {}
|
||||
local parent = {}
|
||||
|
||||
function RoleSkinPanel:InitComponent(gameObject)
|
||||
this.gameObject = gameObject
|
||||
this.skinPre = Util.GetGameObject(gameObject,"skinPre")
|
||||
this.Select = Util.GetGameObject(gameObject,"selectLight")
|
||||
this.skinGrid = Util.GetGameObject(gameObject,"skinGrid")
|
||||
for i = 1, this.skinGrid.transform.childCount do
|
||||
skinPres[i] = this.skinGrid.transform:GetChild(i - 1)
|
||||
end
|
||||
return this
|
||||
end
|
||||
|
||||
function RoleSkinPanel:BindEvent()
|
||||
end
|
||||
|
||||
--界面打开时调用
|
||||
function RoleSkinPanel:OnShow(_sortinglayer,parent,curHerodata)
|
||||
curHeroData = curHerodata
|
||||
parent = parent
|
||||
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.HeroSkin,"HeroId",curHeroData.id)
|
||||
local skins = {}
|
||||
for i = 1 ,#configs do
|
||||
if not skins[configs[i].Type] then
|
||||
skins[configs[i].Type] = configs[i]
|
||||
end
|
||||
end
|
||||
for k,v in ipairs(skinPres) do
|
||||
v.gameObject:SetActive(false)
|
||||
end
|
||||
local index = 1
|
||||
for i,v in pairs(skins) do
|
||||
if not skinPres[index] then
|
||||
skinPres[index] = newObjToParent(self.skinPre,self.skinGrid)
|
||||
end
|
||||
skinPres[index].gameObject:SetActive(true)
|
||||
self:SetSingleData(skinPres[index],v)
|
||||
index = index + 1
|
||||
end
|
||||
end
|
||||
|
||||
function RoleSkinPanel:SetSingleData(go,data)
|
||||
LogGreen("皮肤Id:"..data.Type)
|
||||
local icon = Util.GetGameObject(go,"skinIcon"):GetComponent("Image")
|
||||
local lock = Util.GetGameObject(go,"skinState/Off")
|
||||
local infoPre = Util.GetGameObject(go,"skinInfo/infoPre")
|
||||
local infoGrid = Util.GetGameObject(go,"skinInfo/grid")
|
||||
local skinName = Util.GetGameObject(go,"skinName/name"):GetComponent("Text")
|
||||
skinName.text = data.ReadingName
|
||||
icon.sprite = Util.LoadSprite(artResConfig[data.Painting].Name)
|
||||
if not porpertys then
|
||||
porpertys = {}
|
||||
end
|
||||
if not porpertys[go] then
|
||||
porpertys[go] = {}
|
||||
end
|
||||
for i = 1, infoGrid.transform.childCount do
|
||||
porpertys[go][i] = infoGrid.transform:GetChild(i - 1)
|
||||
porpertys[go][i].gameObject:SetActive(false)
|
||||
end
|
||||
if HeroSkinManager.IsExist(data.Type) or data.IsDefault == 1 then
|
||||
if data.MonomerProperty and #data.MonomerProperty > 0 then
|
||||
for i = 1, #data.MonomerProperty do
|
||||
if not porpertys[go][i] then
|
||||
porpertys[go][i] = newObjToParent(infoPre,infoGrid)
|
||||
end
|
||||
porpertys[go][i].gameObject:SetActive(true)
|
||||
local tempProData = porpertyConfigs[data.MonomerProperty[i][1]]
|
||||
Util.GetGameObject(porpertys[go][i],"info"):GetComponent("Text").text = tempProData.Info .. "+" ..GetPropertyFormatStr(tempProData.Style,data.MonomerProperty[i][2])
|
||||
porpertys[go][i]:GetComponent("Button").enabled = false
|
||||
end
|
||||
end
|
||||
lock.gameObject:SetActive(false)
|
||||
else
|
||||
if not porpertys[go][1] then
|
||||
porpertys[go][1] = newObjToParent(infoPre,infoGrid)
|
||||
end
|
||||
porpertys[go][1].gameObject:SetActive(true)
|
||||
Util.GetGameObject(porpertys[go][1],"info"):GetComponent("Text").text = "获取途径"
|
||||
Util.AddOnceClick(porpertys[go][1].gameObject,function()
|
||||
end)
|
||||
lock.gameObject:SetActive(true)
|
||||
end
|
||||
if data.Type == curHeroData.skinId or (curHeroData.skinId == 0 and data.IsDefault == 1) then
|
||||
self.Select.transform:SetParent(Util.GetGameObject(go,"skinState").transform)
|
||||
self.Select:GetComponent("RectTransform").localPosition = Vector3.zero
|
||||
elseif HeroSkinManager.IsExist(data.Type) or data.IsDefault == 1 then
|
||||
local changeSkinId = data.IsDefault == 1 and 0 or data.Type
|
||||
Util.AddOnceClick(go.gameObject,function()
|
||||
NetManager.ChangeHeroSkin(curHeroData.dynamicId,changeSkinId,function()
|
||||
poolManager:UnLoadLive(curHeroData.live, parent.curLiveObj)
|
||||
HeroManager.ChangeSkinId(curHeroData.dynamicId,changeSkinId)
|
||||
curHeroData = HeroManager.GetSingleHeroData(curHeroData.dynamicId)
|
||||
parent.curLiveObj = HeroManager.LoadHerolive(curHeroData,parent.curObj)
|
||||
PopupTipPanel.ShowTip("已更换皮肤!")
|
||||
this:OnOpen(curHeroData,skins,parent)
|
||||
end)
|
||||
end)
|
||||
else
|
||||
Util.AddOnceClick(go.gameObject,function()
|
||||
poolManager:UnLoadLive(curHeroData.live, parent.curLiveObj)
|
||||
parent.curLiveObj = poolManager:LoadLive(GetResourcePath(data.Live), parent.curObj.transform,
|
||||
Vector3.one * data.Scale, Vector3.New(data.Position[1], data.Position[2], 0))
|
||||
PopupTipPanel.ShowTip("未获得此皮肤!")
|
||||
end)
|
||||
end
|
||||
end
|
||||
function RoleSkinPanel:OnHide()
|
||||
this.gameObject:SetActive(false)
|
||||
end
|
||||
function RoleSkinPanel:OnClose()
|
||||
|
||||
end
|
||||
function RoleSkinPanel:OnDestroy()
|
||||
skinPres = {}
|
||||
porpertys = {}
|
||||
curHeroData = {}
|
||||
end
|
||||
return RoleSkinPanel
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: cfaf0b227e32fd24aaf52196024ba41d
|
||||
timeCreated: 1545907222
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
require("Base/BasePanel")
|
||||
RoleStoryLayout = Inherit(BasePanel)
|
||||
local this = RoleStoryLayout
|
||||
local curHeroData--当前英雄信息
|
||||
|
||||
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
local heroRankupConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
|
||||
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
||||
local heroSkinConfig = ConfigManager.GetConfig(ConfigName.HeroSkin)
|
||||
|
||||
--初始化组件(用于子类重写)
|
||||
function RoleStoryLayout:InitComponent(gameObject)
|
||||
this.gameObject = gameObject
|
||||
this.infoTextStory = Util.GetGameObject(gameObject,"infoBg/infoRect/infoText"):GetComponent("Text")
|
||||
return this
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
function RoleStoryLayout:BindEvent()
|
||||
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function RoleStoryLayout:AddListener()
|
||||
|
||||
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function RoleStoryLayout:RemoveListener()
|
||||
|
||||
|
||||
end
|
||||
|
||||
function RoleStoryLayout:OnSortingOrderChange()
|
||||
|
||||
end
|
||||
|
||||
function RoleStoryLayout:OnShow(_sortinglayer,_parent,_curHerodata)
|
||||
this.gameObject:SetActive(true)
|
||||
curHeroData = _curHerodata
|
||||
this.infoTextStory:GetComponent("RectTransform").anchoredPosition = Vector2.New(-2, 0)
|
||||
local stroyStr = string.gsub(curHeroData.heroConfig.HeroStory,"#","\n")
|
||||
this.infoTextStory.text = string.gsub(stroyStr,"|"," ")--传记
|
||||
end
|
||||
|
||||
function RoleStoryLayout:OnHide()
|
||||
this.gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
function RoleStoryLayout:OnClose()
|
||||
|
||||
end
|
||||
|
||||
function RoleStoryLayout:OnDestroy()
|
||||
|
||||
end
|
||||
|
||||
return RoleStoryLayout
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ac1578927f2f8394fa17db6d56ebc30b
|
||||
timeCreated: 1545907222
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
|
@ -0,0 +1,447 @@
|
|||
require("Base/BasePanel")
|
||||
this = Inherit(BasePanel)
|
||||
local this = this
|
||||
|
||||
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 isUpStarMaterials=true--升星 材料是否充足
|
||||
local curSelectUpStarData--当前选择升星坑位的数据
|
||||
local curSelectUpStarGo--当前选择升星坑位的预设
|
||||
local upStarConsumeMaterial={}--升星消耗的英雄组 {{1坑位英雄信息}{2坑位英雄信息}{}}
|
||||
local upStarMaterialIsAll={}--升星消耗的英雄组是否满足 {{1满足}{2不满足}{}}
|
||||
local isHeroUpStar=false--是否可升星
|
||||
|
||||
local upStarRankUpConfig={}--即将要升星的数据
|
||||
local curStarRankUpConfig={}--当前升星的数据
|
||||
local curHeroData--当前英雄信息
|
||||
local parent = {}
|
||||
local upStarPreList = {}
|
||||
local heroDatas = {}
|
||||
local isUpZhen = false
|
||||
local allAddProVal = {}
|
||||
--初始化组件(用于子类重写)
|
||||
function this:InitComponent(gameObject)
|
||||
this.gameObject = gameObject
|
||||
this.upStar=Util.GetGameObject(gameObject,"upStar")
|
||||
this.noUpStarText=Util.GetGameObject(gameObject,"noUpStarText")
|
||||
this.upStarPre=Util.GetGameObject(this.upStar,"upStarPre")
|
||||
this.upStarGrid=Util.GetGameObject(this.upStar,"grid")
|
||||
this.upStarBtn=Util.GetGameObject(this.upStar,"btns/upStarBtn")
|
||||
this.upStarBtnRedPoint=Util.GetGameObject(this.upStar,"btns/upStarBtn/redPoint")
|
||||
this.goldBtn=Util.GetGameObject(this.upStar,"goldGrid/gold")
|
||||
this.goldText=Util.GetGameObject(this.upStar,"goldGrid/gold/Text"):GetComponent("Text")
|
||||
this.goldImage=Util.GetGameObject(this.upStar,"goldGrid/gold")
|
||||
this.gold2Btn=Util.GetGameObject(this.upStar,"goldGrid/gold2")
|
||||
this.gold2Text=Util.GetGameObject(this.upStar,"goldGrid/gold2/Text"):GetComponent("Text")
|
||||
this.gold2Image=Util.GetGameObject(this.upStar,"goldGrid/gold2")
|
||||
this.roleUpStarLayoutTip=Util.GetGameObject(this.upStar,"tip"):GetComponent("Text")
|
||||
this.roleUpStarRedPoint=Util.GetGameObject(gameObject,"rolePanel/btnList/btnUpStar/redPoint")
|
||||
this.goCompoundHero=Util.GetGameObject(this.upStar.transform, "goCompoundHero")
|
||||
Util.GetGameObject(this.upStar.transform, "goCompoundHero/Text"):GetComponent("Text").text = Language[12290]
|
||||
--升星属性
|
||||
this.curStarGrid = Util.GetGameObject(this.upStar.transform, "upStarProInfo/curStarGrid")
|
||||
this.nextStarGrid = Util.GetGameObject(this.upStar.transform, "upStarProInfo/nextStarGrid")
|
||||
this.skillInfoGrid = Util.GetGameObject(this.upStar.transform, "upStarProInfo/skillInfo")
|
||||
this.skillInfoGrid:SetActive(false)
|
||||
this.atkPro_UpStar=Util.GetGameObject(gameObject,"upStar/upStarProInfo/pro/atk")
|
||||
this.hpPro_UpStar=Util.GetGameObject(gameObject,"upStar/upStarProInfo/pro/hp")
|
||||
this.phyDef_UpStar=Util.GetGameObject(gameObject,"upStar/upStarProInfo/pro/phyDef")
|
||||
this.magDef_UpStar=Util.GetGameObject(gameObject,"upStar/upStarProInfo/pro/magDef")
|
||||
this.lv_UpStar=Util.GetGameObject(gameObject,"upStar/upStarProInfo/pro/lv/proValue"):GetComponent("Text")
|
||||
this.nextlv_UpStar=Util.GetGameObject(gameObject,"upStar/upStarProInfo/pro/lv/nextproValue"):GetComponent("Text")
|
||||
return this
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
function this:BindEvent()
|
||||
--升星
|
||||
Util.AddClick(this.upStarBtn, function()
|
||||
self:StarUpClick()
|
||||
end)
|
||||
--前往化虚坛
|
||||
Util.AddClick(this.goCompoundHero, function()
|
||||
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.COMPOUND_HERO) then
|
||||
JumpManager.GoJump(750001)
|
||||
else
|
||||
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.COMPOUND_HERO))
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
function this:AddListener()
|
||||
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.UpdateHeroUpStarMaterialShow)
|
||||
end
|
||||
--移除事件监听(用于子类重写)
|
||||
function this:RemoveListener()
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold,this.UpdateHeroUpStarMaterialShow)
|
||||
end
|
||||
|
||||
function this:OnShow(_sortinglayer,_parent,_curHerodata,_isUpZhen,_heroDatas)
|
||||
this.gameObject:SetActive(true)
|
||||
this.sortingOrder = _sortinglayer
|
||||
curHeroData = _curHerodata
|
||||
parent = _parent
|
||||
heroDatas = _heroDatas
|
||||
isUpZhen = _isUpZhen
|
||||
this:GetCurHeroUpLvOrUpStarSData()
|
||||
this:UpdateHeroUpStarData()--进阶
|
||||
end
|
||||
|
||||
--更新英雄进阶数据
|
||||
function this:UpdateHeroUpStarData()
|
||||
--进阶材料
|
||||
this:UpdateHeroUpStarMaterialShow()
|
||||
|
||||
--计算面板属性
|
||||
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
|
||||
--进阶属性提升
|
||||
if upStarRankUpConfig and upStarRankUpConfig.Id then
|
||||
this:UpdateHeroUpStarProUpShow()
|
||||
end
|
||||
--进阶吞英雄条件
|
||||
Util.ClearChild(this.upStarGrid.transform)
|
||||
local curUpStarData= HeroManager.GetHeroCurUpStarInfo(curHeroData.dynamicId)
|
||||
if curUpStarData and #curUpStarData>0 then
|
||||
this.upStar:SetActive(true)
|
||||
this.noUpStarText:SetActive(false)
|
||||
parent.talentTipStrGo:SetActive(true)
|
||||
upStarConsumeMaterial={}
|
||||
upStarMaterialIsAll = {}
|
||||
upStarPreList = {}
|
||||
this.goCompoundHero:SetActive(curHeroData.star == 4 or curHeroData.star == 5)
|
||||
for i = 1, #curUpStarData do
|
||||
local go=newObject(this.upStarPre)
|
||||
go.transform:SetParent(this.upStarGrid.transform)
|
||||
go.transform.localScale = Vector3.one
|
||||
go.transform.localPosition=Vector3.zero;
|
||||
go:SetActive(true)
|
||||
go.transform.name = "upStarPre"..i
|
||||
upStarPreList[i] = go
|
||||
upStarConsumeMaterial[i]={}
|
||||
upStarMaterialIsAll[i]=2
|
||||
Util.GetGameObject(go.transform, "iconbg/proImage"):SetActive(false)
|
||||
if curUpStarData[i].upStarMaterialsData.Issame==1 or curUpStarData[i].upStarMaterialsData.IsId>0 then
|
||||
Util.GetGameObject(go.transform,"iconDefault"):SetActive(false)
|
||||
Util.GetGameObject(go.transform,"icon"):SetActive(true)
|
||||
Util.GetGameObject(go.transform, "iconbg/proImage"):SetActive(true)
|
||||
Util.GetGameObject(go.transform, "iconbg/proImage"):GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName))
|
||||
if curUpStarData[i].upStarMaterialsData.Issame==1 then
|
||||
Util.GetGameObject(go.transform,"icon"):GetComponent("Image").sprite=Util.LoadSprite(GetResourcePath(curHeroData.heroConfig.Icon))
|
||||
Util.GetGameObject(go.transform,"frame"):GetComponent("Image").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(curHeroData.heroConfig.Quality, curUpStarData[i].upStarMaterialsData.StarLimit))
|
||||
Util.GetGameObject(go.transform, "iconbg/proImage"):GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName))
|
||||
elseif curUpStarData[i].upStarMaterialsData.IsId>0 then
|
||||
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, curUpStarData[i].upStarMaterialsData.IsId)
|
||||
Util.GetGameObject(go.transform,"icon"):GetComponent("Image").sprite=Util.LoadSprite(GetResourcePath(heroConfig.Icon))
|
||||
Util.GetGameObject(go.transform,"frame"):GetComponent("Image").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(heroConfig.Quality, curUpStarData[i].upStarMaterialsData.StarLimit))
|
||||
Util.GetGameObject(go.transform, "iconbg/proImage"):GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
|
||||
end
|
||||
else
|
||||
if curUpStarData[i].upStarMaterialsData.IsSameClan ==1 then
|
||||
Util.GetGameObject(go.transform, "iconbg/proImage"):SetActive(true)
|
||||
Util.GetGameObject(go.transform, "iconbg/proImage"):GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName))
|
||||
end
|
||||
Util.GetGameObject(go.transform,"iconDefault"):SetActive(true)
|
||||
Util.GetGameObject(go.transform,"icon"):SetActive(false)
|
||||
Util.GetGameObject(go.transform,"frame"):GetComponent("Image").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(nil,curUpStarData[i].upStarMaterialsData.StarLimit))
|
||||
--
|
||||
end
|
||||
local upStarHeroListData=HeroManager.GetUpStarHeroListData(curUpStarData[i].upStarMaterialsData.Id,curHeroData)
|
||||
if upStarHeroListData.state>0 then
|
||||
Util.GetGameObject(go.transform,"add/add"):SetActive(true)
|
||||
else
|
||||
Util.GetGameObject(go.transform,"add/add"):SetActive(false)
|
||||
end
|
||||
Util.GetGameObject(go.transform,"num"):GetComponent("Text").text=string.format("<color=#FF0000FF>%s/%s</color>",0,curUpStarData[i].upStarData[4])
|
||||
SetHeroStars(Util.GetGameObject(go.transform, "iconbg/starGrid"), curUpStarData[i].upStarMaterialsData.StarLimit,1,nil,-15.3)
|
||||
local addBtn=Util.GetGameObject(go.transform,"add")
|
||||
Util.AddOnceClick(addBtn, function()
|
||||
curSelectUpStarData=curUpStarData[i]
|
||||
curSelectUpStarGo=go
|
||||
local curShowHeroListData=self:SetShowHeroListData(upStarConsumeMaterial,upStarHeroListData.heroList)
|
||||
--参数1 显示的herolist 2 3 升当前星的规则 4 打开RoleUpStarListPanel的界面
|
||||
UIManager.OpenPanel(UIName.RoleUpStarListPanel,curShowHeroListData,curUpStarData[i].upStarMaterialsData,curUpStarData[i].upStarData,this,upStarConsumeMaterial[i],curHeroData)
|
||||
end)
|
||||
end
|
||||
else
|
||||
this.upStar:SetActive(false)
|
||||
this.noUpStarText:SetActive(true)
|
||||
parent.talentTipStrGo:SetActive(false)
|
||||
end
|
||||
self:AutoSelectUpStarHeroList(curUpStarData)
|
||||
end
|
||||
--获取当前英雄的下一突破 和 升星 静态数据
|
||||
function this:GetCurHeroUpLvOrUpStarSData()
|
||||
isHeroUpStar = false
|
||||
upStarRankUpConfig = {}
|
||||
local heroRankUpConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
|
||||
for i, v in ConfigPairs(heroRankUpConfig) do
|
||||
if v.Star==curHeroData.heroConfig.Star then--初始星级相等
|
||||
if v.Show==2 then -- 2 升星
|
||||
if v.Id ~= curHeroData.upStarId and curHeroData.star == v.LimitStar then
|
||||
--Log("升星 "..v.Id)
|
||||
upStarRankUpConfig=v
|
||||
isHeroUpStar = true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--更新英雄进阶材料显示
|
||||
function this:UpdateHeroUpStarMaterialShow()
|
||||
--进阶金币 妖壶条件
|
||||
if upStarRankUpConfig then
|
||||
isUpStarMaterials=true
|
||||
local ConsumeMaterial=upStarRankUpConfig.ConsumeMaterial
|
||||
if ConsumeMaterial and #ConsumeMaterial>=2 then
|
||||
if ConsumeMaterial[1][2]>0 then
|
||||
this.goldImage:SetActive(true)
|
||||
this.goldImage:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(itemConfig[ConsumeMaterial[1][1]].ResourceID))
|
||||
if BagManager.GetItemCountById(ConsumeMaterial[1][1])<ConsumeMaterial[1][2] then
|
||||
isUpStarMaterials=false
|
||||
this.goldText.text=string.format("<color=#FF0000FF>%s</color>",ConsumeMaterial[1][2])
|
||||
else
|
||||
this.goldText.text=string.format("<color=#FFFFFFFF>%s</color>",ConsumeMaterial[1][2])
|
||||
end
|
||||
Util.AddOnceClick(this.goldBtn,function()
|
||||
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,ConsumeMaterial[1][1])
|
||||
end)
|
||||
else
|
||||
this.goldImage:SetActive(false)
|
||||
end
|
||||
if ConsumeMaterial[2][2]>0 then
|
||||
this.gold2Image:SetActive(true)
|
||||
this.gold2Image:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(itemConfig[ConsumeMaterial[2][1]].ResourceID))
|
||||
if BagManager.GetItemCountById(ConsumeMaterial[2][1])<ConsumeMaterial[2][2] then
|
||||
isUpStarMaterials=false
|
||||
this.gold2Text.text=string.format("<color=#FF0000FF>%s</color>",ConsumeMaterial[2][2])
|
||||
else
|
||||
this.gold2Text.text=string.format("<color=#FFFFFFFF>%s</color>",ConsumeMaterial[2][2])
|
||||
end
|
||||
Util.AddOnceClick(this.gold2Btn,function()
|
||||
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,ConsumeMaterial[2][1])
|
||||
end)
|
||||
else
|
||||
this.gold2Image:SetActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--进阶属性提升
|
||||
function this:UpdateHeroUpStarProUpShow()
|
||||
if upStarRankUpConfig and upStarRankUpConfig.Id then
|
||||
local size = Vector2.New (45,45)
|
||||
SetHeroStars(this.curStarGrid, curHeroData.star,2,size,-9)
|
||||
SetHeroStars(this.nextStarGrid, curHeroData.star + 1,2,size,-9)
|
||||
--this.curLvEnd.text = HeroManager.GetCurHeroStarLvEnd(1,curHeroData)
|
||||
--this.nextLvEnd.text = HeroManager.GetCurHeroStarLvEnd(2,curHeroData,curHeroData.breakId,upStarRankUpConfig.Id)
|
||||
local nextUpStarConFig = ConfigManager.GetConfigData(ConfigName.HeroRankupConfig,upStarRankUpConfig.Id)
|
||||
local nextProUpVal = 0
|
||||
if nextUpStarConFig then nextProUpVal = nextUpStarConFig.PropertiesDisplay end
|
||||
--this.proUpVal.text = GetPropertyFormatStr(2, nextProUpVal)
|
||||
--this.UpdateHeroUpStarProUpSkillShow(this.skillInfoGrid,self:NextStarUpSkillTabs())
|
||||
|
||||
local nextallAddProVal=HeroManager.CalculateHeroAllProValList(2,curHeroData.dynamicId,false,curHeroData.breakId,upStarRankUpConfig.Id)
|
||||
this:ProShow(this.atkPro_UpStar,allAddProVal,HeroProType.Attack,nextallAddProVal)
|
||||
this:ProShow(this.hpPro_UpStar,allAddProVal,HeroProType.Hp,nextallAddProVal)
|
||||
this:ProShow(this.phyDef_UpStar,allAddProVal,HeroProType.PhysicalDefence,nextallAddProVal)
|
||||
this:ProShow(this.magDef_UpStar,allAddProVal,HeroProType.MagicDefence,nextallAddProVal)
|
||||
this.lv_UpStar.text= HeroManager.GetCurHeroStarLvEnd(1,curHeroData)
|
||||
this.nextlv_UpStar.text= HeroManager.GetCurHeroStarLvEnd(2,curHeroData,curHeroData.breakId,upStarRankUpConfig.Id)
|
||||
end
|
||||
end
|
||||
function this:ProShow(go,allAddProVal,HeroProType,nextallAddProVal)
|
||||
local curProSConFig = ConfigManager.GetConfigData(ConfigName.PropertyConfig,HeroProType)
|
||||
Util.GetGameObject(go,"proName"):GetComponent("Text").text = curProSConFig.Info..":"
|
||||
Util.GetGameObject(go,"proValue"):GetComponent("Text").text = allAddProVal[HeroProType]
|
||||
Util.GetGameObject(go,"Image"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(propertyConfig[HeroProType].PropertyIcon))
|
||||
if nextallAddProVal then
|
||||
Util.GetGameObject(go,"nextproValue"):GetComponent("Text").text = nextallAddProVal[HeroProType]
|
||||
end
|
||||
end
|
||||
--升星选择祭品后刷新界面
|
||||
function this:AutoSelectUpStarHeroList(_curUpStarData)
|
||||
local curUpStarData= _curUpStarData
|
||||
if curUpStarData and #curUpStarData>0 then
|
||||
for i = 1, #curUpStarData do
|
||||
curSelectUpStarData=curUpStarData[i]
|
||||
curSelectUpStarGo=upStarPreList[i]
|
||||
local upStarHeroListData=HeroManager.GetUpStarHeroListData(curUpStarData[i].upStarMaterialsData.Id,curHeroData)
|
||||
local curSelectHeroList = {}
|
||||
if curUpStarData[i].upStarMaterialsData.Issame ==1
|
||||
or curUpStarData[i].upStarMaterialsData.IsId > 0
|
||||
or (curUpStarData[i].upStarMaterialsData.IsSameClan == 1
|
||||
and curUpStarData[i].upStarMaterialsData.StarLimit == 3
|
||||
and curHeroData.heroConfig.Qualiy ~= 3) then
|
||||
if LengthOfTable(upStarHeroListData.heroList) >= curUpStarData[i].upStarData[4] then
|
||||
for i = 1, curUpStarData[i].upStarData[4] do
|
||||
if upStarHeroListData.heroList[i].lockState == 0 and upStarHeroListData.heroList[i].isFormation == "" then
|
||||
table.insert(curSelectHeroList,upStarHeroListData.heroList[i])
|
||||
end
|
||||
end
|
||||
self:UpdateUpStarPosHeroData(curSelectHeroList)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--进阶红点
|
||||
local upStarRedPointState = HeroManager.IsShowUpStarRedPoint(curHeroData)
|
||||
-- this.roleUpStarRedPoint:SetActive(upStarRedPointState)
|
||||
-- this.upStarBtnRedPoint:SetActive(upStarRedPointState)
|
||||
end
|
||||
|
||||
|
||||
--刷新当前升星坑位英雄的信息
|
||||
function this:UpdateUpStarPosHeroData(curSelectHeroList)
|
||||
if LengthOfTable(curSelectHeroList)<curSelectUpStarData.upStarData[4] then
|
||||
upStarMaterialIsAll[curSelectUpStarData.upStarData[2]]=2
|
||||
Util.GetGameObject(curSelectUpStarGo.transform,"add/add"):SetActive(true)
|
||||
local upStarHeroListData=HeroManager.GetUpStarHeroListData(curSelectUpStarData.upStarMaterialsData.Id,curHeroData)
|
||||
if upStarHeroListData.state<=0 then
|
||||
Util.GetGameObject(curSelectUpStarGo.transform,"add/add"):SetActive(false)
|
||||
end
|
||||
Util.GetGameObject(curSelectUpStarGo.transform,"num"):GetComponent("Text").text=string.format("<color=#FF0000FF>%s/%s</color>", LengthOfTable(curSelectHeroList),curSelectUpStarData.upStarData[4])
|
||||
else
|
||||
upStarMaterialIsAll[curSelectUpStarData.upStarData[2]]=1
|
||||
Util.GetGameObject(curSelectUpStarGo.transform,"add/add"):SetActive(false)
|
||||
Util.GetGameObject(curSelectUpStarGo.transform,"num"):GetComponent("Text").text=string.format("<color=#FFFFFFFF>%s/%s</color>", LengthOfTable(curSelectHeroList),curSelectUpStarData.upStarData[4])
|
||||
end
|
||||
local curUpStarConsumeMaterial={}
|
||||
for i, v in pairs(curSelectHeroList) do
|
||||
table.insert(curUpStarConsumeMaterial,v.dynamicId)
|
||||
end
|
||||
upStarConsumeMaterial[curSelectUpStarData.upStarData[2]]=curUpStarConsumeMaterial
|
||||
for i = 1, #upStarConsumeMaterial do
|
||||
--Log("选择升星位置的英雄数量 "..#upStarConsumeMaterial[i])
|
||||
if #upStarConsumeMaterial[i]>0 then
|
||||
for j = 1, #upStarConsumeMaterial[i] do
|
||||
--Log("选择升星位置的英雄都有谁 "..upStarConsumeMaterial[i][j])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--分析设置升星界面显示的英雄list数据 如果当前升星材料的坑位的英雄数据与 以其他坑位有重合并且选择上的英雄不显示 如果是当前坑位显示的英雄显示对勾
|
||||
function this:SetShowHeroListData(upStarConsumeMaterial,curHeroList)--1 消耗的总消耗组 2 当前坑位可选择的所有英雄
|
||||
--Log("#curHeroList "..#curHeroList)
|
||||
local curEndShowHeroListData2={}
|
||||
for i = 1, #curHeroList do
|
||||
table.insert(curEndShowHeroListData2,curHeroList[i])
|
||||
end
|
||||
local curEndShowHeroListData={}
|
||||
for i, v in pairs(curEndShowHeroListData2) do
|
||||
v.isSelect=2
|
||||
table.insert(curEndShowHeroListData,v)
|
||||
end
|
||||
for j = 1, #upStarConsumeMaterial do
|
||||
if upStarConsumeMaterial[j] and #upStarConsumeMaterial[j]>0 then
|
||||
for k = 1, #upStarConsumeMaterial[j] do
|
||||
if j==curSelectUpStarData.upStarData[2] then--curSelectUpStarData 当前坑位选择的英雄信息
|
||||
for _, v in pairs(curEndShowHeroListData) do
|
||||
if v.dynamicId==upStarConsumeMaterial[j][k] then
|
||||
v.isSelect=1
|
||||
end
|
||||
end
|
||||
else
|
||||
for i, v in pairs(curEndShowHeroListData) do
|
||||
if v.dynamicId==upStarConsumeMaterial[j][k] then
|
||||
curEndShowHeroListData[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local curList={}
|
||||
for _, v in pairs(curEndShowHeroListData) do
|
||||
table.insert(curList,v)
|
||||
end
|
||||
return curList
|
||||
end
|
||||
--进阶按钮点击事件处理
|
||||
function this:StarUpClick()
|
||||
if curHeroData.lv>=HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then
|
||||
PopupTipPanel.ShowTip(Language[11846])
|
||||
return
|
||||
end
|
||||
if curHeroData.lv<upStarRankUpConfig.LimitLevel then
|
||||
PopupTipPanel.ShowTip(Language[11851]..upStarRankUpConfig.LimitLevel)
|
||||
return
|
||||
end
|
||||
local isUpStarMaterialsHero=true
|
||||
for i = 1, #upStarMaterialIsAll do
|
||||
if upStarMaterialIsAll[i]==2 then
|
||||
isUpStarMaterialsHero=false
|
||||
end
|
||||
end
|
||||
if isUpStarMaterials and isUpStarMaterialsHero then
|
||||
NetManager.HeroUpStarEvent(curHeroData.dynamicId,upStarConsumeMaterial ,function (msg)
|
||||
UIManager.OpenPanel(UIName.RoleUpStarSuccessPanel,curHeroData,upStarRankUpConfig.Id,upStarRankUpConfig.OpenLevel,function ()
|
||||
local dropItemTabs = BagManager.GetTableByBackDropData(msg)
|
||||
if #dropItemTabs > 0 then
|
||||
BagManager.SetDropIsSHowEquipPrint(false)
|
||||
UIManager.OpenPanel(UIName.RewardItemPopup, msg, 1, function ()
|
||||
self:DeleteUpStarMaterials()
|
||||
end)
|
||||
else
|
||||
self:DeleteUpStarMaterials()
|
||||
end
|
||||
end)
|
||||
end)
|
||||
-- 进阶音效
|
||||
PlaySoundWithoutClick(SoundConfig.Sound_Recruit3)
|
||||
else
|
||||
PopupTipPanel.ShowTip(Language[11852])
|
||||
end
|
||||
end
|
||||
--扣除升星 消耗的材料 更新英雄数据
|
||||
function this:DeleteUpStarMaterials()
|
||||
HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId,curHeroData.lv,curHeroData.star+1,curHeroData.breakId,upStarRankUpConfig.Id,true)
|
||||
HeroManager.UpdateSingleHeroSkillData(curHeroData.dynamicId)
|
||||
for i, v in pairs(heroDatas) do
|
||||
if curHeroData == v then
|
||||
curHeroData=HeroManager.GetSingleHeroData(curHeroData.dynamicId)
|
||||
v=curHeroData
|
||||
end
|
||||
end
|
||||
--本地数据删除材料英雄
|
||||
for i = 1, #upStarConsumeMaterial do
|
||||
HeroManager.DeleteHeroDatas(upStarConsumeMaterial[i])
|
||||
end
|
||||
if HeroManager.heroListPanelProID ~= ProIdConst.All then
|
||||
heroDatas = HeroManager.GetHeroDataByProperty(HeroManager.heroListPanelProID)
|
||||
else
|
||||
heroDatas = HeroManager.GetAllHeroDatas()
|
||||
end
|
||||
if UIManager.IsOpen(UIName.RoleInfoPanel) then--当界面存在时需要刷新当前界面
|
||||
HeroManager.SortHeroDatas(heroDatas)
|
||||
parent:OnOpen(curHeroData, heroDatas,isUpZhen)
|
||||
parent:OnShow()
|
||||
end
|
||||
end
|
||||
function this:OnSortingOrderChange()
|
||||
|
||||
end
|
||||
|
||||
function this:OnHide()
|
||||
this.gameObject:SetActive(false)
|
||||
end
|
||||
|
||||
function this:OnClose()
|
||||
|
||||
end
|
||||
|
||||
function this:OnDestroy()
|
||||
upStarPreList = {}
|
||||
end
|
||||
|
||||
return this
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
fileFormatVersion: 2
|
||||
guid: fd7aef2b2e5152b4598cc7edd7fee598
|
||||
timeCreated: 1545907222
|
||||
licenseType: Pro
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
Reference in New Issue