神将合成部分显示代码

dev_chengFeng
zhangqiang 2020-08-08 11:06:01 +08:00
parent f2d743a343
commit 6dd95ec834
2 changed files with 278 additions and 181 deletions

View File

@ -434,7 +434,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &7089497568261089825
RectTransform:
m_ObjectHideFlags: 0
@ -1807,7 +1807,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &4895294187974720368
RectTransform:
m_ObjectHideFlags: 0
@ -2238,7 +2238,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &14473587821320198
RectTransform:
m_ObjectHideFlags: 0
@ -2602,7 +2602,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1862423619776916248}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
@ -7964,7 +7964,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6234572071217861648}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
@ -8113,7 +8113,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6248596653111728194}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
@ -8752,24 +8752,6 @@ MonoBehaviour:
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!1 &6580311159226306795
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6361794076020594987}
- component: {fileID: 6359395958638946819}
- component: {fileID: 6539434559057412867}
m_Layer: 5
m_Name: Pos
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &6598883408994514013
GameObject:
m_ObjectHideFlags: 0
@ -9134,7 +9116,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6932354149095647648}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
@ -10180,7 +10162,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &4744560557158824247
RectTransform:
m_ObjectHideFlags: 0
@ -12195,27 +12177,7 @@ PrefabInstance:
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2320031819902321005, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
- target: {fileID: 2320031819916146513, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819931042899, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
- target: {fileID: 2320031820207909310, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819195525549, guid: e356d5948e4971f499cfe38db3551f59,
- target: {fileID: 2320031818352649172, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
@ -12225,11 +12187,31 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031818352649172, guid: e356d5948e4971f499cfe38db3551f59,
- target: {fileID: 2320031819195525549, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031820207909310, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819916146513, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819902321005, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
- target: {fileID: 2320031819931042899, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e356d5948e4971f499cfe38db3551f59, type: 3}
--- !u!224 &4004229281899235646 stripped
@ -12360,27 +12342,7 @@ PrefabInstance:
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 2320031819902321005, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
- target: {fileID: 2320031819916146513, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819931042899, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
- target: {fileID: 2320031820207909310, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819195525549, guid: e356d5948e4971f499cfe38db3551f59,
- target: {fileID: 2320031818352649172, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
@ -12390,11 +12352,31 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031818352649172, guid: e356d5948e4971f499cfe38db3551f59,
- target: {fileID: 2320031819195525549, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031820207909310, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819916146513, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819902321005, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
- target: {fileID: 2320031819931042899, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e356d5948e4971f499cfe38db3551f59, type: 3}
--- !u!224 &830107167574040034 stripped
@ -12525,27 +12507,7 @@ PrefabInstance:
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2320031819902321005, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
- target: {fileID: 2320031819916146513, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819931042899, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
- target: {fileID: 2320031820207909310, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819195525549, guid: e356d5948e4971f499cfe38db3551f59,
- target: {fileID: 2320031818352649172, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
@ -12555,11 +12517,31 @@ PrefabInstance:
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031818352649172, guid: e356d5948e4971f499cfe38db3551f59,
- target: {fileID: 2320031819195525549, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031820207909310, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819916146513, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: 3.2600002
objectReference: {fileID: 0}
- target: {fileID: 2320031819902321005, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
- target: {fileID: 2320031819931042899, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -16.999998
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: e356d5948e4971f499cfe38db3551f59, type: 3}
--- !u!224 &8285715864431426671 stripped
@ -12568,27 +12550,3 @@ RectTransform:
type: 3}
m_PrefabInstance: {fileID: 5895948752121214208}
m_PrefabAsset: {fileID: 0}
--- !u!222 &6359395958638946819 stripped
CanvasRenderer:
m_CorrespondingSourceObject: {fileID: 690038966185697027, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
m_PrefabInstance: {fileID: 5895948752121214208}
m_PrefabAsset: {fileID: 0}
--- !u!114 &6539434559057412867 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 797738787769710083, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
m_PrefabInstance: {fileID: 5895948752121214208}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6580311159226306795}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!224 &6361794076020594987 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 692213107735653419, guid: e356d5948e4971f499cfe38db3551f59,
type: 3}
m_PrefabInstance: {fileID: 5895948752121214208}
m_PrefabAsset: {fileID: 0}

View File

@ -5,17 +5,16 @@ local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local curIndex = 0
local curNeedHero = {}
local curSelectHero = {}
local curSelectHeroConfig = {}
local curSelectGO
local materidaIsCan = false
local tabs={}
local needHeros={}
function this:InitComponent(gameObject)
this.compoundBtn = Util.GetGameObject(gameObject, "CompoundHeroPanel_Compound/compoundBtn")
this.compoundHero = Util.GetGameObject(gameObject, "CompoundHeroPanel_Compound/titleGo/compoundHero/Hero")
this.compoundHeroTipText = Util.GetGameObject(gameObject, "CompoundHeroPanel_Compound/titleGo/compoundHero/tipText")
this.compoundHeroTipText:GetComponent("Text").text = "请选择需要合成的神将"
needHeros = {}
for i = 1, 4 do
needHeros[i] = Util.GetGameObject(gameObject, "CompoundHeroPanel_Compound/Tabs/grid/needHero" .. i)
needHeros[i] = Util.GetGameObject(gameObject, "CompoundHeroPanel_Compound/titleGo/needHero" .. i)
end
for i = 1, 5 do
tabs[i] = Util.GetGameObject(gameObject, "CompoundHeroPanel_Compound/Tabs/grid/Btn" .. i)
@ -28,6 +27,26 @@ function this:InitComponent(gameObject)
this.heroPre, this.ScrollBar, Vector2.New(-v2.x*2, -v2.y*2), 1, 5, Vector2.New(50,15))
this.ScrollView.moveTween.MomentumAmount = 1
this.ScrollView.moveTween.Strength = 1
--up compound Hero info
this.compoundHero = Util.GetGameObject(gameObject, "CompoundHeroPanel_Compound/titleGo/compoundHero/Hero")
this.compoundHeroTipText = Util.GetGameObject(gameObject, "CompoundHeroPanel_Compound/titleGo/compoundHero/tipText")
this.compoundHeroTipText:GetComponent("Text").text = "请选择需要合成的神将"
this.compoundHerobg=Util.GetGameObject(this.compoundHero,"Bg1"):GetComponent("Image")
this.compoundHerolv=Util.GetGameObject(this.compoundHero,"lv/Text"):GetComponent("Text")
this.compoundHerohp = Util.GetGameObject(this.compoundHero,"hpProgress/hp"):GetComponent("Image")
this.compoundHerohpPass = Util.GetGameObject(this.compoundHero,"hpProgress/hpPass"):GetComponent("Image")
this.compoundHerorage = Util.GetGameObject(this.compoundHero,"rageProgress/rage"):GetComponent("Image")
this.compoundHerofg=Util.GetGameObject(this.compoundHero,"Bg2"):GetComponent("Image")
this.compoundHeropro=Util.GetGameObject(this.compoundHero,"Pro/Image"):GetComponent("Image")
this.compoundHerostarGrid=Util.GetGameObject(this.compoundHero,"StarGrid")
this.compoundHeroname=Util.GetGameObject(this.compoundHero,"Name/Text"):GetComponent("Text")
this.compoundHeroyuanImage=Util.GetGameObject(this.compoundHero,"yuanImage")
this.compoundHerolive = Util.GetGameObject(this.compoundHero, "Mask/icon"):GetComponent("RawImage")
this.compoundHerozs = Util.GetGameObject(this.compoundHero, "zs")
Util.GetGameObject(this.compoundHero,"hpProgress").gameObject:SetActive(false)
Util.GetGameObject(this.compoundHero,"rageProgress").gameObject:SetActive(false)
Util.GetGameObject(this.compoundHero,"UI_Effect_jinkuang_KaPai").gameObject:SetActive(false)
end
function this:BindEvent()
@ -69,8 +88,7 @@ end
--显示当前阵营的英雄
function this.ShowCurrPosHeroCompound()
local heroDatas = this.GetAllHeroCompoundData(curIndex)
curSelectHero = nil
this.ShowTitleData(curSelectHero)
this.SelectHeroShow(nil)
this.ScrollView:SetData(heroDatas, function (index, go)
this.SingleHeroDataShow(go, heroDatas[index])
end)
@ -83,61 +101,155 @@ function this.SetBtnSelect(_parObj)
this.selectBtn.transform.localScale = Vector3.one
this.selectBtn.transform.localPosition=Vector3.zero
end
function this.ShowTitleData(_heroData,_star)
if _heroData then
LogGreen("_heroData ".._heroData.icon)
function this.ShowTitleData(curHeroCompoundData)
if curHeroCompoundData then
local _star = curHeroCompoundData.star
local heroData = curHeroCompoundData.haveHeroList[1][1]
local heroConfig = heroData and heroData.heroConfig or curHeroCompoundData.config
this.compoundHero:SetActive(true)
this.compoundHeroTipText:SetActive(false)
local heroData=_heroData
local o = this.compoundHero
local bg=Util.GetGameObject(o,"Bg1"):GetComponent("Image")
local lv=Util.GetGameObject(o,"lv/Text"):GetComponent("Text")
local hp = Util.GetGameObject(o,"hpProgress/hp"):GetComponent("Image")
local hpPass = Util.GetGameObject(o,"hpProgress/hpPass"):GetComponent("Image")
local rage = Util.GetGameObject(o,"rageProgress/rage"):GetComponent("Image")
bg.sprite = Util.LoadSprite(GetHeroCardStarBg[_star])
Util.GetGameObject(o,"hpProgress").gameObject:SetActive(false)
Util.GetGameObject(o,"rageProgress").gameObject:SetActive(false)
local fg=Util.GetGameObject(o,"Bg2"):GetComponent("Image")
local pro=Util.GetGameObject(o,"Pro/Image"):GetComponent("Image")
local starGrid=Util.GetGameObject(o,"StarGrid")
local name=Util.GetGameObject(o,"Name/Text"):GetComponent("Text")
local yuanImage=Util.GetGameObject(o,"yuanImage")
local live = Util.GetGameObject(o, "Mask/icon"):GetComponent("RawImage")
local liveName = GetResourcePath(heroData.heroConfig.Live)
local roleConfig = ConfigManager.GetConfigData(ConfigName.RoleConfig, heroData.heroConfig.Id)
this.compoundHerobg.sprite = Util.LoadSprite(GetHeroCardStarBg[_star])
local zsName = GetHeroCardStarZs[_star]
this.compoundHerofg.sprite = Util.LoadSprite(GetHeroCardStarFg[_star])
this.compoundHeroyuanImage:SetActive(false)
SetCardStars(this.compoundHerostarGrid,_star)
local curHeroHpVal = nil--FormationManager.GetFormationHeroHp(this.curFormationIndex,_heroData.dynamicId)
this.compoundHerohp.fillAmount = curHeroHpVal or 1
this.compoundHerohpPass.fillAmount = curHeroHpVal or 1
this.compoundHerorage.fillAmount = 0.5
local liveName = GetResourcePath(heroConfig.Live)
local roleConfig = ConfigManager.GetConfigData(ConfigName.RoleConfig, heroConfig.Id)
local scale = roleConfig.play_liveScale
local livePos = Vector3.New(roleConfig.offset[1], roleConfig.offset[2], 0)
live.texture = CardRendererManager.GetSpineTexture(1, liveName, Vector3.one * scale, livePos, true)
live.transform.localScale = Vector3.one
live.transform.localPosition = Vector3.zero
local zs = Util.GetGameObject(o, "zs")
local zsName = GetHeroCardStarZs[_star]
this.compoundHerolive.texture = CardRendererManager.GetSpineTexture(1, liveName, Vector3.one * scale, livePos, true)
this.compoundHerolive.transform.localScale = Vector3.one
this.compoundHerolive.transform.localPosition = Vector3.zero
this.compoundHeropro.sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
this.compoundHeroname.text=heroConfig.ReadingName
if zsName == "" then
zs:SetActive(false)
this.compoundHerozs:SetActive(false)
else
zs:SetActive(true)
zs:GetComponent("Image").sprite = Util.LoadSprite(zsName)
this.compoundHerozs:SetActive(true)
this.compoundHerozs:GetComponent("Image").sprite = Util.LoadSprite(zsName)
end
if heroData then--第一位是否有英雄
this.compoundHerolv.text=heroData.lv
else
this.compoundHerolv.text=1
end
yuanImage:SetActive(heroData.createtype == 1)
lv.text=heroData.lv
fg.sprite = Util.LoadSprite(GetHeroCardStarFg[_star])
pro.sprite=Util.LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
SetCardStars(starGrid,_star)
Util.GetGameObject(o,"UI_Effect_jinkuang_KaPai").gameObject:SetActive(false)
name.text=heroData.heroConfig.ReadingName
local curHeroHpVal = FormationManager.GetFormationHeroHp(this.curFormationIndex,_heroData.dynamicId)
hp.fillAmount = curHeroHpVal or 1
hpPass.fillAmount = curHeroHpVal or 1
rage.fillAmount = 0.5
else
LogGreen("_data nil ")
this.compoundHero:SetActive(false)
this.compoundHeroTipText:SetActive(true)
end
end
local upStarConsumeMaterial = {}
local upStarMaterialIsAll = {}
--更新英雄进阶数据
function this.UpdateHeroUpStarData(_curUpStarData)
--进阶吞英雄条件
if _curUpStarData then
upStarConsumeMaterial={}
upStarMaterialIsAll = {}
for i = 1, #_curUpStarData.upStarMaterialsData do
local upStarMaterialsData = _curUpStarData.upStarMaterialsData[i]
local curUpStarData = _curUpStarData.upStarData[i]
local go = needHeros[i + 1]
go:SetActive(true)
upStarConsumeMaterial[i]={}
upStarMaterialIsAll[i]=false
local proImage = Util.GetGameObject(go.transform, "iconbg/proImage")
local iconDefault = Util.GetGameObject(go.transform,"iconDefault")
local icon = Util.GetGameObject(go.transform,"icon")
local frame = Util.GetGameObject(go.transform,"frame")
local addBtn=Util.GetGameObject(go.transform,"add")
local addBtnImage = Util.GetGameObject(go.transform,"add/add")
local num = Util.GetGameObject(go.transform,"num")
local num = Util.GetGameObject(go.transform,"num")
local starGrid = Util.GetGameObject(go.transform, "iconbg/starGrid")
proImage:SetActive(false)
if upStarMaterialsData.Issame==1 or upStarMaterialsData.IsId>0 then
iconDefault:SetActive(false)
icon:SetActive(true)
proImage:SetActive(true)
if upStarMaterialsData.Issame==1 then
icon:GetComponent("Image").sprite=Util.LoadSprite(GetResourcePath(_curUpStarData.config.Icon))
frame:GetComponent("Image").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(_curUpStarData.config.Quality, upStarMaterialsData.StarLimit))
proImage:GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(_curUpStarData.config.PropertyName))
elseif upStarMaterialsData.IsId>0 then
local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, upStarMaterialsData.IsId)
icon:GetComponent("Image").sprite=Util.LoadSprite(GetResourcePath(heroConfig.Icon))
frame:GetComponent("Image").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(heroConfig.Quality, upStarMaterialsData.StarLimit))
proImage:GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
end
else
if upStarMaterialsData.IsSameClan ==1 then
proImage:SetActive(true)
proImage:GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(_curUpStarData.config.PropertyName))
end
iconDefault:SetActive(true)
icon:SetActive(false)
frame:GetComponent("Image").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(nil,upStarMaterialsData.StarLimit))
end
-- local upStarHeroListData=HeroManager.GetUpStarHeroListData(curUpStarData.Id,curSelectHero)
-- if upStarHeroListData.state>0 then
-- addBtnImage:SetActive(true)
-- else
-- addBtnImage:SetActive(false)
-- end
if #_curUpStarData.haveHeroList[i + 1] >= curUpStarData[4] then
num:GetComponent("Text").text=string.format("<color=#FFFFFF>%s/%s</color>",#_curUpStarData.haveHeroList[i + 1],curUpStarData[4])
else
num:GetComponent("Text").text=string.format("<color=#FF0000FF>%s/%s</color>",#_curUpStarData.haveHeroList[i + 1],curUpStarData[4])
end
SetHeroStars(starGrid, upStarMaterialsData.StarLimit,1,nil,-15.3)
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,upStarMaterialsData,curUpStarData,this,upStarConsumeMaterial[i],curSelectHero)
end)
end
else
for i = 1, #needHeros do
needHeros[i]:SetActive(false)
end
end
--自动选择进阶妖灵师材料
-- self:AutoSelectUpStarHeroList(curUpStarData)
end
--更新英雄进阶数据
function this.UpdateFirstHeroUpStarData(curHeroCompoundData)
local go = needHeros[1]
local proImage = Util.GetGameObject(go.transform, "iconbg/proImage")
local iconDefault = Util.GetGameObject(go.transform,"iconDefault")
local icon = Util.GetGameObject(go.transform,"icon")
local frame = Util.GetGameObject(go.transform,"frame")
local addBtn=Util.GetGameObject(go.transform,"add")
local addBtnImage = Util.GetGameObject(go.transform,"add/add")
local num = Util.GetGameObject(go.transform,"num")
local num = Util.GetGameObject(go.transform,"num")
local starGrid = Util.GetGameObject(go.transform, "iconbg/starGrid")
if curSelectHero or curHeroCompoundData then
local heroConfig = curSelectHero and curSelectHero.heroConfig or curHeroCompoundData.config
go:SetActive(true)
proImage:SetActive(true)
iconDefault:SetActive(false)
addBtnImage:SetActive(false)
icon:GetComponent("Image").sprite=Util.LoadSprite(GetResourcePath(heroConfig.Icon))
frame:GetComponent("Image").sprite=Util.LoadSprite(GetHeroQuantityImageByquality(heroConfig.Quality, heroConfig.Star))
proImage:GetComponent("Image").sprite=Util.LoadSprite(GetProStrImageByProNum(heroConfig.PropertyName))
SetHeroStars(starGrid, heroConfig.Star,1,nil,-15.3)
if curSelectHero then
num:GetComponent("Text").text=string.format("<color=#FFFFFF>%s/%s</color>",1,1)
else
num:GetComponent("Text").text=string.format("<color=#FF0000FF>%s/%s</color>",0,1)
end
else
needHeros[1]:SetActive(false)
end
end
--数据显示
function this.SingleHeroDataShow(_go,_heroData)
local go = _go
@ -164,25 +276,33 @@ function this.SingleHeroDataShow(_go,_heroData)
local cardBtn = Util.GetGameObject(go.transform, "icon")
local choosed = Util.GetGameObject(go.transform, "choosed")
choosed:SetActive(false)
if curSelectHero and curSelectHero.config.Id == _heroData.config.Id then
if curSelectHeroConfig and curSelectHeroConfig.config and curSelectHeroConfig.config.Id == _heroData.config.Id then
choosed:SetActive(true)
curSelectGO = choosed
this.SelectHeroShow(curSelectHeroConfig)
end
Util.AddOnceClick(cardBtn, function()
if curSelectHero and curSelectHero.config.Id == _heroData.config.Id then
choosed:SetActive(false)
curSelectHero = nil
curSelectGO = nil
this.SelectHeroShow(nil)
return
else
curSelectHero = heroData
choosed:SetActive(true)
if curSelectGO then
curSelectGO:SetActive(false)
if curSelectHeroConfig and curSelectHeroConfig.config then
if curSelectHeroConfig.config.Id == _heroData.config.Id then
choosed:SetActive(false)
curSelectHeroConfig = nil
curSelectGO = nil
this.SelectHeroShow(nil)
return
else
curSelectHeroConfig = heroData
if curSelectGO then
curSelectGO:SetActive(false)
end
choosed:SetActive(true)
curSelectGO = choosed
this.SelectHeroShow(curSelectHeroConfig)
end
else
curSelectHeroConfig = heroData
choosed:SetActive(true)
curSelectGO = choosed
this.SelectHeroShow(curSelectHero)
this.SelectHeroShow(curSelectHeroConfig)
end
end)
end
@ -221,6 +341,10 @@ function this.SwitchView(index)
end
function this:OnClose()
curNeedHero = {}
curSelectHero = {}
curSelectHeroConfig = {}
curSelectGO = nil
end
function this:OnDestroy()
@ -243,6 +367,8 @@ function this.GetAllHeroCompoundData(index)
curHeroCompoundData.needNum = 1--需要英雄数量 第一位先加上
curHeroCompoundData.haveHeroList[1] = {}
curHeroCompoundData.haveHeroList3[1] = {}
curHeroCompoundData.upStarData = {}
curHeroCompoundData.upStarMaterialsData = {}
--其后几位加数量
if configInfo.RankupConsumeMaterial then
for i = 1, #configInfo.RankupConsumeMaterial do
@ -250,6 +376,9 @@ function this.GetAllHeroCompoundData(index)
curHeroCompoundData.needNum = curHeroCompoundData.needNum + configInfo.RankupConsumeMaterial[i][4]
curHeroCompoundData.haveHeroList[configInfo.RankupConsumeMaterial[i][2] + 1] = {}
curHeroCompoundData.haveHeroList3[configInfo.RankupConsumeMaterial[i][2] + 1] = {}
curHeroCompoundData.upStarData[i] = configInfo.RankupConsumeMaterial[i]
table.insert(curHeroCompoundData.upStarData,configInfo.RankupConsumeMaterial[i])
table.insert(curHeroCompoundData.upStarMaterialsData,heroRankupGroup[configInfo.RankupConsumeMaterial[i][3]])
end
end
end
@ -332,9 +461,9 @@ function this.GetAllHeroCompoundData2(configInfo,curHeroCompoundData,isGet)
end
end
end
if #curHeroCompoundData.haveHeroList[configInfo.RankupConsumeMaterial[i][2] + 1] < configInfo.RankupConsumeMaterial[i][4] then
if curNeedHeroData and not curHeroCompoundData[curNeedHeroData.dynamicId] then
if curNeedHeroData and not curHeroCompoundData.haveHeroList2[curNeedHeroData.dynamicId] then
-- LogGreen("SID "..curHeroCompoundData.config.Id.." pos "..configInfo.RankupConsumeMaterial[i][2] + 1 .." curNeedHeroData.dynamicId "..curNeedHeroData.dynamicId)
table.insert(curHeroCompoundData.haveHeroList[configInfo.RankupConsumeMaterial[i][2] + 1],curNeedHeroData)
curHeroCompoundData.haveHeroList2[curNeedHeroData.dynamicId] = curNeedHeroData
end
@ -352,6 +481,16 @@ function this.GetAllHeroCompoundData2(configInfo,curHeroCompoundData,isGet)
end
--点击获取数据
function this.SelectHeroShow(curHeroCompoundData)
this.ShowTitleData(curHeroCompoundData.haveHeroList[1][1],curHeroCompoundData.star)
if curHeroCompoundData then
curSelectHero = curHeroCompoundData.haveHeroList[1][1]
this.ShowTitleData(curHeroCompoundData)
this.UpdateFirstHeroUpStarData(curHeroCompoundData)
this.UpdateHeroUpStarData(curHeroCompoundData)
else
curSelectHero = nil
this.ShowTitleData(nil)
this.UpdateFirstHeroUpStarData(nil)
this.UpdateHeroUpStarData(nil)
end
end
return this