Ejemplo n.º 1
0
        // method to set the window to show the game
        private void USetup_Close(object sender, PropertyChangedEventArgs e)
        {
            _gameManager.DealCards();
            UGame game = new UGame(_gameManager);

            game.EndGame += UEndScreen_reset;
            ContentController.Content = game;
        }
Ejemplo n.º 2
0
        public GamePage(MainPage m)
        {
            this.InitializeComponent();
            Main = m;


            PlayerPanels = new List <Panel>();
            Game         = new UGame(3, 0, true);
            BIPanels     = new Dictionary <int, List <Panel> >();

            Handler = new UserHandler(Game, Game.Players[0], this);

            foreach (var p in Game.Players)
            {
                //    Binding myBinding = new Binding()
                //    {
                //        Mode = BindingMode.OneWay,
                //        Source = GameWPF.Game;
                //    };


                StackPanel sp = new StackPanel
                {
                    Name        = "sp" + p.ID,
                    Orientation = Orientation.Horizontal
                };
                TextBlock tb = new TextBlock()
                {
                    Text = p.Nickname
                };


                //BindingOperations.SetBinding(sp, TextBlock.TextProperty, myBinding);

                sp.Children.Add(tb);


                List <Panel> list = new List <Panel>();
                for (int i = 0; i < Game.Settings.NumberToWin; i++)
                {
                    StackPanel spl = new StackPanel()
                    {
                        Orientation = Orientation.Horizontal
                    };

                    list.Add(spl);
                    sp.Children.Add(spl);
                }
                BIPanels.Add(p.ID, list);

                PlayerPanels.Add(sp);
                GameContent.Children.Add(sp);
            }

            Handler.InitializeUserPanels();

            //Task taskA = new Task(() => GameWPF.Start(2000));
            //// Start the task.
            //taskA.Start();

            Button b = new Button()
            {
                Content = "Pass Turn"
            };

            b.Click += Button_Click;

            GameContent.Children.Add(b);
            UpdateGamePanel();
        }