本文整理汇总了C#中IMessage.Write方法的典型用法代码示例。如果您正苦于以下问题:C# IMessage.Write方法的具体用法?C# IMessage.Write怎么用?C# IMessage.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMessage
的用法示例。
在下文中一共展示了IMessage.Write方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendMessage
public void SendMessage(IMessage msg, NetConnection conn)
{
NetOutgoingMessage om = server.CreateMessage();
om.Write(msg.Id);
msg.Write(om);
server.SendMessage(om, conn, NetDeliveryMethod.Unreliable);
}
示例2: SendMessage
public void SendMessage(IMessage msg)
{
lock (MessageQueueLocker)
{
NetOutgoingMessage om = client.CreateMessage();
om.Write(msg.Id);
msg.Write(om);
if (om.LengthBytes > MaxPacketSize)
{
var id = client.UniqueIdentifier;
lock (PacketMessageDictionaryLocker)
{
PacketMessageDictionary[id] = om;
}
var packetMsg = new SendPacketMessage()
{
UniqueIdentifier = id,
TargetSize = (om.LengthBytes + MaxPacketSize - 1) / MaxPacketSize,
};
SendMessage(packetMsg);
}
else
{
MessageQueue.Enqueue(new NetClientMsg(om, NetDeliveryMethod.Unreliable));
}
}
}
示例3: SendMessageExceptOne
public static void SendMessageExceptOne(NetServer server, IMessage msg, NetConnection except)
{
NetOutgoingMessage om = server.CreateMessage();
om.Write(msg.Id);
msg.Write(om);
List<NetConnection> all = server.Connections;
if (all.Contains(except))
{
all.Remove(except);
}
if (all.Count > 0)
{
server.SendMessage(om, all, NetDeliveryMethod.Unreliable, 0);
}
}
示例4: Serialize
private byte[] Serialize(IMessage msg)
{
MemoryStream ms = new MemoryStream();
NetworkWriter writer = new NetworkWriter(ms);
msg.Write(writer);
return ms.ToArray();
}
示例5: SerializeRequest
private void SerializeRequest(IMessage message, MethodDefinition method, object[] args)
{
message.InitializeRequestMessage(this._serviceProxy.ClientChannel, this._serviceInterface.Namespace, this._serviceProxy.ActiveInterfaceName, method.Name);
for (int i = 0; i < method.Parameters.Count; i++)
{
ParameterDefinition parameter = method.Parameters[i];
message.Write(parameter.Name, args[i], parameter.Type, parameter.StreamingFormat);
}
message.FinalizeMessage();
}
示例6: SendMessage
public void SendMessage(IMessage msg)
{
lock (MessageQueueLocker)
{
NetOutgoingMessage om = client.CreateMessage();
om.Write(msg.Id);
msg.Write(om);
MessageQueue.Enqueue(new NetClientMsg(om, NetDeliveryMethod.Unreliable));
}
}
示例7: SendMessageToServer
public void SendMessageToServer(IMessage msg)
{
if (ServerConn != null)
{
NetOutgoingMessage om = server.CreateMessage();
om.Write(msg.Id);
msg.Write(om);
server.SendMessage(om, ServerConn, NetDeliveryMethod.Unreliable);
}
}