예제 #1
0
 public Box GetNewBasicBox(GameFrame gf = null)
 {
     Random rand = new Random(seed);
     seed = rand.Next();
     int id = rand.Next(7)+1;
     return GetBoxFromId(id, gf);
 }
예제 #2
0
 public static Box GetBoxFromId(int id,GameFrame gf = null)
 {
     Box box=null;
     switch (id)
     {
         case 1:
             box = new Z_Box(gf);
             break;
         case 2:
             box = new S_Box(gf);
             break;
         case 3:
             box = new T_Box(gf);
             break;
         case 4:
             box = new I_Box(gf);
             break;
         case 5:
             box = new O_Box(gf);
             break;
         case 6:
             box = new L_Box(gf);
             break;
         case 7:
             box = new J_Box(gf);
             break;
     }
     if (box == null)
         box = new I_Box(gf);
     return box;
 }
예제 #3
0
 public J_Box(GameFrame gf)
     : base(gf)
 {
     this.shape = BoxShape.J;
     entity = new List<Square>{
         new Square(new Position(0,0), shape),
         new Square(new Position(0,-1), shape),
         new Square(new Position(-1,0), shape),
         new Square(new Position(-2,0), shape)
     };
 }
예제 #4
0
        public MainWindow()
        {
            InitializeComponent();

            game = new MyGameFrame(gameGrid,19,11);

            scoreBoard = new ScoringBoard(Scoring_Board);

            preview = new PreviewWindow(game, PreviewImage);

            game.RowsCleanEvent += scoreBoard.GetScore;
            game.GameOverEvent += scoreBoard.WhenGameOver;
        }
예제 #5
0
        public PreviewWindow(GameFrame gf,Image img)
        {
            gFrame = gf;
            this.img = img;
            string path = System.Environment.CurrentDirectory + "/images/" + "emptyPreview.png";

            if (File.Exists(path))
            {
                img.Source = new BitmapImage(new Uri(path, UriKind.Absolute));
            }
            else
            {
                img.Source = null;
            }

            gFrame.RenewReadyBox += GetNewReadyBox;
        }
		public Singleplaywindow()
		{
			InitializeComponent();
            // 在此点之下插入创建对象所需的代码。
           
            game = new MyGameFrame(gameGrid,19,11);

            scoreBoard = new ScoringBoard(Scoring_Board);

            preview = new PreviewWindow(game, PreviewImage);

            game.RowsCleanEvent += scoreBoard.GetScore;
            game.RowsCleanEvent += Play;           

            game.GameOverEvent += scoreBoard.WhenGameOver;
            //game.GameOverEvent += writeScoreRating;
        }
예제 #7
0
파일: BoxShadow.cs 프로젝트: zpw987/Teteris
 public BoxShadow(GameFrame gf)
 {
     //entity = new List<Square>();
     gFrame = gf;
     reflect += gf.ActiveBoxPositionChanged;
 }
예제 #8
0
 public O_Box(GameFrame gf)
     : base(gf)
 {
     this.shape = BoxShape.O;
     entity = new List<Square>{
         new Square(new Position(0,0), shape),
         new Square(new Position(0,1), shape),
         new Square(new Position(-1,0), shape),
         new Square(new Position(-1,1), shape),
     };
 }
예제 #9
0
 public L_Box(GameFrame gf)
     : base(gf)
 {
     state = 0;
     this.shape = BoxShape.L;
     entity = new List<Square>{
         new Square(new Position(0,0), shape),
         new Square(new Position(0,1), shape),
         new Square(new Position(-1,0), shape),
         new Square(new Position(-2,0), shape),
     };
 }
예제 #10
0
파일: Box.cs 프로젝트: zpw987/Teteris
        protected Timer timer2; //快速下落后销毁方块

        #endregion Fields

        #region Constructors

        public Box(GameFrame gf)
        {
            this.gFrame = gf;
            isActive = false;
            center = new Position(2, gFrame.Column / 2);
        }