Exemplo n.º 1
0
        protected override void draw(GameGraphic g, int fx, int fy, MapPoint p, int sx, int sy)
        {
            if (map.isOutOfBounds(p))
            {
                return;
            }

            var tile = tileMap[p];

            drawTerrain(g, p, sx, sy, tile, false, false);

            var strongholdId = tileMap.stronghold.getId(tileMap, p);

            if (strongholdId != null)
            {
                drawStronghold(g, sx, sy, (int)strongholdId);
            }

            if (!isEditor)
            {
                drawPlayer(g, p, sx, sy);
            }

            if (p == cursorPosition)
            {
                drawCursor(g, sx, sy);
            }
        }
Exemplo n.º 2
0
        private void initSystem(StateManager sm)
        {
            gameRoot = sm ?? new StateManager();

            gameGraphic = new GameGraphic()
            {
                defaultFontName = "MingLiU",
                defaultFontSize = 12
            };
        }
Exemplo n.º 3
0
        private void drawStronghold(GameGraphic g, int x, int y, int strongholdId)
        {
            if (!strongholdSprite.TryGetValue(strongholdId, out var s))
            {
                return;
            }

            var p = s.currentPoint;

            //g.drawImage(gameWorld.getTileMapImage(s.fileName), x, y, new Rectangle()
            //{
            //    X = p.X,
            //    Y = p.Y,
            //    Width = tileWidth,
            //    Height = tileHeight
            //});
        }
Exemplo n.º 4
0
        private void drawPlayer(GameGraphic g, MapPoint p, int sx, int sy)
        {
            var map = gameWorld.gameData.character.map.Values;

            if (map.Any(o => o.location == p))
            {
                g.drawRectangle(new SpriteRectangle()
                {
                    position = new Point(sx, sy),
                    color    = Color.Red,
                    isFill   = true,
                    size     = new Size()
                    {
                        Width  = tileWidth,
                        Height = tileHeight
                    }
                });
            }
        }
Exemplo n.º 5
0
 static Container()
 {
     Checker     = new Checker();
     GameGraphic = new GameGraphic();
 }
Exemplo n.º 6
0
 protected abstract void draw(GameGraphic g, int fx, int fy, MapPoint p, int sx, int sy);
Exemplo n.º 7
0
        private void drawCursor(GameGraphic g, int sx, int sy)
        {
            selector.position = new Point(sx, sy);

            g.drawRectangle(selector);
        }
Exemplo n.º 8
0
        private void drawTerrain(GameGraphic g, MapPoint p, int x, int y, MapTile t, bool isSurface, bool isSurfaceDone)
        {
            var md = gameWorldData.masterData;
            var tt = md.tileMapTerrain[isSurface ? t.terrainSurface.Value : t.terrain];
            var s  = terrainSprite[tt.imageId];

            switch (gameWorldData.gameDate.season)
            {
            case GameDate.Season.spring:
                if (terrainSpriteSpring.TryGetValue(tt.imageId, out var s1))
                {
                    s = s1;
                }
                break;

            case GameDate.Season.summer:
                if (terrainSpriteSummer.TryGetValue(tt.imageId, out var s2))
                {
                    s = s2;
                }
                break;

            case GameDate.Season.autumn:
                if (terrainSpriteAutumn.TryGetValue(tt.imageId, out var s3))
                {
                    s = s3;
                }
                break;

            case GameDate.Season.winter:
                if (terrainSpriteWinter.TryGetValue(tt.imageId, out var s4))
                {
                    s = s4;
                }
                break;
            }

            if (!s.hasOne)
            {
                return;
            }

            var img = resourcePackageCache.getTileMapImage(s.fileName);

            if (img == null)
            {
                return;
            }

            var point = s.currentPoint;

            var ts = tileSprite;

            ts.position = new Point(x, y);

            //viewMode.drawTerrain(this, ts, t);

            var type = mapSpritesInfo.checkTerrainBorder(p, isSurface);

            ts.refresh(img, point, type);

            g.drawSprite(ts);

            if (t.terrainSurface != null && !isSurfaceDone)
            {
                drawTerrain(g, p, x, y, t, true, true);
            }
        }