using Entitas; using Proto; namespace CoreGame.Render { public class RpcRetrySystem : IExecuteSystem { private readonly IGroup 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; } } } } } }