コード例 #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;
                    }
                }
            }
コード例 #2
0
        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 });
        }
コード例 #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));
     }
 }
コード例 #4
0
        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);
        }
コード例 #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));
        }
コード例 #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);
            }
        }
コード例 #7
0
        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();
        }
コード例 #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);
        }
コード例 #9
0
 public void Move(ScreenCanvas canvas, Point location) { }
コード例 #10
0
 public void Click(ScreenCanvas canvas, Point location) { }
コード例 #11
0
 public void Release(ScreenCanvas canvas, Point location)
 {
     int tilePosX = location.X / canvas.Screen.Tileset.TileSize;
     canvas.Screen.CleaveVertically(tilePosX);
 }
コード例 #12
0
 public void Release(ScreenCanvas canvas, Point location)
 {
     canvas.Screen.Stage.AddContinuePoint(canvas.Screen, location);
 }
コード例 #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);
            }
        }
コード例 #14
0
        public void Release(ScreenCanvas canvas, Point location)
        {

        }
コード例 #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);
        }
コード例 #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);
 }