法相manager提交

dev_chengFeng
wangzhenxing 2023-02-18 15:41:04 +08:00
parent 68893390bf
commit 7276228e94
2 changed files with 154 additions and 37 deletions

View File

@ -38,9 +38,10 @@ function this.InitSingleTreasureData(_singleData,notAdd)
single.maxRefineLv = currJewel.StarMax
single.upHeroDid = ""
-- single.race = currJewel.Race
-- single.frame = GetQuantityImageByquality(quantity)
-- single.name = GetLanguageStrById(itemConfig[staticId].Name)
single.itemConfig = itemConfig[staticId]
single.frame = GetQuantityImageByquality(itemConfig[staticId].Quantity)
single.levelPool = currJewel.LevelUpPool
single.refinePool = currJewel.Star
single.equipType = currJewel.Type
@ -51,7 +52,7 @@ function this.InitSingleTreasureData(_singleData,notAdd)
-- else
-- single.type = Language[10553]
-- end
-- single.icon = GetResourcePath(itemConfig[staticId].ResourceID)
single.icon = GetResourcePath(itemConfig[staticId].ResourceID)
single.strongConfig = this.GetCurrTreasureLvConfig(currJewel.LevelUpPool, _singleData.exp)
-- single.refineConfig = this.GetCurrTreasureLvConfig(2, currJewel.Star, _singleData.rebuildLevel)
-- if notAdd then
@ -74,6 +75,16 @@ function this.GetAllHeroEquipedTreasureData()
return equips
end
function this.GetFaXiangItemById(_id)
local equips={}
for i, v in pairs(allTreasures) do
if (v.upHeroDid == 0 or v.upHeroDid == "0") and v.id==_id then
table.insert(equips, v)
end
end
return equips,#equips
end
--设置装备穿戴的英雄
function this.SetEquipTreasureUpHeroDid(_equipTreasureDid, _heroDid)
@ -118,9 +129,16 @@ function this.ChangeTreasureLv(_idDyn, _type)
end
--获取当前等级的基础属性/精炼属性
function this.GetCurrLvAndNextLvPropertyValue(_id, _lv)
function this.GetCurrLvAndNextLvPropertyValue(_id, _lv,_data)
local lvConfig = nil
local nexLvConfig = nil
local Para=0
local starConfig=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.FaxiangStarConfig,"PoolId",_data.refinePool,"Level",_data.refineLv)
if starConfig then
LogError("starConfig.id=="..starConfig.Id)
Para=starConfig.StarPara/10000
end
--获取当前等级属性加成
for _, configInfo in ConfigPairs(faxiangLevelConfig) do
if configInfo.PoolId == _id and configInfo.Level == _lv then
@ -137,16 +155,20 @@ function this.GetCurrLvAndNextLvPropertyValue(_id, _lv)
end
end
local proList = {}
-- for key, value in pairs(addAllProVal) do
-- addEndAllProVal[key] = math.floor(value * (1 + Para))
-- end
if lvConfig then
for i = 1, table.getn(lvConfig.LevelPara) do
local info = lvConfig.LevelPara[i]
if info then
local index = info[1]
local skillValue = {}
skillValue.currValue = info[2]
skillValue.currValue = math.floor(info[2] * (1 + Para))
proList[index] = skillValue
end
end
end
--没有下一等级数据为已升到最高级
if nexLvConfig then
@ -155,10 +177,10 @@ function this.GetCurrLvAndNextLvPropertyValue(_id, _lv)
local info = nexLvConfig.LevelPara[i]
if info then
if proList[info[1]] then
proList[info[1]].nextValue = info[2]
proList[info[1]].nextValue = math.floor(info[2] * (1 + Para))
else
local skillValue = {}
skillValue.currValue = info[2]
skillValue.currValue = math.floor(info[2] * (1 + Para))
proList[info[1]] = skillValue
end
end
@ -171,9 +193,60 @@ function this.GetCurrLvAndNextLvPropertyValue(_id, _lv)
return proList
end
--获取当前星级的基础属性/精炼属性
function this.GetCurrStarAndNextStarPropertyValue(_id, _lv,_data)
local lvConfig = nil
local nexLvConfig = nil
local Para=0
local nextPara=0
local starConfig=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.FaxiangStarConfig,"PoolId",_data.refinePool,"Level",_data.refineLv)
if starConfig then
LogError("starConfig.id=="..starConfig.Id)
Para=starConfig.StarPara/10000
end
if _data.refineLv==_data.maxRefineLv then
nextPara=Para
else
local nextStarConfig=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.FaxiangStarConfig,"PoolId",_data.refinePool,"Level",_data.refineLv+1)
nextPara=nextStarConfig.StarPara/10000
end
--获取当前等级属性加成
for _, configInfo in ConfigPairs(faxiangLevelConfig) do
if configInfo.PoolId == _id and configInfo.Level == _lv then
lvConfig = configInfo
break
end
end
local proList = {}
if lvConfig then
for i = 1, table.getn(lvConfig.LevelPara) do
local info = lvConfig.LevelPara[i]
if info then
local index = info[1]
local skillValue = {}
skillValue.currValue = info[2]
proList[index] = skillValue
end
end
end
for key, value in pairs(proList) do
value.currValue=math.floor(value.currValue * (1 + Para))
value.nextValue=math.floor(value.currValue * (1 + nextPara))
end
return proList
end
--获取法相升级消耗
function this.GetFaXiangLevelCost(pool,lv)
local levelConfig=ConfigManager.GetConfigDataByDoubleKey(ConfigName.FaxiangLevelConfig,"PoolId",pool,"Level",lv)
function this.GetFaXiangLevelCost(_pool,_lv)
local levelConfig=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.FaxiangStarConfig,"PoolId",_pool,"Level",_lv)
if levelConfig then
local items={}
for i = 1,#levelConfig.PropList do
@ -202,8 +275,58 @@ function this.GetFaXiangLevelCost(pool,lv)
end
--获取法相升级消耗
function this.GetFaXiangStarCost()
function this.GetFaXiangStarCost(_poolId,_star,_data)
local config=ConfigManager.GetConfigDataByDoubleKey(ConfigName.FaxiangLevelConfig,"PoolId",_poolId,"Level",_star)
local items={}
if config and config.PropList then
for i = 1, #config.PropList do
local id=config.PropList[i]
local item={}
--同类型宝物
local type=id[1]
if type==1 then
item.id=_data.id
item.icon=_data.icon
item.frame=_data.frame
local equips,num=FaXiangManager.GetFaXiangItemById(_data.id)
if equips then
item.haveNum= num
else
item.haveNum=0
end
item.needNum=id[2]
if item.haveNum>=item.needNum then
item.isEnough=true
else
item.isEnough=false
end
items[#items+1]=item
else
item.id=type
local config=itemConfig[type]
if config then
item.icon=GetResourcePath(config.ResourceID)
item.frame=GetQuantityImageByquality(config.Quantity)
item.haveNum=BagManager.GetItemById(type)
item.needNum=id[2]
if item.haveNum>=item.needNum then
item.isEnough=true
else
item.isEnough=false
end
items[#items+1]=item
end
end
end
end
local isEnough = true
for k,v in pairs(items) do
if not v.isEnough then
isEnough = false
break
end
end
return items,isEnough
end
function this.CalculateWarForceBase(sId, lv, rlv, curTreasure)
@ -378,6 +501,7 @@ end
function this.CalculateWarForceBase(sId, lv, rlv, tlv,curTreasure)
-- LogGreen("sId:"..sId.." lv:"..lv.." rlv:"..rlv.." tlv:"..tlv)
local curEuipTreaSureConfig = ConfigManager.GetConfigData(ConfigName.FaxiangConfig, sId)
local addEndAllProVal={}
if curEuipTreaSureConfig then
local addAllProVal = {}
--主属性
@ -393,22 +517,19 @@ function this.CalculateWarForceBase(sId, lv, rlv, tlv,curTreasure)
end
end
end
--精炼的属性
if
configInfo.PoolID == curEuipTreaSureConfig.RankupPool and
configInfo.Level == rlv
then
for j = 1, #configInfo.Property do
if addAllProVal[configInfo.Property[j][1]] then
addAllProVal[configInfo.Property[j][1]] =
addAllProVal[configInfo.Property[j][1]] + configInfo.Property[j][2]
else
addAllProVal[configInfo.Property[j][1]] = configInfo.Property[j][2]
end
end
local starConfig=ConfigManager.TryGetConfigDataByDoubleKey(ConfigName.FaxiangStarConfig,"PoolId",curEuipTreaSureConfig.Star,"Level",rlv)
if starConfig then
LogError("starConfig.id=="..starConfig.Id)
local Para=starConfig.StarPara/10000
for key, value in pairs(addAllProVal) do
addEndAllProVal[key] = math.floor(value * (1 + Para))
end
end
end
local powerEndVal = HeroPowerManager.CalPower(addAllProVal)
local powerEndVal = HeroPowerManager.CalPower(addEndAllProVal)
return powerEndVal
end
end

View File

@ -74,7 +74,7 @@ function FaXiangStrongPopup:BindEvent()
return
end
this:SetWindShow(1,0)
this:RefreshRedPoint(0,false)
-- this:RefreshRedPoint(0,false)
end)
--精炼页签
Util.AddClick(this.btn_refinePage, function()
@ -82,16 +82,12 @@ function FaXiangStrongPopup:BindEvent()
return
end
this:SetWindShow(2,0)
this:RefreshRedPoint(0,false)
--this:RefreshRedPoint(0,false)
end)
--神应页签
Util.AddClick(this.btn_shenyingPage, function()
if type == 3 then
return
end
this:SetWindShow(3,0)
this:RefreshRedPoint(0,false)
end)
--强化按钮
@ -114,7 +110,7 @@ function FaXiangStrongPopup:BindEvent()
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup,matId)
return
end
NetManager.StrongthenFaxiangEquipRequest(curEquipData.idDyn,curEquipData.lv+1,1,function (msg)
NetManager.StrongthenFaxiangEquipRequest(curEquipData.idDyn,curEquipData.lv+1,1,curEquipData,function (msg)
FaXiangManager.ChangeTreasureLv(curEquipData.idDyn,1)
this.treasureDatas[curIndex]:OnOpen(false, {curEquipData.id,0}, 1, false, false, false, 0,curEquipData.idDyn)
this:SetWindShow(type,0)
@ -363,7 +359,7 @@ function FaXiangStrongPopup:SetWindShow(_index)
this.btnStrongText.text = Language[11777]
this.properList[0].rightTxt.text = string.format( "%d/%d",curEquipData.lv+1,curEquipData.maxLv)
end
propertyShow = FaXiangManager.GetCurrLvAndNextLvPropertyValue(curEquipData.levelPool,curEquipData.lv)
propertyShow = FaXiangManager.GetCurrLvAndNextLvPropertyValue(curEquipData.levelPool,curEquipData.lv,curEquipData)
--显示消耗
LogError("curEquipData.strongConfig.id=="..curEquipData.strongConfig.Id)
--items = FaXiangManager.GetCostItems(curEquipData.idDyn,curEquipData.strongConfig)
@ -375,13 +371,13 @@ function FaXiangStrongPopup:SetWindShow(_index)
end
elseif _index == 2 then
this.titleTxt.text=Language[11779]
this.titleTxt.text="法相升星"
this.btnRefine:SetActive(true)
this.btnStrong:SetActive(false)
this.btnShenying:SetActive(false)
this.SetBtnSelect(this.btn_refinePage)
isMax=curEquipData.refineLv==curEquipData.maxRefineLv
this.properList[0].leftTxt.text = "精炼等"
this.properList[0].leftTxt.text = "法相星"
if isMax then
this.properList[0].rightTxt.text = Language[11062]
this.btnRefine.gameObject:SetActive(false)
@ -389,8 +385,8 @@ function FaXiangStrongPopup:SetWindShow(_index)
this.btnRefineText.text=Language[11781]
this.properList[0].rightTxt.text = string.format( "%d/%s",curEquipData.refineLv+1,curEquipData.maxRefineLv)
end
propertyShow = EquipTreasureManager.GetCurrLvAndNextLvPropertyValue(2,curEquipData.refinePool,curEquipData.refineLv)
items = HeroManager.GetCostItems(curEquipData.idDyn,curEquipData.refineConfig)
propertyShow = FaXiangManager.GetCurrStarAndNextStarPropertyValue(2,curEquipData.refineLv,curEquipData)
items = FaXiangManager.GetFaXiangStarCost(curEquipData.refinePool,curEquipData.refineLv,curEquipData)
if curEquipData.quantity == 6 then
this.hintTxt.text = "精炼等级已达上限"
else