神兵更换代码提交

dev_chengFeng
yuanshuai 2023-03-31 18:20:38 +08:00
parent a176bca619
commit 6c5acdab26
2 changed files with 16 additions and 7 deletions

View File

@ -44,21 +44,25 @@ end
--添加事件监听(用于子类重写)
function this:AddListener()
-- Game.GlobalEvent:AddEvent(GameEvent.GodWeapon.RefreshGodWeaponInfoPanel, this.ShowPower)
Game.GlobalEvent:AddEvent(GameEvent.GodWeapon.RefreshGodWeaponInfoPanel, this.UpdateWin)
end
--移除事件监听(用于子类重写)
function this:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.GodWeapon.RefreshGodWeaponInfoPanel, this.UpdateWin)
end
--界面打开时调用(用于子类重写)
function this:OnOpen(_data)
this.UpdateWin(_data)
end
function this.UpdateWin(_data)
godwData=_data
this.icon.sprite = this.spLoader:LoadSprite(GetResourcePath(_data.config.Icon))
this.nameText.text=_data.config.Name
local starSize = Vector2.New(65,65)
PokemonManager.SetHeroStars(this.spLoader, this.starGrid,godwData.star,1,starSize)
PokemonManager.SetHeroStars(this.spLoader, this.starGrid,_data.star,1,starSize)
local allPropDic=GodWeaponManager.GetSinglePokemonAddProData(_data.Did,_data.star)
local propInfoList={}
propInfoList[1]={}

View File

@ -77,10 +77,15 @@ function this.SingleItemDataShow(_go,_itemData)
SetHeroStars(this.spLoader, Util.GetGameObject(_go.transform, "star/starGrid"), _itemData.star,1,starSize,-5,Vector2.New(0.5,0.5))
Util.AddOnceClick(Util.GetGameObject(_go.transform,"upZhen"), function()
if curUpZhenPokemonData then
NetManager.RequestMagicSoldierExchange(curUpZhenPokemonData.Did,_itemData.dynamicId,function()
GodWeaponManager.ChangeWeaponPos(curUpZhenPokemonData.Did,_itemData.dynamicId)
local godWeaponData=GodWeaponManager.GetSingleWeaponData(_itemData.dynamicId)
UIManager.OpenPanel(UIName.GodWeaponInfoPanel,godWeaponData)
NetManager.RequestMagicSoldierLocation(curUpZhenPokemonData.Did,0,function()
local upPos=curUpZhenPokemonData.point
GodWeaponManager.SetWeaponUpZhen(curUpZhenPokemonData.Did,0)
NetManager.RequestMagicSoldierLocation(_itemData.dynamicId,upPos,function()
GodWeaponManager.SetWeaponUpZhen(_itemData.dynamicId,upPos)
local godWeaponData=GodWeaponManager.GetSingleWeaponData(_itemData.dynamicId)
Game.GlobalEvent:DispatchEvent(GameEvent.GodWeapon.RefreshGodWeaponInfoPanel,godWeaponData)
parent:ClosePanel()
end)
end)
else
--上阵 协议