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 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; }