Example #1
0
 public void KurbagaRandom(OvalShape ovalKurbaga)
 {
     KurbagaYeri.X = rnd.Next(1,42)*20;
     KurbagaYeri.Y = rnd.Next(1,28)*20;
     ovalKurbaga.BackColor = Color.Red;
     ovalKurbaga.Location = KurbagaYeri;
 }
Example #2
0
 public bool ShouldSerializeIndex(OvalShape o)
 {
     return BaseShouldSerializeIndex(o);
 }
Example #3
0
 public void SetIndex(OvalShape o, short Index)
 {
     BaseSetIndex(o, Index);
 }
Example #4
0
 public void ResetIndex(OvalShape o)
 {
     BaseResetIndex(o);
 }
Example #5
0
 public short GetIndex(OvalShape o)
 {
     return BaseGetIndex(o);
 }
Example #6
0
            public EarAnimation(OvalShape ovalEarL, OvalShape ovalEarHoleL, OvalShape ovalEarR, OvalShape ovalEarHoleR, Timer timer, Timer backTimer)
            {
                this.ovalEarL = ovalEarL;
                this.ovalEarHoleL = ovalEarHoleL;
                this.ovalEarR = ovalEarR;
                this.ovalEarHoleR = ovalEarHoleR;

                this.timer = timer;
                this.backTimer = backTimer;
            }
        //yılanın geldiği yöne bağlı olarak kuyruğun hangi sona ekleneceği belirleniyor
        public void YilaniUzat()
        {
            OvalShape yeniOval = new OvalShape();
            yeniOval.Size = new System.Drawing.Size(20, 20);
            yeniOval.BackStyle = BackStyle.Opaque;
            yeniOval.BackColor = Color.FromArgb(rnd.Next(0, 255), rnd.Next(0, 255), rnd.Next(0, 255));
            Form1.frm.shapeContainer1.Shapes.Add(yeniOval);    //çizim alanı içerisine ekleniyor

            if (sag)
            {
                yeniOvalKonum.X = dizi[dizi.Count - 1].Location.X-20;
                yeniOvalKonum.Y = dizi[dizi.Count - 1].Location.Y;
                yeniOval.Location = yeniOvalKonum;
                dizi.Add(yeniOval);

            }
            else if (sol)
            {
                yeniOvalKonum.X = dizi[dizi.Count - 1].Location.X + 20;
                yeniOvalKonum.Y = dizi[dizi.Count - 1].Location.Y;
                yeniOval.Location = yeniOvalKonum;

                dizi.Add(yeniOval);
            }
            else if (asagi)
            {
                yeniOvalKonum.X = dizi[dizi.Count - 1].Location.X;
                yeniOvalKonum.Y = dizi[dizi.Count - 1].Location.Y-20;
                yeniOval.Location = yeniOvalKonum;
                dizi.Add(yeniOval);
            }
            else if (yukari)
            {
                yeniOvalKonum.X = dizi[dizi.Count - 1].Location.X;
                yeniOvalKonum.Y = dizi[dizi.Count - 1].Location.Y + 20;
                yeniOval.Location = yeniOvalKonum;
                dizi.Add(yeniOval);
            }
        }
Example #8
0
        /// <summary>
        /// Check that the move is valid. Return a string error message if it is not, and the empty
        /// string "" if it is.
        /// </summary>
        /// <param name="boardSpot">the RectangleShape the user clicked on</param>
        /// <returns>string with either the error message or "" indicating no error</returns>
        private string checkMove(RectangleShape boardSpot)
        {
            //bool isGoodDistance = false;
            bool isJump = false;

            // convert the boardSpot and the piece that is moving locations to positions
            int[] boardPos = this.MyBoard.ConvertLocToBoardPos(boardSpot.Location, "RectangleShape");
            int[] movePiecePos = this.MyBoard.ConvertLocToBoardPos(
                this.PieceToMove.Location, "OvalShape");

            int deltaPosX = boardPos[1] - movePiecePos[1];
            int deltaPosY = boardPos[2] - movePiecePos[2];

            // if 2 spaces being moved in x- and y-directions, it is a jump (note that double-
            //   jumping is not currently supported
            if (Math.Abs(deltaPosX) == 2 && Math.Abs(deltaPosY) == 2)
            {
                isJump = true;
            }

            if (isJump)                                                             // is a jump
            {
                // find the position that would be jumped by taking the average of current location
                //   and the desired location
                int possibleJumpPiecePosX = (boardPos[1] + movePiecePos[1]) / 2;
                int possibleJumpPiecePosY = (boardPos[2] + movePiecePos[2]) / 2;
                int[] possibleJumpPiecePos = { possibleJumpPiecePosX, possibleJumpPiecePosY};

                int[] possibleJumpLoc = this.MyBoard.ConvertBoardPosToLoc(
                    possibleJumpPiecePos, "OvalShape");

                // if no piece to jump in the location, return error message
                if (this.MyBoard.PiecesOnBoard[possibleJumpLoc[0]] == null)
                {
                    return "No piece to jump!";
                }
                else
                {
                    // set this.PieceToTake appropriately
                    this.PieceToTake = Ovals.Where(o => o.Location.X == possibleJumpLoc[1]).Where(
                        o2 => o2.Location.Y == possibleJumpLoc[2]).First();
                }

                // Check that you are not jumping a piece of the same color
                if ((this.PieceToTake.Tag.ToString() == "b,n" ||
                    this.PieceToTake.Tag.ToString() == "b,k") &&
                    (this.PieceToMove.Tag.ToString() == "b,n" ||
                    this.PieceToMove.Tag.ToString() == "b,k"))      // black jumping black
                {
                    this.PieceToTake = null;
                    return "Cannot jump black piece!!!";
                }
                else if ((this.PieceToTake.Tag.ToString() == "r,n" ||
                    this.PieceToTake.Tag.ToString() == "r,k") &&
                    (this.PieceToMove.Tag.ToString() == "r,n" ||
                    this.PieceToMove.Tag.ToString() == "r,k"))      // red jumping red
                {
                    this.PieceToTake = null;
                    return "Cannot jump red piece!!!";
                }

                // Check black non-king pieces for good move distance
                if (this.PieceToMove.Tag.ToString() == "r,n")                   // piece is red
                {
                    if (deltaPosY == -2 && (deltaPosX == 2 || deltaPosX == -2))
                    {
                        return "";
                    }
                    else
                    {
                        return "Invalid black jump!";
                    }
                }

                // Check red non-king pieces for good move distance
                if (this.PieceToMove.Tag.ToString() == "b,n")                   // piece is red
                {
                    if (deltaPosY == 2 && (deltaPosX == 2 || deltaPosX == -2))
                    {
                        return "";
                    }
                    else
                    {
                        return "Invalid red jump!";
                    }
                }

                //// Check kings for good move distance
                //if (this.PieceToMove.Tag.ToString() == "r,k" ||
                //        this.PieceToMove.Tag.ToString() == "b,k")               // piece is a king
                //{
                //    if (Math.Abs(deltaPosY) == 2 && Math.Abs(deltaPosX) == 2)
                //    {
                //        return "";
                //    }
                //    else
                //    {
                //        return "Invalid king jump!!!";
                //    }
                //}

            }
            else                                                                    // not a jump
            {
                // Check red non-king pieces for good move distance
                if (this.PieceToMove.Tag.ToString() == "r,n")                       // piece is red
                {
                    if (deltaPosY == -1 && (deltaPosX == 1 || deltaPosX == -1))
                    {
                        return "";
                    }
                    else
                    {
                        return "Invalid red move!";
                    }
                }

                // Check black non-king pieces for good move distance
                if (this.PieceToMove.Tag.ToString() == "b,n")                   // piece is black
                {
                    if (deltaPosY == 1 && (deltaPosX == 1 || deltaPosX == -1))
                    {
                        return "";
                    }
                    else
                    {
                        return "Invalid black move!";
                    }
                }

                // Check kings for good move distance
                if (this.PieceToMove.Tag.ToString() == "r,k" ||
                        this.PieceToMove.Tag.ToString() == "b,k")               // piece is a king
                {
                    if (Math.Abs(deltaPosY) == 1 && Math.Abs(deltaPosX) == 1)
                    {
                        return "";
                    }
                    else
                    {
                        return "Invalid king move!";
                    }
                }
            }

            return "";
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="info"></param>
        public BOMChartDynamically(BOMTool info)
        {
            mainForm = info;
            MaxCount = Count();

            //ClientDataControl.Client = mainForm.CompanyName;

            for (int i = 0; i < MaxCount; i++)
            {
                circle[i] = new OvalShape();
                labelInfo[i] = new Label();
                objectivesCheckBox[i] = new CheckBox();
                categoryLabel[i] = new Label();
                labelHide[i] = false;
                newDiff[i] = new float();
                newCrit[i] = new float();
                newEff[i] = new int();
                catArray[i] = new int();
                objArray[i] = new int();
                iniArray[i] = new int();

                count[i] = new int();
                clickArray[i] = new int();
                for (int j = 0; j < 100; j++)
                {
                    difArray[i, j] = new float();
                    effArray[i, j] = new float();
                    criArray[i, j] = new float();
                    locX[i, j] = new int();
                    locY[i, j] = new int();
                    //access[i, j] = new string("", j);
                }
            }

            panelChart.Parent = this;
            panelList.Parent = this;
            btnClose.Parent = this;
            btnReset.Parent = this;
            btnUndo.Parent = this;
            btnSave.Parent = this;
            btnUpdate.Parent = this;
            infoPanel.Parent = this;

            infoGridView.Parent = infoPanel;
            infoLabel.Parent = infoPanel;

            ShapeContainer canvas = new ShapeContainer();
            canvas.Parent = panelChart;

            lineX.Parent = canvas;
            lineY.Parent = canvas;
            diffLabel.Parent = panelChart;
            origin.Parent = panelChart;
            endX.Parent = panelChart;
            endY.Parent = panelChart;
            endXLine.Parent = canvas;
            endYLine.Parent = canvas;

            panelChart.Width = 550;
            panelChart.Height = 550;

            panelList.Width = 200;
            panelList.Height = 400;

            infoPanel.Width = 770;
            infoPanel.Height = 140;
            infoPanel.AutoScroll = true;

            infoLabel.Width = 770;
            infoLabel.Height = 20;
            infoLabel.Font = new Font("Arial", 12);
            infoLabel.Text = "View Bubble: ";

            infoGridView.Width = 770;
            infoGridView.Height = 100;
            infoGridView.AllowUserToAddRows = false;
            infoGridView.AllowUserToDeleteRows = false;
            infoGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

            DataGridViewCellStyle columnHeaderStyle = new DataGridViewCellStyle();
            columnHeaderStyle.BackColor = Color.Aqua;
            columnHeaderStyle.Font = new Font("Verdana", 12, FontStyle.Bold);
            columnHeaderStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            infoGridView.ColumnHeadersDefaultCellStyle = columnHeaderStyle;

            DataGridViewCellStyle rowStyle = new DataGridViewCellStyle();
            rowStyle.Font = new Font("Verdana", 12);
            rowStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
            infoGridView.RowsDefaultCellStyle = rowStyle;

            infoGridView.ColumnCount = 4;
            infoGridView.Columns[0].Name = "Imperative";
            infoGridView.Columns[1].Name = "Differentiation";
            infoGridView.Columns[2].Name = "Criticality";
            infoGridView.Columns[3].Name = "Effectiveness";

            infoGridView.RowHeadersVisible = false;
            infoGridView.AutoSize = true;

            panelList.AutoScroll = true;

            diffLabel.AutoSize = true;
            diffLabel.Text = "Differentiation";
            diffLabel.Font = new Font("Arial", 14, FontStyle.Bold);
            diffLabel.BringToFront();

            origin.AutoSize = true;
            origin.Text = "0";
            origin.Font = new Font("Arial", 12);

            endX.AutoSize = true;
            endX.Text = "10";
            endX.Font = new Font("Arial", 12);

            endY.AutoSize = true;
            endY.Text = "10";
            endY.Font = new Font("Arial", 12);

            //criticLabel.AutoSize = true;
            //criticLabel.Text = "Criticality";
            //criticLabel.Font = new Font("Arial", 14, FontStyle.Bold);
            //diffLabel.Font.Size = 14;
            //diffLabel.Font.Name = "Arial";
            //diffLabel.Font.Bold = true;

            diffLabel.Location = new Point(panelChart.Width / 2 - diffLabel.Width / 2, panelChart.Height - diffLabel.Height - 5);

            Size btnSize = new Size(200, 35);
            Size btnSmallSize = new Size(95, 35);

            btnClose.Size = btnSize;
            btnReset.Size = btnSmallSize;
            btnUndo.Size = btnSmallSize;
            btnSave.Size = btnSize;
            btnUpdate.Size = btnSize;

            btnClose.Text = "Close";
            btnReset.Text = "Reset";
            btnUndo.Text = "Undo";
            btnSave.Text = "Save Image";
            btnUpdate.Text = "Update";

            btnClose.TextAlign = ContentAlignment.MiddleCenter;

            lineX.X1 = 30;
            lineX.X2 = panelChart.Width - 20;
            lineX.Y1 = panelChart.Height - 30;
            lineX.Y2 = panelChart.Height - 30;
            lineX.Enabled = false;

            lineY.X1 = 30;
            lineY.X2 = 30;
            lineY.Y1 = 20;
            lineY.Y2 = panelChart.Height - 30;
            lineY.Enabled = false;

            endXLine.X1 = lineX.X2;
            endXLine.X2 = lineX.X2;
            endXLine.Y1 = lineX.Y1;
            endXLine.Y2 = lineX.Y1 + 5;

            endYLine.X1 = lineY.X1 - 5;
            endYLine.X2 = lineY.X1;
            endYLine.Y1 = lineY.Y1;
            endYLine.Y2 = lineY.Y1;

            origin.Location = new Point(lineX.X1 - origin.Size.Width, lineX.Y1);
            endX.Location = new Point(endXLine.X2 - endX.Size.Width / 2, endXLine.Y2);
            endY.Location = new Point(endYLine.X1 - endY.Size.Width, endYLine.Y1);

            origin.BringToFront();
            endX.BringToFront();
            endY.BringToFront();

            this.SizeChanged += new EventHandler(BOMChartDynamically_SizeChanged);
            SizeChanged += new EventHandler(panelChart_SizeChanged);
            SizeChanged += new EventHandler(panelList_SizeChanged);
            SizeChanged += new EventHandler(infoPanel_SizeChanged);

            panelChart.BackColor = Color.White;
            panelList.BackColor = Color.LightGray;
            infoPanel.BackColor = Color.DimGray;

            panelChart.Location = new Point(5, 5);
            panelList.Location = new Point(570, 5);
            infoPanel.Location = new Point(5, 560);
            infoLabel.Location = new Point(0, 0);
            infoGridView.Location = new Point(0, 20);

            btnUndo.Location = new Point(570, panelList.Height + 10);
            btnReset.Location = new Point(570 + btnUndo.Width, panelList.Height + 10);
            btnUpdate.Location = new Point(570, btnUndo.Location.Y + 38);
            btnSave.Location = new Point(570, btnUpdate.Location.Y + 38);
            btnClose.Location = new Point(570, btnSave.Location.Y + 38);

            btnUndo.Click += new EventHandler(btnUndo_Click);
            btnReset.Click += new EventHandler(btnReset_Click);
            btnSave.Click += new EventHandler(btnSave_Click);
            btnClose.Click += new EventHandler(btnClose_Click);
            btnUpdate.Click += new EventHandler(btnUpdate_Click);

            //picBox.Parent = panelChart;

            //panelChart.Paint += new PaintEventHandler(OnPaintBackground);
            //picBox.BringToFront();

            int rowCount = 0;
            objCount = 0;

            int cirCount = 0;
            int objectivesCount = 0;
            mouseDown = false;

            for (int i = 0; i < circleCount; i++)
            {
                if (labelInfo[i] != null)
                {
                    labelInfo[i].ResetText();
                    labelInfo[i] = new Label();
                }
            }

            for (int i = 0; i < circleCount; i++)
            {
                if (circle[i] != null)
                {
                    circle[i].Hide();
                    circle[i] = new OvalShape();
                }
            }

            circleCount = 0;
            labelCount = 0;

            int x = 5;
            int y = 5;

            if (mainForm == null)
            {
                this.Hide();
            }

            int valOfCount = 0;

            for (int i = 0; i < mainForm.Categories.Count; i++)
            {
                rowCount++;
                categoryLabel[i].Parent = panelList;
                categoryLabel[i].Text = mainForm.Categories[i].name;
                categoryLabel[i].AutoSize = true;
                categoryLabel[i].Font = new Font("Arial", 12, FontStyle.Bold);
                categoryLabel[i].BackColor = Color.Orange;
                y += i * 24;
                categoryLabel[i].Location = new Point(x, y);
                for (int j = 0; j < mainForm.Categories[i].Objectives.Count; j++)
                {
                    rowCount++;
                    objectivesCheckBox[objCount].Parent = panelList;
                    //System.Diagnostics.Trace.WriteLine(mainForm.Categories[i].Objectives[j].Name);
                    objectivesCheckBox[objCount].Text = mainForm.Categories[i].Objectives[j].ObjName;
                    objectivesCheckBox[objCount].Name = objectivesCheckBox[j].Text;
                    y += 24;
                    objectivesCheckBox[objCount].Location = new Point((x + 10), y);
                    objectivesCheckBox[objCount].Font = new Font("Arial", 12);
                    objectivesCheckBox[objCount].AutoSize = true;
                    objectivesCheckBox[objCount].BackColor = mainForm.Categories[i].Objectives[j].BackColor;
                    if (valOfCount > 0 && objectivesCheckBox[objCount - valOfCount].BackColor ==  objectivesCheckBox[objCount].BackColor)
                        objectivesCheckBox[objCount].BackColor = Color.FromArgb(random.Next(225), random.Next(225), random.Next(225), random.Next(225));
                    objectivesCheckBox[objCount].Checked = true;
                    objectivesCheckBox[objCount].CheckedChanged += new EventHandler(checkBox_CheckedChanged);
                    valOfCount++;
                    //if (objectivesCheckBox[objectivesCount].Checked)
                    //{
                        for (int k = 0; k < mainForm.Categories[i].Objectives[j].Imperatives.Count; k++)
                        {
                            name = mainForm.Categories[i].Objectives[j].Imperatives[k].Name;
                            criticality = mainForm.Categories[i].Objectives[j].Imperatives[k].Criticality;
                            differentiation = mainForm.Categories[i].Objectives[j].Imperatives[k].Differentiation;
                            effectiveness = mainForm.Categories[i].Objectives[j].Imperatives[k].Effectiveness;

                            catArray[cirCount] = i;
                            objArray[cirCount] = j;
                            iniArray[cirCount] = k;

                            float effective = effectiveness * 20;
                            int effectivenessBig = (int)(effective);
                            newEff[cirCount] = effectivenessBig;
                            effArray[cirCount, 0] = effectiveness;

                            float critical = criticality * ((lineY.Y2 - lineY.Y1) / 10);
                            int newCriticality = (int)(critical);
                            newCrit[cirCount] = criticality;
                            criArray[cirCount, 0] = criticality;

                            float different = differentiation * ((lineX.X2 - lineX.X1) / 10);
                            int newDifferentiation = (int)(different);
                            newDiff[cirCount] = differentiation;
                            difArray[cirCount, 0] = differentiation;

                            System.Diagnostics.Trace.WriteLine("Diff: " + newDifferentiation.ToString() + "  Critic: " + newCriticality.ToString());

                            circle[cirCount].Parent = canvas;

                            circle[cirCount].FillStyle = FillStyle.Solid;
                            circle[cirCount].FillColor = objectivesCheckBox[objectivesCount].BackColor;

                            circle[cirCount].Name = (i + 1).ToString() + "." + (j + 1).ToString() + "." + (k + 1).ToString() + " " + name;

                            circle[cirCount].AccessibleName = "Differentiation: " + differentiation.ToString() + ",  Criticality: " + criticality.ToString()
                                + ",  Effectiveness: " + effectiveness.ToString();

                            //circle[cirCount].AccessibleDescription = circle[cirCount].Name + "\n" + circle[cirCount].AccessibleName;

                            circle[cirCount].Visible = true;
                            circle[cirCount].Location = new System.Drawing.Point((30 + (int)(newDifferentiation) - (int)effectivenessBig / 2), (lineX.Y1 - (int)(newCriticality) - (int)(effectivenessBig / 2)));
                            circle[cirCount].Size = new System.Drawing.Size(effectivenessBig, effectivenessBig);

                            locX[cirCount, 0] = circle[cirCount].Left;
                            locY[cirCount, 0] = circle[cirCount].Top;
                            count[cirCount] = 0;
                            access1[cirCount, 0] = circle[cirCount].Name;
                            access2[cirCount, 0] = circle[cirCount].AccessibleName;

                            System.Diagnostics.Trace.WriteLine("X: " + circle[cirCount].Location.X.ToString() + "  Y: " + circle[cirCount].Location.Y.ToString());

                            circle[cirCount].MouseClick += new MouseEventHandler(circle_MouseClick);
                            circle[cirCount].MouseDown += new MouseEventHandler(circle_MouseDown);
                            circle[cirCount].MouseMove += new MouseEventHandler(circle_MouseMove);
                            circle[cirCount].MouseUp += new MouseEventHandler(circle_MouseUp);

                            rowCount++;
                            circleCount++;
                            cirCount++;
                            imperativesCount++;

                        }
                    //}*/
                    objectivesCount++;
                    objCount++;
                }
                y += 10;
            }
            panelChart.Paint += new PaintEventHandler(picBox_Paint);

            Bitmap bmp = new Bitmap(panelChart.Width, panelChart.Height);
            //new Bitmap(this.panelChart.Width,this.panelChart.Height);
            panelChart.DrawToBitmap(bmp, new Rectangle(5, 5, bmp.Width, bmp.Height));
            //System.Diagnostics.Trace.WriteLine("path: " + Application.StartupPath.ToString());
            bmp.Save(ClientDataControl.Client.FilePath + "/BubbleChart.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
            bmp.Save(Directory.GetCurrentDirectory() + @"/Charts/" + "BubbleChart.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);

            InitializeComponent();

            //this.panelChart.Paint += new PaintEventHandler(picBox_Paint);
            //GenerateText();
        }
Example #10
0
        public void IlkDegerAtama(OvalShape oval1, OvalShape oval2, OvalShape oval3, OvalShape oval4, OvalShape oval5, OvalShape oval6)
        {
            this.oval1 = oval1;
            this.oval2 = oval2;
            this.oval3 = oval3;
            this.oval4 = oval4;
            this.oval5 = oval5;
            this.oval6 = oval6;

            dizi.Add(this.oval1);
            dizi.Add(this.oval2);
            dizi.Add(this.oval3);
            dizi.Add(this.oval4);
            dizi.Add(this.oval5);
            dizi.Add(this.oval6);
            puan = 0;
        }
        private void checkBox_CheckedChanged(object sender, EventArgs e)
        {
            int rowCount = 0;

            int cirCount = 0;
            int objectivesCount = 0;
            mouseDown = false;

            for (int i = 0; i < circleCount; i++)
            {
                if (labelInfo[i] != null)
                {
                    labelInfo[i].ResetText();
                    labelInfo[i] = new Label();
                }
            }

            for (int i = 0; i < circleCount; i++)
            {
                //circle[i].
                if (circle[i] != null)
                {
                    circle[i].Hide();
                    circle[i] = new OvalShape();
                }
            }

            lineX.BringToFront();
            lineY.BringToFront();

            circleCount = 0;
            labelCount = 0;

            ShapeContainer canvas = new ShapeContainer();
            canvas.Parent = panelChart;

            if (mainForm == null)
            {
                this.Hide();
            }

            for (int i = 0; i < mainForm.Categories.Count; i++)
            {
                rowCount++;
                for (int j = 0; j < mainForm.Categories[i].Objectives.Count; j++)
                {
                    rowCount++;
                    if (objectivesCheckBox[objectivesCount].Checked)
                    {
                        for (int k = 0; k < mainForm.Categories[i].Objectives[j].Imperatives.Count; k++)
                        {
                            name = mainForm.Categories[i].Objectives[j].Imperatives[k].Name;
                            criticality = mainForm.Categories[i].Objectives[j].Imperatives[k].Criticality;
                            differentiation = mainForm.Categories[i].Objectives[j].Imperatives[k].Differentiation;
                            effectiveness = mainForm.Categories[i].Objectives[j].Imperatives[k].Effectiveness;

                            catArray[cirCount] = i;
                            objArray[cirCount] = j;
                            iniArray[cirCount] = k;

                            float effective = effectiveness * 20;
                            int effectivenessBig = (int)(effective);
                            newEff[cirCount] = effectivenessBig;
                            effArray[cirCount, 0] = effectiveness;

                            float critical = criticality * ((lineY.Y2 - lineY.Y1) / 10);
                            int newCriticality = (int)(critical);
                            newCrit[cirCount] = criticality;
                            criArray[cirCount, 0] = criticality;

                            float different = differentiation * ((lineX.X2 - lineX.X1) / 10);
                            int newDifferentiation = (int)(different);
                            newDiff[cirCount] = differentiation;
                            difArray[cirCount, 0] = differentiation;

                            circle[cirCount].Parent = canvas;

                            circle[cirCount].FillStyle = FillStyle.Solid;
                            circle[cirCount].FillColor = objectivesCheckBox[objectivesCount].BackColor;

                            circle[cirCount].Name = (i + 1).ToString() + "." + (j + 1).ToString() + "." + (k + 1).ToString() + " " + name;

                            circle[cirCount].AccessibleName = "Differentiation: " + differentiation.ToString() + "\nCriticality: " + criticality.ToString() + "\nEffectiveness: " + effectiveness.ToString();

                            circle[cirCount].Visible = true;
                            circle[cirCount].Location = new System.Drawing.Point((30 + (int)(newDifferentiation) - (int)effectivenessBig / 2), (lineX.Y1 - (int)(newCriticality) - (int)(effectivenessBig / 2)));
                            circle[cirCount].Size = new System.Drawing.Size(effectivenessBig, effectivenessBig);

                            circle[cirCount].AccessibleDescription = circle[cirCount].Name + "\n" + circle[cirCount].AccessibleName;

                            locX[cirCount, 0] = circle[cirCount].Left;
                            locY[cirCount, 0] = circle[cirCount].Top;
                            count[cirCount] = 0;
                            access1[cirCount, 0] = circle[cirCount].Name;
                            access2[cirCount, 0] = circle[cirCount].AccessibleName;

                            circle[cirCount].MouseClick += new MouseEventHandler(circle_MouseClick);
                            circle[cirCount].MouseDown += new MouseEventHandler(circle_MouseDown);
                            circle[cirCount].MouseMove += new MouseEventHandler(circle_MouseMove);
                            circle[cirCount].MouseUp += new MouseEventHandler(circle_MouseUp);

                            rowCount++;
                            circleCount++;
                            cirCount++;

                        }
                    }
                    objectivesCount++;
                }
            }

            Bitmap bmp = new Bitmap(panelChart.Width, panelChart.Height);
            panelChart.DrawToBitmap(bmp, new Rectangle(5, 5, panelChart.Width, panelChart.Height));
            bmp.Save(Directory.GetCurrentDirectory() + @"/Charts/" + "BubbleChart.jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
        }
Example #12
0
        /// <summary>
        /// This is called after checkMove validates the move is legal, and it updates all the
        /// appropriate values to signify a successful move.
        /// </summary>
        /// <param name="boardSpot">the RectangleShape the user clicked on</param>
        private void movePiece(RectangleShape boardSpot)
        {
            int oldSpot = 0;

            // loop through PiecesOnBoard to find the old spot number
            for (int i = 1; i < 65; i++)
            {
                if (this.MyBoard.PiecesOnBoard[i] == this.PieceToMove.Name)
                {
                    oldSpot = i;
                    break;
                }
            }

            // set this.MyBoard.PiecesOnBoard to the new values to reflect the move
            string spotNumber = boardSpot.Name.ToString().Split('e')[3];
            int intSpot = Convert.ToInt16(spotNumber);
            this.MyBoard.PiecesOnBoard[intSpot] = this.PieceToMove.Name;
            this.MyBoard.PiecesOnBoard[oldSpot] = null;     // remove old location

            // add 8 to the boardSpot location values to account for piece offset
            Point newLoc = new Point(8 + boardSpot.Location.X,
                8 + boardSpot.Location.Y);

            this.PieceToMove.Location = newLoc;             // move the piece in the GUI
            this.PieceToMove = null;

            // if there is a piece to take:
            if (this.PieceToTake != null)
            {
                // get the position of the piece to take
                int[] pieceToTakePos = this.MyBoard.ConvertLocToBoardPos(this.PieceToTake.Location,
                    "OvalShape");

                // move the OvalShape that was taken to (-100,-100)
                OvalShape ovalToRemove = new OvalShape();
                ovalToRemove = Ovals.Where(o => o.Name == this.PieceToTake.Name).First();
                ovalToRemove.Location = new Point(-100, -100);

                // remove the piece from this.MyBoard.PiecesOnBoard
                this.MyBoard.PiecesOnBoard[pieceToTakePos[0]] = null;

                // subtract one from pieces remaining every time a piece is captured
                if (this.PieceToTake.Tag.ToString() == "r,n" || this.PieceToTake.Tag.ToString() == "r,k")
                {
                    this.PiecesRemainingRed -= 1;
                }
                else
                {
                    this.PiecesRemainingBlack -= 1;
                }

                // print who wins to the message box if pieces remaining for the opponent is 0
                if (this.PiecesRemainingBlack == 0)
                {
                    txtMessageBox.Text = "RED WINS!!!";
                }
                else if (this.PiecesRemainingRed == 0)
                {
                    txtMessageBox.Text = "BLACK WINS!!!";
                }

                this.PieceToTake = null;
            }

            // Move succeeded, change whose turn it it:
            if (this.IsRedTurn)
                this.IsRedTurn = false;
            else
                this.IsRedTurn = true;
        }
Example #13
0
        //// set this.PieceToMove, return false if there was a piece there already
        //private string setPieceToMove(OvalShape ovalSender)
        //{
        //    if (this.PieceToMove == null)       // piece is not already selected
        //    {
        //        this.PieceToMove = ovalSender;
        //        return "";
        //    }
        //    // clicked on one piece then another:
        //    else
        //    {
        //        return "There is a piece already there!";
        //    }
        //}
        // Check whose turn it is and return error if not your turn
        /// <summary>
        /// Check whose turn it is and return false bool if not your turn
        /// </summary>
        /// <param name="ovalSender">This is the OvalShape that the user clicked on</param>
        /// <returns>Returns bool true if it is your turn and false otherwise</returns>
        private bool isMyTurnCheck(OvalShape ovalSender)
        {
            if (IsRedTurn)                                                  // it's red's turn
            {
                if (ovalSender.Tag.ToString() == "b,n" ||
                    ovalSender.Tag.ToString() == "b,k")                     // piece is black
                {
                    txtMessageBox.Text = "It's red's turn!";
                    return false;
                }
            }
            else if (!IsRedTurn)                                            // it's black's turn
            {
                if (ovalSender.Tag.ToString() == "r,n" ||
                    ovalSender.Tag.ToString() == "r,k")                     // piece is red
                {
                    txtMessageBox.Text = "It's black's turn!";
                    return false;
                }
            }

            return true;                                                    // it is your turn
        }
Example #14
0
 private void PlaceOvals(OvalShape[,] zone)
 {
     var ovalShapes = new Microsoft.VisualBasic.PowerPacks.ShapeContainer()
     {
         Dock = DockStyle.Fill,
         Margin = new Padding(0),
         Padding = new Padding(0),
     };
     for (int x = 0; x < 7; x++)
     {            
         for (int y = 0; y < 6; y++)
         {
             OvalShape ovl = new OvalShape();
             ovl.Width = 20;
             ovl.Height = 20;
             
             ovl.FillStyle = FillStyle.Solid;
             ovl.FillColor = Color.White;
             ovl.BorderWidth = 0;
             ovl.Location = new Point(521 + (x * 34), 71 + (y * 24));
             ovl.Visible = true;
             ovalShapes.Shapes.Add(ovl);
             zone[x, y] = ovl;                  
         }
     }
     this.Controls.Add(ovalShapes);
 }
Example #15
0
        public void HucreIlerlet(Boolean sag, Boolean sol, Boolean asagi, Boolean yukari,Timer timer,OvalShape ovalKurbaga)
        {
            this.sag = sag;
            this.sol = sol;
            this.asagi = asagi;
            this.yukari = yukari;

            if (sag)  //sağa doğru gidiyorsa
            {

                yer2 = dizi[0].Location;
                Boolean kontrol = true;
                ClickRight();
                for (int i = 1; i < dizi.Count; i++)
                {
                    yer1 = yer3;
                    yer3 = dizi[i].Location;                 //yılanın vücudu 1 birim öteye kaydırılıyor
                    if (kontrol)
                    {
                        dizi[i].Location = yer2;
                        kontrol = false;
                    }
                    else
                    {
                        dizi[i].Location = yer1;
                    }
                }
                YilanVucutCarpisma(timer);
                if (dizi[0].Location.X == Form1.frm.Width - 20)  //sınırlara çarpıp çarpmadığı kontrol ediliyor
                {
                    YilanBasiKonumu.X = 0;
                    YilanBasiKonumu.Y=dizi[0].Location.Y;
                    dizi[0].Location = YilanBasiKonumu;

                }
            }
            else if (sol)
            {
                yer2 = dizi[0].Location;
                Boolean kontrol = true;
                ClickLeft();
                for (int i = 1; i < dizi.Count; i++)
                {
                    yer1 = yer3;
                    yer3 = dizi[i].Location;
                    if (kontrol)
                    {
                        dizi[i].Location = yer2;
                        kontrol = false;
                    }
                    else
                    {
                        dizi[i].Location = yer1;
                    }
                }
                if (dizi[0].Location.X == -20)  //sınırlara çarpıp çarpmadığı kontrol ediliyor
                {
                    YilanBasiKonumu.X = 880;
                    YilanBasiKonumu.Y = dizi[0].Location.Y;
                    dizi[0].Location = YilanBasiKonumu;
                }
                YilanVucutCarpisma(timer);
            }
            else if (asagi)
            {

                yer2 = dizi[0].Location;
                Boolean kontrol = true;
                ClickDown();

                for (int i = 1; i < dizi.Count; i++)
                {
                    yer1 = yer3;
                    yer3 = dizi[i].Location;
                    if (kontrol)
                    {
                        dizi[i].Location = yer2;
                        kontrol = false;
                    }
                    else
                    {
                        dizi[i].Location = yer1;
                    }
                }
                if (dizi[0].Location.Y == Form1.frm.Height-40)  //sınırlara çarpıp çarpmadığı kontrol ediliyor
                {
                    YilanBasiKonumu.Y = 0;
                    YilanBasiKonumu.X = dizi[0].Location.X;
                    dizi[0].Location = YilanBasiKonumu;
                }
                YilanVucutCarpisma(timer);
            }
            else if (yukari)
            {
                YilanVucutCarpisma(timer);

                yer2 = dizi[0].Location;
                Boolean kontrol = true;
                ClickUp();
                for (int i = 1; i < dizi.Count; i++)
                {
                    yer1 = yer3;
                    yer3 = dizi[i].Location;
                    if (kontrol)
                    {
                        dizi[i].Location = yer2;
                        kontrol = false;
                    }
                    else
                    {
                        dizi[i].Location = yer1;
                    }
                }
                if (dizi[0].Location.Y == -20 )  //sınırlara çarpıp çarpmadığı kontrol ediliyor
                {
                    YilanBasiKonumu.Y = 560;
                    YilanBasiKonumu.X = dizi[0].Location.X;
                    dizi[0].Location = YilanBasiKonumu;
                }
                YilanVucutCarpisma(timer); //yılanın vücuduna çarpıp çarpmadığı kontrol ediliyor

            }

            if (dizi[0].Location == ovalKurbaga.Location) //yılanın kurbağayı yeyip yemediği kontrol ediliyor
            {
                puan++;
                Form1.frm.lblPuan.Text = ""+puan * 10;
                kurbaga.KurbagaRandom(ovalKurbaga);
                YilaniUzat();
            }
        }
Example #16
0
 private void NewGame(OvalShape[,] zone)
 {
     foreach (OvalShape o in zone)
         o.FillColor = Color.White;
 }
Example #17
0
            private void create_City(Point e)
            {
            counter_City++;
            toolStripStatuslblNumCity.Text = counter_City.ToString();
            OvalShape newCity = new OvalShape();
            //
            // newCity
            //
            newCity.BackColor = Color.Red;
            newCity.BackStyle = BackStyle.Opaque;
            newCity.BorderColor = Color.Red;
            newCity.Cursor = Cursors.Hand;
            newCity.Location = new Point(e.X, e.Y);
            newCity.Size = new Size(20, 20);
            newCity.Click += new EventHandler(this.ovalShape_Click);

            ovalShape_City.Add(newCity);
            shapeContainer_allCityShape.Shapes.Add(newCity);
            }