Esempio n. 1
0
        private void palBlackboard_MouseMove(object sender, MouseEventArgs e)
        {
            //技术鼠标坐标
            Point mouse = palBlackboard.PointToClient(MousePosition);

            if (mouse.NearBy(PointFToPoint(currentBoard.Location, OutlineRect.Size, OutlineRect.Location), 40, new Size((int)(currentBoard.Size.Width * zoom), (int)(currentBoard.Size.Height * zoom)), currentBoard.Origin))
            {
                RemainedBoards.MoveTo(currentBoard, FixedBoards);
                lblRemaineds.Text = $"剩余:{RemainedBoards.Count}个";
                palBlackboard.Refresh();
                if (RemainedBoards.Count > 0)
                {
                    Thread.Sleep(500);
                    currentBoard = SwitchBoard();
                }
                else
                {
                    palBlackboard.Refresh();
                    FixedBoards.Clear();
                    lblRemaineds.Text = $"剩余:{RemainedBoards.Count}个";
                    if (LevelsManager.HasNextLevel())
                    {
                        LevelsManager.NextLevel();
                    }
                    else
                    {
                        MessageBox.Show("通关成功!");
                        LevelsManager.SwitchLevel(1);
                    }
                    AdjustOutline();
                    RemainedBoards.AddRange(LevelsManager.CurrentLevel.Boards);
                    currentBoard    = SwitchBoard();
                    RemainedSeconds = LevelsManager.CurrentLevel.Times;
                    lblTime.Text    = $"时间:{RemainedSeconds}s";
                }
            }
            palBlackboard.Refresh();
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeComponent();
            new Size(381, 387);
            Bitmap back1 = new Bitmap(Properties.Resources.level1);
            Bitmap back2 = new Bitmap(Properties.Resources.level2);
            Bitmap back3 = new Bitmap(Properties.Resources.level3);

            LevelsManager.Levels.AddRange(new Level[] {
                new Level(back1, "简单", 1, 120, new Board[] {
                    new Board()
                    {
                        Index = 0, Shape = new Bitmap(Properties.Resources.青), Location = new PointF(0.25984252f, 0), Size = new Size(100, 99)
                    },
                    new Board()
                    {
                        Index = 1, Shape = new Bitmap(Properties.Resources.粉), Location = new PointF(0, 0.2937685f), Size = new Size(198, 99)
                    },
                    new Board()
                    {
                        Index = 2, Shape = new Bitmap(Properties.Resources.橘), Location = new PointF(0.25984252f, 0.169139f), Size = new Size(281, 140)
                    },
                    new Board()
                    {
                        Index = 3, Shape = new Bitmap(Properties.Resources.绿), Location = new PointF(0.1312336f, 0.587537f), Size = new Size(141, 140), Origin = new PointF(0.25f, 0.25f)
                    },
                    new Board()
                    {
                        Index = 4, Shape = new Bitmap(Properties.Resources.浅蓝), Location = new PointF(0.1312336f, 0.587537f), Size = new Size(281, 140)
                    },
                    new Board()
                    {
                        Index = 5, Shape = new Bitmap(Properties.Resources.深蓝), Location = new PointF(0.5f, 0.587537f), Size = new Size(141, 70)
                    },
                    new Board()
                    {
                        Index = 6, Shape = new Bitmap(Properties.Resources.黄), Location = new PointF(0.68421f, 0.587537f), Size = new Size(71, 140)
                    },
                })
                {
                    OutlineLocation = new Point(103, 84),
                    OutLineSize     = new Size(381, 337),
                    OutlineOpacity  = 1
                },
                new Level(back2, "中等", 2, 120, new Board[]
                {
                    new Board()
                    {
                        Index = 0, Shape = new Bitmap(Properties.Resources.黄2), Location = new PointF(0, 0.209059f), Size = new Size(120, 60),
                    },
                    new Board()
                    {
                        Index = 1, Shape = new Bitmap(Properties.Resources.深蓝2), Location = new PointF(0.251046f, 0.414634f), Size = new Size(84, 84)
                    },
                    new Board()
                    {
                        Index = 2, Shape = new Bitmap(Properties.Resources.浅蓝2), Location = new PointF(0.251046f, 0), Size = new Size(240, 120)
                    },
                    new Board()
                    {
                        Index = 3, Shape = new Bitmap(Properties.Resources.青2), Location = new PointF(0.42887f, 0.414634f), Size = new Size(84, 84)
                    },
                    new Board()
                    {
                        Index = 4, Shape = new Bitmap(Properties.Resources.橘2), Location = new PointF(0.502092f, 0), Size = new Size(240, 120)
                    },
                    new Board()
                    {
                        Index = 5, Shape = new Bitmap(Properties.Resources.粉2), Location = new PointF(0.606694f, 0.414634f), Size = new Size(180, 60)
                    },
                    new Board()
                    {
                        Index = 6, Shape = new Bitmap(Properties.Resources.绿2), Location = new PointF(0.606694f, 0.414634f), Size = new Size(85, 168)
                    },
                })
                {
                    OutlineLocation = new Point(52, 132),
                    OutLineSize     = new Size(478, 287),
                    OutlineOpacity  = 1,
                },
                new Level(back3, "困难", 3, 120, new Board[]
                {
                    new Board()
                    {
                        Index = 0, Shape = new Bitmap(Properties.Resources.深蓝3), Size = new Size(94, 102), Location = new PointF(0.4076433f, 0), Origin = new PointF(0.25f, 0.25f),
                    },
                    new Board()
                    {
                        Index = 1, Shape = new Bitmap(Properties.Resources.红3), Size = new Size(133, 133), Location = new PointF(0.05414f, 0.450549f), Origin = new PointF(0.75f, 0.33f)
                    },
                    new Board()
                    {
                        Index = 2, Shape = new Bitmap(Properties.Resources.粉3), Size = new Size(94, 94), Location = new PointF(0.509554f, 0.065934f),
                    },
                    new Board()
                    {
                        Index = 3, Shape = new Bitmap(Properties.Resources.橘3), Size = new Size(133, 67), Location = new PointF(0.576433f, 0.4203296f)
                    },
                    new Board()
                    {
                        Index = 4, Shape = new Bitmap(Properties.Resources.绿3), Size = new Size(133, 133), Location = new PointF(0.477707f, 0.3241758f), Origin = new PointF(0.33f, 0.33f),
                    },
                    new Board()
                    {
                        Index = 5, Shape = new Bitmap(Properties.Resources.青3), Size = new Size(67, 67), Location = new PointF(0.477707f, 0.815934f), Origin = new PointF(0.33f, 0.67f),
                    },
                    new Board()
                    {
                        Index = 6, Shape = new Bitmap(Properties.Resources.浅蓝3), Size = new Size(67, 67), Location = new PointF(0, 0.590659f), Origin = new PointF(0.33f, 0.33f),
                    },
                })
                {
                    OutlineLocation = new Point(137, 75),
                    OutLineSize     = new Size(314, 364),
                    OutlineOpacity  = 1,
                }
            });
            Level startLevel = LevelsManager.SwitchLevel(1);

            RemainedSeconds = startLevel.Times;
            RemainedBoards.AddRange(startLevel.Boards);
            currentBoard       = SwitchBoard();
            bf_colors          = new Bitmap(palBlackboard.Width, palBlackboard.Height);
            bf_colors_renderer = Graphics.FromImage(bf_colors);
        }