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.
34 lines
1.1 KiB
34 lines
1.1 KiB
1 month ago
|
using Entitas;
|
||
|
using Proto;
|
||
|
|
||
|
namespace CoreGame.Render
|
||
|
{
|
||
|
public class RpcRetrySystem : IExecuteSystem
|
||
|
{
|
||
|
private readonly IGroup<CombatEntity> m_BornGroup;
|
||
|
|
||
|
public RpcRetrySystem(CombatContext contexts)
|
||
|
{
|
||
|
m_BornGroup = contexts.GetGroup(CombatMatcher.RPCRetry);
|
||
|
}
|
||
|
public void Execute(float deltaTime)
|
||
|
{
|
||
|
m_BornGroup.GetEntities(Contexts.s_CacheEntities);
|
||
|
for (int i = 0; i < Contexts.s_CacheEntities.Count; i++)
|
||
|
{
|
||
|
var ent = Contexts.s_CacheEntities[i];
|
||
|
var commandCaches = ent.rPCRetry.commandCache;
|
||
|
float time = GameTime.GetRenderTime();
|
||
|
foreach (var commandCache in commandCaches)
|
||
|
{
|
||
|
var cache = commandCache.Value;
|
||
|
if (time - cache.time >= 0.46) // 460ms
|
||
|
{
|
||
|
NetMsgGateway.Instance?.SendMsgReqCoreGame((ClientMsgId)cache.msgId, cache.msg);
|
||
|
cache.time = time;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|