From 2200de75fc56f17707897f25c196795cd135860a Mon Sep 17 00:00:00 2001 From: vurtne14 Date: Thu, 3 Apr 2025 20:07:22 +0800 Subject: [PATCH] 1 --- .../Modules/Adventure/AdventureMainPanel.lua | 188 +-- .../~Lua/Modules/Equip/TalismanManager.lua | 123 +- .../Modules/Fight/FightPointPassManager.lua | 86 +- .../~Lua/Modules/Login/LoginPanel.lua | 2 +- .../~Lua/Modules/Popup/RewardItemPopup.lua | 1 + .../~Lua/Modules/RoleInfo/RoleInfoPanel.lua | 1238 +++++++++-------- 6 files changed, 876 insertions(+), 762 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Adventure/AdventureMainPanel.lua b/Assets/ManagedResources/~Lua/Modules/Adventure/AdventureMainPanel.lua index ecbceada3..3546f1788 100644 --- a/Assets/ManagedResources/~Lua/Modules/Adventure/AdventureMainPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Adventure/AdventureMainPanel.lua @@ -16,12 +16,13 @@ local isChooseOne = false local costHourGlass = 0 local costDemonCrystal = 0 local costDemonCrystalNum = 0 -local sayInfo = { GetLanguageStrById(10046), GetLanguageStrById(10047), GetLanguageStrById(10048), GetLanguageStrById(10049), GetLanguageStrById(10050) } +local sayInfo = { GetLanguageStrById(10046), GetLanguageStrById(10047), GetLanguageStrById(10048), GetLanguageStrById(10049), + GetLanguageStrById(10050) } --初始化组件(用于子类重写) function AdventureMainPanel:InitComponent() this.btnBack = Util.GetGameObject(self.gameObject, "btnBack") this.helpBtn = Util.GetGameObject(self.gameObject, "helpBtn") - this.helpPosition=this.helpBtn:GetComponent("RectTransform").localPosition + this.helpPosition = this.helpBtn:GetComponent("RectTransform").localPosition this.alienInvasionBtn = Util.GetGameObject(self.gameObject, "right/alienInvasionBtn") this.alienInvasionRedPoint = Util.GetGameObject(self.gameObject, "right/alienInvasionBtn/redPoint") this.grid = Util.GetGameObject(self.gameObject, "ScrollRect/grid") @@ -35,24 +36,29 @@ function AdventureMainPanel:InitComponent() this.reward2NumberText = Util.GetGameObject(self.gameObject, "top/reward2bg/reward2NumberText"):GetComponent("Text") this.expeditionsBtn = Util.GetGameObject(self.gameObject, "right/expeditionsBtn") this.costItemImage = Util.GetGameObject(self.gameObject, "right/costItem"):GetComponent("Image") - this.costItem= Util.GetGameObject(self.gameObject, "right/costItem") + this.costItem = Util.GetGameObject(self.gameObject, "right/costItem") this.costNumerText = Util.GetGameObject(self.gameObject, "right/costItem/costNumerText"):GetComponent("Text") this.BtView = SubUIManager.Open(SubUIConfig.BtView, self.gameObject.transform) this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft }) this.adventureFastBattle = Util.GetGameObject(self.gameObject, "right/Text"):GetComponent("Text") this.sayInfoImageBg = Util.GetGameObject(self.gameObject, "ScrollRect/grid/head/sayInfoImageBg") - this.sayInfoText = Util.GetGameObject(self.gameObject, "ScrollRect/grid/head/sayInfoImageBg/Text"):GetComponent("Text") + this.sayInfoText = Util.GetGameObject(self.gameObject, "ScrollRect/grid/head/sayInfoImageBg/Text"):GetComponent( + "Text") this.monsterBtn = Util.GetGameObject(self.gameObject, "ScrollRect/grid/head/live2d/monsterBtn") this.GetAllRewardEffect = Util.GetGameObject(self.transform, "effect_yijianlingqu") - this.hourGlassText = Util.GetGameObject(self.gameObject, "right/expeditionsBtn/hourGlassImage/hourGlassText"):GetComponent("Text") + this.hourGlassText = Util.GetGameObject(self.gameObject, "right/expeditionsBtn/hourGlassImage/hourGlassText") + :GetComponent("Text") this.popUpView1 = Util.GetGameObject(self.gameObject, "PopUpViewTip") this.popUpViewBtn1 = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/fastBattleBtn") this.popUpViewItem1 = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/item1") - this.popUpViewItemNumber1 = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/item1/numberText"):GetComponent("Text") + this.popUpViewItemNumber1 = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/item1/numberText"):GetComponent( + "Text") this.popUpViewItem2 = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/item2") - this.popUpViewItemNumber2 = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/item2/numberText"):GetComponent("Text") + this.popUpViewItemNumber2 = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/item2/numberText"):GetComponent( + "Text") this.popUpViewBtnBack1 = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/btnBack") - this.remainNumber = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/item1/numberText (1)"):GetComponent("Text") + this.remainNumber = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/item1/numberText (1)"):GetComponent( + "Text") this.chooseImage1 = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/chooseImage1") this.chooseImage2 = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/chooseImage2") this.btn1 = Util.GetGameObject(self.gameObject, "PopUpViewTip/Image/btn1") @@ -60,18 +66,22 @@ function AdventureMainPanel:InitComponent() this.popUpView2 = Util.GetGameObject(self.gameObject, "PopUpViewTip2") this.popUpViewBtnBack2 = Util.GetGameObject(self.gameObject, "PopUpViewTip2/Image/btnBack") this.costItemIcon = Util.GetGameObject(self.gameObject, "PopUpViewTip2/Image/costItemIcon"):GetComponent("Image") - this.costItemNumber = Util.GetGameObject(self.gameObject, "PopUpViewTip2/Image/costItemIcon/costNumber"):GetComponent("Text") + this.costItemNumber = Util.GetGameObject(self.gameObject, "PopUpViewTip2/Image/costItemIcon/costNumber") + :GetComponent("Text") this.Toggle = Util.GetGameObject(self.gameObject, "PopUpViewTip2/Image/Toggle"):GetComponent("Toggle") this.btnSureCost = Util.GetGameObject(self.gameObject, "PopUpViewTip2/Image/sureBtn") this.callMonsterBtn = Util.GetGameObject(self.gameObject, "right/callMonsterBtn") - this.callMonsterText = Util.GetGameObject(self.gameObject, "right/callMonsterBtn/callMonsterImage/callMonsterText"):GetComponent("Text") - this.remaindTimeText= Util.GetGameObject(self.gameObject, "right/callMonsterBtn/remaindTimeText"):GetComponent("Text") - this.freeText=Util.GetGameObject(self.gameObject, "right/freeText"):GetComponent("Text") - this.callMonsterRedPoint=Util.GetGameObject(self.gameObject, "right/callMonsterBtn/redPoint") - this.expeditionRedPoint=Util.GetGameObject(self.gameObject, "right/expeditionsBtn/redPoint") + this.callMonsterText = Util.GetGameObject(self.gameObject, "right/callMonsterBtn/callMonsterImage/callMonsterText") + :GetComponent("Text") + this.remaindTimeText = Util.GetGameObject(self.gameObject, "right/callMonsterBtn/remaindTimeText"):GetComponent( + "Text") + this.freeText = Util.GetGameObject(self.gameObject, "right/freeText"):GetComponent("Text") + this.callMonsterRedPoint = Util.GetGameObject(self.gameObject, "right/callMonsterBtn/redPoint") + this.expeditionRedPoint = Util.GetGameObject(self.gameObject, "right/expeditionsBtn/redPoint") --花费时光沙漏的次数 - this.adventureFastBattle.text = GetLanguageStrById(10051) .. AdventureManager.adventureFastBattle / 3600 .. GetLanguageStrById(10052) + this.adventureFastBattle.text = GetLanguageStrById(10051) .. + AdventureManager.adventureFastBattle / 3600 .. GetLanguageStrById(10052) local count = AdventureManager.GetStoneFastBattleCount() local hasCostNumber = count + 1 costDemonCrystal = StoreConfig[10015].Cost[2] @@ -82,11 +92,12 @@ function AdventureMainPanel:InitComponent() else cost = costDemonCrystal[costDemonCrystalNum] end - this.costNumerText.text = "×" .. cost .. GetLanguageStrById(10053) .. AdventureManager.fastBattlePrivilegeNumber .. GetLanguageStrById(10054) + this.costNumerText.text = "×" .. + cost .. GetLanguageStrById(10053) .. AdventureManager.fastBattlePrivilegeNumber .. GetLanguageStrById(10054) for i = #AdventureManager.Data, 1, -1 do local go1 = newObject(self.item) go1.name = "itemPro" .. i - + go1.transform:SetParent(this.grid.transform) go1.transform.localScale = Vector3.one go1.transform.localPosition = Vector3.zero @@ -105,7 +116,7 @@ function AdventureMainPanel:InitComponent() -- 创建循环列表 local rootHight = this.scrollRoot.transform.rect.height this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.scrollRoot.transform, - this.chatItem, nil, Vector2.New(1080, rootHight), 1, 1, Vector2.New(0, 8)) + this.chatItem, nil, Vector2.New(1080, rootHight), 1, 1, Vector2.New(0, 8)) this.ScrollView.moveTween.MomentumAmount = 1 this.ScrollView.moveTween.Strength = 2 -- 刷新聊天信息 @@ -152,15 +163,19 @@ function AdventureMainPanel:OnRefreshPopUpData() if (this.hourGlassNumber < costHourGlass or BagManager.GetItemCountById(StoreConfig[10015].Cost[1][1]) < cost) then this.popUpView1:SetActive(false) end - this.popUpViewItemNumber1.text = PrintWanNum(BagManager.GetItemCountById(StoreConfig[10015].Cost[1][1])) .. "/" .. cost - this.remainNumber.text = GetLanguageStrById(10055) .. AdventureManager.fastBattlePrivilegeNumber .. GetLanguageStrById(10056) - this.popUpViewItemNumber2.text = PrintWanNum(BagManager.GetItemCountById(StoreConfig[10008].Cost[1][1])) .. "/" .. costHourGlass + this.popUpViewItemNumber1.text = PrintWanNum(BagManager.GetItemCountById(StoreConfig[10015].Cost[1][1])) .. + "/" .. cost + this.remainNumber.text = GetLanguageStrById(10055) .. + AdventureManager.fastBattlePrivilegeNumber .. GetLanguageStrById(10056) + this.popUpViewItemNumber2.text = PrintWanNum(BagManager.GetItemCountById(StoreConfig[10008].Cost[1][1])) .. + "/" .. costHourGlass end function AdventureMainPanel:ShowTestLiveGO() --TODO:动态加载立绘 - self.preList = poolManager:LoadLive("live2d_m_syjm_0026", Util.GetTransform(self.transform, "ScrollRect/grid/head/live2d"), - Vector3.New(0.36, 0.36, 1), Vector3.New(8, -311, 0)) + self.preList = poolManager:LoadLive("live2d_m_syjm_0026", + Util.GetTransform(self.transform, "ScrollRect/grid/head/live2d"), + Vector3.New(0.36, 0.36, 1), Vector3.New(8, -311, 0)) end --绑定事件(用于子类重写) @@ -171,7 +186,7 @@ function AdventureMainPanel:BindEvent() end) --帮助按钮 Util.AddClick(this.helpBtn, function() - UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.Adventure,this.helpPosition.x,this.helpPosition.y) + UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.Adventure, this.helpPosition.x, this.helpPosition.y) end) --点击塔顶怪物 Util.AddClick(this.monsterBtn, function() @@ -189,10 +204,11 @@ function AdventureMainPanel:BindEvent() --点击召唤首领按钮 Util.AddClick(this.callMonsterBtn, function() - if(AdventureManager.callAlianInvasionTime>=1) then + if (AdventureManager.callAlianInvasionTime >= 1) then AdventureManager.CallAlianInvasionRequest(function() this:OnRefreshRedPoint() - this.callMonsterText.text = AdventureManager.callAlianInvasionTime.."/"..AdventureManager.callAlianInvasionTotalTime + this.callMonsterText.text = AdventureManager.callAlianInvasionTime .. + "/" .. AdventureManager.callAlianInvasionTotalTime end) else PopupTipPanel.ShowTipByLanguageId(10057) @@ -329,7 +345,6 @@ function AdventureMainPanel:BindEvent() end end) Util.AddClick(this.btnSureCost, function() - --探险次数不充足或妖晶不充足 local isShow = this.Toggle.isOn if (isShow == true) then @@ -342,13 +357,9 @@ function AdventureMainPanel:BindEvent() end) Util.AddClick(this.popUpViewBtnBack1, function() this.popUpView1:SetActive(false) - - end) Util.AddClick(this.popUpViewBtnBack2, function() this.popUpView2:SetActive(false) - - end) Util.AddClick(this.btn1, function() this.chooseImage1:SetActive(true) @@ -366,7 +377,7 @@ function AdventureMainPanel:BindEvent() end -- 绑定红点 - BindRedPointObject(RedPointType.SecretTer_Boss, this.alienInvasionRedPoint) -- 外敌boss红点(服务器红点) + BindRedPointObject(RedPointType.SecretTer_Boss, this.alienInvasionRedPoint) -- 外敌boss红点(服务器红点) end function AdventureMainPanel:RefreshBoxRedState() @@ -418,13 +429,14 @@ function AdventureMainPanel:RefreshExpeditionsData() else cost = costDemonCrystal[costDemonCrystalNum] end - this.costNumerText.text = "×" .. cost .. GetLanguageStrById(10053) .. AdventureManager.fastBattlePrivilegeNumber .. GetLanguageStrById(10054) + this.costNumerText.text = "×" .. + cost .. GetLanguageStrById(10053) .. AdventureManager.fastBattlePrivilegeNumber .. GetLanguageStrById(10054) AdventureManager.isSuccess = false if (AdventureManager.GetSandFastBattleCount() ~= 0) then - this.freeText.text=GetLanguageStrById(10061) + this.freeText.text = GetLanguageStrById(10061) this.costItem:SetActive(false) else - this.freeText.text="" + this.freeText.text = "" this.costItem:SetActive(true) end end @@ -439,7 +451,6 @@ function AdventureMainPanel:AddListener() Game.GlobalEvent:AddEvent(GameEvent.Adventure.MonsterSayInfo, this.MonsterSayInfo) Game.GlobalEvent:AddEvent(GameEvent.Guide.GuidePanelScrollViewPos, this.GuideResult) Game.GlobalEvent:AddEvent(GameEvent.Adventure.CallAlianInvasionTime, this.CallAlianInvasionTimeCountDown) - end --移除事件监听(用于子类重写) @@ -453,6 +464,7 @@ function AdventureMainPanel:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.Guide.GuidePanelScrollViewPos, this.GuideResult) Game.GlobalEvent:RemoveEvent(GameEvent.Adventure.CallAlianInvasionTime, this.CallAlianInvasionTimeCountDown) end + --界面打开时调用(用于子类重写) function AdventureMainPanel:OnOpen(...) -- 音效 @@ -475,7 +487,7 @@ function AdventureMainPanel:OnSortingOrderChange() end function AdventureMainPanel:OnShow() - AdventureManager.isEnterAdventure=true + AdventureManager.isEnterAdventure = true this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.AdventureTimes }) this.BtView:OnOpen({ sortOrder = self.sortingOrder, panelType = PanelTypeView.SecretTerritoryPanel }) this:OnRefreshData() @@ -486,10 +498,10 @@ function AdventureMainPanel:OnShow() this.chooseImage2:SetActive(not isChooseOne) --AdventureManager.OnFlushShowData() if (AdventureManager.GetSandFastBattleCount() ~= 0) then - this.freeText.text=GetLanguageStrById(10061) + this.freeText.text = GetLanguageStrById(10061) this.costItem:SetActive(false) else - this.freeText.text="" + this.freeText.text = "" this.costItem:SetActive(true) end this.ChatMsgUpdate() @@ -502,25 +514,24 @@ function AdventureMainPanel:OnShow() end --刷新红点 - function AdventureMainPanel:OnRefreshRedPoint() - if(AdventureManager.callAlianInvasionTime>=1) then - this.callMonsterRedPoint:SetActive(true) - else - this.callMonsterRedPoint:SetActive(false) - end - this.hourGlassNumber = BagManager.GetItemCountById(StoreConfig[10008].Cost[1][1]) - if(AdventureManager.GetSandFastBattleCount() ~= 0 or this.hourGlassNumber>=1) then - this.expeditionRedPoint:SetActive(true) - else - this.expeditionRedPoint:SetActive(false) - end - end - - +function AdventureMainPanel:OnRefreshRedPoint() + if (AdventureManager.callAlianInvasionTime >= 1) then + this.callMonsterRedPoint:SetActive(true) + else + this.callMonsterRedPoint:SetActive(false) + end + this.hourGlassNumber = BagManager.GetItemCountById(StoreConfig[10008].Cost[1][1]) + if (AdventureManager.GetSandFastBattleCount() ~= 0 or this.hourGlassNumber >= 1) then + this.expeditionRedPoint:SetActive(true) + else + this.expeditionRedPoint:SetActive(false) + end +end --刷新主页数据 function AdventureMainPanel:OnRefreshData() - this.callMonsterText.text = AdventureManager.callAlianInvasionTime.."/"..AdventureManager.callAlianInvasionTotalTime + this.callMonsterText.text = AdventureManager.callAlianInvasionTime .. + "/" .. AdventureManager.callAlianInvasionTotalTime this.grid:GetComponent("RectTransform").localPosition = Vector2.New(0, 4631.2) this.attackTimesText:GetComponent("Text").text = AdventureManager.canAttackBossTimes this.hourGlassNumber = BagManager.GetItemCountById(StoreConfig[10008].Cost[1][1]) @@ -540,8 +551,10 @@ function AdventureMainPanel:OnRefreshData() local data = AdventureManager.Data[i] viewList[i]:OnRefreshData() if (PlayerManager.level >= data.OpenLevel[1] and data.isAttackBoosSuccess == 1) then - this.reward1NumberAll = RewardGroup[data.baseRewardGroup[1][data.areaLevel]].ShowItem[2][2] + this.reward1NumberAll - this.reward2NumberAll = RewardGroup[data.baseRewardGroup[1][data.areaLevel]].ShowItem[1][2] + this.reward2NumberAll + this.reward1NumberAll = RewardGroup[data.baseRewardGroup[1][data.areaLevel]].ShowItem[2][2] + + this.reward1NumberAll + this.reward2NumberAll = RewardGroup[data.baseRewardGroup[1][data.areaLevel]].ShowItem[1][2] + + this.reward2NumberAll end end this.reward1NumberAll = this.reward1NumberAll + math.floor(AdventureManager.vipAddBaseGift * this.reward1NumberAll) @@ -549,13 +562,20 @@ function AdventureMainPanel:OnRefreshData() for i = #AdventureManager.Data, 1, -1 do local j = #AdventureManager.Data + 1 - i if (PlayerManager.level < AdventureManager.Data[j].OpenLevel[1]) then - Util.GetGameObject(goList[j], "lock/unLockLevelText"):GetComponent("Text").text = AdventureManager.Data[j].OpenLevel[1] .. GetLanguageStrById(10062) + Util.GetGameObject(goList[j], "lock/unLockLevelText"):GetComponent("Text").text = string.format( + GetLanguageStrById(10062), AdventureManager.Data[j].OpenLevel[1]) break end end if (AdventureManager.vipAddBaseGift * 100 ~= 0) then - this.reward1NumberText.text = " ×" .. this.reward1NumberAll .. string.format("(+%s", AdventureManager.vipAddBaseGift * 100) .. "%)" .. GetLanguageStrById(10063) - this.reward2NumberText.text = " ×" .. this.reward2NumberAll .. string.format("(+%s", AdventureManager.vipAddBaseGift * 100) .. "%)" .. GetLanguageStrById(10063) + this.reward1NumberText.text = " ×" .. + this.reward1NumberAll .. + string.format("(+%s", AdventureManager.vipAddBaseGift * 100) .. + "%)" .. GetLanguageStrById(10063) + this.reward2NumberText.text = " ×" .. + this.reward2NumberAll .. + string.format("(+%s", AdventureManager.vipAddBaseGift * 100) .. + "%)" .. GetLanguageStrById(10063) else this.reward1NumberText.text = " ×" .. this.reward1NumberAll .. GetLanguageStrById(10063) this.reward2NumberText.text = " ×" .. this.reward2NumberAll .. GetLanguageStrById(10063) @@ -579,7 +599,8 @@ function this.TimeFormat(time, k) AdventureManager.Data[k].bossRemainTime = -1 this:OnRefreshData() end - Util.GetGameObject(goList[k], "haveAttackunLock/bossAppear/bossAppearCountDown"):GetComponent("Text").text = string.format("%02d:%02d:%02d",hour, min, sec) + Util.GetGameObject(goList[k], "haveAttackunLock/bossAppear/bossAppearCountDown"):GetComponent("Text").text = string + .format("%02d:%02d:%02d", hour, min, sec) end --更新宝箱状态 @@ -629,25 +650,25 @@ function this.ChatNodeAdapter(node, data) local monsterId = monsterGroup[data.bossGroupId].Contents[1][1] local monsterInfo = monsterConfig[monsterId] local bossName = GetLanguageStrById(monsterInfo.ReadingName) - local isCanClick=true - for i,v in ipairs(AdventureManager.hasKilledId) do - if(data.bossId==v) then - content:GetComponent("Text").text =string.format(GetLanguageStrById(10064), areaName, bossName) - isCanClick=false + local isCanClick = true + for i, v in ipairs(AdventureManager.hasKilledId) do + if (data.bossId == v) then + content:GetComponent("Text").text = string.format(GetLanguageStrById(10064), areaName, bossName) + isCanClick = false end end - if(isCanClick) then + if (isCanClick) then content:GetComponent("Text").text = string.format(GetLanguageStrById(10065), areaName, bossName) -- 点击事件监听 Util.AddOnceClick(content, function() - local isCanClick=true - for i,v in ipairs(AdventureManager.hasKilledId) do - if(data.bossId==v) then - content:GetComponent("Text").text =string.format(GetLanguageStrById(10064), areaName, bossName) - isCanClick=false + local isCanClick = true + for i, v in ipairs(AdventureManager.hasKilledId) do + if (data.bossId == v) then + content:GetComponent("Text").text = string.format(GetLanguageStrById(10064), areaName, bossName) + isCanClick = false end end - if(isCanClick) then + if (isCanClick) then UIManager.OpenPanel(UIName.FormationPanel, FORMATION_TYPE.ADVENTURE_BOSS, data) end end) @@ -673,25 +694,31 @@ function AdventureMainPanel:OnDestroy() -- 清除红点绑定的物体 ClearRedPointObject(RedPointType.SecretTer_Boss) end + --怪物进行说话 function this.MonsterSayInfo(arenaId) - this.grid:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, 1082.807) - local bosssName = GetLanguageStrById(monsterConfig[monsterGroup[AdventureManager.Data[arenaId].systemBoss].Contents[1][1]].ReadingName) + local bosssName = GetLanguageStrById(monsterConfig + [monsterGroup[AdventureManager.Data[arenaId].systemBoss].Contents[1][1]].ReadingName) this.sayInfoImageBg:SetActive(true) - this.sayInfoText.text = GetLanguageStrById(10066) .. string.format("%s", bosssName) .. GetLanguageStrById(10067) .. string.format(GetLanguageStrById(10068), AdventureManager.Data[arenaId].areaName .. AdventureManager.Data[arenaId].areaLevel) + this.sayInfoText.text = GetLanguageStrById(10066) .. + string.format("%s", bosssName) .. + GetLanguageStrById(10067) .. + string.format(GetLanguageStrById(10068), + AdventureManager.Data[arenaId].areaName .. AdventureManager.Data[arenaId].areaLevel) end function this.GuideResult() - this.grid.transform:DOLocalMoveY(4631.2, 0.6, false):OnComplete(function() AdventureManager.Data[1].stateTime = AdventureManager.adventureRefresh end) end + --跳转显示新手提示圈 function this.ShowGuideGo() JumpManager.ShowGuide(UIName.AdventureMainPanel, this.expeditionsBtn) end + --外敌次数恢复时间倒计时 function this.CallAlianInvasionTimeCountDown(remainTime) local hour = 0 @@ -709,11 +736,12 @@ function this.CallAlianInvasionTimeCountDown(remainTime) if (remainTime == 0) then this.remaindTimeText.text = "00:00:00" end - if(remainTime==AdventureManager.callAlianInvasionCountDownTime) then + if (remainTime == AdventureManager.callAlianInvasionCountDownTime) then this:OnRefreshRedPoint() CheckRedPointStatus(RedPointType.SecretTer_CallAlianInvasionTime) end - this.callMonsterText.text = AdventureManager.callAlianInvasionTime.."/"..AdventureManager.callAlianInvasionTotalTime + this.callMonsterText.text = AdventureManager.callAlianInvasionTime .. + "/" .. AdventureManager.callAlianInvasionTotalTime end -return AdventureMainPanel \ No newline at end of file +return AdventureMainPanel diff --git a/Assets/ManagedResources/~Lua/Modules/Equip/TalismanManager.lua b/Assets/ManagedResources/~Lua/Modules/Equip/TalismanManager.lua index 83b10f86d..efab4e566 100644 --- a/Assets/ManagedResources/~Lua/Modules/Equip/TalismanManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Equip/TalismanManager.lua @@ -1,13 +1,13 @@ TalismanManager = {}; local this = TalismanManager local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) -local heroConfig=ConfigManager.GetConfig(ConfigName.HeroConfig) +local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig) local equipTalismana = ConfigManager.GetConfig(ConfigName.EquipTalismana) local equipTalismanaRankup = ConfigManager.GetConfig(ConfigName.EquipTalismanaRankup) -local propertyConfig=ConfigManager.GetConfig(ConfigName.PropertyConfig) +local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) -this.lv=0--默认法宝等级 -this.talismanDatas={} +this.lv = 0 --默认法宝等级 +this.talismanDatas = {} this.talismanTabs = {} this.AllTalismanStartStar = {} @@ -18,6 +18,7 @@ local GameSettingTalismanOpenVal = 0 function this.Initialize() end + --初始化更新法宝数据 -- function this.InitUpdateTalismanData(msg) -- if msg and #msg > 0 then @@ -46,32 +47,35 @@ end -- end -- end --获取全部 -function this.GetAllTalismanData(isAddUpHero,heroDid) +function this.GetAllTalismanData(isAddUpHero, heroDid) local talismans = {} for i, v in pairs(this.talismanTabs) do if isAddUpHero then - table.insert(talismans,v) + table.insert(talismans, v) else if v.upHeroDid == "0" and heroDid and v.upHeroDid == heroDid then - table.insert(talismans,v) + table.insert(talismans, v) end end end - table.sort(talismans, function(a,b) return a.backData.equipId < b.backData.equipId end) + table.sort(talismans, function(a, b) return a.backData.equipId < b.backData.equipId end) return talismans end + --设置法宝穿戴的英雄 -function this.SetTalismanUpHeroDid(talismanDid,heroDid) +function this.SetTalismanUpHeroDid(talismanDid, heroDid) if this.talismanTabs[talismanDid] then - this.talismanTabs[talismanDid].upHeroDid=heroDid + this.talismanTabs[talismanDid].upHeroDid = heroDid end end + --设置法宝穿戴的星级 -function this.SetLv(lv,did) +function this.SetLv(lv, did) -- if not this.talismanDatas[did] then - this.talismanDatas[did]=lv + this.talismanDatas[did] = lv -- end end + --获取单个法宝信息 function this.GetSingleTalismanData(talismanDid) if this.talismanTabs[talismanDid] then @@ -79,37 +83,41 @@ function this.GetSingleTalismanData(talismanDid) end return nil end + --删除单个法宝信息 function this.DeleteSingleTalismanData(talismanDids) for i = 1, #talismanDids do if this.talismanTabs[talismanDids[i]] then - this.talismanTabs[talismanDids[i]] = nil end end end + --计算战斗力 -function this.CalculateWarForceBySid(sId,star,heroPos) - local curTalismanConFigData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana, "TalismanaId", sId, "Level", star) - return this.CalculateWarForceBase(curTalismanConFigData,heroPos) +function this.CalculateWarForceBySid(sId, star, heroPos) + local curTalismanConFigData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana, "TalismanaId", sId, + "Level", star) + return this.CalculateWarForceBase(curTalismanConFigData, heroPos) end --计算战斗力 -function this.CalculateWarForce(talismanDid,heroPos) - local curTalisman = this.talismanTabs[talismanDid] +function this.CalculateWarForce(talismanDid, heroPos) + local curTalisman = this.talismanTabs[talismanDid] if curTalisman then - local curTalismanConFigData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana, "TalismanaId", curTalisman.id, "Level", curTalisman.star) - return this.CalculateWarForceBase(curTalismanConFigData,heroPos) + local curTalismanConFigData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.EquipTalismana, "TalismanaId", + curTalisman.id, "Level", curTalisman.star) + return this.CalculateWarForceBase(curTalismanConFigData, heroPos) end end -function this.CalculateWarForceBase(curTalismanConFigData,heroPos) + +function this.CalculateWarForceBase(curTalismanConFigData, heroPos) if curTalismanConFigData then local addAllProVal = {} --主属性 for i = 1, #curTalismanConFigData.Property do if addAllProVal[curTalismanConFigData.Property[i][1]] then addAllProVal[curTalismanConFigData.Property[i][1]] = addAllProVal[curTalismanConFigData.Property[i][1]] + - curTalismanConFigData.Property[i][2] + curTalismanConFigData.Property[i][2] else addAllProVal[curTalismanConFigData.Property[i][1]] = curTalismanConFigData.Property[i][2] end @@ -117,31 +125,33 @@ function this.CalculateWarForceBase(curTalismanConFigData,heroPos) --副属性 if curTalismanConFigData.SpecialProperty and #curTalismanConFigData.SpecialProperty > 0 then for i = 1, #curTalismanConFigData.SpecialProperty do - if curTalismanConFigData.SpecialProperty[i][1] == 1 then--是属性 + if curTalismanConFigData.SpecialProperty[i][1] == 1 then --是属性 if heroPos == 0 or heroPos == curTalismanConFigData.SpecialProperty[i][2] then if addAllProVal[curTalismanConFigData.SpecialProperty[i][3]] then - addAllProVal[curTalismanConFigData.SpecialProperty[i][3]] = addAllProVal[curTalismanConFigData.SpecialProperty[i][3]] + - curTalismanConFigData.SpecialProperty[i][4] + addAllProVal[curTalismanConFigData.SpecialProperty[i][3]] = addAllProVal + [curTalismanConFigData.SpecialProperty[i][3]] + + curTalismanConFigData.SpecialProperty[i][4] else - addAllProVal[curTalismanConFigData.SpecialProperty[i][3]] = curTalismanConFigData.SpecialProperty[i][4] + addAllProVal[curTalismanConFigData.SpecialProperty[i][3]] = curTalismanConFigData + .SpecialProperty[i][4] end end end end end - local heroPropertyScore={} + local heroPropertyScore = {} for i, v in ConfigPairs(propertyConfig) do - heroPropertyScore[i]=v.Score + heroPropertyScore[i] = v.Score end - local powerEndVal=0 + local powerEndVal = 0 for i, v in pairs(addAllProVal) do if v > 0 then - local curProConfigData = ConfigManager.GetConfigData(ConfigName.PropertyConfig,i) + local curProConfigData = ConfigManager.GetConfigData(ConfigName.PropertyConfig, i) if curProConfigData then if curProConfigData.Style == 1 then - powerEndVal=powerEndVal+v*heroPropertyScore[i] + powerEndVal = powerEndVal + v * heroPropertyScore[i] else - powerEndVal=powerEndVal+v/100*heroPropertyScore[i] + powerEndVal = powerEndVal + v / 100 * heroPropertyScore[i] end end end @@ -149,21 +159,22 @@ function this.CalculateWarForceBase(curTalismanConFigData,heroPos) return math.floor(powerEndVal) end end -function this.GetAllTalismanByCondition(curTalismanData,upStarConFigData) + +function this.GetAllTalismanByCondition(curTalismanData, upStarConFigData) local GetAllTalismanByConditionList = {} for i, v in pairs(this.talismanTabs) do - if v.upHeroDid == "0" and v.did ~= curTalismanData.did then + if v.upHeroDid == "0" and v.did ~= curTalismanData.did then if v.star == upStarConFigData.StarLimit then - if upStarConFigData.Issame == 1 then--同名 + if upStarConFigData.Issame == 1 then --同名 if v.id == curTalismanData.id then - table.insert(GetAllTalismanByConditionList,v) + table.insert(GetAllTalismanByConditionList, v) end - elseif upStarConFigData.IsId ~= 0 then--指定id + elseif upStarConFigData.IsId ~= 0 then --指定id if v.id == upStarConFigData.IsId then - table.insert(GetAllTalismanByConditionList,v) + table.insert(GetAllTalismanByConditionList, v) end else - table.insert(GetAllTalismanByConditionList,v) + table.insert(GetAllTalismanByConditionList, v) end end end @@ -194,19 +205,19 @@ function this.GetStartAndEndStar() end --地图临时背包数据 -this.mapShotTimeItemData={} +this.mapShotTimeItemData = {} --地图临时英雄数据存储 function this.InitMapShotTimeTalismanBagData(_mapHero) - this.mapShotTimeItemData[#this.mapShotTimeItemData+1]=_mapHero + this.mapShotTimeItemData[#this.mapShotTimeItemData + 1] = _mapHero end --检查HeroConfig里英雄是否配了法宝 function this.CheckTalismanIsInConfig(curHeroData) local isOpen = true - if heroConfig[curHeroData.id].EquipTalismana~=nil then - isOpen=true + if heroConfig[curHeroData.id].EquipTalismana ~= nil then + isOpen = true else - isOpen=false + isOpen = false end return isOpen end @@ -214,26 +225,28 @@ end --获取当前英雄是否开启法宝 function this.GetCurHeroIsOpenTalisman(curHeroData) local isOpen = false - local gameSettingConFig = ConfigManager.GetConfigData(ConfigName.GameSetting,1) + local gameSettingConFig = ConfigManager.GetConfigData(ConfigName.GameSetting, 1) GameSettingTalismanOpenType = gameSettingConFig.EquipTalismanaUnlock[1][1] - if heroConfig[curHeroData.id].EquipTalismana~=nil then - GameSettingTalismanOpenVal = heroConfig[curHeroData.id].EquipTalismana[1] + if heroConfig[curHeroData.id].EquipTalismana ~= nil then + GameSettingTalismanOpenVal = heroConfig[curHeroData.id].EquipTalismana[1] end if GameSettingTalismanOpenType == 1 then - if PlayerManager.level >= GameSettingTalismanOpenVal and heroConfig[curHeroData.id].EquipTalismana~=nil then + if PlayerManager.level >= GameSettingTalismanOpenVal and heroConfig[curHeroData.id].EquipTalismana ~= nil then isOpen = true end - elseif GameSettingTalismanOpenType == 2 and heroConfig[curHeroData.id].EquipTalismana~=nil then - if curHeroData.star >= heroConfig[curHeroData.id].EquipTalismana[1] then--如果走的英雄星级 判断heroconfig里的法宝星级 + elseif GameSettingTalismanOpenType == 2 and heroConfig[curHeroData.id].EquipTalismana ~= nil then + if curHeroData.star >= heroConfig[curHeroData.id].EquipTalismana[1] then --如果走的英雄星级 判断heroconfig里的法宝星级 isOpen = true end end return isOpen end + function this.GetCurHeroIsOpenTalismanStr() if GameSettingTalismanOpenType == 1 then - return GameSettingTalismanOpenVal .. GetLanguageStrById(10062) + return string.format( + GetLanguageStrById(10062), GameSettingTalismanOpenVal) elseif GameSettingTalismanOpenType == 2 then return NumToSimplenessFont[GameSettingTalismanOpenVal] .. GetLanguageStrById(10488) end @@ -241,9 +254,11 @@ end function this.GetCurHeroIsOpenTalismanTip() if GameSettingTalismanOpenType == 1 then - return GameSettingTalismanOpenVal .. GetLanguageStrById(10062) + return string.format( + GetLanguageStrById(10062), GameSettingTalismanOpenVal) elseif GameSettingTalismanOpenType == 2 then - return GetLanguageStrById(10489)..NumToSimplenessFont[GameSettingTalismanOpenVal] .. GetLanguageStrById(10490) + return GetLanguageStrById(10489) .. NumToSimplenessFont[GameSettingTalismanOpenVal] .. GetLanguageStrById(10490) end end -return this \ No newline at end of file + +return this diff --git a/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua b/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua index 54a613003..096345660 100644 --- a/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Fight/FightPointPassManager.lua @@ -20,26 +20,25 @@ local CHATER_STATE = "CHATER_STATE" local OLD_ID = "OLD_ID" local isOpenRewardUpTip = false function this.Initialize() - this.curOpenFight = 1011 -- 当前开启的关卡 - this.lastPassFightId = 1011 -- 上一关的ID + this.curOpenFight = 1011 -- 当前开启的关卡 + this.lastPassFightId = 1011 -- 上一关的ID this.isBattleBack = false - this.HangOnTime = 0 -- 关卡挂机时长 + this.HangOnTime = 0 -- 关卡挂机时长 this.curFightState = 0 - this.oldLevel = 0 -- 玩家关卡战斗之前的等级 - this.curFightMapId = 1011 -- 当前关卡对应的地图背景ID + this.oldLevel = 0 -- 玩家关卡战斗之前的等级 + this.curFightMapId = 1011 -- 当前关卡对应的地图背景ID this.isOutFight = false - this.isOpenNewChapter = false -- 是否开启新章节 - this.isMaxChapter = false --是否最大章节 - this.maxChapterNum = 15 --最大章节数 + this.isOpenNewChapter = false -- 是否开启新章节 + this.isMaxChapter = false --是否最大章节 + this.maxChapterNum = 15 --最大章节数 this.isBeginFight = false this.enterFightBattle = false -- 进入关卡战斗 this.ShowBtnJumpTime = ConfigManager.GetConfig(ConfigName.GameSetting)[1].JumpLevelTime - this.boxState = 0 -- 当前需要显示的宝箱 + this.boxState = 0 -- 当前需要显示的宝箱 Game.GlobalEvent:AddEvent(GameEvent.Player.OnLevelChange, this.CheckFightRP) -- Game.GlobalEvent:AddEvent(GameEvent.Mission.OnOpenEnableFight, this.CheckFightRP) Game.GlobalEvent:AddEvent(GameEvent.Mission.OnOpenFight, this.CheckFightRP) - end function this.CheckFightRP() @@ -48,7 +47,7 @@ end -- 初始化关卡状态, state , 1 已开启未通过 2 :已通过 -1 已开启等级未解锁 function this.InitAllFightPointState(msg) - if msg.duration < 0 then + if msg.duration < 0 then end this.HangOnTime = msg.duration @@ -56,8 +55,9 @@ function this.InitAllFightPointState(msg) this.curFightState = msg.state this.adventrueEnemyList = msg.adventureBossInfo this.HangOnReward = msg.reward - - this.maxChapterNum = LengthOfTable(GameDataBase.SheetBase.GetKeys(ConfigManager.GetConfig(ConfigName.MainLevelSettingConfig))) + + this.maxChapterNum = LengthOfTable(GameDataBase.SheetBase.GetKeys(ConfigManager.GetConfig(ConfigName + .MainLevelSettingConfig))) end -- 获取某一关卡的状态, 小于当前关卡必定已通关,大于必定未解锁 @@ -171,8 +171,8 @@ function this.RefreshFightId(msg) Game.GlobalEvent:DispatchEvent(GameEvent.Mission.OnOpenFight, oldFight) --判断是否需要弹估计奖励提升界面 - local oldLevelConFig = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,this.lastPassFightId) - local cirLevelConFig = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,this.curOpenFight) + local oldLevelConFig = ConfigManager.GetConfigData(ConfigName.MainLevelConfig, this.lastPassFightId) + local cirLevelConFig = ConfigManager.GetConfigData(ConfigName.MainLevelConfig, this.curOpenFight) for i = 1, #cirLevelConFig.RewardShowMin do local oldsinglePro = oldLevelConFig.RewardShowMin[i] local cursinglePro = cirLevelConFig.RewardShowMin[i] @@ -198,20 +198,23 @@ function this.RefreshFightId(msg) --if isOpen then -- this.SetChapterOpenState(true) --end - + -- 发送关卡通关事件 ---[[ Game.GlobalEvent:DispatchEvent(GameEvent.Mission.OnOpenFight, oldFight)]] + --[[ Game.GlobalEvent:DispatchEvent(GameEvent.Mission.OnOpenFight, oldFight)]] --else -- this.curFightState = 2 --end --end end + function this.GetIsOpenRewardUpTip() return isOpenRewardUpTip end + function this.SetIsOpenRewardUpTip(_isOpenRewardUpTip) isOpenRewardUpTip = _isOpenRewardUpTip end + function this.SetChapterOpenState(state) this.isOpenNewChapter = state local value = state and CHATER_OPEN or CHATER_CLOSE @@ -257,7 +260,7 @@ function this.IsCanFight(fightId) if this.IsChapterClossState() then -- 以防后端不校验,再来一次 if PlayerManager.level < mainLevelConfig[this.curOpenFight].LevelLimit then - return false, tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. GetLanguageStrById(10062)) + return false, string.format(GetLanguageStrById(10062), mainLevelConfig[this.curOpenFight].LevelLimit) else -- 等级不足未通关时设置一下 if this.curFightState == -1 then this.curFightState = 1 @@ -268,8 +271,8 @@ function this.IsCanFight(fightId) if state == FIGHT_POINT_STATE.OPEN_NOT_PASS then return true, GetLanguageStrById(10599) elseif state == FIGHT_POINT_STATE.OPEN_LOW_LEVEL then - return false, tostring(mainLevelConfig[this.curOpenFight].LevelLimit .. GetLanguageStrById(10062)) - elseif state == FIGHT_POINT_STATE.PASS then -- 最后一关 + return false, string.format(GetLanguageStrById(10062), mainLevelConfig[this.curOpenFight].LevelLimit) + elseif state == FIGHT_POINT_STATE.PASS then -- 最后一关 return false, GetLanguageStrById(10601) end else @@ -289,7 +292,7 @@ function this.GetBtnText() -- 先判断等级 local limitLevel = mainLevelConfig[this.curOpenFight].LevelLimit if PlayerManager.level < limitLevel then - return limitLevel .. GetLanguageStrById(10062) + return string.format(GetLanguageStrById(10062), limitLevel) end local offset = 1 @@ -300,7 +303,7 @@ function this.GetBtnText() -- 最后一关 local state = this.GetFightStateById(this.curOpenFight) - if state == FIGHT_POINT_STATE.PASS then -- 最后一关 + if state == FIGHT_POINT_STATE.PASS then -- 最后一关 str = GetLanguageStrById(10604) end return str @@ -334,9 +337,9 @@ end --- ===================== 战力相关的 ============================= ---- 请求战斗 function this.ExecuteFightBattle(monsterGroupId, fightId, callBack) - NetManager.LevelStarFightDataRequest(monsterGroupId, fightId, function (msg) + NetManager.LevelStarFightDataRequest(monsterGroupId, fightId, function(msg) hadUpdate = false - UIManager.OpenPanel(UIName.BattleStartPopup, function () + UIManager.OpenPanel(UIName.BattleStartPopup, function() local fightData = BattleManager.GetBattleServerData(msg, nil, fightId) UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.STORY_FIGHT, callBack) end) @@ -370,7 +373,7 @@ end function this.GetCurChapterIndex() local curChapterId = math.floor(this.curOpenFight / 1000) if not FightPointPassManager.isOpenNewChapter then - curChapterId = curChapterId-1 + curChapterId = curChapterId - 1 if curChapterId == 0 then curChapterId = 1 end @@ -399,13 +402,14 @@ end function this.GetBattleMonsterGroup() return mainLevelConfig[this.curOpenFight].MonsterGroup end + --通过难度和章节获取该章节是否通过 -function this.GetDifficultAndChapter(Difficult,Chapter) +function this.GetDifficultAndChapter(Difficult, Chapter) -- 当前关卡难度 local curFightDiff = mainLevelConfig[this.curOpenFight].Difficulty -- 当前章节难度 local curChapterId = math.floor(this.curOpenFight / 1000) - local state = 0--1 未开启 2 已开启 3 未通关 4 已通关 + local state = 0 --1 未开启 2 已开启 3 未通关 4 已通关 if Difficult > curFightDiff then state = 1 elseif Difficult == curFightDiff then @@ -422,14 +426,13 @@ function this.GetDifficultAndChapter(Difficult,Chapter) return state end - --获取立绘角色奔跑方向 function this.GetRoleDirection() local data = {} if not FightPointPassManager.IsChapterClossState() then - data = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,this.lastPassFightId) + data = ConfigManager.GetConfigData(ConfigName.MainLevelConfig, this.lastPassFightId) else - data = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,this.curOpenFight) + data = ConfigManager.GetConfigData(ConfigName.MainLevelConfig, this.curOpenFight) end return data.RoleDirection end @@ -438,21 +441,21 @@ end function this.GetLevelPointPosition() local data = {} if not FightPointPassManager.IsChapterClossState() then - data = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,this.lastPassFightId) + data = ConfigManager.GetConfigData(ConfigName.MainLevelConfig, this.lastPassFightId) else - data = ConfigManager.GetConfigData(ConfigName.MainLevelConfig,this.curOpenFight) + data = ConfigManager.GetConfigData(ConfigName.MainLevelConfig, this.curOpenFight) end return data.LevelPointPosition end --计算小地图节点坐标 -function this.CalculateMapPointPos(parentPoint,sonPoint) +function this.CalculateMapPointPos(parentPoint, sonPoint) local scaleValueX = parentPoint.localScale.x local scaleValueY = parentPoint.localScale.y - - local x = math.floor(sonPoint[1]*(-1)*scaleValueX) - local y = math.floor(sonPoint[2]*(-1)*scaleValueY) - return x,y + + local x = math.floor(sonPoint[1] * (-1) * scaleValueX) + local y = math.floor(sonPoint[2] * (-1) * scaleValueY) + return x, y end -- 活动期间关卡的总奖励预览 @@ -489,7 +492,7 @@ function this.GetExtralReward() rewardShow[#rewardShow + 1] = shows[j] end else - + end end return 1, rewardShow @@ -513,7 +516,7 @@ function this.GetStopBtnState() return true else if this.curOpenFight == 1011 or this.curOpenFight == 1021 or this.curOpenFight == 1031 - or this.curOpenFight == 1041 or this.curOpenFight == 1051 then + or this.curOpenFight == 1041 or this.curOpenFight == 1051 then isShow = false else isShow = true @@ -528,7 +531,8 @@ end function this:RefreshQuickTrain() if AdventureManager.GetTrainStageLevel() > 0 and ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.QuickTrain) then - local taskConfig = ConfigManager.GetConfigDataByKey(ConfigName.TrainTask, "Level", AdventureManager.GetTrainStageLevel()) + local taskConfig = ConfigManager.GetConfigDataByKey(ConfigName.TrainTask, "Level", + AdventureManager.GetTrainStageLevel()) for i = 1, #taskConfig.TaskID do local taskData = TaskConfig[taskConfig.TaskID[i]] local severData = TaskManager.GetTypeTaskInfo(TaskTypeDef.Train, taskData.Id) @@ -542,4 +546,4 @@ function this:RefreshQuickTrain() return freeTimes > 0 end -return this \ No newline at end of file +return this diff --git a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua index 48852bc3b..97f8ff7e3 100644 --- a/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Login/LoginPanel.lua @@ -844,7 +844,7 @@ function this.OnConnect(network) .."getUserInfo?openId="..LoginManager.openId .."&serverId="..LoginManager.ServerId .."&token="..LoginManager.token - .."&platform=4" + .."&platform=1" .."&sub_channel="..LoginRoot_SubChannel .."&version="..LoginRoot_PackageVersion .."&area="..LoginManager.area diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemPopup.lua b/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemPopup.lua index 4fd167772..f4f6ab52b 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemPopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/RewardItemPopup.lua @@ -255,6 +255,7 @@ function RewardItemPopup:OnOpen(...) this.nextStageTime.text = PrivilegeManager.GetPrivilegeOpenTip(PRIVILEGE_TYPE.AutoNextFight) end else + LogError("ddddddddddddddddddddddddddddd") this.automatic:SetActive(false) end if fightType == BATTLE_TYPE.GUILD_CAR_DELAY or fightType == BATTLE_TYPE.DEATH_POS then diff --git a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua index c561c9a0e..efb410fdc 100644 --- a/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleInfoPanel.lua @@ -3,10 +3,10 @@ RoleInfoPanel = Inherit(BasePanel) local this = RoleInfoPanel --升级升星 -local curHeroData --当前英雄信息 -local leftHeroData --左边预加载英雄信息 -local rightHeroData --右边预加载英雄信息 -local heroDatas --所有英雄list信息 +local curHeroData --当前英雄信息 +local leftHeroData --左边预加载英雄信息 +local rightHeroData --右边预加载英雄信息 +local heroDatas --所有英雄list信息 local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig) local heroRankupConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig) local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) @@ -18,43 +18,43 @@ local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig) local SkillLogicConfig = ConfigManager.GetConfig(ConfigName.SkillLogicConfig) local PassiveSkillLogicConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig) local WarWaySkillConfig = ConfigManager.GetConfig(ConfigName.WarWaySkillConfig) -local WarWaySkillUpgradeCost= ConfigManager.GetAllConfigsDataByKey(ConfigName.WarWaySkillConfig, "Level", 1) +local WarWaySkillUpgradeCost = ConfigManager.GetAllConfigsDataByKey(ConfigName.WarWaySkillConfig, "Level", 1) local SpecialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig) -local index --当前英雄在 英雄列表中的索引 -local costItemList --升级突破静态材料 -local isUpLvMaterials = true --升级 进阶 材料是否充足 -local isUpStarMaterials = true --升星 材料是否充足 -local curSelectUpStarData --当前选择升星坑位的数据 -local curSelectUpStarGo --当前选择升星坑位的预设 -local upStarConsumeMaterial = {}--升星消耗的英雄组 {{1坑位英雄信息}{2坑位英雄信息}{}} -local upStarMaterialIsAll = {} --升星消耗的英雄组是否满足 {{1满足}{2不满足}{}} -local allAddProVal = {} --所有属性加成值 -local lvUpShowProList = {} --升级后展示的属性提升list -local skillShowProList = {} --技能数据 -local isHeroUpTuPo = false --是否可进阶 -local isHeroUpStar = false --是否可升星 -local upTuPoRankUpConfig = {} --即将要突破的数据 -local upStarRankUpConfig = {} --即将要升星的数据 -local curTuPoRankUpConfig = {} --当前突破的数据 -local curStarRankUpConfig = {} --当前升星的数据 +local index --当前英雄在 英雄列表中的索引 +local costItemList --升级突破静态材料 +local isUpLvMaterials = true --升级 进阶 材料是否充足 +local isUpStarMaterials = true --升星 材料是否充足 +local curSelectUpStarData --当前选择升星坑位的数据 +local curSelectUpStarGo --当前选择升星坑位的预设 +local upStarConsumeMaterial = {} --升星消耗的英雄组 {{1坑位英雄信息}{2坑位英雄信息}{}} +local upStarMaterialIsAll = {} --升星消耗的英雄组是否满足 {{1满足}{2不满足}{}} +local allAddProVal = {} --所有属性加成值 +local lvUpShowProList = {} --升级后展示的属性提升list +local skillShowProList = {} --技能数据 +local isHeroUpTuPo = false --是否可进阶 +local isHeroUpStar = false --是否可升星 +local upTuPoRankUpConfig = {} --即将要突破的数据 +local upStarRankUpConfig = {} --即将要升星的数据 +local curTuPoRankUpConfig = {} --当前突破的数据 +local curStarRankUpConfig = {} --当前升星的数据 local upStarPreList = {} --长按升级状态 -local _isClicked = false --是否点击 +local _isClicked = false --是否点击 local _isReqLvUp = false -local _isLongPress = false --是否长按 -RoleInfoPanel.timePressStarted = 0 --监听长按事件 -this.priThread = nil --协同程序播放升级属性提升值动画用 -local isGoToBattle = false --当前英雄是否上阵 -local isClickLeftOrRightBtn = true --点击左右按钮切换英雄播放动画状态 -local teamHero = {} --主线编队成员信息 -local isTriggerLongClick = false --长按是否升过级 -this.AddLv = 1 --升级级数 -this.isCanAdvanced = true --是否进阶 +local _isLongPress = false --是否长按 +RoleInfoPanel.timePressStarted = 0 --监听长按事件 +this.priThread = nil --协同程序播放升级属性提升值动画用 +local isGoToBattle = false --当前英雄是否上阵 +local isClickLeftOrRightBtn = true --点击左右按钮切换英雄播放动画状态 +local teamHero = {} --主线编队成员信息 +local isTriggerLongClick = false --长按是否升过级 +this.AddLv = 1 --升级级数 +this.isCanAdvanced = true --是否进阶 local oldLv = 0 -- local GoToBattleNum = 0 --上阵数量 -local liveDeviation --立绘偏移 +local liveDeviation --立绘偏移 -- local breakLevelOne = { -- [0] = 30, -- [1] = 40, @@ -87,7 +87,7 @@ local orginLayer1 local curSelectEquipData local curSelectTalentIdx = 1 local HeroLevelConfig = ConfigManager.GetAllConfigsData(ConfigName.HeroLevelConfig) -local HeroMaxLevel = HeroLevelConfig[#HeroLevelConfig].Level--340 --英雄最大等级 +local HeroMaxLevel = HeroLevelConfig[#HeroLevelConfig].Level --340 --英雄最大等级 --装备类型 local equipType = { [1] = GetLanguageStrById(22623), @@ -97,10 +97,14 @@ local equipType = { } --锁定按钮 local LockingBtnState = { - [1] = {txt = string.format("%s", GetLanguageStrById(50164)), - img = Util.LoadSprite("X1_pinglun_suoding")}, - [2] = {txt = string.format("%s", GetLanguageStrById(50165)), - img = Util.LoadSprite("X1_pinglun_yisuoding")} + [1] = { + txt = string.format("%s", GetLanguageStrById(50164)), + img = Util.LoadSprite("X1_pinglun_suoding") + }, + [2] = { + txt = string.format("%s", GetLanguageStrById(50165)), + img = Util.LoadSprite("X1_pinglun_yisuoding") + } } --铸神等级图片 @@ -116,7 +120,7 @@ local isLink = false --初始化组件(用于子类重写) function RoleInfoPanel:InitComponent() this.HeadFrameView = SubUIManager.Open(SubUIConfig.PlayerHeadFrameView, self.transform) - this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowRight}) + this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowRight }) this.leftBtn = Util.GetGameObject(self.transform, "leftBtn") this.rightBtn = Util.GetGameObject(self.transform, "rightBtn") @@ -132,23 +136,23 @@ function RoleInfoPanel:InitComponent() --页签按钮 this.btnList = Util.GetGameObject(this.transform, "rolePanel/btnList") - this.btnInfo = Util.GetGameObject(this.btnList, "btnInfo") --属性 - this.btnInfoRedPoint = Util.GetGameObject(this.btnInfo, "redPoint") --属性红点 - this.btnEquip = Util.GetGameObject(this.btnList, "btnEquip") --装备 - this.btnEquipRedPoint = Util.GetGameObject(this.btnEquip, "redPoint") --装备红点 - this.btnCulture = Util.GetGameObject(this.btnList, "btnCulture" ) --培养 + this.btnInfo = Util.GetGameObject(this.btnList, "btnInfo") --属性 + this.btnInfoRedPoint = Util.GetGameObject(this.btnInfo, "redPoint") --属性红点 + this.btnEquip = Util.GetGameObject(this.btnList, "btnEquip") --装备 + this.btnEquipRedPoint = Util.GetGameObject(this.btnEquip, "redPoint") --装备红点 + this.btnCulture = Util.GetGameObject(this.btnList, "btnCulture") --培养 this.btnCultureRedPoint = Util.GetGameObject(this.btnCulture, "redPoint") --培养红点 this.btnCultureBtnList = Util.GetGameObject(this.layout, "LeftBtn") - this.btnUpStar = Util.GetGameObject(this.btnCultureBtnList, "btnList/btnUpStar") --升星 - this.btnUpStarRedpoint = Util.GetGameObject(this.btnUpStar, "redPoint") --升星红点 - this.btnAbility = Util.GetGameObject(this.btnCultureBtnList, "btnList/btnAbility") --能力 - this.btnAbilityRedPoint = Util.GetGameObject(this.btnAbility, "redPoint") --能力红点 - this.btnChip = Util.GetGameObject(this.btnCultureBtnList, "btnList/btnChip") --芯片 - this.btnChipRedPoint = Util.GetGameObject(this.btnChip,"redPoint") --芯片红点 + this.btnUpStar = Util.GetGameObject(this.btnCultureBtnList, "btnList/btnUpStar") --升星 + this.btnUpStarRedpoint = Util.GetGameObject(this.btnUpStar, "redPoint") --升星红点 + this.btnAbility = Util.GetGameObject(this.btnCultureBtnList, "btnList/btnAbility") --能力 + this.btnAbilityRedPoint = Util.GetGameObject(this.btnAbility, "redPoint") --能力红点 + this.btnChip = Util.GetGameObject(this.btnCultureBtnList, "btnList/btnChip") --芯片 + this.btnChipRedPoint = Util.GetGameObject(this.btnChip, "redPoint") --芯片红点 -- this.btnOverclock = Util.GetGameObject(this.btnCultureBtnList, "btnList/btnOverclock") --超频 -- this.btnFlagArr = Util.GetGameObject(this.btnCultureBtnList, "btnList/btnFlagArr") --旗阵 - this.btnSelect = Util.GetGameObject(this.btnCultureBtnList, "btnList/selectBtn") --选择按钮 + this.btnSelect = Util.GetGameObject(this.btnCultureBtnList, "btnList/selectBtn") --选择按钮 --英雄详情结构对象 this.roleInfoLayout = Util.GetGameObject(this.layout, "roleInfoLayout") @@ -165,51 +169,51 @@ function RoleInfoPanel:InitComponent() this.heroName = Util.GetGameObject(this.info, "name/heroName"):GetComponent("Text") this.power = Util.GetGameObject(this.info, "powerBg/powerBtn/value"):GetComponent("Text") - this.core = Util.GetGameObject(this.roleInfoLayout,"core")--核心 + this.core = Util.GetGameObject(this.roleInfoLayout, "core") --核心 - this.posText = Util.GetGameObject(this.roleInfoLayout,"Info/Text"):GetComponent("Text") --定位 - this.pro = Util.GetGameObject(this.roleInfoLayout,"Info/pro") - this.atkPro = Util.GetGameObject(this.pro,"atk") - this.hpPro = Util.GetGameObject(this.pro,"hp") - this.phyDef = Util.GetGameObject(this.pro,"phyDef") - this.Speed = Util.GetGameObject(this.pro,"Speed") - this.profession = Util.GetGameObject(this.pro,"lv/profession") - this.lv = Util.GetGameObject(this.pro,"lv/proValue"):GetComponent("Text") - this.maxLv = Util.GetGameObject(this.pro,"lv/proValueMax"):GetComponent("Text") + this.posText = Util.GetGameObject(this.roleInfoLayout, "Info/Text"):GetComponent("Text") --定位 + this.pro = Util.GetGameObject(this.roleInfoLayout, "Info/pro") + this.atkPro = Util.GetGameObject(this.pro, "atk") + this.hpPro = Util.GetGameObject(this.pro, "hp") + this.phyDef = Util.GetGameObject(this.pro, "phyDef") + this.Speed = Util.GetGameObject(this.pro, "Speed") + this.profession = Util.GetGameObject(this.pro, "lv/profession") + this.lv = Util.GetGameObject(this.pro, "lv/proValue"):GetComponent("Text") + this.maxLv = Util.GetGameObject(this.pro, "lv/proValueMax"):GetComponent("Text") - this.proHelpBtn = Util.GetGameObject(this.roleInfoLayout,"Info/helpBtn") + this.proHelpBtn = Util.GetGameObject(this.roleInfoLayout, "Info/helpBtn") - this.skillGrid = Util.GetGameObject(this.roleInfoLayout,"skill") + this.skillGrid = Util.GetGameObject(this.roleInfoLayout, "skill") for i = 1, 4 do skillShowProList[i] = Util.GetGameObject(this.skillGrid, "skillGroup/Skill" .. i) end --升级 - this.itemPre = Util.GetGameObject(this.roleInfoLayout,"upLv/itemPre") - this.itemGrid = Util.GetGameObject(this.roleInfoLayout,"upLv/itemGrid") - this.upLvBtn = Util.GetGameObject(this.roleInfoLayout,"upLvBtn") + this.itemPre = Util.GetGameObject(this.roleInfoLayout, "upLv/itemPre") + this.itemGrid = Util.GetGameObject(this.roleInfoLayout, "upLv/itemGrid") + this.upLvBtn = Util.GetGameObject(this.roleInfoLayout, "upLvBtn") this.upLvTrigger = Util.GetEventTriggerListener(this.upLvBtn) - this.upClassBtn = Util.GetGameObject(this.roleInfoLayout,"upClassBtn") - this.maxLvTip = Util.GetGameObject(this.roleInfoLayout,"maxLv") + this.upClassBtn = Util.GetGameObject(this.roleInfoLayout, "upClassBtn") + this.maxLvTip = Util.GetGameObject(this.roleInfoLayout, "maxLv") - this.upLv = Util.GetGameObject(this.roleInfoLayout ,"upLv") - this.upLvGoldBtn = Util.GetGameObject(this.upLv ,"gold") - this.upLvGoldText = Util.GetGameObject(this.upLv ,"gold/Text"):GetComponent("Text") + this.upLv = Util.GetGameObject(this.roleInfoLayout, "upLv") + this.upLvGoldBtn = Util.GetGameObject(this.upLv, "gold") + this.upLvGoldText = Util.GetGameObject(this.upLv, "gold/Text"):GetComponent("Text") --升星 - this.upStar = Util.GetGameObject(this.roleUpStarLayout,"upStar") - this.maxStar = Util.GetGameObject(this.roleUpStarLayout,"max") - this.upStarGrid = Util.GetGameObject(this.upStar,"upStarGrid") - this.upStarBtn = Util.GetGameObject(this.upStar,"upStarBtn") + this.upStar = Util.GetGameObject(this.roleUpStarLayout, "upStar") + this.maxStar = Util.GetGameObject(this.roleUpStarLayout, "max") + this.upStarGrid = Util.GetGameObject(this.upStar, "upStarGrid") + this.upStarBtn = Util.GetGameObject(this.upStar, "upStarBtn") -- this.upStarHelpBtn = Util.GetGameObject(this.roleUpStarLayout,"helpBtn") - this.goldGrid = Util.GetGameObject(this.upStar,"goldGrid") - this.goldBtn = Util.GetGameObject(this.goldGrid,"gold") - this.goldText = Util.GetGameObject(this.goldGrid,"gold/Text"):GetComponent("Text") - this.goldImage = Util.GetGameObject(this.goldGrid,"gold") - this.gold2Btn = Util.GetGameObject(this.goldGrid,"gold2") - this.gold2Text = Util.GetGameObject(this.goldGrid,"gold2/Text"):GetComponent("Text") - this.gold2Image = Util.GetGameObject(this.goldGrid,"gold2") + this.goldGrid = Util.GetGameObject(this.upStar, "goldGrid") + this.goldBtn = Util.GetGameObject(this.goldGrid, "gold") + this.goldText = Util.GetGameObject(this.goldGrid, "gold/Text"):GetComponent("Text") + this.goldImage = Util.GetGameObject(this.goldGrid, "gold") + this.gold2Btn = Util.GetGameObject(this.goldGrid, "gold2") + this.gold2Text = Util.GetGameObject(this.goldGrid, "gold2/Text"):GetComponent("Text") + this.gold2Image = Util.GetGameObject(this.goldGrid, "gold2") --升星属性 this.nextStarGrid = Util.GetGameObject(this.upStar, "nextStarGrid") @@ -229,8 +233,8 @@ function RoleInfoPanel:InitComponent() this.trigger.onEndDrag = this.trigger.onEndDrag + this.OnEndDrag --装备 - this.castGodBtn = Util.GetGameObject(this.roleEquipLayout, "castGodBtn")--铸神 - this.EquipAll = Util.GetGameObject(this.roleEquipLayout, "EquipAll")--快速装备 + this.castGodBtn = Util.GetGameObject(this.roleEquipLayout, "castGodBtn") --铸神 + this.EquipAll = Util.GetGameObject(this.roleEquipLayout, "EquipAll") --快速装备 this.EquipAllRedPoint = Util.GetGameObject(this.EquipAll, "redPoint") this.equipInfo = Util.GetGameObject(this.roleEquipLayout, "equipInfo") @@ -246,10 +250,10 @@ function RoleInfoPanel:InitComponent() this.equipRedPoint[i] = Util.GetGameObject(this.equipInfo, "equip" .. i .. "/redPoint") end - this.ResetBtn = Util.GetGameObject(self.transform, "roleInfoLayout/ResetBtn")--重置 - this.LockingBtn = Util.GetGameObject(self.transform, "roleInfoLayout/LockingBtn")--锁定 + this.ResetBtn = Util.GetGameObject(self.transform, "roleInfoLayout/ResetBtn") --重置 + this.LockingBtn = Util.GetGameObject(self.transform, "roleInfoLayout/LockingBtn") --锁定 this.lockTxt = Util.GetGameObject(self.transform, "roleInfoLayout/LockingBtn/Text"):GetComponent("Text") - this.CommentBtn = Util.GetGameObject(self.transform, "roleInfoLayout/CommentBtn")--评论 + this.CommentBtn = Util.GetGameObject(self.transform, "roleInfoLayout/CommentBtn") --评论 --能力 this.preViewBtn = Util.GetGameObject(this.roleAbilityLayout, "preViewBtn") @@ -267,7 +271,7 @@ function RoleInfoPanel:InitComponent() this.chipRedpointList = {} --芯片红点 this.chipGroups = Util.GetGameObject(this.roleChipLayout, "chipGrid") for i = 1, 4 do - local chipItem = Util.GetGameObject(this.chipGroups, "chip"..i) + local chipItem = Util.GetGameObject(this.chipGroups, "chip" .. i) this.chipList[i] = chipItem this.chipRedpointList[i] = Util.GetGameObject(chipItem, "noChip/redpoint") end @@ -305,7 +309,7 @@ function RoleInfoPanel:BindEvent() PlaySoundWithoutClick(SoundConfig.Sound_UICancel) self:ClosePanel() end) - Util.AddClick(this.ResetBtn,function() + Util.AddClick(this.ResetBtn, function() if curHeroData.lv == 1 then PopupTipPanel.ShowTip(GetLanguageStrById(12505)) return @@ -313,12 +317,12 @@ function RoleInfoPanel:BindEvent() if isGoToBattle then -- if GoToBattleNum < 2 then - local teamId = HeroManager.GetFormationByHeroId(curHeroData.dynamicId) - local team = FormationManager.GetFormationByID(teamId).teamHeroInfos - if #team < 2 then - PopupTipPanel.ShowTip(GetLanguageStrById(23163)) - return - end + local teamId = HeroManager.GetFormationByHeroId(curHeroData.dynamicId) + local team = FormationManager.GetFormationByID(teamId).teamHeroInfos + if #team < 2 then + PopupTipPanel.ShowTip(GetLanguageStrById(23163)) + return + end -- end -- PopupTipPanel.ShowTipByLanguageId(11854) -- return @@ -341,30 +345,31 @@ function RoleInfoPanel:BindEvent() -- return -- end -- local teamId = HeroManager.GetFormationByHeroId(curHeroData.dynamicId) - local dropList, cost = HeroManager.GetHeroReturnItems(this.selectHeroData,GENERAL_POPUP_TYPE.ResolveRecall) - UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.ResolveRecall, dropList, this.selectHeroData, cost, function () + local dropList, cost = HeroManager.GetHeroReturnItems(this.selectHeroData, GENERAL_POPUP_TYPE.ResolveRecall) + UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.ResolveRecall, dropList, this.selectHeroData, + cost, function() if isGoToBattle then - HeroManager.CompareWarPower(curHeroData.dynamicId)--对比战力并更新战力值 播放战力变更动画 + HeroManager.CompareWarPower(curHeroData.dynamicId) --对比战力并更新战力值 播放战力变更动画 end this:UpdatePanelData() end) end end) - Util.AddClick(this.LockingBtn,function() + Util.AddClick(this.LockingBtn, function() if curHeroData.lockState == 1 then curHeroData.lockState = 0 elseif curHeroData.lockState == 0 then curHeroData.lockState = 1 end - NetManager.HeroLockEvent(curHeroData.dynamicId,curHeroData.lockState,function () + NetManager.HeroLockEvent(curHeroData.dynamicId, curHeroData.lockState, function() if curHeroData.lockState == 1 then PopupTipPanel.ShowTip(GetLanguageStrById(11853)) elseif curHeroData.lockState == 0 then PopupTipPanel.ShowTip(GetLanguageStrById(11791)) end HeroManager.UpdateSingleHeroLockState(curHeroData.dynamicId, curHeroData.lockState) - + this.lockTxt.text = LockingBtnState[curHeroData.lockState + 1].txt this.LockingBtn:GetComponent("Image").sprite = LockingBtnState[curHeroData.lockState + 1].img @@ -375,7 +380,7 @@ function RoleInfoPanel:BindEvent() end end) end) - Util.AddClick(this.CommentBtn,function() + Util.AddClick(this.CommentBtn, function() UIManager.OpenPanel(UIName.CommentPanel, curHeroData.heroConfig) end) @@ -393,13 +398,13 @@ function RoleInfoPanel:BindEvent() Util.AddClick(this.dragView.gameObject, function() end) - Util.AddClick(this.proHelpBtn,function() - UIManager.OpenPanel(UIName.RoleProInfoPopup,allAddProVal,curHeroData.heroConfig,true) + Util.AddClick(this.proHelpBtn, function() + UIManager.OpenPanel(UIName.RoleProInfoPopup, allAddProVal, curHeroData.heroConfig, true) end) --角色定位按钮 - Util.AddClick(this.posBtn,function() - UIManager.OpenPanel(UIName.RolePosInfoPopup,curHeroData.heroConfig) + Util.AddClick(this.posBtn, function() + UIManager.OpenPanel(UIName.RolePosInfoPopup, curHeroData.heroConfig) end) --属性 @@ -482,12 +487,12 @@ function RoleInfoPanel:BindEvent() return end -- this.FunctionClickEvent(FUNCTION_OPEN_TYPE.ASSEMBLE, function () - self:StarUpClick() + self:StarUpClick() -- end) end) --装备 Util.AddClick(this.equipBtn, function() - UIManager.OpenPanel(UIName.RoleEquipPanel,curHeroData,heroDatas,this,isGoToBattle) + UIManager.OpenPanel(UIName.RoleEquipPanel, curHeroData, heroDatas, this, isGoToBattle) end) --装备 @@ -502,7 +507,7 @@ function RoleInfoPanel:BindEvent() UIManager.OpenPanel(UIName.EquipSelectPopup, curHeroData, i, self, nil) elseif i == 7 or i == 8 then local limit = string.split(SpecialConfig[157].Value, "#") - if curHeroData.star >= tonumber(limit[i-6]) then + if curHeroData.star >= tonumber(limit[i - 6]) then -- if curHeroData.totemId ~= 0 then -- UIManager.OpenPanel(UIName.ToTemUpLvPopup, curHeroData.totemId,curHeroData) -- else @@ -510,7 +515,7 @@ function RoleInfoPanel:BindEvent() -- end UIManager.OpenPanel(UIName.EquipSelectPopup, curHeroData, i, self, nil) else - PopupTipPanel.ShowTip(limit[i-6]..GetLanguageStrById(10488)) + PopupTipPanel.ShowTip(limit[i - 6] .. GetLanguageStrById(10488)) end else local isOpen, txt = this:checkUnlockCombatPlan(i - 4) @@ -524,35 +529,35 @@ function RoleInfoPanel:BindEvent() end --能力预览 - Util.AddClick(this.preViewBtn,function() + Util.AddClick(this.preViewBtn, function() UIManager.OpenPanel(UIName.WarWayPreviewPopup) end) --能力商城 - Util.AddClick(this.shopAbilityBtn,function() + Util.AddClick(this.shopAbilityBtn, function() UIManager.OpenPanel(UIName.MainShopPanel, SHOP_TYPE.WARWAY_SHOP) end) --能力帮助 Util.AddOnceClick(this.abilityHelpBtn, function() - UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.roleSkillLayout, - this.abilityHelpBtn:GetComponent("RectTransform").localPosition.x - 100, - this.abilityHelpBtn:GetComponent("RectTransform").localPosition.y) + UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.roleSkillLayout, + this.abilityHelpBtn:GetComponent("RectTransform").localPosition.x - 100, + this.abilityHelpBtn:GetComponent("RectTransform").localPosition.y) end) --芯片图谱 - Util.AddClick(this.atlasChipBtn,function() + Util.AddClick(this.atlasChipBtn, function() UIManager.OpenPanel(UIName.MedalAtlasPopup) end) --芯片管理 - Util.AddClick(this.manageChipBtn,function() - UIManager.OpenPanel(UIName.MedalSuitPopup,curHeroData) + Util.AddClick(this.manageChipBtn, function() + UIManager.OpenPanel(UIName.MedalSuitPopup, curHeroData) end) --芯片获取 - Util.AddClick(this.gainChipBtn,function() + Util.AddClick(this.gainChipBtn, function() UIManager.OpenPanel(UIName.ReconnaissancePanel) end) --芯片商城 - Util.AddClick(this.shopChipBtn,function() - UIManager.OpenPanel(UIName.MainShopPanel,67) + Util.AddClick(this.shopChipBtn, function() + UIManager.OpenPanel(UIName.MainShopPanel, 67) end) end @@ -567,22 +572,23 @@ end --移除事件监听(用于子类重写) function RoleInfoPanel:RemoveListener() - Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold,this.UpdateHeroUpLvAndBreakMaterialShow) - Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold,this.UpdateHeroUpStarMaterialShow) + Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.UpdateHeroUpLvAndBreakMaterialShow) + Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.UpdateHeroUpStarMaterialShow) Game.GlobalEvent:RemoveEvent(GameEvent.HeroGrade.OnHeroGradeChange, this.UpdateHeroInfoData) Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnPlayTitleChange, this.UpdateHeroInfoData) Game.GlobalEvent:RemoveEvent(GameEvent.Player.OnPlayRingChange, this.UpdateHeroInfoData) end --界面打开时调用(用于子类重写)(初始数据,英雄数据,是否上阵,上阵数量) -function RoleInfoPanel:OnOpen(_curHeroData, _heroDatas, _isGoToBattle)--, _GoToBattleNum) - curHeroData, heroDatas, isGoToBattle--[[, GoToBattleNum]] = _curHeroData, _heroDatas, _isGoToBattle--, _GoToBattleNum +function RoleInfoPanel:OnOpen(_curHeroData, _heroDatas, _isGoToBattle) --, _GoToBattleNum) + curHeroData, heroDatas, isGoToBattle --[[, GoToBattleNum]] = _curHeroData, _heroDatas, + _isGoToBattle --, _GoToBattleNum end function RoleInfoPanel:OnShow() this.HeadFrameView:OnShow() this.UpView:OnOpen({ showType = UpViewOpenType.ShowRight, panelType = PanelType.RoleInfo }) - + isClickLeftOrRightBtn = true for i = 1, #heroDatas do if curHeroData == heroDatas[i] then @@ -595,18 +601,18 @@ function RoleInfoPanel:OnShow() this:UpdateLiveList() this:ShowHeroLive() - FixedUpdateBeat:Add(this.OnUpdate, self)--长按方法注册 + FixedUpdateBeat:Add(this.OnUpdate, self) --长按方法注册 --装备 for i = 1, 6 do if effectList[i] ~= nil then - this.SetActive(effectList[i],false) + this.SetActive(effectList[i], false) end end - this:UpdatePanelData()--刷新页面 - this.OnClick(btnType.Info)--默认显示属性 - this:SelectBtn(this.btnUpStar)--默认显示升星 + this:UpdatePanelData() --刷新页面 + this.OnClick(btnType.Info) --默认显示属性 + this:SelectBtn(this.btnUpStar) --默认显示升星 -- this.ShowHeroEquip() end @@ -614,17 +620,17 @@ end --界面关闭时调用(用于子类重写) function this:OnClose() if this.leftLiveObj and leftHeroData then - UnLoadHerolive(leftHeroData.heroConfig,this.leftLiveObj) + UnLoadHerolive(leftHeroData.heroConfig, this.leftLiveObj) Util.ClearChild(this.leftObj.transform) this.leftLiveObj = nil end if this.rightLiveObj and rightHeroData then - UnLoadHerolive(rightHeroData.heroConfig,this.rightLiveObj) + UnLoadHerolive(rightHeroData.heroConfig, this.rightLiveObj) Util.ClearChild(this.rightObj.transform) this.rightLiveObj = nil end if this.curLiveObj and curHeroData then - UnLoadHerolive(curHeroData.heroConfig,this.curLiveObj) + UnLoadHerolive(curHeroData.heroConfig, this.curLiveObj) Util.ClearChild(this.curObj.transform) this.curLiveObj = nil end @@ -648,17 +654,17 @@ end --加载立绘 function this:ShowHeroLive() if this.leftLiveObj and leftHeroData then - UnLoadHerolive(leftHeroData.heroConfig,this.leftLiveObj) + UnLoadHerolive(leftHeroData.heroConfig, this.leftLiveObj) Util.ClearChild(this.leftObj.transform) this.leftLiveObj = nil end if this.rightLiveObj and rightHeroData then - UnLoadHerolive(rightHeroData.heroConfig,this.rightLiveObj) + UnLoadHerolive(rightHeroData.heroConfig, this.rightLiveObj) Util.ClearChild(this.rightObj.transform) this.rightLiveObj = nil end if this.curLiveObj and curHeroData then - UnLoadHerolive(curHeroData.heroConfig,this.curLiveObj) + UnLoadHerolive(curHeroData.heroConfig, this.curLiveObj) Util.ClearChild(this.curObj.transform) this.curLiveObj = nil end @@ -668,11 +674,11 @@ function this:ShowHeroLive() this.curLiveObj = LoadHerolive(curHeroData.heroConfig, this.curObj) if this.curLiveObj then - this.SetActive(this.dragView.gameObject,true) + this.SetActive(this.dragView.gameObject, true) this.dragView:SetDragGO(this.curLiveObj) else - this.SetActive(this.dragView.gameObject,false) - end + this.SetActive(this.dragView.gameObject, false) + end self.dragView:SetDragGO(this.curLiveObj) end @@ -704,64 +710,71 @@ end --更新界面显示 function this:UpdatePanelData() - this.SetActive(this.core, curHeroData.heroConfig.HeroValue == 1)--核心卡 + this.SetActive(this.core, curHeroData.heroConfig.HeroValue == 1) --核心卡 this.SetActive(this.btnAbility, curHeroData.heroConfig.Star >= 5) if curHeroData.heroConfig.Material == 1 then - this:UpdateMaterialHeroData() --刷新材料英雄信息 + this:UpdateMaterialHeroData() --刷新材料英雄信息 return end if curHeroData.heroConfig.GrowthSwitch then this.HideAllLayout() - this.SetActive(this.roleInfoLayout,true) + this.SetActive(this.roleInfoLayout, true) this:SetSelectBtn(this.btnInfo) end - this:UpdateHeroInfoData() --更新英雄信息数据 - this:GetCurHeroUpLvOrUpStarSData() --获取当前英雄的下一进阶 和 升星 静态数据 - this:UpdateHeroUpStarData() --更新英雄升星数据 - this:UpdateHeroUpLvAndBreakData() --更新英雄升级和进阶数据 - this:UpdateSkillData() --技能信息 - this.UpdateHeroMedalData() --芯片信息 - this:AbilityUpdateUI() --能力界面更新 - this.RefreshPlanSlot() --刷新戒指栏位 - this.ShowHeroEquip() --装备信息 + this:UpdateHeroInfoData() --更新英雄信息数据 + this:GetCurHeroUpLvOrUpStarSData() --获取当前英雄的下一进阶 和 升星 静态数据 + this:UpdateHeroUpStarData() --更新英雄升星数据 + this:UpdateHeroUpLvAndBreakData() --更新英雄升级和进阶数据 + this:UpdateSkillData() --技能信息 + this.UpdateHeroMedalData() --芯片信息 + this:AbilityUpdateUI() --能力界面更新 + this.RefreshPlanSlot() --刷新戒指栏位 + this.ShowHeroEquip() --装备信息 this.SetActive(this.ResetBtn, curHeroData.lv ~= 1 and not isLink) - this:IsMaxLevel() --最高级 - this:UpdateHeroEquipCastGod() --铸造装备解锁 + this:IsMaxLevel() --最高级 + this:UpdateHeroEquipCastGod() --铸造装备解锁 end --技能信息 function this:UpdateSkillData() - local oldSkillList = HeroManager.GetSkillIdsByHeroRulesRole(curHeroData.heroConfig.OpenSkillRules,curHeroData.star,curHeroData.breakId, curHeroData) - local oldOpenPassiveSkillRules = HeroManager.GetPassiveSkillIdsByHeroRuleslock(curHeroData.heroConfig.OpenPassiveSkillRules,curHeroData.star,curHeroData.breakId, curHeroData) + local oldSkillList = HeroManager.GetSkillIdsByHeroRulesRole(curHeroData.heroConfig.OpenSkillRules, curHeroData.star, + curHeroData.breakId, curHeroData) + local oldOpenPassiveSkillRules = HeroManager.GetPassiveSkillIdsByHeroRuleslock( + curHeroData.heroConfig.OpenPassiveSkillRules, curHeroData.star, curHeroData.breakId, curHeroData) for key, value in pairs(oldOpenPassiveSkillRules) do table.insert(oldSkillList, value) end - table.sort(oldSkillList,function(a,b) + table.sort(oldSkillList, function(a, b) return a.skillConfig.Id < b.skillConfig.Id end) for i = 1, 5 do if oldSkillList[i] and i ~= 1 then local triggerCallBack - this.SetActive(skillShowProList[i-1],true) + this.SetActive(skillShowProList[i - 1], true) local sprite = Util.LoadSprite(GetResourcePath(oldSkillList[i].skillConfig.Icon)) if sprite == nil then - LogRed("空资源 资源ID:" .. oldSkillList[i].skillConfig.Icon .. "|资源名:" .. GetResourcePath(oldSkillList[i].skillConfig.Icon)); + LogRed("空资源 资源ID:" .. + oldSkillList[i].skillConfig.Icon .. "|资源名:" .. GetResourcePath(oldSkillList[i].skillConfig.Icon)); end - - Util.GetGameObject(skillShowProList[i-1].transform,"icon"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(oldSkillList[i].skillConfig.Icon)) - Util.GetGameObject(skillShowProList[i-1].transform,"skillNameTx"):GetComponent("Text").text = GetLanguageStrById(oldSkillList[i].skillConfig.Name) + + Util.GetGameObject(skillShowProList[i - 1].transform, "icon"):GetComponent("Image").sprite = Util.LoadSprite( + GetResourcePath(oldSkillList[i].skillConfig.Icon)) + Util.GetGameObject(skillShowProList[i - 1].transform, "skillNameTx"):GetComponent("Text").text = + GetLanguageStrById(oldSkillList[i].skillConfig.Name) local lv - if SkillLogicConfig[oldSkillList[i].skillConfig.Id] ~= nil then - Util.GetGameObject(skillShowProList[i-1].transform,"Lv/LvTx"):GetComponent("Text").text = SkillLogicConfig[oldSkillList[i].skillConfig.Id].Level + if SkillLogicConfig[oldSkillList[i].skillConfig.Id] ~= nil then + Util.GetGameObject(skillShowProList[i - 1].transform, "Lv/LvTx"):GetComponent("Text").text = + SkillLogicConfig[oldSkillList[i].skillConfig.Id].Level lv = SkillLogicConfig[oldSkillList[i].skillConfig.Id].Level else - Util.GetGameObject(skillShowProList[i-1].transform,"Lv/LvTx"):GetComponent("Text").text = PassiveSkillLogicConfig[oldSkillList[i].skillConfig.Id].Level + Util.GetGameObject(skillShowProList[i - 1].transform, "Lv/LvTx"):GetComponent("Text").text = + PassiveSkillLogicConfig[oldSkillList[i].skillConfig.Id].Level lv = PassiveSkillLogicConfig[oldSkillList[i].skillConfig.Id].Level end - Util.SetGray(Util.GetGameObject(skillShowProList[i-1].transform,"icon"),oldSkillList[i].lock) - Util.AddOnceClick(skillShowProList[i-1], function() + Util.SetGray(Util.GetGameObject(skillShowProList[i - 1].transform, "icon"), oldSkillList[i].lock) + Util.AddOnceClick(skillShowProList[i - 1], function() if Game.GlobalEvent:HasEvent(GameEvent.UI.OnClose, triggerCallBack) then Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack) end @@ -769,14 +782,16 @@ function this:UpdateSkillData() local isPassive local skillPos if skillLogicConfig_ == nil then - skillLogicConfig_ = ConfigManager.TryGetConfigDataByKey(ConfigName.SkillLogicConfig,"Id",oldSkillList[i].skillConfig.Id) + skillLogicConfig_ = ConfigManager.TryGetConfigDataByKey(ConfigName.SkillLogicConfig, "Id", + oldSkillList[i].skillConfig.Id) isPassive = false end if skillLogicConfig_ == nil then - skillLogicConfig_ = ConfigManager.TryGetConfigDataByKey(ConfigName.PassiveSkillLogicConfig,"Id",oldSkillList[i].skillConfig.Id) + skillLogicConfig_ = ConfigManager.TryGetConfigDataByKey(ConfigName.PassiveSkillLogicConfig, "Id", + oldSkillList[i].skillConfig.Id) isPassive = true end - + if isPassive then for j = 1, #curHeroData.heroConfig.OpenPassiveSkillRules do if curHeroData.heroConfig.OpenPassiveSkillRules[j][2] == skillLogicConfig_.Group then @@ -792,13 +807,13 @@ function this:UpdateSkillData() end end end - local maxLv = HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id,skillPos) - local panel = UIManager.OpenPanel(UIName.SkillInfoPopup,oldSkillList[i],1,10,maxLv,i - 1,lv) - Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack) - end) + local maxLv = HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id, skillPos) + local panel = UIManager.OpenPanel(UIName.SkillInfoPopup, oldSkillList[i], 1, 10, maxLv, i - 1, lv) + Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack) + end) else if i ~= 1 then - this.SetActive(skillShowProList[i - 1],false) + this.SetActive(skillShowProList[i - 1], false) end end end @@ -819,28 +834,28 @@ function this:UpdateMaterialHeroData() this.posText.text = GetLanguageStrById(curHeroData.heroConfig.HeroLocation) this.lv.text = 1 this.maxLv.text = "" - this.SetActive(this.profession.gameObject,false) + this.SetActive(this.profession.gameObject, false) - this:ProShow(this.atkPro,nil,HeroProType.Attack) - this:ProShow(this.hpPro,nil,HeroProType.Hp) - this:ProShow(this.phyDef,nil,HeroProType.PhysicalDefence) - this:ProShow(this.Speed,nil,HeroProType.Speed) + this:ProShow(this.atkPro, nil, HeroProType.Attack) + this:ProShow(this.hpPro, nil, HeroProType.Hp) + this:ProShow(this.phyDef, nil, HeroProType.PhysicalDefence) + this:ProShow(this.Speed, nil, HeroProType.Speed) this.SetActive(this.equipLinkTip, false) this.SetActive(this.infoLinkTip, false) - this.SetActive(this.upLvBtn,false) - this.SetActive(this.upClassBtn,false) - this.SetActive(this.upLv,false) - this.SetActive(this.ResetBtn,false) - this.SetActive(this.skillGrid,false) - this.SetActive(Util.GetGameObject(this.roleInfoLayout,"Bg/hide"),false) - this.SetActive(this.proHelpBtn,false) + this.SetActive(this.upLvBtn, false) + this.SetActive(this.upClassBtn, false) + this.SetActive(this.upLv, false) + this.SetActive(this.ResetBtn, false) + this.SetActive(this.skillGrid, false) + this.SetActive(Util.GetGameObject(this.roleInfoLayout, "Bg/hide"), false) + this.SetActive(this.proHelpBtn, false) -- this.SetActive(this.btnInfo,false) - this.SetActive(this.btnEquip,false) - this.SetActive(this.btnCulture,false) - Util.GetGameObject(this.roleInfoLayout,"Info"):GetComponent("Text").enabled = false - this.SetActive(this.maxLvTip,false) - this.SetActive(this.LockingBtn,false) + this.SetActive(this.btnEquip, false) + this.SetActive(this.btnCulture, false) + Util.GetGameObject(this.roleInfoLayout, "Info"):GetComponent("Text").enabled = false + this.SetActive(this.maxLvTip, false) + this.SetActive(this.LockingBtn, false) end --更新英雄信息数据 @@ -848,18 +863,18 @@ function this:UpdateHeroInfoData() isLink = PowerCenterManager.FindHeroIsLinkHeroForDynamicId(curHeroData.dynamicId) this.equipLinkTip:SetActive(isLink) this.infoLinkTip:SetActive(isLink) - this.SetActive(this.profession.gameObject,true) - this.SetActive(Util.GetGameObject(this.roleInfoLayout,"Bg/hide"),true) - this.SetActive(this.proHelpBtn,true) - this.SetActive(this.btnInfo,true) - this.SetActive(this.btnEquip,true) - this.SetActive(this.btnCulture,true) - this.SetActive(this.skillGrid,true) - Util.GetGameObject(this.roleInfoLayout,"Info"):GetComponent("Text").enabled = true - this.SetActive(this.LockingBtn,true) + this.SetActive(this.profession.gameObject, true) + this.SetActive(Util.GetGameObject(this.roleInfoLayout, "Bg/hide"), true) + this.SetActive(this.proHelpBtn, true) + this.SetActive(this.btnInfo, true) + this.SetActive(this.btnEquip, true) + this.SetActive(this.btnCulture, true) + this.SetActive(this.skillGrid, true) + Util.GetGameObject(this.roleInfoLayout, "Info"):GetComponent("Text").enabled = true + this.SetActive(this.LockingBtn, true) this.lockTxt.text = LockingBtnState[curHeroData.lockState + 1].txt - this.LockingBtn:GetComponent("Image").sprite = LockingBtnState[curHeroData.lockState + 1].img + this.LockingBtn:GetComponent("Image").sprite = LockingBtnState[curHeroData.lockState + 1].img if teamHero[curHeroData.dynamicId] then isGoToBattle = true @@ -883,10 +898,10 @@ function this:UpdateHeroInfoData() this.heroName.text = GetLanguageStrById(curHeroData.name) this.proImage.sprite = Util.LoadSprite(GetProStrImageByProNum(curHeroData.heroConfig.PropertyName)) - this:ProShow(this.atkPro,allAddProVal,HeroProType.Attack) - this:ProShow(this.hpPro,allAddProVal,HeroProType.Hp) - this:ProShow(this.phyDef,allAddProVal,HeroProType.PhysicalDefence) - this:ProShow(this.Speed,allAddProVal,HeroProType.Speed) + this:ProShow(this.atkPro, allAddProVal, HeroProType.Attack) + this:ProShow(this.hpPro, allAddProVal, HeroProType.Hp) + this:ProShow(this.phyDef, allAddProVal, HeroProType.PhysicalDefence) + this:ProShow(this.Speed, allAddProVal, HeroProType.Speed) this.profession:GetComponent("Image").sprite = Util.LoadSprite(ProfessionImage[curHeroData.heroConfig.Profession]) this.lv.text = curHeroData.lv @@ -920,14 +935,14 @@ end --最高级 function this:IsMaxLevel() if not HeroManager.heroLvEnd[curHeroData.heroConfig.Id] or curHeroData.lv >= HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then - this.SetActive(this.upLv,false) + this.SetActive(this.upLv, false) this.SetActive(this.maxLvTip, not isLink) - this.SetActive(this.upLvBtn,false) - this.SetActive(this.upClassBtn,false) + this.SetActive(this.upLvBtn, false) + this.SetActive(this.upClassBtn, false) return true else this.SetActive(this.upLv, not isLink) - this.SetActive(this.maxLvTip,false) + this.SetActive(this.maxLvTip, false) this.SetActive(this.upLvBtn, not isLink) Util.SetGray(this.proHelpBtn, false) return false @@ -935,15 +950,16 @@ function this:IsMaxLevel() end --英雄属性 -function this:ProShow(go,allAddProVal,HeroProType) - local curProSConFig = ConfigManager.GetConfigData(ConfigName.PropertyConfig,HeroProType) - Util.GetGameObject(go,"proName"):GetComponent("Text").text = GetLanguageStrById(curProSConFig.Info) +function this:ProShow(go, allAddProVal, HeroProType) + local curProSConFig = ConfigManager.GetConfigData(ConfigName.PropertyConfig, HeroProType) + Util.GetGameObject(go, "proName"):GetComponent("Text").text = GetLanguageStrById(curProSConFig.Info) if allAddProVal == nil then - Util.GetGameObject(go,"proValue"):GetComponent("Text").text = 1 + Util.GetGameObject(go, "proValue"):GetComponent("Text").text = 1 else - Util.GetGameObject(go,"proValue"):GetComponent("Text").text = allAddProVal[HeroProType] + Util.GetGameObject(go, "proValue"):GetComponent("Text").text = allAddProVal[HeroProType] end - Util.GetGameObject(go,"Image"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(propertyConfig[HeroProType].PropertyIcon)) + Util.GetGameObject(go, "Image"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(propertyConfig + [HeroProType].PropertyIcon)) end --更新英雄升级和进阶数据 @@ -953,10 +969,10 @@ function this:UpdateHeroUpLvAndBreakData() this:RefreshRedPoint() -- 升级获取突破 和 升星相应heroRankUpConfig静态数据 - if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then - this.SetActive(this.upLv,false) + if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then + this.SetActive(this.upLv, false) this.SetActive(this.upClassBtn, not isLink) - + this.upLvBtn:SetActive(not isLink) -- this.up1LvBtn:SetActive(false) _isClicked = false @@ -964,13 +980,14 @@ function this:UpdateHeroUpLvAndBreakData() return else this.SetActive(this.upLv, not isLink) - this.SetActive(this.upClassBtn,false) + this.SetActive(this.upClassBtn, false) end end --刷新红点 function this:RefreshRedPoint() - this.SetActive(this.btnInfoRedPoint, HeroManager.LvUpBtnRedPoint(curHeroData) and isUpLvMaterials and isGoToBattle and not isLink) + this.SetActive(this.btnInfoRedPoint, + HeroManager.LvUpBtnRedPoint(curHeroData) and isUpLvMaterials and isGoToBattle and not isLink) local WearmedalListWear = MedalManager.MedalDaraByHero(curHeroData.dynamicId) local isOn = false for i = 1, 4 do @@ -983,11 +1000,14 @@ function this:RefreshRedPoint() end local isCanUpStar = HeroManager.IsShowUpStarRedPoint(curHeroData) - - local abilityPointStateRes = HeroManager.GetCurHeroAbilityIsShowRedPoint(curHeroData) - local isAbility = abilityPointStateRes["ability"..tostring(1)] or abilityPointStateRes["ability"..tostring(2)]or abilityPointStateRes["ability"..tostring(3)] - this.SetActive(this.btnCultureRedPoint, isGoToBattle and (isOn or isCanUpStar or isAbility)and (HeroManager.IsCompetencySkills(1) or HeroManager.IsCompetencySkills(3))) + local abilityPointStateRes = HeroManager.GetCurHeroAbilityIsShowRedPoint(curHeroData) + local isAbility = abilityPointStateRes["ability" .. tostring(1)] or abilityPointStateRes["ability" .. tostring(2)] or + abilityPointStateRes["ability" .. tostring(3)] + + this.SetActive(this.btnCultureRedPoint, + isGoToBattle and (isOn or isCanUpStar or isAbility) and + (HeroManager.IsCompetencySkills(1) or HeroManager.IsCompetencySkills(3))) this.SetActive(this.btnUpStarRedpoint, isGoToBattle and isCanUpStar and not isLink) this.SetActive(this.btnChipRedPoint, isGoToBattle and isOn) end @@ -995,18 +1015,19 @@ end --更新英雄升级和进阶的材料显示 function this:UpdateHeroUpLvAndBreakMaterialShow() if this.isCanAdvanced == true then - local costList = {{[1] = 0,[2] = 0},{[1] = 0,[2] = 0}} + local costList = { { [1] = 0, [2] = 0 }, { [1] = 0, [2] = 0 } } if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then costItemList = upTuPoRankUpConfig.ConsumeMaterial else local costData = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv).Consume for m = 4, 0, -1 do local isOk = true - costList = {{[1] = 0,[2] = 0},{[1] = 0,[2] = 0}} + costList = { { [1] = 0, [2] = 0 }, { [1] = 0, [2] = 0 } } local lv = m for i = 0, m do -- if curHeroData.lv + i >= HeroMaxLevel - 1 then lv = i break end - local costItemList1 = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv+i).Consume + local costItemList1 = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv + i) + .Consume if costItemList1 == nil or #costItemList1 <= 1 then break end for j = 1, #costList do costList[j][1] = costData[j][1] @@ -1037,32 +1058,36 @@ function this:UpdateHeroUpLvAndBreakMaterialShow() isUpLvMaterials = true for i = 1, #costItemList do if costItemList[i][1] == 0 then - elseif costItemList[i][1] ~= 14 then--经验 + elseif costItemList[i][1] ~= 14 then --经验 local go = newObject(this.itemPre) go.transform:SetParent(this.itemGrid.transform) go.transform.localScale = Vector3.one go.transform.localPosition = Vector3.zero - this.SetActive(go,true) - Util.GetGameObject(go.transform, "icon"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(itemConfig[costItemList[i][1]].ResourceID)) + this.SetActive(go, true) + Util.GetGameObject(go.transform, "icon"):GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath( + itemConfig[costItemList[i][1]].ResourceID)) if BagManager.GetItemCountById(costItemList[i][1]) < costItemList[i][2] then isUpLvMaterials = false - Util.GetGameObject(go.transform,"Text"):GetComponent("Text").text = string.format("%s",PrintWanNum2(costItemList[i][2])) + Util.GetGameObject(go.transform, "Text"):GetComponent("Text").text = string.format( + "%s", PrintWanNum2(costItemList[i][2])) else - Util.GetGameObject(go.transform,"Text"):GetComponent("Text").text = string.format("%s",PrintWanNum2(costItemList[i][2])) + Util.GetGameObject(go.transform, "Text"):GetComponent("Text").text = string.format("%s", + PrintWanNum2(costItemList[i][2])) end - Util.AddOnceClick(Util.GetGameObject(go.transform,"icon"),function () - UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,costItemList[i][1]) + Util.AddOnceClick(Util.GetGameObject(go.transform, "icon"), function() + UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, costItemList[i][1]) end) else --金钱 if BagManager.GetItemCountById(costItemList[i][1]) < costItemList[i][2] then isUpLvMaterials = false - this.upLvGoldText.text = string.format("%s",PrintWanNum2(costItemList[i][2])) + this.upLvGoldText.text = string.format("%s", + PrintWanNum2(costItemList[i][2])) else - this.upLvGoldText.text = string.format("%s",PrintWanNum2(costItemList[i][2])) + this.upLvGoldText.text = string.format("%s", PrintWanNum2(costItemList[i][2])) end - Util.AddOnceClick(this.upLvGoldBtn,function() - UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,costItemList[i][1]) + Util.AddOnceClick(this.upLvGoldBtn, function() + UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, costItemList[i][1]) end) end end @@ -1076,14 +1101,16 @@ function this:UpdateHeroUpStarData() --初始化技能显示 this.skillIcon.sprite = Util.LoadSprite("X1_tongyong_daojukuang_01") - this.skillIcon.color = Color.New(255/255,255/255,255/255,100/255) - this.SetActive(this.skillImage,false) + this.skillIcon.color = Color.New(255 / 255, 255 / 255, 255 / 255, 100 / 255) + this.SetActive(this.skillImage, false) - if curHeroData.star == curHeroData.heroConfig.MaxRank then + if curHeroData.star == curHeroData.heroConfig.MaxRank then elseif curHeroData.star > 4 and curHeroData.star < 10 then this.skillImage:SetActive(true) - local skillPos = ConfigManager.TryGetConfigDataByKey(ConfigName.UnlockSkill,"Star",curHeroData.star+1).SkillPos - local skillLevel = ConfigManager.TryGetConfigDataByKey(ConfigName.UnlockSkill,"Star",curHeroData.star+1).UnlockLV + local skillPos = ConfigManager.TryGetConfigDataByKey(ConfigName.UnlockSkill, "Star", curHeroData.star + 1) + .SkillPos + local skillLevel = ConfigManager.TryGetConfigDataByKey(ConfigName.UnlockSkill, "Star", curHeroData.star + 1) + .UnlockLV local isPassive = false local skillGroupID for i = 1, #curHeroData.heroConfig.OpenSkillRules do @@ -1097,11 +1124,14 @@ function this:UpdateHeroUpStarData() skillGroupID = curHeroData.heroConfig.OpenPassiveSkillRules[i][2] end end - local skilllogicconfig = ConfigManager.TryGetConfigDataByDoubleKey(isPassive and ConfigName.PassiveSkillLogicConfig or ConfigName.SkillLogicConfig, "Group", skillGroupID, "Level", skillLevel) - local skillConfig = ConfigManager.TryGetConfigData(isPassive and ConfigName.PassiveSkillConfig or ConfigName.SkillConfig,skilllogicconfig.Id) + local skilllogicconfig = ConfigManager.TryGetConfigDataByDoubleKey( + isPassive and ConfigName.PassiveSkillLogicConfig or ConfigName.SkillLogicConfig, "Group", skillGroupID, "Level", + skillLevel) + local skillConfig = ConfigManager.TryGetConfigData( + isPassive and ConfigName.PassiveSkillConfig or ConfigName.SkillConfig, skilllogicconfig.Id) this.skillIcon.sprite = Util.LoadSprite(GetResourcePath(skillConfig.Icon)) - this.skillIcon.color = Color.New(255/255,255/255,255/255,255/255) - this.skillLv.text = skillLevel + this.skillIcon.color = Color.New(255 / 255, 255 / 255, 255 / 255, 255 / 255) + this.skillLv.text = skillLevel if curHeroData.star == 5 or curHeroData.star == 14 then this.skillIcon.sprite = Util.LoadSprite(GetPictureFont("X1_yingxiongxiangqing_quanjineng")) @@ -1111,20 +1141,20 @@ function this:UpdateHeroUpStarData() --进阶祭品条件 local curUpStarData = HeroManager.GetHeroCurUpStarInfo(curHeroData.dynamicId) if curUpStarData and #curUpStarData > 0 then - this.SetActive(this.upStar,true) - this.SetActive(this.maxStar,false) + this.SetActive(this.upStar, true) + this.SetActive(this.maxStar, false) upStarConsumeMaterial = {} upStarMaterialIsAll = {} upStarPreList = {} local childCount = this.upStarGrid.transform.childCount for i = 1, childCount do - local go = Util.GetGameObject(this.upStarGrid.transform,"upStarPre"..i) - local icon = Util.GetGameObject(go.transform,"icon"):GetComponent("Image") - local frame = Util.GetGameObject(go.transform,"frame"):GetComponent("Image") - local addBtn = Util.GetGameObject(go.transform,"add") + local go = Util.GetGameObject(this.upStarGrid.transform, "upStarPre" .. i) + local icon = Util.GetGameObject(go.transform, "icon"):GetComponent("Image") + local frame = Util.GetGameObject(go.transform, "frame"):GetComponent("Image") + local addBtn = Util.GetGameObject(go.transform, "add") local starGrid = Util.GetGameObject(go.transform, "star/starGrid") - local num = Util.GetGameObject(go.transform,"num"):GetComponent("Text") - local name = Util.GetGameObject(go.transform,"name"):GetComponent("Text") + local num = Util.GetGameObject(go.transform, "num"):GetComponent("Text") + local name = Util.GetGameObject(go.transform, "name"):GetComponent("Text") if i <= #curUpStarData then -- 有数据 num.gameObject:SetActive(true) @@ -1132,37 +1162,45 @@ function this:UpdateHeroUpStarData() upStarConsumeMaterial[i] = {} upStarMaterialIsAll[i] = 2 - frame.color = Color.New(255/255,255/255,255/255,255/255) - icon.color = Color.New(255/255,255/255,255/255,255/255) + frame.color = Color.New(255 / 255, 255 / 255, 255 / 255, 255 / 255) + icon.color = Color.New(255 / 255, 255 / 255, 255 / 255, 255 / 255) if curUpStarData[i].upStarMaterialsData.Issame == 1 or curUpStarData[i].upStarMaterialsData.IsId > 0 then if curUpStarData[i].upStarMaterialsData.Issame == 1 then icon.sprite = Util.LoadSprite(GetResourcePath(curHeroData.heroConfig.Icon)) - frame.sprite = Util.LoadSprite(GetQuantityImageByquality(curHeroData.heroConfig.Quality, curUpStarData[i].upStarMaterialsData.StarLimit)) + frame.sprite = Util.LoadSprite(GetQuantityImageByquality(curHeroData.heroConfig.Quality, + curUpStarData[i].upStarMaterialsData.StarLimit)) name.text = GetLanguageStrById(curHeroData.heroConfig.ReadingName) elseif curUpStarData[i].upStarMaterialsData.IsId > 0 then - local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, curUpStarData[i].upStarMaterialsData.IsId) + local heroConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig, + curUpStarData[i].upStarMaterialsData.IsId) icon.sprite = Util.LoadSprite(GetResourcePath(heroConfig.Icon)) - frame.sprite = Util.LoadSprite(GetQuantityImageByquality(heroConfig.Quality, curUpStarData[i].upStarMaterialsData.StarLimit)) + frame.sprite = Util.LoadSprite(GetQuantityImageByquality(heroConfig.Quality, + curUpStarData[i].upStarMaterialsData.StarLimit)) name.text = GetLanguageStrById(heroConfig.ReadingName) end else icon.sprite = Util.LoadSprite(GetNoTargetHero(curUpStarData[i].upStarMaterialsData.StarLimit)) - frame.sprite = Util.LoadSprite(GetQuantityImageByquality(nil,curUpStarData[i].upStarMaterialsData.StarLimit)) + frame.sprite = Util.LoadSprite(GetQuantityImageByquality(nil, + curUpStarData[i].upStarMaterialsData.StarLimit)) name.text = "" end - local upStarHeroListData = HeroManager.GetUpStarHeroListData(curUpStarData[i].upStarMaterialsData.Id,curHeroData) + local upStarHeroListData = HeroManager.GetUpStarHeroListData(curUpStarData[i].upStarMaterialsData.Id, + curHeroData) addBtn:SetActive(true) - num.text = string.format("%s/%s",0,curUpStarData[i].upStarData[4]) + num.text = string.format("%s/%s", 0, curUpStarData[i].upStarData[4]) SetHeroStars(starGrid, curUpStarData[i].upStarMaterialsData.StarLimit) starGrid:SetActive(true) Util.AddOnceClick(addBtn, function() curSelectUpStarData = curUpStarData[i] curSelectUpStarGo = go - local curShowHeroListData = self:SetShowHeroListData(upStarConsumeMaterial,upStarHeroListData.heroList) + local curShowHeroListData = self:SetShowHeroListData(upStarConsumeMaterial, + upStarHeroListData.heroList) --参数1 显示的herolist 2 3 升当前星的规则 4 打开RoleUpStarListPanel的界面 - UIManager.OpenPanel(UIName.RoleUpStarListPanel, curShowHeroListData, curUpStarData[i].upStarMaterialsData, curUpStarData[i].upStarData, this,upStarConsumeMaterial[i], curHeroData) + UIManager.OpenPanel(UIName.RoleUpStarListPanel, curShowHeroListData, + curUpStarData[i].upStarMaterialsData, curUpStarData[i].upStarData, this, upStarConsumeMaterial + [i], curHeroData) end) else --无数据 addBtn:SetActive(false) @@ -1171,14 +1209,14 @@ function this:UpdateHeroUpStarData() name.text = "" frame.sprite = Util.LoadSprite("X1_tongyong_daojukuang_07") - frame.color = Color.New(255/255,255/255,255/255,128/255) + frame.color = Color.New(255 / 255, 255 / 255, 255 / 255, 128 / 255) --icon.sprite = Util.LoadSprite("X1_tongyong_mofazhen") - icon.color = Color.New(255/255,255/255,255/255,26/255) + icon.color = Color.New(255 / 255, 255 / 255, 255 / 255, 26 / 255) end end else - this.SetActive(this.upStar,false) - this.SetActive(this.maxStar,true) + this.SetActive(this.upStar, false) + this.SetActive(this.maxStar, true) end --自动选择进阶英雄材料 this:AutoSelectUpStarHeroList(curUpStarData) @@ -1189,49 +1227,50 @@ function this:UpdateHeroUpStarProUpShow() if upStarRankUpConfig and upStarRankUpConfig.Id then SetHeroStars(this.nextStarGrid, curHeroData.star + 1) - local upInfoGrid = Util.GetGameObject(this.upStar,"upInfoGrid") - local Info1 = Util.GetGameObject(upInfoGrid,"upInfoPro1/Info") - local curLv = HeroManager.GetCurHeroStarLvEnd(1,curHeroData) + local upInfoGrid = Util.GetGameObject(this.upStar, "upInfoGrid") + local Info1 = Util.GetGameObject(upInfoGrid, "upInfoPro1/Info") + local curLv = HeroManager.GetCurHeroStarLvEnd(1, curHeroData) if curLv == nil then curLv = 30 end - Util.GetGameObject(Info1,"cur"):GetComponent("Text").text = curLv - Util.GetGameObject(Info1,"next"):GetComponent("Text").text = HeroManager.GetCurHeroStarLvEnd(2,curHeroData,curHeroData.breakId,upStarRankUpConfig.Id) + Util.GetGameObject(Info1, "cur"):GetComponent("Text").text = curLv + Util.GetGameObject(Info1, "next"):GetComponent("Text").text = HeroManager.GetCurHeroStarLvEnd(2, curHeroData, + curHeroData.breakId, upStarRankUpConfig.Id) - local Info2 = Util.GetGameObject(upInfoGrid,"upInfoPro2/Info") - local Info2Title = Util.GetGameObject(Info2,"title"):GetComponent("Text") - local Info2Cur = Util.GetGameObject(Info2,"cur"):GetComponent("Text") - local Info2Next = Util.GetGameObject(Info2,"next"):GetComponent("Text") + local Info2 = Util.GetGameObject(upInfoGrid, "upInfoPro2/Info") + local Info2Title = Util.GetGameObject(Info2, "title"):GetComponent("Text") + local Info2Cur = Util.GetGameObject(Info2, "cur"):GetComponent("Text") + local Info2Next = Util.GetGameObject(Info2, "next"):GetComponent("Text") - local title2 = ConfigManager.TryGetConfigData(ConfigName.HeroStarConfig,curHeroData.star).Tip + local title2 = ConfigManager.TryGetConfigData(ConfigName.HeroStarConfig, curHeroData.star).Tip if title2 == nil then Info2Title.text = "--" else Info2Title.text = GetLanguageStrById(title2) end - local cur2 = ConfigManager.TryGetConfigData(ConfigName.HeroStarConfig,curHeroData.star).Tip1 + local cur2 = ConfigManager.TryGetConfigData(ConfigName.HeroStarConfig, curHeroData.star).Tip1 if cur2 == nil then Info2Cur.text = "--" else - Info2Cur.text = cur2 * 100 .."%" + Info2Cur.text = cur2 * 100 .. "%" if title2 ~= nil and tonumber(title2) == 2010318 then Info2Cur.text = cur2 end end - local next2 = ConfigManager.TryGetConfigData(ConfigName.HeroStarConfig,curHeroData.star).Tip2 + local next2 = ConfigManager.TryGetConfigData(ConfigName.HeroStarConfig, curHeroData.star).Tip2 if next2 == nil then Info2Next.text = "--" else - Info2Next.text = next2 * 100 .."%" + Info2Next.text = next2 * 100 .. "%" if title2 ~= nil and tonumber(title2) == 2010318 then Info2Next.text = next2 end end - - local Info3 = Util.GetGameObject(upInfoGrid,"upInfoPro3/Info") - local Info3Title = Util.GetGameObject(Info3,"title"):GetComponent("Text") - local Info3Cur = Util.GetGameObject(Info3,"cur"):GetComponent("Text") - local Info3Next = Util.GetGameObject(Info3,"next"):GetComponent("Text") + + local Info3 = Util.GetGameObject(upInfoGrid, "upInfoPro3/Info") + local Info3Title = Util.GetGameObject(Info3, "title"):GetComponent("Text") + local Info3Cur = Util.GetGameObject(Info3, "cur"):GetComponent("Text") + local Info3Next = Util.GetGameObject(Info3, "next"):GetComponent("Text") local title3 = ConfigManager.TryGetConfigData(ConfigName.HeroStarConfig, curHeroData.star).Tip3 if title3 == nil then @@ -1243,13 +1282,13 @@ function this:UpdateHeroUpStarProUpShow() if cur3 == nil then Info3Cur.text = "--" else - Info3Cur.text = cur3 * 100 .."%" + Info3Cur.text = cur3 * 100 .. "%" end local next3 = ConfigManager.TryGetConfigData(ConfigName.HeroStarConfig, curHeroData.star).Tip5 - if next3 == nil then + if next3 == nil then Info3Next.text = "--" else - Info3Next.text = next3 * 100 .."%" + Info3Next.text = next3 * 100 .. "%" end --是否为最大等级 @@ -1277,35 +1316,36 @@ function this:UpdateHeroUpStarProUpShow() end --单个技能显示 -function this.UpdateHeroUpStarProUpSkillShow(skillGridGO,skillTabs) +function this.UpdateHeroUpStarProUpSkillShow(skillGridGO, skillTabs) local triggerCallBack for i = 1, skillGridGO.transform.childCount do - local go = skillGridGO.transform:GetChild(i-1).gameObject + local go = skillGridGO.transform:GetChild(i - 1).gameObject if #skillTabs >= i then local curSkillData = skillTabs[i] - if curSkillData and curSkillData.skillConfig and curSkillData.skillConfig.Name then - this.SetActive(go,true) - local upGo = Util.GetGameObject(go.transform,"up") + if curSkillData and curSkillData.skillConfig and curSkillData.skillConfig.Name then + this.SetActive(go, true) + local upGo = Util.GetGameObject(go.transform, "up") if upGo then if curSkillData.isShowUpImage ~= nil and curSkillData.isShowUpImage == false then - this.SetActive(upGo,false) + this.SetActive(upGo, false) else - this.SetActive(upGo,true) + this.SetActive(upGo, true) end end - Util.GetGameObject(go.transform,"skillImage/skillName"):GetComponent("Text").text = GetLanguageStrById(curSkillData.skillConfig.Name) + Util.GetGameObject(go.transform, "skillImage/skillName"):GetComponent("Text").text = GetLanguageStrById( + curSkillData.skillConfig.Name) else - this.SetActive(go,false) + this.SetActive(go, false) end - Util.AddOnceClick(Util.GetGameObject(go.transform,"icon"), function() + Util.AddOnceClick(Util.GetGameObject(go.transform, "icon"), function() if Game.GlobalEvent:HasEvent(GameEvent.UI.OnClose, triggerCallBack) then Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack) end - local maxLv = HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id,i) - local skillInfoPopup = UIManager.OpenPanel(UIName.SkillInfoPopup,curSkillData,1,10,maxLv,i) + local maxLv = HeroManager.GetHeroSkillMaxLevel(curHeroData.heroConfig.Id, i) + local skillInfoPopup = UIManager.OpenPanel(UIName.SkillInfoPopup, curSkillData, 1, 10, maxLv, i) skillGridGO:GetComponent("Canvas").sortingOrder = skillInfoPopup.sortingOrder + 1 - triggerCallBack = function (panelType, p) + triggerCallBack = function(panelType, p) if panelType == UIName.SkillInfoPopup and skillInfoPopup == p then --监听到SkillInfoPopup关闭,把层级设回去 skillGridGO:GetComponent("Canvas").sortingOrder = this.sortingOrder + 1 Game.GlobalEvent:RemoveEvent(GameEvent.UI.OnClose, triggerCallBack) @@ -1314,7 +1354,7 @@ function this.UpdateHeroUpStarProUpSkillShow(skillGridGO,skillTabs) Game.GlobalEvent:AddEvent(GameEvent.UI.OnClose, triggerCallBack) end) else - this.SetActive(go,false) + this.SetActive(go, false) end end end @@ -1327,14 +1367,15 @@ function this:AutoSelectUpStarHeroList(_curUpStarData) for i = 1, #curUpStarData do curSelectUpStarData = curUpStarData[i] curSelectUpStarGo = upStarPreList[i] - local upStarHeroListData = HeroManager.GetUpStarHeroListData(curUpStarData[i].upStarMaterialsData.Id,curHeroData) + local upStarHeroListData = HeroManager.GetUpStarHeroListData(curUpStarData[i].upStarMaterialsData.Id, + curHeroData) local curSelectHeroList = {} - if curUpStarData[i].upStarMaterialsData.Issame == 1 - or curUpStarData[i].upStarMaterialsData.IsId > 0 then + if curUpStarData[i].upStarMaterialsData.Issame == 1 + or curUpStarData[i].upStarMaterialsData.IsId > 0 then if LengthOfTable(upStarHeroListData.heroList) >= curUpStarData[i].upStarData[4] then for i = 1, curUpStarData[i].upStarData[4] do if upStarHeroListData.heroList[i].lockState == 0 and upStarHeroListData.heroList[i].isFormation == "" then - table.insert(curSelectHeroList,upStarHeroListData.heroList[i]) + table.insert(curSelectHeroList, upStarHeroListData.heroList[i]) end end self.UpdateUpStarPosHeroData(curSelectHeroList) @@ -1350,14 +1391,15 @@ function this:UpdateHeroUpStarMaterialShow() if upStarRankUpConfig then isUpStarMaterials = true local ConsumeMaterial = upStarRankUpConfig.ConsumeMaterial - this.SetActive(this.goldGrid,false) - this.SetActive(this.goldImage,false) - this.SetActive(this.gold2Image,false) + this.SetActive(this.goldGrid, false) + this.SetActive(this.goldImage, false) + this.SetActive(this.gold2Image, false) if ConsumeMaterial and #ConsumeMaterial[1] > 1 then if ConsumeMaterial[1][2] > 0 then - this.SetActive(this.goldGrid,true) - this.SetActive(this.goldImage,true) - this.goldImage:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(itemConfig[ConsumeMaterial[1][1]].ResourceID)) + this.SetActive(this.goldGrid, true) + this.SetActive(this.goldImage, true) + this.goldImage:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(itemConfig + [ConsumeMaterial[1][1]].ResourceID)) if BagManager.GetItemCountById(ConsumeMaterial[1][1]) < ConsumeMaterial[1][2] then isUpStarMaterials = false this.goldText.color = UIColorNew.RED @@ -1365,18 +1407,19 @@ function this:UpdateHeroUpStarMaterialShow() this.goldText.color = UIColorNew.GREEN end this.goldText.text = BagManager.GetItemCountById(ConsumeMaterial[1][1]) .. "/" .. ConsumeMaterial[1][2] - Util.AddOnceClick(this.goldBtn,function() - UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,ConsumeMaterial[1][1]) + Util.AddOnceClick(this.goldBtn, function() + UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, ConsumeMaterial[1][1]) end) else - this.SetActive(this.goldImage,false) + this.SetActive(this.goldImage, false) end end if ConsumeMaterial and #ConsumeMaterial >= 2 then if ConsumeMaterial[1][2] > 0 then - this.SetActive(this.goldGrid,true) - this.SetActive(this.goldImage,true) - this.goldImage:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(itemConfig[ConsumeMaterial[1][1]].ResourceID)) + this.SetActive(this.goldGrid, true) + this.SetActive(this.goldImage, true) + this.goldImage:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(itemConfig + [ConsumeMaterial[1][1]].ResourceID)) if BagManager.GetItemCountById(ConsumeMaterial[1][1]) < ConsumeMaterial[1][2] then isUpStarMaterials = false this.goldText.color = UIColorNew.RED @@ -1384,28 +1427,29 @@ function this:UpdateHeroUpStarMaterialShow() this.goldText.color = UIColorNew.GREEN end this.goldText.text = BagManager.GetItemCountById(ConsumeMaterial[1][1]) .. "/" .. ConsumeMaterial[1][2] - Util.AddOnceClick(this.goldBtn,function() - UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,ConsumeMaterial[1][1]) + Util.AddOnceClick(this.goldBtn, function() + UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, ConsumeMaterial[1][1]) end) else - this.SetActive(this.goldImage,false) + this.SetActive(this.goldImage, false) end if ConsumeMaterial[2][2] > 0 then - this.SetActive(this.goldGrid,true) - this.SetActive(this.gold2Image,true) - this.gold2Image:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(itemConfig[ConsumeMaterial[2][1]].ResourceID)) + this.SetActive(this.goldGrid, true) + this.SetActive(this.gold2Image, true) + this.gold2Image:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(itemConfig + [ConsumeMaterial[2][1]].ResourceID)) if BagManager.GetItemCountById(ConsumeMaterial[2][1]) < ConsumeMaterial[2][2] then isUpStarMaterials = false this.gold2Text.color = UIColorNew.RED else this.gold2Text.color = UIColorNew.GREEN end - this.gold2Text.text = BagManager.GetItemCountById(ConsumeMaterial[2][1]) .. "/" .. ConsumeMaterial[2][2] - Util.AddOnceClick(this.gold2Btn,function() - UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,ConsumeMaterial[2][1]) + this.gold2Text.text = BagManager.GetItemCountById(ConsumeMaterial[2][1]) .. "/" .. ConsumeMaterial[2][2] + Util.AddOnceClick(this.gold2Btn, function() + UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, ConsumeMaterial[2][1]) end) else - this.SetActive(this.gold2Image,false) + this.SetActive(this.gold2Image, false) end end end @@ -1416,10 +1460,10 @@ end function this:SetShowHeroListData(upStarConsumeMaterial, curHeroList) local curEndShowHeroListData2 = {} for i = 1, #curHeroList do - table.insert(curEndShowHeroListData2,curHeroList[i]) + table.insert(curEndShowHeroListData2, curHeroList[i]) end local curEndShowHeroListData = {} - for i, v in pairs(curEndShowHeroListData2) do + for i, v in pairs(curEndShowHeroListData2) do local isFormations = {} for n, w in pairs(FormationManager.formationList) do for m = 1, #w.teamHeroInfos do @@ -1434,7 +1478,7 @@ function this:SetShowHeroListData(upStarConsumeMaterial, curHeroList) table.insert(isFormations, curFormationId) else isFormationStr, curFormationId = HeroManager.GetHeroFormationStr2(n) - isFormationStr = "、" ..isFormationStr + isFormationStr = "、" .. isFormationStr table.insert(isFormations, curFormationId) v.isFormation = v.isFormation .. isFormationStr end @@ -1446,12 +1490,12 @@ function this:SetShowHeroListData(upStarConsumeMaterial, curHeroList) curEndShowHeroListData2[i].isFormations = isFormations v.isSelect = 2 - table.insert(curEndShowHeroListData,v) + table.insert(curEndShowHeroListData, v) end for j = 1, #upStarConsumeMaterial do if upStarConsumeMaterial[j] and #upStarConsumeMaterial[j] > 0 then for k = 1, #upStarConsumeMaterial[j] do - if j == curSelectUpStarData.upStarData[2] then--curSelectUpStarData 当前坑位选择的英雄信息 + if j == curSelectUpStarData.upStarData[2] then --curSelectUpStarData 当前坑位选择的英雄信息 for _, v in pairs(curEndShowHeroListData) do if v.dynamicId == upStarConsumeMaterial[j][k] then v.isSelect = 1 @@ -1469,7 +1513,7 @@ function this:SetShowHeroListData(upStarConsumeMaterial, curHeroList) end local curList = {} for _, v in pairs(curEndShowHeroListData) do - table.insert(curList,v) + table.insert(curList, v) end return curList end @@ -1487,27 +1531,28 @@ function this:GetCurHeroUpLvOrUpStarSData() if v.Star == curHeroData.heroConfig.Star then --1进阶 if v.Show == 1 then - if v.Id ~= curHeroData.breakId and curHeroData.lv == v.LimitLevel then --and curHeroData.star == v.LimitStar + if v.Id ~= curHeroData.breakId and curHeroData.lv == v.LimitLevel then --and curHeroData.star == v.LimitStar isHeroUpTuPo = true upTuPoRankUpConfig = v end if v.Id ~= curHeroData.breakId and v.LimitLevel - curHeroData.lv <= 5 and curHeroData.lv < v.LimitLevel and v.LimitLevel ~= curHeroData.lv then local costData = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv).Consume - for m = 4, 0, -1 do + for m = 4, 0, -1 do local isCanBreach = true --是否可突破 - costItemList = {{[1] = 0,[2] = 0},{[1] = 0,[2] = 0}} + costItemList = { { [1] = 0, [2] = 0 }, { [1] = 0, [2] = 0 } } for i = 0, m do - local costItemListConfig = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv + i).Consume + local costItemListConfig = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, + curHeroData.lv + i).Consume if costItemListConfig == nil then break end - for j = 1,#costItemList do + for j = 1, #costItemList do costItemList[j][1] = costData[j][1] costItemList[j][2] = costItemList[j][2] + costItemListConfig[j][2] end end --如果材料不足 for n = 1, #costItemList do - if BagManager.GetItemCountById(costItemList[n][1]) < costItemList[n][2] then + if BagManager.GetItemCountById(costItemList[n][1]) < costItemList[n][2] then isCanBreach = false end end @@ -1517,18 +1562,18 @@ function this:GetCurHeroUpLvOrUpStarSData() end end - local residualAdvanced = v.LimitLevel - curHeroData.lv--还有几级进阶 + local residualAdvanced = v.LimitLevel - curHeroData.lv --还有几级进阶 if this.AddLv > residualAdvanced then - costItemList = { {[1] = 0,[2] = 0},{[1] = 0,[2] = 0} } - for i = 0,residualAdvanced - 1 do - local costItemListConfig = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv + i).Consume + costItemList = { { [1] = 0, [2] = 0 }, { [1] = 0, [2] = 0 } } + for i = 0, residualAdvanced - 1 do + local costItemListConfig = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, + curHeroData.lv + i).Consume if costItemListConfig == nil then break end - for j = 1,#costItemList do + for j = 1, #costItemList do costItemList[j][1] = costData[j][1] costItemList[j][2] = costItemList[j][2] + costItemListConfig[j][2] - end - end + end this.residualUpLv = residualAdvanced this.isCanAdvanced = false else @@ -1544,21 +1589,22 @@ function this:GetCurHeroUpLvOrUpStarSData() isHeroUpStar = true -- return end - if v.Id ~= curHeroData.upStarId and curHeroData.star == v.LimitStar and curHeroData.star ~= curHeroData.maxStar then--and v.OpenLevel-curHeroData.lv~=0 then + if v.Id ~= curHeroData.upStarId and curHeroData.star == v.LimitStar and curHeroData.star ~= curHeroData.maxStar then --and v.OpenLevel-curHeroData.lv~=0 then local costData = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv).Consume - for m = 4, 0, -1 do + for m = 4, 0, -1 do local isOk = true - costItemList = { {[1] = 0,[2] = 0},{[1] = 0,[2] = 0} } + costItemList = { { [1] = 0, [2] = 0 }, { [1] = 0, [2] = 0 } } for i = 0, m do - local costItemList1 = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv + i).Consume - if costItemList1 == nil then break end--确认 - for j = 1,#costItemList do + local costItemList1 = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, + curHeroData.lv + i).Consume + if costItemList1 == nil then break end --确认 + for j = 1, #costItemList do costItemList[j][1] = costData[j][1] costItemList[j][2] = costItemList[j][2] + costItemList1[j][2] end end - for n = 1, #costItemList do - if BagManager.GetItemCountById(costItemList[n][1]) < costItemList[n][2] then + for n = 1, #costItemList do + if BagManager.GetItemCountById(costItemList[n][1]) < costItemList[n][2] then isOk = false end end @@ -1581,14 +1627,14 @@ function this:GetCurHeroUpLvOrUpStarSData() --还有几级升星 this.upStarNum = nowMaxLevel - curHeroData.lv if this.AddLv > this.upStarNum and this.upStarNum ~= 0 then - costItemList = {{[1] = 0,[2] = 0},{[1] = 0,[2] = 0}} - for i = 0,this.upStarNum - 1 do - local costItemList1 = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, curHeroData.lv + i).Consume - if costItemList1 == nil then break end--确认 - for j = 1,#costItemList do + costItemList = { { [1] = 0, [2] = 0 }, { [1] = 0, [2] = 0 } } + for i = 0, this.upStarNum - 1 do + local costItemList1 = ConfigManager.GetConfigData(ConfigName.HeroLevelConfig, + curHeroData.lv + i).Consume + if costItemList1 == nil then break end --确认 + for j = 1, #costItemList do costItemList[j][1] = costData[j][1] - costItemList[j][2] = costItemList[j][2]+costItemList1[j][2] - + costItemList[j][2] = costItemList[j][2] + costItemList1[j][2] end end this.residualUpLv = this.upStarNum @@ -1606,20 +1652,23 @@ end function this.UpdateUpStarPosHeroData(curSelectHeroList) if LengthOfTable(curSelectHeroList) < curSelectUpStarData.upStarData[4] then upStarMaterialIsAll[curSelectUpStarData.upStarData[2]] = 2 - this.SetActive(Util.GetGameObject(curSelectUpStarGo.transform,"add"),true) - local upStarHeroListData = HeroManager.GetUpStarHeroListData(curSelectUpStarData.upStarMaterialsData.Id,curHeroData) + this.SetActive(Util.GetGameObject(curSelectUpStarGo.transform, "add"), true) + local upStarHeroListData = HeroManager.GetUpStarHeroListData(curSelectUpStarData.upStarMaterialsData.Id, + curHeroData) if upStarHeroListData.state <= 0 then - this.SetActive(Util.GetGameObject(curSelectUpStarGo.transform,"add"),false) + this.SetActive(Util.GetGameObject(curSelectUpStarGo.transform, "add"), false) end - Util.GetGameObject(curSelectUpStarGo.transform,"num"):GetComponent("Text").text = string.format("%s/%s", LengthOfTable(curSelectHeroList),curSelectUpStarData.upStarData[4]) + Util.GetGameObject(curSelectUpStarGo.transform, "num"):GetComponent("Text").text = string.format( + "%s/%s", LengthOfTable(curSelectHeroList), curSelectUpStarData.upStarData[4]) else upStarMaterialIsAll[curSelectUpStarData.upStarData[2]] = 1 -- this.SetActive(Util.GetGameObject(curSelectUpStarGo.transform,"add"),false) - Util.GetGameObject(curSelectUpStarGo.transform,"num"):GetComponent("Text").text = string.format("%s/%s", LengthOfTable(curSelectHeroList),curSelectUpStarData.upStarData[4]) + Util.GetGameObject(curSelectUpStarGo.transform, "num"):GetComponent("Text").text = string.format( + "%s/%s", LengthOfTable(curSelectHeroList), curSelectUpStarData.upStarData[4]) end local curUpStarConsumeMaterial = {} for i, v in pairs(curSelectHeroList) do - table.insert(curUpStarConsumeMaterial,v.dynamicId) + table.insert(curUpStarConsumeMaterial, v.dynamicId) end upStarConsumeMaterial[curSelectUpStarData.upStarData[2]] = curUpStarConsumeMaterial end @@ -1653,7 +1702,7 @@ function this:LvUpClick(isSingleLvUp) -- this:UpdateHeroUpStarProUpShow() -- this:OnClickBtnUpStar() this.OnClick(btnType.Culture) - end,GetLanguageStrById(10719),GetLanguageStrById(11848)) + end, GetLanguageStrById(10719), GetLanguageStrById(11848)) else --材料足够 if isUpLvMaterials then @@ -1665,8 +1714,8 @@ function this:LvUpClick(isSingleLvUp) else curUpLv = curHeroData.lv + this.residualUpLv end - NetManager.HeroLvUpEvent(curHeroData.dynamicId,curUpLv,curHeroData.lv,function (msg) - self:DeleteLvUpMaterials(isSingleLvUp,msg) + NetManager.HeroLvUpEvent(curHeroData.dynamicId, curUpLv, curHeroData.lv, function(msg) + self:DeleteLvUpMaterials(isSingleLvUp, msg) end) else isTriggerLongClick = true @@ -1691,7 +1740,7 @@ function this:LvUpClick(isSingleLvUp) -- this:UpdateHeroUpStarProUpShow() -- this:OnClickBtnUpStar() this.OnClick(btnType.Culture) - end,GetLanguageStrById(10719),GetLanguageStrById(11848)) + end, GetLanguageStrById(10719), GetLanguageStrById(11848)) end else if isUpLvMaterials then @@ -1699,12 +1748,13 @@ function this:LvUpClick(isSingleLvUp) if isSingleLvUp then local curUpLv = curHeroData.lv --初始等级 if isHeroUpTuPo and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then - UIManager.OpenPanel(UIName.RoleRankUpConfirmPopup, curHeroData, upTuPoRankUpConfig, upTuPoRankUpConfig.OpenLevel, upTuPoRankUpConfig.ConsumeMaterial, function () + UIManager.OpenPanel(UIName.RoleRankUpConfirmPopup, curHeroData, upTuPoRankUpConfig, + upTuPoRankUpConfig.OpenLevel, upTuPoRankUpConfig.ConsumeMaterial, function() curUpLv = curHeroData.lv if curUpLv > HeroMaxLevel then curUpLv = HeroMaxLevel end - NetManager.HeroLvUpEvent(curHeroData.dynamicId, curUpLv, curHeroData.lv,function (msg) + NetManager.HeroLvUpEvent(curHeroData.dynamicId, curUpLv, curHeroData.lv, function(msg) self:DeleteLvUpMaterials(isSingleLvUp, msg) end) end) @@ -1736,8 +1786,8 @@ function this:LvUpClick(isSingleLvUp) if curUpLv > this:GetLvEnd() then curUpLv = this:GetLvEnd() end - NetManager.HeroLvUpEvent(curHeroData.dynamicId, curUpLv, curHeroData.lv,function (msg) - self:DeleteLvUpMaterials(isSingleLvUp,msg) + NetManager.HeroLvUpEvent(curHeroData.dynamicId, curUpLv, curHeroData.lv, function(msg) + self:DeleteLvUpMaterials(isSingleLvUp, msg) end) end else @@ -1759,14 +1809,14 @@ function this:LvUpClick(isSingleLvUp) end function RoleInfoPanel:LvUpClickOne(isSingleLvUp) - --是否为最大等级 - if curHeroData.lv >= HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then + --是否为最大等级 + if curHeroData.lv >= HeroManager.heroLvEnd[curHeroData.heroConfig.Id] then PopupTipPanel.ShowTip(GetLanguageStrById(11846)) _isClicked = false _isReqLvUp = false return end - + -- 突破新增加条件 -- local heroRankUpConfig = ConfigManager.GetConfig(ConfigName.HeroRankupConfig) --突破等级 @@ -1782,20 +1832,21 @@ function RoleInfoPanel:LvUpClickOne(isSingleLvUp) -- end --判断是否达到阶级上限 if isUpLvMaterials then - if isSingleLvUp then--是否是单次升级 + if isSingleLvUp then --是否是单次升级 local curUpLv = curHeroData.lv if isHeroUpTuPo and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then - UIManager.OpenPanel(UIName.RoleRankUpConfirmPopup, curHeroData, upTuPoRankUpConfig, upTuPoRankUpConfig.OpenLevel, upTuPoRankUpConfig.ConsumeMaterial, function () + UIManager.OpenPanel(UIName.RoleRankUpConfirmPopup, curHeroData, upTuPoRankUpConfig, + upTuPoRankUpConfig.OpenLevel, upTuPoRankUpConfig.ConsumeMaterial, function() curUpLv = curHeroData.lv - NetManager.HeroLvUpEvent(curHeroData.dynamicId, curUpLv, curHeroData.lv, function (msg) - self:DeleteLvUpMaterials(isSingleLvUp,msg) + NetManager.HeroLvUpEvent(curHeroData.dynamicId, curUpLv, curHeroData.lv, function(msg) + self:DeleteLvUpMaterials(isSingleLvUp, msg) end) end) curUpLv = curHeroData.lv else curUpLv = curHeroData.lv + 1 - NetManager.HeroLvUpEvent(curHeroData.dynamicId, curUpLv, curHeroData.lv, function (msg) - self:DeleteLvUpMaterials(isSingleLvUp,msg) + NetManager.HeroLvUpEvent(curHeroData.dynamicId, curUpLv, curHeroData.lv, function(msg) + self:DeleteLvUpMaterials(isSingleLvUp, msg) end) end else @@ -1815,7 +1866,7 @@ end --长按升级结束后请求协议 function this:LongLvUpClick(oldLv) - NetManager.HeroLvUpEvent(curHeroData.dynamicId,curHeroData.lv,oldLv,function (msg) + NetManager.HeroLvUpEvent(curHeroData.dynamicId, curHeroData.lv, oldLv, function(msg) self:DeleteLvUpMaterials2(msg) end) end @@ -1837,11 +1888,12 @@ function this:StarUpClick() end end if isUpStarMaterials and isUpStarMaterialsHero then - NetManager.HeroUpStarEvent(curHeroData.dynamicId, upStarConsumeMaterial, function (msg) - UIManager.OpenPanel(UIName.RoleUpStarSuccessPanel,curHeroData,upStarRankUpConfig.Id,upStarRankUpConfig.OpenLevel,function () + NetManager.HeroUpStarEvent(curHeroData.dynamicId, upStarConsumeMaterial, function(msg) + UIManager.OpenPanel(UIName.RoleUpStarSuccessPanel, curHeroData, upStarRankUpConfig.Id, + upStarRankUpConfig.OpenLevel, function() local dropItemTabs = BagManager.GetTableByBackDropData(msg) if #dropItemTabs > 0 then - UIManager.OpenPanel(UIName.RewardItemPopup, msg, 1, function () + UIManager.OpenPanel(UIName.RewardItemPopup, msg, 1, function() self:DeleteUpStarMaterials() self:UpdateHeroUpStarProUpShow() end) @@ -1854,7 +1906,7 @@ function this:StarUpClick() -- 进阶音效 PlaySoundWithoutClick(SoundConfig.Sound_Recruit3) - CombatPlanManager.RequestAllPlanData(function()end) + CombatPlanManager.RequestAllPlanData(function() end) else PopupTipPanel.ShowTipByLanguageId(11852) end @@ -1865,13 +1917,14 @@ function this:DeleteLvUpMaterials(isSingleLvUp, msg) --连续升级的时候需要自己先扣除 if isSingleLvUp == false then for i = 1, #costItemList do - BagManager.HeroLvUpUpdateItemsNum(costItemList[i][1],costItemList[i][2]) + BagManager.HeroLvUpUpdateItemsNum(costItemList[i][1], costItemList[i][2]) end end for i, v in pairs(heroDatas) do if curHeroData == v then if isHeroUpTuPo and upTuPoRankUpConfig and curHeroData.lv == upTuPoRankUpConfig.LimitLevel then - UIManager.OpenPanel(UIName.RoleUpLvBreakSuccessPanel,curHeroData,upTuPoRankUpConfig.Id,upTuPoRankUpConfig.OpenLevel) + UIManager.OpenPanel(UIName.RoleUpLvBreakSuccessPanel, curHeroData, upTuPoRankUpConfig.Id, + upTuPoRankUpConfig.OpenLevel) curHeroData.breakId = upTuPoRankUpConfig.Id v.breakId = curHeroData.breakId --突破有可能会升星 @@ -1899,10 +1952,11 @@ function this:DeleteLvUpMaterials(isSingleLvUp, msg) -- 升级音效 PlaySoundWithoutClick(SoundConfig.Sound_Upgrade) end - HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId,curHeroData.lv,curHeroData.star,curHeroData.breakId,curHeroData.upStarId,isSingleLvUp) + HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId, curHeroData.lv, curHeroData.star, curHeroData.breakId, + curHeroData.upStarId, isSingleLvUp) local allAddProValOld = allAddProVal this.ShowProAddVal(allAddProValOld) - this:UpdatePanelData()--刷新界面 + this:UpdatePanelData() --刷新界面 _isReqLvUp = false end @@ -1911,19 +1965,21 @@ end function this:DeleteLvUpMaterials2(msg) for i, v in pairs(heroDatas) do if curHeroData == v then - if msg then + if msg then curHeroData.lv = msg.targetLevel end v.lv = curHeroData.lv end end - HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId,curHeroData.lv,curHeroData.star,curHeroData.breakId,curHeroData.upStarId,true) - this:UpdatePanelData()--刷新界面 + HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId, curHeroData.lv, curHeroData.star, curHeroData.breakId, + curHeroData.upStarId, true) + this:UpdatePanelData() --刷新界面 end --扣除升星 消耗的材料 更新英雄数据 function this:DeleteUpStarMaterials() - HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId,curHeroData.lv,curHeroData.star+1,curHeroData.breakId,upStarRankUpConfig.Id,true) + HeroManager.UpdateSingleHeroDatas(curHeroData.dynamicId, curHeroData.lv, curHeroData.star + 1, curHeroData.breakId, + upStarRankUpConfig.Id, true) HeroManager.UpdateSingleHeroSkillData(curHeroData.dynamicId) for i, v in pairs(heroDatas) do if curHeroData == v then @@ -1940,19 +1996,19 @@ function this:DeleteUpStarMaterials() else heroDatas = HeroManager.GetAllHeroDatas() end - if UIManager.IsOpen(UIName.RoleInfoPanel) then--当界面存在时需要刷新当前界面 + if UIManager.IsOpen(UIName.RoleInfoPanel) then --当界面存在时需要刷新当前界面 this:SortHeroDatas(heroDatas) if this.leftLiveObj and leftHeroData then - UnLoadHerolive(leftHeroData.heroConfig,this.leftLiveObj) + UnLoadHerolive(leftHeroData.heroConfig, this.leftLiveObj) this.leftLiveObj = nil end if this.rightLiveObj and rightHeroData then - UnLoadHerolive(rightHeroData.heroConfig,this.rightLiveObj) + UnLoadHerolive(rightHeroData.heroConfig, this.rightLiveObj) this.rightLiveObj = nil end if this.curLiveObj and curHeroData then - UnLoadHerolive(curHeroData.heroConfig,this.curLiveObj) + UnLoadHerolive(curHeroData.heroConfig, this.curLiveObj) this.curLiveObj = nil end Util.ClearChild(this.curObj.transform) @@ -1966,9 +2022,9 @@ function this:DeleteUpStarMaterials() end this:UpdateLiveList() - this.leftLiveObj = LoadHerolive(leftHeroData.heroConfig,this.leftObj) - this.rightLiveObj = LoadHerolive(rightHeroData.heroConfig,this.rightObj) - this.curLiveObj = LoadHerolive(curHeroData.heroConfig,this.curObj) + this.leftLiveObj = LoadHerolive(leftHeroData.heroConfig, this.leftObj) + this.rightLiveObj = LoadHerolive(rightHeroData.heroConfig, this.rightObj) + this.curLiveObj = LoadHerolive(curHeroData.heroConfig, this.curObj) self.dragView:SetDragGO(this.curLiveObj) this:UpdatePanelData() @@ -1980,21 +2036,21 @@ function this:SortHeroDatas(_heroDatas) --上阵最优先,星级优先,同星级等级优先,同星级同等级按sortId排序。排序时降序排序。 table.sort(_heroDatas, function(a, b) if (teamHero[a.dynamicId] and teamHero[b.dynamicId]) or - (not teamHero[a.dynamicId] and not teamHero[b.dynamicId]) + (not teamHero[a.dynamicId] and not teamHero[b.dynamicId]) then - if a.heroConfig.Natural == b.heroConfig.Natural then - if a.star == b.star then - if a.lv == b.lv then - return a.heroConfig.Id < b.heroConfig.Id - else - return a.lv > b.lv - end + if a.heroConfig.Natural == b.heroConfig.Natural then + if a.star == b.star then + if a.lv == b.lv then + return a.heroConfig.Id < b.heroConfig.Id else - return a.star > b.star + return a.lv > b.lv end else - return a.heroConfig.Natural > b.heroConfig.Natural + return a.star > b.star end + else + return a.heroConfig.Natural > b.heroConfig.Natural + end else return teamHero[a.dynamicId] and not teamHero[b.dynamicId] end @@ -2012,7 +2068,7 @@ function this.ThreadShowProAddVal() this.priThread = nil end table.walk(lvUpShowProList, function(privilegeItem) - this.SetActive(privilegeItem,false) + this.SetActive(privilegeItem, false) end) this.priThread = coroutine.start(function() for i = 1, 4 do @@ -2029,20 +2085,20 @@ end --跳转显示新手提示圈 --1 升级突破 2 进阶 function this.ShowGuideGo(type) if type == 1 then - JumpManager.ShowGuide(UIName.RoleInfoPanel,this.upLvBtn) + JumpManager.ShowGuide(UIName.RoleInfoPanel, this.upLvBtn) elseif type == 2 then --local btn = Util.GetGameObject(this.upStarGrid.transform, "upStarPre3") - JumpManager.ShowGuide(UIName.RoleInfoPanel,this.upClassBtn) + JumpManager.ShowGuide(UIName.RoleInfoPanel, this.upClassBtn) - -- 我要变强跳转过来显示小手 + -- 我要变强跳转过来显示小手 elseif type == -1 then - JumpManager.ShowGuide(UIName.RoleInfoPanel,this.upLvBtn) + JumpManager.ShowGuide(UIName.RoleInfoPanel, this.upLvBtn) elseif type == -2 then - JumpManager.ShowGuide(UIName.RoleInfoPanel,this.equipBtn) + JumpManager.ShowGuide(UIName.RoleInfoPanel, this.equipBtn) elseif type == -3 then - JumpManager.ShowGuide(UIName.RoleInfoPanel,this.soulPrintBtn) + JumpManager.ShowGuide(UIName.RoleInfoPanel, this.soulPrintBtn) elseif type == -4 then - JumpManager.ShowGuide(UIName.RoleInfoPanel,this.talismanClick) + JumpManager.ShowGuide(UIName.RoleInfoPanel, this.talismanClick) end end @@ -2066,7 +2122,7 @@ function this.ShowHeroEquip() local sData = curHeroData.planList[i] local bData = CombatPlanManager.GetPlanData(sData.planId) - curPlanDatas[sData.position + 4] = {sData = sData, bData = bData} + curPlanDatas[sData.position + 4] = { sData = sData, bData = bData } end for i = 1, this.equipInfo.transform.childCount do @@ -2086,7 +2142,7 @@ function this.ShowHeroEquip() local nowAddLevel = this.ShowAddLevel(i) if nowAddLevel > 0 then addLv.gameObject:SetActive(true) - addLv.sprite = Util.LoadSprite(SpriteName..nowAddLevel) + addLv.sprite = Util.LoadSprite(SpriteName .. nowAddLevel) else addLv.gameObject:SetActive(false) end @@ -2094,7 +2150,7 @@ function this.ShowHeroEquip() effectList[i] = effect if curHeroEquipDatas[i] then this.SetActive(item.gameObject, true) - this.SetActive(pro,false) + this.SetActive(pro, false) icon.sprite = Util.LoadSprite(curHeroEquipDatas[i].icon) item.sprite = Util.LoadSprite(curHeroEquipDatas[i].frame) @@ -2106,7 +2162,7 @@ function this.ShowHeroEquip() elseif curPlanDatas[i] then this.SetActive(item.gameObject, true) this.SetActive(mask, false) - this.SetActive(pro,false) + this.SetActive(pro, false) local config = G_CombatPlanConfig[curPlanDatas[i].bData.combatPlanId] if config.Quality ~= 6 then item.sprite = Util.LoadSprite(GetQuantityImageByquality(config.Quality + 1)) @@ -2142,7 +2198,7 @@ function this.ShowHeroEquip() elseif curPlanDatas[i] then UIManager.OpenPanel(UIName.CombatPlanTipsPopup, 1, this, curPlanDatas[i], curHeroData) elseif totemItem[i] then - UIManager.OpenPanel(UIName.ToTemUpLvPopup, curHeroData.totemId,curHeroData) + UIManager.OpenPanel(UIName.ToTemUpLvPopup, curHeroData.totemId, curHeroData) end end) end @@ -2173,22 +2229,26 @@ function this.ShowHeroEquip() this.SetActive(this.btnEquipRedPoint, false) end if isHaveBatter then - this.EquipAll:GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont("X1_yingxiongxiangqing_kuaisuzhuangbei")) - this.EquipAll:GetComponent("RectTransform").sizeDelta = Vector2.New(660,253) + this.EquipAll:GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont( + "X1_yingxiongxiangqing_kuaisuzhuangbei")) + this.EquipAll:GetComponent("RectTransform").sizeDelta = Vector2.New(660, 253) Util.AddOnceClick(this.EquipAll, function() this:AllEquipUp() end) else if isHave then - this.EquipAll:GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont("X1_yingxiongxiangqing_kuaisuzhuangbei")) - this.EquipAll:GetComponent("RectTransform").sizeDelta = Vector2.New(660,253) + this.EquipAll:GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont( + "X1_yingxiongxiangqing_kuaisuzhuangbei")) + this.EquipAll:GetComponent("RectTransform").sizeDelta = Vector2.New(660, 253) Util.AddOnceClick(this.EquipAll, function() this:AllEquipDown() end) else if isNull then - this.EquipAll:GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont("X1_yingxiongxiangqing_yijianxiexia")) - this.EquipAll:GetComponent("RectTransform").sizeDelta = Vector2.New(332,124) + this.EquipAll:GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont( + "X1_yingxiongxiangqing_yijianxiexia")) + this.EquipAll:GetComponent("RectTransform").sizeDelta = Vector2.New(332, 124) Util.AddOnceClick(this.EquipAll, function() this:AllEquipDown() end) else - this.EquipAll:GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont("X1_yingxiongxiangqing_kuaisuzhuangbei")) - this.EquipAll:GetComponent("RectTransform").sizeDelta = Vector2.New(660,253) + this.EquipAll:GetComponent("Image").sprite = Util.LoadSprite(GetPictureFont( + "X1_yingxiongxiangqing_kuaisuzhuangbei")) + this.EquipAll:GetComponent("RectTransform").sizeDelta = Vector2.New(660, 253) Util.AddOnceClick(this.EquipAll, function() PopupTipPanel.ShowTipByLanguageId(23122) end) end end @@ -2200,13 +2260,13 @@ end -- 刷新戒指栏位 function this.RefreshPlanSlot() for i = 5, 6 do - local equip = Util.GetGameObject(this.gameObject, "roleEquipLayout/equipInfo/equip"..i) + local equip = Util.GetGameObject(this.gameObject, "roleEquipLayout/equipInfo/equip" .. i) local lock = Util.GetGameObject(equip, "lock") local text = Util.GetGameObject(equip, "text"):GetComponent("Text") local mask = Util.GetGameObject(equip, "mask") local add = Util.GetGameObject(equip, "add") - local isOpen, txt = this:checkUnlockCombatPlan(i-4) + local isOpen, txt = this:checkUnlockCombatPlan(i - 4) if not isOpen then text.text = txt this.SetActive(lock, true) @@ -2222,13 +2282,13 @@ end function this.RefreshNewEquipState() local limit = string.split(SpecialConfig[157].Value, "#") for i = 7, 8 do - local equip = Util.GetGameObject(this.gameObject, "roleEquipLayout/equipInfo/equip"..i) + local equip = Util.GetGameObject(this.gameObject, "roleEquipLayout/equipInfo/equip" .. i) local mask = Util.GetGameObject(equip, "mask") local lock = Util.GetGameObject(equip, "lock") local add = Util.GetGameObject(equip, "add") -- local text = Util.GetGameObject(equip, "text"):GetComponent("Text") - if curHeroData.star >= tonumber(limit[i-6]) then + if curHeroData.star >= tonumber(limit[i - 6]) then this.SetActive(equip, true) -- text.text = "" add:SetActive(true) @@ -2253,8 +2313,8 @@ end function this.UpdateEquipPosHeroData(_equipOrTreasure, _type, _selectEquipDataList, _oldSelectEquip, position) --type 1.穿单件装备 2.卸单件装备 3.替换单件装备 4.一键穿装备 5.一键脱装备 if _type == 1 then - this.SetActive(effectList[position],false) - this.SetActive(effectList[position],true) + this.SetActive(effectList[position], false) + this.SetActive(effectList[position], true) if _equipOrTreasure == 1 then curSelectEquipData = _selectEquipDataList[1] --装备绑英雄 @@ -2276,7 +2336,7 @@ function this.UpdateEquipPosHeroData(_equipOrTreasure, _type, _selectEquipDataLi for i = 1, #curHeroData.planList do table.insert(oldPlanList, curHeroData.planList[i]) end - table.insert(oldPlanList, {planId = planDid, position = position - 4})--< 后端的第三个参数confPlanId不用 + table.insert(oldPlanList, { planId = planDid, position = position - 4 }) --< 后端的第三个参数confPlanId不用 curHeroData.planList = oldPlanList -- plan+英雄id CombatPlanManager.UpPlanData(curHeroData.dynamicId, planDid) @@ -2315,8 +2375,8 @@ function this.UpdateEquipPosHeroData(_equipOrTreasure, _type, _selectEquipDataLi CombatPlanManager.DownPlanData(curHeroData.dynamicId, planDid) end elseif _type == 3 then - this.SetActive(effectList[position],false) - this.SetActive(effectList[position],true) + this.SetActive(effectList[position], false) + this.SetActive(effectList[position], true) if _equipOrTreasure == 1 then curSelectEquipData = _selectEquipDataList[1] EquipManager.SetEquipUpHeroDid(curSelectEquipData.id, curHeroData.dynamicId) @@ -2329,8 +2389,8 @@ function this.UpdateEquipPosHeroData(_equipOrTreasure, _type, _selectEquipDataLi for i = 1, #curHeroData.equipIdList do if tonumber(curHeroData.equipIdList[i]) == - tonumber(curHeroEquipDatas[position].id) - then + tonumber(curHeroEquipDatas[position].id) + then curHeroData.equipIdList[i] = curSelectEquipData.id break end @@ -2450,12 +2510,12 @@ function this:CheckEquipHaveWear() return true end for i = 1, 8 do - if curHeroEquipDatas[i] == nil then--槽位为空或者有更好装备时 + if curHeroEquipDatas[i] == nil then --槽位为空或者有更好装备时 local curPosEquip = BagManager.GetEquipDataByEquipPosition(curHeroData.heroConfig.Profession, i) if curPosEquip and #curPosEquip > 0 then if i == 7 or i == 8 then local limit = string.split(SpecialConfig[157].Value, "#") - if curHeroData.star >= tonumber(limit[i-6]) then + if curHeroData.star >= tonumber(limit[i - 6]) then isCanWear = true return true end @@ -2468,7 +2528,7 @@ function this:CheckEquipHaveWear() isNull = true end end -----------------------------------------------戒指红点start------------------ + ----------------------------------------------戒指红点start------------------ --红点显示的条件 -- 1.解锁了但是没有装备 -- 2.有更好的戒指 @@ -2493,8 +2553,8 @@ function this:CheckEquipHaveWear() -- end -- end - - + + -- --初始化获得背包所有的戒指,索引从5开始,因为装备是1234,方便区别 -- curRingsData = {} -- for i = 1, #curHeroData.planList do @@ -2523,7 +2583,7 @@ function this:CheckEquipHaveWear() -- Log('全部未装备戒指的评价:' .. CombatPlanManager.CalPlanPowerByProperty(allRingsData[i].property)) -- end - + -- --获取当前穿戴戒指的评分 -- if curRingsData[5] ~= nil then -- Log("1号戒指的评价是:".. CombatPlanManager.CalPlanPowerByProperty(curRingsData[5].bData.property)) @@ -2544,7 +2604,7 @@ function this:CheckEquipHaveWear() -- HeroManager.GetRingsIsShowRedPoint(curHeroData) -------------------------------------------------戒指红点end--- - + return false, isCanWear, isNull end @@ -2584,7 +2644,7 @@ function this:IsEquipUp() if addPower > indexMaxPower then if i == 7 or i == 8 then local limit = string.split(SpecialConfig[157].Value, "#") - if curHeroData.star >= tonumber(limit[i-6]) then + if curHeroData.star >= tonumber(limit[i - 6]) then return true end else @@ -2610,18 +2670,18 @@ function this:RefreshEquipRedPoint() local hasBetterRings, betterRingsState = HeroManager.GetRingsIsShowRedPoint(curHeroData) for i = 1, 8 do if i == 5 or i == 6 then - local equip = Util.GetGameObject(this.gameObject, "roleEquipLayout/equipInfo/equip"..i) + local equip = Util.GetGameObject(this.gameObject, "roleEquipLayout/equipInfo/equip" .. i) local redpoint = Util.GetGameObject(equip, "redPoint") if betterRingsState ~= nil and betterRingsState ~= nil then - this.SetActive(redpoint, betterRingsState["Rings"..i-4]) + this.SetActive(redpoint, betterRingsState["Rings" .. i - 4]) else - this.SetActive(Util.GetGameObject(redpoint, "redPoint"),false) + this.SetActive(Util.GetGameObject(redpoint, "redPoint"), false) end else local state = not isLink if i == 7 or i == 8 then local limit = string.split(SpecialConfig[157].Value, "#") - state = curHeroData.star >= tonumber(limit[i-6]) + state = curHeroData.star >= tonumber(limit[i - 6]) end this.SetActive(this.equipRedPoint[i], false) local curPosEquip = BagManager.GetEquipDataByEquipPosition(curHeroData.heroConfig.Profession, i) @@ -2672,7 +2732,7 @@ function this:AllEquipUp() else if i == 7 or i == 8 then local limit = string.split(SpecialConfig[157].Value, "#") - if curHeroData.star >= tonumber(limit[i-6]) then + if curHeroData.star >= tonumber(limit[i - 6]) then curPosEquip = BagManager.GetEquipDataByEquipPosition(curHeroData.heroConfig.Profession, i) end else @@ -2724,7 +2784,7 @@ function this:AllEquipUp() end end) else - if not allEquipIds or #allEquipIds < 1 then + if not allEquipIds or #allEquipIds < 1 then PopupTipPanel.ShowTipByLanguageId(11826) else PopupTipPanel.ShowTipByLanguageId(11827) @@ -2760,30 +2820,30 @@ function this.UpdateHeroMedalData() local suitRes = {} suitRes = MedalManager.SuitHeroSuitActive(WearmedalListWear) - HeroManager.SetHeroSuitAtive(curHeroData.dynamicId,suitRes) + HeroManager.SetHeroSuitAtive(curHeroData.dynamicId, suitRes) local suitActiveList = HeroManager.GetHeroSuitActive(curHeroData.dynamicId) --套装激活文字显示 - this.SetActive(this.noSuit,false) - this.SetActive(this.suit1,true) - this.SetActive(this.suit2,true) + this.SetActive(this.noSuit, false) + this.SetActive(this.suit1, true) + this.SetActive(this.suit2, true) if LengthOfTable(suitActiveList) > 0 then - for i = 1,LengthOfTable(suitActiveList)do + for i = 1, LengthOfTable(suitActiveList) do local data = suitActiveList[i] - local suit = Util.GetGameObject(this.roleChipLayout,"suit"..i) - Util.SetGray(suit,false) - RoleInfoPanel.ShowSuitActive(suit,data,true) + local suit = Util.GetGameObject(this.roleChipLayout, "suit" .. i) + Util.SetGray(suit, false) + RoleInfoPanel.ShowSuitActive(suit, data, true) end if LengthOfTable(suitActiveList) == 1 then - Util.SetGray(this.suit2,true) - RoleInfoPanel.ShowSuitActive(this.suit2,{num = 4,suitId = suitActiveList[1].suitId},false) + Util.SetGray(this.suit2, true) + RoleInfoPanel.ShowSuitActive(this.suit2, { num = 4, suitId = suitActiveList[1].suitId }, false) end else --身上有无芯片 if LengthOfTable(WearmedalListWear) >= 1 then local data = {} - for k,v in pairs(WearmedalListWear) do + for k, v in pairs(WearmedalListWear) do while true do if v ~= nil then data = v @@ -2793,43 +2853,45 @@ function this.UpdateHeroMedalData() end end --显示最小芯片 - for i = 1,2 do - local suit = Util.GetGameObject(this.roleChipLayout,"suit"..i) - local num = {2,4} - Util.SetGray(suit,true) - RoleInfoPanel.ShowSuitActive(suit,{num = num[i],suitId = data.suitId},false) + for i = 1, 2 do + local suit = Util.GetGameObject(this.roleChipLayout, "suit" .. i) + local num = { 2, 4 } + Util.SetGray(suit, true) + RoleInfoPanel.ShowSuitActive(suit, { num = num[i], suitId = data.suitId }, false) end else - this.SetActive(this.noSuit,true) - this.SetActive(this.suit1,false) - this.SetActive(this.suit2,false) + this.SetActive(this.noSuit, true) + this.SetActive(this.suit1, false) + this.SetActive(this.suit2, false) end end --芯片展示 for i = 1, 4 do local chipItem = this.chipList[i] - local chipBtn = Util.GetGameObject(chipItem,"chipBtn") - local noChip = Util.GetGameObject(chipItem,"noChip") - local frame = Util.GetGameObject(chipItem,"haveChip") - local icon = Util.GetGameObject(chipItem,"haveChip/chip") + local chipBtn = Util.GetGameObject(chipItem, "chipBtn") + local noChip = Util.GetGameObject(chipItem, "noChip") + local frame = Util.GetGameObject(chipItem, "haveChip") + local icon = Util.GetGameObject(chipItem, "haveChip/chip") -- local text = Util.GetGameObject(chipItem,"name") - local star = Util.GetGameObject(chipItem,"star") + local star = Util.GetGameObject(chipItem, "star") if WearmedalListWear[i] then - this.SetActive(noChip,false) - this.SetActive(frame,true) - frame:GetComponent("Image").sprite = Util.LoadSprite(GetQuantityImageByquality(WearmedalListWear[i].medalConfig.Quality)) + this.SetActive(noChip, false) + this.SetActive(frame, true) + frame:GetComponent("Image").sprite = Util.LoadSprite(GetQuantityImageByquality(WearmedalListWear[i] + .medalConfig.Quality)) icon:GetComponent("Image").sprite = Util.LoadSprite(WearmedalListWear[i].icon) - SetHeroStars(star,WearmedalListWear[i].medalConfig.Star) + SetHeroStars(star, WearmedalListWear[i].medalConfig.Star) else - this.SetActive(noChip,true) - this.SetActive(frame,false) + this.SetActive(noChip, true) + this.SetActive(frame, false) end Util.AddOnceClick(chipBtn, function() if WearmedalListWear[i] then - UIManager.OpenPanel(UIName.MedalParticularsPopup,WearmedalListWear[i],i,true,curHeroData.dynamicId,true,true)--data勋章 槽位ID 是否穿戴在英雄身上 英雄id + UIManager.OpenPanel(UIName.MedalParticularsPopup, WearmedalListWear[i], i, true, curHeroData.dynamicId, + true, true) --data勋章 槽位ID 是否穿戴在英雄身上 英雄id else - UIManager.OpenPanel(UIName.MedalChangelPopup,i,curHeroData.dynamicId)--槽位id 英雄ID + UIManager.OpenPanel(UIName.MedalChangelPopup, i, curHeroData.dynamicId) --槽位id 英雄ID end end) end @@ -2840,48 +2902,50 @@ end --刷新芯片红点 function this:RefreshChipRedPoint() for i = 1, 4 do - this.SetActive(this.chipRedpointList[i],false) - local shipList = MedalManager.MedalDaraBySite(i,curHeroData.dynamicId) + this.SetActive(this.chipRedpointList[i], false) + local shipList = MedalManager.MedalDaraBySite(i, curHeroData.dynamicId) if #shipList > 0 then - if Util.GetGameObject(this.chipList[i],"noChip").activeSelf then - this.SetActive(this.chipRedpointList[i],true) + if Util.GetGameObject(this.chipList[i], "noChip").activeSelf then + this.SetActive(this.chipRedpointList[i], true) end end end end -function this.ShowSuitActive(suit,data,isActive) - local activation = Util.GetGameObject(suit,"activation/Image") - local name = Util.GetGameObject(suit,"suitName") - local num = Util.GetGameObject(suit,"suitName/suitNum") - local star = Util.GetGameObject(suit,"suitLv/lv") - local icon = Util.GetGameObject(suit,"pro/icon") - local proName = Util.GetGameObject(suit,"pro/pro") - local value = Util.GetGameObject(suit,"pro/num") +function this.ShowSuitActive(suit, data, isActive) + local activation = Util.GetGameObject(suit, "activation/Image") + local name = Util.GetGameObject(suit, "suitName") + local num = Util.GetGameObject(suit, "suitName/suitNum") + local star = Util.GetGameObject(suit, "suitLv/lv") + local icon = Util.GetGameObject(suit, "pro/icon") + local proName = Util.GetGameObject(suit, "pro/pro") + local value = Util.GetGameObject(suit, "pro/num") local medalSuitData = MedalManager.GetMedalSuitInfoById(data.suitId) local suitTypedata = MedalManager.GetMedalSuitInfoByType(medalSuitData.Type) - this.SetActive(activation,isActive) - Util.SetGray(activation,not isActive) + this.SetActive(activation, isActive) + Util.SetGray(activation, not isActive) name:GetComponent("Text").text = GetLanguageStrById(suitTypedata.Name) - num:GetComponent("Text").text = string.format("(%s/4)",data.num) + num:GetComponent("Text").text = string.format("(%s/4)", data.num) star:GetComponent("Text").text = string.format(GetLanguageStrById(23121), medalSuitData.Star) - for k,v in pairs(medalSuitData.SuitAttr)do + for k, v in pairs(medalSuitData.SuitAttr) do if v[1] == data.num then if v[2] == 8888 then - local PassiveSkillConfigData = ConfigManager.GetConfigDataByKey(ConfigName.PassiveSkillConfig, "Id", v[3]) + local PassiveSkillConfigData = ConfigManager.GetConfigDataByKey(ConfigName.PassiveSkillConfig, "Id", v + [3]) icon.transform.localScale = Vector3.one * 0.7 -- icon:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(PassiveSkillConfigData.Icon)) - proName:GetComponent("Text").text = string.format(GetLanguageStrById(23148), GetLanguageStrById(PassiveSkillConfigData.Name)) + proName:GetComponent("Text").text = string.format(GetLanguageStrById(23148), + GetLanguageStrById(PassiveSkillConfigData.Name)) value:GetComponent("Text").text = "" else icon.transform.localScale = Vector3.one - local PropertyConfigData = ConfigManager.GetConfigDataByKey(ConfigName.PropertyConfig, "PropertyId", v[2]) + local PropertyConfigData = ConfigManager.GetConfigDataByKey(ConfigName.PropertyConfig, "PropertyId", v + [2]) -- icon:GetComponent("Image").sprite = Util.LoadSprite(PropertyConfigData.Icon) proName:GetComponent("Text").text = GetLanguageStrById(PropertyConfigData.Info) - value:GetComponent("Text").text = "+" .. GetPropertyFormatStr(PropertyConfigData.Style,v[3]) - + value:GetComponent("Text").text = "+" .. GetPropertyFormatStr(PropertyConfigData.Style, v[3]) end end end @@ -2890,13 +2954,12 @@ end --检测英雄重铸是否开启 function this:checkUnlockEquipCastGod() local specialConfig = ConfigManager.GetConfigDataByKey(ConfigName.SpecialConfig, "Key", "AdjustUnlockStar") - if curHeroData.star >= tonumber(specialConfig.Value) then - return true + if curHeroData.star >= tonumber(specialConfig.Value) then + return true end return false end - --检测戒指是否开启 function this:checkUnlockCombatPlan(slot) local s_type = 0 @@ -2907,7 +2970,7 @@ function this:checkUnlockCombatPlan(slot) s_type = a[2] s_value = a[3] if tonumber(s_type) == 1 then - return curHeroData.lv >= tonumber(s_value), s_value .. GetLanguageStrById(10062) + return curHeroData.lv >= tonumber(s_value), string.format(GetLanguageStrById(10062), s_value) elseif tonumber(s_type) == 2 then return curHeroData.star >= tonumber(s_value), s_value .. GetLanguageStrById(10488) end @@ -2919,7 +2982,7 @@ end function this.HideAllLayout() local layoutCount = this.layout.transform.childCount for i = 0, layoutCount - 1 do - this.SetActive(this.layout.transform:GetChild(i).gameObject,false) + this.SetActive(this.layout.transform:GetChild(i).gameObject, false) end end @@ -2927,77 +2990,79 @@ end function this:SetSelectBtn(_btn) local btnListCount = self.btnList.transform.childCount for i = 0, btnListCount - 1 do - Util.GetGameObject(this.btnList.transform:GetChild(i),"bg"):GetComponent("Image").sprite = Util.LoadSprite("X1_tongyong_fenlan_weixuanzhong_02") - this.SetActive(Util.GetGameObject(this.btnList.transform:GetChild(i),"title"),false) - this.SetActive(Util.GetGameObject(this.btnList.transform:GetChild(i),"name"),false) - this.SetActive(Util.GetGameObject(this.btnList.transform:GetChild(i),"name2"),true) + Util.GetGameObject(this.btnList.transform:GetChild(i), "bg"):GetComponent("Image").sprite = Util.LoadSprite( + "X1_tongyong_fenlan_weixuanzhong_02") + this.SetActive(Util.GetGameObject(this.btnList.transform:GetChild(i), "title"), false) + this.SetActive(Util.GetGameObject(this.btnList.transform:GetChild(i), "name"), false) + this.SetActive(Util.GetGameObject(this.btnList.transform:GetChild(i), "name2"), true) end - Util.GetGameObject(_btn,"bg"):GetComponent("Image").sprite = Util.LoadSprite("X1_tongyong_fenlan_yixuanzhong_02") - this.SetActive(Util.GetGameObject(_btn,"title"),true) - this.SetActive(Util.GetGameObject(_btn,"name"),true) - this.SetActive(Util.GetGameObject(_btn,"name2"),false) + Util.GetGameObject(_btn, "bg"):GetComponent("Image").sprite = Util.LoadSprite("X1_tongyong_fenlan_yixuanzhong_02") + this.SetActive(Util.GetGameObject(_btn, "title"), true) + this.SetActive(Util.GetGameObject(_btn, "name"), true) + this.SetActive(Util.GetGameObject(_btn, "name2"), false) if this.isFirstOpen then this.isFirstOpen = false else - this.leftBtn.transform.position = Util.GetGameObject(_btn,"leftBtnPos").transform.position - this.rightBtn.transform.position = Util.GetGameObject(_btn,"rightBtnPos").transform.position + this.leftBtn.transform.position = Util.GetGameObject(_btn, "leftBtnPos").transform.position + this.rightBtn.transform.position = Util.GetGameObject(_btn, "rightBtnPos").transform.position end end function this:SelectBtn(_btn) - local selectBtnPos = Vector3.New(6,6.3,0) - this.btnSelect.transform:SetParent(Util.GetGameObject(_btn,"target").transform) + local selectBtnPos = Vector3.New(6, 6.3, 0) + this.btnSelect.transform:SetParent(Util.GetGameObject(_btn, "target").transform) this.btnSelect.transform.localPosition = selectBtnPos - Util.GetGameObject(this.btnSelect,"Text"):GetComponent("Text").text = Util.GetGameObject(_btn,"Text"):GetComponent("Text").text + Util.GetGameObject(this.btnSelect, "Text"):GetComponent("Text").text = Util.GetGameObject(_btn, "Text"):GetComponent( + "Text").text end function this.OnClick(type) this.HideAllLayout() if type == btnType.Info then - this.SetActive(this.roleInfoLayout,true) + this.SetActive(this.roleInfoLayout, true) this:SetSelectBtn(this.btnInfo) this.MoveLive(-150) liveDeviation = -1 elseif type == btnType.Equip then - this.SetActive(this.roleEquipLayout,true) + this.SetActive(this.roleEquipLayout, true) this:SetSelectBtn(this.btnEquip) this.MoveLive(0) liveDeviation = 0 elseif type == btnType.Culture then - this.SetActive(this.roleUpStarLayout,true) - this.SetActive(this.btnCultureBtnList,true) + this.SetActive(this.roleUpStarLayout, true) + this.SetActive(this.btnCultureBtnList, true) this:SetSelectBtn(this.btnCulture) this.MoveLive(150) liveDeviation = 1 this:UpdateHeroUpStarProUpShow() this:SelectBtn(this.btnUpStar) elseif type == btnType.UpStar then - this.SetActive(this.btnCultureBtnList,true) - this.SetActive(this.roleUpStarLayout,true) + this.SetActive(this.btnCultureBtnList, true) + this.SetActive(this.roleUpStarLayout, true) this:SelectBtn(this.btnUpStar) this.MoveLive(150) liveDeviation = 1 elseif type == btnType.Ability then - this.SetActive(this.btnCultureBtnList,true) - this.SetActive(this.roleAbilityLayout,true) + this.SetActive(this.btnCultureBtnList, true) + this.SetActive(this.roleAbilityLayout, true) this:SelectBtn(this.btnAbility) this:AbilityUpdateUI() this.MoveLive(150) liveDeviation = 1 elseif type == btnType.Chip then - this.SetActive(this.btnCultureBtnList,true) - this.SetActive(this.roleChipLayout,true) + this.SetActive(this.btnCultureBtnList, true) + this.SetActive(this.roleChipLayout, true) this:SelectBtn(this.btnChip) this.MoveLive(150) liveDeviation = 1 elseif type == btnType.Overclock then - this.SetActive(this.btnCultureBtnList,true) + this.SetActive(this.btnCultureBtnList, true) this:SelectBtn(this.btnOverclock) this.MoveLive(150) liveDeviation = 1 elseif type == btnType.FlagArr then - this.SetActive(this.btnCultureBtnList,true) + this.SetActive(this.btnCultureBtnList, true) this:SelectBtn(this.btnFlagArr) this.MoveLive(150) liveDeviation = 1 @@ -3049,17 +3114,17 @@ function this:AbilityUpdateUI() if isOpen then -- isOpen local isOn = false local warWaySlotId = curHeroData[string.format("warWaySlot%dId", i)] - LogRed("sssssssssssssssssssssssssssssssss"..warWaySlotId) + LogRed("sssssssssssssssssssssssssssssssss" .. warWaySlotId) if warWaySlotId and warWaySlotId ~= 0 then isOn = true end if isOn then --如果检测到已经学习了能力那么就关闭红点 - this.SetActive(add,false) + this.SetActive(add, false) --this.SetActive(redPoint,false) - this.SetActive(redPoint, abilityPointStateRes["ability".. tostring(i)]) + this.SetActive(redPoint, abilityPointStateRes["ability" .. tostring(i)]) name.text = "" - this.SetActive(icon,true) + this.SetActive(icon, true) Util.AddOnceClick(frame, function() UIManager.OpenPanel(UIName.WarWayLevelUpPopup, curHeroData, i, warWaySlotId) end) @@ -3072,42 +3137,42 @@ function this:AbilityUpdateUI() name.text = "" --解锁了能力但是没有学习能力,加号和红点都显示 --this.SetActive(redPoint,HeroManager.GetCurHeroAbilityIsShowRedPoint(curHeroData)) - abilityPointStateRes["ability".. tostring(i)] = HeroManager.IsCompetencySkills(i) - - this.SetActive(add,true) - this.SetActive(icon,false) + abilityPointStateRes["ability" .. tostring(i)] = HeroManager.IsCompetencySkills(i) + + this.SetActive(add, true) + this.SetActive(icon, false) Util.AddOnceClick(frame, function() UIManager.OpenPanel(UIName.WarWayComprehendPopup, curHeroData, i) end) frame:GetComponent("Image").sprite = Util.LoadSprite(GetQuantityImageByquality(0)) end - this.SetActive(lock,false) + this.SetActive(lock, false) btn.enabled = true else --角色星级不够,开启锁图标,关闭红点和加号还有锁图标 - this.SetActive(lock,true) - this.SetActive(add,false) - this.SetActive(icon,false) + this.SetActive(lock, true) + this.SetActive(add, false) + this.SetActive(icon, false) -- btn.enabled = false - + -- local str -- if limit[i].type == 1 then -- str = limit[i].limit..GetLanguageStrById(50508) -- else -- str = limit[i].limit..GetLanguageStrById(50509) -- end - local str = limit[i]..GetLanguageStrById(50509) + local str = limit[i] .. GetLanguageStrById(50509) Util.AddOnceClick(frame, function() PopupTipPanel.ShowTip(str) end) name.text = str frame:GetComponent("Image").sprite = Util.LoadSprite(GetQuantityImageByquality(0)) end - this.SetActive(redPoint,abilityPointStateRes["ability".. tostring(i)]) + this.SetActive(redPoint, abilityPointStateRes["ability" .. tostring(i)]) end - local isRedpoint = abilityPointStateRes["ability".. tostring(1)] or abilityPointStateRes["ability".. tostring(2)] - this.SetActive(this.btnAbilityRedPoint,isRedpoint) + local isRedpoint = abilityPointStateRes["ability" .. tostring(1)] or abilityPointStateRes["ability" .. tostring(2)] + this.SetActive(this.btnAbilityRedPoint, isRedpoint) end --拖拽立绘 @@ -3117,9 +3182,11 @@ local distance function this:OnBeginDrag(Pointgo, data) beginV3 = this.curLiveObj.transform.anchoredPosition end + function this:OnDrag(Pointgo, data) - distance = Vector2.Distance(beginV3,this.curLiveObj.transform.anchoredPosition) + distance = Vector2.Distance(beginV3, this.curLiveObj.transform.anchoredPosition) end + function this:OnEndDrag(Pointgo, data) endV3 = this.curLiveObj.transform.anchoredPosition if distance > 250 and endV3.x < 0 then @@ -3129,14 +3196,14 @@ function this:OnEndDrag(Pointgo, data) this:LeftBtnOnClick() this.ShowHeroEquip() else - local tweenEndVer = Vector2.New(curHeroData.position[1],curHeroData.position[2]) + local tweenEndVer = Vector2.New(curHeroData.position[1], curHeroData.position[2]) this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(tweenEndVer, 0.5, false):SetEase(Ease.Linear) end distance = 0 end function this.MoveLive(pos) - local tweenEndVer = Vector2.New(curHeroData.heroConfig.Position[1] + pos,curHeroData.heroConfig.Position[2]) + local tweenEndVer = Vector2.New(curHeroData.heroConfig.Position[1] + pos, curHeroData.heroConfig.Position[2]) this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(tweenEndVer, 0.3, false):SetEase(Ease.Linear) end @@ -3152,30 +3219,30 @@ function this:RightBtnOnClick() curHeroData = heroDatas[index] if this.leftLiveObj then - UnLoadHerolive(leftHeroData.heroConfig,this.leftLiveObj) + UnLoadHerolive(leftHeroData.heroConfig, this.leftLiveObj) Util.ClearChild(this.leftObj.transform) this.leftLiveObj = nil end this.curLiveObj.transform:SetParent(self.leftObj.transform) - local tweenEndVer = Vector2.New(oldIndexConfigData.position[1],oldIndexConfigData.position[2]) + local tweenEndVer = Vector2.New(oldIndexConfigData.position[1], oldIndexConfigData.position[2]) this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(tweenEndVer, 0.5, false):SetEase(Ease.Linear) this.rightLiveObj.transform:SetParent(this.curObj.transform) --立绘偏移动画 local tweenEndRightVer if liveDeviation == 1 then - tweenEndRightVer = Vector2.New(rightHeroData.position[1] + 150,rightHeroData.position[2]) + tweenEndRightVer = Vector2.New(rightHeroData.position[1] + 150, rightHeroData.position[2]) elseif liveDeviation == -1 then - tweenEndRightVer = Vector2.New(rightHeroData.position[1] - 150,rightHeroData.position[2]) + tweenEndRightVer = Vector2.New(rightHeroData.position[1] - 150, rightHeroData.position[2]) else - tweenEndRightVer = Vector2.New(rightHeroData.position[1],rightHeroData.position[2]) + tweenEndRightVer = Vector2.New(rightHeroData.position[1], rightHeroData.position[2]) end - this.rightLiveObj:GetComponent("RectTransform"):DOAnchorPos(tweenEndRightVer, 0.4, false):OnComplete(function () + this.rightLiveObj:GetComponent("RectTransform"):DOAnchorPos(tweenEndRightVer, 0.4, false):OnComplete(function() this:UpdateLiveList() this.leftLiveObj = this.curLiveObj this.curLiveObj = this.rightLiveObj - this.rightLiveObj = LoadHerolive(rightHeroData.heroConfig,self.rightObj) + this.rightLiveObj = LoadHerolive(rightHeroData.heroConfig, self.rightObj) this:UpdatePanelData() this:UpdateHeroUpStarProUpShow() this.rightBtn:GetComponent("Button").enabled = true @@ -3194,29 +3261,29 @@ function this:LeftBtnOnClick() index = (index - 1 > 0 and index - 1 or #heroDatas) curHeroData = heroDatas[index] if this.rightLiveObj then - UnLoadHerolive(rightHeroData.heroConfig,this.rightLiveObj) + UnLoadHerolive(rightHeroData.heroConfig, this.rightLiveObj) Util.ClearChild(this.rightObj.transform) this.rightLiveObj = nil end this.curLiveObj.transform:SetParent(this.rightObj.transform) - local tweenEndVer = Vector2.New(oldIndexConfigData.position[1],oldIndexConfigData.position[2]) + local tweenEndVer = Vector2.New(oldIndexConfigData.position[1], oldIndexConfigData.position[2]) this.curLiveObj:GetComponent("RectTransform"):DOAnchorPos(tweenEndVer, 0.5, false):SetEase(Ease.Linear) this.leftLiveObj.transform:SetParent(this.curObj.transform) - + --立绘偏移动画 local tweenEndLeftVer if liveDeviation == 1 then - tweenEndLeftVer = Vector2.New(leftHeroData.position[1] + 150,leftHeroData.position[2]) + tweenEndLeftVer = Vector2.New(leftHeroData.position[1] + 150, leftHeroData.position[2]) elseif liveDeviation == -1 then - tweenEndLeftVer = Vector2.New(leftHeroData.position[1] - 150,leftHeroData.position[2]) + tweenEndLeftVer = Vector2.New(leftHeroData.position[1] - 150, leftHeroData.position[2]) else - tweenEndLeftVer = Vector2.New(leftHeroData.position[1],leftHeroData.position[2]) + tweenEndLeftVer = Vector2.New(leftHeroData.position[1], leftHeroData.position[2]) end - this.leftLiveObj:GetComponent("RectTransform"):DOAnchorPos(tweenEndLeftVer, 0.4, false):OnComplete(function () + this.leftLiveObj:GetComponent("RectTransform"):DOAnchorPos(tweenEndLeftVer, 0.4, false):OnComplete(function() this:UpdateLiveList() this.rightLiveObj = this.curLiveObj this.curLiveObj = this.leftLiveObj - this.leftLiveObj = LoadHerolive(leftHeroData.heroConfig,self.leftObj) + this.leftLiveObj = LoadHerolive(leftHeroData.heroConfig, self.leftObj) this:UpdatePanelData() this:UpdateHeroUpStarProUpShow() this.leftBtn:GetComponent("Button").enabled = true @@ -3227,14 +3294,13 @@ end --设置显隐 function this.SetActive(go, value) if IsNull(go) then - return + return end if value and not go.activeSelf then go:SetActive(value) elseif not value and go.activeSelf then go:SetActive(value) end - end -- --点击时检测功能 @@ -3265,4 +3331,4 @@ function this.ShowAddLevel(curPos) return AddLevel end -return RoleInfoPanel \ No newline at end of file +return RoleInfoPanel