Example #1
0
        public Form1()
        {
            InitializeComponent();

            m_boardInfo    = new BoardInfo();
            m_dragDropKoma = null;
        }
Example #2
0
        void panel1_MouseUp(object sender, MouseEventArgs e)
        {
            int ret;

            ret = m_boardInfo.updateKoma(m_dragDropKoma, m_from_x, m_from_y, m_to_x, m_to_y);

            m_dragDropKoma = null;
            panel1.Refresh();

            if (ret == -1)
            {
                MessageBox.Show("そこには置けません。", "着手エラー", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #3
0
        void panel1_MouseDown(object sender, MouseEventArgs e)
        {
            Point          pos;
            int            num;
            MouseEventArgs mouseEvent = (MouseEventArgs)e;
            MouseButtons   buttons    = mouseEvent.Button;

            // 多分着手可能マスを表示すると思う。。
            m_from_x       = (int)((mouseEvent.X - m_fix_x + 6) / m_mass_size);
            m_from_y       = (int)((mouseEvent.Y - m_fix_y + 6) / m_mass_size);
            m_to_x         = m_from_x;
            m_to_y         = m_from_y;
            m_dragDropKoma = m_boardInfo.getKomaInfo(m_from_x, m_from_y);
        }
Example #4
0
        public int updateKoma(Koma m_dragDropKoma, int fromX, int fromY, int toX, int toY)
        {
            if (toX < 0 || toY < 0 || toX >= BOARD_SIZE || toY >= BOARD_SIZE)
            {
                return(-1);
            }

            if (m_komaArray[toX * 9 + toY] == NO)
            {
                m_komaArray[toX * 9 + toY]     = m_dragDropKoma;
                m_komaArray[fromX * 9 + fromY] = NO;
                return(0);
            }
            else if (toX == fromX && toY == fromY)
            {
                return(0);
            }
            else
            {
                return(-1);
            }
        }
Example #5
0
        public BoardInfo()
        {
            NO   = null;
            OU   = new Koma();
            HI   = new Koma();
            KA   = new Koma();
            KI1  = new Koma();
            GI1  = new Koma();
            KE1  = new Koma();
            KY1  = new Koma();
            KI2  = new Koma();
            GI2  = new Koma();
            KE2  = new Koma();
            KY2  = new Koma();
            FU1  = new Koma();
            FU2  = new Koma();
            FU3  = new Koma();
            FU4  = new Koma();
            FU5  = new Koma();
            FU6  = new Koma();
            FU7  = new Koma();
            FU8  = new Koma();
            FU9  = new Koma();
            GY   = new Koma();
            RY   = new Koma();
            UM   = new Koma();
            GIN1 = new Koma();
            KEN1 = new Koma();
            KYN1 = new Koma();
            GIN2 = new Koma();
            KEN2 = new Koma();
            KYN2 = new Koma();
            TO1  = new Koma();
            TO2  = new Koma();
            TO3  = new Koma();
            TO4  = new Koma();
            TO5  = new Koma();
            TO6  = new Koma();
            TO7  = new Koma();
            TO8  = new Koma();
            TO9  = new Koma();

            opHI   = new Koma();
            opKA   = new Koma();
            opKI1  = new Koma();
            opGI1  = new Koma();
            opKE1  = new Koma();
            opKY1  = new Koma();
            opKI2  = new Koma();
            opGI2  = new Koma();
            opKE2  = new Koma();
            opKY2  = new Koma();
            opFU1  = new Koma();
            opFU2  = new Koma();
            opFU3  = new Koma();
            opFU4  = new Koma();
            opFU5  = new Koma();
            opFU6  = new Koma();
            opFU7  = new Koma();
            opFU8  = new Koma();
            opFU9  = new Koma();
            opGY   = new Koma();
            opRY   = new Koma();
            opUM   = new Koma();
            opGIN1 = new Koma();
            opKEN1 = new Koma();
            opKYN1 = new Koma();
            opGIN2 = new Koma();
            opKEN2 = new Koma();
            opKYN2 = new Koma();
            opTO1  = new Koma();
            opTO2  = new Koma();
            opTO3  = new Koma();
            opTO4  = new Koma();
            opTO5  = new Koma();
            opTO6  = new Koma();
            opTO7  = new Koma();
            opTO8  = new Koma();
            opTO9  = new Koma();

            OU.picIndex = 0;
            HI.picIndex = 1;
            KA.picIndex = 2;

            KI1.picIndex = 3;
            GI1.picIndex = 4;
            KE1.picIndex = 5;
            KY1.picIndex = 6;
            KI2.picIndex = 3;
            GI2.picIndex = 4;
            KE2.picIndex = 5;
            KY2.picIndex = 6;

            FU1.picIndex = 7;
            FU2.picIndex = 7;
            FU3.picIndex = 7;
            FU4.picIndex = 7;
            FU5.picIndex = 7;
            FU6.picIndex = 7;
            FU7.picIndex = 7;
            FU8.picIndex = 7;
            FU9.picIndex = 7;

            GY.picIndex = 8;
            RY.picIndex = 10;
            UM.picIndex = 11;

            GIN1.picIndex = 12;
            KEN1.picIndex = 13;
            KYN1.picIndex = 14;
            GIN2.picIndex = 12;
            KEN2.picIndex = 13;
            KYN2.picIndex = 14;

            TO1.picIndex = 15;

            opHI.picIndex = 17;
            opKA.picIndex = 18;

            opKI1.picIndex = 19;
            opGI1.picIndex = 20;
            opKE1.picIndex = 21;
            opKY1.picIndex = 22;
            opKI2.picIndex = 19;
            opGI2.picIndex = 20;
            opKE2.picIndex = 21;
            opKY2.picIndex = 22;

            opFU1.picIndex = 23;
            opFU2.picIndex = 23;
            opFU3.picIndex = 23;
            opFU4.picIndex = 23;
            opFU5.picIndex = 23;
            opFU6.picIndex = 23;
            opFU7.picIndex = 23;
            opFU8.picIndex = 23;
            opFU9.picIndex = 23;

            opGY.picIndex   = 24;
            opRY.picIndex   = 26;
            opUM.picIndex   = 27;
            opGIN1.picIndex = 28;
            opKEN1.picIndex = 29;
            opKYN1.picIndex = 30;
            opGIN2.picIndex = 28;
            opKEN2.picIndex = 29;
            opKYN2.picIndex = 30;
            opTO1.picIndex  = 31;

            m_komaArray = new Koma[81]
            {
                opKY1, NO, opFU1, NO, NO, NO, FU1, NO, KY1,
                opKE1, opHI, opFU2, NO, NO, NO, FU2, KA, KE1,
                opGI1, NO, opFU3, NO, NO, NO, FU3, NO, GI1,
                opKI1, NO, opFU4, NO, NO, NO, FU4, NO, KI1,
                opGY, NO, opFU5, NO, NO, NO, FU5, NO, OU,
                opKI2, NO, opFU6, NO, NO, NO, FU6, NO, KI2,
                opGI2, NO, opFU7, NO, NO, NO, FU7, NO, GI2,
                opKE2, opKA, opFU8, NO, NO, NO, FU8, HI, KE2,
                opKY2, NO, opFU9, NO, NO, NO, FU9, NO, KY2
            };
        }