コード例 #1
0
ファイル: Help.cs プロジェクト: brunomore/Squares-Desktop
        public Help()
        {
            InitializeComponent();
            this.CenterToScreen();
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.BackColor = System.Drawing.Color.Black;
            this.DoubleBuffered = true;
            this.Width = Resources.help1.Width + 15;
            this.Height = Resources.help1.Width + 15;
            help = Resources.help1;
            helpBitmap = new Bitmap(help);
            font1 = new Fonts("lgs.ttf", 20);
            font2 = new Fonts("lgs.ttf", 28);
            text = "Squares is a simple game with 100 squares\n"
                 + "placed in a matrix 10x10. On the start\n"
                 + "there are 5 squares random placed and\n"
                 + "with random color.The goal is to connect\n"
                 + "a line of three squares and get points.\n"
                 + "But look for a path to the destination!\n"
                 + "If there is no path, there will be no move!\n"
                 + "If you don't connect a line of three squares\n"
                 + "new five random squares are added. After\n"
                 + "two minutes the number of random generated\n"
                 + "squares is increased by one. Maximum\n"
                 + "number of colors added is eight. When\n"
                 + "the matrix is full the game is over.";

            back = Resources.Back;
            backHover = Resources.Back_hover;
            backBtmp = new Bitmap(back, new Size(210, 80));
            backHoverBtmp = new Bitmap(backHover, new Size(210, 80));
            buttonHovered = false;
        }
コード例 #2
0
ファイル: Play.cs プロジェクト: brunomore/Squares-Desktop
        public Play()
        {
            InitializeComponent();

            rows = 10;
            columns = 10;
            offset = 20;
            comboTimerTicks = 0;
            time = 120;
            freezeSeconds = 0;
            squareWidth = Resources._1.Width + 5;

            this.CenterToScreen();
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Height = 8 * offset + rows * squareWidth;
            this.Width = 3 * offset + columns * squareWidth - 15;
            this.BackColor = System.Drawing.Color.Black;
            this.DoubleBuffered = true;

            comboScore = false;
            bombWeaponSelected = false;
            cutWeaponSelected = false;
            freezeWeaponSelected = false;
            bombUsed = false;
            cutUsed = false;
            freezeUsed = false;

            nosTimer.Start();

            font = new Fonts("lgs.ttf", 28);

            sMatrix = new SquaresMatrix(rows, columns, squareWidth, offset);

            bomb = new Square(80 + rows * squareWidth, offset + 150, squareWidth);
            bomb.image = Resources.bomb;
            bomb.imageSelected = Resources.bomb_selected;
            bomb.imageDefault = Resources.no_bomb;
            cut = new Square(80 + rows * squareWidth, offset + 195, squareWidth);
            cut.image = Resources.cut_sword;
            cut.imageSelected = Resources.cut_sword_selected;
            cut.imageDefault = Resources.no_sword;
            freeze = new Square(80 + rows * squareWidth, offset + 240, squareWidth);
            freeze.image = Resources.freeze_time;
            freeze.imageSelected = Resources.no_freeze_time;
            mute = new Square(80 + rows * squareWidth, this.Width - squareWidth - offset - 5, squareWidth);
            mute.image = Resources.volume;
            mute.imageSelected = Resources.volume_off;
        }
コード例 #3
0
 public EnterName()
 {
     InitializeComponent();
     this.BackColor = Color.Black;
     this.Width = 350;
     this.Height = 300;
     this.CenterToScreen();
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
     square = Resources._11;
     offsetX = 45;
     offsetY = 60;
     nameTxt.Location = new Point(120 + offsetX, 25 + offsetY);
     btnOk.Location = new Point(120 + offsetX, 90 + offsetY);
     font = new Fonts("lgs.ttf", 28);
     Invalidate();
 }
コード例 #4
0
        public HighScores()
        {
            InitializeComponent();
            this.CenterToScreen();
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.BackColor = System.Drawing.Color.Black;
            this.DoubleBuffered = true;
            this.Width = Resources.highscores.Width + 15;
            this.Height = Resources.highscores.Width + 15;
            buttonHovered = false;

            try
            {
                FileStream str = File.OpenRead("scores.bin");
            }
            catch (FileNotFoundException)
            {
                scores = new List<int>();
                serializeScores(scores);
            }
            try
            {
                FileStream str = File.OpenRead("names.bin");
            }
            catch (FileNotFoundException)
            {
                names = new List<string>();
                serializeNames(names);
            }
            scores = deserializeScores();
            names = deserializeNames();

            scoresMain = Resources.highscores;
            back = Resources.Back;
            backHover = Resources.Back_hover;
            scoresBitmap = new Bitmap(scoresMain);
            backBtmp = new Bitmap(back, new Size(210, 80));
            backHoverBtmp = new Bitmap(backHover, new Size(210, 80));
            fonts = new Fonts("lgs.ttf", 28);
        }