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


C# Message.GetUInt方法代码示例

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


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

示例1: RotatablePlaceReceiveEvent

 /// <summary>
 ///     Initializes a new instance of the <see cref="ReceiveEvent" /> class.
 /// </summary>
 /// <param name="message">The message.</param>
 public RotatablePlaceReceiveEvent(Message message)
     : base(message)
 {
     this.PosX = message.GetInteger(0);
     this.PosY = message.GetInteger(1);
     this.Block = (RotatableBlock)message.GetInteger(2);
     this.Rotation = message.GetUInt(3);
 }
开发者ID:someone243,项目名称:CupCake,代码行数:12,代码来源:RotatablePlaceReceiveEvent.cs

示例2: SoundPlaceReceiveEvent

 /// <summary>
 ///     Initializes a new instance of the <see cref="ReceiveEvent" /> class.
 /// </summary>
 /// <param name="message">The message.</param>
 public SoundPlaceReceiveEvent(Message message)
     : base(message)
 {
     this.PosX = message.GetInteger(0);
     this.PosY = message.GetInteger(1);
     this.Block = (SoundBlock)message.GetInteger(2);
     this.SoundId = message.GetUInt(3);
 }
开发者ID:someone243,项目名称:CupCake,代码行数:12,代码来源:SoundPlaceReceiveEvent.cs

示例3: InitReceiveEvent

 /// <summary>
 ///     Initializes a new instance of the <see cref="InitReceiveEvent" /> class.
 /// </summary>
 /// <param name="message">The EE message.</param>
 public InitReceiveEvent(Message message)
     : base(message)
 {
     this.OwnerUsername = message.GetString(0);
     this.WorldName = message.GetString(1);
     this.Plays = message.GetInteger(2);
     this.CurrentWoots = message.GetInteger(3);
     this.TotalWoots = message.GetInteger(4);
     this.Encryption = message.GetString(5);
     this.UserId = message.GetInteger(6);
     this.Face = (Smiley)message.GetInteger(7);
     // Aura
     this.SpawnX = message.GetInteger(9);
     this.SpawnY = message.GetInteger(10);
     this.ChatColor = message.GetUInt(11);
     this.Username = message.GetString(12);
     this.CanEdit = message.GetBoolean(13);
     this.IsOwner = message.GetBoolean(14);
     this.RoomWidth = message.GetInteger(15);
     this.RoomHeight = message.GetInteger(16);
     this.IsTutorialRoom = message.GetBoolean(17);
     this.Gravity = message.GetDouble(18);
 }
开发者ID:someone243,项目名称:CupCake,代码行数:27,代码来源:InitReceiveEvent.cs

示例4: ParseWorld

        private WorldBlock[,,] ParseWorld(Message m, int sizeX, int sizeY, uint offset)
        {
            // Find the start of the world
            uint start = 0;
            for (uint i = offset; i <= m.Count - 1; i++)
            {
                if (m[i] as string != null && m.GetString(i) == "ws")
                {
                    start = i + 1;
                    break;
                }
            }

            // Generate an empty world
            WorldBlock[,,] worldArray = GetEmptyWorld(sizeX, sizeY, Block.GravityNothing, Block.GravityNothing);

            // Parse the world data
            uint pointer = start;
            do
            {
                // Exit once we reached the end
                if (m[pointer] as string != null && m.GetString(pointer) == "we")
                    break;

                var block = (Block)m.GetInteger(pointer++);
                int l = m.GetInteger(pointer++);
                byte[] byteArrayX = m.GetByteArray(pointer++);
                byte[] byteArrayY = m.GetByteArray(pointer++);

                switch (block)
                {
                    case Block.CoinDoor:
                    case Block.CoinGate:
                        uint coinsToCollect = m.GetUInt(pointer++);

                        for (int i = 0; i <= byteArrayX.Length - 1; i += 2)
                        {
                            int x = byteArrayX[i] * 256 + byteArrayX[i + 1];
                            int y = byteArrayY[i] * 256 + byteArrayY[i + 1];
                            worldArray[l, x, y].SetCoinDoor((CoinDoorBlock)block, coinsToCollect);
                        }

                        break;
                    case Block.MusicPiano:
                    case Block.MusicDrum:
                        uint soundId = m.GetUInt(pointer++);

                        for (int i = 0; i <= byteArrayX.Length - 1; i += 2)
                        {
                            int x = byteArrayX[i] * 256 + byteArrayX[i + 1];
                            int y = byteArrayY[i] * 256 + byteArrayY[i + 1];
                            worldArray[l, x, y].SetSound((SoundBlock)block, soundId);
                        }

                        break;
                    case Block.HazardSpike:
                    case Block.DecorSciFi2013BlueSlope:
                    case Block.DecorSciFi2013BlueStraight:
                    case Block.DecorSciFi2013YellowSlope:
                    case Block.DecorSciFi2013YellowStraight:
                    case Block.DecorSciFi2013GreenSlope:
                    case Block.DecorSciFi2013GreenStraight:
                        uint rotation = m.GetUInt(pointer++);

                        for (int i = 0; i <= byteArrayX.Length - 1; i += 2)
                        {
                            int x = byteArrayX[i] * 256 + byteArrayX[i + 1];
                            int y = byteArrayY[i] * 256 + byteArrayY[i + 1];
                            worldArray[l, x, y].SetRotatable((RotatableBlock)block, rotation);
                        }

                        break;
                    case Block.Portal:
                    case Block.InvisiblePortal:
                        var portalRotation = (PortalRotation)m.GetUInt(pointer++);
                        uint portalId = m.GetUInt(pointer++);
                        uint portalTarget = m.GetUInt(pointer++);

                        for (int i = 0; i <= byteArrayX.Length - 1; i += 2)
                        {
                            int x = byteArrayX[i] * 256 + byteArrayX[i + 1];
                            int y = byteArrayY[i] * 256 + byteArrayY[i + 1];
                            worldArray[l, x, y].SetPortal((PortalBlock)block, portalId, portalTarget, portalRotation);
                        }

                        break;
                    case Block.WorldPortal:
                        string worldPortalTarget = m.GetString(pointer++);

                        for (int i = 0; i <= byteArrayX.Length - 1; i += 2)
                        {
                            int x = byteArrayX[i] * 256 + byteArrayX[i + 1];
                            int y = byteArrayY[i] * 256 + byteArrayY[i + 1];
                            worldArray[l, x, y].SetWorldPortal((WorldPortalBlock)block, worldPortalTarget);
                        }

                        break;
                    case Block.DecorSign:
                    case Block.DecorLabel:
                        string text = m.GetString(pointer++);
//.........这里部分代码省略.........
开发者ID:KylerM,项目名称:CupCake,代码行数:101,代码来源:WorldService.cs

示例5: GetWorld

        internal static BlockDataWorld GetWorld(Message m, int width, int height, uint offset = InitOffset)
        {
            var world = new BlockDataWorld(width, height);
            uint pointer = GetStart(m, offset);

            string strValue2;
            while ((strValue2 = m[pointer] as string) == null || strValue2 != "we")
            {
                var block = m.GetInteger(pointer++);
                var l = (Layer)m.GetInteger(pointer++);
                byte[] byteArrayX = m.GetByteArray(pointer++);
                byte[] byteArrayY = m.GetByteArray(pointer++);

                switch (l)
                {
                    case Layer.Background:
                        var bgWorldBlock = new BackgroundBlock((Background.Id)block);
                        foreach (Point pos in GetPos(byteArrayX, byteArrayY))
                            world.Background[pos.X, pos.Y] = new BlockData<BackgroundBlock>(bgWorldBlock);
                        break;

                    case Layer.Foreground:
                        ForegroundBlock foregroundBlock;
                        BlockArgsType blockArgsType = WorldUtils.GetBlockArgsType(WorldUtils.GetForegroundType(id: (Foreground.Id)block));

                        switch (blockArgsType)
                        {
                            case BlockArgsType.None:
                                foregroundBlock = new ForegroundBlock((Foreground.Id)block);
                                break;

                            case BlockArgsType.Number:
                                uint i = m.GetUInt(pointer++);
                                foregroundBlock = new ForegroundBlock((Foreground.Id)block, i);
                                break;

                            case BlockArgsType.String:
                                string str = m.GetString(pointer++);
                                foregroundBlock = new ForegroundBlock((Foreground.Id)block, str);
                                break;

                            case BlockArgsType.Portal:
                                var portalRotation = (Morph.Id)m.GetUInt(pointer++);
                                uint portalId = m.GetUInt(pointer++);
                                uint portalTarget = m.GetUInt(pointer++);
                                foregroundBlock = new ForegroundBlock((Foreground.Id)block, portalId, portalTarget, portalRotation);
                                break;

                            case BlockArgsType.Label:
                                string text = m.GetString(pointer++);
                                string textcolor = m.GetString(pointer++);
                                foregroundBlock = new ForegroundBlock((Foreground.Id)block, text, textcolor);
                                break;

                            default:
                                throw new NotSupportedException("Invalid block.");
                        }

                        var fg = new BlockData<ForegroundBlock>(foregroundBlock);
                        foreach (Point pos in GetPos(byteArrayX, byteArrayY))
                            world.Foreground[pos.X, pos.Y] = fg;
                        break;
                }
            }

            return world;
        }
开发者ID:someone243,项目名称:BotBits,代码行数:67,代码来源:BlockUtils.cs

示例6: Connection_OnMessage

        /// <summary>
        /// Handles all incoming PlayerIO messages
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="m">The message.</param>
        static void Connection_OnMessage(object sender, Message m)
        {
            if (m.Type != "init")
                return;

            Console.WriteLine("Inited");
            globalConn.Disconnect();

            Minimap minimap = new Minimap();
            minimap.width = m.GetInt(15);
            minimap.height = m.GetInt(16);

            minimap.initialize();

            Console.WriteLine("Parsing init data...");

            uint p = 22;
            while (m[p] as string != "ws") p++;

            p++;
            // Parse world data
            while (p < m.Count) {
                uint blockId = m.GetUInt(p);
                int layer = m.GetInt(p + 1);
                byte[] xs = m.GetByteArray(p + 2),
                    ys = m.GetByteArray(p + 3);

                for (var b = 0; b < xs.Length; b += 2) {
                    int nx = (xs[b] << 8) | xs[b + 1],
                        ny = (ys[b] << 8) | ys[b + 1];

                    minimap.drawBlock(layer, nx, ny, blockId);
                }

                p += 4;

                if (m[p] as string == "we")
                    break;

                while (p + 3 < m.Count) {
                    if (m[p + 2] is byte[])
                        break;
                    p++;
                }
            }

            minimap.rewriteForegroundBlocks();
            minimap.Save(worldID + ".png");
            generating_minimap = false;
        }
开发者ID:SmallJoker,项目名称:Squirrel,代码行数:55,代码来源:Program.cs

示例7: ParseWorld

        private WorldBlock[,,] ParseWorld(Message m, int sizeX, int sizeY, uint offset)
        {
            // Find the start of the world
            uint start = 0;
            for (uint i = offset; i <= m.Count - 1; i++)
            {
                string strValue;
                if ((strValue = m[i] as string) != null && strValue == "ws")
                {
                    start = i + 1;
                    break;
                }
            }

            // Generate an empty world
            WorldBlock[,,] worldArray = this.GetEmptyWorld(sizeX, sizeY);

            // Parse the world data
            uint pointer = start;
            string strValue2;
            while ((strValue2 = m[pointer] as string) == null || strValue2 != "we")
            {
                var block = (Block)m.GetInteger(pointer++);
                int l = m.GetInteger(pointer++);

                try
                {
                    byte[] byteArrayX = m.GetByteArray(pointer++);
                    byte[] byteArrayY = m.GetByteArray(pointer++);
                    IEnumerable<WorldBlock> wblocks = this.GetBlocks(l, byteArrayX, byteArrayY, worldArray);

                    if (BlockUtils.IsCoinDoorOrGate(block))
                    {
                        uint coinsToCollect = m.GetUInt(pointer++);
                        foreach (WorldBlock wblock in wblocks)
                            wblock.SetCoinDoor((CoinDoorBlock)block, coinsToCollect);
                    }
                    else if (BlockUtils.IsPurpleDoorOrGateOrSwitch(block))
                    {
                        uint purpleId = m.GetUInt(pointer++);

                        foreach (WorldBlock wblock in wblocks)
                            wblock.SetPurpleDoor((PurpleDoorBlock)block, purpleId);
                    }
                    else if (BlockUtils.IsDeathDoorOrGate(block))
                    {
                        uint deathsRequired = m.GetUInt(pointer++);
                        foreach (WorldBlock wblock in wblocks)
                            wblock.SetDeathDoor((DeathDoorBlock)block, deathsRequired);
                    }
                    else if (BlockUtils.IsSound(block))
                    {
                        uint soundId = m.GetUInt(pointer++);
                        foreach (WorldBlock wblock in wblocks)
                            wblock.SetSound((SoundBlock)block, soundId);
                    }
                    else if (BlockUtils.IsRotatable(block))
                    {
                        uint rotation = m.GetUInt(pointer++);
                        foreach (WorldBlock wblock in wblocks)
                            wblock.SetRotatable((RotatableBlock)block, rotation);
                    }
                    else if (BlockUtils.IsPortal(block))
                    {
                        var portalRotation = (PortalRotation)m.GetUInt(pointer++);
                        uint portalId = m.GetUInt(pointer++);
                        uint portalTarget = m.GetUInt(pointer++);
                        foreach (WorldBlock wblock in wblocks)
                            wblock.SetPortal((PortalBlock)block, portalId, portalTarget, portalRotation);
                    }
                    else if (BlockUtils.IsWorldPortal(block))
                    {
                        string worldPortalTarget = m.GetString(pointer++);
                        foreach (WorldBlock wblock in wblocks)
                            wblock.SetWorldPortal((WorldPortalBlock)block, worldPortalTarget);
                    }
                    else if (BlockUtils.IsSign(block))
                    {
                        string text = m.GetString(pointer++);
                        foreach (WorldBlock wblock in wblocks)
                            wblock.SetSign((SignBlock)block, text);

                    }
                    else if (BlockUtils.IsLabel(block))
                    {
                        string text = m.GetString(pointer++);
                        string textColor = m.GetString(pointer++);
                        foreach (WorldBlock wblock in wblocks)
                            wblock.SetLabel((LabelBlock)block, text, textColor);
                    }
                    else
                    {
                        foreach (WorldBlock wblock in wblocks)
                            wblock.SetBlock(block);
                    }
                }
                catch (Exception ex)
                {
                    this.Logger.Log(LogPriority.Error,
                        "Exception when parsing block {0} on layer {1}. The error was: {2}", block, l, ex.Message);
//.........这里部分代码省略.........
开发者ID:someone243,项目名称:CupCake,代码行数:101,代码来源:WorldService.cs


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