【战斗力】新战斗力计算系统完成

dev_chengFeng
gaoxin 2021-09-16 13:35:33 +08:00
parent 3622d49888
commit 66efc9d4e3
30 changed files with 476 additions and 467 deletions

View File

@ -30,6 +30,7 @@ local ManagerNames = {
"Hero/HeroManager",
"Hero/HeroPowerManager",
"Hero/HeroPropManager",
"Hero/HeroTempPropManager",
--背包数据管理
"Bag/BagManager",
--关卡数据管理

View File

@ -42,8 +42,8 @@ function startWith(sSource, sTemplate)
if not sSource or not sTemplate then
return false
else
local _, _endPos = string.find(sSource, sTemplate)
if not _endPos and _endPos == #sSource then
local sp, ep = string.find(sSource, sTemplate)
if sp == 1 and ep == #sTemplate then
return true
else
return false

View File

@ -26,7 +26,7 @@ function PlayerView:onCreate(go, role, position, root)
self.spLoader = SpriteLoader.New()
self.castingEfectNode = self.RootPanel.mySkillCast
self.castingNameNode = Util.GetGameObject(self.castingEfectNode, "TongYong_Casting_Xia/DongHua/MingZi")
self.hpSlider = Util.GetGameObject(go, "hpProgress/hp"):GetComponent("Image")

View File

@ -154,13 +154,14 @@ function this.ShowGoldNum(_costData,_num)
this.subtractBtn:GetComponent("Button").enabled = false
end
end
function this.ShowTitleEquipData(_go,_itemData,_frame,_id)
Util.GetGameObject(_go.transform,"frame"):GetComponent("Image").sprite=this.spLoader:LoadSprite(_frame)
Util.GetGameObject(_go.transform,"icon"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetResourcePath(itemConfig[_id].ResourceID))--this.spLoader:LoadSprite(_itemData.icon)
Util.GetGameObject(_go.transform,"proImg"):GetComponent("Image").sprite=this.spLoader:LoadSprite(GetProStrImageByProNum(itemConfig[_id].PropertyName))
Util.GetGameObject(_go.transform,"name"):GetComponent("Text").text=GetLanguageStrById(itemConfig[_id].Name)
Util.GetGameObject(_go.transform, "star").gameObject:SetActive(false)
Util.AddClick(Util.GetGameObject(_go.transform,"icon"), function()
Util.AddOnceClick(Util.GetGameObject(_go.transform,"icon"), function()
--UIManager.OpenPanel(UIName.HandBookEquipInfoPanel, _itemData.Id)
UIManager.OpenPanel(UIName.RewardTalismanSingleShowPopup, 0,nil,_id, 0, 0,0,nil)
end)

View File

@ -396,10 +396,10 @@ this.backPatFaceAllData = {}
function this.SetPatFaceDaqta(PatFaceDatas)
if PatFaceDatas and PatFaceDatas.id and #PatFaceDatas.id > 0 then
for i = 1, #PatFaceDatas.id do
--LogYellow("后端推送礼包拍脸 礼包id "..PatFaceDatas.id[i])
LogYellow("后端推送礼包拍脸 礼包id "..PatFaceDatas.id[i])
local curRechargeCommodityConfig = ConfigManager.TryGetConfigData(ConfigName.RechargeCommodityConfig,PatFaceDatas.id[i])
if curRechargeCommodityConfig and curRechargeCommodityConfig.PosterUiId then
--LogYellow("后端推送礼包拍脸 拍脸ID "..curRechargeCommodityConfig.PosterUiId)
LogYellow("后端推送礼包拍脸 拍脸ID "..curRechargeCommodityConfig.PosterUiId)
local config = ConfigManager.GetConfigData(ConfigName.LoginPosterConfig,curRechargeCommodityConfig.PosterUiId)
local isShow = true
if config.Type == FacePanelType.Surprise then

View File

@ -107,7 +107,8 @@ function this.UpdateTemporaryFormation(TeamPosInfo)
end
end
this.formationList[FormationTypeDef.FORMATION_TEMPORARY] = curFormation
-- HeroPropManager.SetDirtyByType(heroDId, Hero_Prop_Type.Base)
-- 设置临时编队为脏数据
HeroPropManager.SetFormationPropDirty(FormationTypeDef.FORMATION_TEMPORARY)
end
-- function this.SetCurFormationIndex()
-- local curIndex = 1
@ -280,10 +281,10 @@ function this.GetFormationPower(formationId)
-- 主线编队战斗力
ThinkingAnalyticsManager.SetSuperProperties({
fighting_capacity = power,
fighting_capacity = power2,
})
-- 编队战斗力刷新
Game.GlobalEvent:DispatchEvent(GameEvent.Formation.OnFormationPowerChange, power)
Game.GlobalEvent:DispatchEvent(GameEvent.Formation.OnFormationPowerChange, power2)
return power2
end

View File

@ -338,6 +338,7 @@ function this.SetCardsData()
LogGreen("刷新编队·············· ")
FormationManager.UpdateTemporaryFormation(this.choosedList)
this.formationPower = 0--战力
this.formationPowerOld = 0--战力
--元素共鸣
this.ElementalResonanceView:GetElementalType(this.choosedList,1)
this.ElementalResonanceView:SetPosition(1)
@ -348,6 +349,7 @@ function this.SetCardsData()
--编队为0显示0战力
if #this.choosedList<=0 then
this.formationPower=0
this.formationPowerOld = 0
end
this.power.text=this.formationPower
@ -517,8 +519,12 @@ end
--战力计算
function this.CalculateAllHeroPower(curHeroData,allHeroTeamAddProVal)
-- HeroPowerManager.GetHeroPower(dId, formationId)
local allEquipAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal, nil, FormationTypeDef.FORMATION_TEMPORARY)
this.formationPowerOld = this.formationPowerOld + allEquipAddProVal[HeroProType.WarPower]
LogPink("OLD TEAM POWER:"..this.formationPowerOld)
local allEquipAddProVal = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_TEMPORARY)--HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal)
this.formationPower = this.formationPower + allEquipAddProVal--[HeroProType.WarPower]
LogPink("NEW TEAM POWER:"..this.formationPower)
end

View File

@ -62,6 +62,7 @@ function this.FightBattle( callBack)
PrivilegeManager.RefreshPrivilegeUsedTimes(PRIVILEGE_TYPE.GUILD_CAR_DELEAY_LOOT, 1)
end
end
-- TODO: 没有战斗结果校验
NetManager.FastFightChallengeRequest(type,monsterId,function (msg)
this.score = msg.score

View File

@ -1724,8 +1724,8 @@ end
--计算英雄身上所有属性加成(包括装备就、异妖的加成)
--_type==1 计算当前英雄的所有属性 _type==2 根据_heroDid之后_breakId传过来的值进行计算 _isAllHeroProVal==true 团体加成综合 用字段_allHeroProVal
function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upStarId, _isAllHeroProVal, _allHeroProVal,formationHeroNum)
LogError(" ------- ------------ 原战斗计算方式不应调用 ----------- -------")
function this.CalculateHeroAllProValList(_type, _heroDid, isWar, _breakId, _upStarId, _isAllHeroProVal, _allHeroProVal,formationHeroNum, formationId)
-- LogRed(" ------- ------------ 原战斗计算方式不应调用 ----------- -------")
local curHeroData = this.GetSingleHeroData(_heroDid) or _heroDid
local curLvNum = curHeroData.lv
--添加该英雄装备的属性
@ -2079,10 +2079,10 @@ curHeroData.MLSproList={}
-- LogError("最后allAddProVal 3 "..i.." "..v)
-- end
--end
LogGreenTable(allAddProVal)
LogRed("原方式:"..allAddProVal[HeroProType.WarPower])
local power = HeroPowerManager.GetHeroPower(_heroDid, _allHeroProVal and FormationTypeDef.FORMATION_NORMAL or nil)
LogRed("新方式:"..power)
-- LogGreenTable(allAddProVal)
-- LogRed("原方式:"..allAddProVal[HeroProType.WarPower])
-- local power = HeroPowerManager.GetHeroPower(_heroDid, formationId)
-- LogRed("新方式:"..power)
return allAddProVal
end
@ -3381,48 +3381,6 @@ function this.ResetHero(dynamicloadId)
end
-- 创建用于计算英雄属性和战斗力的数据
function this.CreateHeroCountData(dId)
-- 默认数据
local heroData = {
dId = 0,
tId = 0,
lv = 1,
star = 1,
breakId = 1,
upStarId = 1,
skinId = 0,
equipList = {},
treasureList = {},
soulPrintList = {},
talismanLv = 1,
formationId = FormationTypeDef.FORMATION_NORMAL,
}
if not dId then
return heroData
end
local curHeroData = HeroManager.GetSingleHeroData(dId)
if not curHeroData then
return heroData
end
heroData.dId = curHeroData.dynamicId -- 动态id
heroData.tId = curHeroData.id -- 表id
heroData.lv = curHeroData.lv -- 等级
heroData.star = curHeroData.star -- 星级
heroData.breakId = curHeroData.breakId -- 突破id
heroData.upStarId = curHeroData.upStarId -- 升星id
heroData.skinId = curHeroData.skinId -- 皮肤id
heroData.equipList = EquipManager.GetHeroEquipsBydIds(curHeroData.dynamicId, curHeroData.equipIdList) -- 装备数据
heroData.treasureList = EquipTreasureManager.GetTreasuresBydIds(curHeroData.jewels) -- 宝器数据
heroData.soulPrintList = curHeroData.soulPrintList -- 魂印数据
heroData.talismanLv = curHeroData.talismanList -- 法宝等级
heroData.formationId = FormationTypeDef.FORMATION_NORMAL
return heroData
end
--神将合成
function this.ByCompoundHeroGetAllHeros()
local upSortHeroList = {}
@ -3801,9 +3759,9 @@ end
function this.UpdateSingleHeroWarPower(dynamicId)
if dynamicId and heroDatas[dynamicId] then
heroDatas[dynamicId].warPower = this.CalculateHeroAllProValList(1, dynamicId, false)[HeroProType.WarPower]
--LogGreen(heroDatas[dynamicId].heroConfig.ReadingName.." "..heroDatas[dynamicId].lv.." warPower ".. heroDatas[dynamicId].warPower)
HeroPropManager.SetHeroDirty(dynamicId)--SetDirtyByType(dynamicId, Hero_Prop_Type.Base)
-- heroDatas[dynamicId].warPower = this.CalculateHeroAllProValList(1, dynamicId, false)[HeroProType.WarPower]
-- LogGreen(heroDatas[dynamicId].heroConfig.ReadingName.." "..heroDatas[dynamicId].lv.." warPower ".. heroDatas[dynamicId].warPower)
end
end
@ -3932,8 +3890,12 @@ end
function this.CalculatePvpBonusForShow(data)
--因为后端无法区分是否为PVP所以前端处理把PVP伤害加成和减免从伤害加成和减免中去除
data[51] = data[51] - data[69]
data[52] = data[52] - data[70]
if data[51] and data[69] then
data[51] = data[51] - data[69] or 0
end
if data[52] and data[70] then
data[52] = data[52] - data[70] or 0
end
return data
end

View File

@ -7,19 +7,14 @@ local this = HeroPowerManager
--计算战斗力
local propToSS = {}
local function CalculateWarForce(powerVal)
local powerEndVal = 0
for i, v in pairs(powerVal) do
if v > 0 and i < HeroProType.WarPower then
if not propToSS[i] then
propToSS[i] = {Style = propertyConfig[i].Style, Score = propertyConfig[i].Score, TargetPropertyId = propertyConfig[i].TargetPropertyId}
end
-- 计算战斗
local power = v * propToSS[i].Score
-- 万分比要转为百分比
if propToSS[i].Style == 2 then
power = power / 100
end
local power = v * propertyConfig[i].Score
powerEndVal = powerEndVal + power
elseif v > 0 and i >= HeroProType.WarPower then
powerEndVal = powerEndVal + v
@ -27,6 +22,33 @@ local function CalculateWarForce(powerVal)
end
return math.floor(powerEndVal)
end
local function CalculateWarForce2(powerVal)
local powerEndVal = 0
local basePower = 0
local HighPower = 0
local extPower = 0
for i, v in pairs(powerVal) do
if v > 0 and i < HeroProType.WarPower then
if propertyConfig[i].IfShow == 1 then
if propertyConfig[i].TargetPropertyId == 0 then
basePower = basePower + v * propertyConfig[i].Score
-- Log(i.."|"..v.."|"..basePower)
end
elseif propertyConfig[i].IfShow == 2 then
-- 这里百分比数要转换成小数,用于计算战斗力
HighPower = HighPower + v/100
end
elseif v > 0 and i >= HeroProType.WarPower then
extPower = extPower + v
end
end
-- Log(basePower)
-- Log(HighPower)
-- Log(extPower)
powerEndVal = basePower * (1 + HighPower / 2) + extPower
return math.floor(powerEndVal)
end
function this.Initialize()
@ -47,17 +69,17 @@ end
-- 卸程计算每个人的战斗力
function this.CO_InitPower()
local heroList = HeroManager.GetAllHeroList()
LogRed("co start")
LogRed_Prop("co start")
for k, v in pairs(heroList) do
local power = this.GetHeroPower(v.dynamicId)
v.warPower = power
LogRed("heroPower : "..v.dynamicId .. "|"..power)
LogRed_Prop("heroPower : "..v.dynamicId .. "|"..power)
-- coroutine.yield()
end
this.IsInitAll = false
this.coInitPower = nil
LogRed("co end")
LogRed_Prop("co end")
end
@ -78,7 +100,7 @@ function this.CalPower(heroData, propList)
if subProp then
for i = 1, #subProp do
local propType = subProp[i][1]
local propValue = subProp[i][2]
local propValue = subProp[i][2]/100 -- 百分比数
if propList[propType] then
propList[propType] = propList[propType] - propValue
end
@ -88,37 +110,47 @@ function this.CalPower(heroData, propList)
-- 将百分比加成计算到人物身上
for k, v in pairs(propList) do
if k < HeroProType.WarPower then
if not propToSS[k] then
local config = propertyConfig[k]
propToSS[k] = {Style = config.Style, Score = config.Score, TargetPropertyId = config.TargetPropertyId}
end
local tpId = propToSS[k].TargetPropertyId
local tpId = propertyConfig[k].TargetPropertyId
if propList[k] > 0 and tpId > 0 then
if k ~= 69 and k ~= 70 then--PVP 增减伤 没有处理
if not propList[tpId] then
propList[tpId] = 0
end
propList[tpId] = math.floor( propList[tpId] + propList[tpId] * propList[k] / 10000)
propList[tpId] = math.floor( propList[tpId] + propList[tpId] * propList[k] / 100)
end
end
else
propList[k] = v
end
end
LogPinkTable(propList)
return CalculateWarForce(propList)
-- return CalculateWarForce2(propList)
end
-- 获取英雄战斗力
function this.GetHeroPower(dId, formationId)
LogYellow_Prop("++++++++++++++++++++++++++++++++++")
local heroData = HeroPropManager.CreateHeroCountData(dId)
LogRed_Prop("heroTID: "..heroData.tId)
-- 重新计算人物属性
local propList = HeroPropManager.GetHeroProp(dId, formationId)
--
-- 计算战斗力
local heroData = HeroManager.CreateHeroCountData(dId)
local allPower = this.CalPower(heroData, propList)
-- 旧战斗力
if HeroPropManager.IsDebug() then
local curHeroData = HeroManager.GetSingleHeroData(dId)
local oldProp = HeroManager.CalculateHeroAllProValList(1, dId, false)
local power = oldProp[HeroProType.WarPower]
if power ~= allPower then
LogGreenTable_Prop(REMOVE_ZERO_PROP(oldProp))
LogRed_Prop("GetHeroPower OldPower:"..tostring(power))
LogGreenTable_Prop(REMOVE_ZERO_PROP(propList))
LogRed_Prop("GetHeroPower NewPower:"..allPower)
end
end
LogYellow_Prop("++++++++++++++++++++++++++++++++++")
--
if not this.HeroPowerList[dId] then
this.HeroPowerList[dId] = {}

View File

@ -1,18 +1,29 @@
-- debug用
local IsDebug = false
local _IsDebug = false
local emptyFunc = function()end
Log_Prop = IsDebug and Log or emptyFunc
LogRed_Prop = IsDebug and LogRed or emptyFunc
LogBlue_Prop = IsDebug and LogBlue or emptyFunc
LogGreen_Prop = IsDebug and LogGreen or emptyFunc
LogPink_Prop = IsDebug and LogPink or emptyFunc
LogRedTable_Prop = IsDebug and LogRedTable or emptyFunc
LogBlueTable_Prop = IsDebug and LogBlueTable or emptyFunc
LogGreenTable_Prop = IsDebug and LogGreenTable or emptyFunc
LogPinkTable_Prop = IsDebug and LogPinkTable or emptyFunc
Log_Prop = _IsDebug and Log or emptyFunc
LogRed_Prop = _IsDebug and LogRed or emptyFunc
LogBlue_Prop = _IsDebug and LogBlue or emptyFunc
LogGreen_Prop = _IsDebug and LogGreen or emptyFunc
LogPink_Prop = _IsDebug and LogPink or emptyFunc
LogYellow_Prop = _IsDebug and LogYellow or emptyFunc
LogRedTable_Prop = _IsDebug and LogRedTable or emptyFunc
LogBlueTable_Prop = _IsDebug and LogBlueTable or emptyFunc
LogGreenTable_Prop = _IsDebug and LogGreenTable or emptyFunc
LogPinkTable_Prop = _IsDebug and LogPinkTable or emptyFunc
function REMOVE_ZERO_PROP(propList)
local list = {}
for k, v in pairs(propList) do
if v ~= 0 then
list[k] = v
end
end
return list
end
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
--
require("Modules.Hero.PropHero")
require("Modules.Hero.PropFunc")
@ -21,6 +32,9 @@ require("Modules.Hero.PropCondition")
HeroPropManager = {}
local this = HeroPropManager
function this.IsDebug()
return _IsDebug
end
-- 合并属性列表
local function DoubleTableCompound(allProVal, addProVal)
@ -39,7 +53,7 @@ end
function this.Initialize()
this.AllPropList = {}
this.HeroDataList = {}
this.HeroPropList = {} -- 角色自身属性
@ -63,21 +77,117 @@ function this.Initialize()
this.FuncPropList = {} -- 功能属性(作用于全体)
this.IsFuncDirty = {} -- 判断功能属性是否需要刷新
end
function this.ClearHeroData(dId)
if this.HeroPropList[dId] then
this.HeroPropList[dId] = {}
end
if this.IsHeroDirty[dId] then
this.IsHeroDirty[dId] = {}
end
if this.ConList[dId] then
this.ConList[dId] = {}
end
if this.ConPropList[dId] then
this.ConPropList[dId] = {}
end
if this.IsConPropDirty[dId] then
this.IsConPropDirty[dId] = {}
end
if this.TeamPropList[dId] then
this.TeamPropList[dId] = {}
end
if this.IsTeamPropDirty[dId] then
this.IsTeamPropDirty[dId] = {}
end
if this.ConTeamList[dId] then
this.ConTeamList[dId] = {}
end
if this.DePropList[dId] then
this.DePropList[dId] = {}
end
if this.IsDePropDirty[dId] then
this.IsDePropDirty[dId] = {}
end
if this.FormationPropList[dId] then
this.FormationPropList[dId] = {}
end
if this.IsFormationDirty[dId] then
this.IsFormationDirty[dId] = {}
end
if this.FuncPropList[dId] then
this.FuncPropList[dId] = {}
end
if this.IsFuncDirty[dId] then
this.IsFuncDirty[dId] = {}
end
end
--
function this.LateUpdate()
-- 创建用于计算英雄属性和战斗力的数据
function this.CreateHeroCountData(dId)
-- 判断是否是临时数据
if HeroTempPropManager.IsTempHeroID(dId) then
if HeroTempPropManager.IsTempHeroExist(dId) then
local tempData = HeroTempPropManager.GetTempHero(dId)
if tempData then
return tempData
end
end
assert(false, "是临时数据ID但未找到临时数据"..dId)
end
-- 判断是否有缓存
if this.HeroDataList[dId] then
return this.HeroDataList[dId]
end
-- 默认数据
local heroData = {
dId = 0,
tId = 0,
lv = 1,
star = 1,
breakId = 1,
upStarId = 1,
skinId = 0,
equipList = {},
treasureList = {},
soulPrintList = {},
talismanLv = 1,
formationId = FormationTypeDef.FORMATION_NORMAL,
}
if not dId then
return heroData
end
local curHeroData = HeroManager.GetSingleHeroData(dId)
if not curHeroData then
return heroData
end
heroData.dId = curHeroData.dynamicId -- 动态id
heroData.tId = curHeroData.id -- 表id
heroData.lv = curHeroData.lv -- 等级
heroData.star = curHeroData.star -- 星级
heroData.breakId = curHeroData.breakId -- 突破id
heroData.upStarId = curHeroData.upStarId -- 升星id
heroData.skinId = curHeroData.skinId -- 皮肤id
heroData.equipList = EquipManager.GetHeroEquipsBydIds(curHeroData.dynamicId, curHeroData.equipIdList) -- 装备数据
heroData.treasureList = EquipTreasureManager.GetTreasuresBydIds(curHeroData.jewels) -- 宝器数据
heroData.soulPrintList = curHeroData.soulPrintList -- 魂印数据
heroData.talismanLv = curHeroData.talismanList -- 法宝等级
heroData.formationId = FormationTypeDef.FORMATION_NORMAL
return heroData
end
function this.Get()
-- body
end
-- 获取神将属性
function this.GetHeroProp(dId, formationId)
-- 清空数据
this.HeroDataList[dId] = nil
this.HeroDataList[dId] = this.CreateHeroCountData(dId)
--
local allPropList = {}
-- 获取基础属性
Log_Prop("基础属性")
@ -92,15 +202,15 @@ function this.GetHeroProp(dId, formationId)
DoubleTableCompound(allPropList, conPropList)
-- 获取功能属性加成
local heroData = HeroManager.CreateHeroCountData(dId)
local heroData = this.CreateHeroCountData(dId)
local funcProp = this.GetAllFuncProp(heroData,formationId)
Log_Prop("功能属性")
LogGreenTable_Prop(funcProp)
DoubleTableCompound(allPropList, funcProp)
-- 计算减益属性
Log_Prop("减益属性")
this.CountDeProp(dId, allPropList)
-- Log_Prop("减益属性")
-- this.CountDeProp(dId, allPropList)
-- 判断是否需要加入团队属性加成
@ -140,6 +250,14 @@ function this.GetHeroProp(dId, formationId)
-- 没有元素共鸣
end
-- 万分比转为百分比,这里处理用于兼容显示
for i, v in pairs(allPropList) do
if v > 0 and i < HeroProType.WarPower then
if propertyConfig[i].Style == 2 then
allPropList[i] = allPropList[i] / 100
end
end
end
Log_Prop("总属性")
LogGreenTable_Prop(allPropList)
@ -165,7 +283,7 @@ function this.RefreshHeroProp(dId)
if this.IsHeroDirty[dId].isDirty ~= false then
-- 创建计算属性的数据
local list = {}
local cData = HeroManager.CreateHeroCountData(dId)
local cData = this.CreateHeroCountData(dId)
for _, powerType in pairs(Hero_Prop_Type) do
--
local propList, conList, teamPropList, conTeamList, dePropList
@ -297,7 +415,7 @@ function this.GetConditionProp(dId)
if this.IsConPropDirty[dId].isDirty ~= false then
-- 创建计算属性的数据
local list = {}
local cData = HeroManager.CreateHeroCountData(dId)
local cData = this.CreateHeroCountData(dId)
for _, powerType in pairs(Hero_Prop_Type) do
if this.IsConPropDirty[dId][powerType] ~= false then
local condProp = {}
@ -390,8 +508,8 @@ end
function this.GetConditionTeamData(dId, tdId)
local list = {}
if this.ConTeamList[dId] then
local dData = HeroManager.CreateHeroCountData(dId)
local tdData = HeroManager.CreateHeroCountData(tdId)
local dData = this.CreateHeroCountData(dId)
local tdData = this.CreateHeroCountData(tdId)
for powerType, conds in pairs(this.ConTeamList[dId]) do
for _, cond in ipairs(conds) do
if Condition_Prop_Func[cond.type] then
@ -422,7 +540,7 @@ function this.CountDeProp(dId, allPropList)
for _, prop in ipairs(props) do
local id = prop.propId
local v = prop.value
LogGreenTable_Prop(string.format("%s|%s", id, v))
Log_Prop(string.format("%s|%s", id, v))
allPropList[id] = allPropList[id] * (1 - v / 10000)
end
end
@ -436,7 +554,7 @@ end
-- 刷新编队数据
function this.RefreshFormationProp(formationId)
if this.IsFormationDirty[formationId] ~= false then
local teamAddPro = FormationManager.GetFormationElementAdd(FormationTypeDef.FORMATION_NORMAL)
local teamAddPro = FormationManager.GetFormationElementAdd(formationId)
this.FormationPropList[formationId] = teamAddPro
this.IsFormationDirty[formationId] = false
end

View File

@ -1,158 +1,65 @@
-- debug用
local IsDebug = false
local emptyFunc = function()end
Log_Prop = IsDebug and Log or emptyFunc
LogRed_Prop = IsDebug and LogRed or emptyFunc
LogBlue_Prop = IsDebug and LogBlue or emptyFunc
LogGreen_Prop = IsDebug and LogGreen or emptyFunc
LogPink_Prop = IsDebug and LogPink or emptyFunc
LogRedTable_Prop = IsDebug and LogRedTable or emptyFunc
LogBlueTable_Prop = IsDebug and LogBlueTable or emptyFunc
LogGreenTable_Prop = IsDebug and LogGreenTable or emptyFunc
LogPinkTable_Prop = IsDebug and LogPinkTable or emptyFunc
--
require("Modules.Hero.PropHero")
require("Modules.Hero.PropFunc")
require("Modules.Hero.PropCondition")
HeroTempPropManager = {}
local this = HeroTempPropManager
-- 合并属性列表
local function DoubleTableCompound(allProVal, addProVal)
if addProVal and LengthOfTable(addProVal) > 0 then
for k, v in pairs(addProVal) do
if v > 0 then
if allProVal[k] then
allProVal[k] = allProVal[k] + v
else
allProVal[k] = v
end
end
end
end
end
function this.Initialize()
this.TempHeroDatas = {}
end
-- 根据heroData获取人物属性
function this.GetHeroProp(heroData, formationData)
local allPropList = {}
-- 获取基础属性
local basePropList, conPropList, teamPropList, conTeamPropList, dePropList = this.GetBaseProp(heroData)
Log_Prop("基础属性")
LogGreenTable_Prop(basePropList)
DoubleTableCompound(allPropList, basePropList)
--
Log_Prop("自身条件属性")
LogGreenTable_Prop(conPropList)
DoubleTableCompound(allPropList, conPropList)
-- 计算减益属性
Log_Prop("减益属性")
this.CountDeProp(dePropList, allPropList)
-- 团队属性加成
Log_Prop("团队属性")
LogGreenTable_Prop(teamPropList)
DoubleTableCompound(allPropList, teamPropList)
-- 团队条件属性加成
Log_Prop("团队条件属性")
LogGreenTable_Prop(conTeamPropList)
DoubleTableCompound(allPropList, conTeamPropList)
Log_Prop("总属性")
LogGreenTable_Prop(allPropList)
return allPropList
-- 临时数据的生成规则
function this.GetTempHeroID(dId)
return "TEMP_"..dId
end
---=================== 基础属性======================================
-- 获取基础属性
function this.GetBaseProp(heroData)
local basePropList = {}
local conPropList = {}
local teamPropList = {}
local conTeamPropList = {}
local dePropList = {}
for _, powerType in pairs(Hero_Prop_Type) do
LogGreen_Prop(_)
--
-- 判断该类型数据是否需要刷新
if Hero_Prop_Func[powerType] then
-- 计算属性
local propList, conList, tPropList, conTeamList, deProps = Hero_Prop_Func[powerType](heroData)
if propList then
DoubleTableCompound(basePropList, propList)
end
LogPink_Prop("base")
LogPinkTable_Prop(propList)
-- 条件属性
if conList then
LogPink_Prop("con")
for _, cond in ipairs(conList) do
if Condition_Prop_Func[cond.type] then
local propList = Condition_Prop_Func[cond.type](heroData, heroData, cond.propList, cond.args)
DoubleTableCompound(conPropList, propList)
LogPinkTable_Prop(propList)
end
end
end
-- 对编队中其他人的数据
if teamPropList then
DoubleTableCompound(teamPropList, tPropList)
LogPink_Prop("team")
LogPinkTable_Prop(tPropList)
end
-- 对编队中其他人的数据
if conTeamList then
LogPink_Prop("conteam")
for _, cond in ipairs(conTeamList) do
if Condition_Prop_Func[cond.type] then
local propList = Condition_Prop_Func[cond.type](heroData, heroData, cond.propList, cond.args)
DoubleTableCompound(conTeamPropList, propList)
LogPinkTable_Prop(propList)
end
end
end
-- 减益属性
if dePropList then
for _, deProp in ipairs(deProps) do
table.insert(dePropList, deProp)
end
LogPink_Prop("deprop")
LogPinkTable_Prop(deProps)
end
end
-- 判断是否是临时数据
function this.IsTempHeroID(tempId)
if startWith(tempId, "TEMP_") then
return true
end
return basePropList, conPropList, teamPropList, conTeamPropList, dePropList
return false
end
-- 复制一个神将数据,不影响原数据
function this.CreateTempHero(dId)
if this.IsTempHeroID(dId) then
assert(false, "正在尝试复制一条临时数据")
return
end
local tempId = this.GetTempHeroID(dId)
-- 清空缓存
this.ClearTempHero(tempId)
-- 复制属性
local tempData = Table_DeepCopy(HeroPropManager.CreateHeroCountData(dId))
-- 保存
tempData.dId = tempId
this.TempHeroDatas[tempId] = tempData
return tempId, tempData
end
-- 判断数据是否存在
function this.IsTempHeroExist(tempId)
if this.TempHeroDatas[tempId] then
return true
end
return false
end
-- 获取临时英雄数据
function this.GetTempHero(tempId)
return this.TempHeroDatas[tempId]
end
-- 清空缓存数据
function this.ClearTempHero(tempId)
this.TempHeroDatas[tempId] = nil
HeroPropManager.ClearHeroData(tempId)
end
-- 计算减益
function this.CountDeProp(dePropList, allPropList)
if dePropList then
for _, prop in ipairs(dePropList) do
local id = prop.propId
local v = prop.value
LogGreenTable_Prop(string.format("%s|%s", id, v))
allPropList[id] = allPropList[id] * (1 - v / 10000)
end
-- 获取临时英雄属性
function this.GetTempHeroProp(tempId, formationId)
if this.IsTempHeroExist(tempId) then
return HeroPropManager.GetHeroProp(tempId, formationId)
end
end
-- 获取临时英雄属性
function this.GetTempHeroPower(tempId, formationId)
if this.IsTempHeroExist(tempId) then
return HeroPowerManager.GetHeroPower(tempId, formationId)
end
end
return HeroPropManager
return HeroTempPropManager

View File

@ -3,8 +3,8 @@
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
Condition_Prop_Type = {
LV_100 = 1,
ELE_TEAM_ADD = 2,
LV_100 = 1, -- 100级生效的属性
ELE_TEAM_ADD = 2, -- 元素属性
}
@ -27,7 +27,7 @@ Condition_Prop_Func = {
--
local config = heroConfig[target.tId]
-- 判断元素是否符合条件
if config and args and config == args[4] then
if config and args and config.PropertyName == tonumber(args[1]) then
return propList
end
end

View File

@ -2,10 +2,13 @@
local HeroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
-- 功能属性类型
Func_Prop_Type = {
Vip = 2,
GuildSkill = 3,
Pokemon = 4,
PokemonFetter = 5
Vip = 2, -- VIP加成
GuildSkill = 3, -- 公会技能
Pokemon = 4, -- 灵兽
PokemonFetter = 5, -- 灵兽羁绊
HeroFetter = 6, -- 神将羁绊
HunYinFetter = 7, -- 魂印羁绊
Practice = 8, -- 修行
}
-- 计算需要缓存数据的方法
@ -37,6 +40,21 @@ Func_Prop_Func = {
local allPro = PokemonManager.GetAllPokemonFetterAddPros()
return allPro
end,
-- 神将羁绊属性加成
[Func_Prop_Type.HeroFetter] = function()
local allPro = TianShuMiJuanManger.GetAllFetterAddProsBy(1)
return allPro
end,
-- 魂印羁绊属性加成
[Func_Prop_Type.HunYinFetter] = function()
local allPro = TianShuMiJuanManger.GetAllFetterAddProsBy(2)
return allPro
end,
-- 修行属性加成
[Func_Prop_Type.Practice] = function()
local allPro = PracticeManager.GetCurAllGetAdd()
return allPro
end,
}
@ -69,4 +87,16 @@ Func_Prop_Filter = {
[Func_Prop_Type.PokemonFetter] = function(funcData, heroData)
return funcData
end,
-- 神将羁绊属性加成
[Func_Prop_Type.HeroFetter] = function(funcData, heroData)
return funcData
end,
-- 魂印羁绊属性加成
[Func_Prop_Type.HunYinFetter] = function(funcData, heroData)
return funcData
end,
-- 修行属性加成
[Func_Prop_Type.Practice] = function(funcData, heroData)
return funcData
end,
}

View File

@ -10,17 +10,13 @@ local jewelResonanceConfig = ConfigManager.GetConfig(ConfigName.JewelResonanceCo
local passiveSkillLogicConfig = ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
Hero_Prop_Type = {
Base = 0,
Equip = 1,
EquipTreasure = 2,
PassiveSkill = 4,
Talisman = 5,
SoulPrint = 6,
SkinAdd = 7,--皮肤
-- GuildSkill = 8,--公会技能
-- ElementAdd = 9,--光环
-- VipAdd = 10,--vip加成
-- Pokemon = 11,--灵兽加成
Base = 0, -- 基础属性,自身成长
Equip = 1, -- 装备
EquipTreasure = 2, -- 宝物
PassiveSkill = 4, -- 被动,天赋
Talisman = 5, -- 法宝
SoulPrint = 6, -- 魂印
SkinAdd = 7, -- 皮肤
}

View File

@ -356,7 +356,7 @@ function this.InitSingleEndlessHero(_msgHeroData)
heroData.harmonyGongMing = _msgHeroData.createtype
this.heroDataLists[heroData.dynamicId] = heroData
heroData.warPower = HeroManager.CalculateHeroAllProValList(1, heroData.dynamicId, false)[HeroProType.WarPower]
heroData.warPower = HeroPowerManager.GetHeroPower(heroData.dynamicId)--HeroManager.CalculateHeroAllProValList(1, heroData.dynamicId, false)[HeroProType.WarPower]
end
--宝器

View File

@ -1026,9 +1026,7 @@ function this.GetMapTeamPower()
end
if curFormation[i].allProVal[2] > 0 then
local allEquipAddProVal = 0
allEquipAddProVal = HeroPowerManager.GetHeroPower(heroData.dynamicId)
powerNum = powerNum + allEquipAddProVal[HeroProType.WarPower]
powerNum = powerNum + HeroPowerManager.GetHeroPower(heroData.dynamicId)
end
end
end

View File

@ -464,8 +464,9 @@ function this.GetFriendHelpHeros(trailType,func)
tempdata.player = v
tempdata.hero = this.UpdateHeroDatas(v.hero,v)
table.insert(this.friendHelpHeros[v.trailType],tempdata)
local allAddProVal = HeroManager.CalculateHeroAllProValList(1, tempdata.hero, false)
tempdata.hero.warPower = allAddProVal[HeroProType.WarPower]
local power = HeroPowerManager.GetHeroPower(tempdata.hero)
-- local allAddProVal = HeroManager.CalculateHeroAllProValList(1, tempdata.hero, false)
tempdata.hero.warPower = power--allAddProVal[HeroProType.WarPower]
end
if func then
func(this.friendHelpHeros[trailType])
@ -488,8 +489,9 @@ function this.SetFriendHelpHero(helpFightList,trailType)
end
this.friendHelpHero[v.trailType].player = v
this.friendHelpHero[v.trailType].hero = this.UpdateHeroDatas(v.hero,v)
local allAddProVal = HeroManager.CalculateHeroAllProValList(1, this.friendHelpHero[v.trailType].hero, false)
this.friendHelpHero[v.trailType].hero.warPower = allAddProVal[HeroProType.WarPower]
-- local allAddProVal = HeroManager.CalculateHeroAllProValList(1, this.friendHelpHero[v.trailType].hero, false)
local power = HeroPowerManager.GetHeroPower(v.hero.dynamicId)
this.friendHelpHero[v.trailType].hero.warPower = power -- allAddProVal[HeroProType.WarPower]
end
else
if not this.friendHelpHero then
@ -535,8 +537,9 @@ function this.SetFriendHelpHero(helpFightList,trailType)
this.friendHelpHero[trailType].player = helpFightList
this.friendHelpHero[trailType].hero = this.UpdateHeroDatas(helpFightList.hero,helpFightList)
local allAddProVal = HeroManager.CalculateHeroAllProValList(1, this.friendHelpHero[trailType].hero, false)
this.friendHelpHero[trailType].hero.warPower = allAddProVal[HeroProType.WarPower]
-- local allAddProVal = HeroManager.CalculateHeroAllProValList(1, this.friendHelpHero[trailType].hero, false)
local power = HeroPowerManager.GetHeroPower(helpFightList.hero.dynamicId)
this.friendHelpHero[trailType].hero.warPower = power -- allAddProVal[HeroProType.WarPower]
else
this.friendHelpHero[trailType] = nil
end

View File

@ -754,11 +754,12 @@ function this.HeroLvUpEvent(heroId, upLv,oldLv, func)
--远征初始化血量
ExpeditionManager.InitHeroHpValue(heroId)
end
-- 基础属性重新计算
HeroPropManager.SetDirtyByType(heroId, Hero_Prop_Type.Base)
--
if func then
func(msg)
end
end)
end
--请求英雄升星
@ -793,11 +794,11 @@ function this.HeroUpStarEvent(heroId, consumeMaterials, func)
local data = buffer:DataByte()
local msg = CommonProto_pb.Drop()
msg:ParseFromString(data)
-- 基础属性重新计算
HeroPropManager.SetDirtyByType(heroId, Hero_Prop_Type.Base)
if func then
func(msg)
end
end)
end
@ -4753,8 +4754,11 @@ function this.PokemonBookEnableRequest(id,func)
msg:ParseFromString(data)
if func then
func(msg)
end --设置战斗力脏数据
end
--设置战斗力脏数据
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.PokemonFetter)
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.HeroFetter)
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.HunYinFetter)
end)
end
function this.XiaoyaoyouGetHeroRequest(id,func)
@ -5332,6 +5336,8 @@ function this.UpPracticeLevelRequest(func)
local msg = HeroInfoProto_pb.UpPracticeLevelResponse()
msg:ParseFromString(data)
PracticeManager.UpdataFromServer(msg.practiceLevel)
--
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.Practice)
if func then
func(msg)
end

View File

@ -298,8 +298,8 @@ end
--获取所有灵兽羁绊总和属性 (羁绊属性直接加在团队属性上)
function this.GetAllPokemonFetterAddPros()
return TianShuMiJuanManger.GetAllFetterAddProsBy(3)
end
end
----获取所有灵兽羁绊总和静态战力
function this.GetAllPokemonFetterAddProsSWarPower()
return TianShuMiJuanManger.GetAllPokemonFetterAddProsSWarPower(3)
@ -329,6 +329,7 @@ function this.GetAllPokemonFormationData()
-- end
return pokemonFormation
end
--获取编队灵兽静态id list
function this.GetAllPokemonFormationSids()
local formationSids = {}

View File

@ -83,10 +83,9 @@ function this.RefreshFormation()
end
local allEquipAddProVal
function this.CalculateAllHeroPower(curHeroData)
allEquipAddProVal = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
powerNum = powerNum + allEquipAddProVal[HeroProType.WarPower]
powerNum = powerNum + HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
end
--界面关闭时调用(用于子类重写)

View File

@ -270,16 +270,13 @@ function this.RoleInfo1()
allAddProVal = curHeroData.allAddProVal
else
-- allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId, formationId)
local WarPower
if choosedList then
-- local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(choosedList,curHeroData.dynamicId)
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal,formationHeroNum)
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId,FormationTypeDef.FORMATION_NORMAL)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
else
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,false,{},formationHeroNum)
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
end
end
this.atk.text = allAddProVal[HeroProType.Attack]

View File

@ -646,13 +646,10 @@ function this:UpdateHeroInfoData()
this.talentTipStr.text = ""
end
end
local allAddProVal = {}
local WarPower = 0
if isUpZhen then
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
else
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId)
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
end
@ -680,20 +677,17 @@ function this:ChangeCurentHeroSkinLive(herodata)
-- 临时保存皮肤位置
curHeroPosition = herodata.Position
else
local allAddProVal = {}
local WarPower
if isUpZhen then
-- local formationList = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
-- local allHeroTeamAddProVal = HeroManager.GetAllHeroTeamAddProVal(formationList.teamHeroInfos,curHeroData.dynamicId)
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false,nil,nil,true,allHeroTeamAddProVal)
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
else
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
-- allAddProVal = HeroManager.CalculateHeroAllProValList(1,curHeroData.dynamicId,false)
end
this.force.text = WarPower--allAddProVal[HeroProType.WarPower]
this.force.text = WarPower
this.curLiveObj=HeroManager.LoadHerolive(curHeroData,this.curObj)
-- 清空临时保存的皮肤位置
curHeroPosition = nil

View File

@ -1,4 +1,5 @@
require("Base/BasePanel")

local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)require("Base/BasePanel")
RoleProInfoPopup = Inherit(BasePanel)
local this=RoleProInfoPopup
local sDataTable = {
@ -14,6 +15,8 @@ local thirdlyProGoList = {}
local allAddProVal
local heroSConFig
local isShowGuild = true
local ProGoList
--初始化组件(用于子类重写)
function RoleProInfoPopup:InitComponent()
this.spLoader = SpriteLoader.New()
@ -24,6 +27,65 @@ function RoleProInfoPopup:InitComponent()
this.secondGrid=Util.GetGameObject(self.gameObject, "grid/ver/recordPer (2)/Mask")
this.thirdlyGrid=Util.GetGameObject(self.gameObject, "grid/ver/recordPer (3)/Mask")
this.thirdlyGridP=Util.GetGameObject(self.gameObject, "grid/ver/recordPer (3)")
if not ProGoList then
-- 构建数据
local ProDataList = {}
for _, propConfig in ConfigPairs(propertyConfig) do
if propConfig.IfShow == 1 or propConfig.IfShow == 2 then
table.insert(ProDataList, propConfig)
end
end
table.sort(ProDataList, function (a,b)return a.SortId < b.SortId end)
-- 构建显示节点
ProGoList = {}
local FirstIndex = 0
local SecondIndex = 0
local curFirstPre, curSecondPre
for _, propConfig in ipairs(ProDataList) do
local propId = propConfig.PropertyId
if propConfig.IfShow == 1 then
if FirstIndex == 0 then
curFirstPre = newObjToParent(this.proPre1, this.fristGrid)
Util.GetGameObject(curFirstPre, "pro1"):SetActive(false)
Util.GetGameObject(curFirstPre, "pro2"):SetActive(false)
end
local pro = Util.GetGameObject(curFirstPre, "pro"..FirstIndex+1)
pro:SetActive(true)
ProGoList[propId] = {
propName = Util.GetGameObject(pro, "proName"):GetComponent("Text"),
propValue = Util.GetGameObject(pro, "proVale"):GetComponent("Text")
}
FirstIndex = (FirstIndex + 1) % 2
elseif propConfig.IfShow == 2 then
if SecondIndex == 0 then
curSecondPre = newObjToParent(this.proPre1, this.secondGrid)
Util.GetGameObject(curSecondPre, "pro1"):SetActive(false)
Util.GetGameObject(curSecondPre, "pro2"):SetActive(false)
end
local pro = Util.GetGameObject(curSecondPre, "pro"..SecondIndex+1)
pro:SetActive(true)
ProGoList[propId] = {
propName = Util.GetGameObject(pro, "proName"):GetComponent("Text"),
propValue = Util.GetGameObject(pro, "proVale"):GetComponent("Text")
}
SecondIndex = (SecondIndex + 1) % 2
end
end
-- 公会数据节点
this.guildPre = newObjToParent(this.proPre2, this.thirdlyGrid)
this.jumpBtn = Util.GetGameObject(this.guildPre, "jumpBtn")
this.guildProName = Util.GetGameObject(this.guildPre, "proName"):GetComponent("Text")
this.guildProValue = Util.GetGameObject(this.guildPre, "proVale"):GetComponent("Text")
end
end
--绑定事件(用于子类重写)
@ -32,167 +94,42 @@ function RoleProInfoPopup:BindEvent()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
Util.AddOnceClick(this.jumpBtn, function()
JumpManager.GoJump(73001)
end)
end
local guildSkill = nil
-- 设置属性显示
function RoleProInfoPopup.SetProShow(go, id, value)
go.propName.text = GetLanguageStrById(propertyConfig[id].Info)..":"
value = value or 0
if propertyConfig[id].Style == 1 then
go.propValue.text = GetPropertyFormatStr(propertyConfig[id].Style, value)
elseif propertyConfig[id].Style == 2 then
go.propValue.text = GetPropertyFormatStr(propertyConfig[id].Style, value*100)
end
end
--界面打开时调用(用于子类重写)
function RoleProInfoPopup:OnOpen(_allAddProVal,_configData,_isShowGuild,_guildSkill)
local allAddProVal = {}
for _proId, _val in pairs(_allAddProVal) do
if propertyConfig[_proId] and propertyConfig[_proId].SortId > 0 then
local data = {}
data.proId = _proId
data.val = _val
data.sort = propertyConfig[_proId].SortId
table.insert(allAddProVal,data)
end
end
table.sort(allAddProVal,function (a,b)
return propertyConfig[a.proId].SortId < propertyConfig[b.proId].SortId
end)
heroSConFig = _configData
isShowGuild = _isShowGuild--图鉴不显示公会技能等级特殊操作
guildSkill = _guildSkill and _guildSkill or nil--其他玩家公会技能等级特殊操作
for i = 1, #sDataTable do
allPro[i] = {}
end
--加基础 和 辅助属性
for index, value in ipairs(allAddProVal) do
if propertyConfig[value.proId] then
if propertyConfig[value.proId].IfShow ~= 0 then
local curLength = #allPro[propertyConfig[value.proId].IfShow] > 0 and #allPro[propertyConfig[value.proId].IfShow] or 1
if not allPro[propertyConfig[value.proId].IfShow][curLength] then
allPro[propertyConfig[value.proId].IfShow][curLength] = {}
table.insert(allPro[propertyConfig[value.proId].IfShow][curLength],{proId = value.proId,proVal = value.val})
elseif allPro[propertyConfig[value.proId].IfShow][curLength] and #allPro[propertyConfig[value.proId].IfShow][curLength] < 2 then
table.insert(allPro[propertyConfig[value.proId].IfShow][curLength],{proId = value.proId,proVal = value.val})
elseif allPro[propertyConfig[value.proId].IfShow][curLength] and #allPro[propertyConfig[value.proId].IfShow][curLength] >= 2 then
allPro[propertyConfig[value.proId].IfShow][curLength + 1] = {}
table.insert(allPro[propertyConfig[value.proId].IfShow][curLength + 1],{proId = value.proId,proVal = value.val})
end
end
end
-- 设置属性显示
for _proId, go in pairs(ProGoList) do
this.SetProShow(go, _proId, _allAddProVal[_proId])
end
if isShowGuild then
this.thirdlyGridP:SetActive(_isShowGuild)
if _isShowGuild then
--加公会技能特殊属性
allPro[3][1] = {}
local allLv = isShowGuild and GuildSkillManager.GetAllGuildSkillLv(heroSConFig.Profession) or 0
if guildSkill then allLv = guildSkill end
table.insert(allPro[3][1],{proId = Language[11061]..GuildSkillType[heroSConFig.Profession],proVal = allLv})
--for i = 1, #allPro do
-- for j = 1, #allPro[i] do
-- for k = 1, #allPro[i][j] do
-- --LogGreen("allPro[i][j][k] "..allPro[i][j][k].proId.." "..allPro[i][j][k].proVal)
-- end
-- end
--end
end
this.ShowPanelData()
end
function this.ShowPanelData()
this.GridShowData(1,allPro[1],fristProGoList, this.proPre1,this.fristGrid)
this.GridShowData(2,allPro[2],secondProGoList, this.proPre1,this.secondGrid)
if isShowGuild then
this.GridShowData(3,allPro[3],thirdlyProGoList, this.proPre2,this.thirdlyGrid)
end
this.thirdlyGridP:SetActive(isShowGuild)
end
function this.GridShowData(type,curAllPro,curProGoList,curPre,curGrid)
for i = 1, math.max(#curAllPro, #curProGoList) do
local go = curProGoList[i]
if not go then
go = newObject(curPre)
go.transform:SetParent(curGrid.transform)
go.transform.localScale = Vector3.one
go.transform.localPosition = Vector3.zero
curProGoList[i] = go
end
go.gameObject:SetActive(false)
end
for i = 1, #curAllPro do
this.SingleProShowData(type,curAllPro[i],curProGoList[i])
local allLv = _isShowGuild and GuildSkillManager.GetAllGuildSkillLv(_configData.Profession) or 0
if _guildSkill then allLv = _guildSkill end
this.guildProName.text = Language[11061]..GuildSkillType[_configData.Profession]
this.guildProValue.text = allLv
-- 跳转按钮如果设置的公会技能等级,说明是别人,就不显示跳转
this.jumpBtn:SetActive(_guildSkill == nil)
end
end
function this.SingleProShowData(type,data,go)
go:SetActive(true)
if type == 3 then
Util.GetGameObject(go, "proName"):GetComponent("Text").text = data[1].proId..":"
Util.GetGameObject(go, "proVale"):GetComponent("Text").text = data[1].proVal
if guildSkill then
Util.GetGameObject(go, "jumpBtn"):SetActive(false)
else
Util.GetGameObject(go, "jumpBtn"):SetActive(true)
end
Util.AddOnceClick(Util.GetGameObject(go, "jumpBtn"), function()
JumpManager.GoJump(73001)
end)
else
for i = 1, 2 do
local curGo =go .transform:GetChild(i-1).gameObject
if #data > 1 then
curGo:SetActive(true)
--LogGreen("data.proId "..data[i].proId.." "..data[i].proVal)
Util.GetGameObject(curGo, "proName"):GetComponent("Text").text = GetLanguageStrById(propertyConfig[data[i].proId].Info)..":"
local proVale = Util.GetGameObject(curGo, "proVale"):GetComponent("Text")
if propertyConfig[data[i].proId].Style==1 then--绝对值
proVale.text = GetPropertyFormatStr(propertyConfig[data[i].proId].Style, data[i].proVal)
elseif propertyConfig[data[i].proId].Style==2 then--百分百
proVale.text = GetPropertyFormatStr(propertyConfig[data[i].proId].Style, data[i].proVal*100)
end
else
curGo:SetActive(false)
end
end
end
end
--function this.ShowProValPanelData()
-- local allProKeys={}
-- for k, v in pairs(allPro) do
-- if k~=1000 and (propertyConfig[k].IfShow==0) then
-- local singleProData={}
-- singleProData.id=k
-- singleProData.val=v
-- table.insert(allProKeys,singleProData)
-- end
-- end
-- table.sort(allProKeys, function (a,b)return a.id<b.id end)
-- for i = 1, #allProKeys do
-- local id = allProKeys[i].id
-- local val = allProKeys[i].val
-- local go = allProGoList[i]
-- if not go then
-- go = newObject(this.proPre)
-- go.transform:SetParent(this.proValRect.transform)
-- go.transform.localScale = Vector3.one
-- go.transform.localPosition = Vector3.zero
-- go:SetActive(true)
-- allProGoList[i] = go
-- end
-- go:GetComponent("Text").text = propertyConfig[id].Info
-- if propertyConfig[id].Style==1 then--绝对值
-- Util.GetGameObject(go.transform, "proVal"):GetComponent("Text").text = GetPropertyFormatStr(propertyConfig[id].Style, val)
-- elseif propertyConfig[id].Style==2 then--百分百
-- Util.GetGameObject(go.transform, "proVal"):GetComponent("Text").text = GetPropertyFormatStr(propertyConfig[id].Style, val*100)
-- end
-- end
-- --加公会技能加成显示
-- local go = allProGoList[#allProKeys + 1]
-- if not go then
-- go = newObject(this.proPre)
-- go.transform:SetParent(this.proValRect.transform)
-- go.transform.localScale = Vector3.one
-- go.transform.localPosition = Vector3.zero
-- go:SetActive(true)
-- allProGoList[#allProKeys + 1] = go
-- end
-- go:GetComponent("Text").text = "公会技能-"..GuildSkillType[heroSConFig.Profession]
-- local allLv,isEqualityLv = GuildSkillManager.GetAllGuildSkillLv(heroSConFig.Profession)
-- Util.GetGameObject(go.transform, "proVal"):GetComponent("Text").text = allLv
--end
--界面关闭时调用(用于子类重写)
function RoleProInfoPopup:OnClose()
@ -201,9 +138,8 @@ end
--界面销毁时调用(用于子类重写)
function RoleProInfoPopup:OnDestroy()
this.spLoader:Destroy()
fristProGoList = {}
secondProGoList = {}
thirdlyProGoList = {}
ProGoList = nil
end
return RoleProInfoPopup

View File

@ -59,7 +59,15 @@ function RoleUpLvBreakSuccessPanel:OnOpen(...)
-- this.upLvMaskPanleProSpeed.text= oldLvAllAddProVal[HeroProType.Speed]
--计算面板属性cur
-- local curLvAllAddProVal=HeroManager.CalculateHeroAllProValList(2,curHeroData.dynamicId,false,nextHeroBreakId,curHeroData.upStarId)
local curLvAllAddProVal,curPower = HeroPowerManager.GetNextHeroPower(curHeroData.dynamicId, nil,nextHeroBreakId ,curHeroData.upStarId)
-- local curLvAllAddProVal,curPower = HeroPowerManager.GetNextHeroPower(curHeroData.dynamicId, nil,nextHeroBreakId ,curHeroData.upStarId)
-- 生成一个临时英雄数据,使用完成后需主动清理
local tempDId, tempData = HeroTempPropManager.CreateTempHero(curHeroData.dynamicId)
tempData.upStarId = curHeroData.upStarId
tempData.breakId = nextHeroBreakId
local curLvAllAddProVal = HeroTempPropManager.GetTempHeroProp(tempDId)
HeroTempPropManager.ClearTempHero(tempDId)-- 清理
this.upLvMaskPanleNextProAtk.text=curLvAllAddProVal[HeroProType.Attack]
this.upLvMaskPanleNextProHp.text=curLvAllAddProVal[HeroProType.Hp]
this.upLvMaskPanleNextProPhyDef.text=curLvAllAddProVal[HeroProType.PhysicalDefence]

View File

@ -292,8 +292,16 @@ function RoleUpStarLayout:UpdateHeroUpStarProUpShow()
if nextUpStarConFig then nextProUpVal = nextUpStarConFig.PropertiesDisplay end
--this.proUpVal.text = GetPropertyFormatStr(2, nextProUpVal)
--this.UpdateHeroUpStarProUpSkillShow(this.skillInfoGrid,self:NextStarUpSkillTabs())
local nextallAddProVal,curPower = HeroPowerManager.GetNextHeroPower(curHeroData.dynamicId, nil,curHeroData.breakId ,upStarRankUpConfig.Id)
-- local nextallAddProVal=HeroManager.CalculateHeroAllProValList(2,curHeroData.dynamicId,false,curHeroData.breakId,upStarRankUpConfig.Id)
-- local nextallAddProVal,curPower = HeroPowerManager.GetNextHeroPower(curHeroData.dynamicId, nil,curHeroData.breakId ,upStarRankUpConfig.Id)
-- 生成一个临时英雄数据,使用完成后需主动清理
local tempDId, tempData = HeroTempPropManager.CreateTempHero(curHeroData.dynamicId)
tempData.upStarId = upStarRankUpConfig.Id
tempData.breakId = curHeroData.breakId
local nextallAddProVal = HeroTempPropManager.GetTempHeroProp(tempDId)
HeroTempPropManager.ClearTempHero(tempDId)-- 清理
this:ProShow(this.atkPro_UpStar,allAddProVal,HeroProType.Attack,nextallAddProVal)
this:ProShow(this.hpPro_UpStar,allAddProVal,HeroProType.Hp,nextallAddProVal)
this:ProShow(this.phyDef_UpStar,allAddProVal,HeroProType.PhysicalDefence,nextallAddProVal)

View File

@ -140,7 +140,13 @@ function RoleUpStarSuccessPanel:OnOpen(...)
this.upLvMaskPanleProSpeed.text= oldLvAllAddProVal[HeroProType.Speed]
--计算面板属性cur
-- local curLvAllAddProVal=HeroManager.CalculateHeroAllProValList(2,curHeroData.dynamicId,false,curHeroData.breakId,nextHeroUpStarId)
local curLvAllAddProVal,curPower = HeroPowerManager.GetNextHeroPower(curHeroData.dynamicId, nil,curHeroData.breakId,nextHeroUpStarId)
-- 生成一个临时英雄数据,使用完成后需主动清理
local tempDId, tempData = HeroTempPropManager.CreateTempHero(curHeroData.dynamicId)
tempData.upStarId = nextHeroUpStarId
tempData.breakId = curHeroData.breakId
local curLvAllAddProVal = HeroTempPropManager.GetTempHeroProp(tempDId)--HeroPowerManager.GetNextHeroPower(curHeroData.dynamicId, nil,curHeroData.breakId,nextHeroUpStarId)
HeroTempPropManager.ClearTempHero(tempDId)-- 清理
this.upLvMaskPanleNextProAtk.text=curLvAllAddProVal[HeroProType.Attack]
this.upLvMaskPanleNextProHp.text=curLvAllAddProVal[HeroProType.Hp]
this.upLvMaskPanleNextProPhyDef.text=curLvAllAddProVal[HeroProType.PhysicalDefence]

View File

@ -323,14 +323,11 @@ function this.SetHero()
this.heroIcon.sprite=this.spLoader:LoadSprite(curHeroData.icon)
this.heroFrame.sprite=this.spLoader:LoadSprite(GetHeroQuantityImageByquality(curHeroData.heroConfig.Quality,curHeroData.star))
-- local allPro = HeroManager.CalculateHeroAllProValList(1, curHeroData.dynamicId, false)
local allAddProVal
local WarPower
--计算面板属性
if isUpZhen then
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId, FormationTypeDef.FORMATION_NORMAL)
else
allAddProVal = HeroPropManager.GetHeroProp(curHeroData.dynamicId)
WarPower = HeroPowerManager.GetHeroPower(curHeroData.dynamicId)
end
this.power.text = WarPower

View File

@ -67,9 +67,9 @@ function FourTrailSingleHelpHero:OnShow(curType,...)
self.proIcon.sprite = self.spLoader:LoadSprite(GetProStrImageByProNum(heroData.heroConfig.PropertyName))
SetHeroStars(self.spLoader,self.starGrid , heroData.star)
self.name.text = itemConfig[heroData.heroConfig.Id].Name
local allAddProVal = HeroManager.CalculateHeroAllProValList(1, heroData, false)
-- local allAddProVal = HeroManager.CalculateHeroAllProValList(1, heroData, false)
--LogGreen(heroData.dynamicId.." allAddProVal[HeroProType.WarPower]:"..allAddProVal[HeroProType.WarPower])
self.num.text = heroData.warPower
self.num.text = HeroPowerManager.GetHeroPower(heroData.dynamicId)--heroData.warPower
if curType == 1 then
local from = ""
if player.guildName == 0 then

View File

@ -108,6 +108,7 @@ function PlayerInfoView:OnShow()
end
function PlayerInfoView:RefreshPower(force)
LogYellow("战斗力刷新:"..tostring(force))
self.heroTeamPower.text = force
-- self.heroTeamPower.text = FormationManager.GetFormationPower(FormationManager.curFormationIndex)
end