Form1.cs

(开头部分) 5KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 俄罗斯方块
{
    public partial class Form1 : Form
    {

        private Block currentBlock, nextBlock;
        int score = 0;
        Point startLocation = new Point(GameField.squareSize * 8, 0);
        Graphics g1,g2;

        private enum speed
        {
            slower = 1000,
            slow = 900,
            quick = 500,
            quicker = 300,
            quickest = 200
        };

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            picBackground.Size = new Size(GameField.width * GameField.squareSize, GameField.height * GameField.squareSize);
            GameField.backColor = picBackground.BackColor;
            g1 = picBackground.CreateGraphics();
            g2 = picPreview.CreateGraphics();
            timer1.Interval = (int)speed.quick;

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            if (!currentBlock.MoveDown(g1))
            {
                if (currentBlock.Top() == 0)
                {
                    timer1.Enabled = false;
                    //MessageBox.Show("Game Over");
                    lblMsg.BringToFront();
                    lblMsg.Text = "游戏结束";
                    return;
                }
                int eraseLines = GameField.CheckLines();
                if (eraseLines > 0)
                {
                    score += GameField.width * eraseLines;
                    scoreLabel.Text = score.ToString();
                    picBackground.Refresh();
后面还有 116 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。