StyleCop clean FrameData
This commit is contained in:
@@ -24,15 +24,15 @@ namespace OpenRA.Network
|
|||||||
readonly Dictionary<int, int> clientQuitTimes = new Dictionary<int, int>();
|
readonly Dictionary<int, int> clientQuitTimes = new Dictionary<int, int>();
|
||||||
readonly Dictionary<int, Dictionary<int, byte[]>> framePackets = new Dictionary<int, Dictionary<int, byte[]>>();
|
readonly Dictionary<int, Dictionary<int, byte[]>> framePackets = new Dictionary<int, Dictionary<int, byte[]>>();
|
||||||
|
|
||||||
public IEnumerable<int> ClientsPlayingInFrame( int frame )
|
public IEnumerable<int> ClientsPlayingInFrame(int frame)
|
||||||
{
|
{
|
||||||
return clientQuitTimes
|
return clientQuitTimes
|
||||||
.Where( x => frame <= x.Value )
|
.Where(x => frame <= x.Value)
|
||||||
.Select( x => x.Key )
|
.Select(x => x.Key)
|
||||||
.OrderBy( x => x );
|
.OrderBy(x => x);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClientQuit( int clientId, int lastClientFrame )
|
public void ClientQuit(int clientId, int lastClientFrame)
|
||||||
{
|
{
|
||||||
if (lastClientFrame == -1)
|
if (lastClientFrame == -1)
|
||||||
lastClientFrame = framePackets
|
lastClientFrame = framePackets
|
||||||
@@ -42,10 +42,10 @@ namespace OpenRA.Network
|
|||||||
clientQuitTimes[clientId] = lastClientFrame;
|
clientQuitTimes[clientId] = lastClientFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddFrameOrders( int clientId, int frame, byte[] orders )
|
public void AddFrameOrders(int clientId, int frame, byte[] orders)
|
||||||
{
|
{
|
||||||
var frameData = framePackets.GetOrAdd( frame );
|
var frameData = framePackets.GetOrAdd(frame);
|
||||||
frameData.Add( clientId, orders );
|
frameData.Add(clientId, orders);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsReadyForFrame(int frame)
|
public bool IsReadyForFrame(int frame)
|
||||||
@@ -60,16 +60,16 @@ namespace OpenRA.Network
|
|||||||
.Where(client => !frameData.ContainsKey(client));
|
.Where(client => !frameData.ContainsKey(client));
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<ClientOrder> OrdersForFrame( World world, int frame )
|
public IEnumerable<ClientOrder> OrdersForFrame(World world, int frame)
|
||||||
{
|
{
|
||||||
var frameData = framePackets[ frame ];
|
var frameData = framePackets[frame];
|
||||||
var clientData = ClientsPlayingInFrame( frame )
|
var clientData = ClientsPlayingInFrame(frame)
|
||||||
.ToDictionary( k => k, v => frameData[ v ] );
|
.ToDictionary(k => k, v => frameData[v]);
|
||||||
|
|
||||||
return clientData
|
return clientData
|
||||||
.SelectMany( x => x.Value
|
.SelectMany(x => x.Value
|
||||||
.ToOrderList( world )
|
.ToOrderList(world)
|
||||||
.Select( o => new ClientOrder { Client = x.Key, Order = o } ) );
|
.Select(o => new ClientOrder { Client = x.Key, Order = o }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user