コード例 #1
0
        //パネル上でマウスクリックされた時、マップチップを編集する
        public void MapMouseAction(Point point, int currentLayer, MapChip mapChip)
        {
            //左クリックされている時の処理
            if ((Control.MouseButtons & MouseButtons.Left)
                == MouseButtons.Left)
            {
                //マップを書く
                MapDataControl.EditMapChip.
                EditWrite(mws.LocationToMap(point, MapDataControl.MapChipSize), mapChip, currentLayer);
            }

            //右クリックされている時の処理
            else if ((Control.MouseButtons & MouseButtons.Right)
                     == MouseButtons.Right)
            {
                //マップをクリアします
                MapDataControl.EditMapChip.EditErase(mws.LocationToMap(point, MapDataControl.MapChipSize), currentLayer);
            }
        }
コード例 #2
0
        //画面に表示するマップチップをAddChildする
        private void AddShowMapImage(MapWriteScene mws, int mapChipSize)
        {
            var panel = mws.control;
            //新たにlUpIndexを計算する
            Point newLUpIndex = mws.LocationToMap(new Point(0, 0), mapChipSize);
            //新たにrDownIndexを計算する
            Point newRDownIndex =
                new Point(
                    panel.Size.Width / mapChipSize + newLUpIndex.X + 1,
                    panel.Size.Height / mapChipSize + newLUpIndex.Y + 1
                    );

            //画面に表示されるMapImageだけAddChild
            for (int x = newLUpIndex.X; x < newRDownIndex.X && x < mapData.MapSizeX; x++)
            {
                for (int y = newLUpIndex.Y; y < newRDownIndex.Y && y < mapData.MapSizeY; y++)
                {
                    mws.AddChild(mapData.List[x, y]);
                }
            }
        }