Esempio n. 1
0
        //初始 各变量 和 所需 类
        #region  初始
        void init()
        {
            try
            {
                this.Opacity = 0.0;
                Color c = Color.FromArgb(45, 45, 45);

                //设置游戏容器背景
                Image_Procces.ImageForBackImage(this.panel1);

                //设置游戏下个方块背景
                this.panel2.BackColor = c;
                Image_Procces.ImageForBackImage(this.panel2);

                //对方浏览窗体的背景1
                //键盘设置
                key[0]  = Keys.Up;            // 旋转
                key[1]  = Keys.Down;          //加速
                key[2]  = Keys.Left;          //向左
                key[3]  = Keys.Right;         //向右
                key[4]  = Keys.Space;
                key[5]  = Keys.S;             //切换道具
                key[6]  = Keys.D1;            //对1号使用道具
                key[7]  = Keys.D2;
                key[8]  = Keys.D3;
                key[9]  = Keys.D4;
                key[10] = Keys.D5;
                key[11] = Keys.D6;              //对6号使用道具
                keysSet.getForm(this);          //参数设置获得主界面
                // 彩色背景图片(如 人物形象)
                ColorImage[0] = new  Bitmap(@"图片\man1.gif");
                ColorImage[1] = new  Bitmap(@"图片\man2.gif");
                ColorImage[2] = new  Bitmap(@"图片\man3.gif");
                ColorImage[3] = new  Bitmap(@"图片\man4.gif");
                ColorImage[4] = new  Bitmap(@"图片\man5.gif");
                ColorImage[5] = new  Bitmap(@"图片\man6.gif");

                //主游戏区 背景灰化
                Image_Procces.Image_Hui(ColorImage[0], this.panel1);
                Root_Module = new Bitmap(this.panel1.BackgroundImage, this.panel1.Width, this.panel1.Height);
                Image_Procces.Image_AddPicture(ColorImage[0], this.panel1);


                this.block = new SingleTetirs(this.panel1, 12, 21, 16, this);          //(Control con1,int gridx,int gridy,int side,Form formControl)
                //背景音乐
                this.soundBack = new SoundBack();
            }
            catch {}
        }
Esempio n. 2
0
        //开始游戏
        //这里的开始 与结束 是用于 实现网络的同步 当所有 人都开始 游戏才开始
        //同样 当只有一人没有失败时才结束
        public void StartGame()
        {
            // TODO:  添加 Form1.StartGame 实现

            this.block.start();            //后台开始
            Sound.Play(6);
            //Ready go 开始
            Image_Procces.Image_GameStart(this.panel1);

            Thread.CurrentThread.Join(400);
            this.Game_Fail = false;
            if (keysSet.musicBack)
            {
                this.soundBack.music_start();
            }
        }
Esempio n. 3
0
//游戏失败检测
        private void checkFail()
        {
            if (!this.isPut(this.Now_Brick_X, this.Now_Brick_Y, this.Now_Brick_Num, this.Now_Brick_Direct))
            {
                try
                {
                    SingleTetirs.FailOrWin = true;                  //游戏失败
                    Sound.Play(5);
                    Image_Procces.Image_GameStop(this.con, this.Game_Score, this.Game_Line, this.module);
                    this.formControl.Fail();
                    //失败 绘图

                    Thread.Sleep(4000);

                    this.con.Invalidate();
                    this.con.Update();
                    //将 提示下一个方块信息 的 窗体清空
                }
                catch {}
            }
        }