From b09bf01c544d7c4dd7f8671af03b73d89990cf46 Mon Sep 17 00:00:00 2001 From: guowei Date: Thu, 24 Dec 2020 16:16:53 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E9=B8=BF=E8=92=99=E9=98=B5bug?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Harmony/Manager/HarmonyManager.lua | 22 ++++--- .../~Lua/Modules/Net/IndicationManager.lua | 7 ++- .../~Lua/View/HarmonyView.lua | 58 +++++++++++-------- 3 files changed, 53 insertions(+), 34 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Harmony/Manager/HarmonyManager.lua b/Assets/ManagedResources/~Lua/Modules/Harmony/Manager/HarmonyManager.lua index 575a9dc79a..433fc5ae33 100644 --- a/Assets/ManagedResources/~Lua/Modules/Harmony/Manager/HarmonyManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Harmony/Manager/HarmonyManager.lua @@ -63,7 +63,7 @@ function this.InitHongMengData(hongmengGuards, hongmengHeroInfos, hongmengTablet end -function this:UpdateHongMengData(hongmengGuards,hongmengAdditions) +function this.UpdateHongMengData(hongmengGuards,hongmengAdditions) this.hongmengGuards = hongmengGuards this.hongmengAdditions = hongmengAdditions print("刷新hongmengGuards") @@ -328,11 +328,15 @@ function this:GetAdditions() end function this.GetSingleAdditions(type) - for i = 1, #this.hongmengAdditions do - if this.hongmengAdditions[i].additionType == type then - return this.hongmengAdditions[i].value + if this.hongmengAdditions then + -- body + for i = 1, #this.hongmengAdditions do + if this.hongmengAdditions[i].additionType == type then + return this.hongmengAdditions[i].value + end end end + return 0 end @@ -499,13 +503,17 @@ end function this.RefreshEnvoyPoint() -- body - for i = 1, #this.hongmengGuards do + if this.hongmengTablet >= this.TowerStartLimit then -- body - if this.hongmengGuards[i].heroId ~= "" then + for i = 1, #this.hongmengGuards do -- body - return true + if this.hongmengGuards[i].heroId == "" then + -- body + return true + end end end + return false end diff --git a/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua b/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua index 0cac2b7f8a..9b5898f174 100644 --- a/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Net/IndicationManager.lua @@ -124,10 +124,13 @@ function this.HongMengIndication(buffer) local msg = HeroInfoProto_pb.HongmengInfoIndication() msg:ParseFromString(data) LogGreen("更新数据") - + if msg.hongmengGuards or msg.hongmengAdditions then -- body - + for i = 1, #msg.hongmengGuards do + -- body + print(HeroManager.GetSingleHeroData(msg.hongmengGuards[i].heroId).name) + end HarmonyManager.UpdateHongMengData(msg.hongmengGuards,msg.hongmengAdditions) end end diff --git a/Assets/ManagedResources/~Lua/View/HarmonyView.lua b/Assets/ManagedResources/~Lua/View/HarmonyView.lua index b4579732c6..d2e1e46386 100644 --- a/Assets/ManagedResources/~Lua/View/HarmonyView.lua +++ b/Assets/ManagedResources/~Lua/View/HarmonyView.lua @@ -56,9 +56,15 @@ function HarmonyView:OnOpen() local heroDataList = {} if HarmonyManager.hongmengGuards and #HarmonyManager.hongmengGuards > 0 then for i = 1, #HarmonyManager.hongmengGuards do - table.insert(heroDataList,HeroManager.GetSingleHeroData(HarmonyManager.hongmengGuards[i].heroId)) + if HarmonyManager.hongmengGuards[i].heroId ~= "" then + -- body + table.insert(heroDataList,HeroManager.GetSingleHeroData(HarmonyManager.hongmengGuards[i].heroId)) + LogGreen("刷新"..i) + end + end end + -- if #heroDataList > 0 then -- table.sort(heroDataList, function(a,b) -- if a.lv==b.lv then @@ -68,6 +74,32 @@ function HarmonyView:OnOpen() -- end -- end) -- end + + + -- self.count = 1; + -- self:SetGreen(self.HongMengData) + --LogGreen(heroDataList[6].name) + + for i = 1, 6 do + local singleHeroData = {} + if heroDataList[i] then + singleHeroData = heroDataList[i] + self.HongMengData[i] = singleHeroData + if heroDataList[i].lv== heroDataList[#heroDataList].lv then + -- body + self:SetItem(self.HongMengData[i],self.GongMingTable[i],1) + else + self:SetItem(self.HongMengData[i],self.GongMingTable[i],0) + end + + + else + self.HongMengData[i] = singleHeroData + self:SetItem(nil,self.GongMingTable[i],0) + end + end + + for i = 1, #self.HongMengData do if self.HongMengData[i] then -- body @@ -81,30 +113,6 @@ function HarmonyView:OnOpen() end end - - -- self.count = 1; - -- self:SetGreen(self.HongMengData) - --LogGreen(heroDataList[6].name) - - for i = 1, 6 do - local singleHeroData = {} - if heroDataList[i] then - singleHeroData = heroDataList[i] - self.HongMengData[i] = singleHeroData - if self.HongMengData[i].lv== heroDataList[#heroDataList].lv then - -- body - self:SetItem(self.HongMengData[i],self.GongMingTable[i],1) - else - self:SetItem(self.HongMengData[i],self.GongMingTable[i],0) - end - - - else - self.HongMengData[i] = singleHeroData - self:SetItem(nil,self.GongMingTable[i],0) - end - end - -- for i = 0, #self.GongMingTable do -- if i == 5 then -- self:SetItem(self.HongMengData[i+1],self.GongMingTable[i],1)