public UIQueryPanel(LotView.World world) { World = world; Active = false; Opacity = 0; Visible = false; AdStrings = new string[14]; for (int i = 0; i < 14; i++) { string str = GameFacade.Strings.GetString("206", (i + 4).ToString()); AdStrings[i] = ((i < 7)?str.Substring(0, str.Length - 2) + "{0}":str) + "\r\n"; } var useSmall = (GlobalSettings.Default.GraphicsWidth < 1024) || FSOEnvironment.UIZoomFactor > 1f; var script = this.RenderScript("querypanel" + (useSmall?"":"1024") + ".uis"); //NOTE: the background and position of this element changes with the context it is used in. //other elements that are only used for certain modes will be flagged as such with comments. QuerybackPanel = new UIImage(BackgroundImagePanel); QuerybackPanel.Y = 0; QuerybackPanel.BlockInput(); this.AddAt(0, QuerybackPanel); QuerybackCatalog = new UIImage(BackgroundImageCatalog); QuerybackCatalog.Position = new Vector2(-22, 0); QuerybackCatalog.BlockInput(); this.AddAt(1, QuerybackCatalog); QuerybackTrade = new UIImage(BackgroundImageTrade); QuerybackTrade.Y = 0; QuerybackTrade.BlockInput(); this.AddAt(2, QuerybackTrade); //init general tab specific backgrounds DescriptionBackgroundImage = new UIImage(ImageDescriptionBackground); DescriptionBackgroundImage.Position = new Microsoft.Xna.Framework.Vector2(119, 7); this.AddAt(3, DescriptionBackgroundImage); MotivesBackgroundImage = new UIImage(ImageMotivesBackground); MotivesBackgroundImage.Position = new Microsoft.Xna.Framework.Vector2(useSmall ? 395:619, 7); this.AddAt(3, MotivesBackgroundImage); GeneralTabImage = new UIImage(ImageGeneralTab); GeneralTabImage.Position = new Microsoft.Xna.Framework.Vector2(useSmall ? 563 : 787, 0); this.AddAt(3, GeneralTabImage); SpecificTabImage = new UIImage(ImageSpecificTab); SpecificTabImage.Position = new Microsoft.Xna.Framework.Vector2(useSmall ? 563 : 787, 0); this.AddAt(3, SpecificTabImage); OwnerPriceBack = new UIImage(GeneralOwnerPriceBack); OwnerPriceBack.Position = new Microsoft.Xna.Framework.Vector2(useSmall ? 501 : 725, 80); this.AddAt(3, OwnerPriceBack); Thumbnail = new UIImage(); Thumbnail.Position = new Vector2(24, 11); Thumbnail.SetSize(90, 90); this.Add(Thumbnail); DescriptionText.CurrentText = "No Object Selected"; //user should not see this. DescriptionSlider.AttachButtons(DescriptionScrollUpButton, DescriptionScrollDownButton, 1); DescriptionText.AttachSlider(DescriptionSlider); MotivesText.CurrentText = ""; MotivesSlider.AttachButtons(MotivesScrollUpButton, MotivesScrollDownButton, 1); MotivesText.AttachSlider(MotivesSlider); GeneralTabButton.OnButtonClick += new ButtonClickDelegate(GeneralTabButton_OnButtonClick); SpecificTabButton.OnButtonClick += new ButtonClickDelegate(SpecificTabButton_OnButtonClick); SellBackButton.OnButtonClick += new ButtonClickDelegate(SellBackButton_OnButtonClick); Mode = 1; Tab = 0; }
public PersonSelectionEdit() : base() { /** * Data */ var content = Content.GameContent.Get; MaleHeads = content.AvatarCollections.Get("ea_male_heads.col"); MaleOutfits = content.AvatarCollections.Get("ea_male.col"); FemaleHeads = content.AvatarCollections.Get("ea_female_heads.col"); FemaleOutfits = content.AvatarCollections.Get("ea_female.col"); /** * UI */ UIScript ui = RenderScript("personselectionedit1024.uis"); Position = new Vector2((GlobalSettings.Default.GraphicsWidth - 1024) / 2, (GlobalSettings.Default.GraphicsHeight - 768) / 2) * FSOEnvironment.DPIScaleFactor; m_ExitButton = (UIButton)ui["ExitButton"]; m_ExitButton.OnButtonClick += new ButtonClickDelegate(m_ExitButton_OnButtonClick); CancelButton = (UIButton)ui["CancelButton"]; CancelButton.OnButtonClick += new ButtonClickDelegate(CancelButton_OnButtonClick); //CancelButton.Disabled = true; DescriptionTextEdit.CurrentText = ui.GetString("DefaultAvatarDescription"); DescriptionSlider.AttachButtons(DescriptionScrollUpButton, DescriptionScrollDownButton, 1); DescriptionTextEdit.AttachSlider(DescriptionSlider); DescriptionTextEdit.CurrentText = DefaultAvatarDescription; DescriptionTextEdit.OnChange += DescriptionTextEdit_OnChange; NameTextEdit.OnChange += new ChangeDelegate(NameTextEdit_OnChange); NameTextEdit.CurrentText = GlobalSettings.Default.LastUser; AcceptButton.Disabled = NameTextEdit.CurrentText.Length == 0; AcceptButton.OnButtonClick += new ButtonClickDelegate(AcceptButton_OnButtonClick); /** Appearance **/ SkinLightButton.OnButtonClick += new ButtonClickDelegate(SkinButton_OnButtonClick); SkinMediumButton.OnButtonClick += new ButtonClickDelegate(SkinButton_OnButtonClick); SkinDarkButton.OnButtonClick += new ButtonClickDelegate(SkinButton_OnButtonClick); SelectedAppearanceButton = SkinLightButton; m_HeadSkinBrowser = ui.Create <UICollectionViewer>("HeadSkinBrowser"); m_HeadSkinBrowser.OnChange += new ChangeDelegate(HeadSkinBrowser_OnChange); m_HeadSkinBrowser.Init(); Add(m_HeadSkinBrowser); m_BodySkinBrowser = ui.Create <UICollectionViewer>("BodySkinBrowser"); m_BodySkinBrowser.OnChange += new ChangeDelegate(BodySkinBrowser_OnChange); m_BodySkinBrowser.Init(); Add(m_BodySkinBrowser); FemaleButton.OnButtonClick += new ButtonClickDelegate(GenderButton_OnButtonClick); MaleButton.OnButtonClick += new ButtonClickDelegate(GenderButton_OnButtonClick); /** Backgrounds **/ var bg = new UIImage(BackgroundImage).With9Slice(128, 128, 84, 84); AddAt(0, bg); bg.SetSize(GlobalSettings.Default.GraphicsWidth, GlobalSettings.Default.GraphicsHeight); bg.Position = new Vector2((GlobalSettings.Default.GraphicsWidth - 1024) / -2, (GlobalSettings.Default.GraphicsHeight - 768) / -2); Background = bg; var offset = new Vector2(0, 0); if (BackgroundImageDialog != null) { offset = new Vector2(112, 84); AddAt(1, new UIImage(BackgroundImageDialog) { X = 112, Y = 84 }); } /** * Music */ HIT.HITVM.Get.PlaySoundEvent(UIMusic.CAS); SimBox = new UISim { Position = new Vector2(offset.X + 70, offset.Y + 88), Size = new Vector2(140, 200), AutoRotate = true }; Add(SimBox); /** * Init state */ if (GlobalSettings.Default.DebugGender) { Gender = Gender.Male; MaleButton.Selected = true; FemaleButton.Selected = false; } else { Gender = Gender.Female; MaleButton.Selected = false; FemaleButton.Selected = true; } AppearanceType = (AppearanceType)GlobalSettings.Default.DebugSkin; SkinLightButton.Selected = false; SkinMediumButton.Selected = false; SkinDarkButton.Selected = false; switch (AppearanceType) { case AppearanceType.Light: SkinLightButton.Selected = true; break; case AppearanceType.Medium: SkinMediumButton.Selected = true; break; case AppearanceType.Dark: SkinDarkButton.Selected = true; break; } RefreshCollections(); SearchCollectionForInitID(GlobalSettings.Default.DebugHead, GlobalSettings.Default.DebugBody); FSO.UI.Model.DiscordRpcEngine.SendFSOPresence("In Create A Sim"); GameThread.NextUpdate(x => { FSOFacade.Hints.TriggerHint("screen:cas"); }); }
public UIQueryPanel(LotView.World world) { World = world; Active = false; Opacity = 0; Visible = false; AdStrings = new string[14]; for (int i = 0; i < 14; i++) { string str = GameFacade.Strings.GetString("206", (i + 4).ToString()); AdStrings[i] = ((i < 7)?str.Substring(0, str.Length - 2) + "{0}":str) + "\r\n"; } var useSmall = (GlobalSettings.Default.GraphicsWidth < 1024) || FSOEnvironment.UIZoomFactor > 1f; var script = this.RenderScript("querypanel" + (useSmall?"":"1024") + ".uis"); //NOTE: the background and position of this element changes with the context it is used in. //other elements that are only used for certain modes will be flagged as such with comments. QuerybackPanel = new UIImage(BackgroundImagePanel); QuerybackPanel.Y = 0; this.AddAt(0, QuerybackPanel); ListenForMouse(new Rectangle(0, 0, QuerybackPanel.Texture.Width, QuerybackPanel.Texture.Height), (t, s) => { }); Size = QuerybackPanel.Size.ToVector2() + new Vector2(22, 42); BackOffset = new Point(40, 0); QuerybackCatalog = new UIImage(BackgroundImageCatalog); QuerybackCatalog.Position = new Vector2(-22, 0); this.AddAt(1, QuerybackCatalog); QuerybackTrade = new UIImage(BackgroundImageTrade); QuerybackTrade.X = -40; QuerybackTrade.Y = 0; this.AddAt(2, QuerybackTrade); //init general tab specific backgrounds DescriptionBackgroundImage = new UIImage(ImageDescriptionBackground); DescriptionBackgroundImage.Position = new Microsoft.Xna.Framework.Vector2(119, 7); this.AddAt(3, DescriptionBackgroundImage); MotivesBackgroundImage = new UIImage(ImageMotivesBackground); MotivesBackgroundImage.Position = new Microsoft.Xna.Framework.Vector2(useSmall ? 395:619, 7); this.AddAt(3, MotivesBackgroundImage); GeneralTabImage = new UIImage(ImageGeneralTab); GeneralTabImage.Position = new Microsoft.Xna.Framework.Vector2(useSmall ? 563 : 787, 0); this.AddAt(3, GeneralTabImage); SpecificTabImage = new UIImage(ImageSpecificTab); SpecificTabImage.Position = new Microsoft.Xna.Framework.Vector2(useSmall ? 563 : 787, 0); this.AddAt(3, SpecificTabImage); OwnerPriceBack = script.Create <UIImage>("OwnerPriceBack"); this.AddAt(3, OwnerPriceBack); BuyerPriceBack = script.Create <UIImage>("BuyerPriceBack"); this.AddAt(3, BuyerPriceBack); OwnerPriceBack.X = ForSalePrice.X; BuyerPriceBack.X = ForSalePrice.X; ForSalePrice.Y += 2; ForSalePrice.SetSize(OwnerPriceBack.Width, ForSalePrice.Height); Thumbnail = new UIImage(); Thumbnail.Position = new Vector2(24, 11); Thumbnail.SetSize(90, 90); this.Add(Thumbnail); DescriptionText.CurrentText = "No Object Selected"; //user should not see this. DescriptionSlider.AttachButtons(DescriptionScrollUpButton, DescriptionScrollDownButton, 1); DescriptionText.AttachSlider(DescriptionSlider); MotivesText.CurrentText = ""; MotivesSlider.AttachButtons(MotivesScrollUpButton, MotivesScrollDownButton, 1); MotivesText.AttachSlider(MotivesSlider); GeneralTabButton.OnButtonClick += new ButtonClickDelegate(GeneralTabButton_OnButtonClick); SpecificTabButton.OnButtonClick += new ButtonClickDelegate(SpecificTabButton_OnButtonClick); SellBackButton.OnButtonClick += new ButtonClickDelegate(SellBackButton_OnButtonClick); AsyncBuyButton.OnButtonClick += (btn) => { OnAsyncBuyClicked?.Invoke(btn); }; AsyncSaleButton.OnButtonClick += (btn) => { OnAsyncSaleClicked?.Invoke(btn); }; AsyncEditPriceButton.OnButtonClick += (btn) => { OnAsyncPriceClicked?.Invoke(btn); }; AsyncCancelSaleButton.OnButtonClick += (btn) => { OnAsyncSaleCancelClicked?.Invoke(btn); }; InventoryButton.OnButtonClick += InventoryButton_OnButtonClick; WearProgressBar.CaptionStyle = TextStyle.DefaultLabel.Clone(); WearProgressBar.CaptionStyle.Shadow = true; var btnBg = GetTexture(0x8A700000001); //buybuild_query_generalbuy_sellasyncback = 0x8A700000001 SpecificBtnBGs = new List <UIImage>(); SpecificBtnBGs.Add(AddButtonBackground(SellBackButton, btnBg)); SpecificBtnBGs.Add(AddButtonBackground(InventoryButton, btnBg)); SpecificBtnBGs.Add(AddButtonBackground(AsyncSaleButton, btnBg)); AsyncCancelSaleButtonBG = AddButtonBackground(AsyncCancelSaleButton, btnBg); var progressBG = new UIImage(ImageWearBack); progressBG.Position = WearProgressBar.Position - new Vector2(3, 2); AddAt(3, progressBG); SpecificBtnBGs.Add(progressBG); Mode = 1; Tab = 0; }
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(); }