本文整理汇总了C#中Lidgren.Network.NetIncomingMessage.ReadBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# NetIncomingMessage.ReadBoolean方法的具体用法?C# NetIncomingMessage.ReadBoolean怎么用?C# NetIncomingMessage.ReadBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lidgren.Network.NetIncomingMessage
的用法示例。
在下文中一共展示了NetIncomingMessage.ReadBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Decode
public void Decode(NetIncomingMessage im)
{
this.Id = im.ReadInt32();
this.MessageTime = im.ReadDouble();
this.MoveUp = im.ReadBoolean();
this.MoveDown = im.ReadBoolean();
this.MoveLeft = im.ReadBoolean();
this.MoveRight = im.ReadBoolean();
}
示例2: Decode
public override void Decode(NetIncomingMessage msg)
{
findSixes = msg.ReadBoolean();
nPosition = new HashSet<int>();
for (int i = msg.ReadByte(); i > 0; i--)
nPosition.Add(msg.ReadByte());
}
示例3: Decode
public void Decode(NetIncomingMessage im)
{
this.Username = im.ReadString();
this.ID = im.ReadByte();
this.Me = im.ReadBoolean();
this.Color = new Color(im.ReadByte(), im.ReadByte(), im.ReadByte());
}
示例4: ReadData
private void ReadData(AttributeTypeID Type, NetIncomingMessage Message)
{
switch(Type) {
case AttributeTypeID.Float:
Data = Message.ReadFloat();
break;
case AttributeTypeID.Int:
Data = Message.ReadInt32();
break;
case AttributeTypeID.List:
Console.WriteLine("AttributeSystem: List<> Type not supported on network sync");
break;
case AttributeTypeID.Long:
Data = Message.ReadInt64();
break;
case AttributeTypeID.Rectangle:
Data = Message.ReadRectangle();
break;
case AttributeTypeID.String:
Data = Message.ReadString();
break;
case AttributeTypeID.Vector2:
Data = Message.ReadVector2();
break;
case AttributeTypeID.Bool:
Data = Message.ReadBoolean();
break;
default:
Console.WriteLine("Invalid Attribute Type: {0}", Type.ToString());
break;
}
}
示例5: Write
/// <summary>
/// Writes a <see cref="NetIncomingMessage"/> buffer into the BitStream.
/// </summary>
/// <param name="source">The <see cref="NetIncomingMessage"/> who's contents will be copied to this BitStream.</param>
public void Write(NetIncomingMessage source)
{
#if DEBUG
var startBSPos = PositionBits;
var startMsgPos = (int)source.Position;
#endif
// Read full 32-bit integers
while (source.LengthBits - source.Position >= _bitsInt)
{
var v = source.ReadUInt32();
Write(v);
}
// Read full 8-bit integers
while (source.LengthBits - source.Position >= _bitsByte)
{
var v = source.ReadByte();
Write(v);
}
// Read the remaining bits
while (source.LengthBits > source.Position)
{
var v = source.ReadBoolean();
Write(v);
}
Debug.Assert(source.Position == source.LengthBits);
#if DEBUG
Debug.Assert(PositionBits - startBSPos == source.LengthBits - startMsgPos);
#endif
}
示例6: ReadLine
public static Line ReadLine(NetIncomingMessage message, bool isServer=false)
{
float removeAnimation = message.ReadFloat();
Vector2 animationEnd = message.ReadVector2();
int turn = message.ReadInt32();
bool wasGrowing = message.ReadBoolean();
Vector2 begin = message.ReadVector2();
Vector2 end = message.ReadVector2();
float thickness = message.ReadFloat();
if (!isServer) {
animationEnd = Constants.FromField(animationEnd);
begin = Constants.FromField(begin);
end = Constants.FromField(end);
}
Line l = new Line (begin, end);
l.removeAnimationTime = removeAnimation;
l.animationEnd = animationEnd;
l.turn = turn;
l.color = Constants.COLORS[turn];
l.wasGrowing = wasGrowing;
l.thickness = thickness;
return l;
}
示例7: ClientDisconnectedTransferableData
public ClientDisconnectedTransferableData(NetIncomingMessage message)
{
SessionID = message.ReadInt64();
ID = message.ReadInt32();
IsValid = message.ReadBoolean();
PlayerIndex = message.ReadInt16();
}
开发者ID:elefantstudio-se,项目名称:xna-lidgren-multiplayer-game,代码行数:7,代码来源:ClientDisconnectedTransferableData.cs
示例8: ToOtherPlayers
public static void ToOtherPlayers(NetIncomingMessage im, OtherPlayer[] d)
{
bool alive = im.ReadBoolean();
float xp = im.ReadFloat();
float yp = im.ReadFloat();
float zp = im.ReadFloat();
Int32 id = im.ReadInt32();
float xr = im.ReadFloat();
float yr = im.ReadFloat();
Int16 model = im.ReadInt16();
if (d[id] == null)
{
d[id] = new OtherPlayer(xp, yp, zp, id, model, xr, yr);
}
d[id].model = model;
d[id].xr = xr;
d[id].yr = yr;
if (!alive)
{
d[id].ChangeLifeStatus(false);
}
d[id].position = new Vector3(xp, yp, zp);
d[id].boundingSphere.Center = new Vector3(d[id].position.X, d[id].position.Y + Constants.HEADMAX/2, d[id].position.Z);
}
示例9: ProjectileTransferableData
public ProjectileTransferableData(NetIncomingMessage message)
{
SessionID = message.ReadInt64();
ID = message.ReadInt32();
IsValid = message.ReadBoolean();
Position = message.ReadVector2();
Angle = message.ReadFloat();
}
示例10: Decode
public void Decode(NetIncomingMessage im)
{
this.ID = im.ReadByte();
this.Position = new Point(im.ReadInt32(), im.ReadInt32());
this.Velocity = new Point(im.ReadInt32(), im.ReadInt32());
this.Movement = new Point(im.ReadInt32(), im.ReadInt32());
this.IsJumping = im.ReadBoolean();
}
示例11: HealthTransferableData
public HealthTransferableData(NetIncomingMessage message)
{
SessionID = message.ReadInt64();
ID = message.ReadInt32();
IsValid = message.ReadBoolean();
PlayerIndex = message.ReadInt32();
Value = message.ReadFloat();
}
示例12: HandleEntityComponentNetworkMessage
/// <summary>
/// Handles an incoming entity component message
/// </summary>
/// <param name="message">Raw network message</param>
/// <returns>An IncomingEntityComponentMessage object</returns>
public IncomingEntityComponentMessage HandleEntityComponentNetworkMessage(NetIncomingMessage message)
{
var componentFamily = (ComponentFamily) message.ReadByte();
var messageParams = new List<object>();
while (message.Position < message.LengthBits)
{
switch ((NetworkDataType) message.ReadByte())
{
case NetworkDataType.d_enum:
messageParams.Add(message.ReadInt32());
break;
case NetworkDataType.d_bool:
messageParams.Add(message.ReadBoolean());
break;
case NetworkDataType.d_byte:
messageParams.Add(message.ReadByte());
break;
case NetworkDataType.d_sbyte:
messageParams.Add(message.ReadSByte());
break;
case NetworkDataType.d_ushort:
messageParams.Add(message.ReadUInt16());
break;
case NetworkDataType.d_short:
messageParams.Add(message.ReadInt16());
break;
case NetworkDataType.d_int:
messageParams.Add(message.ReadInt32());
break;
case NetworkDataType.d_uint:
messageParams.Add(message.ReadUInt32());
break;
case NetworkDataType.d_ulong:
messageParams.Add(message.ReadUInt64());
break;
case NetworkDataType.d_long:
messageParams.Add(message.ReadInt64());
break;
case NetworkDataType.d_float:
messageParams.Add(message.ReadFloat());
break;
case NetworkDataType.d_double:
messageParams.Add(message.ReadDouble());
break;
case NetworkDataType.d_string:
messageParams.Add(message.ReadString());
break;
case NetworkDataType.d_byteArray:
int length = message.ReadInt32();
messageParams.Add(message.ReadBytes(length));
break;
}
}
return new IncomingEntityComponentMessage(componentFamily, messageParams);
}
示例13: DataProcessing
// TODO: Merge opcodes for move direction, something like that: Move(LookDirection)
void DataProcessing(NetIncomingMessage message, ref Client client)
{
switch (message.ReadByte())
{
case (byte)MessageType.ClientMessage.NeedMap:
Program.Log.Info("[RECEIVE][Client #" + client.ClientId + "] Need map ! Let's give it to him :)");
ReceiveNeedMap(client);
break;
case (byte)MessageType.ClientMessage.MapSelection:
Program.Log.Info("[RECEIVE][Client #" + client.ClientId + "] Has selected a map to play ! :)");
ReceiveMapSelection(client, message.ReadString());
break;
case (byte)MessageType.ClientMessage.Credentials:
ReceiveCredentials(client, message.ReadString(), message.ReadString());
break;
case (byte)MessageType.ClientMessage.Ready:
Program.Log.Info("[RECEIVE][Client #" + client.ClientId + "] Ready message !");
ReceiveReady(client, message.ReadBoolean());
break;
case (byte)MessageType.ClientMessage.WantToStartGame:
Program.Log.Info("[RECEIVE][Client #" + client.ClientId + "] WantToStartGame message !");
ReceiveWantToStartGame();
break;
case (byte)MessageType.ClientMessage.HasMap:
Program.Log.Info("[RECEIVE][Client #" + client.ClientId + "] HasMap message !");
ReceiveHasMap(client);
break;
case (byte)MessageType.ClientMessage.MoveDown:
Program.Log.Info("[RECEIVE][Client #" + client.ClientId + "] Want to move down !");
ReceiveMovePlayer(client, LookDirection.Down);
break;
case (byte)MessageType.ClientMessage.MoveLeft:
Program.Log.Info("[RECEIVE][Client #" + client.ClientId + "] Want to move left !");
ReceiveMovePlayer(client, LookDirection.Left);
break;
case (byte)MessageType.ClientMessage.MoveRight:
Program.Log.Info("[RECEIVE][Client #" + client.ClientId + "] Want to move right !");
ReceiveMovePlayer(client, LookDirection.Right);
break;
case (byte)MessageType.ClientMessage.MoveUp:
Program.Log.Info("[RECEIVE][Client #" + client.ClientId + "] Want to move up !");
ReceiveMovePlayer(client, LookDirection.Up);
break;
case (byte)MessageType.ClientMessage.Standing:
Program.Log.Info("[RECEIVE][Client #" + client.ClientId + "] Want to stay here !");
ReceiveMovePlayer(client, LookDirection.Idle, message.ReadTime(client.ClientConnection, true));
break;
case (byte)MessageType.ClientMessage.PlaceBomb:
Program.Log.Info("[RECEIVE][Client #" + client.ClientId + "] Want to place bomb !");
ReceiveBombPlacing(client);
break;
}
}
示例14: MsgToOtherPlayers
public static OtherPlayer MsgToOtherPlayers(NetIncomingMessage im)
{
bool alive = im.ReadBoolean();
float xp = im.ReadFloat();
float yp = im.ReadFloat();
float zp = im.ReadFloat();
Int32 id = im.ReadInt32();
float xr = im.ReadFloat();
float yr = im.ReadFloat();
Int16 model = im.ReadInt16();
OtherPlayer d = new OtherPlayer(xp, yp, zp, id, xr, yr, false);
d.model = model;
return d;
}
示例15: MsgToPlayer
public static Player MsgToPlayer(NetIncomingMessage im, GraphicsDevice device)
{
bool alive = im.ReadBoolean();
float xp = im.ReadFloat();
float yp = im.ReadFloat();
float zp = im.ReadFloat();
Int32 id = im.ReadInt32();
float xr = im.ReadFloat();
xr = im.ReadFloat();
Int32 mo = im.ReadInt32();
Player d = new Player(xp, yp, zp, id, mo, device);
Globals.player = d;
return d;
}