From 2d25ebb61bdcc078893ab25b4a2364fa695d9bb6 Mon Sep 17 00:00:00 2001 From: ZhangBiao Date: Wed, 24 Nov 2021 11:30:55 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E4=B8=BA=E3=80=91=E4=BF=AE?= =?UTF-8?q?=E4=B8=BA=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../UI/GeneralPanel/GeneralBigPopup.prefab | 16 ++++---- .../Modules/Practice/CultivationPanel.lua | 18 +++++---- .../~Lua/Modules/Practice/PracticeManager.lua | 37 +++++++++++++++++-- 3 files changed, 52 insertions(+), 19 deletions(-) diff --git a/Assets/ManagedResources/Prefabs/UI/GeneralPanel/GeneralBigPopup.prefab b/Assets/ManagedResources/Prefabs/UI/GeneralPanel/GeneralBigPopup.prefab index ccf3f2a8ac..b6b1f5dc1a 100644 --- a/Assets/ManagedResources/Prefabs/UI/GeneralPanel/GeneralBigPopup.prefab +++ b/Assets/ManagedResources/Prefabs/UI/GeneralPanel/GeneralBigPopup.prefab @@ -1195,10 +1195,10 @@ RectTransform: m_Father: {fileID: 391854018} m_RootOrder: 2 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: -1.3999023, y: 370} - m_SizeDelta: {x: -172.8, y: 181.9} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -1.3999023, y: -624} + m_SizeDelta: {x: 907.2, y: 181.90002} m_Pivot: {x: 0.5, y: 0.5} --- !u!114 &1220850633 MonoBehaviour: @@ -1601,10 +1601,10 @@ RectTransform: m_Father: {fileID: 391854018} m_RootOrder: 3 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: -1.3999023, y: 985.7202} - m_SizeDelta: {x: -172.8, y: 1049.6} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: -1.3999023, y: -5.4000244} + m_SizeDelta: {x: 907.2, y: 1111.8999} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &1831826791 CanvasRenderer: diff --git a/Assets/ManagedResources/~Lua/Modules/Practice/CultivationPanel.lua b/Assets/ManagedResources/~Lua/Modules/Practice/CultivationPanel.lua index c685697605..003501110a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Practice/CultivationPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Practice/CultivationPanel.lua @@ -7,8 +7,6 @@ local IMAGE = { [4] = "r_hero_jinengdian01", } local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig) -local maxLevel = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,133).Value) -local statePower = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,134).Value) function Cultivation:InitComponent() self.spLoader = SpriteLoader.New() @@ -19,6 +17,7 @@ function Cultivation:InitComponent() self.textPre = Util.GetGameObject(self.grid,"TextPre") self.textPre:SetActive(false) self.Tips = Util.GetGameObject(self.gameObject,"Frame/Tips"):GetComponent("Text") + self.title = Util.GetGameObject(self.gameObject,"Frame/Bg/title/Text"):GetComponent("Text") self.Slide = Util.GetGameObject(self.gameObject,"Frame/Slide") self.level = Util.GetGameObject(self.Slide,"level"):GetComponent("Text") @@ -44,11 +43,11 @@ function Cultivation:BindEvent() self:ClosePanel() end) Util.AddOnceClick(self.upGradeBtn, function() - if (self.curMaxPower-PracticeManager.CultivationLevel*statePower) < statePower then + if (self.curMaxPower-self.achivePower) < self.statePower then PopupTipPanel.ShowTip("战力不足无法升级!") return end - if maxLevel <= PracticeManager.CultivationLevel then + if self.maxLevel <= PracticeManager.CultivationLevel then PopupTipPanel.ShowTip("等级已达上限!") return end @@ -88,8 +87,11 @@ function Cultivation:OnShow() --战力 self.curMaxPower = PlayerManager.maxForce self.lastLevel = PracticeManager.CultivationLevel--上次的等级 + self.maxLevel,self.statePower,self.achivePower = PracticeManager.getDataOfCur() + self.lastPower = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL) self.Tips.text = ConfigManager.GetConfigData(ConfigName.QAConfig,112).content + self.title.text = string.format("最高战力每提升%s万可提升1级修为",self.statePower/10000) --设置四个属性 for i = 1, #self.configData.ProRank do local go = self.textPreList[i] @@ -104,12 +106,12 @@ function Cultivation:OnShow() self.level.text = string.format("%s级",PracticeManager.CultivationLevel) self.power.text = self.curMaxPower --数字 - if maxLevel > PracticeManager.CultivationLevel then - self.value.text = string.format("%s/%s",self.curMaxPower-statePower*PracticeManager.CultivationLevel,statePower) - if self.curMaxPower-statePower*PracticeManager.CultivationLevel > statePower then + if self.maxLevel > PracticeManager.CultivationLevel then + self.value.text = string.format("%s/%s",self.curMaxPower-self.achivePower,self.statePower) + if self.curMaxPower-self.achivePower > self.statePower then self.fill:GetComponent("RectTransform").sizeDelta = Vector3.New(445,26,0) else - local size = (self.curMaxPower%statePower)/statePower + local size = (self.curMaxPower-self.achivePower)/self.statePower self.fill:GetComponent("RectTransform").sizeDelta = Vector3.New(445*size,26,0) end self.btnText.text = "升 级" diff --git a/Assets/ManagedResources/~Lua/Modules/Practice/PracticeManager.lua b/Assets/ManagedResources/~Lua/Modules/Practice/PracticeManager.lua index b6c4043c7f..fd82f746f1 100644 --- a/Assets/ManagedResources/~Lua/Modules/Practice/PracticeManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Practice/PracticeManager.lua @@ -723,12 +723,43 @@ function this.SetCultivationLevel(_level,func) end end +function this.getDataOfCur() + local maxLevel = 0--最大等级 + local statePower = 0--当前升一级需要的战力 + local achivePower = 0--当前等级已达到的战力 + + local levelList = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig,133).Value, "#") + local statePowerList = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig,134).Value, "#") + local limitPowerList = string.split(ConfigManager.GetConfigData(ConfigName.SpecialConfig,139).Value, "#") + maxLevel = tonumber(levelList[#levelList]) + + for i = #levelList, 1,-1 do + if this.CultivationLevel <= tonumber(levelList[i]) then + statePower = tonumber(statePowerList[i]) + end + end + for i = 1, #levelList do + if this.CultivationLevel <= tonumber(levelList[i]) then + if levelList[i-1] then + achivePower = achivePower + (this.CultivationLevel - tonumber(levelList[i-1]))*statePower + break + else + achivePower = this.CultivationLevel*statePower + break + end + else + achivePower = tonumber(limitPowerList[i]) + end + end + -- LogGreen("修为等级:"..tostring(this.CultivationLevel).." maxLevel:"..tostring(maxLevel).." statePower:"..tostring(statePower).." achivePower:"..tostring(achivePower).." 最高战力:"..tostring(PlayerManager.maxForce)) + return maxLevel,statePower,achivePower +end + function this.CheckPlayerCultivetionRed() - local maxLevel = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,133).Value) - local statePower = tonumber(ConfigManager.GetConfigData(ConfigName.SpecialConfig,134).Value) + local maxLevel,statePower,achivePower = this.getDataOfCur() if maxLevel > this.CultivationLevel then FormationManager.UserPowerChanged() - if (PlayerManager.maxForce - statePower*this.CultivationLevel) > statePower then + if (PlayerManager.maxForce - achivePower) > statePower then return true end end