コード例 #1
0
ファイル: MainForm.cs プロジェクト: SameGoone/Try-to-catch
        private void ResizeComponents()
        {
            int bigSize   = 25;
            int smallSize = 18;
            int hugeSize  = 40;

            if (Width > 1200 && Width < 1400)
            {
                bigSize      = 18;
                smallSize    = 12;
                hugeSize     = 30;
                _kResolution = 0.70;
            }
            else if (Width >= 1400 && Width < 1600)
            {
                bigSize      = 20;
                smallSize    = 13;
                hugeSize     = 32;
                _kResolution = 0.78;
            }
            else if (Width >= 1600 && Width < 1700)
            {
                bigSize      = 23;
                smallSize    = 14;
                hugeSize     = 35;
                _kResolution = 0.85;
            }
            else if (Width > 1900 && Width < 2000)
            {
                bigSize      = 27;
                smallSize    = 18;
                hugeSize     = 40;
                _kResolution = 1;
            }
            else if (Width <= 1200)
            {
                bigSize      = 15;
                smallSize    = 9;
                hugeSize     = 28;
                _kResolution = 0.57;
            }
            _hugeFont  = new Font("Calibri", hugeSize, FontStyle.Bold);
            _bigFont   = new Font("Calibri", bigSize, FontStyle.Bold);
            _smallFont = new Font("Calibri", smallSize, FontStyle.Bold);

            _cloudSize = ResizeTexture(new Size(400, 220));
            _angrySize = ResizeTexture(130);
            _fruitSize = ResizeTexture(40);
            _mySize    = (int)(Width * _mySize_K);

            InfoPause_Label.ResizeControl(this, new Size(400, 50), new Point(760, 515), _bigFont);
            Score_Label.ResizeControl(this, new Size(60, 60), new Point(1843, 15), _smallFont);
            СЧЕТ_Label.ResizeControl(this, new Size(85, 35), new Point(1775, 15), _smallFont);
            MaxScore_Label.ResizeControl(this, new Size(85, 35), new Point(1843, 50), _smallFont);
            Victory_Label.ResizeControl(this, new Size(575, 162), new Point(670, 135), _hugeFont);

            _recordLocation = new Point(1745, 50);
            _targetLocation = new Point(1770, 50);
            if (_endlessMode)
            {
                екИлиЦель_Label.ResizeControl(this, new Size(150, 35), _recordLocation, _smallFont);
            }
            else
            {
                екИлиЦель_Label.ResizeControl(this, new Size(150, 35), _targetLocation, _smallFont);
            }

            NewGame_Button.ResizeControl(this, new Size(575, 100), new Point(575, 150), _bigFont);
            Info_Button.ResizeControl(this, new Size(575, 100), new Point(575, 300), _bigFont);
            Settings_Button.ResizeControl(this, new Size(575, 100), new Point(575, 450), _bigFont);
            Exit_Button.ResizeControl(this, new Size(575, 100), new Point(575, 600), _bigFont);


            InfoPause_Label.BackColor = Color.Transparent;
            Score_Label.BackColor     = Color.Transparent;
            СЧЕТ_Label.BackColor      = Color.Transparent;
            екИлиЦель_Label.BackColor = Color.Transparent;
            MaxScore_Label.BackColor  = Color.Transparent;
            СЧЕТ_Label.Text           = "СЧЕТ:";
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: SameGoone/Try-to-catch
        private void StartGame()
        {
            _mySize_K = (double)_myStartSize / 1920;
            _isGaming = true;
            _victory  = false;
            Controls.Add(Score_Label);
            Controls.Add(СЧЕТ_Label);
            Controls.Add(екИлиЦель_Label);
            Controls.Add(MaxScore_Label);
            MaxScore_Label.BringToFront();

            Controls.Remove(NewGame_Button);
            Controls.Remove(Info_Button);
            Controls.Remove(Exit_Button);
            Controls.Remove(Settings_Button);

            Random r = new Random();

            _cloudPosition.X = r.Next(_cloudSize.Width / 2 + 3, Width - _cloudSize.Width / 2 - 3);
            _cloudPosition.Y = r.Next(_cloudSize.Height / 2 + 3, Height - _cloudSize.Height / 2 - 3);
            _angryPosition.X = _mousePosition.X + 500;
            _angryPosition.Y = _mousePosition.Y + 500;
            if (!_endlessMode)
            {
                switch (_complexityType)
                {
                case 0:
                    _kSpeed_Angry    = 4;
                    _deltaSpeedAngry = 0.1;
                    _deltaSpeedCloud = 0;
                    _targetScore     = 30; break;

                case 1:
                    _kSpeed_Angry    = 7;
                    _deltaSpeedAngry = 0.2;
                    _deltaSpeedCloud = 0.01;
                    _targetScore     = 70; break;

                case 2:
                    _kSpeed_Angry    = 10;
                    _deltaSpeedAngry = 0.3;
                    _deltaSpeedCloud = 0.01;
                    _targetScore     = 100; break;
                }
            }
            else
            {
                _kSpeed_Angry    = 5;
                _deltaSpeedAngry = 0.1;
                _deltaSpeedCloud = 0.01;
            }

            _kSpeed_Cloud         = 5;
            _pauseFixCnt          = 0;
            _mySize               = (int)(Width * _mySize_K);
            _pauseFixCnt          = 0;
            FixPauseTimer.Enabled = true;

            if (File.Exists("cursor.cur"))
            {
                Cursor = new Cursor("cursor.cur");
            }
            else
            {
                File.WriteAllBytes($"cursor.cur", Resources.myCursor);
                Cursor = new Cursor("cursor.cur");
            }

            Refresher.Enabled = true;
            CloudDirection_Controller.Enabled = true;
            FruitGenerator.Enabled            = true;
            timer1.Enabled = true;

            _score = 0;
            if (_score != 0)
            {
                for (int i = 1; i <= _score; i++)
                {
                    if (!_endlessMode)
                    {
                        MySizeIncrease();
                    }
                    ComplexityIncrease();
                }
            }
            Score_Label.Text = _score.ToString();

            _startedJustNow = true;
            _fixFPS         = 0;
            ResizeComponents();
        }