本文整理汇总了C#中UnityEngine.Networking.NetworkWriter类的典型用法代码示例。如果您正苦于以下问题:C# NetworkWriter类的具体用法?C# NetworkWriter怎么用?C# NetworkWriter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NetworkWriter类属于UnityEngine.Networking命名空间,在下文中一共展示了NetworkWriter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Serialize
public override void Serialize(NetworkWriter writer)
{
writer.Write(this.netId);
writer.WritePackedUInt32((uint) this.stateHash);
writer.Write(this.normalizedTime);
writer.WriteBytesAndSize(this.parameters, this.parameters.Length);
}
示例2: AddOurselves
public void AddOurselves(ClientPlayer player, NetworkWriter nw)
{
player.currentVessel = this;
player.ChunkI = WorldToChunkI((Vector2)player.transform.position);
int rangeT = (PLAYER_CHUNK_RANGE * 2) + 1;
nw.Write((ushort)ClientMessageType.RequestChunk);
nw.Write((ushort)(rangeT * rangeT));
for (int i = 0; i < rangeT; i++) {
for (int j = 0; j < rangeT; j++) {
Vec2i temp = player.ChunkI + new Vec2i(i - PLAYER_CHUNK_RANGE, j - PLAYER_CHUNK_RANGE);
if (!((temp - player.ChunkI) <= PLAYER_CHUNK_RANGE)) {
VesselChunk temp2 = chunks.TryGet(temp.x, temp.y);
nw.Write(temp.x);
nw.Write(temp.y);
if (temp2 != null) {
nw.Write(temp2.version);
} else {
nw.Write((uint)uint.MaxValue);
}
}
}
}
}
示例3: Serialize
public override void Serialize(NetworkWriter writer)
{
writer.Write(proxyId);
writer.Write((short)packet.Compression);
writer.Write(packet.Length);
writer.WriteBytesFull(packet.Data);
}
示例4: OutputMessage
public OutputMessage(NetworkWriter data, int connectionID, int channelID)
{
Data = data;
ConnectionID = connectionID;
Type = MessageType.Reply;
ChannelID = channelID;
}
示例5: Serialize
public override void Serialize(NetworkWriter writer)
{
writer.Write(this.netId);
writer.WriteBytesFull(this.payload);
writer.Write(this.teleport);
writer.WritePackedUInt32((uint) this.time);
}
示例6: Serialize
public override void Serialize(NetworkWriter writer)
{
base.Serialize(writer);
writer.Write(Polyline.Count);
foreach (var vector3 in Polyline)
writer.Write(vector3);
}
示例7: PostInternalMessage
private void PostInternalMessage(short msgType)
{
NetworkWriter writer = new NetworkWriter();
writer.StartMessage(msgType);
writer.FinishMessage();
this.PostInternalMessage(writer.AsArray(), 0);
}
示例8: Serialize
public override void Serialize(NetworkWriter writer)
{
writer.WritePackedUInt32((uint) this.oldConnectionId);
writer.WritePackedUInt32((uint) this.playerControllerId);
writer.Write(this.netId);
writer.WriteBytesAndSize(this.msgData, this.msgSize);
}
示例9: OnSerialize
public override bool OnSerialize(NetworkWriter writer, bool initialState)
{
var serialized = base.OnSerialize (writer, initialState);
var time = animator.playbackTime;
writer.Write (time);
return serialized;
}
示例10: Serialize
public override void Serialize(NetworkWriter writer)
{
writer.Write(this.netId);
writer.Write(this.sceneId);
writer.Write(this.position);
writer.WriteBytesFull(this.payload);
}
示例11: Serialize
public static byte[] Serialize(INetMsg msg)
{
var networkWriter = new NetworkWriter();
uint index = GetMsgIndexFromType( msg.GetType() );
networkWriter.WritePackedUInt32( index );
((MessageBase)msg).Serialize(networkWriter);
return networkWriter.AsArray();
}
示例12: OnSerialize
/// <summary>
/// Server: Serialize the state over network
/// </summary>
/// <param name="writer"></param>
/// <param name="initialState"></param>
/// <returns></returns>
public override bool OnSerialize(NetworkWriter writer, bool initialState)
{
writer.Write(serverLastState.state);
writer.Write(serverLastState.position);
writer.Write(serverLastState.rotation);
return true;
}
示例13: Serialize
public override void Serialize(NetworkWriter writer)
{
writer.WritePackedUInt32((uint) this.connectionId);
writer.Write(this.address);
writer.WritePackedUInt32((uint) this.port);
writer.Write(this.isHost);
writer.Write(this.isYou);
}
示例14: InvokeHandlerOnClient
internal void InvokeHandlerOnClient(short msgType, MessageBase msg, int channelId)
{
NetworkWriter writer = new NetworkWriter();
writer.StartMessage(msgType);
msg.Serialize(writer);
writer.FinishMessage();
this.InvokeBytesOnClient(writer.AsArray(), channelId);
}
示例15: Serialize
public override void Serialize(NetworkWriter writer)
{
writer.Write((ushort) this.peers.Length);
foreach (PeerInfoMessage message in this.peers)
{
message.Serialize(writer);
}
}