diff --git a/Assets/ManagedResources/Prefabs/UI/Compound/CompoundPanel.prefab b/Assets/ManagedResources/Prefabs/UI/Compound/CompoundPanel.prefab index 644636a0cb..85dbf1854b 100644 --- a/Assets/ManagedResources/Prefabs/UI/Compound/CompoundPanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/Compound/CompoundPanel.prefab @@ -3169,7 +3169,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMax: {x: 0.5, y: 0.5} - m_AnchoredPosition: {x: 259, y: 303} + m_AnchoredPosition: {x: 284, y: 303} m_SizeDelta: {x: 203.89, y: 203.89} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &313656261710327451 diff --git a/Assets/ManagedResources/~Lua/Modules/Harmony/Panel/HongMengEnvoyPanel.lua b/Assets/ManagedResources/~Lua/Modules/Harmony/Panel/HongMengEnvoyPanel.lua index bfdd76a239..83fab8c663 100644 --- a/Assets/ManagedResources/~Lua/Modules/Harmony/Panel/HongMengEnvoyPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Harmony/Panel/HongMengEnvoyPanel.lua @@ -1,14 +1,11 @@ require("Base/BasePanel") HongMengEnvoyPanel = Inherit(BasePanel) - HongMengEnvoyPanel.contents = { [1] = {view = require("Modules/Harmony/View/HarmonyScrllow"), panelName = " HongMengEnvoyPanel"} } HongMengEnvoyPanel.prefab = {} - HongMengEnvoyPanel.EnvoyItemList = {} local Item = require("Modules/Harmony/EnvoyItem/EnvoyItem") - local Gold = 0 local GrowthAmulet = 0 HongMengEnvoyPanel.timerEffect = nil @@ -43,27 +40,17 @@ function HongMengEnvoyPanel:InitComponent() HarmonyManager:SetTowerInit() self:InitEnvoyItemList(ItemPfb, parent) - - end function HongMengEnvoyPanel:InitEnvoyItemList(ItemPfb, parent) for i = 1, #HarmonyManager.hongmengGuards do - -- bodys - self.EnvoyItemList[i] = Item:New(newObject(ItemPfb)) - self.EnvoyItemList[i]:InitComponent(parent, HarmonyManager.hongmengGuards[i]) end for i = 1, #self.contents do self.prefab[i] = Util.GetGameObject(self.panel, self.contents[i].panelName) - self.contents[i].view:InitComponent( - self.panel, - BagManager.GetTotalItemNum(UpViewRechargeType.XuanHuangZhiQi), - BagManager.GetTotalItemNum(UpViewRechargeType.DemonCrystal), - 2 - ) + self.contents[i].view:InitComponent(self.panel,BagManager.GetTotalItemNum(UpViewRechargeType.XuanHuangZhiQi),BagManager.GetTotalItemNum(UpViewRechargeType.DemonCrystal),2) end end --绑定事件(用于子类重写) @@ -94,7 +81,6 @@ function HongMengEnvoyPanel:BindEvent() PopupTipPanel.ShowTip(Language[12201]) else local data = HarmonyManager:GetHongMengUpData() - --print(data.LevelUp[1][2].." "..data.LevelUp[2][2]) if data == nil then return end @@ -137,12 +123,11 @@ function HongMengEnvoyPanel:RunTimerFun() for key, value in pairs(self.EnvoyItemList) do if HarmonyManager.hongmengGuards[key].time - GetTimeStamp() > 0 then if value.Empty.activeSelf == false then - -- body value.Empty:SetActive(true) end local time_content = TimeToFelaxible(HarmonyManager.hongmengGuards[key].time - GetTimeStamp()) value.timer_text.text = string.format(Language[12204], time_content) - else + else if not value.AddImage.activeSelf then value.AddImage:SetActive(true) value.timer_text.text = "" @@ -163,7 +148,6 @@ function HongMengEnvoyPanel:IsUpBtnGray() self.imageGame:SetActive(false) self.TextGame:SetActive(false) self.UnShowText:SetActive(true) - -- self.UpBtnRedPoint:SetActive(false) else Util.SetGray(self.UpBtn, false) self.imageGame:SetActive(true) @@ -174,11 +158,8 @@ function HongMengEnvoyPanel:IsUpBtnGray() CheckRedPointStatus(RedPointType.HongMeng_UpTower) end function HongMengEnvoyPanel:RefeshRedPoint() - -- body - end function HongMengEnvoyPanel:UpdateShow(list) - for i = 1, #list do --LogBlue("执行刷新"..list[i].heroId) self.EnvoyItemList[i]:SetItemData(list[i]) @@ -258,7 +239,6 @@ end --界面打开时调用(用于子类重写) function HongMengEnvoyPanel:OnOpen(equipSId) --NetManager.PlayerInfoRequest(LoadingPanel.OnStep) - for i = 1, #self.EnvoyItemList do self.EnvoyItemList[i]:OnOpen() end diff --git a/Assets/ManagedResources/~Lua/Modules/Harmony/View/HarmonyScrllow.lua b/Assets/ManagedResources/~Lua/Modules/Harmony/View/HarmonyScrllow.lua index d530588f89..7e9245d8ec 100644 --- a/Assets/ManagedResources/~Lua/Modules/Harmony/View/HarmonyScrllow.lua +++ b/Assets/ManagedResources/~Lua/Modules/Harmony/View/HarmonyScrllow.lua @@ -1,16 +1,10 @@ local this={} - this.tab=ConfigManager.GetConfig(ConfigName.Hongmeng) - - - local Gold =0; local DemonCrystal = 0 local HeroList = {} - local tempData = nil local TempItem = nil - local ItemList = {} local Box = 0 local OpenBox = 0 @@ -21,146 +15,85 @@ function this:AwakeLength() HeroCount = 0 Box = #HarmonyManager.hongmengHeroInfos; OpenBox = #HarmonyManager.hongmengHeroInfos+2 - --print(Box.."@@@@@@@@@"..OpenBox) for i = 1, #HarmonyManager.hongmengHeroInfos do - -- body if HarmonyManager.hongmengHeroInfos[i].heroId~="" then - -- body HeroCount = HeroCount + 1 end end - if self.stage == 1 then - -- body this.NumText.text = string.format("%d/%d",HeroCount,Box) - else - local count = 0 for i = 1, #HarmonyManager.hongmengGuards do - -- body if HarmonyManager.hongmengGuards[i].heroId ~= "" then count = count + 1 - -- body end end - this.NumText.text = string.format("%d/%d",HeroCount + count,Box + #HarmonyManager.hongmengGuards) end - end function this:InitComponent(gameObject,Golds,DemonCrystals,stage) Gold = Golds DemonCrystal = DemonCrystals self.stage = stage - -- item预制件 - this.item = Util.GetGameObject(gameObject , "HarmonyPanel/item") - --btn组件 this.addBtn = Util.GetGameObject(gameObject,"HarmonyPanel/AddBtn") this.GongMingMsgBtn = Util.GetGameObject(gameObject,"HarmonyPanel/KnowGongMing") - this.scrollbar = Util.GetGameObject(gameObject,"HarmonyPanel/Scrollbar"):GetComponent("Scrollbar") local scrollParent = Util.GetGameObject(gameObject, "HarmonyPanel/scroll"):GetComponent("RectTransform").rect - this.NumText = Util.GetGameObject(gameObject,"HarmonyPanel/itemNumText"):GetComponent("Text") - this.ScrollView=SubUIManager.Open(SubUIConfig.ScrollCycleView,Util.GetGameObject(gameObject,"HarmonyPanel/scroll").transform, this.item,this.scrollbar,Vector2.New(-scrollParent.x*2,-scrollParent.y*2),1,5,Vector2.New(42,15)) this.ScrollView.moveTween.MomentumAmount = 1 this.ScrollView.moveTween.Strength = 1 - -- for key, value in ConfigPairs(this.tab) do - -- print("key:",key,"value",value.Id) - -- end - - this.BoxList=0; this:AwakeLength() this:InitBox() - --this.RunTimerFun() end local TextList = {} local BoxList = {} function this:InitBox() - - -- - local keys = GameDataBase.SheetBase.GetKeys(this.tab) --获取数据长度 - this.ScrollView:SetData(keys,function (index, go) local key = keys[index] - this.SingleBoxDataShow(go, this.tab[key], index) - - end,false,false) - --print(LengthOfTable(ItemList)) - - - end function this.RunTimerFun() - local refreshFunc = function() - for key, value in pairs(ItemList) do if value.index <= #HarmonyManager.hongmengHeroInfos then - --value.TimerText.text = "" value.index <= #HarmonyManager.hongmengHeroInfos and - -- print("倒计时开启 .."..#HarmonyManager.hongmengHeroInfos) if value.TimerText ~=nil and value.Empty ~=nil then - -- body if HarmonyManager.hongmengHeroInfos[value.index].time - GetTimeStamp() > 0 then if value.Empty ~=nil then - -- body - --print(value.Empty," ") - -- if value.Empty.activeSelf == false then - -- -- body - -- value.Empty:SetActive(true) - -- end end - local time_content = TimeToFelaxible(HarmonyManager.hongmengHeroInfos[value.index].time - GetTimeStamp()) - --print(" ~~~~~ ",value.TimerText," xxxxx",time_content) value.TimerText.text = string.format(Language[12204],time_content) else - HarmonyManager.hongmengHeroInfos[value.index].time = 0 - if value.TimerText then - -- body value.TimerText.text = "" if not value.AddImage.activeSelf then - -- body value.AddImage:SetActive(true) end - end - end end - - else - end end - end if this.timerEffect ==nil then - -- body this.timerEffect = Timer.New(refreshFunc, 1, -1, true) end - this.timerEffect:Start() refreshFunc() end function this.SingleBoxDataShow(go,boxData,index) - -- body - local mask = Util.GetGameObject(go.transform,"Box/Empty/lock/mask"); local lock = Util.GetGameObject(go.transform,"Box/Empty/lock"); local Empty = Util.GetGameObject(go.transform,"Box/Empty") @@ -169,7 +102,6 @@ function this.SingleBoxDataShow(go,boxData,index) local redPoint = Util.GetGameObject(go.transform,"Box/Empty/redPoint") Util.GetGameObject(go.transform, "GameObject/proIcon"):GetComponent("Image").sprite = Util.LoadSprite("r_hero_huo 1_zh") - ItemList[go] ={} ItemList[go].index = index ItemList[go].TimerText = TimerText @@ -194,10 +126,7 @@ function this.SingleBoxDataShow(go,boxData,index) LogError("error: no hero data") end else - if gridData.time - GetTimeStamp() <= 0 then - -- body - TimerText.text = "" AddImage:SetActive(true) else @@ -209,19 +138,15 @@ function this.SingleBoxDataShow(go,boxData,index) redPoint:SetActive(false) end else - end elseif index == Box + 1 then mask:SetActive(false) Util.SetGray(lock,false) tempData = boxData if HarmonyManager.RefreshOpenBoxPoint() then - -- body Gold = BagManager.GetTotalItemNum(UpViewRechargeType.XuanHuangZhiQi) CheckRedPointStatus(RedPointType.HongMeng_OpenBox) - -- print(Gold.."!@@@@@@"..boxData.PropPrice[2]) if Gold > boxData.PropPrice[2] then - -- body redPoint:SetActive(true) else redPoint:SetActive(false) @@ -231,32 +156,24 @@ function this.SingleBoxDataShow(go,boxData,index) end else TimerText.text = "" - end - Util.AddOnceClick(go,function() if gridData then - -- body if gridData.heroId ~= "" then - -- body TempItem = index HarmonyManager:SetMingListIndexData(boxData.Id) HarmonyManager.UnLoadGongMing = boxData.Id--发往服务器 UIManager.OpenPanel(UIName.HongMengUnLoadPanel) else if gridData.time == 0 then - -- body UIManager.OpenPanel(UIName.HongMengChooseHeroPanel,false) TempItem = index - HarmonyManager.GongMingBox = boxData.Id print(Language[12205],HarmonyManager.GongMingBox) else local content = "" - --print((HarmonyManager.hongmengHeroInfos[boxData.Id].time - GetTimeStamp()) / 432) local money = math.ceil((HarmonyManager.hongmengHeroInfos[boxData.Id].time - GetTimeStamp()) / 432) content =string.format(Language[12189],money) - MsgPanel.ShowTwo(content,function () MsgPanel.Hide() end,function () @@ -267,10 +184,7 @@ function this.SingleBoxDataShow(go,boxData,index) end --向服务器 发消息 NetManager.UnlockGrid(boxData.Id,1,function () - -- body - for i = 1, #HarmonyManager.hongmengHeroInfos do - -- body if HarmonyManager.hongmengHeroInfos[i].gridId ==boxData.Id then HarmonyManager.hongmengHeroInfos[i].time = 0 print(Language[12206]) @@ -279,36 +193,24 @@ function this.SingleBoxDataShow(go,boxData,index) end AddImage:SetActive(true) TimerText.text = "" - end,Language[10731],Language[11934]) this.RunTimerFun() - end) end end else if mask.activeSelf then - -- body PopupTipPanel.ShowTip(Language[12207]) else if lock.activeSelf then - -- body this:AddBoxFun(boxData) end end end end) - - - - -end ---卸载刷新 -function this:UpdateItemShow(go,boxData,msg) - - - + function this:UpdateItemShow(go,boxData,msg) + end end function this:AddBoxFun(boxData) local content = "" @@ -316,7 +218,6 @@ function this:AddBoxFun(boxData) DemonCrystal = BagManager.GetTotalItemNum(UpViewRechargeType.DemonCrystal) local keys = GameDataBase.SheetBase.GetKeys(this.tab) --获取数据长度 if #HarmonyManager.hongmengHeroInfos >= #keys then - -- body PopupTipPanel.ShowTip(Language[12208]) return end @@ -324,59 +225,43 @@ function this:AddBoxFun(boxData) if Gold >= boxData.PropPrice[2] then content =string.format(Language[12209],boxData.PropPrice[2]) elseif Gold < boxData.PropPrice[2] then - -- body and DemonCrystal >= boxData.MoneyPrice[2] content=string.format(Language[12210],boxData.PropPrice[2],boxData.MoneyPrice[2]) - end MsgPanel.ShowTwo(content,function () - end,function () if Gold < boxData.PropPrice[2] and DemonCrystal < boxData.MoneyPrice[2] then PopupTipPanel.ShowTip(Language[10497]) return - end - if condition then - -- body end --向服务器请求消息 NetManager.HongMengRequset(boxData.Id,function() - -- Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.RereshNumText,boxData.Id) end) end,Language[10731],Language[11934]) end + function this:BindEvent() - end function this:OnOpen() - this:AwakeLength() ItemList = {} this:InitBox() this.RunTimerFun() - --this.timerEffect:Start() end function this.SingleItemDataShow(clone,Itemdata) - --LogGreen(clone.name.."||"..Itemdata.heroConfig.Id) - --Util.GetGameObject(clone.transform, "Box/Empty"):SetActive(false) Util.GetGameObject(clone.transform, "GameObject/frame"):GetComponent("Image").sprite = Util.LoadSprite(GetHeroQuantityImageByquality(Itemdata.heroConfig.Quality,Itemdata.star)) Util.GetGameObject(clone.transform, "GameObject/lv/Text"):GetComponent("Text").text = string.format("%d",Itemdata.lv) Util.GetGameObject(clone.transform, "GameObject/icon"):GetComponent("Image").sprite = Util.LoadSprite(Itemdata.icon) - --Util.GetGameObject(clone.transform, "GameObject/posIcon"):SetActive(false)--:GetComponent("Image").sprite = Util.LoadSprite(heroData.professionIcon) Util.GetGameObject(clone.transform, "GameObject/proIcon"):GetComponent("Image").sprite = Util.LoadSprite(GetProStrImageByProNum(Itemdata.heroConfig.PropertyName)) local starGrid = Util.GetGameObject(clone.transform, "GameObject/star") SetHeroStars(starGrid, Itemdata.star,1,nil,nil,Vector2.New(0,1)) - end function this:Refesh(id) - -- body - Box = Box + 1 OpenBox = OpenBox + 1 - Gold = BagManager.GetTotalItemNum(UpViewRechargeType.XuanHuangZhiQi) DemonCrystal = BagManager.GetTotalItemNum(UpViewRechargeType.DemonCrystal) if self.stage == 1 then @@ -384,15 +269,12 @@ function this:Refesh(id) else local count = 0 for i = 1, #HarmonyManager.hongmengGuards do - -- body if HarmonyManager.hongmengGuards[i].heroId ~= "" then count = count + 1 - -- body end end Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount + count,Box + #HarmonyManager.hongmengGuards}) end - LogGreen(Box) local data = {} data.gridId = id data.heroId = "" @@ -401,66 +283,45 @@ function this:Refesh(id) local keys = GameDataBase.SheetBase.GetKeys(this.tab) --获取数据长度 this.ScrollView:SetData(keys,function (index, go) local key = keys[index] - this.SingleBoxDataShow(go, this.tab[key], index) - - end,true,true) end function this:OpenBoxFun() if tempData then - -- body this:AddBoxFun(tempData) else PopupTipPanel.ShowTip(Language[12208]) return end - end function this:UpdateHero(Herodata) - - for i = 1, #HarmonyManager.hongmengHeroInfos do - -- body if HarmonyManager.GongMingBox ==HarmonyManager.hongmengHeroInfos[i].gridId then - -- body - HarmonyManager.hongmengHeroInfos[i].heroId = Herodata.dynamicId HarmonyManager.hongmengHeroInfos[i].time = 0 - break end end HeroCount = HeroCount + 1 if self.stage == 1 then - -- body Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount,Box}) else local count = 0 for i = 1, #HarmonyManager.hongmengGuards do - -- body if HarmonyManager.hongmengGuards[i].heroId~="" then count = count + 1 - -- body end end Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount + count,Box + #HarmonyManager.hongmengGuards}) end - --Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount,Box, 1}) - --this.NumText.text = string.format("%d/%d",HeroCount,Box) local keys = GameDataBase.SheetBase.GetKeys(this.tab) --获取数据长度 - --刷新选择英雄界面的 数据 HarmonyManager:SetInitList() - this.ScrollView:SetData(keys,function (index, go) local key = keys[index] - this.SingleBoxDataShow(go, this.tab[key], index) - - end,true,true) this.RunTimerFun() end @@ -469,44 +330,30 @@ end function this:UnLoadFun(msg) HeroCount = HeroCount - 1 - for key, value in pairs(ItemList) do if value.index == TempItem then - -- body HarmonyManager.hongmengHeroInfos[value.index].time = msg.leftTime + GetTimeStamp() - HarmonyManager.hongmengHeroInfos[value.index].heroId = "" - end - - end + end --刷新选择英雄界面的 数据 HarmonyManager:SetInitList() if self.stage == 1 then - -- body Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount,Box, 1}) else local count = 0 for i = 1, #HarmonyManager.hongmengGuards do - -- body if HarmonyManager.hongmengGuards[i].heroId ~= "" then count = count + 1 - -- body end end Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount + count,Box + #HarmonyManager.hongmengGuards}) end - -- Game.GlobalEvent:DispatchEvent(GameEvent.HongMeng.OnlyRefeshText,{HeroCount,Box, 1}) - --this.NumText.text = string.format("%d/%d",HeroCount,Box) local keys = GameDataBase.SheetBase.GetKeys(this.tab) --获取数据长度 - ItemList = {} this.ScrollView:SetData(keys,function (index, go) local key = keys[index] - this.SingleBoxDataShow(go, this.tab[key], index) - - end,true,true) this.RunTimerFun() end @@ -516,25 +363,18 @@ function this:OnlyRefeshHeroLv() local keys = GameDataBase.SheetBase.GetKeys(this.tab) --获取数据长度 this.ScrollView:SetData(keys,function (index, go) local key = keys[index] - this.SingleBoxDataShow(go, this.tab[key], index) - - end,true,true) - end --界面关闭时调用(用于子类重写) function this:OnClose() if this.timerEffect then - -- body this.timerEffect:Stop() end end function this:AddListener() - -- body - Game.GlobalEvent:AddEvent(GameEvent.HongMeng.RereshNumText,self.Refesh,self) Game.GlobalEvent:AddEvent(GameEvent.HongMeng.OpenBoxTips,self.OpenBoxFun,self) Game.GlobalEvent:AddEvent(GameEvent.HongMeng.ChooseData,self.UpdateHero,self) @@ -544,7 +384,6 @@ function this:AddListener() end function this:RemoveListener() - -- body Game.GlobalEvent:RemoveEvent(GameEvent.HongMeng.RereshNumText,self.Refesh,self) Game.GlobalEvent:RemoveEvent(GameEvent.HongMeng.OpenBoxTips,self.OpenBoxFun,self) Game.GlobalEvent:RemoveEvent(GameEvent.HongMeng.ChooseData,self.UpdateHero,self) @@ -553,11 +392,5 @@ function this:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.HongMeng.UpdateGongMingLv,self.OnlyRefeshHeroLv,self) end function this:OnShow(...) - -- body - end - - - - return this \ No newline at end of file