Exemplo n.º 1
0
        public Table(MainWindow main, List<Rectangle> tabRect, Level lvl)
        {
            this.lvl = lvl;
            var left = 1;
            var top = 1;

            this.windows = main;

            for (int i = 1; i < 181; i++)
            {
                var rect = new Rectangle();
                rect.Height = 20;
                rect.Width = 20;
                rect.Stroke = new SolidColorBrush(Colors.LightGray);
                rect.Tag = i - 1;
                Canvas.SetLeft(rect, left * 20);
                Canvas.SetTop(rect, top * 20);
                main.gameGrid.Children.Add(rect);
                tabRect.Add(rect);

                if (i % 10 == 0 && i != 0)
                {
                    top++;
                    left = 1;
                }
                else
                {
                    left++;
                }
            }
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            Closing += Window_Closing;
            AllThreads = new List<Thread>();
            main = this;
            fenetre.Background = new SolidColorBrush(Colors.LightBlue);
        }
Exemplo n.º 3
0
 public MainWindow()
 {
     instance = this;
     InitializeComponent();
 }
Exemplo n.º 4
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Tetris = ((Tetris.MainWindow)(target));
                return;

            case 2:

            #line 9 "..\..\MainWindow.xaml"
                ((System.Windows.Controls.Grid)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Grid_MouseDown);

            #line default
            #line hidden
                return;

            case 3:
                this.map = ((System.Windows.Controls.Grid)(target));
                return;

            case 4:
                this.rctSidePanel = ((System.Windows.Shapes.Rectangle)(target));

            #line 18 "..\..\MainWindow.xaml"
                this.rctSidePanel.MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.rctSidePanel_MouseDown);

            #line default
            #line hidden
                return;

            case 5:
                this.tbkHeader = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.btnPause = ((System.Windows.Controls.Button)(target));

            #line 20 "..\..\MainWindow.xaml"
                this.btnPause.Click += new System.Windows.RoutedEventHandler(this.btnPause_Click);

            #line default
            #line hidden
                return;

            case 7:
                this.recImageBackground = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 8:
                this.imgNextPiece = ((System.Windows.Controls.Image)(target));
                return;

            case 9:
                this.lblNextPiece = ((System.Windows.Controls.Label)(target));
                return;

            case 10:
                this.rctStatBackground = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 11:
                this.stckStatLabels = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 12:
                this.lblScore = ((System.Windows.Controls.Label)(target));
                return;

            case 13:
                this.lblLines = ((System.Windows.Controls.Label)(target));
                return;

            case 14:
                this.lblTime = ((System.Windows.Controls.Label)(target));
                return;

            case 15:
                this.lblLevel = ((System.Windows.Controls.Label)(target));
                return;

            case 16:
                this.stckStatLabels_Copy = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 17:
                this.lblScoreOutput = ((System.Windows.Controls.Label)(target));
                return;

            case 18:
                this.lblLinesOutput = ((System.Windows.Controls.Label)(target));
                return;

            case 19:
                this.lblTimeOutput = ((System.Windows.Controls.Label)(target));
                return;

            case 20:
                this.lblLevelOutput = ((System.Windows.Controls.Label)(target));
                return;
            }
            this._contentLoaded = true;
        }
Exemplo n.º 5
0
        public Partie(MainWindow main, Level level)
        {
            ScoresPartie = new Score();
            ScoresPartie.Read(level.numero);
            this.enregistré = false;
            this.main = main;
            this.level = level;

            main.tetris.Visibility = Visibility.Collapsed;
            Barre.Couleurs = level.Couleurs;
            main.fenetre.Background = new SolidColorBrush(level.backgroundcolor);

            if (level.backgroundcolor == Colors.Black)
            {
                main.Termine.Foreground = new SolidColorBrush(Colors.White);
                main.ScoreNiveau.Foreground = new SolidColorBrush(Colors.White);
                main.ScoreNom.Foreground = new SolidColorBrush(Colors.White);
                main.ScoreScore.Foreground = new SolidColorBrush(Colors.White);
                main.labelScore.Foreground = new SolidColorBrush(Colors.White);
                main.labelScoreLevel.Foreground = new SolidColorBrush(Colors.White);
                main.labelScoreNom.Foreground = new SolidColorBrush(Colors.White);
                main.ScoreActuel.Foreground = new SolidColorBrush(Colors.White);
                main.score.Foreground = new SolidColorBrush(Colors.White);
            }
            else
            {
                main.Termine.Foreground = new SolidColorBrush(Colors.Black);
                main.ScoreNiveau.Foreground = new SolidColorBrush(Colors.Black);
                main.ScoreNom.Foreground = new SolidColorBrush(Colors.Black);
                main.ScoreScore.Foreground = new SolidColorBrush(Colors.Black);
                main.labelScore.Foreground = new SolidColorBrush(Colors.Black);
                main.labelScoreLevel.Foreground = new SolidColorBrush(Colors.Black);
                main.labelScoreNom.Foreground = new SolidColorBrush(Colors.Black);
                main.ScoreActuel.Foreground = new SolidColorBrush(Colors.Black);
                main.score.Foreground = new SolidColorBrush(Colors.Black);
            }

            if (level.numero == 4) {
                main.nyan.Visibility = System.Windows.Visibility.Visible;
                main.image.Visibility = System.Windows.Visibility.Visible;
            }

            test = Barre.Create(); // Test est la barre qui sera en cours de placement
            tabRect = new List<Rectangle>(180);
            main.banniere.Content = "GooOOoooo";
            this.grille = new Table(main, tabRect, level);
            messageTimer = new DispatcherTimer();
            messageTimer.Tick += new EventHandler(messageTimer_Tick);
            messageTimer.Interval = new TimeSpan(0, 0, 0, 0, level.timer);
            messageTimer.Start();

            Thread myThread = new Thread(() => playSong());
            MainWindow.AllThreads.Add(myThread);
            myThread.Start();
            partie = this;

            if(level.numero == 3)
            {
                da= new DoubleAnimation();
                da.From = 0;
                da.To = 360;
                da.Duration = new Duration(TimeSpan.FromSeconds(3));
                da.RepeatBehavior = RepeatBehavior.Forever;
                rt = new RotateTransform(360, main.gameGrid.Width / 2, main.gameGrid.Height / 2);
                main.gameGrid.RenderTransform = rt;
                rt.BeginAnimation(RotateTransform.AngleProperty, da);

            }
            if(level.numero == 5)
            {
                main.gameGrid.RenderTransform = new RotateTransform(180,main.gameGrid.Width /2, main.gameGrid.Height / 2);

                for (int i = 0; i < tabRect.Count; i++)
                {
                        tabRect[i].Fill = new SolidColorBrush(Colors.Black);
                }
            }
        }
Exemplo n.º 6
0
        public void destroy()
        {
            messageTimer.Stop();

            if (level.numero == 5)
                main.gameGrid.RenderTransform = new RotateTransform(360, main.gameGrid.Width / 2, main.gameGrid.Height / 2);

            da = new DoubleAnimation();
            da.From = 0;
            da.To = 0;
            da.Duration = new Duration(TimeSpan.FromSeconds(1));
            da.RepeatBehavior = RepeatBehavior.Forever;
            rt = new RotateTransform();
            main.gameGrid.RenderTransform = rt;
            rt.BeginAnimation(RotateTransform.AngleProperty, da);

            this.read = false;
            this.grille = null;
            this.main = null;
            this.tabRect = null;
            this.test = null;
            Score.listeScore = new List<Score>();
        }