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


C# PacketReader.ReadSByte方法代码示例

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


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

示例1: EquipmentUpdate

        private static void EquipmentUpdate( PacketReader p )
        {
            Serial serial = p.ReadUInt32();

            Item i = World.FindItem( serial );
            if ( i == null )
            {
                World.AddItem( i=new Item( serial ) );
                Item.UpdateContainers();
            }

            if ( World.Player != null && World.Player.Holding == i )
                World.Player.Holding = null;

            ushort iid = p.ReadUInt16();
            i.ItemID = (ushort)(iid + p.ReadSByte()); // signed, itemID offset
            i.Layer = p.ReadByte();
            Serial ser = p.ReadUInt32();// cont must be set after hue (for counters)
            i.Hue = p.ReadUInt16();

            i.Container = ser;
        }
开发者ID:herculesjr,项目名称:razor,代码行数:22,代码来源:Handlers.cs

示例2: Read

        public override void Read(PacketReader stream)
        {
            X = stream.ReadDouble();
            Y = stream.ReadDouble();
            Z = stream.ReadDouble();
            Radius = stream.ReadFloat();
            Offsets = new sbyte[stream.ReadInt(), 3];
            for (int i = 0; i < Offsets.GetLength(0); i++)
            {
                Offsets[i, 0] = stream.ReadSByte();
                Offsets[i, 1] = stream.ReadSByte();
                Offsets[i, 2] = stream.ReadSByte();
            }

            UnknownA = stream.ReadFloat();
            UnknownB = stream.ReadFloat();
            UnknownC = stream.ReadFloat();
        }
开发者ID:OBASI,项目名称:c-raft,代码行数:18,代码来源:Packet.cs

示例3: WorldItem

        private static void WorldItem( PacketReader p, PacketHandlerEventArgs args )
        {
            Item item;
            uint serial = p.ReadUInt32();
            item = World.FindItem( serial&0x7FFFFFFF );
            bool isNew = false;
            if ( item == null )
            {
                World.AddItem( item=new Item( serial&0x7FFFFFFF ) );
                isNew = true;
            }
            else
            {
                item.CancelRemove();
            }

            if ( !DragDropManager.EndHolding( serial ) )
                return;

            item.Container = null;
            Counter.Uncount( item );

            ushort itemID = p.ReadUInt16();
            item.ItemID = (ushort)(itemID&0x7FFF);

            if ( (serial & 0x80000000) != 0 )
                item.Amount = p.ReadUInt16();
            else
                item.Amount = 1;

            if ( (itemID & 0x8000) != 0 )
                item.ItemID = (ushort)(item.ItemID + p.ReadSByte());

            ushort x = p.ReadUInt16();
            ushort y = p.ReadUInt16();

            if ( (x & 0x8000) != 0 )
                item.Direction = p.ReadByte();
            else
                item.Direction = 0;

            short z = p.ReadSByte();

            item.Position = new Point3D( x&0x7FFF, y&0x3FFF, z );

            if ( ( y & 0x8000 ) != 0 )
                item.Hue = p.ReadUInt16();
            else
                item.Hue = 0;

            byte flags = 0;
            if ( ( y & 0x4000 ) != 0 )
                flags = p.ReadByte();

            item.ProcessPacketFlags( flags );

            if ( isNew && World.Player != null )
            {
                if ( item.ItemID == 0x2006 )// corpse itemid = 0x2006
                {
                    if ( Config.GetBool( "ShowCorpseNames" ) )
                        ClientCommunication.SendToServer( new SingleClick( item ) );
                    if ( Config.GetBool( "AutoOpenCorpses" ) && Utility.InRange( item.Position, World.Player.Position, Config.GetInt( "CorpseRange" ) ) && World.Player != null && World.Player.Visible )
                        PlayerData.DoubleClick( item ) ;
                }
                else if ( item.IsMulti )
                {
                    ClientCommunication.PostAddMulti( item.ItemID, item.Position );
                }
                else
                {
                    ScavengerAgent s = ScavengerAgent.Instance;
                    int dist = Utility.Distance( item.GetWorldPosition(), World.Player.Position );
                    if ( !World.Player.IsGhost && World.Player.Visible && dist <= 2 && s.Enabled && item.Movable )
                        s.Scavenge( item );
                }
            }

            Item.UpdateContainers();
        }
开发者ID:herculesjr,项目名称:razor,代码行数:80,代码来源:Handlers.cs

示例4: SAWorldItem

        private static void SAWorldItem(PacketReader p, PacketHandlerEventArgs args)
        {
            /*
            New World Item Packet
            PacketID: 0xF3
            PacketLen: 24
            Format:

                BYTE - 0xF3 packetId
                WORD - 0x01
                BYTE - ArtDataID: 0x00 if the item uses art from TileData table, 0x02 if the item uses art from MultiData table)
                DWORD - item Serial
                WORD - item ID
                BYTE - item direction (same as old)
                WORD - amount
                WORD - amount
                WORD - X
                WORD - Y
                SBYTE - Z
                BYTE - item light
                WORD - item Hue
                BYTE - item flags (same as old packet)
            */

            // Post-7.0.9.0
            /*
            New World Item Packet
            PacketID: 0xF3
            PacketLen: 26
            Format:

                BYTE - 0xF3 packetId
                WORD - 0x01
                BYTE - ArtDataID: 0x00 if the item uses art from TileData table, 0x02 if the item uses art from MultiData table)
                DWORD - item Serial
                WORD - item ID
                BYTE - item direction (same as old)
                WORD - amount
                WORD - amount
                WORD - X
                WORD - Y
                SBYTE - Z
                BYTE - item light
                WORD - item Hue
                BYTE - item flags (same as old packet)
                WORD ???
            */

            ushort _unk1 = p.ReadUInt16();

            byte _artDataID = p.ReadByte();

            Item item;
            uint serial = p.ReadUInt32();
            item = World.FindItem(serial);
            bool isNew = false;
            if (item == null)
            {
                World.AddItem(item = new Item(serial));
                isNew = true;
            }
            else
            {
                item.CancelRemove();
            }

            if (!DragDropManager.EndHolding(serial))
                return;

            item.Container = null;
            Counter.Uncount(item);

            ushort itemID = p.ReadUInt16();
            item.ItemID = (ushort)( _artDataID == 0x02 ? itemID | 0x4000 : itemID );

            item.Direction = p.ReadByte();

            ushort _amount = p.ReadUInt16();
            item.Amount = _amount = p.ReadUInt16();

            ushort x = p.ReadUInt16();
            ushort y = p.ReadUInt16();
            short z = p.ReadSByte();

            item.Position = new Point3D(x, y, z);

            byte _light = p.ReadByte();

            item.Hue = p.ReadUInt16();

            byte flags = p.ReadByte();

            item.ProcessPacketFlags(flags);

            if (Engine.UsePostHSChanges)
            {
                p.ReadUInt16();
            }

            if (isNew && World.Player != null)
//.........这里部分代码省略.........
开发者ID:herculesjr,项目名称:razor,代码行数:101,代码来源:Handlers.cs

示例5: MovementRej

        private static void MovementRej( PacketReader p, PacketHandlerEventArgs args )
        {
            if ( World.Player != null )
            {
                byte seq = p.ReadByte();
                int x = p.ReadUInt16();
                int y = p.ReadUInt16();
                Direction dir = (Direction)p.ReadByte();
                sbyte z = p.ReadSByte();

                if ( WalkAction.IsMacroWalk( seq ) )
                    args.Block = true;
                World.Player.MoveRej( seq, dir, new Point3D( x, y, z ) );
            }
        }
开发者ID:herculesjr,项目名称:razor,代码行数:15,代码来源:Handlers.cs

示例6: DropRequest

        private static void DropRequest(PacketReader p, PacketHandlerEventArgs args)
        {
            Serial serial = p.ReadUInt32();
            int x = p.ReadInt16();
            int y = p.ReadInt16();
            int z = p.ReadSByte();
            Item container = World.FindItem(p.ReadUInt32());

            if (items.ContainsKey(serial))
            {
                args.Block = true;
                FakeItem fake = items[serial];
                if (container == World.Player.Backpack)
                    fake.Position = new Point3D(x, y, z);
                else
                    foreach (Serial s in fake.List.Take(lifting))
                        DragDrop.Move(World.FindItem(s), container);
                lifting = 0;
                Resend();
            }
            else
                args.Block = PacketHandler.ProcessViewers(dropRequest, p);
        }
开发者ID:jaryn-kubik,项目名称:RazorEx,代码行数:23,代码来源:PotionStack.cs

示例7: PersonalLight

 private static void PersonalLight( PacketReader p, PacketHandlerEventArgs args )
 {
     if ( World.Player != null && !args.Block )
     {
         p.ReadUInt32(); // serial
         World.Player.LocalLightLevel = p.ReadSByte();
     }
 }
开发者ID:herculesjr,项目名称:razor,代码行数:8,代码来源:Handlers.cs

示例8: ServerList

        private static void ServerList( PacketReader p, PacketHandlerEventArgs args )
        {
            p.ReadByte(); //unknown
            ushort numServers = p.ReadUInt16();

            for ( int i = 0; i < numServers; ++i )
            {
                ushort num = p.ReadUInt16();
                World.Servers[num] = p.ReadString( 32 );
                p.ReadByte(); // full %
                p.ReadSByte(); // time zone
                p.ReadUInt32(); // ip
            }
        }
开发者ID:herculesjr,项目名称:razor,代码行数:14,代码来源:Handlers.cs

示例9: DropRequest

        private static void DropRequest( PacketReader p, PacketHandlerEventArgs args )
        {
            Serial iser = p.ReadUInt32();
            int x = p.ReadInt16();
            int y = p.ReadInt16();
            int z = p.ReadSByte();
            if ( Engine.UsePostKRPackets )
                /* grid num */p.ReadByte();
            Point3D newPos = new Point3D( x, y, z );
            Serial dser = p.ReadUInt32();

            if ( Macros.MacroManager.AcceptActions )
                MacroManager.Action( new DropAction( dser, newPos ) );

            Item i = World.FindItem( iser );
            if ( i == null )
                return;

            Item dest = World.FindItem( dser );
            if ( dest != null && dest.IsContainer && World.Player != null && ( dest.IsChildOf( World.Player.Backpack ) || dest.IsChildOf( World.Player.Quiver ) ) )
                i.IsNew = true;

            if ( Config.GetBool( "QueueActions" ) )
                args.Block = DragDropManager.Drop( i, dser, newPos );
        }
开发者ID:herculesjr,项目名称:razor,代码行数:25,代码来源:Handlers.cs


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