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


C# NetIncomingMessage.ReadVector3方法代码示例

本文整理汇总了C#中Lidgren.Network.NetIncomingMessage.ReadVector3方法的典型用法代码示例。如果您正苦于以下问题:C# NetIncomingMessage.ReadVector3方法的具体用法?C# NetIncomingMessage.ReadVector3怎么用?C# NetIncomingMessage.ReadVector3使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lidgren.Network.NetIncomingMessage的用法示例。


在下文中一共展示了NetIncomingMessage.ReadVector3方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Decode

 public void Decode(NetIncomingMessage im)
 {
     this.Id = im.ReadInt32();
     this.MessageTime = im.ReadDouble();
     this.Position = im.ReadVector3();
     /*this.MoveUp = im.ReadBoolean();
     this.MoveDown = im.ReadBoolean();
     this.MoveLeft = im.ReadBoolean();
     this.MoveRight = im.ReadBoolean();*/
     this.Object = Utility.Serializer.DeserializeObjectFromString<Model.Object.Object>(im.ReadString());
 }
开发者ID:Gothen111,项目名称:2DWorld,代码行数:11,代码来源:UpdateObjectMessage.cs

示例2: Decode

        public void Decode(NetIncomingMessage im)
        {
            this.Id = im.ReadInt32();
            this.MessageTime = im.ReadDouble();

            //this.Region = Utility.Serializer.DeserializeObjectFromString<Model.Map.Region.Region>(im.ReadString());
            //this.Region.Parent = Model.Map.World.World.world;

            this.Position = im.ReadVector3();

            this.RegionEnum = (Model.Map.Region.RegionEnum)im.ReadInt32();
        }
开发者ID:Gothen111,项目名称:2DWorld,代码行数:12,代码来源:UpdateRegionMessage.cs

示例3: Decode

        public void Decode(NetIncomingMessage im)
        {
            this.Id = im.ReadInt32();
            this.MessageTime = im.ReadDouble();
            this.RegionId = im.ReadInt32();

            //this.Chunk = Utility.Serializer.DeserializeObjectFromString<Model.Map.Chunk.Chunk>(im.ReadString());
            //this.Chunk.Parent = Model.Map.World.World.world.getRegion(this.RegionId);
            //this.Chunk.setAllNeighboursOfBlocks();

            this.Position = im.ReadVector3();

            Model.Map.Chunk.Chunk var_Chunk =  Model.Map.World.World.world.getChunkAtPosition(Position);

            if (var_Chunk != null)
            {
                if (var_Chunk.IsRequested)
                {
                    var_Chunk.IsRequested = false;
                }
            }
        }
开发者ID:Gothen111,项目名称:2DWorld,代码行数:22,代码来源:UpdateChunkMessage.cs

示例4: Decode

        public void Decode(NetIncomingMessage im)
        {
            this.MessageTime = im.ReadDouble();
            this.ChunkId = im.ReadInt32();

            Microsoft.Xna.Framework.Vector3 var_Position = im.ReadVector3();

            this.Block = GameLibrary.Model.Map.World.World.world.getBlockAtCoordinate(var_Position);

            int var_Size = Enum.GetValues(typeof(GameLibrary.Model.Map.Block.BlockLayerEnum)).Length;

            if (this.Block != null)
            {
                if (this.Block.IsRequested)
                {
                    for (int i = 0; i < var_Size; i++)
                    {
                        this.Block.Layer[i] = (Model.Map.Block.BlockEnum)im.ReadInt32();
                    }
                }
                this.Block.IsRequested = false;
            }
        }
开发者ID:Gothen111,项目名称:2DWorld,代码行数:23,代码来源:UpdateBlockMessage.cs

示例5: Decode

 public void Decode(NetIncomingMessage im)
 {
     this.Id = im.ReadInt32();
     this.MessageTime = im.ReadDouble();
     this.Position = im.ReadVector3();
     this.Velocity = im.ReadVector3();
     this.MoveUp = im.ReadBoolean();
     this.MoveDown = im.ReadBoolean();
     this.MoveLeft = im.ReadBoolean();
     this.MoveRight = im.ReadBoolean();
 }
开发者ID:Gothen111,项目名称:2DWorld,代码行数:11,代码来源:UpdateObjectPositionMessage.cs

示例6: Update

        public void Update()
        {
            // Recieve messages from the server.
            while ((_msgBuffer = _client.ReadMessage()) != null)
            {
                NetIncomingMessageType msgType = _msgBuffer.MessageType;

                switch (msgType)
                {
                    case NetIncomingMessageType.StatusChanged:
                        {
                            NetConnectionStatus status = (NetConnectionStatus)_msgBuffer.ReadByte();

                            if (status == NetConnectionStatus.Disconnected)
                            {
                                string reason = _msgBuffer.ReadString();
                                switch (reason)
                                {
                                    case "kicked":
                                        {
                                            _pbag.GameManager.SetErrorState(ErrorMsg.Kicked);
                                            break;
                                        }
                                    case "banned":
                                        {
                                            _pbag.GameManager.SetErrorState(ErrorMsg.Banned);
                                            break;
                                        }
                                    case "serverfull":
                                        {
                                            _pbag.GameManager.SetErrorState(ErrorMsg.ServerFull);
                                            break;
                                        }
                                    case "versionmismatch":
                                        {
                                            _pbag.GameManager.SetErrorState(ErrorMsg.VersionMismatch);
                                            break;
                                        }
                                    case "shutdown":
                                        {
                                            _pbag.GameManager.SetErrorState(ErrorMsg.ServerShutdown);
                                            break;
                                        }
                                    case "restart":
                                        {
                                            _pbag.GameManager.SetErrorState(ErrorMsg.ServerRestart);
                                            break;
                                        }
                                    case "exit":
                                        {
                                            //Todo need to find more info about this case in the disconnect switch
                                            break;
                                        }
                                    default:
                                        {
                                            _pbag.GameManager.Temperrormsg(reason);
                                            //Pbag.GameManager.SetErrorState(ErrorMsg.Unkown);
                                            break;
                                        }
                                }
                            }
                            break;
                        }
                    case NetIncomingMessageType.DiscoveryResponse:
                        {
                            string name = _msgBuffer.ReadString();
                            int playercount = _msgBuffer.ReadInt32();
                            int playermax = _msgBuffer.ReadInt32();
                            bool lan = _msgBuffer.ReadBoolean();
                            string ip = _msgBuffer.SenderEndpoint.Address.ToString();
                            ServerInformation newserver = new ServerInformation(name,ip,playercount,playermax,lan);
                            _pbag.GameManager.AddServer(newserver);
                            break;
                        }
                    case NetIncomingMessageType.ConnectionApproval:
                        {
                            break;
                        }
                    case NetIncomingMessageType.Data:
                        {
                            PacketType dataType = (PacketType)_msgBuffer.ReadByte();
                            switch (dataType)
                            {
                                case PacketType.WorldMapSize:
                                    {
                                        _pbag.WorldManager.Mapsize = _msgBuffer.ReadInt32();
                                        _pbag.WorldManager.Start();
                                        break;
                                    }
                                case PacketType.PlayerInitialUpdate:
                                    {
                                        _pbag.Player.Myid = _msgBuffer.ReadInt32();
                                        _pbag.Player.Name = _msgBuffer.ReadString();
                                        _pbag.Player.Position = _msgBuffer.ReadVector3();
                                        break;
                                    }
                                case PacketType.PlayerJoined:
                                    {
                                        ClientPlayer dummy = new ClientPlayer(_pbag.GameManager.Conmanager);
                                        dummy.Id = _msgBuffer.ReadInt32();
//.........这里部分代码省略.........
开发者ID:dkfdevil,项目名称:Mine-World,代码行数:101,代码来源:ClientListener.cs

示例7: Decode

 public void Decode(NetIncomingMessage im)
 {
     this.MessageTime = im.ReadDouble();
     this.Position = im.ReadVector3();
 }
开发者ID:Gothen111,项目名称:2DWorld,代码行数:5,代码来源:RequestRegionMessage.cs


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