Beispiel #1
0
 public ActionResult AddLakes(Lakes model)
 {
     using (_db = new Context())
     {
         if (ModelState.IsValid)
         {
             _db.Lakes.Add(model);
             _db.SaveChanges();
         }
     }
     return(RedirectToAction("Index", "Home"));
 }
Beispiel #2
0
        private void drawLandmass(SKCanvas canvas)
        {
            var features = pack.features;
            var chains   = map4Coastline.Paths;
            var paint    = new SKPaint()
            {
                IsAntialias = true
            };

            chains.Keys.forEach(f =>
            {
                var paths = chains[f];
                if (features[f].type == "lake")
                {
                    //landmask
                    paint.Style      = SKPaintStyle.Fill;
                    paint.Color      = Color.Black.SK();
                    paint.MaskFilter = null;
                    paths.ForEach(p => canvas.DrawPath(lineGenZ(p), paint));

                    //lakes
                    var lake    = Lakes.find(l => l.name == features[f].group);
                    paint.Style = SKPaintStyle.Fill;
                    paint.Color = lake.fill.ToColor().Opacity(lake.opacity).SK();
                    paths.ForEach(p => canvas.DrawPath(lineGenZ(p), paint));

                    paint.Style       = SKPaintStyle.Stroke;
                    paint.Color       = lake.stroke.ToColor().Opacity(lake.opacity).SK();
                    paint.StrokeWidth = lake.strokeWidth;
                    paths.ForEach(p => canvas.DrawPath(lineGenZ(p), paint));
                }
                else
                {
                    //landmask
                    paint.Style      = SKPaintStyle.Fill;
                    paint.Color      = Color.White.SK();
                    paint.MaskFilter = null;
                    paths.ForEach(p => canvas.DrawPath(lineGenZ(p), paint));

                    //coastline
                    var g             = features[f].group == "lake_island" ? "lake_island" : "sea_island";
                    var island        = Islands.find(l => l.name == g);
                    paint.Style       = SKPaintStyle.Stroke;
                    paint.Color       = island.stroke.ToColor().Opacity(island.opacity).SK();
                    paint.StrokeWidth = island.strokeWidth;
                    //! TODO 滤镜怎么实现
                    paint.MaskFilter = SKMaskFilter.CreateBlur(SKBlurStyle.Normal, 0.2f);
                    paths.ForEach(p => canvas.DrawPath(lineGenZ(p), paint));
                }
            });
        }
    void GenerateLakes()
    {
        lakes = new Lakes[lakePieces.Randomize];


        for (int i = 0; i < lakes.Length; i++)
        {
            lakes[i] = new Lakes();
            lakes[i].SetUpLakes(lakeXCoord.Randomize, lakeZCoord.Randomize, lakeLength.Randomize, lakeWidth.Randomize);

            for (int x = 0; x < lakes[i].lakeLength; x++)
            {
                int xCoord = lakes[i].xPos + x;

                for (int z = 0; z < lakes[i].lakeHeight; z++)
                {
                    int zCoord = lakes[i].zPos + z;
                    grid[xCoord, zCoord].walkable = false;
                }
            }
        }
    }
Beispiel #4
0
        public ActionResult AddLakes()
        {
            var model = new Lakes();

            return(View(model));
        }
Beispiel #5
0
    void GenerateLakes()
    {
        lakes = new Lakes[lakePieces.Randomize];
        //The amount of lakes is selected here

        for (int i = 0; i < lakes.Length; i++)
        {
            lakes[i] = new Lakes();
            lakes[i].SetUpLakes(lakeXCoord.Randomize, lakeZCoord.Randomize, lakeLength.Randomize, lakeWidth.Randomize);
            //Creates a new lake for each lake. Each lake has its stuff randomized.

            for (int x = 0; x < lakes[i].lakeLength; x++)
            {
                int xCoord = lakes[i].xPos + x;

                for (int z = 0; z < lakes[i].lakeHeight; z++)
                {
                    int zCoord = lakes[i].zPos + z;
                    tiles[xCoord][zCoord] = TileType.Water;
                    //Sets the tile number to be assigned to become a water tile during CreateGrid();
                }
            }
        }
    }