private void RenameAdmin(UIElement button) { if (GameFacade.EnableMod) { var lotName = new UILotPurchaseDialog(); lotName.OnNameChosen += (name) => { if (CurrentNeigh != null && CurrentNeigh.Value != null) { CurrentNeigh.Value.Neighborhood_Name = name; FindController <NeighPageController>().SaveName(CurrentNeigh.Value); } UIScreen.RemoveDialog(lotName); var terrain = (UIScreen.Current as CoreGameScreen)?.CityRenderer; if (terrain != null) { terrain.NeighGeom.Data[terrain.NeighGeom.ToID((int)CurrentNeigh.Value.Id)].Name = name; } }; if (CurrentNeigh != null && CurrentNeigh.Value != null) { lotName.NameTextEdit.CurrentText = CurrentNeigh.Value.Neighborhood_Name; } UIScreen.GlobalShowDialog(new DialogReference { Dialog = lotName, Controller = this, Modal = true, }); } }
public void PurchaseLot(string name) { //Show waiting dialog UIScreen.RemoveDialog(_LotBuyName); ShowCreationProgressBar(true); PurchaseRegulator.Purchase(new Regulators.PurchaseLotRequest { X = _BuyLot.Lot_Location.Location_X, Y = _BuyLot.Lot_Location.Location_Y, Name = name }); _LotBuyName = null; }
private void BuyPropertyAlert_OnButtonClick(UIElement button) { if (_LotBuyAlert != null) { UIScreen.RemoveDialog(_LotBuyAlert); _LotBuyAlert = null; } //User needs to name the property _LotBuyName = new UILotPurchaseDialog(); UIScreen.GlobalShowDialog(new DialogReference { Dialog = _LotBuyName, Controller = this, Modal = true, }); }
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); } } } }); }