【修为】修为调整

dev_chengFeng
ZhangBiao 2021-11-24 11:30:55 +08:00
parent 0e15c3d812
commit 2d25ebb61b
3 changed files with 52 additions and 19 deletions

View File

@ -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:

View File

@ -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 = "升 级"

View File

@ -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