コード例 #1
0
ファイル: EditArea.cs プロジェクト: capasha/EEOEditor
        /*public void Draw(int x, int y, Graphics g)
         * {
         *  bool faded = false;
         *  int id = CurFrame.Foreground[y, x];
         *  int bid = CurFrame.Background[y, x];
         *  if (id == 0 && !IsBackground)
         *  {
         *      id = Frames[curFrame - 1].Foreground[y, x];
         *      if (id != 0) faded = true;
         *  }
         *  Draw(x, y, g, bid, id, CurFrame.BlockData[y, x], faded);
         * }*/

        #region draw
        public void Draw(int x, int y, Graphics g, int bid, int fid, int coins, int id, int target, string text, string text1, string text2, string text3, Color color)
        {
            //Graphics g = Graphics.FromImage(Back);
            if (Bricks[bid] == null || bid == -1)
            {
                if (bid >= 500 && bid <= 999 || bid >= 2507 && bid <= 2513)
                {
                    Bitmap bmp2 = new Bitmap(16, 16);
                    if (bid >= 500 && bid <= 999 && bid < 2500)
                    {
                        bmp2 = unknowBricks.Clone(new Rectangle(5 * 16, 0, 16, 16), unknowBricks.PixelFormat);
                    }
                    else if (bid >= 2507 && bid <= 2513)
                    {
                        bmp2 = unknowBricks.Clone(new Rectangle(6 * 16 + 1, 0, 16, 16), unknowBricks.PixelFormat);
                    }
                    g.DrawImage(bmp2, x * 16, y * 16);
                }
            }
            else if (bid >= 500 && bid <= 999 || bid == 0)
            {
                Bitmap bmp0 = new Bitmap(Bricks[bid], MainForm.Zoom, MainForm.Zoom);
                if (!MainForm.userdata.useColor)
                {
                    g.DrawImage(bmp0, x * MainForm.Zoom, y * MainForm.Zoom);
                }
                else
                {
                    if (bid != 0)
                    {
                        g.DrawImage(Bricks[bid], x * 16, y * 16);
                    }
                    else
                    {
                        //if (BlockWidth < x && BlockHeight < y) mouseBlocksB[x, y] = 0;
                        if (Color.Transparent == color)
                        {
                            if (MainForm.userdata.thisColor != Color.Transparent)
                            {
                                g.FillRectangle(new SolidBrush(MainForm.userdata.thisColor), new Rectangle(x * 16, y * 16, 16, 16));
                            }
                            else
                            {
                                g.DrawImage(Bricks[bid], x * 16, y * 16);
                            }
                        }
                        else
                        {
                            if (MainForm.userdata.thisColor != Color.Transparent)
                            {
                                g.FillRectangle(new SolidBrush(MainForm.userdata.thisColor), new Rectangle(x * 16, y * 16, 16, 16));
                            }
                            else
                            {
                                g.DrawImage(bmp0, x * MainForm.Zoom, y * MainForm.Zoom);
                            }
                        }
                    }
                }
            }

            /*if (fid == -1)
             * {
             *  //g.DrawImage(Bricks[1], x * 16, y * 16);
             * }*/
            if (fid > 0 && Bricks[fid] != null && fid != -1 && !bdata.ignore.Contains(fid) && !bdata.morphable.Contains(fid))
            {
                Bitmap bmp1 = new Bitmap(Bricks[fid], MainForm.Zoom, MainForm.Zoom);
                if (!MainForm.userdata.useColor)
                {
                    g.DrawImage(bmp1, x * MainForm.Zoom, y * MainForm.Zoom);
                }
                else
                {
                    if (fid != 0)
                    {
                        g.DrawImage(Bricks[fid], x * 16, y * 16);
                    }
                    else
                    {
                        if (Color.Transparent == color)
                        {
                            if (MainForm.userdata.thisColor != Color.Transparent)
                            {
                                g.FillRectangle(new SolidBrush(MainForm.userdata.thisColor), new Rectangle(x * 16, y * 16, 16, 16));
                            }
                            else
                            {
                                g.DrawImage(Bricks[fid], x * 16, y * 16);
                            }
                        }
                        else
                        {
                            if (MainForm.userdata.thisColor != Color.Transparent)
                            {
                                g.FillRectangle(new SolidBrush(MainForm.userdata.thisColor), new Rectangle(x * 16, y * 16, 16, 16));
                            }
                            else
                            {
                                g.DrawImage(Bricks[fid], x * 16, y * 16);
                            }
                        }
                    }
                }
            }
            else if (fid > 0 && fid != -1 && Bricks[fid] == null)
            {
                if (MainForm.decosBMI[fid] == 0 && MainForm.foregroundBMI[fid] == 0 && fid != 0 && MainForm.miscBMI[fid] == 0)
                {
                    if (fid < 500 || fid >= 1001 && fid < 2500)
                    {
                        Bitmap bmp2 = unknowBricks.Clone(new Rectangle(2 * 16, 0, 16, 16), unknowBricks.PixelFormat);
                        g.DrawImage(bmp2, x * 16, y * 16);
                    }
                }
            }
            else if (fid == 0)
            {
            }
            if (bdata.goal.Contains(fid) && fid != 423 && fid != 417 && fid != 418 && fid != 419 && fid != 420 && fid != 421 && fid != 422 && fid != 453 && fid != 1027 && fid != 1028 && fid != 1582)
            {
                int offSet = coins >= 10 ? 4 : 9;
                if (fid == 467 || fid == 1079 || fid == 1080 || fid == 1012 || fid == 113 || fid == 184 || fid == 185 || fid == 461 || fid == 1619 || fid == 1620)
                {
                    if (fid == 461 && coins == 0 || coins > 1 && coins <= 999)
                    {
                        DrawText(coins.ToString(), Back, Brushes.White, bfont.Families[0], 8, "bottom", "right", x * 16, y * 16, false);
                    }
                    else if (fid == 461 && coins == 1000)
                    {
                        DrawText("x", Back, Brushes.White, null, 8, "bottom", "center", x * 16, y * 16, false);
                    }
                    else if (fid == 461 && coins == 1)
                    {
                        Bitmap bmp3 = bdata.getRotation(fid, coins);
                        if (bmp3 != null)
                        {
                            g.DrawImage(bmp3, x * 16, y * 16);
                        }
                    }
                    else
                    {
                        if (coins <= 999)
                        {
                            DrawText(coins.ToString(), Back, Brushes.White, bfont.Families[0], 8, "bottom", "right", x * 16, y * 16, false);
                        }
                        else
                        {
                            DrawText("999", Back, Brushes.White, bfont.Families[0], 8, "bottom", "right", x * 16, y * 16, false);
                        }
                    }

                    //g.DrawString(coins.ToString(), new Font("Courier", 6), Brushes.White, new PointF(x * 16 + offSet, y * 16 + 8));
                }

                else if (fid == 165 || fid == 43 || fid == 213 || fid == 214)
                {
                    if (coins <= 999)
                    {
                        DrawText(coins.ToString(), Back, fid == 43 ? Brushes.Black : Brushes.White, bfont.Families[0], 8, "bottom", "right", x * 16, y * 16, false);
                    }
                    else
                    {
                        DrawText("999", Back, fid == 43 ? Brushes.Black : Brushes.White, bfont.Families[0], 8, "bottom", "right", x * 16, y * 16, false);
                    }
                }
                else if (fid != 77 && fid != 83 && fid != 1520)
                {
                    //Console.WriteLine(bfont.Families[0]);
                    if (coins <= 999)
                    {
                        DrawText(coins.ToString(), Back, Brushes.Black, bfont.Families[0], 8, "bottom", "right", x * 16, y * 16, false);
                    }
                    else
                    {
                        DrawText("999", Back, Brushes.Black, bfont.Families[0], 8, "bottom", "right", x * 16, y * 16, false);
                    }
                }
            }
            else
            {
                /*if (fid == 1000)
                 * {
                 *  Font trFont = new Font("System", 11.0f, FontStyle.Bold, GraphicsUnit.Point);
                 *  RectangleF rect1 = new Rectangle(x + 32, y + 32,180, trFont.Height * 3);
                 *  g.DrawString(text, new Font("System", 11.0f, FontStyle.Bold, GraphicsUnit.Pixel), Brushes.Red, rect1);
                 *  //DrawText(text, Back1, Brushes.White, null, 8, null,null, x * 16, y * 16, true);
                 * }*/
                if (fid == 242 || fid == 381)
                {
                    Bitmap bmp3 = bdata.getRotation(fid, coins);
                    if (bmp3 != null)
                    {
                        g.DrawImage(bmp3, x * 16, y * 16);
                    }
                    //g.DrawString(id.ToString(), new Font("Courier", 6), Brushes.Black, new PointF(x * 16 + 4, y * 16 + 1));

                    int idd     = id;
                    int targget = target;
                    if (id.ToString().Length > 3)
                    {
                        idd = Convert.ToInt32(id.ToString().Substring(0, 3));
                    }
                    if (target.ToString().Length > 3)
                    {
                        targget = Convert.ToInt32(target.ToString().Substring(0, 3));
                    }
                    DrawText(idd.ToString(), Back, Brushes.Black, bfont.Families[0], 8, "top", "center", x * 16, y * 16 + 1, false);
                    DrawText(targget.ToString(), Back, Brushes.Red, bfont.Families[0], 8, "bottom", "center", x * 16, y * 16 - 1, false);
                }
                else
                {
                    Bitmap bmp2 = bdata.getRotation(fid, coins);
                    if (bmp2 != null)
                    {
                        g.DrawImage(bmp2, x * 16, y * 16);
                    }
                }
            } //yes
            if (MainForm.userdata.useColor)
            {
                if (bid == 0 || fid == 0)
                {
                    if (MainForm.userdata.thisColor != Color.Transparent)
                    {
                        if (color != Color.Transparent)
                        {
                            Minimap.SetColor(x, y, MainForm.userdata.thisColor);
                            if (bid != 0)
                            {
                                Minimap.SetPixel(x, y, bid);
                            }
                            if (fid != 0 && Minimap.ImageColor[fid])
                            {
                                Minimap.SetPixel(x, y, fid);
                            }
                        }
                        else
                        {
                            Minimap.SetColor(x, y, MainForm.userdata.thisColor);
                            if (bid != 0)
                            {
                                Minimap.SetPixel(x, y, bid);
                            }
                            if (fid != 0 && Minimap.ImageColor[fid])
                            {
                                Minimap.SetPixel(x, y, fid);
                            }
                        }
                    }
                }
                else
                {
                    Minimap.SetPixel(x, y, bid);
                    if (fid != 0 && Minimap.ImageColor[fid])
                    {
                        Minimap.SetPixel(x, y, fid);
                    }
                }
            }
            else
            {
                Minimap.SetPixel(x, y, bid);
                if (fid != -1 && Minimap.ImageColor[fid])
                {
                    Minimap.SetPixel(x, y, fid);
                }
            }
        }