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.
42 lines
957 B
42 lines
957 B
using System.Collections.Generic;
|
|
using Entitas;
|
|
using Entitas.CodeGeneration.Attributes;
|
|
|
|
namespace CoreGame.Render
|
|
{
|
|
[Unique, Combat]
|
|
public class RPCRetryComponent : IComponent
|
|
{
|
|
public Dictionary<int, CommandCache> commandCache;
|
|
public int seq = 0;
|
|
|
|
public void AddCache(int msgId, object msg)
|
|
{
|
|
commandCache.Add(seq, new CommandCache
|
|
{
|
|
msgId = msgId,
|
|
seq = seq,
|
|
time = GameTime.GetRenderTime(),
|
|
msg = msg
|
|
});
|
|
seq++;
|
|
}
|
|
|
|
public bool RemoveCache(int seq)
|
|
{
|
|
return commandCache.Remove(seq);
|
|
}
|
|
}
|
|
|
|
public class CommandCache
|
|
{
|
|
public int msgId;
|
|
public int seq;
|
|
public float time;
|
|
public object msg;
|
|
public override int GetHashCode()
|
|
{
|
|
return seq;
|
|
}
|
|
}
|
|
}
|