コード例 #1
0
        private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            int w, h, r = 0, c = 0;

            if (iMatch.getPlayType() == 1)
            {
                w = pictureBox1.Width / 20;
                h = pictureBox1.Height / 20;
                c = (int)(e.X + w * 0.5) / w - 1;
                r = (int)(e.Y + h * 0.5) / h - 1;
                play(r, c, iMatch.getturn());
            }
            else if (iMatch.getPlayType() == 2)
            {
                int turn = iMatch.getturn();
                if (turn == 1)
                {
                    w = pictureBox1.Width / 20;
                    h = pictureBox1.Height / 20;
                    c = (int)(e.X + w * 0.5) / w - 1;
                    r = (int)(e.Y + h * 0.5) / h - 1;
                    play(r, c, turn);
                    autoPlay();
                }
            }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: swk3169/kumoh-code
        }         // end method RunClient

        private void pictureBox1_MouseClick(object sender, MouseEventArgs e)
        {
            int w, h, r = 0, c = 0;

            if (iMatch.getPlayType() == 1) // 네트워크 사용하지 않는 2인 게임
            {
                w = pictureBox1.Width / 20;
                h = pictureBox1.Height / 20;
                c = (int)(e.X + w * 0.5) / w - 1;
                r = (int)(e.Y + h * 0.5) / h - 1;
                play(r, c, iMatch.getturn());
            }
            else if (iMatch.getPlayType() == 2) // 네트워크 사용하지 않는 1인 게임
            {
                int turn = iMatch.getturn();
                if (turn == 1)
                {
                    w = pictureBox1.Width / 20;
                    h = pictureBox1.Height / 20;
                    c = (int)(e.X + w * 0.5) / w - 1;
                    r = (int)(e.Y + h * 0.5) / h - 1;
                    play(r, c, turn);
                    autoPlay();
                }
            }
            else // 네트워크 게임
            {
                int turn = iMatch.getturn();

                if (turn == 2)
                {
                    w = pictureBox1.Width / 20;
                    h = pictureBox1.Height / 20;
                    c = (int)(e.X + w * 0.5) / w - 1;
                    r = (int)(e.Y + h * 0.5) / h - 1;
                    writer.WriteLine(r); // 순서 바뀜 수정  (2015.10.8)
                    writer.WriteLine(c); // 순서 바뀜 수정  (2015.10.8)
                    writer.Flush();      // 추가  (2015.10.8)
                    play(r, c, iMatch.getturn());
                }
            }
        }