Beispiel #1
0
        void DrawMapChipInfo(int chipset_id, int x, int y, PaintEventArgs e)
        {
            PointF pt = new PointF();

            pt.X = x;
            pt.Y = y;

            //このチップセットの名前を問い合わせる.
            uint terrain_data = ImageUtilMap.GetChipsetID(chipset_id, this.configUZ);

            if (terrain_data == U.NOT_FOUND)
            {
                return;
            }
            const uint test_class = 1; //主人公クラス

            string terrain_name    = MapTerrainNameForm.GetName(terrain_data);
            string terrain_kaihi   = R._("地形回避") + ":" + MoveCostForm.GetMoveCost(test_class, terrain_data, 3).ToString(); //地形回避
            string terrain_kaifuku = R._("地形回復") + ":" + MoveCostForm.GetMoveCost(test_class, terrain_data, 6).ToString(); //地形回復

            string terrain_tuukou = R._("地形コスト") + ":";
            uint   cost           = MoveCostForm.GetMoveCost(test_class, terrain_data, 0);

            terrain_tuukou += cost.ToString();
            if (cost >= 255)
            {
                cost = MoveCostForm.GetMoveCost(ClassForm.GetFlyClass(), terrain_data, 0);
                if (cost < 255)
                {
                    terrain_tuukou += R._("(飛行のみ)");
                }
                else
                {
                    terrain_tuukou += R._("(全員不可)");
                }
            }


            Rectangle windowrc = new Rectangle();

            windowrc.X      = (int)pt.X + 48 + 1;
            windowrc.Y      = (int)pt.Y;
            windowrc.Width  = (int)0;
            windowrc.Height = (int)this.Font.Height * 4;

            //枠を描画する幅を特定します.
            SizeF textSize = e.Graphics.MeasureString(terrain_name, this.Font, 1000);

            if (windowrc.Width < textSize.Width)
            {
                windowrc.Width = (int)textSize.Width;
            }
            textSize = e.Graphics.MeasureString(terrain_kaihi, this.Font, 1000);
            if (windowrc.Width < textSize.Width)
            {
                windowrc.Width = (int)textSize.Width;
            }
            textSize = e.Graphics.MeasureString(terrain_kaifuku, this.Font, 1000);
            if (windowrc.Width < textSize.Width)
            {
                windowrc.Width = (int)textSize.Width;
            }
            textSize = e.Graphics.MeasureString(terrain_tuukou, this.Font, 1000);
            if (windowrc.Width < textSize.Width)
            {
                windowrc.Width = (int)textSize.Width;
            }

            if (windowrc.X + windowrc.Width > e.ClipRectangle.Right)
            {//画面右端の場合、左側に押し出す.
                windowrc.X = windowrc.X - windowrc.Width - 32;
                windowrc.Y = windowrc.Y + 16 + 32;
            }
            if (windowrc.Y + windowrc.Height > e.ClipRectangle.Bottom)
            {//画面下端の場合、上側に押し出す.
                windowrc.X = windowrc.X - 16 - 32;
                windowrc.Y = windowrc.Y - windowrc.Height - 32;
            }
            if (windowrc.X < 0)
            {
                windowrc.X = 0;
                while (true)
                {
                    if (pt.X < windowrc.Width && pt.Y >= windowrc.Y && pt.Y <= windowrc.Y + windowrc.Height)
                    {
                        windowrc.Y += 16;
                        continue;
                    }
                    break;
                }
            }
            pt.X = windowrc.X;
            pt.Y = windowrc.Y;

            e.Graphics.FillRectangle(this.BackBrush, windowrc);

            e.Graphics.DrawString(terrain_name, this.Font, this.ForeBrush, pt);

            pt.Y = pt.Y + this.Font.Height;
            e.Graphics.DrawString(terrain_kaihi, this.Font, this.ForeBrush, pt);

            pt.Y = pt.Y + this.Font.Height;
            e.Graphics.DrawString(terrain_kaifuku, this.Font, this.ForeBrush, pt);

            pt.Y = pt.Y + this.Font.Height;
            e.Graphics.DrawString(terrain_tuukou, this.Font, this.ForeBrush, pt);
        }