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


C# Wrapped.readInt方法代码示例

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


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

示例1: ReadEntityMetadata

        public static object[] ReadEntityMetadata(Wrapped wSock) {
            var MetadataDict = new Dictionary<int, object>();

            do {
                var item = wSock.readByte();

                if (item == 127)
                    break;

                var index = item & 0x1F;
                var type = item >> 5;

                switch (type) {
                    case 0:
                        MetadataDict.Add(index, wSock.readByte());
                        break;
                    case 1:
                        MetadataDict.Add(index, wSock.readShort());
                        break;
                    case 2:
                        MetadataDict.Add(index, wSock.readInt());
                        break;
                    case 3:
                        MetadataDict.Add(index, wSock.readFloat());
                        break;
                    case 4:
                        MetadataDict.Add(index, wSock.readString());
                        break;
                    case 5:
                        MetadataDict.Add(index, ReadSlot(wSock));
                        break;
                    case 6:
                        MetadataDict.Add(index, new Vector(wSock.readInt(), wSock.readInt(), wSock.readInt()));
                        break;
                }
            } while (true);

            MetadataDict.OrderBy(o => o.Key); // -- Order the dictionary based on the index values
            return MetadataDict.Values.ToArray(); // -- Return the data as an array.
        }
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:40,代码来源:WrappedExtension.cs

示例2: Read

        public void Read(Wrapped wSock) {
            ChunkX = wSock.readInt();
            ChunkZ = wSock.readInt();
            Recordcount = wSock.readShort();
            Datasize = wSock.readInt();
            Records = new Record[Recordcount];

            for (int x = 0; x < Recordcount; x++)
                Records[x] = WrappedExtension.ReadRecord(wSock);
        }
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:10,代码来源:IPacket.cs

示例3: ReadRecord

        public static Record ReadRecord(Wrapped wSock) {
            var Data = new Record();
            var RecordData = wSock.readInt();

            Data.Metadata = (byte)(RecordData & 0xF);
            Data.BlockID = (short)((RecordData >> 4) & 0xFFF);
            Data.Y = (byte)((RecordData >> 16) & 0xFF);
            Data.Z = (byte)((RecordData >> 24) & 0xF);
            Data.X = (byte)((RecordData >> 28) & 0xF);

            return Data;
        }
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:12,代码来源:WrappedExtension.cs

示例4: ReadObjectMetadata

        public static ObjectMetadata ReadObjectMetadata(Wrapped wSock) {
            var Data = new ObjectMetadata();
            Data.ObjectID = wSock.readInt();

            if (Data.ObjectID != 0) {
                Data.SpeedX = wSock.readShort();
                Data.SpeedY = wSock.readShort();
                Data.SpeedZ = wSock.readShort();
            }

            return Data;
        }
开发者ID:reddragon010,项目名称:libMC.NET,代码行数:12,代码来源:WrappedExtension.cs


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