You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
4.8 KiB
149 lines
4.8 KiB
1 month ago
|
using Sog;
|
||
|
using ProtoCSStruct;
|
||
|
using LitJson;
|
||
|
using System;
|
||
|
|
||
|
namespace Battle
|
||
|
{
|
||
|
|
||
|
public static class BattleMatchHandler
|
||
|
{
|
||
|
private static ProtoCSStruct.BattleInfoAll lastBattleInfoAll;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
private static bool OnCheckArenaBattle(long uid, ref BattleInfoAll battleInfo,
|
||
|
ref BattleBriefStatistics briefStatistic, ref BattleStatistics battleStats)
|
||
|
{
|
||
|
TraceLog.Debug("BattleMatchHandler.OnCheckArenaBattle mainland {0} battle {1} uid {2}"
|
||
|
, battleInfo.MainlandId, battleInfo.BattleId, uid);
|
||
|
//ProtoCSClass.BattleInfoAll battleInfoCls = ProtoHelper.BattleInfoAllToClass(ref battleInfo);
|
||
|
//ref var battleInput = ref GetAutoFightInput();
|
||
|
//Stopwatch sw = new Stopwatch();
|
||
|
//sw.Start();
|
||
|
|
||
|
//int runRet = RunBattle(battleInfoCls, uid, battleInfo.BattleId, battleInfo.MainlandId,
|
||
|
// ref battleInput, out AIScriptBattle scriptBattle);
|
||
|
//sw.Stop();
|
||
|
|
||
|
|
||
|
//if (runRet == 0 && scriptBattle != null)
|
||
|
//{
|
||
|
// //填充统计
|
||
|
// ProtoHelper.BattleStatisticsToStruct(scriptBattle._battle.battleStats, ref battleStats);
|
||
|
// ProtoHelper.BattleBriefStatisticsToStruct(scriptBattle._battle.briefStatistics, ref briefStatistic);
|
||
|
|
||
|
// int logicTimeMs = battleStats.TotalFrame * GameTime.LogicTimeOneFrameMs;
|
||
|
// BattleCheckStatSucc(battleInfo.MainlandId, logicTimeMs, (int)sw.ElapsedMilliseconds, 1);
|
||
|
//}
|
||
|
//else
|
||
|
//{
|
||
|
// TraceLog.Error("BattleMatchHandler.OnCheckArenaBattle mainland {0} battle {1} uid {2} run ret error",
|
||
|
// battleInfo.MainlandId, battleInfo.BattleId, uid);
|
||
|
// return false;
|
||
|
//}
|
||
|
|
||
|
//TraceLog.Debug("BattleMatchHandler.OnCheckArenaBattle mainland {0} battle {1} uid {2} BattleResult {3} usedTimeMs {4}"
|
||
|
// , battleInfo.MainlandId, battleInfo.BattleId, uid, briefStatistic.Result, sw.ElapsedMilliseconds);
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
private static void BattleCheckStatSucc(int mainlandId, int logicTimeMs, int checkTimeMs, int isArena)
|
||
|
{
|
||
|
var checkStat = BattleServerUtils.GetBattleServerData().battleCheckStat;
|
||
|
checkStat.battleNum++;
|
||
|
checkStat.battleNum_total++;
|
||
|
|
||
|
checkStat.checkSuccBattleNum++;
|
||
|
checkStat.checkSuccBattleNum_total++;
|
||
|
|
||
|
if (isArena == 1)
|
||
|
{
|
||
|
checkStat.arenaNum++;
|
||
|
checkStat.arenaNum_total++;
|
||
|
|
||
|
checkStat.checkSuccArenaNum++;
|
||
|
checkStat.checkSuccArenaNum_total++;
|
||
|
}
|
||
|
|
||
|
if (checkTimeMs > checkStat.maxCheckTimeMs)
|
||
|
{
|
||
|
checkStat.maxCheckTimeMs = checkTimeMs;
|
||
|
checkStat.maxMainlandId = mainlandId;
|
||
|
checkStat.maxLogicTimeMs = logicTimeMs;
|
||
|
}
|
||
|
|
||
|
if (checkTimeMs > checkStat.maxCheckTimeMs_total)
|
||
|
{
|
||
|
checkStat.maxCheckTimeMs_total = checkTimeMs;
|
||
|
checkStat.maxMainlandId_total = mainlandId;
|
||
|
checkStat.maxLogicTimeMs_total = logicTimeMs;
|
||
|
}
|
||
|
|
||
|
checkStat.battleLogicTimeMs += logicTimeMs;
|
||
|
checkStat.battleLogicTimeMs_total += logicTimeMs;
|
||
|
|
||
|
checkStat.battleCheckTimeMs += checkTimeMs;
|
||
|
checkStat.battleCheckTimeMs_total += checkTimeMs;
|
||
|
|
||
|
}
|
||
|
|
||
|
private static void BattleCheckStatFail(int errorCode, int isArena, long appVersion)
|
||
|
{
|
||
|
var checkStat = BattleServerUtils.GetBattleServerData().battleCheckStat;
|
||
|
checkStat.battleNum++;
|
||
|
checkStat.battleNum_total++;
|
||
|
|
||
|
if (isArena == 1)
|
||
|
{
|
||
|
checkStat.arenaNum++;
|
||
|
checkStat.arenaNum_total++;
|
||
|
}
|
||
|
|
||
|
if (! checkStat.errorCount.ContainsKey(errorCode))
|
||
|
{
|
||
|
checkStat.errorCount[errorCode] = 1;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
checkStat.errorCount[errorCode]++;
|
||
|
}
|
||
|
|
||
|
if (!checkStat.appVersionFailCount.ContainsKey(appVersion))
|
||
|
{
|
||
|
checkStat.appVersionFailCount[appVersion] = 1;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
checkStat.appVersionFailCount[appVersion]++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
private static void BattleStatEnterArena(int arenaType)
|
||
|
{
|
||
|
var checkStat = BattleServerUtils.GetBattleServerData().battleCheckStat;
|
||
|
if (checkStat.enterArenaNum.ContainsKey(arenaType))
|
||
|
{
|
||
|
checkStat.enterArenaNum[arenaType]++;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
checkStat.enterArenaNum.Add(arenaType, 1);
|
||
|
}
|
||
|
++checkStat.totalArenaNum;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|