private void MapPictureBox_MouseClick(object sender, MouseEventArgs e)
        {
            int clickx = MapPictureBox.CursolToTile(e.X);
            int clicky = MapPictureBox.CursolToTile(e.Y);

            this.ReWriteValueX.Value = clickx;
            this.ReWriteValueY.Value = clicky;
        }
Exemple #2
0
        private void MapMouseDownEvent(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {//右クリックされたとき
                int clickx = MapPictureBox.CursolToTile(e.X);
                int clicky = MapPictureBox.CursolToTile(e.Y);

                for (int index = 0; true; index++)
                {
                    //表示領域の都合上、選択されたユニットでなければ、最終移動位置しか描画していないため、探索するときはそれを踏まえる.
                    bool isSelectedUnit = (this.AddressList.SelectedIndex == index);

                    uint addr = InputFormRef.SelectToAddr(this.AddressList, index);
                    if (!U.isSafetyOffset(addr))
                    {
                        break;
                    }
                    int before_x = (int)Program.ROM.u8(addr + 4);
                    int before_y = (int)Program.ROM.u8(addr + 5);
                    int after_x  = (int)Program.ROM.u8(addr + 6);
                    int after_y  = (int)Program.ROM.u8(addr + 7);

                    if (isSelectedUnit)
                    {//選択している場合は、配置前座標を探索.
                        if (before_x == clickx && before_y == clicky)
                        {
                            this.AddressList.SelectedIndex = index; //選択されたユニットへ移動
                            this.B4.Focus();                        //移動場所にフォーカスを当てることで notifyモードに切り替える.
                            break;
                        }
                    }
                    //配置後探索
                    if (after_x == clickx && after_y == clicky)
                    {
                        this.AddressList.SelectedIndex = index; //選択されたユニットへ移動

                        //ただし配置後と配置前か同一の場合、配置前を選択する.
                        if (before_x == after_x && before_y == after_y)
                        {
                            this.B4.Focus(); //配置前
                        }
                        else
                        {
                            this.B6.Focus(); //移動場所にフォーカスを当てることで notifyモードに切り替える.
                        }

                        break;
                    }
                }
            }
        }