Exemple #1
0
        public Trade(PA3BackEnd.src.Monopoly.MonopolyGame monopolyGame, RoutedEventHandler routedEvent)
        {
            InitializeComponent();
            this.monopolyGame = monopolyGame;


            properties0 = new List <int>();
            properties1 = new List <int>();

            this.routedEvent = routedEvent;

            cover = new Rectangle();
            cover.SetValue(Grid.RowSpanProperty, 4);
            cover.SetValue(Grid.ColumnSpanProperty, 4);
            cover.Fill    = Brushes.White;
            cover.Opacity = 0.5;

            CardHolderPlayer0.Add_EventHandler(PlayerOneGives);
            CardHolderPlayer1.Add_EventHandler(PlayerTwoGives);

            for (int i = 0; i < monopolyGame.amountOfPlayers; i++)
            {
                if (i == monopolyGame.currentPlayerID - 1)
                {
                    continue;
                }

                ComboBoxSelectPlayer.Items.Add($"Player {i+1} ({PA3BackEnd.src.Monopoly.MonopolyGame.GetUserTokenName(i+1)})");
            }

            CardHolderPlayer0.ClearDeeds();
            foreach (var prop in monopolyGame.GetPropertiesOwnedByPlayer())
            {
                if (monopolyGame.HasAnyBuildingsOnIt(prop))
                {
                    continue;
                }
                CardHolderPlayer0.Add_Deed(prop);
            }

            CardHolderPlayer1.ClearDeeds();

            ComboBoxSelectPlayer.SelectedIndex = 0;
            textblockmoney.Text = $"${0}";
        }