コード例 #1
0
 public void MoveLot(bool freshStart)
 {
     UIScreen.RemoveDialog(_LotBuyAlert);
     _LotBuyAlert = null;
     PurchaseRegulator.Purchase(new Regulators.PurchaseLotRequest
     {
         X          = _BuyLot.Lot_Location.Location_X,
         Y          = _BuyLot.Lot_Location.Location_Y,
         Name       = "",
         StartFresh = freshStart
     });
 }
コード例 #2
0
        public void ClickLot(int x, int y)
        {
            var id       = MapCoordinates.Pack((ushort)x, (ushort)y);
            var occupied = IsTileOccupied(x, y);

            DataService.Get <Lot>(id).ContinueWith(result =>
            {
                if (occupied)
                {
                    GameThread.InUpdate(() =>
                    {
                        if (PlacingTownHall)
                        {
                            UIAlert.Alert("", GameFacade.Strings.GetString("f115", "51"), true);
                        }
                        else
                        {
                            Parent.ShowLotPage(id);
                        }
                    });
                }
                else if (!Realestate.IsPurchasable((ushort)x, (ushort)y))
                {
                    return;
                }
                else if (PlacingTownHall && View.NeighGeom.NhoodNearestDB(x, y) != TownHallNhood)
                {
                    UIAlert.Alert("", GameFacade.Strings.GetString("f115", "50", new string[] { TownHallNhoodName }), true);
                    return;
                }
                else
                {
                    if (PlacingTownHall)
                    {
                        //we don't particularly care about the price,
                        //all we need to know is if it is in the correct nhood

                        var ourCash = Parent.Screen.VisualBudget;
                        _BuyLot     = result.Result;

                        if (ourCash < 2000)
                        {
                            UIAlert.Alert("", GameFacade.Strings.GetString("f115", "90"), true);
                        }
                        else
                        {
                            UIAlert.YesNo("", GameFacade.Strings.GetString("f115", "49"), true,
                                          (complete) =>
                            {
                                if (complete)
                                {
                                    if (!TownHallMove)
                                    {
                                        //User needs to name the property
                                        _LotBuyName = new UILotPurchaseDialog();
                                        UIScreen.GlobalShowDialog(new DialogReference
                                        {
                                            Dialog     = _LotBuyName,
                                            Controller = this,
                                            Modal      = true,
                                        });
                                    }
                                    else
                                    {
                                        PurchaseRegulator.Purchase(new Regulators.PurchaseLotRequest
                                        {
                                            X          = _BuyLot.Lot_Location.Location_X,
                                            Y          = _BuyLot.Lot_Location.Location_Y,
                                            Name       = "",
                                            StartFresh = false,
                                            Mayor      = true
                                        });
                                    }
                                }
                            });
                        }
                    }
                    else
                    {
                        if (result.Result.Lot_Price == 0)
                        {
                            //We need to request the price
                            DataService.Request(MaskedStruct.MapView_RollOverInfo_Lot_Price, id).ContinueWith(masked =>
                            {
                                ShowLotBuyDialog((Lot)masked.Result);
                            });
                        }
                        else
                        {
                            //Good to show dialog
                            ShowLotBuyDialog(result.Result);
                        }
                    }
                }
            });
        }