oss分析
This commit is contained in:
parent
fc25acdbbb
commit
e02800f11a
@ -52,9 +52,10 @@ namespace Logic.Editor
|
||||
|
||||
public class UnitStatisticResult
|
||||
{
|
||||
public float MatchCount; // 有效局数
|
||||
public float TurnCount; // 有效回合数
|
||||
public float AppearCount; // 单局出战次数
|
||||
public float EarliestAppearTurn; // 单局最早出战回合
|
||||
public float AppearMatchCount; // 出战局数
|
||||
public float DeathCount; // 单局死亡次数
|
||||
public float KillCount; // 单局击杀次数
|
||||
public float TotalDamageDealt; // 单局总造成伤害
|
||||
@ -63,6 +64,22 @@ namespace Logic.Editor
|
||||
public float AverageDamageTaken; // 单局平均承受伤害
|
||||
public float TransformFromCount; // 单局被转化次数(作为来源)
|
||||
public float TransformToCount; // 单局转化成此单位次数
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
MatchCount = 0;
|
||||
TurnCount = 0;
|
||||
AppearCount = 0;
|
||||
EarliestAppearTurn = 0;
|
||||
DeathCount = 0;
|
||||
KillCount = 0;
|
||||
TotalDamageDealt = 0;
|
||||
TotalDamageTaken = 0;
|
||||
AverageDamageDealt = 0;
|
||||
AverageDamageTaken = 0;
|
||||
TransformFromCount = 0;
|
||||
TransformToCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -77,8 +94,16 @@ namespace Logic.Editor
|
||||
|
||||
public class TechStatisticResult
|
||||
{
|
||||
public float LearnMatchCount; // 学习局数
|
||||
public float LearnCount; // 单局平均学习次数
|
||||
public float LearnTurn; // 单局平均首次学习时间
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
LearnMatchCount = 0;
|
||||
LearnCount = 0;
|
||||
LearnTurn = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -92,12 +117,24 @@ namespace Logic.Editor
|
||||
public class EmpireStatisticResult
|
||||
{
|
||||
public int MatchCount;
|
||||
public int TurnCount;
|
||||
public float CoinPerTurn; // 单局回合金币
|
||||
public float TechPointPerTurn; // 单局回合科技点
|
||||
public float CityCount; // 单局城市数量
|
||||
public float MaxCityLevel; // 单局最高城市等级
|
||||
public float CityLevel; // 单局城市等级
|
||||
public float TechCount; // 单局科技数量
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
MatchCount = 0;
|
||||
CoinPerTurn = 0;
|
||||
TechPointPerTurn = 0;
|
||||
CityCount = 0;
|
||||
MaxCityLevel = 0;
|
||||
CityLevel = 0;
|
||||
TechCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -138,6 +175,10 @@ namespace Logic.Editor
|
||||
{
|
||||
_unitLimit ??= new UnitStatisticLimit();
|
||||
_unitResult ??= new UnitStatisticResult();
|
||||
_techLimit ??= new TechStatisticLimit();
|
||||
_techResult ??= new TechStatisticResult();
|
||||
_empireLimit ??= new EmpireStatisticLimit();
|
||||
_empireResult ??= new EmpireStatisticResult();
|
||||
|
||||
if (_redBoxStyle == null)
|
||||
{
|
||||
@ -215,20 +256,21 @@ namespace Logic.Editor
|
||||
|
||||
|
||||
EditorGUILayout.BeginVertical(_redBoxStyle);
|
||||
if (_unitResult != null && _unitResult.AppearMatchCount > 0)
|
||||
if (_unitResult != null)
|
||||
{
|
||||
EditorGUILayout.BeginVertical(_redBoxStyle);
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>===== 统计结果 =====</b>");
|
||||
InspectorUtils.InspectorTextWidthRich(
|
||||
$"<b>扫描文件数:</b> {_totalFileCount} <b>有效文件数:</b> {_validFileCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>平均单局出战次数:</b> {_unitResult.AppearCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>平均单局最早出战回合:</b> Turn {_unitResult.EarliestAppearTurn}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>平均单局击杀次数:</b> {_unitResult.KillCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>平均单局死亡次数:</b> {_unitResult.DeathCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>平均单局总造成伤害:</b> {_unitResult.TotalDamageDealt}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>平均单局总承受伤害:</b> {_unitResult.TotalDamageTaken}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>平均单局平均造成伤害:</b> {_unitResult.AverageDamageDealt}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>平均单局平均承受伤害:</b> {_unitResult.AverageDamageTaken}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>有效局数:</b> {_unitResult.MatchCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局出战次数:</b> {_unitResult.AppearCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局最早出战回合:</b> Turn {_unitResult.EarliestAppearTurn}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局击杀次数:</b> {_unitResult.KillCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局死亡次数:</b> {_unitResult.DeathCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局总造成伤害:</b> {_unitResult.TotalDamageDealt}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局总承受伤害:</b> {_unitResult.TotalDamageTaken}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局每个单位造成伤害:</b> {_unitResult.AverageDamageDealt}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局每个单位承受伤害:</b> {_unitResult.AverageDamageTaken}");
|
||||
EditorGUILayout.EndVertical();
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
@ -269,6 +311,7 @@ namespace Logic.Editor
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>===== 统计结果 =====</b>");
|
||||
InspectorUtils.InspectorTextWidthRich(
|
||||
$"<b>扫描文件数:</b> {_totalFileCount} <b>有效文件数:</b> {_validFileCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>有效局数:</b> {_techResult.LearnMatchCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>平均学习次数(所有局):</b> {_techResult.LearnCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局平均首次学习时间(只统计学习局):</b> Turn {_techResult.LearnTurn}");
|
||||
EditorGUILayout.EndVertical();
|
||||
@ -291,7 +334,7 @@ namespace Logic.Editor
|
||||
|
||||
if (InspectorUtils.InspectorButtonWithTextWidth($"计算!!!"))
|
||||
{
|
||||
CalculateTechStatistic();
|
||||
CalculateEmpireStatistic();
|
||||
}
|
||||
EditorGUILayout.EndVertical();
|
||||
|
||||
@ -306,6 +349,7 @@ namespace Logic.Editor
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>===== 统计结果 =====</b>");
|
||||
InspectorUtils.InspectorTextWidthRich(
|
||||
$"<b>扫描文件数:</b> {_totalFileCount} <b>有效文件数:</b> {_validFileCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>有效局数:</b> {_empireResult.MatchCount}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局回合金币(有效局):</b> {_empireResult.CoinPerTurn}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局回合科技点(有效局):</b> {_empireResult.TechPointPerTurn}");
|
||||
InspectorUtils.InspectorTextWidthRich($"<b>单局城市数量(有效局):</b> {_empireResult.CityCount}");
|
||||
@ -349,14 +393,14 @@ namespace Logic.Editor
|
||||
}
|
||||
}
|
||||
|
||||
_unitResult.AppearCount /= _unitResult.AppearMatchCount;
|
||||
_unitResult.DeathCount /= _unitResult.AppearMatchCount;
|
||||
_unitResult.KillCount /= _unitResult.AppearMatchCount;
|
||||
_unitResult.TotalDamageDealt /= _unitResult.AppearMatchCount;
|
||||
_unitResult.TotalDamageTaken /= _unitResult.AppearMatchCount;
|
||||
_unitResult.AverageDamageDealt /= _unitResult.AppearMatchCount;
|
||||
_unitResult.AverageDamageTaken /= _unitResult.AppearMatchCount;
|
||||
_unitResult.EarliestAppearTurn /= _unitResult.AppearMatchCount;
|
||||
_unitResult.AppearCount /= _unitResult.MatchCount;
|
||||
_unitResult.DeathCount /= _unitResult.MatchCount;
|
||||
_unitResult.KillCount /= _unitResult.MatchCount;
|
||||
_unitResult.TotalDamageDealt /= _unitResult.MatchCount;
|
||||
_unitResult.TotalDamageTaken /= _unitResult.MatchCount;
|
||||
_unitResult.AverageDamageDealt /= _unitResult.MatchCount;
|
||||
_unitResult.AverageDamageTaken /= _unitResult.MatchCount;
|
||||
_unitResult.EarliestAppearTurn /= _unitResult.MatchCount;
|
||||
|
||||
LogSystem.LogInfo($"统计完成: 共扫描 {_totalFileCount} 个文件,有效 {_validFileCount} 个");
|
||||
}
|
||||
@ -393,8 +437,8 @@ namespace Logic.Editor
|
||||
}
|
||||
}
|
||||
|
||||
_techResult.LearnCount /= _validFileCount;
|
||||
_techResult.LearnTurn /= _techResult.LearnCount;
|
||||
_techResult.LearnCount /= _techResult.LearnMatchCount;
|
||||
_techResult.LearnTurn /= _techResult.LearnMatchCount;
|
||||
|
||||
LogSystem.LogInfo($"统计完成: 共扫描 {_totalFileCount} 个文件,有效 {_validFileCount} 个");
|
||||
}
|
||||
@ -454,9 +498,9 @@ namespace Logic.Editor
|
||||
if (turn < 0 || addUnit.Turn < turn) turn = (int)addUnit.Turn;
|
||||
}
|
||||
|
||||
if (turn < 0 || appearCount == 0) return;
|
||||
if (appearCount == 0) return;
|
||||
result.MatchCount++;
|
||||
result.EarliestAppearTurn += turn;
|
||||
result.AppearMatchCount++;
|
||||
result.AppearCount += appearCount;
|
||||
|
||||
// 2. 伤害统计 & 击杀/死亡:从 Damages 统计
|
||||
@ -474,7 +518,7 @@ namespace Logic.Editor
|
||||
if (MatchUnitFullType(dmg.TargetUnitType))
|
||||
{
|
||||
result.TotalDamageTaken += dmg.TargetDamage;
|
||||
result.TotalDamageTaken += dmg.TargetDamage / (float)appearCount;
|
||||
result.AverageDamageTaken += dmg.TargetDamage / (float)appearCount;
|
||||
if (dmg.IsKill) result.DeathCount++;
|
||||
}
|
||||
}
|
||||
@ -491,34 +535,40 @@ namespace Logic.Editor
|
||||
if (learnTurn < 0 || learnTurn > techCollectData.Turn) learnTurn = (int)techCollectData.Turn;
|
||||
}
|
||||
|
||||
if (learnTurn > 0) result.LearnTurn += learnTurn;
|
||||
if (learnTurn > 0)
|
||||
{
|
||||
result.LearnTurn += learnTurn;
|
||||
result.LearnMatchCount++;
|
||||
}
|
||||
|
||||
LogSystem.LogInfo($"result.LearnCount {result.LearnCount} result.LearnMatchCount{result.LearnMatchCount}");
|
||||
}
|
||||
|
||||
private void ProcessCollectData(CollectData collectData, EmpireStatisticResult result)
|
||||
{
|
||||
var count = 0;
|
||||
var resultCache = new EmpireStatisticResult();
|
||||
foreach (var turnStartData in collectData.OnTurnStarts)
|
||||
{
|
||||
if (!MatchEmpire(turnStartData.Empire)) continue;
|
||||
|
||||
result.CoinPerTurn += turnStartData.PlayerCoinPerTurn;
|
||||
result.TechPointPerTurn += turnStartData.PlayerTechPointPerTurn;
|
||||
result.CityCount += turnStartData.CityCount;
|
||||
result.MaxCityLevel += turnStartData.MaxCityLevel;
|
||||
result.CityLevel += turnStartData.AverageCityLevel;
|
||||
result.TechCount += turnStartData.TechCount;
|
||||
count++;
|
||||
resultCache.CoinPerTurn += turnStartData.PlayerCoinPerTurn;
|
||||
resultCache.TechPointPerTurn += turnStartData.PlayerTechPointPerTurn;
|
||||
resultCache.CityCount += turnStartData.CityCount;
|
||||
resultCache.MaxCityLevel += turnStartData.MaxCityLevel;
|
||||
resultCache.CityLevel += turnStartData.AverageCityLevel;
|
||||
resultCache.TechCount += turnStartData.TechCount;
|
||||
resultCache.TurnCount++;
|
||||
}
|
||||
|
||||
if (count > 0)
|
||||
if (resultCache.TurnCount > 0)
|
||||
{
|
||||
result.MatchCount++;
|
||||
result.CoinPerTurn /= count;
|
||||
result.TechPointPerTurn /= count;
|
||||
result.CityCount /= count;
|
||||
result.MaxCityLevel /= count;
|
||||
result.CityLevel /= count;
|
||||
result.TechCount /= count;
|
||||
result.CoinPerTurn += resultCache.CoinPerTurn / resultCache.TurnCount;
|
||||
result.TechPointPerTurn += resultCache.TechPointPerTurn / resultCache.TurnCount;
|
||||
result.CityCount += resultCache.CityCount / resultCache.TurnCount;
|
||||
result.MaxCityLevel += resultCache.MaxCityLevel / resultCache.TurnCount;
|
||||
result.CityLevel += resultCache.CityLevel / resultCache.TurnCount;
|
||||
result.TechCount += resultCache.TechCount / resultCache.TurnCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user