Exemplo n.º 1
0
            public void Draw(IRenderingContext renderContext, int layer, string text, Point position)
            {
                if (charTex == null)
                    charTex = renderContext.LoadResource(info.ImagePath);

                if (!info.CaseSensitive)
                {
                    text = text.ToUpper();
                }

                int xpos = position.X;

                foreach (char c in text)
                {
                    if (c == ' ')
                    {
                        xpos += info.CharWidth;
                        continue;
                    }

                    var location = info[c];

                    if (location != null)
                    {
                        renderContext.Draw(charTex, layer, new Point(xpos, position.Y),
                            new Rectangle(location.Value.X, location.Value.Y, info.CharWidth, info.CharWidth));

                        xpos += info.CharWidth;
                    }
                }
            }
        public void RightClick(ScreenCanvas surface, Point location)
        {
            int tile_x = location.X / surface.Screen.Tileset.TileSize;
            int tile_y = location.Y / surface.Screen.Tileset.TileSize;

            var tile = surface.Screen.TileAt(tile_x, tile_y);
            ViewModelMediator.Current.GetEvent<TileSelectedEventArgs>().Raise(this, new TileSelectedEventArgs() { Tile = tile });
        }
Exemplo n.º 3
0
 public void RightClick(ScreenCanvas canvas, Point location)
 {
     var i = canvas.Screen.FindEntityAt(location);
     if (i >= 0)
     {
         var e = canvas.Screen.GetEntity(i);
         canvas.Screen.RemoveEntity(e);
         canvas.Screen.Stage.PushHistoryAction(new RemoveEntityAction(e, canvas.Screen));
     }
 }
        public void Release(ScreenCanvas canvas, Point location)
        {
            var args = new TestLocationSelectedEventArgs() {
                Screen = canvas.Screen.Name,
                X = location.X,
                Y = location.Y
            };

            ViewModelMediator.Current.GetEvent<TestLocationSelectedEventArgs>().Raise(this, args);
        }
Exemplo n.º 5
0
        public void Click(ScreenCanvas canvas, Point location)
        {
            var placement = new Common.EntityPlacement() {
                entity = _entity.Name,
                direction = Common.Direction.Unknown,
                screenX = location.X,
                screenY = location.Y
            };

            canvas.Screen.AddEntity(placement);

            canvas.Screen.Stage.PushHistoryAction(new AddEntityAction(placement, canvas.Screen));
        }
Exemplo n.º 6
0
        public HandlerText(SceneTextCommandInfo info, IEntityPool entityPool)
        {
            this.Content    = info.Content ?? String.Empty;
            this.speed      = info.Speed ?? 0;
            this.position   = new MegaMan.Common.Geometry.Point(info.X, info.Y);
            this.entityPool = entityPool;
            this.font       = info.Font ?? "Default";

            if (info.Binding != null)
            {
                this.binding = Binding.Create(info.Binding, this);
            }
        }
        public void Click(ScreenCanvas canvas, Point location)
        {
            int tile_x = location.X / canvas.Screen.Tileset.TileSize;
            int tile_y = location.Y / canvas.Screen.Tileset.TileSize;

            var old = canvas.Screen.TileAt(tile_x, tile_y);

            Flood(canvas, tile_x, tile_y, old.Id, 0, 0);

            canvas.Screen.Stage.PushHistoryAction(new DrawAction("Fill", changes));

            changes.Clear();
        }
Exemplo n.º 8
0
        public void Draw(IResourceImage resource, int layer, MegaMan.Common.Geometry.Point position, MegaRect?sourceRect = null, bool flipHorizontal = false, bool flipVertical = false)
        {
            if (!IsLayerEnabled(layer))
            {
                return;
            }

            var texture = _loadedTextures[resource.ResourceId];
            var batch   = _spriteBatchLayers[layer];

            if (resource.PaletteName != null)
            {
                var palette = PaletteSystem.Get(resource.PaletteName);
                if (palette != null)
                {
                    VerifyPaletteSwaps(palette, resource.ResourceId, texture);
                    texture = this._paletteSwaps[resource.ResourceId][palette.CurrentIndex];
                }
            }

            var destination = new Vector2(position.X, position.Y);

            XnaRect?source = null;

            if (sourceRect != null)
            {
                source = new XnaRect(sourceRect.Value.X, sourceRect.Value.Y, sourceRect.Value.Width, sourceRect.Value.Height);
            }

            SpriteEffects effect = SpriteEffects.None;

            if (flipHorizontal)
            {
                effect = SpriteEffects.FlipHorizontally;
            }
            if (flipVertical)
            {
                effect |= SpriteEffects.FlipVertically;
            }

            batch.Draw(texture,
                       destination, source,
                       _opacityColor, 0,
                       Vector2.Zero, 1, effect, 0);
        }
 public void Move(ScreenCanvas canvas, Point location) { }
 public void Click(ScreenCanvas canvas, Point location) { }
 public void Release(ScreenCanvas canvas, Point location)
 {
     int tilePosX = location.X / canvas.Screen.Tileset.TileSize;
     canvas.Screen.CleaveVertically(tilePosX);
 }
Exemplo n.º 12
0
 public void Release(ScreenCanvas canvas, Point location)
 {
     canvas.Screen.Stage.AddContinuePoint(canvas.Screen, location);
 }
Exemplo n.º 13
0
        public HandlerText(SceneTextCommandInfo info, IEntityPool entityPool)
        {
            this.Content = info.Content ?? String.Empty;
            this.speed = info.Speed ?? 0;
            this.position = new MegaMan.Common.Geometry.Point(info.X, info.Y);
            this.entityPool = entityPool;
            this.font = info.Font ?? "Default";

            if (info.Binding != null)
            {
                this.binding = Binding.Create(info.Binding, this);
            }
        }
Exemplo n.º 14
0
        public void Release(ScreenCanvas canvas, Point location)
        {

        }
Exemplo n.º 15
0
        public void StartStage(string name, string screen = null, Point? startPosition = null)
        {
            var stage = _stageFactory.Get(name);

            if (screen != null && startPosition != null)
                stage.SetTestingStartPosition(screen, startPosition.Value);

            StartAndPushToStack(stage);
        }
Exemplo n.º 16
0
 public static void Draw(IRenderingContext renderContext, int layer, string font, string text, MegaMan.Common.Geometry.Point position)
 {
     fonts[font].Draw(renderContext, layer, text, position);
 }