private void wonder_Click(object sender, RoutedEventArgs e)
        {
            String name = image.Source.ToString();

            String subs = name.Split(',').Last();
            String last = subs.Split('/').Last();

            if (!last.Equals("BackOfWonderCards.png"))//make sure its not the placeholder
            {
                if (player.getPlayedACard() == false && (player.getBoard().getMaxWonderLevel() > player.getWonderCards().Count))
                {
                    if (rm.ValidateWonder(player))
                    {
                        player.getHand().Remove(cardToPlay);//remove from cards in hand of player

                        player.setWonderCards(cardToPlay);
                        player.getBoard().incrementWonderLevel(player);

                        this.Close();
                        PlayerGameBoard play = new PlayerGameBoard(parent, player, rm.getGameState());
                    }
                    else
                    {
                        this.Close();
                        ResourceManager manager = ResourceManager.GetInstance(rm.getGameState());
                        manager.resetResources(player);

                        WonderBuyingWindow window = new WonderBuyingWindow(ResourceManager.GetInstance().GetCombinedResources(player), cardToPlay, view, rm.getGameState());
                        window.Show();
                    }
                }
            }
        }
Exemplo n.º 2
0
//Mouse Click for "Sell Card" Button
        public void sellCardButton_Click(object sender, EventArgs e)
        {
            if (player.getPlayedACard() == false)
            {
                for (int i = 0; i < player.getHand().Count; i++)
                {
                    Card  c   = player.getHand()[i];
                    Image img = (Image)playBoard.Children[(56 + i)];//

                    if (img.ActualHeight > 150)
                    {
                        if (img.Source != new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Images/EmptyCard.png", UriKind.RelativeOrAbsolute));
                            PlayerGameBoard play = new PlayerGameBoard(parent, player, game);
                        }
                        //img.Source = new BitmapImage(new Uri(@"pack://application:,,,/Images/EmptyCard.png", UriKind.RelativeOrAbsolute));

                        // return;
                    }
                }
            }
        }
        private void buttonSell_Click(object sender, RoutedEventArgs e)
        {
            player.updateCoins(3);
            PlayerGameBoard play = new PlayerGameBoard(parent, player, rm.getGameState());

            this.Close();
        }
Exemplo n.º 4
0
//Mouse Click to handle the boards that allows free play of card
        private void specialMoveButton_Click(object sender, EventArgs e)
        {
            if (player.getPlayedACard() == false)
            {
                int numCards = player.getHand().Count;

                for (int i = 0; i < player.getHand().Count; i++)
                {
                    Card  c   = player.getHand()[i];
                    Image img = (Image)playBoard.Children[(56 + i)];

                    if (img.ActualHeight > 150)//this is the selected card
                    {
                        if (img.Source != new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Images/EmptyCard.png", UriKind.RelativeOrAbsolute));
                            PlayerGameBoard play = new PlayerGameBoard(parent, player, game);
                        }
                    }
                }
            }
        }
        private void startGameButton_Click(object sender, RoutedEventArgs e)
        {
            parent.Children.Remove(parent.Children[1]);     //hostCanvas

            List <TextBox>  tbList  = new List <TextBox>(7);
            List <ComboBox> cbList  = new List <ComboBox>(7);
            List <Player>   players = new List <Player>();

            input = this.tb.Text;
            UIElementCollection c = waitingCanvas.Children;

            //System.Console.WriteLine("\n\n\n");

            for (int i = 0; i < c.Count; i++)
            {
                UIElement el = c[i];

                if (c[i].GetType() == typeof(System.Windows.Controls.ComboBox))
                {
                    cbList.Add((ComboBox)c[i]);
                }

                if (c[i].GetType() == typeof(System.Windows.Controls.TextBox))
                {
                    tbList.Add((TextBox)c[i]);
                }
            }

            for (int i = 0; i < tbList.Count; i++)
            {
                ComboBox cb = null;
                TextBox  tb = tbList[i];

                if (tb.Text.Length != 0 && tb.Text != " ")
                {
                    cb = this.getComboBox(cbList, tb.Name.Substring(4, 1));
                    players.Add(new Player(i, cb.SelectedIndex));
                }
            }

            if (players.Count < 3)
            {
                System.Windows.MessageBox.Show("C'mon you need at least three players!");
                WaitingToStartCanvasHost wait = new WaitingToStartCanvasHost(parent);
            }
            else
            {
                StartGame start = new StartGame(players);
                //TODO NETWORKING   need a text field input of how many players are connected
                //Just read the text fields?...Accumulate
                GameState          game = start.getGame();
                List <PlayerState> ps   = game.getPlayers();

                PlayerGameBoard play = new PlayerGameBoard(parent, ps[0], game);//this creates the canvas that shows.
                //TODO need to make child 0 player and child 1 current view.
            }
        }
Exemplo n.º 6
0
// Mouse Click on player Buttons 72-78 Red 79-85 blue
        private void playerButton_Click(object sender, EventArgs e)
        {
            Button b  = (Button)sender;
            string p1 = "P1";
            string p2 = "P2";
            string p3 = "P3";
            string p4 = "P4";
            string p5 = "P5";
            string p6 = "P6";
            string p7 = "P7";

            makeCirclesBlack();

            if (b.Name.Equals(p1))
            {
                Ellipse el = (Ellipse)playBoard.Children[72];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(0), game);
            }
            else if (b.Name.Equals(p2))
            {
                Ellipse el = (Ellipse)playBoard.Children[73];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(1), game);
            }
            else if (b.Name.Equals(p3))
            {
                Ellipse el = (Ellipse)playBoard.Children[74];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(2), game);
            }
            else if (b.Name.Equals(p4))
            {
                Ellipse el = (Ellipse)playBoard.Children[75];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(3), game);
            }
            else if (b.Name.Equals(p5))
            {
                Ellipse el = (Ellipse)playBoard.Children[76];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(4), game);
            }
            else if (b.Name.Equals(p6))
            {
                Ellipse el = (Ellipse)playBoard.Children[77];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(5), game);
            }
            else if (b.Name.Equals(p7))
            {
                Ellipse el = (Ellipse)playBoard.Children[78];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(6), game);
            }
        }
 public ResourceBuying(Resources res, Card c, PlayerGameBoard p)
 {
     rc = res;
     card = c;
     board = p;
     you = rm.getGameState().getPlayerNum(rc.getPlayerName()[1]);
     
     InitializeComponent();
     createButtons();
     createValueFields();
 }
        public PlayExtraCardWindow(PlayerState p, Grid g, PlayerGameBoard pgb, Card c)
        {
            player     = p;
            parent     = g;
            view       = pgb;
            cardToPlay = c;

            InitializeComponent();

            image.Source = new BitmapImage(
                new Uri(@"pack://application:,,,/Images/" + cardToPlay.getName() + ".jpg", UriKind.RelativeOrAbsolute));
        }
Exemplo n.º 9
0
        public WonderBuyingWindow(Resources res, Card c, PlayerGameBoard p, GameState g)
        {
            resources = res;
            card      = c;
            board     = p;
            game      = g;
            manager   = ResourceManager.GetInstance();
            you       = manager.getGameState().getPlayerNum(resources.getPlayerName()[1]);

            InitializeComponent();
            createButtons();
            createValueFields();
        }
        public WonderBuyingWindow(Resources res, Card c, PlayerGameBoard p, GameState g)
        {
            resources = res;
            card      = c;
            board     = p;
            game      = g;
            manager   = ResourceManager.GetInstance();
            you       = manager.getGameState().getPlayerNum(resources.getPlayerName()[1]);

            InitializeComponent();
            createButtons();
            createValueFields();
        }
 public static WonderBuyingWindow GetInstance(Resources r, Card c, PlayerGameBoard p, GameState g)
 {
     if (_instance == null)
     {
         _instance = new WonderBuyingWindow(r, c, p, g);
     }
     else
     {
         _instance.Close();
         _instance.reset();
         _instance = new WonderBuyingWindow(r, c, p, g);
     }
     return(_instance);
 }
Exemplo n.º 12
0
//Mouse Click for "Add to Wonder" Button
        public void wonderCardButton_Click(object sender, EventArgs e)
        {
            if (player.getPlayedACard() == false && (player.getBoard().getMaxWonderLevel() > player.getWonderCards().Count))
            {
                for (int i = 0; i < player.getHand().Count; i++)
                {
                    Card  c   = player.getHand()[i];
                    Image img = (Image)playBoard.Children[(56 + i)];

                    if (img.ActualHeight > 150)
                    {
                        if (img.Source != new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Images/EmptyCard.png", UriKind.RelativeOrAbsolute));

                                Image           imgl = (Image)playBoard.Children[91];
                                PlayerGameBoard play = new PlayerGameBoard(parent, player, game);
                            }
                            else
                            {
                                ResourceManager manager = ResourceManager.GetInstance(game);
                                manager.resetResources(player);

                                WonderBuyingWindow window = new WonderBuyingWindow(ResourceManager.GetInstance().GetCombinedResources(player), c, this, game);
                                window.Show();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 13
0
//Mouse Click for "Play Card" button
        public void playerMoveButton_Click(object sender, EventArgs e)
        {
            if (player.getPlayedACard() == false)
            {
                int numCards = player.getHand().Count;

                for (int i = 0; i < player.getHand().Count; i++)
                {
                    Card  c   = player.getHand()[i];
                    Image img = (Image)playBoard.Children[(56 + i)];

                    if (img.ActualHeight > 150)//this is the selected card
                    {
                        if (img.Source != new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Images/EmptyCard.png", UriKind.RelativeOrAbsolute));
                                PlayerGameBoard play = new PlayerGameBoard(parent, player, game);
                            }
                            else
                            {
                                ResourceManager manager = ResourceManager.GetInstance(game);
                                manager.resetResources(player);

                                ResourceBuying window = new ResourceBuying(ResourceManager.GetInstance().GetCombinedResources(player), c, this, game);
                                window.Show();
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 14
0
        private void buttonPlay_Click(object sender, RoutedEventArgs e)
        {
            String name = image.Source.ToString();

            String subs = name.Split(',').Last();
            String last = subs.Split('/').Last();

            if (!last.Equals("BackOfWonderCards.png")) //make sure its not the placeholder
            {
                player.addPlayedCards(cardToPlay);     //add to the playerState
                discards.Remove(cardToPlay);           //remove the card from discards

                rm.getGameState().incrementTurn();
                this.Close();
                //now redraw the window
                PlayerGameBoard play = new PlayerGameBoard(parent, player, rm.getGameState());
            }
        }
Exemplo n.º 15
0
        public ResourceBuying(Resources res, Card c, PlayerGameBoard p, GameState g)
        {
            resources = res;

            //Console.WriteLine(resources.ToString());

            card    = c;
            board   = p;
            game    = g;
            manager = ResourceManager.GetInstance();


            you = manager.getGameState().getPlayerNum(resources.getPlayerName()[1]);

            InitializeComponent();
            createButtons();
            createValueFields();
        }
        private void buttonPlay_Click(object sender, RoutedEventArgs e)
        {
            if (rm.ValidateCard(player, cardToPlay))
            {
                player.addPlayedCards(cardToPlay);
                this.Close();
                PlayerGameBoard play = new PlayerGameBoard(parent, player, rm.getGameState());
            }
            else
            {
                this.Close();
                ResourceManager manager = ResourceManager.GetInstance(rm.getGameState());
                manager.resetResources(player);

                ResourceBuying window = new ResourceBuying(ResourceManager.GetInstance().GetCombinedResources(player), cardToPlay, view, rm.getGameState());
                window.Show();
            }
        }
Exemplo n.º 17
0
        public ResourceBuying(Resources res, Card c, PlayerGameBoard p, GameState g)
        {
            resources = res;

            //Console.WriteLine(resources.ToString());
            
            card    = c;
            board   = p;
            game    = g;
            manager = ResourceManager.GetInstance();


            you = manager.getGameState().getPlayerNum(resources.getPlayerName()[1]);
            
            InitializeComponent();
            createButtons();
            createValueFields();
        }
Exemplo n.º 18
0
//Mouse Click for "Play Card" button
        private void playerMoveButton_Click(object sender, EventArgs e)
        {
            if (player.getPlayedACard() == false)
            {               
                int numCards = player.getHand().Count;

                for (int i = 0; i < player.getHand().Count; i++)
                {
                    Card c = player.getHand()[i];
                    Image img = (Image)playBoard.Children[(56 + i)];

                    if (img.ActualHeight > 150)//this is the selected card
                    {
                        if (img.Source != new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Images/EmptyCard.png", UriKind.RelativeOrAbsolute));
                                PlayerGameBoard play = new PlayerGameBoard(parent, player, game);
                            }
                            else
                            {
                                ResourceManager manager = ResourceManager.GetInstance(game);
                                manager.resetResources(player);

                                ResourceBuying window = new ResourceBuying(ResourceManager.GetInstance().GetCombinedResources(player), c, this, game);
                                window.Show();
                            }
                        }
                    }                    
                }
            }
        }
Exemplo n.º 19
0
//Mouse Click for "Sell Card" Button
        private void sellCardButton_Click(object sender, EventArgs e)
        {
            if (player.getPlayedACard() == false)
            {
                for (int i = 0; i < player.getHand().Count; i++)
                {
                    Card c = player.getHand()[i];
                    Image img = (Image)playBoard.Children[(56 + i)];//

                    if (img.ActualHeight > 150)
                    {
                        if (img.Source != new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Images/EmptyCard.png", UriKind.RelativeOrAbsolute));
                            PlayerGameBoard play = new PlayerGameBoard(parent, player, game);
                        }
                        //img.Source = new BitmapImage(new Uri(@"pack://application:,,,/Images/EmptyCard.png", UriKind.RelativeOrAbsolute));
                        
                       // return;
                    }

                }
            }
        }
Exemplo n.º 20
0
//Mouse Click for "Add to Wonder" Button
        private void wonderCardButton_Click(object sender, EventArgs e) 
        {
            if (player.getPlayedACard() == false && (player.getBoard().getMaxWonderLevel() >= player.getWonderCards().Count))
            {
                for (int i = 0; i < player.getHand().Count; i++)
                {
                    Card c = player.getHand()[i];
                    Image img = (Image)playBoard.Children[(56 + i)];

                    if (img.ActualHeight > 150)
                    {
                        if (img.Source != new BitmapImage(new Uri(@"pack://*****:*****@"pack://application:,,,/Images/EmptyCard.png", UriKind.RelativeOrAbsolute));

                                Image imgl = (Image)playBoard.Children[91];
                                PlayerGameBoard play = new PlayerGameBoard(parent, player, game);
                            }
                            else
                            {
                                ResourceManager manager = ResourceManager.GetInstance(game);
                                manager.resetResources(player);

                                WonderBuyingWindow window = new WonderBuyingWindow(ResourceManager.GetInstance().GetCombinedResources(player), c, this, game);
                                window.Show();
                            }
                        }
                    }
                }
            }            
        }
Exemplo n.º 21
0
 public static WonderBuyingWindow GetInstance(Resources r, Card c, PlayerGameBoard p, GameState g)
 {
     if (_instance == null)
     {
         _instance = new WonderBuyingWindow(r, c, p, g);
     }
     else
     {
         _instance.Close();
         _instance.reset();
         _instance = new WonderBuyingWindow(r, c, p, g);
     }
     return _instance;
 }
Exemplo n.º 22
0
// This button click handler finds which button you pressed and then modifies the appropriate 
// Player resources as well calling methods for removing and adding money
// B[1,7] = YOU, B[8,14] = LEFT, B[15-21] = RIGHT

        private void buyButton_Click(object sender, RoutedEventArgs e)
        {
            Button b = (Button)sender;
            string name = b.Name;//have button name will travel

            int index;

            if (name.Length > 2)
            {
                index = ((int)Char.GetNumericValue(name[1]) * 10) + (int)Char.GetNumericValue(name[2]);
            }
            else
            {
                index = (int)Char.GetNumericValue(name[1]);//know which number
            }

            if (index > 0 && index < 8)//Player clicked on YOU
            {
                manager.usingSpecialResource(you, (index - 1));
                resources = manager.GetCombinedResources(you);

                if (manager.ValidateWonder(you))//ok check if you can play the card now.
                {
                    you.getHand().Remove(card);//remove from cards in hand of player
                    you.setPlayedACard();//set true
                    game.incrementTurn();
                    you.setWonderCards(card);
                    you.getBoard().incrementWonderLevel(you);
                    this.Close();
                    PlayerGameBoard play = new PlayerGameBoard(board.getGrid(), you, manager.getGameState());
                }
                else
                {
                    this.Close();

                    WonderBuyingWindow window = new WonderBuyingWindow(resources, card, board, game);
                    window.Show();
                }
            }

            if (index > 7 && index < 15)//Player clicked on LEFT
            {
                int i = (index - 8);

                if (manager.canAfford(you))
                {
                    //PlayerGameBoard play = new PlayerGameBoard(board.getGrid(), you, manager.getGameState());
                    Canvas c = (Canvas)board.getGrid().Children[1];
                    Label l = (Label)c.Children[90];
                    l.Content = " " + manager.getCoinTransaction();

                    manager.tradeTo(you, i, 0);
                    resources = manager.GetCombinedResources(you); 

                    if (manager.ValidateWonder(you))//ok check if you can play the card now.
                    {
                        you.getHand().Remove(card);//remove from cards in hand of player
                        you.setPlayedACard();//set true
                        game.incrementTurn();
                        you.setWonderCards(card);
                        you.getBoard().incrementWonderLevel(you);
                        this.Close();
                        PlayerGameBoard play = new PlayerGameBoard(board.getGrid(), you, manager.getGameState());
                    }
                    else
                    {
                        this.Close();

                        WonderBuyingWindow window = new WonderBuyingWindow(resources, card, board, game);
                        window.Show();
                    }
                }
            }

            if (index > 14 && index < 22)//Player clicked on RIGHT
            {
                int i = (index - 15);//0-6 the resource traded

                if (manager.canAfford(you))
                {
                    Canvas c = (Canvas)board.getGrid().Children[1];
                    Label l = (Label)c.Children[90];
                    l.Content = " " + manager.getCoinTransaction();
                    
                    manager.tradeTo(you, i, 1);
                    resources = manager.GetCombinedResources(you); 

                    if (manager.ValidateWonder(you))//ok check if you can play the card now.
                    {
                        you.getHand().Remove(card);//remove from cards in hand of player
                        you.setPlayedACard();//set true
                        game.incrementTurn();
                        you.setWonderCards(card);
                        you.getBoard().incrementWonderLevel(you);
                        this.Close();
                        PlayerGameBoard play = new PlayerGameBoard(board.getGrid(), you, manager.getGameState());
                    }
                    else
                    {
                        this.Close();

                        WonderBuyingWindow window = new WonderBuyingWindow(resources, card, board, game);
                        window.Show();
                    }
                }
            }
        }
 public static ResourceBuying GetInstance(Resources r, Card c, PlayerGameBoard p)
 {
     if (_instance == null)
     {
         _instance = new ResourceBuying(r, c, p);
     }
     else
     {
         _instance.Close();
         _instance = new ResourceBuying(r, c, p);
     }
     return _instance;
 }
        //This button click handler finds which button you pressed and then modifies the appropriate 
        //Player resources as well calling methods for removing and adding money
        // B[1,7] = YOU, B[8,14] = LEFT, B[15-21] = RIGHT
        private void buyButton_Click(object sender, RoutedEventArgs e)
        {
            Button b = (Button)sender;
            string name = b.Name;//have button name will travel
            
            int index;

            if (name.Length > 2)
            {
                index = ((int)Char.GetNumericValue(name[1])*10) + (int)Char.GetNumericValue(name[2]);
            }
            else
            {
                index = (int)Char.GetNumericValue(name[1]);//know which number
            }

            Console.WriteLine("Button Number: " + index);
            
            if(index > 0 && index < 8)
            {

                this.Hide();

                rm.usingSpecialResource(you, index-1);                
                
                //rm.resetSpecialResources(you);

                rc = rm.GetCombinedResources(you);

                ResourceBuying window = ResourceBuying.GetInstance(rc, card, board);                
                
                if (rm.ValidateCard(you, card))//ok check if you can play the card now.
                {                    
                    //window.Hide();
                    you.addPlayedCards(card);//add to the playerState
                    board.changeCard(card);//adds to the board cards                    
                    you.setPlayedACard();//set true
                    you.getHand().Remove(card);//remove from cards in hand of player
                    rm.getGameState().incrementTurn();

                    //refresh the view
                    PlayerGameBoard play = new PlayerGameBoard(board.getGrid(), you, rm.getGameState());
                }
                else
                {                    
                    window.Show();
                }
                Console.WriteLine("Player: " + you.getName() + " Calling Special: index currently: " + (index-1));
            }
        }
Exemplo n.º 25
0
// Mouse Click on player Buttons 72-78 Red 79-85 blue
        private void playerButton_Click(object sender, EventArgs e)
        {
            Button b = (Button)sender;
            string p1 = "P1";
            string p2 = "P2";
            string p3 = "P3";
            string p4 = "P4";
            string p5 = "P5";
            string p6 = "P6";
            string p7 = "P7";

            makeCirclesBlack();

            if (b.Name.Equals(p1))
            {
                Ellipse el = (Ellipse)playBoard.Children[72];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(0), game);
            }
            else if(b.Name.Equals(p2))
            {
                Ellipse el = (Ellipse)playBoard.Children[73];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(1), game);
            }
            else if (b.Name.Equals(p3))
            {
                Ellipse el = (Ellipse)playBoard.Children[74];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(2), game);
            }
            else if (b.Name.Equals(p4))
            {
                Ellipse el = (Ellipse)playBoard.Children[75];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(3), game);
            }
            else if (b.Name.Equals(p5))
            {
                Ellipse el = (Ellipse)playBoard.Children[76];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(4), game);
            }
            else if (b.Name.Equals(p6))
            {
                Ellipse el = (Ellipse)playBoard.Children[77];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(5), game);
            }
            else if (b.Name.Equals(p7))
            {
                Ellipse el = (Ellipse)playBoard.Children[78];
                el.Fill = new SolidColorBrush(Colors.Red);
                PlayerGameBoard g = new PlayerGameBoard(parent, game.getPlayerNum(6), game);
            }
        }
Exemplo n.º 26
0
        private void startGameButton_Click(object sender, RoutedEventArgs e)
        {
            parent.Children.Remove(parent.Children[1]);     //hostCanvas

            List<TextBox>  tbList = new List<TextBox>(7);
            List<ComboBox> cbList = new List<ComboBox>(7);
            List<Player>  players = new List<Player>();

            input = this.tb.Text;            
            UIElementCollection c = waitingCanvas.Children;
            //System.Console.WriteLine("\n\n\n");
            
            for (int i = 0; i < c.Count; i++)
            {                                               
                UIElement el = c[i];

                if (c[i].GetType() == typeof(System.Windows.Controls.ComboBox))
                    cbList.Add((ComboBox)c[i]);

                if (c[i].GetType() == typeof(System.Windows.Controls.TextBox))
                    tbList.Add((TextBox)c[i]);
            }

            for (int i = 0; i < tbList.Count; i++)
            {
                ComboBox cb = null;
                TextBox tb = tbList[i];

                if (tb.Text.Length != 0 && tb.Text != " ")
                {
                    cb = this.getComboBox(cbList, tb.Name.Substring(4, 1)); 
                    players.Add(new Player(i, cb.SelectedIndex));
                }
            }

            if (players.Count < 3)
            {
                System.Windows.MessageBox.Show("C'mon you need at least three players!");
                WaitingToStartCanvasHost wait = new WaitingToStartCanvasHost(parent);
            }
            else
            {                
                StartGame start = new StartGame(players);
                //TODO NETWORKING   need a text field input of how many players are connected
                //Just read the text fields?...Accumulate
                GameState game = start.getGame();
                List<PlayerState> ps = game.getPlayers();

                PlayerGameBoard play = new PlayerGameBoard(parent, ps[0], game);//this creates the canvas that shows.                
                //TODO need to make child 0 player and child 1 current view.
            }
        }
// This button click handler finds which button you pressed and then modifies the appropriate
// Player resources as well calling methods for removing and adding money
// B[1,7] = YOU, B[8,14] = LEFT, B[15-21] = RIGHT

        private void buyButton_Click(object sender, RoutedEventArgs e)
        {
            Button b    = (Button)sender;
            string name = b.Name;//have button name will travel

            int index;

            if (name.Length > 2)
            {
                index = ((int)Char.GetNumericValue(name[1]) * 10) + (int)Char.GetNumericValue(name[2]);
            }
            else
            {
                index = (int)Char.GetNumericValue(name[1]);//know which number
            }

            if (index > 0 && index < 8)//Player clicked on YOU
            {
                manager.usingSpecialResource(you, (index - 1));
                resources = manager.GetCombinedResources(you);

                if (manager.ValidateWonder(you)) //ok check if you can play the card now.
                {
                    you.getHand().Remove(card);  //remove from cards in hand of player
                    you.setPlayedACard();        //set true
                    you.setWonderCards(card);

                    you.getBoard().incrementWonderLevel(you);
                    manager.getGameState().incrementTurn();
                    this.Close();
                    PlayerGameBoard play = new PlayerGameBoard(board.getGrid(), you, manager.getGameState());
                }
                else
                {
                    this.Close();

                    WonderBuyingWindow window = new WonderBuyingWindow(resources, card, board, game);
                    window.Show();
                }
            }

            if (index > 7 && index < 15)//Player clicked on LEFT
            {
                int i = (index - 8);

                if (manager.canAfford(you))
                {
                    //PlayerGameBoard play = new PlayerGameBoard(board.getGrid(), you, manager.getGameState());
                    Canvas c = (Canvas)board.getGrid().Children[1];
                    Label  l = (Label)c.Children[90];
                    l.Content = " " + manager.getTempCoins(you);

                    manager.tradeTo(you, i, 0);
                    resources = manager.GetCombinedResources(you);

                    if (manager.ValidateWonder(you)) //ok check if you can play the card now.
                    {
                        you.getHand().Remove(card);  //remove from cards in hand of player
                        you.setPlayedACard();        //set true
                        you.setWonderCards(card);
                        you.getBoard().incrementWonderLevel(you);
                        manager.getGameState().incrementTurn();
                        this.Close();
                        PlayerGameBoard play = new PlayerGameBoard(board.getGrid(), you, manager.getGameState());
                    }
                    else
                    {
                        this.Close();

                        WonderBuyingWindow window = new WonderBuyingWindow(resources, card, board, game);
                        window.Show();
                    }
                }
            }

            if (index > 14 && index < 22) //Player clicked on RIGHT
            {
                int i = (index - 15);     //0-6 the resource traded

                if (manager.canAfford(you))
                {
                    Canvas c = (Canvas)board.getGrid().Children[1];
                    Label  l = (Label)c.Children[90];
                    l.Content = " " + manager.getTempCoins(you);

                    manager.tradeTo(you, i, 1);
                    resources = manager.GetCombinedResources(you);

                    if (manager.ValidateWonder(you)) //ok check if you can play the card now.
                    {
                        you.getHand().Remove(card);  //remove from cards in hand of player
                        you.setPlayedACard();        //set true
                        you.setWonderCards(card);
                        you.getBoard().incrementWonderLevel(you);
                        manager.getGameState().incrementTurn();
                        this.Close();
                        PlayerGameBoard play = new PlayerGameBoard(board.getGrid(), you, manager.getGameState());
                    }
                    else
                    {
                        this.Close();

                        WonderBuyingWindow window = new WonderBuyingWindow(resources, card, board, game);
                        window.Show();
                    }
                }
            }
        }