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


C# GameBitBuffer.ReadInt方法代码示例

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


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

示例1: Parse

 public void Parse(GameBitBuffer buffer)
 {
     Field0 = buffer.ReadInt(32);
     Field1 = new IVector2D();
     Field1.Parse(buffer);
     arSnoLevelAreas = new int /* sno */[4];
     for (int i = 0; i < arSnoLevelAreas.Length; i++) arSnoLevelAreas[i] = buffer.ReadInt(32);
     snoPrevWorld = buffer.ReadInt(32);
     Field4 = buffer.ReadInt(32);
     snoPrevLevelArea = buffer.ReadInt(32);
     snoNextWorld = buffer.ReadInt(32);
     Field7 = buffer.ReadInt(32);
     snoNextLevelArea = buffer.ReadInt(32);
     snoMusic = buffer.ReadInt(32);
     snoCombatMusic = buffer.ReadInt(32);
     snoAmbient = buffer.ReadInt(32);
     snoReverb = buffer.ReadInt(32);
     snoWeather = buffer.ReadInt(32);
     snoPresetWorld = buffer.ReadInt(32);
     Field15 = buffer.ReadInt(32);
     Field16 = buffer.ReadInt(32);
     Field17 = buffer.ReadInt(32);
     Field18 = buffer.ReadInt(32);
     tCachedValues = new SceneCachedValues();
     tCachedValues.Parse(buffer);
 }
开发者ID:darkschasu,项目名称:d3sharp,代码行数:26,代码来源:GameMessageTypes.cs

示例2: ParseValue

 public void ParseValue(GameBitBuffer buffer)
 {
     switch (Attribute.EncodingType)
     {
         case GameAttributeEncoding.Int:
             Int = buffer.ReadInt(Attribute.BitCount);
             break;
         case GameAttributeEncoding.IntMinMax:
             Int = buffer.ReadInt(Attribute.BitCount) + Attribute.Min;
             break;
         case GameAttributeEncoding.Float16:
             Float = buffer.ReadFloat16();
             break;
         case GameAttributeEncoding.Float16Or32:
             Float = buffer.ReadBool() ? buffer.ReadFloat16() : buffer.ReadFloat32();
             break;
         default:
             throw new Exception("bad voodoo");
     }
 }
开发者ID:darkschasu,项目名称:d3sharp,代码行数:20,代码来源:GameMessageTypes.cs

示例3: Identify

        public static void Identify(IConnection connection, MemoryStream stream)
        {
            //We Should move this part to a more central position
            if (gameMessages == null)
            {
                gameMessages = new Dictionary<Type, Action<GameMessage, GameBitBuffer, IConnection>>();
                var actionInfos = typeof(GameRouter).GetMethods().Where(o => o.GetParameters().Where(a => a.ParameterType == typeof(GameMessage)).Count() == 1 && 
                        o.GetParameters().Where(a => a.ParameterType == typeof(IConnection)).Count() == 1 &&
                        o.GetParameters().Where(a => a.ParameterType == typeof(GameBitBuffer)).Count() == 1
                    ).ToList();
                foreach (var actionInfo in actionInfos)
                {
                    Action<GameMessage, GameBitBuffer, IConnection> action = (Action<GameMessage, GameBitBuffer, IConnection>)Delegate.CreateDelegate(typeof(Action<GameMessage, GameBitBuffer, IConnection>), actionInfo);
                    Type typ = Type.GetType("D3Sharp.Net.Game.Packets." + actionInfo.Name);
                    gameMessages.Add(typ, action);
                }
            }
            //

            GameBitBuffer _incomingBuffer = new GameBitBuffer(512);
            GameBitBuffer _outgoingBuffer = new GameBitBuffer(ushort.MaxValue);

            _outgoingBuffer.WriteInt(32, 0);

            var header = new GameHeader(stream);
            var payload = new byte[header.Length - 6];

            stream.Read(payload, 0, (int)header.Length - 6);

            _incomingBuffer.AppendData(header.Data);
            _incomingBuffer.AppendData(payload);

            while (_incomingBuffer.IsPacketAvailable())
            {
                int end = _incomingBuffer.Position;
                end += _incomingBuffer.ReadInt(32) * 8;

                while ((end - _incomingBuffer.Position) >= 9)
                {
                    GameMessage msg = _incomingBuffer.ParseMessage();

                    Logger.LogIncoming(msg);
                    try
                    {
                        if (gameMessages.ContainsKey(GetMessageType(msg.Id)))
                            gameMessages[GetMessageType(msg.Id)](msg, _outgoingBuffer, connection);
                        else
                            Logger.Debug("Unhandled game message: 0x{0:X4} {1}", msg.Id, msg.GetType().Name);
                    }
                    catch (NotImplementedException)
                    {
                        Logger.Debug("Unhandled game message: 0x{0:X4} {1}", msg.Id, msg.GetType().Name);
                    }
                }

                _incomingBuffer.Position = end;
            }
        }
开发者ID:darkschasu,项目名称:d3sharp,代码行数:58,代码来源:GameRouter.cs


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