parent
aa82e7f13f
commit
b37b584d68
File diff suppressed because it is too large
Load Diff
|
|
@ -35,9 +35,11 @@ function PokemonInfoPanel:InitComponent()
|
|||
|
||||
this.live2dRoot = Util.GetGameObject(self.gameObject, "live2dRoot")
|
||||
this.bg = Util.GetGameObject(self.gameObject, "bg")
|
||||
this.starGrid = Util.GetGameObject(self.transform, "rolePanel/info/sartAndLvLayout")
|
||||
this.starGrid = Util.GetGameObject(self.transform, "starGrid")
|
||||
|
||||
this.heroName = Util.GetGameObject(self.transform, "rolePanel/info/nameAndPossLayout/heroName"):GetComponent("Text")
|
||||
this.namne = Util.GetGameObject(self.transform, "nameInfo/nameText"):GetComponent("Text")
|
||||
this.sortText = Util.GetGameObject(self.transform, "nameInfo/sortText"):GetComponent("Text")
|
||||
this.upZhenImage = Util.GetGameObject(self.transform, "nameInfo/upZhenImage")
|
||||
|
||||
this.leftBtn = Util.GetGameObject(self.transform, "leftBtn/GameObject")
|
||||
this.rightBtn = Util.GetGameObject(self.transform, "rightBtn/GameObject")
|
||||
|
|
@ -50,7 +52,7 @@ function PokemonInfoPanel:InitComponent()
|
|||
this.replaceBtn=Util.GetGameObject(self.transform,"replaceBtn")
|
||||
this.restBtn=Util.GetGameObject(self.transform,"restBtn")
|
||||
|
||||
selthisf.dragView = SubUIManager.Open(SubUIConfig.DragView, self.gameObject.transform)
|
||||
this.dragView = SubUIManager.Open(SubUIConfig.DragView, self.gameObject.transform)
|
||||
this.dragView.transform:SetSiblingIndex(1)
|
||||
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft})
|
||||
screenAdapte(self.bg)
|
||||
|
|
@ -65,7 +67,6 @@ function PokemonInfoPanel:InitComponent()
|
|||
this.contents[i].view:InitComponent(Util.GetGameObject(self.gameObject, "layout"))
|
||||
end
|
||||
end
|
||||
local oldLv = 0
|
||||
--绑定事件(用于子类重写)
|
||||
function PokemonInfoPanel:BindEvent()
|
||||
for i = 1, #this.contents do
|
||||
|
|
@ -159,8 +160,6 @@ function this.SwitchView(index)
|
|||
this.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main})
|
||||
elseif index==2 then
|
||||
this.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main})
|
||||
elseif index==3 then
|
||||
this.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main})
|
||||
end
|
||||
this.RefreshHelpBtn()
|
||||
--执行子模块初始化
|
||||
|
|
|
|||
|
|
@ -44,4 +44,21 @@ function this.GetSinglePokemonData(_isZhen)
|
|||
end
|
||||
return curAllPokemonList
|
||||
end
|
||||
--移除灵兽数据
|
||||
function this.RemoveSinglePokemonData(_did)
|
||||
if not _did then return end
|
||||
if pokemons[_did] then
|
||||
pokemons[_did] = nil
|
||||
end
|
||||
end
|
||||
--获取当前所有可吞卡灵兽数据
|
||||
function this.RemoveSinglePokemonData(_id)
|
||||
local curAllPokemonList = {}
|
||||
for key, value in pairs(pokemons) do
|
||||
if value.isZhen == false and value.star <= 0 and value.lv <= 1 then
|
||||
table.insert(curAllPokemonList,value)
|
||||
end
|
||||
end
|
||||
return curAllPokemonList
|
||||
end
|
||||
return this
|
||||
|
|
@ -1,12 +1,8 @@
|
|||
----- 灵兽羁绊 -----
|
||||
----- 灵兽升级 -----
|
||||
local this = {}
|
||||
local sortingOrder=0
|
||||
local costItemList--升级突破静态材料
|
||||
local isUpLvMaterials=true--升级 突破 材料是否充足
|
||||
local isHeroUpTuPo=false--是否可突破
|
||||
local lvUpShowProList={}--升级后展示的属性提升list
|
||||
local upTuPoRankUpConfig={}--即将要突破的数据
|
||||
local curTuPoRankUpConfig={}--当前突破的数据
|
||||
|
||||
--长按升级状态
|
||||
local _isClicked = false
|
||||
|
|
@ -29,11 +25,11 @@ function this:InitComponent(gameObject)
|
|||
--技能
|
||||
this.skillIcon = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpLv/skill/icon"):GetComponent("Image")
|
||||
this.skillName = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpLv/skill/skillName"):GetComponent("Text")
|
||||
this.skillClick = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpLv/skill/skillClick")
|
||||
--属性
|
||||
for i = 1, 4 do
|
||||
for i = 1, 5 do
|
||||
proList[i] = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpLv/pro/singlePro ("..i..")")
|
||||
end
|
||||
this.allProButton=Util.GetGameObject(self.transform,"PokemonInfoPanel_UpLv/allProButton")
|
||||
|
||||
--升级
|
||||
this.upLvItemParent = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpLv/upLvItemParent")
|
||||
|
|
@ -87,7 +83,6 @@ end
|
|||
local sortingOrder = 0
|
||||
function this.OnSortingOrderChange(_sortingOrder)
|
||||
sortingOrder = _sortingOrder
|
||||
this.skillGrid:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1
|
||||
end
|
||||
function this:OnShow(...)
|
||||
this.ShowCurrPosTreasures()
|
||||
|
|
@ -107,158 +102,42 @@ function this.OnUpdate()
|
|||
end
|
||||
end
|
||||
|
||||
--更新英雄情报数据
|
||||
function this:UpdateHeroInfoData(isNeedLoadLive)
|
||||
allAddProVal=HeroManager.CalculateHeroAllProValList(1,curPokemonData.dynamicId,false)
|
||||
|
||||
--lvUpShowProList
|
||||
local curShowProList = {}
|
||||
for i = 1, #lvUpShowProList do
|
||||
this.ProShow(lvUpShowProList[i],curShowProList[i])--lv HeroProType.Attack Hp PhysicalDefence MagicDefence
|
||||
--更新英雄升级材料显示
|
||||
function this:ShowPokemonInfo()
|
||||
--属性
|
||||
local curAllPro = {}--加上等级
|
||||
for i = 1, #proList do
|
||||
if PropertyTypeIconDef[i] then
|
||||
Util.GetGameObject(proList[i], "Image"):GetComponent("Image").sprite = Util.LoadSprite(PropertyTypeIconDef[i])
|
||||
end
|
||||
Util.GetGameObject(proList[i], "proName"):GetComponent("Text").text=curAllPro[i].proName
|
||||
Util.GetGameObject(proList[i], "proValue"):GetComponent("Text").text=curAllPro[i].proValue
|
||||
end
|
||||
--技能
|
||||
this.skillIcon.sprite = Util.LoadSprite(PropertyTypeIconDef[1])
|
||||
this.skillName.text = ""
|
||||
Util.AddOnceClick(this.skillClick, function()
|
||||
|
||||
end)
|
||||
--升级消耗材料
|
||||
end
|
||||
|
||||
--长按升级结束后请求协议
|
||||
function this.LongLvUpClick(oldLv)
|
||||
NetManager.HeroLvUpEvent(curPokemonData.dynamicId,curPokemonData.lv,oldLv,function (msg)
|
||||
self:DeleteLvUpMaterials2(msg)
|
||||
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.GetCurHeroUpLvOrUpStarSData()
|
||||
isHeroUpTuPo = false
|
||||
isHeroUpStar = false
|
||||
upTuPoRankUpConfig = {}
|
||||
upStarRankUpConfig = {}
|
||||
local heroRankUpConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
|
||||
for i, v in ConfigPairs(heroRankUpConfig) do
|
||||
if v.Star==curPokemonData.heroConfig.Star then--初始星级相等
|
||||
if v.Show==1 then -- 1 突破
|
||||
if v.Id ~= curPokemonData.breakId and curPokemonData.lv == v.LimitLevel then--and curPokemonData.star == v.LimitStar
|
||||
--Log("突破 "..v.Id)
|
||||
isHeroUpTuPo = true
|
||||
upTuPoRankUpConfig = v
|
||||
end
|
||||
end
|
||||
if v.Show==2 then -- 2 升星
|
||||
if v.Id ~= curPokemonData.upStarId and curPokemonData.star == v.LimitStar then
|
||||
--Log("升星 "..v.Id)
|
||||
upStarRankUpConfig=v
|
||||
isHeroUpStar=true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
--升级按钮点击事件处理
|
||||
function this.LvUpClick(isSingleLvUp)
|
||||
--是否为最大等级
|
||||
-- LogGreen("isSingleLvUp "..tostring(isSingleLvUp))
|
||||
if curPokemonData.lv>=HeroManager.heroLvEnd[curPokemonData.heroConfig.Id] then
|
||||
PopupTipPanel.ShowTip(Language[11846])
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
return
|
||||
--各种判断能否升级
|
||||
if true then
|
||||
|
||||
end
|
||||
--如果此时需要进阶 每次都要跳转
|
||||
if isHeroUpStar and upStarRankUpConfig and curTuPoRankUpConfig and curTuPoRankUpConfig.JudgeClass==1 and curPokemonData.lv >= curTuPoRankUpConfig.OpenLevel then--当前突破全部完成
|
||||
if curStarRankUpConfig then--进阶过处理
|
||||
if curPokemonData.lv == curStarRankUpConfig.OpenLevel then
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
MsgPanel.ShowTwo(Language[11847], nil, function()
|
||||
this.OnClickBtnUpStar()
|
||||
end,Language[10719],Language[11848])
|
||||
else
|
||||
if isUpLvMaterials then
|
||||
if isSingleLvUp then--是否是单次升级
|
||||
NetManager.HeroLvUpEvent(curPokemonData.dynamicId,curPokemonData.lv + 1,curPokemonData.lv,function (msg)
|
||||
self:DeleteLvUpMaterials(isSingleLvUp,msg)
|
||||
end)
|
||||
else
|
||||
isTriggerLongClick = true
|
||||
self:DeleteLvUpMaterials(isSingleLvUp)
|
||||
end
|
||||
else
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
if isHeroUpTuPo and curPokemonData.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()
|
||||
this.OnClickBtnUpStar()
|
||||
end,Language[10719],Language[11848])
|
||||
end
|
||||
if isSingleLvUp then
|
||||
|
||||
else
|
||||
if isUpLvMaterials then
|
||||
if isSingleLvUp then--是否是单次升级
|
||||
local curUpLv = curPokemonData.lv
|
||||
if isHeroUpTuPo and curPokemonData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
curUpLv = curPokemonData.lv
|
||||
else
|
||||
curUpLv = curPokemonData.lv + 1
|
||||
end
|
||||
-- LogGreen("isSingleLvUp "..tostring(isSingleLvUp))
|
||||
NetManager.HeroLvUpEvent(curPokemonData.dynamicId,curUpLv,curPokemonData.lv,function (msg)
|
||||
self:DeleteLvUpMaterials(isSingleLvUp,msg)
|
||||
end)
|
||||
else
|
||||
isTriggerLongClick = true
|
||||
self:DeleteLvUpMaterials(isSingleLvUp)
|
||||
end
|
||||
else
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
if isHeroUpTuPo and curPokemonData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
PopupTipPanel.ShowTip(Language[11849])
|
||||
else
|
||||
PopupTipPanel.ShowTip(Language[11850])
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
--播放升级 属性提升动画
|
||||
|
|
@ -293,164 +172,17 @@ end
|
|||
|
||||
--扣除升级 突破 消耗的材料 更新英雄数据
|
||||
function this.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 curPokemonData == v then
|
||||
if isHeroUpTuPo and upTuPoRankUpConfig and curPokemonData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
UIManager.OpenPanel(UIName.RoleUpLvBreakSuccessPanel,curPokemonData,upTuPoRankUpConfig.Id,upTuPoRankUpConfig.OpenLevel)
|
||||
curPokemonData.breakId=upTuPoRankUpConfig.Id
|
||||
curPokemonData.breakId=curPokemonData.breakId
|
||||
--突破有可能会升星
|
||||
if curPokemonData.star<upTuPoRankUpConfig.OpenStar then
|
||||
curPokemonData.star=upTuPoRankUpConfig.OpenStar
|
||||
curPokemonData.star=curPokemonData.star
|
||||
end
|
||||
_isClicked = false
|
||||
_isReqLvUp = false
|
||||
else
|
||||
if msg then
|
||||
curPokemonData.lv=msg.targetLevel
|
||||
--Log("后端更新猎妖师技术前端刷新界面 "..msg.targetLevel)
|
||||
else
|
||||
curPokemonData.lv=curPokemonData.lv + 1
|
||||
end
|
||||
-- curPokemonData.lv=curPokemonData.lv
|
||||
--PopupTipPanel.ShowTip("升级成功!")
|
||||
end
|
||||
-- end
|
||||
-- end
|
||||
--Log("刷新英雄库里单个英雄数据 "..curPokemonData.dynamicId.." "..curPokemonData.lv.." "..curPokemonData.star.." "..curPokemonData.breakId.." "..curPokemonData.upStarId)
|
||||
--刷新英雄库里单个英雄数据
|
||||
if isHeroUpTuPo and upTuPoRankUpConfig and curPokemonData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
this.lvUpGoImage:SetActive(false)
|
||||
-- 突破音效
|
||||
PlaySoundWithoutClick(SoundConfig.Sound_Breach)
|
||||
else
|
||||
this.lvUpGoImage:SetActive(true)
|
||||
-- 升级音效
|
||||
PlaySoundWithoutClick(SoundConfig.Sound_Upgrade)
|
||||
end
|
||||
HeroManager.UpdateSingleHeroDatas(curPokemonData.dynamicId,curPokemonData.lv,curPokemonData.star,curPokemonData.breakId,curPokemonData.upStarId,isSingleLvUp)
|
||||
local allAddProValOld=allAddProVal
|
||||
this:UpdatePanelData(true)--刷新界面
|
||||
this.ShowProAddVal(allAddProValOld)
|
||||
|
||||
_isReqLvUp = false
|
||||
end
|
||||
|
||||
--连续升级更新后端英雄数据
|
||||
function this.DeleteLvUpMaterials2(msg)
|
||||
for i, v in pairs(heroDatas) do
|
||||
if curPokemonData == v then
|
||||
if msg then
|
||||
curPokemonData.lv=msg.targetLevel
|
||||
--Log("后端更新猎妖师技术前端刷新界面 "..msg.targetLevel)
|
||||
end
|
||||
v.lv=curPokemonData.lv
|
||||
end
|
||||
end
|
||||
|
||||
HeroManager.UpdateSingleHeroDatas(curPokemonData.dynamicId,curPokemonData.lv,curPokemonData.star,curPokemonData.breakId,curPokemonData.upStarId,true)
|
||||
this:UpdatePanelData(true)--刷新界面
|
||||
end
|
||||
|
||||
--更新英雄升级 和 突破数据
|
||||
function this:UpdateHeroUpLvAndBreakData()
|
||||
-- 升级获取突破 和 升星相应heroRankUpConfig静态数据
|
||||
-- LogError("curPokemonData "..curPokemonData.breakId)
|
||||
if isHeroUpTuPo and upTuPoRankUpConfig and curPokemonData.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 curPokemonData.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 curPokemonData.lv >= curTuPoRankUpConfig.OpenLevel then--当前突破全部完成
|
||||
if curStarRankUpConfig then--进阶过处理
|
||||
if curPokemonData.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(curPokemonData)
|
||||
this.btnInfoRedPoint:SetActive(upLvRedpoint)
|
||||
this.upLvBtnRedPoint:SetActive(upLvRedpoint)
|
||||
end
|
||||
--更新英雄升级 和 突破 的材料显示
|
||||
function this:UpdateHeroUpLvAndBreakMaterialShow()
|
||||
if isHeroUpTuPo and upTuPoRankUpConfig and curPokemonData.lv == upTuPoRankUpConfig.LimitLevel then
|
||||
costItemList=upTuPoRankUpConfig.ConsumeMaterial
|
||||
else
|
||||
costItemList=ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curPokemonData.lv).Consume
|
||||
end
|
||||
if curPokemonData.lv>=HeroManager.heroLvEnd[curPokemonData.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:OnClose()
|
||||
|
|
|
|||
|
|
@ -2,51 +2,41 @@
|
|||
local this = {}
|
||||
local sortingOrder=0
|
||||
local isHeroUpStar=false--是否可升星
|
||||
local upStarRankUpConfig={}--即将要升星的数据
|
||||
local curStarRankUpConfig={}--当前升星的数据
|
||||
local upStarConsumeMaterial={}--升星消耗的英雄组 {{1坑位英雄信息}{2坑位英雄信息}{}}
|
||||
local upStarMaterialIsAll={}--升星消耗的英雄组是否满足 {{1满足}{2不满足}{}}
|
||||
local isUpStarMaterials=true--升星 材料是否充足
|
||||
local curSelectUpStarData--当前选择升星坑位的数据
|
||||
local curSelectUpStarGo--当前选择升星坑位的预设
|
||||
local upStarMaterialsPre = {}
|
||||
local curPokemonData = {}
|
||||
function this:InitComponent(gameObject)
|
||||
--升星
|
||||
this.upStar=Util.GetGameObject(self.transform,"rolePanel/layout/roleUpStarLayout/upStar")
|
||||
this.noUpStarText=Util.GetGameObject(self.transform,"rolePanel/layout/roleUpStarLayout/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(self.transform,"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.curLvEnd = Util.GetGameObject(this.upStar.transform, "upStarProInfo/lvUp/curLvEnd"):GetComponent("Text")
|
||||
--this.nextLvEnd = Util.GetGameObject(this.upStar.transform, "upStarProInfo/lvUp/nextLvEnd"):GetComponent("Text")
|
||||
--this.proUpVal = Util.GetGameObject(this.upStar.transform, "upStarProInfo/proUp/upVal"):GetComponent("Text")
|
||||
this.skillInfoGrid = Util.GetGameObject(this.upStar.transform, "upStarProInfo/skillInfo")
|
||||
this.skillInfoGrid:SetActive(false)
|
||||
this.atkPro_UpStar=Util.GetGameObject(self.transform,"rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/atk")
|
||||
this.hpPro_UpStar=Util.GetGameObject(self.transform,"rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/hp")
|
||||
this.phyDef_UpStar=Util.GetGameObject(self.transform,"rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/phyDef")
|
||||
this.magDef_UpStar=Util.GetGameObject(self.transform,"rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/magDef")
|
||||
this.lv_UpStar=Util.GetGameObject(self.transform,"rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/lv/proValue"):GetComponent("Text")
|
||||
this.nextlv_UpStar=Util.GetGameObject(self.transform,"rolePanel/layout/roleUpStarLayout/upStar/upStarProInfo/pro/lv/nextproValue"):GetComponent("Text")
|
||||
Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/Image (1)/Text"):GetComponent("Text").text = "灵兽提升"
|
||||
Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/Image (2)/Text"):GetComponent("Text").text = "升星要求"
|
||||
Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/upStarProInfo/lvUp/Text"):GetComponent("Text").text = "属性加成:"
|
||||
Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/upStarProInfo/skillUp/Text"):GetComponent("Text").text = "技能:"
|
||||
|
||||
this.curStarGrid = Util.GetGameObject(this.upStar.transform, "PokemonInfoPanel_UpStar/upStar/upStarProInfo/curStarGrid")
|
||||
this.nextStarGrid = Util.GetGameObject(this.upStar.transform, "PokemonInfoPanel_UpStar/upStar/upStarProInfo/nextStarGrid")
|
||||
|
||||
this.curLvEnd = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/upStarProInfo/lvUp/curLvEnd"):GetComponent("Text")
|
||||
this.nextLvEnd = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/upStarProInfo/lvUp/nextLvEnd"):GetComponent("Text")
|
||||
|
||||
this.skill1Icon = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/upStarProInfo/skillUp/Skill1/icon"):GetComponent("Image")
|
||||
this.skill1Lv = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/upStarProInfo/skillUp/Skill1/skillImage/skillLv"):GetComponent("Text")
|
||||
this.skill2Icon = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/upStarProInfo/skillUp/Skill2/icon"):GetComponent("Image")
|
||||
this.skill2Lv = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/upStarProInfo/skillUp/Skill2/skillImage/skillLv"):GetComponent("Text")
|
||||
|
||||
this.skillTip = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/tip"):GetComponent("Text")
|
||||
|
||||
this.upStarBtn = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/upStarBtn")
|
||||
this.upStar = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar")
|
||||
this.noUpStarText = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/noUpStarText")
|
||||
|
||||
for i = 1, 2 do
|
||||
upStarMaterialsPre[i] = Util.GetGameObject(self.transform,"PokemonInfoPanel_UpStar/upStar/grid/upStarPre ("..i..")")
|
||||
end
|
||||
end
|
||||
|
||||
function this:BindEvent()
|
||||
--升星
|
||||
Util.AddClick(this.upStarBtn, function()
|
||||
self:StarUpClick()
|
||||
this.StarUpClick()
|
||||
end)
|
||||
end
|
||||
|
||||
|
|
@ -55,12 +45,14 @@ end
|
|||
|
||||
function this:RemoveListener()
|
||||
end
|
||||
|
||||
local sortingOrder = 0
|
||||
function this:OnSortingOrderChange(_sortingOrder)
|
||||
sortingOrder = _sortingOrder
|
||||
end
|
||||
function this:OnShow(...)
|
||||
this.ShowCurrPosTreasures()
|
||||
curPokemonData = {}
|
||||
this.OnShowData()
|
||||
end
|
||||
|
||||
|
||||
|
|
@ -68,353 +60,89 @@ function this.OnUpdate()
|
|||
|
||||
end
|
||||
--进阶属性提升
|
||||
function PokemonInfoPanel: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)
|
||||
function this.OnShowData()
|
||||
--curPokemonData
|
||||
local curUpStarConfig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.SpiritAnimalStar,"Quality", 4, "Star", 4)
|
||||
local nextUpStarConfig = ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.SpiritAnimalStar,"Quality", 4, "Star", 4)
|
||||
if not nextUpStarConfig then
|
||||
this.upStar:SetActive(false)
|
||||
this.noUpStarText:SetActive(true)
|
||||
return
|
||||
else
|
||||
this.upStar:SetActive(true)
|
||||
this.noUpStarText:SetActive(false)
|
||||
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]
|
||||
SetHeroStars(this.curStarGrid, curPokemonData.star)
|
||||
SetHeroStars(this.nextStarGrid, curPokemonData.star + 1)
|
||||
this.curLvEnd.text = curUpStarConfig.StarPara / 100 .. "%"
|
||||
this.nextLvEnd.text = nextUpStarConfig.StarPara / 100 .. "%"
|
||||
|
||||
local curSkillId = 0
|
||||
local nextSkillId = 0
|
||||
local skillArray = ConfigManager.GetConfigData(ConfigName.SpiritAnimalStar,curPokemonData.id).SkillArray
|
||||
for i = 1, #skillArray do
|
||||
if skillArray[i][1] == curUpStarConfig.Star then
|
||||
curSkillId = skillArray[i][2]
|
||||
end
|
||||
if skillArray[i][1] == nextUpStarConfig.Star then
|
||||
nextSkillId = skillArray[i][2]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--显示当前阵营的宝物
|
||||
function this.ShowCurrPosTreasures()
|
||||
fetterList = {}
|
||||
this.ScrollView:SetData(fetterList, function (index, go)
|
||||
this.SingleItemDataShow(go, fetterList[index])
|
||||
end)
|
||||
-- this.ScrollView:ForeachItemGO(function(index, go)
|
||||
-- Timer.New(function()
|
||||
-- go.gameObject:SetActive(true)
|
||||
-- PlayUIAnim(go.gameObject)
|
||||
-- end, 0.001 * (index - 1)):Start()
|
||||
-- end)
|
||||
end
|
||||
|
||||
--宝物列表宝物数据显示
|
||||
function this.SingleItemDataShow(_go,_itemData)
|
||||
Util.GetGameObject(_go.transform,"tipText"):GetComponent("Text").text="获得下方所有灵兽后激活图鉴属性"
|
||||
|
||||
Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=Util.LoadSprite(GetQuantityImageByquality(curEquipStarsConfig.Quality))
|
||||
Util.GetGameObject(_go.transform,"icon"):GetComponent("Image").sprite=Util.LoadSprite(_itemData.icon)
|
||||
Util.GetGameObject(_go,"proImg"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(itemConfig[_itemData.Id].PropertyName))
|
||||
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=_itemData.name
|
||||
|
||||
Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=Util.LoadSprite(GetQuantityImageByquality(curEquipStarsConfig.Quality))
|
||||
Util.GetGameObject(_go.transform,"icon"):GetComponent("Image").sprite=Util.LoadSprite(_itemData.icon)
|
||||
Util.GetGameObject(_go,"proImg"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(itemConfig[_itemData.Id].PropertyName))
|
||||
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=_itemData.name
|
||||
|
||||
Util.GetGameObject(_go.transform,"nextproValue"):GetComponent("Text").text="羁绊属性[已激活]"
|
||||
-- SetHeroStars(Util.GetGameObject(_go.transform, "star"), 0)
|
||||
|
||||
for i = 1, 4 do
|
||||
local singlePro = Util.GetGameObject(_go.transform,"proList/pro (".. i ..")")
|
||||
Util.GetGameObject(singlePro.transform,"proName"):GetComponent("Text").text="name"
|
||||
Util.GetGameObject(singlePro.transform,"proValue"):GetComponent("Text").text="value"
|
||||
local nextSkillConFig = ConfigManager.GetConfigData(ConfigName.SkillConfig,nextSkillId)
|
||||
this.skill1Icon.sprite = Util.LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.SkillConfig,curSkillId).Icon))
|
||||
this.skill1Lv.text = 10
|
||||
this.skill2Icon.sprite = Util.LoadSprite(GetResourcePath(nextSkillConFig.Icon))
|
||||
this.skill2Lv.text = 10
|
||||
-- local skillstr = ""
|
||||
-- for i = 1, #nextSkillConFig.DescValue do
|
||||
-- if skillstr == "" then
|
||||
-- skillstr = nextSkillConFig.DescValue[i]
|
||||
-- else
|
||||
-- skillstr = skillstr .. "," .. nextSkillConFig.DescValue[i]
|
||||
-- end
|
||||
-- end
|
||||
this.skillTip.text = "提升预览:"--.. string.format(nextSkillConFig.Desc,nextSkillConFig.DescValue)
|
||||
|
||||
local upStarMaterialsData = {{curPokemonData.id,curUpStarConfig.ConsumeItemNum},{1522,curUpStarConfig.ConsumeRes}}
|
||||
isUpStarMaterials = true
|
||||
for i = 1, #upStarMaterialsPre do
|
||||
local itemParent = Util.GetGameObject(upStarMaterialsPre[i],"itemParent")
|
||||
local num = Util.GetGameObject(upStarMaterialsPre[i],"num"):GetComponent("Text")
|
||||
if upStarMaterialsData[i] then
|
||||
SubUIManager.Open(SubUIConfig.ItemView, itemParent.transform):OnOpen(false, upStarMaterialsData[i], 0.97)
|
||||
local curMaterialBagNum = 0
|
||||
if i == 1 then--需要的灵兽
|
||||
curMaterialBagNum = PokemonManager.RemoveSinglePokemonData(curPokemonData.id)
|
||||
elseif i == 2 then--需要的材料
|
||||
curMaterialBagNum = BagManager.GetItemCountById(upStarMaterialsData[i][1])
|
||||
end
|
||||
if curMaterialBagNum < upStarMaterialsData[i][2] then
|
||||
isUpStarMaterials = false
|
||||
-- go.transform:Find("Image").gameObject:SetActive(true)--显示加号
|
||||
num.text=string.format("<color=#FF0000FF>%s/%s</color>",PrintWanNum2(curMaterialBagNum),PrintWanNum2(upStarMaterialsData[i][2]))
|
||||
else
|
||||
-- go.transform:Find("Image").gameObject:SetActive(false)--隐藏加号
|
||||
num.text=string.format("<color=#FFFFFFFF>%s/%s</color>",PrintWanNum2(curMaterialBagNum),PrintWanNum2(upStarMaterialsData[i][2]))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
--扣除升星 消耗的材料 更新英雄数据
|
||||
function PokemonInfoPanel: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.PokemonInfoPanel) then--当界面存在时需要刷新当前界面
|
||||
this:SortHeroDatas(heroDatas)
|
||||
if this.leftLiveObj and leftHeroData then
|
||||
poolManager:UnLoadLive(leftHeroData.live, this.leftLiveObj)
|
||||
this.leftLiveObj = nil
|
||||
end
|
||||
if this.rightLiveObj and rightHeroData then
|
||||
poolManager:UnLoadLive(rightHeroData.live, this.rightLiveObj)
|
||||
this.rightLiveObj = nil
|
||||
end
|
||||
if this.curLiveObj and curHeroData then
|
||||
poolManager:UnLoadLive(curHeroData.live, this.curLiveObj)
|
||||
this.curLiveObj = nil
|
||||
end
|
||||
for i = 1, #heroDatas do
|
||||
if curHeroData == heroDatas[i] then
|
||||
index = i
|
||||
end
|
||||
end
|
||||
this:UpdateLiveList()
|
||||
this.leftLiveObj = this:LoadHerolive(leftHeroData,self.leftObj)
|
||||
this.rightLiveObj = this:LoadHerolive(rightHeroData,self.rightObj)
|
||||
this.curLiveObj = this:LoadHerolive(curHeroData,self.curObj)
|
||||
if this.curLiveObj then
|
||||
self.dragView.gameObject:SetActive(true)
|
||||
self.dragView:SetDragGO(this.curLiveObj)
|
||||
else
|
||||
self.dragView.gameObject:SetActive(false)
|
||||
end
|
||||
this:UpdatePanelData()
|
||||
end
|
||||
function this.DeleteUpStarMaterials()
|
||||
|
||||
end
|
||||
|
||||
|
||||
--进阶按钮点击事件处理
|
||||
function PokemonInfoPanel: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
|
||||
local upStarPreList = {}
|
||||
--更新英雄进阶数据
|
||||
function this:UpdateHeroUpStarData(isNeedLoadLive)
|
||||
if isNeedLoadLive then return end
|
||||
--进阶材料
|
||||
this:UpdateHeroUpStarMaterialShow()
|
||||
--进阶属性提升
|
||||
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)
|
||||
this.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)
|
||||
this.talentTipStrGo:SetActive(false)
|
||||
end
|
||||
--回溯按钮显隐
|
||||
-- this.upReturn:SetActive(this:GetCurHeroIsOpenReturn())
|
||||
-- this.upReturn2:SetActive(this:GetCurHeroIsOpenReturn())
|
||||
--自动选择进阶妖灵师材料
|
||||
self:AutoSelectUpStarHeroList(curUpStarData)
|
||||
end
|
||||
--升星选择祭品后刷新界面
|
||||
function PokemonInfoPanel: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: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
|
||||
function this.StarUpClick()
|
||||
|
||||
end
|
||||
|
||||
|
||||
--刷新当前升星坑位英雄的信息
|
||||
function PokemonInfoPanel: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
|
||||
|
||||
function this:OnClose()
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,11 @@ end
|
|||
function this.RefreshPanel()
|
||||
for i, v in ipairs(allProData) do
|
||||
local go= allProPre[i]
|
||||
Util.GetGameObject(go,"Image"):GetComponent("Image").sprite= Util.LoadSprite(GetResourcePath(heroConfig[v.tmpId].Icon))
|
||||
Util.GetGameObject(go,"lv/proName"):GetComponent("Text").text=v.level
|
||||
Util.GetGameObject(go,"lv/proValue"):GetComponent("Text").text=v.level
|
||||
if PropertyTypeIconDef[i] then
|
||||
Util.GetGameObject(go, "Image"):GetComponent("Image").sprite = Util.LoadSprite(PropertyTypeIconDef[i])
|
||||
end
|
||||
Util.GetGameObject(go,"lv/proName"):GetComponent("Text").text="生命"
|
||||
Util.GetGameObject(go,"lv/proValue"):GetComponent("Text").text= 1
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue