示例#1
0
        public UIGridViewerRender(UIGridViewer owner)
        {
            this.owner = owner;

            button                = new UIButton(owner.ThumbButtonImage);
            button.Size           = owner.ThumbSize;
            button.OnButtonClick += new ButtonClickDelegate(button_OnButtonClick);
            this.Add(button);

            image = new UIImage();
            //image.ScaleX = owner.ThumbImageSize.X / (owner.ThumbSize.X - (owner.ThumbImageOffsets.X * 2));
            image.SetSize(owner.ThumbSize.X - (owner.ThumbImageOffsets.X * 2),
                          owner.ThumbSize.Y - (owner.ThumbImageOffsets.Y * 2));
            image.Position = owner.ThumbImageOffsets;
            this.Add(image);
        }
        public UIGridViewerRender(UIGridViewer owner)
        {
            this.owner = owner;

            button = new UIButton(owner.ThumbButtonImage);
            button.Size = owner.ThumbSize;
            button.OnButtonClick += new ButtonClickDelegate(button_OnButtonClick);
            this.Add(button);

            image = new UIImage();
            //image.ScaleX = owner.ThumbImageSize.X / (owner.ThumbSize.X - (owner.ThumbImageOffsets.X * 2));
            image.SetSize(owner.ThumbSize.X - (owner.ThumbImageOffsets.X * 2),
                          owner.ThumbSize.Y - (owner.ThumbImageOffsets.Y * 2));
            image.Position = owner.ThumbImageOffsets;
            this.Add(image);
        }
        public UILoginProgress()
            : base(UIDialogStyle.Standard, false)
        {
            this.SetSize(400, 180);
            this.Caption = GameFacade.Strings.GetString("210", "1");

            /**
             * Label background
             */
            var bgImg = new UIImage(UITextBox.StandardBackground)
            {
                X = 20,
                Y = 120
            };
            bgImg.SetSize(360, 27);
            this.Add(bgImg);

            m_ProgressBar = new UIProgressBar() {
                X = 20,
                Y = 66,
                Value = 0
            };
            m_ProgressBar.SetSize(360, 27);
            this.Add(m_ProgressBar);

            this.Add(new UILabel
            {
                Caption = GameFacade.Strings.GetString("210", "2"),
                X = 20,
                Y = 44
            });

            this.Add(new UILabel
            {
                Caption = GameFacade.Strings.GetString("210", "3"),
                X = 20,
                Y = 97
            });

            m_ProgressLabel = new UILabel{
                Caption = GameFacade.Strings.GetString("210", "4"),
                X = 31,
                Y = 122
            };
            this.Add(m_ProgressLabel);
        }
示例#4
0
        public UIAlert(UIAlertOptions options)
            : base(UIDialogStyle.Standard, true)
        {
            this.m_Options = options;
            this.Caption = options.Title;
            this.Opacity = 0.9f;

            m_TextStyle = TextStyle.DefaultLabel.Clone();
            m_TextStyle.Size = options.TextSize;

            Icon = new UIImage();
            Icon.Position = new Vector2(32, 32);
            Icon.SetSize(0, 0);
            Add(Icon);

            /** Determine the size **/
            ComputeText();

            /** Add buttons **/
            Buttons = new List<UIButton>();
            if (options.Buttons == UIAlertButtons.OK)
                Buttons.Add(AddButton(GameFacade.Strings.GetString("142", "ok button"), UIAlertButtons.OK, true));
            else if (options.Buttons == UIAlertButtons.OKCancel)
            {
                Buttons.Add(AddButton(GameFacade.Strings.GetString("142", "ok button"), UIAlertButtons.OK, false));
                Buttons.Add(AddButton(GameFacade.Strings.GetString("142", "cancel button"), UIAlertButtons.Cancel, true));
            }
            else if (options.Buttons == UIAlertButtons.Yes)
                Buttons.Add(AddButton(GameFacade.Strings.GetString("142", "yes button"), UIAlertButtons.Yes, true));
            else if(options.Buttons == UIAlertButtons.No)
                Buttons.Add(AddButton(GameFacade.Strings.GetString("142", "no button"), UIAlertButtons.No, true));
            else if(options.Buttons == UIAlertButtons.YesNo)
            {
                Buttons.Add(AddButton(GameFacade.Strings.GetString("142", "yes button"), UIAlertButtons.Yes, false));
                Buttons.Add(AddButton(GameFacade.Strings.GetString("142", "no button"), UIAlertButtons.No, true));
            }

            /** Position buttons **/
            RefreshSize();
        }
示例#5
0
 /// <summary>
 /// Set the size of the dialog
 /// </summary>
 /// <param name="width"></param>
 /// <param name="height"></param>
 public void SetSize(int width, int height)
 {
     Background.SetSize(width, height);
     m_Bounds = new Rectangle(0, 0, width, height);
 }
        public DebugTypeFaceScreen()
        {
            var msg = "The quick brown fox jumps over the lazy dog";
            var sizes = new int[] { 10, 12, 14, 16, 20 };

            this.Add(new UILabel()
            {
                X = 10.0f,
                Y = 30.0f,
                Caption = "Metric calculation test: Green bar is Y 0, Red bar is calculated baseline"
            });

            var greenTexture = TextureUtils.TextureFromColor(GameFacade.GraphicsDevice, Color.Green);
            var redTexture = TextureUtils.TextureFromColor(GameFacade.GraphicsDevice, Color.Red);
            var grayTexture = TextureUtils.TextureFromColor(GameFacade.GraphicsDevice, Color.Gray);

            var yPosition = 100.0f;
            for (var i = 0; i < sizes.Length; i++)
            {
                var pxSize = sizes[i];

                var label = new UILabel();
                label.Caption = msg;
                label.CaptionStyle = TextStyle.DefaultLabel.Clone();
                label.CaptionStyle.Size = pxSize;

                label.X = 10;
                label.Y = yPosition;

                /** Origin line **/
                var origLine = new UIImage(greenTexture);
                origLine.SetSize(800.0f, 1.0f);
                origLine.X = 10;
                origLine.Y = yPosition;
                this.Add(origLine);

                var baseLine = new UIImage(redTexture);
                baseLine.SetSize(800.0f, 1.0f);
                baseLine.X = 10;
                baseLine.Y = yPosition + label.CaptionStyle.BaselineOffset;
                this.Add(baseLine);

                yPosition += (float)Math.Round(label.CaptionStyle.MeasureString(msg).Y);
                yPosition += 20.0f;
                this.Add(label);
            }

            this.Add(new UILabel()
            {
                X = 10.0f,
                Y = yPosition + 30.0f,
                Caption = "Alignment calculation test"
            });

            var alignments = new TextAlignment[]{
                TextAlignment.Center,
                TextAlignment.Right,
                TextAlignment.Middle,
                TextAlignment.Middle | TextAlignment.Center,
                TextAlignment.Middle | TextAlignment.Right
            };

            yPosition += 60.0f;
            sizes = new int[] { 10 };

            for (var i = 0; i < sizes.Length; i++)
            {
                var pxSize = sizes[i];

                foreach (var align in alignments)
                {
                    var label = new UILabel();
                    label.Caption = msg;
                    label.CaptionStyle = TextStyle.DefaultLabel.Clone();
                    label.CaptionStyle.Size = pxSize;
                    label.Size = new Vector2(800.0f, 50.0f);
                    label.Alignment = align;

                    label.X = 10;
                    label.Y = yPosition;

                    var area = new UIImage(grayTexture);
                    area.SetSize(800.0f, 50.0f);
                    area.X = 10;
                    area.Y = yPosition;
                    this.Add(area);

                    ///** Origin line **/
                    //var origLine = new UIImage(greenTexture);
                    //origLine.SetSize(800.0f, 1.0f);
                    //origLine.X = 10;
                    //origLine.Y = yPosition;
                    //this.Add(origLine);

                    //var baseLine = new UIImage(redTexture);
                    //baseLine.SetSize(800.0f, 1.0f);
                    //baseLine.X = 10;
                    //baseLine.Y = yPosition + label.CaptionStyle.BaselineOffset;
                    //this.Add(baseLine);

                    yPosition += 50.0f;//(float)Math.Round(label.CaptionStyle.MeasureString(msg).Y);
                    yPosition += 20.0f;
                    this.Add(label);
                }
            }
        }
        /// <summary>
        /// Setup UI events
        /// </summary>
        public void Init()
        {
            /** Textures **/
            AvatarButton.Texture = Screen.SimCreateButtonImage;
            CityButton.Texture = Screen.CityButtonTemplateImage;
            HouseButton.Texture = Screen.HouseButtonTemplateImage;

            /** Send tab stuff to the bottom **/
            Screen.SendToBack(TabBackground, TabEnterBackground, TabDescBackground);

            /** Events **/
            EnterTabButton.OnButtonClick += new ButtonClickDelegate(EnterTabButton_OnButtonClick);
            DescTabButton.OnButtonClick += new ButtonClickDelegate(DescTabButton_OnButtonClick);

            NewAvatarButton.OnButtonClick += new ButtonClickDelegate(NewAvatarButton_OnButtonClick);

            PersonDescriptionSlider.AttachButtons(PersonDescriptionScrollUpButton, PersonDescriptionScrollDownButton, 1);
            PersonDescriptionText.AttachSlider(PersonDescriptionSlider);

            CityThumb = new UIImage {
                X = CityButton.X + 6,
                Y = CityButton.Y + 6
            };
            CityThumb.SetSize(78, 58);
            Screen.Add(CityThumb);

            SetTab(PersonSlotTab.EnterTab);
        }
示例#8
0
        public UIPieMenu(List<VMPieMenuInteraction> pie, VMEntity obj, VMEntity caller, UILotControl parent)
        {
            m_PieButtons = new List<UIButton>();
            this.m_Obj = obj;
            this.m_Caller = caller;
            this.m_Parent = parent;
            this.ButtonStyle = new TextStyle
            {
                Font = GameFacade.MainFont,
                Size = 12,
                Color = new Color(0xA5, 0xC3, 0xD6),
                SelectedColor = new Color(0x00, 0xFF, 0xFF),
                CursorColor = new Color(255, 255, 255)
            };

            m_Bg = new UIImage(TextureGenerator.GetPieBG(GameFacade.GraphicsDevice));
            m_Bg.SetSize(0, 0); //is scaled up later
            this.AddAt(0, m_Bg);

            m_PieTree = new UIPieMenuItem()
            {
                Category = true
            };

            for (int i = 0; i < pie.Count; i++)
            {
                string[] depth = pie[i].Name.Split('/');

                var category = m_PieTree; //set category to root
                for (int j = 0; j < depth.Length-1; j++) //iterate through categories
                {
                    if (category.Children.ContainsKey(depth[j]))
                    {
                        category = category.Children[depth[j]];
                    }
                    else
                    {
                        var newCat = new UIPieMenuItem()
                        {
                            Category = true,
                            Name = depth[j],
                            Parent = category
                        };
                        category.Children.Add(depth[j], newCat);
                        category = newCat;
                    }
                }
                //we are in the category, put the interaction in here;

                var item = new UIPieMenuItem()
                {
                    Category = false,
                    Name = depth[depth.Length-1],
                    ID = pie[i].ID
                };
                if (!category.Children.ContainsKey(item.Name)) category.Children.Add(item.Name, item);
            }

            m_CurrentItem = m_PieTree;
            m_PieButtons = new List<UIButton>();
            RenderMenu();

            VMAvatar Avatar = (VMAvatar)caller;
            m_Head = new SimAvatar(Avatar.Avatar); //talk about confusing...
            m_Head.StripAllButHead();

            initSimHead();
        }
        public UIQueryPanel(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 script = this.RenderScript("querypanel"+((GlobalSettings.Default.GraphicsWidth < 1024)?"":"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((GlobalSettings.Default.GraphicsWidth < 1024)?395:619, 7);
            this.AddAt(3, MotivesBackgroundImage);

            GeneralTabImage = new UIImage(ImageGeneralTab);
            GeneralTabImage.Position = new Microsoft.Xna.Framework.Vector2((GlobalSettings.Default.GraphicsWidth < 1024) ? 563 : 787, 0);
            this.AddAt(3, GeneralTabImage);

            SpecificTabImage = new UIImage(ImageSpecificTab);
            SpecificTabImage.Position = new Microsoft.Xna.Framework.Vector2((GlobalSettings.Default.GraphicsWidth < 1024) ? 563 : 787, 0);
            this.AddAt(3, SpecificTabImage);

            OwnerPriceBack = new UIImage(GeneralOwnerPriceBack);
            OwnerPriceBack.Position = new Microsoft.Xna.Framework.Vector2((GlobalSettings.Default.GraphicsWidth < 1024) ? 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;
        }