本文整理汇总了C#中InputManager.FromNetworkData方法的典型用法代码示例。如果您正苦于以下问题:C# InputManager.FromNetworkData方法的具体用法?C# InputManager.FromNetworkData怎么用?C# InputManager.FromNetworkData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InputManager
的用法示例。
在下文中一共展示了InputManager.FromNetworkData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NetworkUpdate
public override void NetworkUpdate()
{
lastStateSent = SendServerData(lastStateSent);
//Create a deep copy clone so we don't mess with the thread
ConcurrentQueue<NetworkMessage> messages = gServer.Inbox;
//Snazzy
NetworkMessage msg;
while (messages.TryDequeue(out msg))
{
//Determine what the msg is and what to do with it
if(msg.NetworkData[0] == NetworkMessageType.ClientInput)
{
//Corresponds to the id in gServer clients and gameWorld inputs
byte msgId = msg.NetworkData[1];
InputManager input;
if(gameWorld.inputs.TryGetValue(msgId, out input))
{
//If we have the client update them
input.FromNetworkData(msg.NetworkData);
}
else
{
//If we don't, add them
input = new InputManager(msgId);
input.FromNetworkData(msg.NetworkData);
gameWorld.inputs.Add(msgId, input);
}
}
}
}