本文整理汇总了C#中Lidgren.Network.NetIncomingMessage.ReadInt64方法的典型用法代码示例。如果您正苦于以下问题:C# NetIncomingMessage.ReadInt64方法的具体用法?C# NetIncomingMessage.ReadInt64怎么用?C# NetIncomingMessage.ReadInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lidgren.Network.NetIncomingMessage
的用法示例。
在下文中一共展示了NetIncomingMessage.ReadInt64方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnMessage
public virtual void OnMessage(NetIncomingMessage msg)
{
MessageTypes Type = (MessageTypes)msg.ReadByte();
switch (Type) {
case MessageTypes.ConnectionOkay:
Console.WriteLine("Connected to Remote Server");
break;
case MessageTypes.ChatMessage:
UIApi.AddChatMessage(msg.ReadString());
break;
case MessageTypes.RequestPlayerName:
Console.WriteLine("Server Requested Our Name");
NetOutgoingMessage Message = ClientConnection.CreateMessage();
Message.Write((byte)MessageTypes.PlayerNameResponse);
Message.Write(GameClient.Playername);
ClientConnection.SendMessage(Message, NetDeliveryMethod.ReliableUnordered);
Console.WriteLine("Responded to Server Name Request");
break;
case MessageTypes.IncomingMapData:
GameClient.Terrain.LoadTerrainFromNetwork(msg);
break;
case MessageTypes.MapDataChange:
GameClient.Terrain.UpdateTerrainTiles(msg);
break;
case MessageTypes.ActorCreate:
ActorManager.SpawnActor(msg);
break;
case MessageTypes.ActorMovement:
ActorManager.UpdateFromPacket(msg);
break;
case MessageTypes.ActorDestroy:
ActorManager.DrawableActors.Remove(msg.ReadInt64());
break;
case MessageTypes.ActorAnimate:
ActorManager.UpdateAnimationFromPacket(msg);
break;
case MessageTypes.CameraFocusAt:
GameClient.Camera.LookAtActor(ActorManager.DrawableActors[msg.ReadInt64()], true);
break;
case MessageTypes.AttributeSync:
Attributes.AttributeManager.UpdateAttributes(msg);
break;
default:
Console.WriteLine("Unhandled NetMessage Type: {0}", Type);
break;
}
}
示例2: 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;
}
}
示例3: Rock
public Rock(NetIncomingMessage Message)
: base()
{
Texture = GameClient.ContentManager.Load<Texture2D>("RockFull");
ID = Message.ReadInt64();
BoundingBox = Message.ReadRectangle();
}
示例4: DataReceived
public override void DataReceived ( NetCommand command, NetIncomingMessage msg )
{
if (command==NetCommand.Snapshot) {
var frame = msg.ReadUInt32();
var prevFrame = msg.ReadUInt32();
var ackCmdID = msg.ReadUInt32();
var serverTicks = msg.ReadInt64();
var size = msg.ReadInt32();
//Log.Warning("{0}", offsetTicks );
if (prevFrame!=0) {
Log.Warning("Bad initial snapshot. Previous frame does not equal zero.");
return;
}
if (ackCmdID!=0) {
Log.Warning("Bad command ID {0}. Command ID for initial snapshot must be zero.", ackCmdID);
return;
}
// read snapshot :
var snapshot = NetDeflate.Decompress( msg.ReadBytes(size) );
// initial snapshot contains atom table :
gameClient.Atoms = new AtomCollection( msg );
gameClient.SetState( new Active( gameClient, frame, snapshot, serverTicks ) );
}
if (command==NetCommand.Notification) {
gameClient.FeedNotification( msg.ReadString() );
}
}
示例5: 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
示例6: ProjectileTransferableData
public ProjectileTransferableData(NetIncomingMessage message)
{
SessionID = message.ReadInt64();
ID = message.ReadInt32();
IsValid = message.ReadBoolean();
Position = message.ReadVector2();
Angle = message.ReadFloat();
}
示例7: Decode
public void Decode(NetIncomingMessage im)
{
Id = im.ReadInt64();
MessageTime = im.ReadDouble();
/*this.Position = im.ReadVector3();
this.Velocity = im.ReadVector3();*/
Rotation = im.ReadSingle();
}
示例8: HealthTransferableData
public HealthTransferableData(NetIncomingMessage message)
{
SessionID = message.ReadInt64();
ID = message.ReadInt32();
IsValid = message.ReadBoolean();
PlayerIndex = message.ReadInt32();
Value = message.ReadFloat();
}
示例9: Init
public override void Init(NetIncomingMessage msg, params float[] p_afInitFloats)
{
long iID = msg.ReadInt64();
if (Program.GetTheGame().dixPlayers.ContainsKey(iID))
{
this.xOwner = Program.GetTheGame().dixPlayers[iID].xEntity;
this.SpawnDemButters();
}
}
示例10: Init
public override void Init(NetIncomingMessage msg, params float[] p_afInitFloats)
{
long key = msg.ReadInt64();
if (Program.game.dixPlayers.ContainsKey(key))
{
this.xPlayer = Program.game.dixPlayers[key];
this.xOwner = this.xPlayer.xEntity;
return;
}
this.bToBeDestroyed = true;
}
示例11: OnAdvancedNetworkMessage
public override void OnAdvancedNetworkMessage(NetIncomingMessage msg)
{
if (msg.ReadByte() == 0)
{
this.bToBeDestroyed = true;
long iPlayerID = msg.ReadInt64();
if (Program.GetTheGame().dixPlayers.ContainsKey(iPlayerID))
{
this.Claim(Program.GetTheGame().dixPlayers[iPlayerID]);
}
}
}
示例12: OnInteract
public static void OnInteract(NetIncomingMessage Packet)
{
var ID = Packet.ReadInt64();
if (!LoadedObjects.ContainsKey(ID)) {
Console.WriteLine("Invalid Interaction Request for ObjectID: {0}", ID);
return;
}
if (!LoadedObjects[ID].Interactable)
return;
GameServer.TaskScheduler.AddTask(LoadedObjects[ID].Interact(Packet));
}
示例13: Init
public override void Init(NetIncomingMessage msg, params float[] p_afInitFloats)
{
long key = msg.ReadInt64();
if (Program.game.dixPlayers.ContainsKey(key))
{
this.xOwner = Program.game.dixPlayers[key].xEntity;
}
else
{
this.xOwner = new EntityShell(Vector2.Zero);
}
this.fVelocity = p_afInitFloats[0];
Program.GetTheGame().xSoundSystem.PlayCue("meteor_impact", this, false);
this.xRenderComponent.fVirtualHeight = p_afInitFloats[1];
this.iChargeLevel = (int)p_afInitFloats[2];
if (this.iChargeLevel == 3)
{
this.xRenderComponent.SwitchAnimation(2, Animation.CancelOptions.IgnoreIfPlaying);
}
}
示例14: Init
public override void Init(NetIncomingMessage msg, params float[] p_afInitFloats)
{
this.xRenderComponent.fVirtualHeight = p_afInitFloats[0];
this.iChargeLevel = (int)p_afInitFloats[1];
if (this.iChargeLevel >= 2)
{
AnimatedRenderComponent expr_2C_cp_0 = this.xRenderComponent;
expr_2C_cp_0.v2OffsetRenderPos.Y = expr_2C_cp_0.v2OffsetRenderPos.Y - 10f;
}
if (this.iChargeLevel == 3)
{
this.xRenderComponent.SwitchAnimation(10, Animation.CancelOptions.IgnoreIfPlaying);
this.iAnimPlus = 10;
}
long iID = msg.ReadInt64();
if (Program.GetTheGame().dixPlayers.ContainsKey(iID))
{
this.xOwner = Program.GetTheGame().dixPlayers[iID].xEntity;
}
}
示例15: HandleRequestIntroduction
private void HandleRequestIntroduction(NetIncomingMessage msg)
{
IPEndPoint clientInternal = msg.ReadIPEndpoint();
long hostId = msg.ReadInt64();
string token = msg.ReadString();
Object[] elist;
if (registeredHosts.TryGetValue(hostId, out elist))
{
peer.Introduce(
(IPEndPoint) elist[0],
(IPEndPoint) elist[1],
clientInternal,
msg.SenderEndpoint,
token
);
}
else
{
Console.WriteLine("Client requested introduction to nonlisted host!");
}
}