Ejemplo n.º 1
0
 public Situation(WarMap warMap, IList<WarSide> troops, WarUnitCollection units)
 {
     _map = warMap;
     Sides = troops;
     _units = units;
     _phaseManager = new PhaseManager();
     _turnManager = new TurnManager();
 }
Ejemplo n.º 2
0
        public DeploymentWindow(List<List<WarUnit>> deployingUnitsList, WarPresentationModel model, WarMap warMap, Action finishDelegate)
        {
            InitializeComponent();
            _deployingUnitsList = deployingUnitsList;
            _index = 0;
            _model = model;
            _warMap = warMap;
            _finishDelegate = finishDelegate;
            _model.SelectMapChipEvent += Deploy;
            _model.CancelMapChipEvent += Undeploy;

            initializeDeployment();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 指定したマップを描画する
        /// </summary>
        /// <param name="e">Paint イベントのデータ</param>
        /// <param name="map">描画するマップ</param>
        public void DrawMap(PaintEventArgs e, WarMap map)
        {
            // 描画範囲の計算
            var g = e.Graphics;
            var rect = e.ClipRectangle;

            int y = rect.Top / _chipPixelSize.Height;
            int endy = (rect.Bottom - 1) / _chipPixelSize.Height;

            for (; y <= endy; y++)
            {
                int gap = _offsetX * (y + 1);
                int x = (rect.Left - gap) / _chipPixelSize.Width;
                int endx = (rect.Right - 1 - gap) / _chipPixelSize.Width;
                for (; x <= endx; x++)
                {
                    var mapchip = map[x, y];
                    var p = ChipPoint2PixelPoint(new Point2(x, y));
                    // 地形描画
                    g.DrawSurface(mapchip.Image, p);
                    // 枠描画
                    //g.DrawRectangle(Pens.Red, new Rectangle(p, _chipPixelSize));

                    // ユニット描画
                    var unit = mapchip.Unit;
                    if (unit != null && unit.Visible)
                    {
                        g.DrawSurface(unit.ChipImage, p);
                        var r1 = new Rectangle(p + new Vector2(2, 2), new Size(6, 6));
                        var r2 = new Rectangle(p + new Vector2(2, 2), new Size(6, 6));
                        if (unit.Side.IsPlayer)
                            g.FillEllipse(Brushes.Blue, r1);
                        else
                            g.FillEllipse(Brushes.Red, r1);
                        g.DrawEllipse(Pens.White, r2);
                    }
                }
            }

            // 現在行動しているユニットがわかるように表示
            if (_model.Situation.ActiveUnit != null)
            {
                var alpha = Global.MainLoop.FrameCount * Global.MainLoop.Fps / 5 % 256;
                if (alpha > 128) alpha = 256 - alpha;
                g.FillRectangle(new SolidBrush(Color.FromArgb(alpha, 255, 255, 0)),
                    new Rectangle(ChipPoint2PixelPoint(_model.Situation.ActiveUnit.Location), _chipPixelSize));
            }
        }
Ejemplo n.º 4
0
        private void updateAreaWithCityRoadWall(WarMap map)
        {
            int city = 0, road = 0, wall = 0;
            for (int widht = 0; widht < map.Width; widht++)
            {
                for (int height = 0; height < map.Height; height++)
                {
                    var land = map[widht, height];
                    if (land.Construct == null)
                        continue;

                    switch (land.Construct.Info.Name)
                    {
                        case "街":
                            city++;
                            break;
                        case "道":
                            road++;
                            break;
                        case "壁":
                            wall++;
                            break;
                    }
                }
            }
            _battleArea.NumCity100 = city * 100;
            _battleArea.NumRoad100 = road * 100;
            _battleArea.NumWall100 = wall * 100;
        }