Merge branch 'china/dev' of http://60.1.1.230/gaoxin/JL_Client into china/dev

dev_chengFeng
ZhangBiao 2021-07-23 19:23:05 +08:00
commit 7bc3a3d460
5 changed files with 1927 additions and 2638 deletions

View File

@ -4680,8 +4680,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.000015258789, y: -89.600006}
m_SizeDelta: {x: 64.4, y: 37.51}
m_AnchoredPosition: {x: 0.000015258789, y: -91.24}
m_SizeDelta: {x: 64.4, y: 40.78}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &222600956484834218
CanvasRenderer:
@ -5104,6 +5104,8 @@ RectTransform:
- {fileID: 1298334587255639450}
- {fileID: 1799237812738150230}
- {fileID: 8592251680213530260}
- {fileID: 6193489970714018668}
- {fileID: 1449685011234502786}
m_Father: {fileID: 224797861638971062}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -38611,6 +38613,85 @@ ParticleSystemRenderer:
m_Mesh2: {fileID: 0}
m_Mesh3: {fileID: 0}
m_MaskInteraction: 0
--- !u!1 &1597479055163298302
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1449685011234502786}
- component: {fileID: 1091151930144477597}
- component: {fileID: 6827508354133794526}
m_Layer: 5
m_Name: middleDownLv
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1449685011234502786
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1597479055163298302}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.9009009, y: 0.9009009, z: 1}
m_Children: []
m_Father: {fileID: 224550793111032812}
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -1.62, y: -46.553}
m_SizeDelta: {x: 127.2, y: 33.125}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &1091151930144477597
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1597479055163298302}
m_CullTransparentMesh: 0
--- !u!114 &6827508354133794526
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1597479055163298302}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 4b73e9e4512d17e4daeea351e090d33c, type: 3}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 3
m_MaxSize: 50
m_Alignment: 7
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: +88
--- !u!1 &2066763438172914823
GameObject:
m_ObjectHideFlags: 0
@ -39136,6 +39217,85 @@ MonoBehaviour:
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
--- !u!1 &3519125261167570629
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6193489970714018668}
- component: {fileID: 6593720557690555738}
- component: {fileID: 5584268453037143474}
m_Layer: 5
m_Name: rightUplv
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6193489970714018668
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3519125261167570629}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.9009009, y: 0.9009009, z: 1}
m_Children: []
m_Father: {fileID: 224550793111032812}
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 32.199997, y: 47.13}
m_SizeDelta: {x: 61.8, y: 34.29}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &6593720557690555738
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3519125261167570629}
m_CullTransparentMesh: 0
--- !u!114 &5584268453037143474
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3519125261167570629}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 12800000, guid: 4b73e9e4512d17e4daeea351e090d33c, type: 3}
m_FontSize: 30
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 3
m_MaxSize: 50
m_Alignment: 5
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 1
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text: +88
--- !u!1 &3721601256782621991
GameObject:
m_ObjectHideFlags: 0

View File

@ -72,6 +72,18 @@ function this.GetTreasureDataByPos(_pos, _idDyn, PropertyName)
return equips
end
--获取玩家穿戴的宝物
function this.GetAllHeroEquipedTreasureData()
local equips = {}
for i, v in pairs(allTreasures) do
if (v.upHeroDid == "" or v.upHeroDid == 0) then
else
table.insert(equips, v)
end
end
return equips
end
function this.OpenTreasure(star)
local config = ConfigManager.GetConfigData(40)
local configs = string.split(config.Value, "|")

View File

@ -4,8 +4,6 @@ local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
local jewelConfig=ConfigManager.GetConfig(ConfigName.JewelConfig)
local this=EquipTreasureStrongPopup
local curEquipData
local properList={}
local costItemPreList={}
local haveTreasures={}
local type
local isMatEnough=true
@ -13,37 +11,38 @@ local matId=0
local isCoinEnough=true
local isMax=false
local isEnough = false
local curIndex = 0
--初始化组件(用于子类重写)
function EquipTreasureStrongPopup:InitComponent()
this.spLoader = SpriteLoader.New()
this.btnBack= Util.GetGameObject(self.transform, "bg/btnBack")
this.titleTxt=Util.GetGameObject(self.transform, "bg/name"):GetComponent("Text")
this.equipFrame=Util.GetGameObject(self.transform, "bg/armorInfo/frame"):GetComponent("Image")
this.equipIcon=Util.GetGameObject(self.transform, "bg/armorInfo/icon"):GetComponent("Image")
this.equipName=Util.GetGameObject(self.transform, "bg/armorInfo/nameTxt"):GetComponent("Text")
this.equipQuaTxt=Util.GetGameObject(self.transform, "bg/armorInfo/equipQuaText"):GetComponent("Text")
this.btn_strong=Util.GetGameObject(self.transform, "bg/btnGrid/btnStrong")
this.btn_refine=Util.GetGameObject(self.transform, "bg/btnGrid/btnRefine")
this.btn_strongPage=Util.GetGameObject(self.transform, "bg/btnList/btnStrong")
this.btn_refinePage=Util.GetGameObject(self.transform, "bg/btnList/btnRefine")
this.coinImg=Util.GetGameObject(self.transform, "bg/coinImg"):GetComponent("Image")
this.coinTxt=Util.GetGameObject(self.transform, "bg/coinNumTxt"):GetComponent("Text")
this.coinBg=Util.GetGameObject(self.transform, "bg/coinBg")
this.costItemPre=Util.GetGameObject(self.transform, "bg/costItemPre")
this.costItemPre.gameObject:SetActive(false)
this.properItemPre=Util.GetGameObject(self.transform, "bg/propertyPre")
this.costItemGrid=Util.GetGameObject(self.transform, "bg/costGrid")
this.propertyGrid=Util.GetGameObject(self.transform, "bg/scroll/grid")
this.equipLvTxt=Util.GetGameObject(self.transform, "bg/armorInfo/lvTxt"):GetComponent("Text")
this.equipRefineLvTxt=Util.GetGameObject(self.transform, "bg/armorInfo/refineLv"):GetComponent("Text")
this.selectBtn=Util.GetGameObject(self.transform,"bg/btnList/selectBtn")
this.lvTxt=Util.GetGameObject(self.transform,"bg/propertyPre/leftTxt"):GetComponent("Text")
this.lvValueTxt=Util.GetGameObject(self.transform,"bg/propertyPre/rightTxt"):GetComponent("Text")
this.proImg=Util.GetGameObject(self.transform,"bg/armorInfo/proImg"):GetComponent("Image")
this.hintTxt=Util.GetGameObject(self.transform,"bg/hintTxt"):GetComponent("Text")
this.content = Util.GetGameObject(self.transform, "bg/content")
this.btnBack= Util.GetGameObject(this.content,"btnBack")
this.titleTxt=Util.GetGameObject(this.content,"name"):GetComponent("Text")
this.itemPre = Util.GetGameObject(this.content,"itemView")
this.firstScroll=Util.GetGameObject(this.content,"firstScroll")
this.properItemPre = Util.GetGameObject(this.content,"propertyPre")
this.propertyGrid=Util.GetGameObject(this.content,"secondScroll/grid")
this.costItemGrid=Util.GetGameObject(this.content,"costGrid")
this.hintTxt=Util.GetGameObject(this.content,"hintTxt"):GetComponent("Text")
this.btnRefine=Util.GetGameObject(this.content,"btnGrid/btnRefine")
this.btnRefineText = Util.GetGameObject(this.btnRefine,"Text"):GetComponent("Text")
this.btnStrong=Util.GetGameObject(this.content,"btnGrid/btnStrong")
this.btnStrongText = Util.GetGameObject(this.btnStrong,"Text"):GetComponent("Text")
this.btn_strongPage=Util.GetGameObject(this.content,"btnList/btnStrong")
this.btn_refinePage=Util.GetGameObject(this.content,"btnList/btnRefine")
this.selectBtn=Util.GetGameObject(this.content,"btnList/selectBtn")
this.treasureDatas = {}
this.costTreasureDatas = {}
this.properList = {}
this.properList[0] = {}
this.properList[0].go = this.properItemPre
this.properList[0].leftTxt = Util.GetGameObject(this.properItemPre,"leftTxt"):GetComponent("Text")
this.properList[0].rightTxt = Util.GetGameObject(this.properItemPre,"rightTxt"):GetComponent("Text")
local rootHight = this.firstScroll.transform.rect.height
local rootWidth=this.firstScroll.transform.rect.width
this.firstScrollCycleView = SubUIManager.Open(SubUIConfig.ScrollCycleView,this.firstScroll.transform,this.itemPre,nil, Vector2.New(rootWidth,rootHight), 1, 5, Vector2.New(15,30))
this.gongming = Util.GetGameObject(this.content,"gongming")
this.select = Util.GetGameObject(this.content,"select")
end
--绑定事件(用于子类重写)
@ -55,20 +54,14 @@ function EquipTreasureStrongPopup:BindEvent()
end)
--强化页签
Util.AddClick(this.btn_strongPage, function()
if HarmonyManager.IsInfo(curEquipData.upHeroDid) then
-- body
PopupTipPanel.ShowTip(Language[12184])
else
this.SetWindShow(1)
end
this:SetWindShow(1)
end)
--精炼页签
Util.AddClick(this.btn_refinePage, function()
this.SetWindShow(2)
this:SetWindShow(2)
end)
--强化按钮
Util.AddClick(this.btn_strong, function()
Util.AddClick(this.btnStrong, function()
--如果强化界面 强化到最高等级谈提示 精炼界面 就切界面
if type==1 then
if isMax then
@ -76,7 +69,7 @@ function EquipTreasureStrongPopup:BindEvent()
return
end
else
this.SetWindShow(1)
this:SetWindShow(1)
return
end
--材料是否足够
@ -91,7 +84,8 @@ function EquipTreasureStrongPopup:BindEvent()
end
NetManager.EquipTreasureBuildRequest(curEquipData.idDyn,1,nil,function (msg)
EquipTreasureManager.ChangeTreasureLv(curEquipData.idDyn,type)
this.SetWindShow(type)
this:SetWindShow(type)
this.treasureDatas[curIndex]:OnOpen(false, {curEquipData.id,0}, 1, true, false, false, 0,curEquipData.idDyn)
if isMax then
PopupTipPanel.ShowTip(Language[11772])
else
@ -107,7 +101,7 @@ function EquipTreasureStrongPopup:BindEvent()
end)
--精炼按钮
Util.AddClick(this.btn_refine, function()
Util.AddClick(this.btnRefine, function()
--如果精炼界面 精炼到最高等级谈提示 否 强化界面 就切界面
if type==2 then
if isMax then
@ -115,7 +109,7 @@ function EquipTreasureStrongPopup:BindEvent()
return
end
else
this.SetWindShow(2)
this:SetWindShow(2)
return
end
if isMatEnough==false then
@ -147,7 +141,8 @@ function EquipTreasureStrongPopup:BindEvent()
end
end
EquipTreasureManager.ChangeTreasureLv(curEquipData.idDyn,type)
this.SetWindShow(type)
this:SetWindShow(type)
this.treasureDatas[curIndex]:OnOpen(false, {curEquipData.id,0}, 1, true, false, false, 0,curEquipData.idDyn)
if isMax then
PopupTipPanel.ShowTip(Language[11774])
else
@ -169,160 +164,178 @@ function EquipTreasureStrongPopup:OnOpen(...)
local datas={...}
curEquipData=datas[1]
type=datas[2]
end
function EquipTreasureStrongPopup:OnShow()
this.SetWindShow(type)
local datas = EquipTreasureManager.GetAllHeroEquipedTreasureData()
this.formationInfo = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
table.sort(datas,function(a,b)
local aIsMainFormation = this:GetHeroIsMainFormation(a.upHeroDid)
local bIsMainFormation = this:GetHeroIsMainFormation(b.upHeroDid)
if aIsMainFormation and bIsMainFormation then
if a.upHeroDid ~= b.upHeroDid then
return aIsMainFormation.position < bIsMainFormation.position
else
return a.equipType < b.equipType
end
elseif not aIsMainFormation and not bIsMainFormation then
if a.quantity == b.quantity then
return a.id < b.id
else
return a.quantity > b.quantity
end
else
return aIsMainFormation
end
end)
this:ShowTopDataList(datas)
this:SetWindShow(type)
end
function EquipTreasureStrongPopup:GetHeroIsMainFormation(HeroId)
for k,v in ipairs(this.formationInfo.teamHeroInfos) do
if HeroId == v.heroId then
return v
end
end
return nil
end
function EquipTreasureStrongPopup:ShowTopDataList(list)
if not this.treasureDatas then
this.treasureDatas = {}
end
this.firstScrollCycleView:ForeachItemGO(function(index, go)
go.gameObject:SetActive(false)
end)
this.firstScrollCycleView:SetData(list,function(index, go)
this:SetScrollPre(go,list[index],index)
end,false,false)
for i = 1,#list do
if list[i].idDyn == curEquipData.idDyn then
curIndex = i
this.firstScrollCycleView:SetIndex(i)
break
end
end
end
function EquipTreasureStrongPopup:SetScrollPre(go,data,_index)
if data.idDyn == curEquipData.idDyn then
this.select.transform:SetParent(go.transform)
this.select:GetComponent("RectTransform").anchoredPosition3D = Vector3.New(-8.5,6.8,0)
this.select.gameObject:SetActive(true)
end
go.gameObject:SetActive(true)
local btn = Util.GetGameObject(go,"btn")
if not this.treasureDatas[_index] then
this.treasureDatas[_index] = SubUIManager.Open(SubUIConfig.ItemView,go.transform)
this.treasureDatas[_index].transform:SetAsFirstSibling()
end
this.treasureDatas[_index]:OnOpen(false, {data.id,0}, 1, true, false, false, 0,data.idDyn)
this.treasureDatas[_index].name:GetComponent("Text").text = HeroManager.GetSingleHeroData(data.upHeroDid).heroConfig.ReadingName
Util.AddOnceClick(btn,function()
this.select.transform:SetParent(go.transform)
this.select:GetComponent("RectTransform").anchoredPosition3D = Vector3.New(-8.5,6.8,0)
this.select.gameObject:SetActive(true)
curEquipData = data
curIndex = _index
this:SetWindShow(type)
end)
end
--设置界面显示 1.强化 2.精炼
function this.SetWindShow(_index)
function EquipTreasureStrongPopup:SetWindShow(_index)
haveTreasures = {}
type=_index
LogBlue("curEquipData.idDyn:"..curEquipData.idDyn)
type = _index
curEquipData = EquipTreasureManager.GetSingleEquipTreasreData(curEquipData.idDyn)
isMatEnough=true
isCoinEnough=true
this.equipFrame.sprite=this.spLoader:LoadSprite(curEquipData.frame)
this.equipIcon.sprite=this.spLoader:LoadSprite(curEquipData.icon)
this.equipName.text=curEquipData.name
this.proImg.sprite=this.spLoader:LoadSprite(curEquipData.proIcon)
local items, coin
if _index==1 then
this.titleTxt.text=Language[11775]
this.btn_refine:SetActive(false)
this.btn_strong:SetActive(true)
local items, propertyShow
if _index == 1 then
this.titleTxt.text = Language[11775]
this.btnRefine:SetActive(false)
this.btnStrong:SetActive(true)
this.SetBtnSelect(this.btn_strongPage)
--显示属性
this.lvTxt.text=string.format( Language[11776],curEquipData.lv,curEquipData.maxLv)
isMax =curEquipData.lv==curEquipData.maxLv
isMax = curEquipData.lv == curEquipData.maxLv
this.properList[0].leftTxt.text = "强化等级"
if isMax then
this.lvValueTxt.text = isMax and Language[11062] or string.format( "%d/%d",curEquipData.lv,curEquipData.maxLv)
--Util.GetGameObject(this.btn_strong,"Text"):GetComponent("Text").text="已达上限"
--this.btn_refine.gameObject:SetActive(true)
this.btn_strong.gameObject:SetActive(false)
this.properList[0].rightTxt.text = Language[11062]
this.btnStrong.gameObject:SetActive(false)
else
Util.GetGameObject(this.btn_strong,"Text"):GetComponent("Text").text=Language[11777]
this.lvValueTxt.text = isMax and Language[11062] or string.format( "%d/%d",curEquipData.lv+1,curEquipData.maxLv)
this.btn_refine.gameObject:SetActive(false)
this.btnStrongText.text = Language[11777]
this.properList[0].rightTxt.text = string.format( "%d/%d",curEquipData.lv+1,curEquipData.maxLv)
end
local info1=EquipTreasureManager.GetCurrLvAndNextLvPropertyValue(1,curEquipData.levelPool,curEquipData.lv)
this.SetPropertyShow(info1)
propertyShow = EquipTreasureManager.GetCurrLvAndNextLvPropertyValue(1,curEquipData.levelPool,curEquipData.lv)
--显示消耗
items,coin=this.GetCostItems(curEquipData.strongConfig)
items = this:GetCostItems(curEquipData.strongConfig)
this.hintTxt.text=Language[11778]
else
this.titleTxt.text=Language[11779]
this.btn_strong:SetActive(false)
this.btn_refine:SetActive(true)
this.btnRefine:SetActive(true)
this.btnStrong:SetActive(false)
this.SetBtnSelect(this.btn_refinePage)
--显示属性
this.lvTxt.text=string.format( Language[11780],curEquipData.refineLv,curEquipData.maxRefineLv)
isMax=curEquipData.refineLv==curEquipData.maxRefineLv
if isMax then
this.lvValueTxt.text = isMax and Language[11062] or string.format( "%d/%s",curEquipData.refineLv,curEquipData.maxRefineLv)
--Util.GetGameObject(this.btn_refine,"Text"):GetComponent("Text").text="已达上限"
--this.btn_strong.gameObject:SetActive(true)
this.btn_refine.gameObject:SetActive(false)
this.properList[0].leftTxt.text = "精炼等级"
if isMax then
this.properList[0].rightTxt.text = Language[11062]
this.btnRefine.gameObject:SetActive(false)
else
Util.GetGameObject(this.btn_refine,"Text"):GetComponent("Text").text=Language[11781]
this.btn_strong.gameObject:SetActive(false)
this.lvValueTxt.text = isMax and Language[11062] or string.format( "%d/%s",curEquipData.refineLv+1,curEquipData.maxRefineLv)
this.btnRefineText.text=Language[11781]
this.properList[0].rightTxt.text = string.format( "%d/%s",curEquipData.refineLv+1,curEquipData.maxRefineLv)
end
local info2=EquipTreasureManager.GetCurrLvAndNextLvPropertyValue(2,curEquipData.refinePool,curEquipData.refineLv)
this.SetPropertyShow(info2)
items,coin=this.GetCostItems(curEquipData.refineConfig)
propertyShow = EquipTreasureManager.GetCurrLvAndNextLvPropertyValue(2,curEquipData.refinePool,curEquipData.refineLv)
items = this:GetCostItems(curEquipData.refineConfig)
this.hintTxt.text=Language[11782]
end
this.hintTxt.gameObject:SetActive(isMax)
--显示消耗金币
if coin and isMax==false then
this.coinImg.gameObject:SetActive(true)
this.coinTxt.gameObject:SetActive(true)
this.coinBg.gameObject:SetActive(true)
this.coinImg.sprite=this.spLoader:LoadSprite(coin.icon)
if coin.isEnough then
this.coinTxt.text=string.format("<color=#816D4E>%s</color>",coin.needNum)
else
isCoinEnough=false
this.coinTxt.text=string.format("<color=#FF0000FF>%s</color>",coin.needNum)
end
else
this.coinImg.gameObject:SetActive(false)
this.coinTxt.gameObject:SetActive(false)
this.coinBg.gameObject:SetActive(false)
this:SetPropertyShow(propertyShow)
this:CostShow(items)
end
function EquipTreasureStrongPopup:CostShow(items)
if not this.costItemPreList then
this.costItemPreList = {}
end
--显示消耗物品
if items and isMax==false then
this.costItemGrid.gameObject:SetActive(true)
local dataCount=table.getn(items)
local preCount=table.getn(costItemPreList)
for i = 1, dataCount-preCount do
local pre=newObjToParent(this.costItemPre,this.costItemGrid)
pre.transform.localScale = Vector3.one
pre.transform.localPosition = Vector3.zero
table.insert(costItemPreList,pre)
end
local index=1
for i, v in pairs(items) do
local obj=costItemPreList[index]
obj.gameObject:SetActive(true)
if v then
obj.gameObject:SetActive(true)
for i = 1,math.max(#items,#this.costItemPreList) do
if not items[i] then
this.costItemPreList[i].gameObject:SetActive(false)
else
obj.gameObject:SetActive(false)
end
Util.GetGameObject(obj,"iconBg"):GetComponent("Image").sprite=this.spLoader:LoadSprite(v.frame)
Util.GetGameObject(obj,"icon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(v.icon)
if jewelConfig[v.id] then
Util.GetGameObject(obj,"proImg"):SetActive(true)
Util.GetGameObject(obj,"proImg"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetProStrImageByProNum(itemConfig[v.id].PropertyName))
else
Util.GetGameObject(obj,"proImg"):SetActive(false)
end
if v.isEnough then
Util.GetGameObject(obj,"numTxt"):GetComponent("Text").text=string.format("<color=#816D4E>%s/%s</color>",v.haveNum,v.needNum)
else
--如果材料不足默认弹第一个不足的材料tip
if isMatEnough then
isMatEnough=false
matId=v.id
if not this.costItemPreList[i] then
this.costItemPreList[i] = SubUIManager.Open(SubUIConfig.ItemView,this.costItemGrid.transform)
end
Util.GetGameObject(obj,"numTxt"):GetComponent("Text").text=string.format("<color=#FF0000FF>%s/%s</color>",v.haveNum,v.needNum)
end
if v.id==curEquipData.id then
if v.isEnough then
Util.GetGameObject(obj,"add").gameObject:SetActive(false)
this.costItemPreList[i].gameObject:SetActive(true)
if items[i].id==curEquipData.id then
this.costItemPreList[i]:OnOpen(false,{items[i].id,0}, 0.8, true, items[i].isEnough , false, 0)
else
Util.GetGameObject(obj,"add").gameObject:SetActive(true)
this.costItemPreList[i]:OnOpen(false,{items[i].id,0}, 0.8, true, false , false, 0)
end
else
Util.GetGameObject(obj,"add").gameObject:SetActive(false)
end
Util.AddClick(Util.GetGameObject(obj,"icon"),function ()
if jewelConfig[v.id] then
UIManager.OpenPanel(UIName.RewardTalismanSingleShowPopup,2,"",v.id,0,0)
if items[i].isEnough then
this.costItemPreList[i].name:GetComponent("Text").text = string.format("<color=#816D4E>%s/%s</color>",items[i].haveNum,items[i].needNum)
else
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,v.id)
--如果材料不足默认弹第一个不足的材料tip
if isMatEnough then
isMatEnough=false
matId=items[i].id
end
this.costItemPreList[i].name:GetComponent("Text").text = string.format("<color=#FF0000FF>%s/%s</color>",items[i].haveNum,items[i].needNum)
end
end)
index=index+1
end
for i = 1,#costItemPreList do
if i>=index then
costItemPreList[i]:SetActive(false)
end
end
else
this.costItemGrid.gameObject:SetActive(false)
this.costItemGrid.gameObject:SetActive(false)
end
end
--获取消耗物品数据
function this.GetCostItems(_config)
function EquipTreasureStrongPopup:GetCostItems(_config)
if _config==nil then
return
end
@ -331,7 +344,6 @@ function this.GetCostItems(_config)
if exps==nil then
return
end
local costCoin
local items={}
for i = 1,#exps do
local id=exps[i][1]
@ -343,12 +355,7 @@ function this.GetCostItems(_config)
item.haveNum=BagManager.GetItemCountById(id)
item.needNum=exps[i][2]
item.isEnough=item.haveNum>=item.needNum
--消耗金币
if id==14 then
costCoin=item
else
items[i]=item
end
items[i]=item
end
end
if config.JewelExpend then
@ -416,37 +423,38 @@ end
--设置属性的显示
function this.SetPropertyShow(_infos)
local dataCount=LengthOfTable(_infos)
local preCount=#properList
for i = 1, dataCount-preCount do
local go = newObject(this.properItemPre)
go.transform:SetParent(this.propertyGrid.transform)
go.transform.localScale = Vector3.one
go.transform.localPosition = Vector3.zero
go.gameObject:SetActive(false)
--properList[i] = go
table.insert(properList,go)
function EquipTreasureStrongPopup:SetPropertyShow(_infos)
if type == 1 and HarmonyManager.IsInfo(curEquipData.upHeroDid) then
for i = 0, #this.properList do
this.properList[i].go.gameObject:SetActive(false)
end
this.gongming.gameObject:SetActive(true)
return
end
local index=1
this.gongming.gameObject:SetActive(false)
this.properList[0].go.gameObject:SetActive(true)
for i = 1, #this.properList do
this.properList[i].go.gameObject:SetActive(false)
end
local index = 1
for key, value in pairs(_infos) do
local obj=properList[index]
if not this.properList[index] then
this.properList[index] = {}
this.properList[index].go = newObjToParent(this.properItemPre,this.propertyGrid)
this.properList[index].leftTxt = Util.GetGameObject(this.properList[index].go,"leftTxt"):GetComponent("Text")
this.properList[index].rightTxt = Util.GetGameObject(this.properList[index].go,"rightTxt"):GetComponent("Text")
end
this.properList[index].go.gameObject:SetActive(true)
local proper=ConfigManager.GetConfigData(ConfigName.PropertyConfig,key)
if proper.Style==1 then
Util.GetGameObject(obj,"leftTxt"):GetComponent("Text").text=string.format("%s+%s",GetLanguageStrById(proper.Info),value.currValue)
Util.GetGameObject(obj,"rightTxt"):GetComponent("Text").text= isMax and Language[11062] or value.nextValue
this.properList[index].leftTxt.text=string.format("%s+%s",GetLanguageStrById(proper.Info),value.currValue)
this.properList[index].rightTxt.text= isMax and Language[11062] or value.nextValue
else
Util.GetGameObject(obj,"leftTxt"):GetComponent("Text").text=GetLanguageStrById(proper.Info).."+"..value.currValue/100 .."%"
Util.GetGameObject(obj,"rightTxt"):GetComponent("Text").text=isMax and Language[11062] or value.nextValue/100 .."%"
this.properList[index].leftTxt.text=GetLanguageStrById(proper.Info).."+"..value.currValue/100 .."%"
this.properList[index].rightTxt.text = isMax and Language[11062] or value.nextValue/100 .."%"
end
obj.gameObject:SetActive(true)
index=index+1
end
for i = 1, #properList do
if i>=index then
properList[i]:SetActive(false)
end
end
end
--设置物体选中
@ -459,22 +467,30 @@ end
--界面关闭时调用(用于子类重写)
function EquipTreasureStrongPopup:OnClose()
curEquipData=nil
isEnough=true
type=0
isMax=false
isCoinEnough=false
isMatEnough=false
haveTreasures={}
matId = 0
end
--界面销毁时调用(用于子类重写)
function EquipTreasureStrongPopup:OnDestroy()
this.spLoader:Destroy()
curEquipData=nil
properList={}
costItemPreList={}
isEnough=true
haveTreasures={}
type=0
isMatEnough=false
matId=0
isCoinEnough=false
isMax=false
Util.ClearChild(this.propertyGrid.transform)
this.properList = {}
for i = 1,#this.costItemPreList do
SubUIManager.Close(this.costItemPreList[i])
end
this.costItemPreList = {}
for i = 1,#this.costItemPreList do
SubUIManager.Close(this.treasureDatas[i])
end
this.costItemPreList = {}
SubUIManager.Close(this.firstScrollCycleView)
end
return EquipTreasureStrongPopup

View File

@ -28,6 +28,8 @@ function ItemView:InitComponent()
Util.GetGameObject(self.gameObject, "item/heroShow/posIcon"):SetActive(false)
self.name = Util.GetGameObject(self.gameObject, "name")
self.resetLv = Util.GetGameObject(self.gameObject, "item/resetLv")
self.rightUplv = Util.GetGameObject(self.gameObject, "item/rightUplv"):GetComponent("Text")
self.middleDownLv = Util.GetGameObject(self.gameObject, "item/middleDownLv"):GetComponent("Text")
self.item = Util.GetGameObject(self.gameObject, "item")
self.innateImage=Util.GetGameObject(self.gameObject, "item/innateImage")
self.innateText=Util.GetGameObject(self.gameObject, "item/innateImage/Text"):GetComponent("Text")
@ -82,7 +84,7 @@ end
--isPlayAnim 是否播放获得动画(默认不播)
--effectLayer 当前界面层级(显示粒子特效用)
--界面打开时调用(用于子类重写)
function ItemView:OnOpen(isGet, itemDatas, _scale, isShowName, isShowAddImage, isPlayAnim, effectLayer)
function ItemView:OnOpen(isGet, itemDatas, _scale, isShowName, isShowAddImage, isPlayAnim, effectLayer,Did)
isShowName = isShowName or false
isShowAddImage = isShowAddImage or false
isPlayAnim = isPlayAnim or false
@ -92,6 +94,7 @@ function ItemView:OnOpen(isGet, itemDatas, _scale, isShowName, isShowAddImage, i
self.addImage:SetActive(isShowAddImage)
self.gameObject:GetComponent("PlayFlyAnim").enabled = isPlayAnim
self.scale = _scale or 1
self.Did = Did
--self.gameObject:GetComponent("RectTransform").localScale = Vector2.New(scale, scale)
self.gameObject:GetComponent("RectTransform").sizeDelta = Vector2.New(135, 135)
if isGet and itemDatas then
@ -101,6 +104,8 @@ function ItemView:OnOpen(isGet, itemDatas, _scale, isShowName, isShowAddImage, i
end
end
function ItemView:GetRewardShow(_itemData, effectLayer)
self.rightUplv.gameObject:SetActive(false)
self.middleDownLv.gameObject:SetActive(false)
self.isRewardItemPop=true
self.fragmentIcon:SetActive(false)
self.heroShowGo:SetActive(false)
@ -393,6 +398,8 @@ function ItemView:NoGetRewardShow(_reward, effectLayer, isShowAddImage)
self.UI_Effect_jinkuang_Yuan:SetActive(false)
self.UI_effect_ItemView_saoguang:SetActive(false)
self.UI_effect_WuCai_Kuang:SetActive(false)
self.rightUplv.gameObject:SetActive(false)
self.middleDownLv.gameObject:SetActive(false)
self.iconGo:SetActive(true)
self.circleFrameBg:SetActive(false)
Util.AddParticleSortLayer(self.UI_Effect_Kuang_JinSe, effectLayer - self.EffectOrginLayerQu)
@ -565,6 +572,29 @@ function ItemView:NoGetRewardShow(_reward, effectLayer, isShowAddImage)
self.icon.sprite = self.spLoader:LoadSprite(GetResourcePath(itemConfig[itemSId].ResourceID))
self.fragmentIcon:SetActive(true)
self.fragmentIcon:GetComponent("Image").sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(itemConfig[itemSId].PropertyName))
if not self.Did then
self.rightUplv.gameObject:SetActive(false)
self.middleDownLv.gameObject:SetActive(false)
else
local data = EquipTreasureManager.GetSingleTreasureByIdDyn(self.Did)
if not data then
self.rightUplv.gameObject:SetActive(false)
self.middleDownLv.gameObject:SetActive(false)
else
if data.lv > 0 then
self.rightUplv.gameObject:SetActive(true)
self.rightUplv.text = string.format("<color=#32F432>+%s</color>",data.lv)
else
self.rightUplv.gameObject:SetActive(false)
end
if data.refineLv > 0 then
self.middleDownLv.gameObject:SetActive(true)
self.middleDownLv.text =string.format("<color=#32CFF4>+%s</color>", data.refineLv)
else
self.middleDownLv.gameObject:SetActive(false)
end
end
end
Util.AddOnceClick(self.frameBtn, function()
UIManager.OpenPanel(UIName.RewardTalismanSingleShowPopup,2,"",itemSId,0,0)
end)
@ -715,6 +745,9 @@ function ItemView:OnClose()
-- 修复对象池回收层级没有重置,导致特效穿透的问题
self:SetEffectLayer(-self.EffectOrginLayerQu)
self.spLoader:Destroy()
self.rightUplv.gameObject:SetActive(false)
self.middleDownLv.gameObject:SetActive(false)
self.Did = nil
end
function ItemView:OnDestroy()