From 31b9eb30573c6230ab1566e032e28b4966d80769 Mon Sep 17 00:00:00 2001 From: ZhangBiao Date: Mon, 26 Apr 2021 16:20:22 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E8=B8=8F=E7=A2=8E=E5=87=8C=E9=9C=84?= =?UTF-8?q?=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Prefabs/UI/Battle/BattlePanel.prefab | 32 +------ .../~Lua/Modules/Battle/View/BattlePanel.lua | 87 +++++++++++++------ .../NewActivity/CommonActPageManager.lua | 1 + .../TaSuiLingXiao/TaSuiLingXiaoPanel.lua | 1 + 4 files changed, 68 insertions(+), 53 deletions(-) diff --git a/Assets/ManagedResources/Prefabs/UI/Battle/BattlePanel.prefab b/Assets/ManagedResources/Prefabs/UI/Battle/BattlePanel.prefab index b2a6003168..e2c52f2b8f 100644 --- a/Assets/ManagedResources/Prefabs/UI/Battle/BattlePanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/Battle/BattlePanel.prefab @@ -152238,7 +152238,6 @@ GameObject: serializedVersion: 6 m_Component: - component: {fileID: 5510259970768181577} - - component: {fileID: 5557887828650331500} m_Layer: 5 m_Name: bar m_TagString: Untagged @@ -152260,34 +152259,11 @@ RectTransform: m_Father: {fileID: 5251286333026968868} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 1, y: 0.5} - m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: -79.75012, y: -290.99997} - m_SizeDelta: {x: 100, y: 500} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -14.700012, y: -866.4} + m_SizeDelta: {x: 868.5, y: 305.2} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &5557887828650331500 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4546522920489809414} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 1297475563, guid: f70555f144d8491a825f0804e09c671c, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Padding: - m_Left: 0 - m_Right: 0 - m_Top: 0 - m_Bottom: 0 - m_ChildAlignment: 1 - m_Spacing: 50 - m_ChildForceExpandWidth: 0 - m_ChildForceExpandHeight: 0 - m_ChildControlWidth: 0 - m_ChildControlHeight: 0 --- !u!1 &4556669536885542883 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua index 64f73cfc28..fded5b909f 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua @@ -8,12 +8,14 @@ BattlePanel = Inherit(BasePanel) local this = BattlePanel local battleTimeScaleKey = "battleTimeScaleKey" +local ArtResourcesConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig) local timeCount local endFunc local isBack = false --是否为战斗回放 local fightType -- 1关卡 2副本 3限时怪, 5兽潮, 6新关卡, 7公会boss local orginLayer local boxList={}--新将来袭奖励盒子 +local boxList2={}--踏碎凌霄奖励盒子 -- 显示跳过战斗使用 local hadCounted = 0 @@ -67,7 +69,8 @@ function this:InitComponent() this.dmg3Progress = Util.GetGameObject(this.dmg3, "progress/Fill"):GetComponent("Image") this.dmg3Text = Util.GetGameObject(this.dmg3, "progress/Text"):GetComponent("Text") this.dmg3grid = Util.GetGameObject(this.dmg3, "grid") - this.bar = Util.GetGameObject(this.dmg3, "bar") + this.bar3 = Util.GetGameObject(this.dmg3, "bar") + this.boxpre = Util.GetGameObject(this.dmg3, "boxpre") end --绑定事件(用于子类重写) @@ -312,20 +315,32 @@ function this.InitPanelData() end) end elseif fightType == BATTLE_TYPE.TASUILINGXIAO then--踏碎凌霄 + boxList2={} + local actData = CommonActPageManager.GetData(ActivityTypeDef.TaSuiLingXiao) + local boxs = ConfigManager.GetConfigDataByKey(ConfigName.NewHeroConfig,"Id",actData.activityId).BoxList + local maxDmg = actData.value this.dmg3:SetActive(fightType == BATTLE_TYPE.TASUILINGXIAO) this.myDamage = 0 this.myDamageLevel = 0 - this.dmg3Text.text = "0" + this.dmg3Text.text = string.format("0/%s",boxs[1][1]) this.dmg3Progress.fillAmount = 0 - -- local actData = CommonActPageManager.GetData(ActivityTypeDef.TaSuiLingXiao) - -- local boxs = ConfigManager.GetConfigDataByKey(ConfigName.NewHeroConfig,"Id",actData.activityId).BoxList - -- for i = 1, 7 do - -- boxList[i] = Util.GetGameObject(this.dmg2, "box"..i) - -- boxList[i]:SetActive(false) - -- local effect = Util.GetGameObject(boxList[i], "effect") - -- effect:SetActive(false) - -- end + for i = 1, #actData.rewards do + local index = #boxList2 + 1 + if actData.rewards[i].state == 0 then + boxList2[index] = {} + boxList2[index].obj = newObject(this.boxpre) + boxList2[index].obj.transform:SetParent(this.dmg3grid.transform) + boxList2[index].obj.transform.localScale = Vector3.one + boxList2[index].obj.transform.localPosition = Vector3.zero + boxList2[index].moved = false + boxList2[index].obj:SetActive(false) + Util.GetGameObject(boxList2[index].obj,"iconRoot/icon"):GetComponent("Image").sprite = Util.LoadSprite(ArtResourcesConfig[boxs[i][2]].Name) + end + end + if #boxList2 > 0 then + boxList2[1].obj:SetActive(true) + end this.RefreshMyDamageShow() local list = RoleManager.Query(function (r) return r.camp == 1 end) @@ -760,31 +775,50 @@ function this.RefreshMyDamageShow(role) -- local curBossHp = role.data:GetData(RoleDataName.Hp) local maxBossHp = role.data:GetData(RoleDataName.MaxHp) - local num = 0 + local num1,num2 = 0,0 local actData = CommonActPageManager.GetData(ActivityTypeDef.TaSuiLingXiao) local boxs = ConfigManager.GetConfigDataByKey(ConfigName.NewHeroConfig,"Id",actData.activityId).BoxList - this.dmg3Text.text = string.format("%s/%s",myDamage,maxBossHp) for i = 1, #boxs do local lastValue = boxs[i-1] and boxs[i-1][1] or 0 if myDamage < boxs[i][1] then - num = (myDamage - lastValue)/(boxs[i][1] - lastValue) + num1 = myDamage - lastValue + num2 = boxs[i][1] - lastValue curLevel = i break + else + num1 = boxs[i][1] - lastValue + num2 = boxs[i][1] - lastValue + end + end + this.dmg3Text.text = string.format("%s/%s",num1,num2) + this.dmg3Progress.fillAmount = num1/num2 + + local list = {} + for i = 1, #boxs do + -- LogBlue("TaSuiLingXiaoHistoryDmg:"..tostring(CommonActPageManager.TaSuiLingXiaoHistoryDmg)) + if CommonActPageManager.TaSuiLingXiaoHistoryDmg < boxs[i][1] then + table.insert(list,boxs[i]) + end + end + -- LogGreen("#list:"..tostring(#list)) + if #list > 0 then + for i = 1, #list do + -- LogYellow("myDamage:"..tostring(myDamage).." list[i][1]:"..tostring(list[i][1])) + if myDamage >= list[i][1] then + if boxList2[i+1] then + boxList2[i+1].obj:SetActive(true) + end + -- LogPink("not boxList2[i].moved:"..tostring(boxList2[i].moved)) + if not boxList2[i].moved then + boxList2[i].obj.transform:SetParent(this.bar3.transform) + boxList2[i].obj.transform:DOLocalMove(Vector3.New(math.random(-400, 400),math.random(-100, 100),0), 1.5) + boxList2[i].moved = true + Util.GetGameObject(boxList2[i].obj, "effect"):SetActive(true) + end + end end end - this.dmg2Progress.fillAmount = num - -- for i = 1, #boxs do - -- if curPercent >= (boxs[i][1]/boxs[#boxs][1])*100 then - -- if boxList[i+1] then - -- boxList[i+1]:SetActive(true) - -- end - -- boxList[i].transform:SetParent(this.bar.transform) - -- local t = i%5 == 0 and 5 or i%5 - -- boxList[i].transform:DOLocalMove(Vector3.New(math.floor(i/6)*-120,-329+t*100,0), 1.5) - -- Util.GetGameObject(boxList[i], "effect"):SetActive(true) - -- end - -- end end end @@ -806,6 +840,9 @@ function this:OnClose() end --检测是否需要弹每日任务飘窗 TaskManager.RefreshShowDailyMissionTipPanel() + for i = 1, #boxList2 do + destroy(boxList2[i].obj) + end end --界面销毁时调用(用于子类重写) diff --git a/Assets/ManagedResources/~Lua/Modules/NewActivity/CommonActPageManager.lua b/Assets/ManagedResources/~Lua/Modules/NewActivity/CommonActPageManager.lua index c21dc89717..c2c3417f8e 100644 --- a/Assets/ManagedResources/~Lua/Modules/NewActivity/CommonActPageManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/NewActivity/CommonActPageManager.lua @@ -2,6 +2,7 @@ CommonActPageManager = {} local this = CommonActPageManager local dataList = {} this.TaSuiLingXiaoMsg = nil +this.TaSuiLingXiaoHistoryDmg = 0 function this.Initialize() end diff --git a/Assets/ManagedResources/~Lua/Modules/TaSuiLingXiao/TaSuiLingXiaoPanel.lua b/Assets/ManagedResources/~Lua/Modules/TaSuiLingXiao/TaSuiLingXiaoPanel.lua index 4d81c37ed9..019c89df39 100644 --- a/Assets/ManagedResources/~Lua/Modules/TaSuiLingXiao/TaSuiLingXiaoPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/TaSuiLingXiao/TaSuiLingXiaoPanel.lua @@ -70,6 +70,7 @@ end function TaSuiLingXiao:Refresh() self.actData = CommonActPageManager.GetData(ActivityTypeDef.TaSuiLingXiao) + CommonActPageManager.TaSuiLingXiaoHistoryDmg = self.actData.value TaSuiLingXiao:ShowLive() TaSuiLingXiao:SetTime() TaSuiLingXiao:ShowSkillList()