当前位置: 首页>>代码示例>>C#>>正文


C# NetIncomingMessage.ReadInt64方法代码示例

本文整理汇总了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;
            }
        }
开发者ID:fusspawn,项目名称:sobriety,代码行数:48,代码来源:NetworkClient.cs

示例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;
     }
 }
开发者ID:fusspawn,项目名称:sobriety,代码行数:32,代码来源:Attribute.cs

示例3: Rock

 public Rock(NetIncomingMessage Message)
     : base()
 {
     Texture = GameClient.ContentManager.Load<Texture2D>("RockFull");
     ID = Message.ReadInt64();
     BoundingBox = Message.ReadRectangle();
 }
开发者ID:fusspawn,项目名称:sobriety,代码行数:7,代码来源:Rock.cs

示例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() );
				}
			}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:35,代码来源:GameClient.Awaiting.cs

示例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();
 }
开发者ID:elefantstudio-se,项目名称:xna-lidgren-multiplayer-game,代码行数:8,代码来源:ProjectileTransferableData.cs

示例7: Decode

 public void Decode(NetIncomingMessage im)
 {
     Id = im.ReadInt64();
     MessageTime = im.ReadDouble();
     /*this.Position = im.ReadVector3();
     this.Velocity = im.ReadVector3();*/
     Rotation = im.ReadSingle();
 }
开发者ID:imGoose,项目名称:SkyrimOnline,代码行数:8,代码来源:UpdatePlayerStateMessage.cs

示例8: HealthTransferableData

 public HealthTransferableData(NetIncomingMessage message)
 {
     SessionID = message.ReadInt64();
     ID = message.ReadInt32();
     IsValid = message.ReadBoolean();
     PlayerIndex = message.ReadInt32();
     Value = message.ReadFloat();
 }
开发者ID:elefantstudio-se,项目名称:xna-lidgren-multiplayer-game,代码行数:8,代码来源:HealthTransferableData.cs

示例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();
     }
 }
开发者ID:ancientgods,项目名称:SoG,代码行数:9,代码来源:_Ridiculon_ButterflySwarmInstance.cs

示例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;
 }
开发者ID:ancientgods,项目名称:SoG,代码行数:11,代码来源:_Skills_BerserkInstance.cs

示例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]);
         }
     }
 }
开发者ID:ancientgods,项目名称:SoG,代码行数:12,代码来源:FlagTriggerItem.cs

示例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));
        }
开发者ID:fusspawn,项目名称:sobriety,代码行数:13,代码来源:ObjectManager.cs

示例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);
     }
 }
开发者ID:ancientgods,项目名称:SoG,代码行数:20,代码来源:_Spells_MeteorInstance.cs

示例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;
     }
 }
开发者ID:ancientgods,项目名称:SoG,代码行数:20,代码来源:_Spells_PlantInstance.cs

示例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!");
            }
        }
开发者ID:imGoose,项目名称:SkyrimOnline,代码行数:22,代码来源:Program.cs


注:本文中的Lidgren.Network.NetIncomingMessage.ReadInt64方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。