Beispiel #1
0
 public Bitmap NoCursorMakePictureBox(PictureBox pictureBox, Bitmap canvas, Graphics graphics, int turn)
 {
     Bitmap                       = canvas;
     DrawField.Bitmap             = canvas;
     DrawField.AgentsActivityData = AgentsActivityData;
     DrawField.Draw(turn);
     return(canvas);
 }
Beispiel #2
0
        /// <summary>
        /// PictureBoxを新たに生成します。
        /// </summary>
        /// <param name="pictureBox">表示するPictureBox</param>
        /// <param name="canvas">表示するBitmap</param>
        /// <param name="graphics">表示するGraphics</param>
        /// <param name="turn">表示するターン</param>
        /// <returns></returns>
        public Bitmap MakePictureBox(PictureBox pictureBox, Bitmap canvas, Graphics graphics, int turn)
        {
            var fieldWidth  = ((pictureBox.Width <= 0) ? 1 : pictureBox.Width) / Calc.Field.Width;
            var fieldHeight = ((pictureBox.Height <= 0) ? 1 : pictureBox.Height) / Calc.Field.Height;

            Bitmap = canvas;

            var cursor = CursorPosition(PictureBox);

            DrawField.Bitmap             = canvas;
            DrawField.AgentsActivityData = AgentsActivityData;
            DrawField.Draw(turn, cursor);
            precursor = cursor;
            try
            {
                foreach (var agent in Calc.Agents)
                {
                    if (ClickField.ClickedAgent == agent && cursor.ChebyshevDistance(agent.Position) == 1)
                    {
                        DrawField.DrawArrow(agent.Team, agent.Position, cursor);
                        break;
                    }
                    else if (cursor.ChebyshevDistance(agent.Position) == 1 && cursor.ChebyshevDistance(ClickField.ClickedAgent.Position) != 1)
                    {
                        DrawField.DrawArrow(agent.Team, agent.Position, cursor);
                        break;
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("フィールドの外です。", "エラー", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(canvas);
        }