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


C# NetworkMessage.AddLocation方法代码示例

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


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

示例1: ToNetworkMessage

 public override void ToNetworkMessage(NetworkMessage msg)
 {
     msg.AddByte((byte)Type);
     msg.AddLocation(FromPosition);
     msg.AddLocation(ToPosition);
     msg.AddByte((byte)Effect);
 }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:7,代码来源:ProjectilePacket.cs

示例2: ToNetworkMessage

 public override void ToNetworkMessage(NetworkMessage msg)
 {
     msg.AddByte((byte)Type);
     msg.AddLocation(FromLocation);
     msg.AddByte(FromStackPosition);
     msg.AddLocation(ToLocation);
 }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:7,代码来源:CreatureMovePacket.cs

示例3: ToNetworkMessage

 public override void ToNetworkMessage(NetworkMessage msg)
 {
     msg.AddByte((byte)Type);
     msg.AddLocation(Location);
     msg.AddByte((byte)Color);
     msg.AddString(Message);
 }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:7,代码来源:AnimatedTextPacket.cs

示例4: ParseMessage

        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination, NetworkMessage outMsg)
        {
            if (msg.GetByte() != (byte)IncomingPacketType.TileUpdate)
                return false;

            Destination = destination;
            Type = IncomingPacketType.TileUpdate;
            outMsg.AddByte((byte)Type);

            Objects.Location pos = msg.GetLocation();
            outMsg.AddLocation(pos);

            ushort thingId = msg.PeekUInt16();

            if (thingId == 0xFF01)
            {
                outMsg.AddUInt16(msg.GetUInt16());
            }
            else
            {
                ParseTileDescription(msg, pos, outMsg);
                outMsg.AddUInt16(msg.GetUInt16());
            }

            return true;
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:26,代码来源:TileUpdatePacket.cs

示例5: ToNetworkMessage

 public override void ToNetworkMessage(NetworkMessage msg)
 {
     msg.AddByte((byte)Type);
     msg.AddLocation(FromLocation);
     msg.AddUInt16(SpriteId);
     msg.AddByte(FromStackPosition);
     msg.AddUInt32(CreatureId);
 }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:8,代码来源:ItemUseBattlelistPacket.cs

示例6: ToNetworkMessage

        public override void ToNetworkMessage(NetworkMessage msg)
        {

            msg.AddByte((byte)Type);

            msg.AddLocation(Location);
            msg.AddUInt16(ItemId);
            msg.AddByte(StackPosition);
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:9,代码来源:ItemRotatePacket.cs

示例7: ParseMessage

        public override bool ParseMessage(NetworkMessage msg, PacketDestination destination, NetworkMessage outMsg)
        {
            int msgPosition = msg.Position, outMsgPosition = outMsg.Position;

            if (msg.GetByte() != (byte)IncomingPacketType.MapDescription)
                return false;

            Destination = destination;
            Type = IncomingPacketType.MapDescription;
            outMsg.AddByte((byte)Type);

            Client.playerLocation = msg.GetLocation();
            outMsg.AddLocation(Client.playerLocation);

            return ParseMapDescription(msg, Client.playerLocation.X - 8, Client.playerLocation.Y - 6, Client.playerLocation.Z, 18, 14, outMsg);
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:16,代码来源:MapDescriptionPacket.cs

示例8: ToNetworkMessage

        public override void ToNetworkMessage(NetworkMessage msg)
        {
            msg.AddByte((byte)Type);

            msg.AddLocation(Position);
            msg.AddByte(StackPosition);
            msg.AddUInt16(ThingId);

            if (ThingId == 0x0061 || ThingId == 0x0062 || ThingId == 0x0063)
            {
                msg.AddUInt32(CreatureId);
                msg.AddByte(CreatureDirection);
            }
            else
            {
                if (Item.HasExtraByte)
                    msg.AddByte(Item.Count);
            }
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:19,代码来源:TileTransformThingPacket.cs

示例9: ToNetworkMessage

        public override void ToNetworkMessage(NetworkMessage msg)
        {
            msg.AddByte((byte)Type);

            msg.AddLocation(Location);
            msg.AddByte(Stack);
            msg.AddUInt16(ThingId);

            if (ThingId == 0x0061 || ThingId == 0x0062)
            {
                if (ThingId == 0x0062)
                    msg.AddUInt32(Creature.Id);
                else if (ThingId == 0x0061)
                {
                    msg.AddUInt32(Creature.RemoveId);
                    msg.AddUInt32(Creature.Id);
                    msg.AddString(Creature.Name);
                }

                msg.AddByte(Creature.Health);
                msg.AddByte(Creature.Direction);
                msg.AddOutfit(Creature.Outfit);

                msg.AddByte(Creature.LightLevel);
                msg.AddByte(Creature.LightColor);

                msg.AddUInt16(Creature.Speed);
                msg.AddByte((byte)Creature.Skull);
                msg.AddByte((byte)Creature.PartyShield);
            }
            else if (ThingId == 0x0063)
            {
                msg.AddUInt32(Creature.Id);
                msg.AddByte(Creature.Direction);
            }
            else
            {
                if (Item.HasExtraByte)
                    msg.AddByte(Item.Count);
            }
        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:41,代码来源:TileAddThingPacket.cs

示例10: ToNetworkMessage

        public override void ToNetworkMessage(NetworkMessage msg)
        {
            msg.AddByte((byte)Type);

            msg.AddUInt32(Unknown);
            msg.AddString(SenderName);
            msg.AddUInt16(SenderLevel);

            SpeechTypeInfo info = Enums.GetSpeechTypeInfo(Client.VersionNumber, SpeechType);

            msg.AddByte(info.Value);

            switch (info.AdditionalSpeechData)
            {
                case AdditionalSpeechData.Location:
                    msg.AddLocation(Position);
                    break;
                case AdditionalSpeechData.ChannelId:
                    msg.AddUInt16((ushort)ChannelId);
                    break;
                case AdditionalSpeechData.Time:
                    msg.AddUInt32(Time);
                    break;
                default:
                    break;
            }

            msg.AddString(Message);
        }
开发者ID:Xileck,项目名称:tibiaapi,代码行数:29,代码来源:CreatureSpeechPacket.cs

示例11: ToNetworkMessage

        public override void ToNetworkMessage(NetworkMessage msg)
        {
            Tile playerTile = Client.Map.GetTileWithPlayer();
            msg.AddByte((byte)Type);
            msg.AddLocation(playerTile.Location);

            //GetMapDescription(playerLocation.X - 8, playerLocation.Y - 6, playerLocation.Z, 18, 14, msg);

            int startz, endz, zstep;

            if (playerTile.Location.Z > 7)
            {
                startz = playerTile.Location.Z - 2;
                endz = Math.Min(15, playerTile.Location.Z + 2);
                zstep = 1;
            }
            else
            {
                startz = 7;
                endz = 0;
                zstep = -1;
            }

            uint mapStart = Client.Memory.ReadUInt32(Addresses.Map.MapPointer);

            for (int z = startz; z != endz + zstep; z += zstep)
            {
                for (int x = 0; x < 18; x++)
                {
                    for (int y = 0; y < 14; y++)
                    {
                        Location memLoc = new Location(x, y, z);
                        uint num = memLoc.ToTileNumber();
                        Tile pCurrent = new Tile(Client, mapStart + (Addresses.Map.StepTile * num), num);

                        foreach (TileObject o in pCurrent.Objects)
                        {
                            if (o.Id == 0x0063)
                            {
                                // Add a creature
                                Creature c = Client.BattleList.GetCreatures().FirstOrDefault(cr => cr.Id == o.Data);

                                if (c == null)
                                    throw new Exception("Creature does not exist.");

                                // Add as unknown
                                msg.AddUInt16((ushort)o.Id);

                                // No need to remove a creature
                                msg.AddUInt32(0);

                                // Add the creature id
                                msg.AddUInt32((uint)c.Id);

                                msg.AddString(c.Name);

                                msg.AddByte((byte)c.HPBar);

                                msg.AddByte((byte)c.Direction);

                                msg.AddOutfit(c.Outfit);

                                msg.AddByte((byte)c.Light);

                                msg.AddByte((byte)c.LightColor);

                                msg.AddUInt16((ushort)c.WalkSpeed);

                                msg.AddByte((byte)c.Skull);

                                msg.AddByte((byte)c.PartyShield);
                            }
                            else
                            {
                                Item item = new Item(Client, (uint)o.Id);

                                msg.AddUInt16((ushort)item.Id);

                                if (item.HasExtraByte)
                                    msg.AddByte(item.Count);
                            }
                        }

                        msg.AddByte(0x00);
                        msg.AddByte(0xFF);
                    }
                }
            }

        }
开发者ID:FaNtA91,项目名称:pokemonapi,代码行数:90,代码来源:MapDescriptionPacket.cs


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