diff --git a/Assets/ManagedResources/Prefabs/UI/GodWeapon/GodWeaponInfoPanel.prefab b/Assets/ManagedResources/Prefabs/UI/GodWeapon/GodWeaponInfoPanel.prefab index 8927d9e8fc..2d29c52e83 100644 --- a/Assets/ManagedResources/Prefabs/UI/GodWeapon/GodWeaponInfoPanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/GodWeapon/GodWeaponInfoPanel.prefab @@ -36,8 +36,8 @@ RectTransform: m_Father: {fileID: 7828067444209862821} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 1} - m_AnchorMax: {x: 0, y: 1} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 25, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 1} @@ -2050,7 +2050,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_Color: {r: 0.5176471, g: 0.31764707, b: 0.22352943, a: 1} m_RaycastTarget: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -2059,7 +2059,7 @@ MonoBehaviour: Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: 4b73e9e4512d17e4daeea351e090d33c, type: 3} - m_FontSize: 25 + m_FontSize: 35 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 2 @@ -2388,7 +2388,7 @@ GameObject: - component: {fileID: 2696076604634790031} - component: {fileID: 2696076604634790030} m_Layer: 5 - m_Name: Button (3) + m_Name: unloadBtn m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -3267,7 +3267,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: -170, y: -115} - m_SizeDelta: {x: 160, y: 53} + m_SizeDelta: {x: 190, y: 70} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &2696076605480272384 CanvasRenderer: @@ -3297,7 +3297,7 @@ MonoBehaviour: m_Calls: [] m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - m_Sprite: {fileID: 21300000, guid: a379642716d30e746a7730ece97c7704, type: 3} + m_Sprite: {fileID: 21300000, guid: addacd5860691b74db509358d99a6dfb, type: 3} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -3385,7 +3385,7 @@ RectTransform: m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} m_AnchoredPosition: {x: 170, y: -115} - m_SizeDelta: {x: 160, y: 53} + m_SizeDelta: {x: 190, y: 70} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &2696076605662271635 CanvasRenderer: @@ -3415,7 +3415,7 @@ MonoBehaviour: m_Calls: [] m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null - m_Sprite: {fileID: 21300000, guid: a379642716d30e746a7730ece97c7704, type: 3} + m_Sprite: {fileID: 21300000, guid: cc47a59ad14ba0344b8eaa93093a8bd5, type: 3} m_Type: 0 m_PreserveAspect: 0 m_FillCenter: 1 @@ -3479,7 +3479,7 @@ GameObject: - component: {fileID: 2696076605675086638} - component: {fileID: 2696076605675086637} m_Layer: 5 - m_Name: Button (2) + m_Name: changeBtn m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -3642,7 +3642,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Material: {fileID: 0} - m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1} + m_Color: {r: 0.5176471, g: 0.31764707, b: 0.22352943, a: 1} m_RaycastTarget: 1 m_OnCullStateChanged: m_PersistentCalls: @@ -3651,7 +3651,7 @@ MonoBehaviour: Version=1.0.0.0, Culture=neutral, PublicKeyToken=null m_FontData: m_Font: {fileID: 12800000, guid: 4b73e9e4512d17e4daeea351e090d33c, type: 3} - m_FontSize: 25 + m_FontSize: 35 m_FontStyle: 0 m_BestFit: 0 m_MinSize: 0 @@ -6169,7 +6169,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1} - m_AnchoredPosition: {x: 0, y: -0.000030517578} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 0, y: 0} m_Pivot: {x: 0, y: 1} --- !u!222 &3992972364876945023 diff --git a/Assets/ManagedResources/Prefabs/UI/GodWeapon/GodWeaponUpPanel.prefab b/Assets/ManagedResources/Prefabs/UI/GodWeapon/GodWeaponUpPanel.prefab index 947ddb0837..579becea92 100644 --- a/Assets/ManagedResources/Prefabs/UI/GodWeapon/GodWeaponUpPanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/GodWeapon/GodWeaponUpPanel.prefab @@ -187,7 +187,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 460.8, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 921.6, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!222 &8020006507883475629 @@ -647,7 +647,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 463.4, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 876.8, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!222 &5543922836007099624 @@ -743,7 +743,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 1} m_AnchorMax: {x: 0.5, y: 1} - m_AnchoredPosition: {x: 0, y: 0.000015258789} + m_AnchoredPosition: {x: 0, y: 0.000022888184} m_SizeDelta: {x: 921.6, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!222 &4363852263215371060 @@ -4607,7 +4607,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 460.8, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 921.6, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!222 &99618445818788559 @@ -4764,7 +4764,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0} - m_AnchoredPosition: {x: 463.4, y: 0} + m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: 876.8, y: 0} m_Pivot: {x: 0.5, y: 1} --- !u!222 &524564526553235147 @@ -5146,6 +5146,7 @@ GameObject: - component: {fileID: 4232835687836527410} - component: {fileID: 4232835687836527421} - component: {fileID: 4232835687836527420} + - component: {fileID: 6163269794362358217} m_Layer: 5 m_Name: upLvBtn m_TagString: Untagged @@ -5252,6 +5253,20 @@ MonoBehaviour: m_Calls: [] m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +--- !u!114 &6163269794362358217 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 4232835687836527422} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: c8482223f7a300343abc792779f7e094, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Delegates: [] + delegates: [] --- !u!1 &4232835688393017275 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index 88fbd8462e..103440facc 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -494,6 +494,7 @@ PanelType = { HomeLand = {14,12061,12062,1297}, ExploreFun = { 14, 16, 12061 }, -- 体力 2 GodPrint = { 14, 16, 1294 }, -- 神印 + GodWeapon={14, 16,22301}, --神兵 } diff --git a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua index 0f7ad2274d..fc8d85845c 100644 --- a/Assets/ManagedResources/~Lua/Logic/GameEvent.lua +++ b/Assets/ManagedResources/~Lua/Logic/GameEvent.lua @@ -561,4 +561,8 @@ GameEvent = { RefreshIncarnationPanel = "RefreshIncarnationPanel", RefreshIncarnationPanelUp = "RefreshIncarnationPanelUp", }, + --神兵消息 + GodWeapon={ + RefreshGodWeaponInfoPanel = "RefreshGodWeaponInfoPanel", + }, } \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponInfoPanel.lua b/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponInfoPanel.lua index 32b261a8dd..64ef1135dd 100644 --- a/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponInfoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponInfoPanel.lua @@ -13,6 +13,8 @@ function this:InitComponent() this.upStarBtn=Util.GetGameObject(self.gameObject,"infoLayout/propertyInfo/upStarBtn") this.upLvBtn=Util.GetGameObject(self.gameObject,"infoLayout/propertyInfo/upLvBtn") this.skillGrid=Util.GetGameObject(self.gameObject,"infoLayout/skill/scroll/grid") + this.unloadBtn = Util.GetGameObject(self.gameObject, "infoLayout/unloadBtn") + this.changeBtn = Util.GetGameObject(self.gameObject, "infoLayout/changeBtn") end --绑定事件(用于子类重写) @@ -26,12 +28,23 @@ function this:BindEvent() Util.AddClick(this.upLvBtn, function() UIManager.OpenPanel(UIName.GodWeaponUpPanel,2,godwData) end) + Util.AddClick(this.unloadBtn, function() + NetManager.RequestMagicSoldierLocation(godwData.Did,0,function() + PopupTipPanel.ShowTip("下阵成功") + this.unloadBtn.gameObject:SetActive(false) + this.changeBtn.gameObject:SetActive(false) + GodWeaponManager.SetWeaponUpZhen(godwData.Did,0) + end) + end) + Util.AddClick(this.changeBtn, function() + UIManager.OpenPanel(UIName.GodWeaponListPanel,1,godwData,godwData.point) + end) end --添加事件监听(用于子类重写) function this:AddListener() - + -- Game.GlobalEvent:AddEvent(GameEvent.GodWeapon.RefreshGodWeaponInfoPanel, this.ShowPower) end --移除事件监听(用于子类重写) diff --git a/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponListPanel_UpWar.lua b/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponListPanel_UpWar.lua index d8eff6f4b9..283b13c480 100644 --- a/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponListPanel_UpWar.lua +++ b/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponListPanel_UpWar.lua @@ -77,30 +77,11 @@ 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 - --替换 协议 - local oldWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) - local pos = 0 - local allPokemonFormation = PokemonManager.GetAllPokemonFormationData() - for i = 1, #allPokemonFormation do - if allPokemonFormation[i].pokemonId and allPokemonFormation[i].pokemonId == curUpZhenPokemonData.dynamicId then - pos = allPokemonFormation[i].position - allPokemonFormation[i].pokemonId = _itemData.dynamicId - end - end - if pos > 0 then - NetManager.ReplaceTeamPokemonInfoRequest(allPokemonFormation, function() - PokemonManager.RefreshPokemonFormation(allPokemonFormation) - local newWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) - PokemonManager.PiaoWarPowerChange(oldWarPower,newWarPower) - Game.GlobalEvent:DispatchEvent(GameEvent.Pokemon.PokemonUpZhenRefresh) - FormationManager.CheckHeroIdExist() - local pokemonInfoPanem = UIManager.GetOpenPanel(UIName.PokemonInfoPanel) - if pokemonInfoPanem then - pokemonInfoPanem.RefreshShow(_itemData,PokemonManager.GetPokemonUpZhenDatas()) - end - parent:ClosePanel() - end) - end + NetManager.RequestMagicSoldierExchange(curUpZhenPokemonData.Did,_itemData.dynamicId,function() + GodWeaponManager.ChangeWeaponPos(curUpZhenPokemonData.Did,_itemData.dynamicId) + local godWeaponData=GodWeaponManager.GetSingleWeaponData(_itemData.dynamicId) + UIManager.OpenPanel(UIName.GodWeaponInfoPanel,godWeaponData) + end) else --上阵 协议 local oldWarPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) diff --git a/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponManager.lua b/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponManager.lua index 43ea58add3..73e43dcd36 100644 --- a/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponManager.lua @@ -83,7 +83,28 @@ function this.GetSingleWeaponData(_id) end return nil end +---神兵升星刷新数据 +function this.SetGodWeaponStar(_Did) + if allGodWeapons[_Did] then + allGodWeapons[_Did].star=allGodWeapons[_Did].star+1 + end +end +---升星消耗更新消耗数据 +function this.SetGodWeaponUpStarCost(_costDids) + for i = 1, #_costDids do + if allGodWeapons[_costDids[i]] then + allGodWeapons[_costDids[i]]=nil + end + end +end + +---神兵升级刷新数据 +function this.SetGodWeaponLv(_Did,_upLv) + if allGodWeapons[_Did] then + allGodWeapons[_Did].lv=allGodWeapons[_Did].lv+_upLv + end +end --获取当前可上阵的所有灵兽数据 curUpZhenPokemonData 如果不为空就时替换上阵操作 @@ -179,7 +200,6 @@ end function this.GetSinglePokemonAddProData(_did,_star,_lv)--_star 传值的话就用此星级计算属性 -- LogPink("_did 1 ".._did) if not allGodWeapons[_did] then return end - -- LogPink("_did 2 ".._did) local addAllProVal = {} local curPokeonData = allGodWeapons[_did] local curPokemonConFig = ConfigManager.GetConfigData(ConfigName.ShenBing,curPokeonData.id) @@ -226,4 +246,15 @@ function this.GetSingleGodWeaponSkillDes(_did,_star) return skillInfos end +----获取升星需要材料 +function this.GetUpStarCost(_curData) + local costList={} + for key, value in pairs(allGodWeapons) do + if value.id==_curData.id and value.Did~=_curData.Did and value.lv<=1 and value.star<=0 then + table.insert(costList,value.Did) + end + end + return costList +end + return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponUpPanel.lua b/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponUpPanel.lua index 670361797b..384086d000 100644 --- a/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponUpPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/GodWeapon/GodWeaponUpPanel.lua @@ -3,6 +3,14 @@ GodWeaponUpPanel = Inherit(BasePanel) local this = GodWeaponUpPanel local tabType=1 --1升星 2升级 local godWeaponData + +--长按升级状态 +local _isClicked = false +local _isReqLvUp = false +local _isLongPress = false +local addLvNum=0 +local isTriggerLongClick = false--长按是否升过级 +local costItems={} --初始化组件(用于子类重写) function this:InitComponent() this.btnBack = Util.GetGameObject(self.gameObject, "btnBack") @@ -20,6 +28,7 @@ function this:InitComponent() this.skillLayout=Util.GetGameObject(self.gameObject,"infoLayout/skillLayout") this.upStarBtn=Util.GetGameObject(self.gameObject,"infoLayout/btnLayout/upStarBtn") this.upLvBtn=Util.GetGameObject(self.gameObject,"infoLayout/btnLayout/upLvBtn") + this.upLvTrigger = Util.GetEventTriggerListener(this.upLvBtn) this.limitText=Util.GetGameObject(self.gameObject,"infoLayout/btnLayout/limitText"):GetComponent("Text") this.jiantou=Util.GetGameObject(self.gameObject,"infoLayout/propertyInfo/jiantou") this.starGrid=Util.GetGameObject(self.gameObject,"starGrid/starGrid") @@ -27,6 +36,7 @@ function this:InitComponent() this.curSkillInfo=Util.GetGameObject(self.gameObject,"infoLayout/skillLayout/skillScroll/skillGrid/curSkillInfo") this.nextSkillInfo=Util.GetGameObject(self.gameObject,"infoLayout/skillLayout/skillScroll/skillGrid/nextSkillInfo") this.costItemViews={} + this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft }) end --绑定事件(用于子类重写) @@ -45,11 +55,105 @@ function this:BindEvent() this.UpdateWinInfo() end) Util.AddClick(this.upStarBtn, function() - + local haveUpStarCost=GodWeaponManager.GetUpStarCost(godWeaponData) + local starConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.ShenbingStar,"Star",godWeaponData.star,"Quality",godWeaponData.config.Quality) + local needNum=starConfig.ConsumeItemNum + if #haveUpStarCost>=needNum then + local costList={} + for i = 1, needNum do + costList[i]=haveUpStarCost[i] + end + NetManager.RequestMagicSoldierStrong(godWeaponData.Did,2,0,costList,function(msg) + this.UpdateWinInfo() + end) + end end) Util.AddClick(this.upLvBtn, function() - + this.LvUpClick(true) end) + --长按升级按下状态 + this._onPointerDown = function(Pointgo, data) + isTriggerLongClick = false + _isClicked = true + this.timePressStarted = Time.realtimeSinceStartup + end + --长按升级抬起状态 + this._onPointerUp = function(Pointgo, data) + if _isLongPress and isTriggerLongClick then + --连续升级抬起请求升级 + this.LongLvUpClick() + end + _isClicked = false + _isLongPress = false + end + this.upLvTrigger.onPointerDown = this.upLvTrigger.onPointerDown + this._onPointerDown + this.upLvTrigger.onPointerUp = this.upLvTrigger.onPointerUp + this._onPointerUp +end + +--长按升级处理 +function this.OnUpdate() + if _isClicked then + if Time.realtimeSinceStartup - this.timePressStarted > 0.4 then + _isLongPress = true + if not _isReqLvUp then + _isReqLvUp = true + this.LvUpClick(false) + end + end + end +end + +--长按升级结束后请求协议 +function this.LongLvUpClick() + NetManager.RequestMagicSoldierStrong(godWeaponData.Did,1,addLvNum,nil,function(msg) + _isReqLvUp = false + addLvNum=0 + end) +end + +--升级按钮点击事件处理 +function this.LvUpClick(isSingleLvUp) + local isCost=true + local isLimit=godWeaponData.lv>=200 + if #costItems>0 then + for i = 1, #costItems do + local haveCount=BagManager.GetItemCountById(costItems[i][1]) + if haveCount=200 then + PopupTipPanel.ShowTip("等级已达上限") + else + PopupTipPanel.ShowTip("道具不足") + end + return + end + if isSingleLvUp then --单次点击升级 + NetManager.RequestMagicSoldierStrong(godWeaponData.Did,1,1,nil,function(msg) + GodWeaponManager.SetGodWeaponLv(godWeaponData.Did,1) + this.UpdateWinInfo() + end) + else + isTriggerLongClick = true + --前端先扣除材料 + for i = 1, #costItems do + BagManager.HeroLvUpUpdateItemsNum(costItems[i][1],costItems[i][2]) + end + addLvNum=addLvNum+1 + GodWeaponManager.SetGodWeaponLv(godWeaponData.Did,1) + this.UpdateWinInfo() + _isReqLvUp = false + end end function this.SetSelectBtn() @@ -75,6 +179,11 @@ function this:OnOpen(_type,_data) this.icon.sprite = this.spLoader:LoadSprite(GetResourcePath(godWeaponData.config.Icon)) this.nameText.text=godWeaponData.config.Name this.UpdateWinInfo() + this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.GodWeapon }) +end + +function this:OnShow() + FixedUpdateBeat:Add(this.OnUpdate, self)--长按方法注册 end function this.UpdateWinInfo() @@ -83,9 +192,7 @@ function this.UpdateWinInfo() PokemonManager.SetHeroStars(this.spLoader, this.starGrid, godWeaponData.star,1,starSize) local curPropDic local nextPropDic - local costItems={} local isLimit=false - LogBlue(godWeaponData.star.."||||"..godWeaponData.lv.."####"..godWeaponData.config.Quality) if tabType==1 then isLimit=godWeaponData.star>=5 this.skillLayout.gameObject:SetActive(true) @@ -93,13 +200,21 @@ function this.UpdateWinInfo() this.upLvBtn.gameObject:SetActive(false) this.curLv.transform.parent.gameObject:SetActive(false) curPropDic=GodWeaponManager.GetSinglePokemonAddProData(godWeaponData.Did,godWeaponData.star,godWeaponData.lv) + local curSkillInfos= GodWeaponManager.GetSingleGodWeaponSkillDes(godWeaponData.Did) + this.SetSkillInfo(this.curSkillInfo,"升星前技能",curSkillInfos) if not isLimit then nextPropDic=GodWeaponManager.GetSinglePokemonAddProData(godWeaponData.Did,godWeaponData.star+1,godWeaponData.lv) local starConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.ShenbingStar,"Star",godWeaponData.star,"Quality",godWeaponData.config.Quality) costItems[1]={} costItems[1][1]=godWeaponData.id costItems[1][2]=starConfig.ConsumeItemNum + local nextSkillInfos=GodWeaponManager.GetSingleGodWeaponSkillDes(godWeaponData.Did,godWeaponData.star+1) + this.SetSkillInfo(this.nextSkillInfo,"升星后技能",nextSkillInfos) + this.nextSkillInfo.gameObject:SetActive(true) + else + this.nextSkillInfo.gameObject:SetActive(false) end + LayoutRebuilder.ForceRebuildLayoutImmediate(this.skillScroll.transform) this.limitText.text="星级已满" else @@ -125,17 +240,15 @@ function this.UpdateWinInfo() this.limitText.gameObject:SetActive(true) this.nextPropGrid.gameObject:SetActive(false) this.costGrid.gameObject:SetActive(false) + local costItems={} else this.costGrid.gameObject:SetActive(true) this.SetPropInfo(nextPropDic,this.nextPropGrid) this.SetCostItemInfo(costItems) + this.limitText.gameObject:SetActive(false) end - local curSkillInfos= GodWeaponManager.GetSingleGodWeaponSkillDes(godWeaponData.Did) - local nextSkillInfos=GodWeaponManager.GetSingleGodWeaponSkillDes(godWeaponData.Did,godWeaponData.star+1) - this.SetSkillInfo(this.curSkillInfo,"升星前技能",curSkillInfos) - this.SetSkillInfo(this.nextSkillInfo,"升星后技能",nextSkillInfos) - LayoutRebuilder.ForceRebuildLayoutImmediate(this.skillScroll.transform) + end ---设置属性信息 @@ -173,6 +286,7 @@ function this.SetSkillInfo(_skillInfoObj,_titleStr,_skillDatas) Util.GetGameObject(_skillInfoObj,"des"):GetComponent("Text").text=desStr LayoutRebuilder.ForceRebuildLayoutImmediate(_skillInfoObj.transform) end + --设置消耗材料显示 function this.SetCostItemInfo(_costItems) if not this.costItemViews then @@ -182,14 +296,24 @@ function this.SetCostItemInfo(_costItems) v.gameObject:SetActive(false) end for i = 1, #_costItems do - if i<#this.costItemViews then - this.costItemViews[i].OnOpen(false,{_costItems[i][1],_costItems[i][2]},0.9,true,false,false,this.sortingOrder) + local view + if i<=#this.costItemViews then + view=this.costItemViews[i] else - local view= SubUIManager.Open(SubUIConfig.ItemView, this.costGrid.transform) - view:OnOpen(false,{_costItems[i][1],_costItems[i][2]},0.9,true,false,false,this.sortingOrder) - this.costItemViews[i]=view + view= SubUIManager.Open(SubUIConfig.ItemView, this.costGrid.transform) + table.insert(this.costItemViews,view) + end + view:OnOpen(false,{_costItems[i][1],_costItems[i][2]},0.9,true,true,false,this.sortingOrder) + view.gameObject:SetActive(true) + view.addImage.gameObject:SetActive(false) + if tabType==1 then + local haveUpStarCost=GodWeaponManager.GetUpStarCost(godWeaponData) + local needNum=_costItems[i][2] + view.num:GetComponent("Text").text=string.format("%s/%s",#haveUpStarCost,_costItems[i][2]) + if #haveUpStarCost>=needNum then + view.num:GetComponent("Text").color=UIColor.WRITE + end end - end end @@ -200,12 +324,13 @@ end --界面关闭时调用(用于子类重写) function this:OnClose() - + FixedUpdateBeat:Remove(this.OnUpdate, self) end --界面销毁时调用(用于子类重写) function this:OnDestroy() this.spLoader:Destroy() + SubUIManager.Close(this.UpView) end return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua index 799c661b0b..b25348b355 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/NetManager.lua @@ -7177,14 +7177,27 @@ end ---神兵强化 -function NetManager.RequestMagicSoldierStrong(_id,_type,_target,_func) +--神兵强化 //1:升级,2:升星 +function NetManager.RequestMagicSoldierStrong(_id,_type,_num,_costIds,_func) local data = PlayerInfoProto_pb.MagicSoldierStrongRequest() data.id=_id data.type=_type - data.target=_target + if _type==1 then + data.num=_num + else + for i = 1, #_costIds do + table.insert(data.costIds,_costIds[i]) + end + end local msg = data:SerializeToString() Network:SendMessageWithCallBack(MessageTypeProto_pb.MAGIC_SOLDIER_STRONG_REQUEST,MessageTypeProto_pb.MAGIC_SOLDIER_STRONG_RESPONSE,msg,function(buffer) + local data = buffer:DataByte() + local msg = PlayerInfoProto_pb.MagicSoldierStrongResponse() + msg:ParseFromString(data) + if _type==2 then + GodWeaponManager.SetGodWeaponStar(_id) + GodWeaponManager.SetGodWeaponUpStarCost(_costIds) + end if _func then _func(msg) end diff --git a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpLv.lua b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpLv.lua index 0c06979d11..45aa14bfb0 100644 --- a/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpLv.lua +++ b/Assets/ManagedResources/~Lua/Modules/Pokemon/view/PokemonInfoPanel_UpLv.lua @@ -59,33 +59,33 @@ function this:InitComponent(gameObject) end function this:BindEvent() - --升级 - Util.AddClick(this.upLvBtn, function() - if Time.realtimeSinceStartup - this.timePressStarted <= 0.4 then - this.LvUpClick(true) + --升级 + Util.AddClick(this.upLvBtn, function() + if Time.realtimeSinceStartup - this.timePressStarted <= 0.4 then + this.LvUpClick(true) + end + end) + --长按升级按下状态 + this._onPointerDown = function(Pointgo, data) + isTriggerLongClick = false + _isClicked = true + this.timePressStarted = Time.realtimeSinceStartup + oldLv = curPokemonData.lv + allAddProVal = PokemonManager.GetSinglePokemonAddProData(curPokemonData.dynamicId) end -end) ---长按升级按下状态 -this._onPointerDown = function(Pointgo, data) - isTriggerLongClick = false - _isClicked = true - this.timePressStarted = Time.realtimeSinceStartup - oldLv = curPokemonData.lv - allAddProVal = PokemonManager.GetSinglePokemonAddProData(curPokemonData.dynamicId) -end ---长按升级抬起状态 -this._onPointerUp = function(Pointgo, data) - LogPink("连续升级抬起请求升级 "..tostring(_isLongPress)) - if _isLongPress and isTriggerLongClick then - --连续升级抬起请求升级 - LogPink("连续升级抬起请求升级 ") - this.LongLvUpClick(oldLv) + --长按升级抬起状态 + this._onPointerUp = function(Pointgo, data) + LogPink("连续升级抬起请求升级 "..tostring(_isLongPress)) + if _isLongPress and isTriggerLongClick then + --连续升级抬起请求升级 + LogPink("连续升级抬起请求升级 ") + this.LongLvUpClick(oldLv) + end + _isClicked = false + _isLongPress = false end - _isClicked = false - _isLongPress = false -end -this.upLvTrigger.onPointerDown = this.upLvTrigger.onPointerDown + this._onPointerDown -this.upLvTrigger.onPointerUp = this.upLvTrigger.onPointerUp + this._onPointerUp + this.upLvTrigger.onPointerDown = this.upLvTrigger.onPointerDown + this._onPointerDown + this.upLvTrigger.onPointerUp = this.upLvTrigger.onPointerUp + this._onPointerUp end function this:AddListener()