public UIBulletinDialog(uint nhoodID) : base(UIDialogStyle.Close, true) { Board = new UIBulletinBoard(); Board.OnSelection += SelectedPost; Post = new UIBulletinPost(); Post.Opacity = 0; Post.Visible = false; Post.OnBack += Return; DynamicOverlay.Add(Board); DynamicOverlay.Add(Post); CurrentNeigh = new Binding <Neighborhood>() .WithBinding(this, "Caption", "Neighborhood_Name", (name) => { return(GameFacade.Strings.GetString("f120", "1", new string[] { (string)name })); }) .WithBinding(this, "MayorID", "Neighborhood_MayorID"); Caption = GameFacade.Strings.GetString("f120", "1", new string[] { "" }); SetSize(600, 610); var controller = ControllerUtils.BindController <BulletinDialogController>(this); controller.LoadNhood(nhoodID); GlobalInstance = this; }
public override void Removed() { base.Removed(); GlobalInstance = null; }
public UINeighPage() { Add(BackgroundImage = new UIImage()); Add(InfoTabBackgroundImage = new UIImage()); Add(InfoTabImage = new UIImage()); Add(TopSTab2BackgroundImage = new UIImage()); Add(TopSTab3BackgroundImage = new UIImage()); Add(TopSTabImage = new UIImage()); Add(TopSTabTab1BackgroundImage = new UIImage()); Add(TopSTabTab2BackgroundImage = new UIImage()); Add(TopSTabTab3BackgroundImage = new UIImage()); Add(TopSTabTab4BackgroundImage = new UIImage()); Add(TopSTabTab1SeatImage = new UIImage()); Add(TopSTabTab2SeatImage = new UIImage()); Add(TopSTabTab3SeatImage = new UIImage()); Add(TopSTabTab4SeatImage = new UIImage()); Add(MayorTabBackgroundImage = new UIImage()); Add(MayorTabImage = new UIImage()); Add(MayorTabRateImage = new UIImage()); MayorBanner = new UINeighBanner() { ScaleX = 0.3333f, ScaleY = 0.3333f, Caption = GameFacade.Strings.GetString("f115", "72") }; TermBanner = new UINeighBanner() { ScaleX = 0.3333f, ScaleY = 0.3333f, Caption = GameFacade.Strings.GetString("f115", "83", new string[] { GetOrdinal(1) }) }; TownNameBanner = new UINeighBanner() { ScaleX = 0.3333f, ScaleY = 0.3333f, Caption = GameFacade.Strings.GetString("f115", "14") }; MayorRatingBox1 = new UIRatingSummaryPanel(); MayorRatingBox2 = new UIRatingSummaryPanel(); RatingStars = new UIRatingDisplay(false); RatingStars.HalfStars = 7; var script = RenderScript("fsoneighpage.uis"); DescriptionText.OnChange += DescriptionText_OnChange; HouseNameButton.OnButtonClick += RenameAdmin; InfoButton.OnButtonClick += (btn) => SetTab(UINeighPageTab.Description); HouseButton.OnButtonClick += (btn) => SetTab(UINeighPageTab.Lots); PersonButton.OnButtonClick += (btn) => SetTab(UINeighPageTab.People); MayorButton.OnButtonClick += (btn) => SetTab(UINeighPageTab.Mayor); TopTab1Button.OnButtonClick += (btn) => SetSubTab(0); TopTab2Button.OnButtonClick += (btn) => SetSubTab(1); TopTab3Button.OnButtonClick += (btn) => SetSubTab(2); TopTab4Button.OnButtonClick += (btn) => SetSubTab(3); RateButton.OnButtonClick += RateSwitch; UIUtils.MakeDraggable(BackgroundImage, this, true); DescriptionSlider.AttachButtons(DescriptionScrollUpButton, DescriptionScrollDownButton, 1); DescriptionText.AttachSlider(DescriptionSlider); RateButton.Width = 60; LotThumbnail = script.Create <UILotThumbButton>("HouseThumbSetup"); LotThumbnail.Init(RoommateThumbButtonImage, VisitorThumbButtonImage); DefaultThumb = TextureUtils.TextureFromFile(GameFacade.GraphicsDevice, GameFacade.GameFilePath("userdata/houses/defaulthouse.bmp")); TextureUtils.ManualTextureMask(ref DefaultThumb, new uint[] { 0xFF000000 }); LotThumbnail.SetThumbnail(DefaultThumb, 0); LotThumbnail.OnLotClick += (btn) => { FindController <CoreGameScreenController>()?.ShowLotPage(CurrentNeigh.Value?.Neighborhood_TownHallXY ?? 0); }; Add(LotThumbnail); MayorPersonButton = script.Create <UIBigPersonButton>("MayorPersonButton"); Add(MayorPersonButton); Add(RatingStars); Add(MayorBanner); Add(TermBanner); TermBanner.Flip = true; Add(TownNameBanner); Add(MayorRatingBox1); Add(MayorRatingBox2); CurrentNeigh = new Binding <Neighborhood>() .WithBinding(HouseNameButton, "Caption", "Neighborhood_Name") .WithBinding(ResidentCountLabel, "Caption", "Neighborhood_AvatarCount", (object ava) => { return(GameFacade.Strings.GetString("f115", "15", new string[] { ava.ToString() })); }) .WithBinding(PropertyCountLabel, "Caption", "Neighborhood_LotCount", (object lot) => { return(GameFacade.Strings.GetString("f115", "16", new string[] { lot.ToString() })); }) .WithBinding(ActivityRatingLabel, "Caption", "Neighborhood_ActivityRating", (object rate) => { return(GameFacade.Strings.GetString("f115", "13", new string[] { rate.ToString() })); }) .WithBinding(TermBanner, "Caption", "Neighborhood_ElectedDate", (object rate) => { return(GameFacade.Strings.GetString("f115", "83", new string[] { GetOrdinal(GetTermsSince((uint)rate)) })); }) .WithBinding(this, "MayorID", "Neighborhood_MayorID") .WithBinding(this, "TownHallID", "Neighborhood_TownHallXY") .WithBinding(StatusLabel, "Caption", "Neighborhood_Flag", (object flago) => { var flag = (uint)flago; var availableText = "11"; if ((flag & 1) > 0) { availableText = "12"; } return(GameFacade.Strings.GetString("f115", availableText)); }) .WithMultiBinding((changes) => Redraw(), "Neighborhood_Description", "Neighborhood_TownHallXY", "Neighborhood_MayorID", "Neighborhood_TopLotCategory", "Neighborhood_TopLotOverall", "Neighborhood_TopAvatarActivity", "Neighborhood_TopAvatarFamous", "Neighborhood_TopAvatarInfamous"); CurrentMayor = new Binding <Avatar>() .WithBinding(RatingStars, "DisplayStars", "Avatar_MayorRatingHundredth", (object hundredths) => { return(((uint)hundredths) / 100f); }) .WithBinding(this, "Ratings", "Avatar_ReviewIDs"); CurrentTownHall = new Binding <Lot>() .WithBinding(TownNameBanner, "Caption", "Lot_Name", (object name) => { if ((string)name == "Retrieving...") { return(GameFacade.Strings.GetString("f115", "14")); } else { return((string)name); } }); CenterButton.OnButtonClick += (btn) => { (UIScreen.Current as CoreGameScreen).CityRenderer.NeighGeom.CenterNHood((int)(CurrentNeigh.Value?.Id ?? 0)); }; BulletinButton.OnButtonClick += (btn) => { var id = CurrentNeigh?.Value?.Id ?? 0; if (id != 0 && !UIBulletinDialog.Present) { var dialog = new UIBulletinDialog(id); dialog.CloseButton.OnButtonClick += (btn2) => { UIScreen.RemoveDialog(dialog); }; UIScreen.GlobalShowDialog(dialog, false); } }; CloseButton.OnButtonClick += (btn) => { FindController <NeighPageController>().Close(); }; //mayor action buttons: MayorActionMod.OnButtonClick += (btn) => { CurrentMayorTab = UINeighMayorTabMode.ModActions; Redraw(); }; MayorActionReturn.OnButtonClick += (btn) => { CurrentMayorTab = UINeighMayorTabMode.Rate; Redraw(); }; MayorActionMoveTH.OnButtonClick += (btn) => { MoveTownHall(true); }; MayorActionNewTH.OnButtonClick += (btn) => { MoveTownHall(false); }; ModActionSetMayor.OnButtonClick += ModSetMayor; ModActionReturn.OnButtonClick += (btn) => { CurrentMayorTab = UINeighMayorTabMode.Actions; Redraw(); }; ModActionManageRatings.OnButtonClick += (btn) => { var ratingList = new UIRatingList(CurrentMayor.Value?.Avatar_Id ?? 0); UIScreen.GlobalShowAlert(new UIAlertOptions() { Title = GameFacade.Strings.GetString("f118", "23", new string[] { "Retrieving..." }), Message = GameFacade.Strings.GetString("f118", "24", new string[] { "Retrieving..." }), GenericAddition = ratingList, Width = 530 }, true); }; foreach (var elem in Children) { var label = elem as UILabel; if (label != null) { label.CaptionStyle = label.CaptionStyle.Clone(); label.CaptionStyle.Shadow = true; } } Pedestals = new List <UITop10Pedestal>(); Top10Labels = new List <UILabel>(); var top10style = TextStyle.DefaultLabel.Clone(); top10style.Shadow = true; top10style.Size = 8; for (int i = 0; i < 10; i++) { var alt = i % 2 == 1; var ped = new UITop10Pedestal() { AltColor = alt }; Pedestals.Add(ped); var label = new UILabel() { CaptionStyle = top10style, Alignment = TextAlignment.Center | TextAlignment.Middle, Size = new Vector2(1, 1) }; Top10Labels.Add(label); Add(label); } for (int i = 0; i < 10; i += 2) { Add(Pedestals[i]); //backmost } for (int i = 1; i < 10; i += 2) { Add(Pedestals[i]); //frontmost } SetPedestalPosition(false, true); Redraw(); }