Esempio n. 1
0
        private void 복기ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            reviveFlag = true;

            OpenFileDialog ofd = new OpenFileDialog();

            ofd.InitialDirectory = dirName;
            ofd.Filter           = "Omok files(*.omk)|*.omk";
            ofd.ShowDialog();
            string fileName = ofd.FileName;

            //sequenceFlag = true;

            try
            {
                StreamReader r    = File.OpenText(fileName);
                string       line = "";

                // 파일내용을 한줄씩 읽어서 lstRevive 리스트에 넣는다
                while ((line = r.ReadLine()) != null)
                {
                    string[] items = line.Split(' ');
                    Revive   rev   = new Revive(
                        int.Parse(items[0]),
                        int.Parse(items[1]),
                        items[2] == "black" ? STONE.black : STONE.white,
                        int.Parse(items[3]));
                    lstRevive.Add(rev);
                }
                r.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            // 복기준비
            reviveFlag = true;
            stoneCnt   = 1;
            NewGame();
            stoneCnt = 0;
        }
Esempio n. 2
0
        private void DrawAStone(Revive item)
        {
            int   x   = item.X;
            int   y   = item.Y;
            STONE s   = item.Stone;
            int   seq = item.Seq;

            Rectangle r = new Rectangle(mgn + 눈 * x - 돌 / 2,
                                        mgn + 눈 * y - 돌 / 2, 돌, 돌);

            if (s == STONE.black)
            {
                if (imageFlag == false)
                {
                    g.FillEllipse(bBrush, r);
                }
                else
                {
                    Bitmap bmp = new Bitmap("../../Images/black.png");
                    g.DrawImage(bmp, r);
                }
                DrawStoneSequence(seq, Brushes.White, r);
                바둑판[x, y] = STONE.black;
            }
            else
            {
                if (imageFlag == false)
                {
                    g.FillEllipse(wBrush, r);
                }
                else
                {
                    Bitmap bmp = new Bitmap("../../Images/white.png");
                    g.DrawImage(bmp, r);
                }
                DrawStoneSequence(seq, Brushes.Black, r);
                바둑판[x, y] = STONE.white;
            }
            CheckOmok(x, y);
        }