コード例 #1
0
 public ReadOnlyWorldDictionaryItem(ForegroundBlock foreground, int x, int y)
 {
     this._foreground = foreground;
     this._background = null;
     this.X           = x;
     this.Y           = y;
 }
コード例 #2
0
 public void Update(Point point, ForegroundBlock oldBlock, ForegroundBlock newBlock)
 {
     if (!this.TryUpdate(point, oldBlock, newBlock))
     {
         throw new InvalidOperationException("Unable to find the given oldBlock at the given location.");
     }
 }
コード例 #3
0
        public bool TryUpdate(Point point, ForegroundBlock oldBlock, ForegroundBlock newBlock)
        {
            if (!this.InternalForeground.Remove(oldBlock, point))
            {
                return(false);
            }

            this.InternalForeground.Add(newBlock, point);
            return(true);
        }
コード例 #4
0
        public static CountWorld GetClearedWorld(int width, int height, uint borderBlock)
        {
            var world = new CountWorld(width, height);

            // Border drawing
            var maxX  = (uint)(width - 1);
            var maxY  = (uint)(height - 1);
            var block = new ForegroundBlock(borderBlock);

            for (uint y = 0; y <= maxY; y++)
            {
                world.Foreground[0, y]    = block;
                world.Foreground[maxX, y] = block;
            }
            for (uint x = 0; x <= maxX; x++)
            {
                world.Foreground[x, 0]    = block;
                world.Foreground[x, maxY] = block;
            }

            return(world);
        }
コード例 #5
0
 public IBlockQuery <ForegroundBlock, BlocksItem> this[ForegroundBlock block] => this.Foreground[block];
コード例 #6
0
ファイル: DBBrick.cs プロジェクト: EEmulator/EEmulator
        public DBBrick(ForegroundBlock b)
        {
            this.Type = b.Type;

            switch (this.Type)
            {
            case (uint)ItemTypes.CoinDoor:
            case (uint)ItemTypes.CoinGate:
            case (uint)ItemTypes.BlueCoinDoor:
            case (uint)ItemTypes.BlueCoinGate:
            case (uint)ItemTypes.DeathDoor:
            case (uint)ItemTypes.DeathGate:
            case (uint)ItemTypes.SwitchPurple:
            case (uint)ItemTypes.DoorPurple:
            case (uint)ItemTypes.GatePurple:
            case (uint)ItemTypes.EffectTeam:
            case (uint)ItemTypes.TeamDoor:
            case (uint)ItemTypes.TeamGate:
            case (uint)ItemTypes.EffectCurse:
            case (uint)ItemTypes.EffectFly:
            case (uint)ItemTypes.EffectJump:
            case (uint)ItemTypes.EffectProtection:
            case (uint)ItemTypes.EffectRun:
            case (uint)ItemTypes.EffectZombie:
            case (uint)ItemTypes.EffectLowGravity:
            case (uint)ItemTypes.EffectMultijump:
            case (uint)ItemTypes.SwitchOrange:
            case (uint)ItemTypes.DoorOrange:
            case (uint)ItemTypes.GateOrange:
                this.Goal = b.Number;
                break;

            case (uint)ItemTypes.Portal:
            case (uint)ItemTypes.PortalInvisible:
                this.Id       = b.PortalId;
                this.Target   = b.PortalTarget;
                this.Rotation = b.PortalRotation;
                break;

            case (uint)ItemTypes.WorldPortal:
                this.TargetWorld = b.Text;
                break;

            case (uint)ItemTypes.Label:
                this.Text      = b.Text;
                this.TextColor = b.Color;
                this.Goal      = b.WrapLength;
                break;

            case (uint)ItemTypes.Piano:
            case (uint)ItemTypes.Drums:
            case (uint)ItemTypes.Guitar:
                this.Id = b.Number;
                break;

            case (uint)ItemTypes.Spike:
            case (uint)ItemTypes.GlowyLineBlueSlope:
            case (uint)ItemTypes.GlowyLineBlueStraight:
            case (uint)ItemTypes.GlowyLineGreenSlope:
            case (uint)ItemTypes.GlowyLineGreenStraight:
            case (uint)ItemTypes.GlowyLineYellowSlope:
            case (uint)ItemTypes.GlowyLineYellowStraight:
            case (uint)ItemTypes.GlowyLineRedSlope:
            case (uint)ItemTypes.GlowyLineRedStraight:
            case (uint)ItemTypes.OnewayCyan:
            case (uint)ItemTypes.OnewayOrange:
            case (uint)ItemTypes.OnewayYellow:
            case (uint)ItemTypes.OnewayPink:
            case (uint)ItemTypes.OnewayGray:
            case (uint)ItemTypes.OnewayBlue:
            case (uint)ItemTypes.OnewayRed:
            case (uint)ItemTypes.OnewayGreen:
            case (uint)ItemTypes.OnewayBlack:
            case (uint)ItemTypes.OnewayWhite:
            case (uint)ItemTypes.MedievalAxe:
            case (uint)ItemTypes.MedievalBanner:
            case (uint)ItemTypes.MedievalCoatOfArms:
            case (uint)ItemTypes.MedievalShield:
            case (uint)ItemTypes.MedievalSword:
            case (uint)ItemTypes.MedievalTimber:
            case (uint)ItemTypes.ToothBig:
            case (uint)ItemTypes.ToothSmall:
            case (uint)ItemTypes.ToothTriple:
            case (uint)ItemTypes.DojoLightLeft:
            case (uint)ItemTypes.DojoLightRight:
            case (uint)ItemTypes.DojoDarkLeft:
            case (uint)ItemTypes.DojoDarkRight:
            case (uint)ItemTypes.DomesticLightBulb:
            case (uint)ItemTypes.DomesticTap:
            case (uint)ItemTypes.DomesticPainting:
            case (uint)ItemTypes.DomesticVase:
            case (uint)ItemTypes.DomesticTv:
            case (uint)ItemTypes.DomesticWindow:
            case (uint)ItemTypes.HalfBlockDomesticBrown:
            case (uint)ItemTypes.HalfBlockDomesticWhite:
            case (uint)ItemTypes.HalfBlockDomesticYellow:
            case (uint)ItemTypes.Halloween2015WindowRect:
            case (uint)ItemTypes.Halloween2015WindowCircle:
            case (uint)ItemTypes.Halloween2015Lamp:
            case (uint)ItemTypes.NewYear2015Balloon:
            case (uint)ItemTypes.NewYear2015Streamer:
            case (uint)ItemTypes.FairytaleFlowers:
            case (uint)ItemTypes.HalfBlockFairytaleOrange:
            case (uint)ItemTypes.HalfBlockFairytaleGreen:
            case (uint)ItemTypes.HalfBlockFairytaleBlue:
            case (uint)ItemTypes.HalfBlockFairytalePink:
            case (uint)ItemTypes.HalfBlockWhite:
            case (uint)ItemTypes.HalfBlockGray:
            case (uint)ItemTypes.HalfBlockBlack:
            case (uint)ItemTypes.HalfBlockRed:
            case (uint)ItemTypes.HalfBlockOrange:
            case (uint)ItemTypes.HalfBlockYellow:
            case (uint)ItemTypes.HalfBlockGreen:
            case (uint)ItemTypes.HalfBlockCyan:
            case (uint)ItemTypes.HalfBlockBlue:
            case (uint)ItemTypes.HalfBlockPurple:
            case (uint)ItemTypes.SpringDaisy:
            case (uint)ItemTypes.SpringTulip:
            case (uint)ItemTypes.SpringDaffodil:
            case (uint)ItemTypes.SummerIceCream:
            case (uint)ItemTypes.SummerFlag:
            case (uint)ItemTypes.SummerAwning:
            case (uint)ItemTypes.CaveCrystal:
            case (uint)ItemTypes.RestaurantBowl:
            case (uint)ItemTypes.RestaurantCup:
            case (uint)ItemTypes.RestaurantPlate:
            case (uint)ItemTypes.Halloween2016Eyes:
            case (uint)ItemTypes.Halloween2016Rotatable:
            case (uint)ItemTypes.Halloween2016Pumpkin:
            case (uint)ItemTypes.HalfBlockChristmas2016PresentRed:
            case (uint)ItemTypes.HalfBlockChristmas2016PresentGreen:
            case (uint)ItemTypes.HalfBlockChristmas2016PresentWhite:
            case (uint)ItemTypes.HalfBlockChristmas2016PresentBlue:
            case (uint)ItemTypes.HalfBlockChristmas2016PresentYellow:
            case (uint)ItemTypes.Christmas2016LightsDown:
            case (uint)ItemTypes.Christmas2016LightsUp:
            case (uint)ItemTypes.EffectGravity:
            case (uint)ItemTypes.IndustrialPipeThick:
            case (uint)ItemTypes.IndustrialPipeThin:
            case (uint)ItemTypes.IndustrialTable:
            case (uint)ItemTypes.DomesticPipeStraight:
            case (uint)ItemTypes.DomesticPipeT:
            case (uint)ItemTypes.DomesticFrameBorder:
                this.Rotation = b.Number;
                break;

            case (uint)ItemTypes.TextSign:
                this.Text     = b.Text;
                this.SignType = b.SignType;
                break;
            }
        }
コード例 #7
0
 public void Set(ForegroundBlock block)
 {
     this._blocks.Place(this.X, this.Y, block);
 }
コード例 #8
0
 public static bool TryUpdate <T>(this IWorldDictionary <T> worldDictionary, int x, int y, ForegroundBlock oldBlock, ForegroundBlock newBlock) where T : struct
 {
     return(worldDictionary.TryUpdate(new Point(x, y), oldBlock, newBlock));
 }
コード例 #9
0
 public static void Update <T>(this IWorldDictionary <T> worldDictionary, int x, int y, ForegroundBlock oldBlock, ForegroundBlock newBlock) where T : struct
 {
     worldDictionary.Update(new Point(x, y), oldBlock, newBlock);
 }
コード例 #10
0
ファイル: BlockUtils.cs プロジェクト: someone243/BotBits
        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;
        }
コード例 #11
0
ファイル: BlocksItem.cs プロジェクト: someone243/BotBits
 public void Set(ForegroundBlock block)
 {
     this._blocks.Place(this._x, this._y, block);
 }
 public Foreground.Id GetId(ForegroundBlock block)
 {
     return(block.Id);
 }
 public TItem GenerateItem(Point point, ForegroundBlock block)
 {
     return(this._itemGenerator(point, block));
 }
コード例 #14
0
 public Item(ForegroundBlock block, uint x, uint y)
 {
     this.Block = block;
     this.X     = x;
     this.Y     = y;
 }
コード例 #15
0
 public IBlockQuery <ForegroundBlock, ReadOnlyWorldDictionaryItem> this[ForegroundBlock block] => this.Foreground[block];