From 22a2789d08bd02ca1032c11296d9de698064d996 Mon Sep 17 00:00:00 2001 From: wangzhenxing Date: Fri, 23 Oct 2020 09:54:49 +0900 Subject: [PATCH] =?UTF-8?q?=E7=81=B5=E5=85=BD=E6=B6=85=E6=A7=83=E6=8F=90?= =?UTF-8?q?=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Prefabs/UI/Resolve/ResolvePanel.prefab | 20 +++--- .../~Lua/Modules/Bag/BagManager.lua | 19 +++++- .../~Lua/Modules/Net/NetManager.lua | 13 ++++ .../~Lua/Modules/Pokemon/PokemonInfoPanel.lua | 47 +++++++------- .../~Lua/Modules/Pokemon/PokemonManager.lua | 5 +- .../~Lua/Modules/Popup/GeneralPopup.lua | 4 +- .../View/GeneralPopup_PokemonResolve.lua | 8 +-- .../View/GeneralPopup_ResolveDismantle.lua | 9 ++- .../Modules/Resolve/View/Resolve_Pokemon.lua | 65 ++++++++++++------- 9 files changed, 124 insertions(+), 66 deletions(-) diff --git a/Assets/ManagedResources/Prefabs/UI/Resolve/ResolvePanel.prefab b/Assets/ManagedResources/Prefabs/UI/Resolve/ResolvePanel.prefab index 2b4c5a5747..fb38435aaf 100644 --- a/Assets/ManagedResources/Prefabs/UI/Resolve/ResolvePanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/Resolve/ResolvePanel.prefab @@ -147,7 +147,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -221.00928} + m_AnchoredPosition: {x: 0, y: -221.00934} m_SizeDelta: {x: 0, y: -642.03} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &596642562941241991 @@ -372,7 +372,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 0, y: 20.099945} - m_SizeDelta: {x: 140, y: 140} + m_SizeDelta: {x: 150, y: 150} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &6996615424501926437 CanvasRenderer: @@ -396,7 +396,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 + m_RaycastTarget: 0 m_OnCullStateChanged: m_PersistentCalls: m_Calls: [] @@ -598,7 +598,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &6630273786794472594 RectTransform: m_ObjectHideFlags: 0 @@ -2440,7 +2440,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -221.00928} + m_AnchoredPosition: {x: 0, y: -221.00934} m_SizeDelta: {x: 0, y: -642.03} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1114639480647534771 @@ -5497,7 +5497,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -221.00928} + m_AnchoredPosition: {x: 0, y: -221.00934} m_SizeDelta: {x: 0, y: -642.03} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &5324989187067502496 @@ -7490,7 +7490,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -221.00928} + m_AnchoredPosition: {x: 0, y: -221.00934} m_SizeDelta: {x: 0, y: -642.03} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &636023640754060400 @@ -11170,7 +11170,7 @@ RectTransform: m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} + m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0.5, y: 0.5} @@ -12210,7 +12210,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0} m_AnchorMax: {x: 0.5, y: 0} - m_AnchoredPosition: {x: 18.400003, y: -38.64038} + m_AnchoredPosition: {x: 18.400003, y: -38.640686} m_SizeDelta: {x: 1000.3, y: 80.099976} m_Pivot: {x: 0.5, y: 0.5} --- !u!1 &7583128554718342606 @@ -13467,7 +13467,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: -221.00928} + m_AnchoredPosition: {x: 0, y: -221.00934} m_SizeDelta: {x: 0, y: -642.03} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &4595371406642608546 diff --git a/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua b/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua index 76d8168f88..24c2d7327f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Bag/BagManager.lua @@ -291,6 +291,22 @@ function this.GetBagItemDataByItemType(_itemType) end return items end + +--通过物品类型获得物品list +function this.GetItemDataByItemType(_itemType) + local items = {} + local index = 1 + --LogError("_itemType ".._itemType) + for i, v in pairs(this.bagDatas) do + --LogError(v.itemConfig.Name.." ".._itemType.." "..v.type.." "..v.num) + if v.type == _itemType and v.num > 0 then + items[index] = v + index = index + 1 + end + end + return items +end + --通过物品类型获得物品list function this.GetDataByItemType(_itemType) local items = {} @@ -710,10 +726,11 @@ function this.GetTableByBackDropData(drop) local itemdata = {} itemdata.itemType = 6 itemdata.sId = drop.pokemon[i].tempId - itemdata.backData = drop.pokemon[i] + itemdata.backData = drop.pokemon[i] itemdata.configData = ConfigManager.GetConfigData(ConfigName.SpiritAnimal, drop.pokemon[i].tempId) local itemConfig = itemConfig[drop.pokemon[i].tempId] itemdata.name = itemConfig.ReadingName + itemdata.config=itemConfig itemdata.frame = GetHeroQuantityImageByquality(itemConfig.ResourceID) itemdata.icon ="r_jieling_fl_3008_SkillStarGem" -- GetResourcePath(itemConfig.Icon) itemdata.num = 1 diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index e08646f775..e2a68e0d8c 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -4520,6 +4520,19 @@ function this.UpPokemonStarRequest(pokemonDId,curUpStarSelectPokemonData, func) end end) end +--请求灵兽涅槃 +function this.PokemonBackRequest(pokemons, func) + local data = HeroInfoProto_pb.PokemonBackRequest() + data.pokemonId = pokemons + local msg = data:SerializeToString() + Network:SendMessageWithCallBack(MessageTypeProto_pb.POKEMON_BACK_REQUEST, MessageTypeProto_pb.POKEMON_BACK_RESPONSE, msg, function(buffer) + -- local data = buffer:DataByte() + -- msg:ParseFromString(data) + if func then + func(msg) + end + end) +end --替换灵兽编队 function this.ReplaceTeamPokemonInfoRequest(_teamPokemonInfos, func) local data = HeroInfoProto_pb.ReplaceTeamPokemonInfoRequest() diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua index ce792f72e9..46a32259c7 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonInfoPanel.lua @@ -11,7 +11,6 @@ local pokemonDatas--所有灵兽list信息 local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local heroRankupConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig) local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) -local spiritConfig=ConfigManager.GetConfig(ConfigName.SpiritAnimalSetting) local index--当前灵兽在 灵兽列表中的索引 local allAddProVal={}--所有属性加成值 local isClickLeftOrRightBtn = true--点击左右按钮切换灵兽播放动画状态 @@ -94,11 +93,11 @@ function PokemonInfoPanel:BindEvent() Util.AddClick(this.nirvanaBtn, function() local lv=curPokemonData.lv local star=curPokemonData.star - local qua=curPokemonData.Quality + local qua=curPokemonData.config.Quality --所有材料 local allMaterials={} --升级消耗 - local lvConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalLevel,"Level",lv,"Quality",star) + local lvConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.SpiritAnimalLevel,"Level",lv,"Quality",qua) if lvConfig then local matrs=lvConfig.SumConsume if matrs then @@ -109,36 +108,40 @@ function PokemonInfoPanel:BindEvent() end end --升星消耗 - local starConfig=ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.SpiritAnimalStar,"Star",star,"Quality",qua) - if starConfig then - --消耗本体数量,分解成碎片 - local lingshouConfig=ConfigManager.GetConfigData(ConfigName.SpiritAnimal,curPokemonData.id) - if starConfig.ConsumeItemNum>0 then - local chipNum=lingshouConfig.PiecesCount*(1+starConfig.ConsumeItemNum) - table.insert(allMaterials,{lingshouConfig.PiecesId,chipNum}) - end - local starMatrs=starConfig.SumConsume - --消耗材料 - if starMatrs then - for i = 1, #starMatrs do - local starm=starMatrs[i] - table.insert(allMaterials,{starm[1],starm[2]}) + local lingshouConfig=ConfigManager.GetConfigData(ConfigName.SpiritAnimal,curPokemonData.id) + if star>0 then + local starConfig=ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.SpiritAnimalStar,"Star",star,"Quality",qua) + if starConfig then + --消耗本体数量,分解成碎片 + if starConfig.ConsumeItemNum>0 then + local chipNum=lingshouConfig.PiecesCount*(1+starConfig.ConsumeItemNum) + table.insert(allMaterials,{lingshouConfig.PiecesId,chipNum}) + end + local starMatrs=starConfig.SumConsume + --消耗材料 + if starMatrs then + for i = 1, #starMatrs do + local starm=starMatrs[i] + table.insert(allMaterials,{starm[1],starm[2]}) + end end end end + local coin=0 --消耗妖晶的数量 - if spiritConfig then - coin=spiritConfig.ReturnCost + if lingshouConfig.ReturnCos then + coin=lingshouConfig.ReturnCost[1][2] + LogError("消耗妖晶数量"..coin) end --判断妖晶是否充足 - if coinBagManager.GetItemCountById(16) then PopupTipPanel.ShowTip(Language[11139]) return end UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.PokemonResolve,coin,allMaterials,function () - NetManager.ComplexEquipRequest(curIndex,0,0,function(msg) - this.OnClickTabBtn(curIndex) + NetManager.PokemonBackRequest(curPokemonData.dynamicId,function(msg) + -- this.OnClickTabBtn(curIndex) UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function() end) end) diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua index ecd544f5cc..2a1ec95255 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/PokemonManager.lua @@ -40,6 +40,7 @@ function this.UpdatePokemonDatas(_msgPokemonData,isRefreshFetter)--单个掉落 singPokemonData.scale = spiritAnimal[singPokemonData.id].Scale singPokemonData.position = spiritAnimal[singPokemonData.id].Position singPokemonData.config= spiritAnimal[_msgPokemonData.tempId] + pokemons[singPokemonData.dynamicId] = singPokemonData if isRefreshFetter then this.GetPokemonRefreshFetter(singPokemonData.id) @@ -58,7 +59,9 @@ end function this.GetPokemonDatas() local curAllPokemonList = {} for key, value in pairs(pokemons) do - table.insert(curAllPokemonList,value) + if not value.isZhen then + table.insert(curAllPokemonList,value) + end end return curAllPokemonList end diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/GeneralPopup.lua b/Assets/ManagedResources/~Lua/Modules/Popup/GeneralPopup.lua index 8a030fbcc2..72d5cb533b 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/GeneralPopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/GeneralPopup.lua @@ -51,9 +51,9 @@ local contentScripts = { --灵兽战力加成 [24] = {view = require("Modules/Popup/View/GeneralPopup_PokemonUpZhenAddPro"), panelName = "GeneralPopup_PokemonUpZhenAddPro",type=GENERAL_POPUP_TYPE.PokemonUpZhenAddPro}, --灵兽涅槃 - [25]={view = require("Modules/Popup/View/GeneralPopup_PokemonResolve"), panelName = "GeneralPopup_PokemonResolve",type=GENERAL_POPUP_TYPE.PokemonResolve}, + [25] = {view = require("Modules/Popup/View/GeneralPopup_PokemonResolve"), panelName = "GeneralPopup_PokemonResolve",type=GENERAL_POPUP_TYPE.PokemonResolve}, --灵兽还原 - [26]={view = require("Modules/Popup/View/GeneralPopup_PokemonRestore"), panelName = "GeneralPopup_PokemonRestore",type=GENERAL_POPUP_TYPE.PokemonResolve}, + [26] = {view = require("Modules/Popup/View/GeneralPopup_PokemonRestore"), panelName = "GeneralPopup_PokemonRestore",type=GENERAL_POPUP_TYPE.PokemonRestore}, --灵兽碎片合成 [27]={view = require("Modules/Popup/View/GeneralPopup_PokemonChipCompound"), panelName = "GeneralPopup_PokemonChipCompound",type=GENERAL_POPUP_TYPE.PokemonCompound}, } diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonResolve.lua b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonResolve.lua index 10c000d525..a0d27627dc 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonResolve.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_PokemonResolve.lua @@ -16,7 +16,7 @@ function this:InitComponent(gameObject) this.titleText.text="灵兽涅槃" this.infoTxt=Util.GetGameObject(gameObject,"Body/Text"):GetComponent("Text") --this.num=Util.GetGameObject(gameObject,"Body/Num"):GetComponent("Text") - -- this.numImage=Util.GetGameObject(gameObject,"Body/Num/Image"):GetComponent("Image") + this.numImage=Util.GetGameObject(gameObject,"Body/Image"):GetComponent("Image") this.cancelBtn=Util.GetGameObject(gameObject,"CancelBtn") this.confirmBtn=Util.GetGameObject(gameObject,"ConfirmBtn") Util.GetGameObject(gameObject,"ConfirmBtn/Text"):GetComponent("Text").text="涅槃" @@ -47,10 +47,10 @@ function this:OnShow(_parent,...) sortingOrder = _parent.sortingOrder --不定参中包含的不定参 _args[1]为面板类型 _args[2]之后(包括)为打开面板后传入的不定参 local args = {...} - this.num.text = args[1] + --this.num.text = args[1] + itemList=args[2] fun = args[3] - this.titleText.text=Language[11617] - this.infoTxt.text=string.format("确认花费 %s将%s涅槃为灵兽碎片,并100%返还养成消耗") + this.infoTxt.text=string.format("确认花费 %s将%s涅槃为灵兽碎片,并100返还养成消耗",args[1],"111") this.numImage.sprite = SetIcon(14) FindFairyManager.ResetItemView(this.root,this.root.transform,itemList,10,1,sortingOrder,false,args[2]) end diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_ResolveDismantle.lua b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_ResolveDismantle.lua index 8956627ce5..25da16e19d 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_ResolveDismantle.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_ResolveDismantle.lua @@ -10,7 +10,9 @@ local dropList = {} --item容器 local itemList = {} --传入选择英雄 -local selectHeroData +local selectHeroData={} +local chipId=0 +local chipNum=0 local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig) local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig) @@ -56,8 +58,9 @@ function this:OnShow(_parent,...) parent=_parent sortingOrder =_parent.sortingOrder local args = {...} - dropList = args[1] - selectHeroData=args[2] + selectHeroData=args[1] + chipId=args[2] + chipNum=args[3] local isShowFourStarUpTip = false for k,v in pairs(selectHeroData) do if v.star >= 4 then diff --git a/Assets/ManagedResources/~Lua/Modules/Resolve/View/Resolve_Pokemon.lua b/Assets/ManagedResources/~Lua/Modules/Resolve/View/Resolve_Pokemon.lua index 881d1e6572..bf975fd6eb 100644 --- a/Assets/ManagedResources/~Lua/Modules/Resolve/View/Resolve_Pokemon.lua +++ b/Assets/ManagedResources/~Lua/Modules/Resolve/View/Resolve_Pokemon.lua @@ -7,14 +7,15 @@ local selectHeroData={}--选择的英雄list did = data local maxSelectNum = 30--最大选择数量 --选择碎片的数量 local selectChipNum = 0 - +--显示的灵兽及碎片数据 +local heroDatas={} local oldChoosed=nil--上一个选中英雄 --选择的碎片id local selectChipId=0 --碎片最大数量 local maxChipNum =0 --是否为灵兽/灵兽碎片 -local isPokemon = true +local isPokemon = false function this:InitComponent(gameObject) --上部内容 this.helpBtn=Util.GetGameObject(gameObject,"Content/Resolve_Pokemon/HelpBtn") @@ -33,7 +34,7 @@ function this:InitComponent(gameObject) this.chipObj=Util.GetGameObject(gameObject, "Content/Resolve_Pokemon/chipObj") this.btn_remove=Util.GetGameObject(gameObject, "Content/Resolve_Pokemon/chipObj/btn_remove") this.btn_add=Util.GetGameObject(gameObject, "Content/Resolve_Pokemon/chipObj/btn_add") - this.chipNumTxt=Util.GetGameObject(gameObject, "Content/Resolve_Pokemon/chipObj/Text") + this.chipNumTxt=Util.GetGameObject(gameObject, "Content/Resolve_Pokemon/chipObj/Text"):GetComponent("Text") this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(gameObject, "Content/Resolve_Pokemon/ItemListRoot").transform, this.cardPre, this.scrollbar, Vector2.New(v21.width, v21.height), 1, 5, Vector2.New(43,15)) @@ -81,7 +82,7 @@ function this:BindEvent() PopupTipPanel.ShowTip(Language[12394]) else UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.ResolveDismantle, - HeroManager.GetHeroReturnItems(selectHeroData,GENERAL_POPUP_TYPE.ResolveDismantle),selectHeroData) + HeroManager.GetHeroReturnItems(selectHeroData,GENERAL_POPUP_TYPE.ResolveDismantle),selectHeroData,selectChipId,selectChipNum) end end) @@ -113,8 +114,6 @@ function this.SortTypeClick(_sortType) --所有灵兽数据 local heros=PokemonManager.GetPokemonDatas() - local heroDatas={} - local chipDatas={} if heros then for i, v in pairs(heros) do local hero={} @@ -122,20 +121,20 @@ function this.SortTypeClick(_sortType) hero.star=v.star hero.lv=v.lv hero.dynamicId=v.dynamicId - hero.ischip=0 - hero.frame= GetHeroQuantityImageByquality(heroConfig.Quality,v.star) + hero.ischip=0 hero.icon=heroConfig.Icon hero.id=v.id hero.quality=heroConfig.Quality hero.name=heroConfig.Name hero.returnCoin=heroConfig.CoinReturn + hero.frame=GetHeroQuantityImageByquality(heroConfig.Quality,1) hero.num=1 table.insert(heroDatas,hero) end end --所有灵兽碎片 - local chips=BagManager.GetBagItemDataByItemType(22) + local chips=BagManager.GetDataByItemType(22) if chips then for i, v in pairs(chips) do local chip={} @@ -149,16 +148,18 @@ function this.SortTypeClick(_sortType) chip.num=v.num chip.name=v.name chip.returnCoin=0 + chip.dynamicId=v.id table.insert(heroDatas,chip) end end - + this.chipObj:SetActive(false) + this.selectText.gameObject:SetActive(true) this.selectText.text = Language[11775].."0/"..maxSelectNum -- this.SortHeroDatas(heroDatas) this.Empty:SetActive(#heroDatas <= 0) this.ScrollView:SetData(heroDatas, function (index, go) - this.SingleHeroDataShow(go, heroDatas[index]) + this.SingleHeroDataShow(go, heroDatas[index],false) end) this.ScrollView:ForeachItemGO(function(index, go) Timer.New(function() @@ -169,25 +170,31 @@ function this.SortTypeClick(_sortType) end --英雄单个数据展示 -function this.SingleHeroDataShow(go,_heroData) +function this.SingleHeroDataShow(go,_heroData,isGray) local heroData = _heroData local _go = go Util.GetGameObject(_go.transform, "frame"):GetComponent("Image").sprite = Util.LoadSprite(heroData.frame) - Util.GetGameObject(_go.transform, "lv/Text"):GetComponent("Text").text = heroData.lv + if heroData.ischip==1 then + Util.GetGameObject(_go.transform, "lv/Text"):GetComponent("Text").text = heroData.num + else + Util.GetGameObject(_go.transform, "lv/Text"):GetComponent("Text").text = heroData.lv + end + Util.GetGameObject(_go.transform, "Text"):GetComponent("Text").text = heroData.name Util.GetGameObject(_go.transform, "icon"):GetComponent("Image").sprite = Util.LoadSprite(heroData.icon) local chipImg=Util.GetGameObject(_go.transform, "chipImg"):GetComponent("Image") + local formationMask =Util.GetGameObject(_go.transform, "mask") if heroData.ischip==1 then chipImg.gameObject:SetActive(true) + formationMask:SetActive(isGray) chipImg.sprite=Util.LoadSprite(GetHeroChipQuantityImageByquality(heroData.quality)) else chipImg.gameObject:SetActive(false) + formationMask:SetActive(false) end local starGrid = Util.GetGameObject(_go.transform, "star") SetHeroStars(starGrid, heroData.star,1,Vector2.New(32.5,32.5),-15) - local choosed =Util.GetGameObject(_go.transform, "choosed") - local formationMask =Util.GetGameObject(_go.transform, "mask") - formationMask:SetActive(not isPokemon) + local choosed =Util.GetGameObject(_go.transform, "choosed") if heroData.ischip then choosed:SetActive(selectChipId==heroData.dynamicId) else @@ -197,11 +204,12 @@ function this.SingleHeroDataShow(go,_heroData) this.selectText.text = Language[11775]..LengthOfTable(selectHeroData).."/"..maxSelectNum Util.AddOnceClick(cardclickBtn, function() --如果点击的是碎片 - if heroData.ischip then + if heroData.ischip==1 then --第一个选中的碎片 if oldChoosed==nil then - this.selectText:SetActive(false) + this.selectText.gameObject:SetActive(false) this.chipObj:SetActive(true) + choosed:SetActive(true) oldChoosed=choosed else --如果选中之前选中的,就取消选中 @@ -209,32 +217,40 @@ function this.SingleHeroDataShow(go,_heroData) oldChoosed=nil selectChipId=0 choosed:SetActive(false) - this.selectText:SetActive(true) + this.selectText.gameObject:SetActive(true) this.selectText.text = Language[11775].."0".."/"..maxSelectNum this.chipObj:SetActive(false) return else oldChoosed:SetActive(false) + choosed:SetActive(true) oldChoosed=choosed end end selectChipId=heroData.dynamicId Util.SetGray(this.btn_add,true) - selectChipNum=heroData.chipNum - maxChipNum=heroData.chipNum + selectChipNum=heroData.num + maxChipNum=heroData.num this.chipNumTxt.text=selectChipNum isPokemon=false - --点击的是灵兽 else --如果灵兽是选中状态,取消选中 if selectHeroData[heroData.dynamicId] then choosed:SetActive(false) + if oldChoosed then + oldChoosed:SetActive(false) + end + selectChipId=0 selectHeroData[heroData.dynamicId] = nil local haveNum=LengthOfTable(selectHeroData) this.selectText.text = Language[11775]..haveNum.."/"..maxSelectNum if haveNum==0 then -- --todo 取消所有碎片置灰 + this.ScrollView:SetData(heroDatas, function (index, go) + this.SingleHeroDataShow(go, heroDatas[index],false) + end) + isPokemon=false end return end @@ -245,8 +261,11 @@ function this.SingleHeroDataShow(go,_heroData) end if isPokemon==false then --todo 首次点击灵兽,置灰所有碎片 + this.ScrollView:SetData(heroDatas, function (index, go) + this.SingleHeroDataShow(go, heroDatas[index],true) + end) selectChipId=0 - this.selectText:SetActive(true) + this.selectText.gameObject:SetActive(true) this.chipObj:SetActive(false) isPokemon = true end