示例#1
0
 private void ShowBuyQuery(PropertyListing property)
 {
     if (this.Dispatcher.CheckAccess())
     {
         myBoard.Dice.ToggleEndTurnEnabled(true);
         if (property.IsOwned)
         {
             string msg = localPlayer.PlayerGUID + Message.DELIMETER + property.Owner + Message.DELIMETER + property.CalculateRent();
             comm.Send(new Message(Message.Type.Rent, Encoding.UTF8.GetBytes(msg)).ToBytes());
             PayRent(localPlayer.PlayerGUID, property.Owner, property.CalculateRent());
             return;
         }
         if (property.Cost > localPlayer.Money)
         {
             MessageBox.Show("You cannot afford this property");
             return;
         }
         if (property.Cost == 0)
         {
             return;
         }
         BuyQuery bq = new BuyQuery(this, property);
         bq.Result += new EventHandler <BuyPropertyEventArgs>(bq_Result);
         bq.ShowDialog();
     }
     else
     {
         this.Dispatcher.BeginInvoke(new Action <PropertyListing>(ShowBuyQuery), new object[] { property });
     }
 }
示例#2
0
        public Property(int loc, PropertyListing property)
        {
            this.property = property;
            InitializeComponent();
            switch (loc)
            {
            case (int)Side.TOP:
                TopLayout();
                break;

            case (int)Side.RIGHT:
                RightLayout();
                break;

            case (int)Side.LEFT:
                LeftLayout();
                break;

            case (int)Side.BOTTOM:
                BottomLayout();
                break;

            default:
                break;
            }
            myGrid.Children.Add(mGrid);
        }
        private void MakeProperty(PropertyListing p)
        {
            if (Dispatcher.CheckAccess())
            {
                bool     special = p.ImageLocation == null;
                Property pr      = new Property((int)p.Side, p);
                switch (p.Side)
                {
                case Property.Side.TOP:
                    Grid.SetColumn(pr, p.Location % 10);
                    Grid.SetRow(pr, (int)Side.TOP);
                    break;

                case Property.Side.RIGHT:
                    Grid.SetColumn(pr, (int)Side.RIGHT);
                    Grid.SetRow(pr, p.Location % 10);
                    break;

                case Property.Side.BOTTOM:
                    Grid.SetColumn(pr, 10 - p.Location % 10);
                    Grid.SetRow(pr, (int)Side.BOTTOM);
                    break;

                case Property.Side.LEFT:
                    Grid.SetColumn(pr, (int)Side.LEFT);
                    Grid.SetRow(pr, 10 - p.Location % 10);
                    break;
                }
                myBoard.Children.Add(pr);
            }
            else
            {
                Dispatcher.BeginInvoke(new Action <PropertyListing>(MakeProperty), new object[] { p });
            }
        }
示例#4
0
 public BuyQuery(Window owner, PropertyListing property)
 {
     InitializeComponent();
     index = property.Location;
     this.Owner = owner;
     PropertyName.Text = property.Name;
     TitleBorder.Background = property.ColorGroup;
     Rent.Text = "$" + property.CalculateRent();
     Rent1.Text = property.House1 == 0 ? "N/A" : "$" + property.House1;
     Rent2.Text = property.House2 == 0 ? "N/A" : "$" + property.House2;
     Rent3.Text = property.House3 == 0 ? "N/A" : "$" + property.House3;
     Rent4.Text = property.House4 == 0 ? "N/A" : "$" + property.House4;
     RentH.Text = property.Hotel == 0 ? "N/A" : "$" + property.Hotel;
     CostH.Text = property.HouseCost == 0 ? "N/A" : "$" + property.HouseCost;
     CostHo.Text = property.HouseCost == 0 ? "N/A" : "$" + property.HouseCost;
     Mortgage.Text = property.Mortgage == 0 ? "N/A" : "$" + property.Mortgage;
     PurchaseText.Text = "Would you like to purchase " + property.Name + " for $" + property.Cost + "?";
 }
 public BuyQuery(Window owner, PropertyListing property)
 {
     InitializeComponent();
     index                  = property.Location;
     this.Owner             = owner;
     PropertyName.Text      = property.Name;
     TitleBorder.Background = property.ColorGroup;
     Rent.Text              = "$" + property.CalculateRent();
     Rent1.Text             = property.House1 == 0 ? "N/A" : "$" + property.House1;
     Rent2.Text             = property.House2 == 0 ? "N/A" : "$" + property.House2;
     Rent3.Text             = property.House3 == 0 ? "N/A" : "$" + property.House3;
     Rent4.Text             = property.House4 == 0 ? "N/A" : "$" + property.House4;
     RentH.Text             = property.Hotel == 0 ? "N/A" : "$" + property.Hotel;
     CostH.Text             = property.HouseCost == 0 ? "N/A" : "$" + property.HouseCost;
     CostHo.Text            = property.HouseCost == 0 ? "N/A" : "$" + property.HouseCost;
     Mortgage.Text          = property.Mortgage == 0 ? "N/A" : "$" + property.Mortgage;
     PurchaseText.Text      = "Would you like to purchase " + property.Name + " for $" + property.Cost + "?";
 }
示例#6
0
 public Property(int loc, PropertyListing property)
 {
     this.property = property;
     InitializeComponent();
     switch (loc)
     {
         case (int)Side.TOP:
             TopLayout();
             break;
         case (int)Side.RIGHT:
             RightLayout();
             break;
         case (int)Side.LEFT:
             LeftLayout();
             break;
         case (int)Side.BOTTOM:
             BottomLayout();
             break;
         default :
             break;
     }
     myGrid.Children.Add(mGrid);
 }
示例#7
0
 public void AddProperty(int key, PropertyListing value)
 {
     _Properties.Add(key, value);
     OnPlayerUpdate(new PlayerUpdateEventArgs());
 }
 private void ShowBuyQuery(PropertyListing property)
 {
     if (this.Dispatcher.CheckAccess())
     {
         myBoard.Dice.ToggleEndTurnEnabled(true);
         if (property.IsOwned)
         {
             string msg = localPlayer.PlayerGUID + Message.DELIMETER + property.Owner + Message.DELIMETER + property.CalculateRent();
             comm.Send(new Message(Message.Type.Rent, Encoding.UTF8.GetBytes(msg)).ToBytes());
             PayRent(localPlayer.PlayerGUID, property.Owner, property.CalculateRent());
             return;
         }
         if (property.Cost > localPlayer.Money)
         {
             MessageBox.Show("You cannot afford this property");
             return;
         }
         if(property.Cost == 0)
         {
             return;
         }
         BuyQuery bq = new BuyQuery(this, property);
         bq.Result += new EventHandler<BuyPropertyEventArgs>(bq_Result);
         bq.ShowDialog();
     }
     else this.Dispatcher.BeginInvoke(new Action<PropertyListing>(ShowBuyQuery), new object[] { property });
 }
 private void MakeProperty(PropertyListing p)
 {
     if (Dispatcher.CheckAccess())
     {
         bool special = p.ImageLocation == null;
         Property pr = new Property((int)p.Side, p);
         switch (p.Side)
         {
             case Property.Side.TOP:
                 Grid.SetColumn(pr, p.Location % 10);
                 Grid.SetRow(pr, (int)Side.TOP);
                 break;
             case Property.Side.RIGHT:
                 Grid.SetColumn(pr, (int)Side.RIGHT);
                 Grid.SetRow(pr, p.Location % 10);
                 break;
             case Property.Side.BOTTOM:
                 Grid.SetColumn(pr, 10 - p.Location % 10);
                 Grid.SetRow(pr, (int)Side.BOTTOM);
                 break;
             case Property.Side.LEFT:
                 Grid.SetColumn(pr, (int)Side.LEFT);
                 Grid.SetRow(pr, 10 - p.Location % 10);
                 break;
         }
         myBoard.Children.Add(pr);
     }
     else Dispatcher.BeginInvoke(new Action<PropertyListing>(MakeProperty), new object[] { p });
 }