SetSize() public method

public SetSize ( float width, float height ) : void
width float
height float
return void
Ejemplo n.º 1
0
        public UIPropertyLog()
            : base(UIDialogStyle.Standard | UIDialogStyle.Close, true)
        {
            //todo: this dialog is resizable. The elements use offests from each side to size and position themselves.
            //right now we're just using positions.

            History = new List<VMChatEvent>();

            this.RenderScript("chatdialog.uis");
            this.SetSize(400, 255);

            this.Caption = "Property Log";

            ChatHistoryBackground = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            ChatHistoryBackground.Position = new Vector2(19, 39);
            ChatHistoryBackground.SetSize(341, 166+30);
            AddAt(3, ChatHistoryBackground);

            ChatHistorySlider.AttachButtons(ChatHistoryScrollUpButton, ChatHistoryScrollDownButton, 1);
            ChatHistorySlider.SetSize(ChatHistorySlider.Size.X, 138 + 30);
            ChatHistoryScrollDownButton.Position += new Vector2(0, 30);
            ChatHistoryText.AttachSlider(ChatHistorySlider);

            ChatHistoryText.Position = new Vector2(29, 47);
            var histStyle = ChatHistoryText.TextStyle.Clone();
            histStyle.Size = 8;
            ChatHistoryText.Size = new Vector2(322, 150+30);
            ChatHistoryText.MaxLines = 13;
            ChatHistoryText.TextStyle = histStyle;

            Remove(ChatEntryTextEdit);
            CloseButton.OnButtonClick += CloseButton_OnButtonClick;
        }
Ejemplo n.º 2
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>();

            foreach (var button in options.Buttons)
            {
                string buttonText = "";
                if (button.Text != null) buttonText = button.Text;
                else
                {
                    switch (button.Type)
                    {
                        case UIAlertButtonType.OK:
                            buttonText = GameFacade.Strings.GetString("142", "ok button");
                            break;
                        case UIAlertButtonType.Yes:
                            buttonText = GameFacade.Strings.GetString("142", "yes button");
                            break;
                        case UIAlertButtonType.No:
                            buttonText = GameFacade.Strings.GetString("142", "no button");
                            break;
                        case UIAlertButtonType.Cancel:
                            buttonText = GameFacade.Strings.GetString("142", "cancel button");
                            break;
                    }
                }
                var btnElem = AddButton(buttonText, button.Type, button.Handler == null);
                Buttons.Add(btnElem);
                if (button.Handler != null) btnElem.OnButtonClick += button.Handler;
            }

            if (options.TextEntry)
            {
                TextBox = new UITextBox();
                this.Add(TextBox);
            }

            /** Position buttons **/
            RefreshSize();
        }
Ejemplo n.º 3
0
        public void SetIcon(Texture2D img, int width, int height)
        {
            Icon.Texture = img;
            IconSpace    = new Vector2(width + 15, height);

            if (img == null)
            {
                IconSpace = new Vector2();
                Icon.SetSize(0, 0);
            }
            else
            {
                float scale = Math.Min(1, Math.Min((float)height / (float)img.Height, (float)width / (float)img.Width));
                Icon.SetSize(img.Width * scale, img.Height * scale);
                Icon.Position = new Vector2(32, 38) + new Vector2(width / 2 - (img.Width * scale / 2), height / 2 - (img.Height * scale / 2));
            }

            ComputeText();
            RefreshSize();
        }
        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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
0
        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);
        }
Ejemplo n.º 7
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);

            if (OKBg != null)
            {
                OKBg.Position     = new Vector2(width - 53, height - 46);
                OKButton.Position = OKBg.Position + new Vector2(10, 4);
            }

            if (CloseBg != null)
            {
                CloseBg.Position     = new Vector2(width - 70, 0);
                CloseButton.Position = CloseBg.Position + new Vector2(45, 10);
            }

            m_Bounds = new Rectangle(0, 0, width, height);
        }
Ejemplo n.º 8
0
        public UIChatDialog()
            : base(UIDialogStyle.Standard | UIDialogStyle.OK | UIDialogStyle.Close, true)
        {
            //todo: this dialog is resizable. The elements use offests from each side to size and position themselves.
            //right now we're just using positions.

            History = new List<VMChatEvent>();

            this.RenderScript("chatdialog.uis");
            this.SetSize(400, 255);

            this.Caption = "Property Chat (?) - ???";

            ChatEntryBackground = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            ChatEntryBackground.Position = new Vector2(25, 211);
            ChatEntryBackground.SetSize(323, 26);
            AddAt(5, ChatEntryBackground);

            ChatHistoryBackground = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            ChatHistoryBackground.Position = new Vector2(19, 39);
            ChatHistoryBackground.SetSize(341, 166);
            AddAt(5, ChatHistoryBackground);

            ChatHistorySlider.AttachButtons(ChatHistoryScrollUpButton, ChatHistoryScrollDownButton, 1);
            ChatHistoryText.AttachSlider(ChatHistorySlider);

            ChatEntryTextEdit.OnEnterPress += SendMessageEnter;

            ChatHistoryText.Position = new Vector2(29, 47);
            var histStyle = ChatHistoryText.TextStyle.Clone();
            histStyle.Size = 8;
            ChatHistoryText.Size = new Vector2(322, 150);
            ChatHistoryText.MaxLines = 10;
            ChatHistoryText.TextStyle = histStyle;

            ChatEntryTextEdit.OnChange += ChatEntryTextEdit_OnChange;
            ChatEntryTextEdit.Position = new Vector2(38, 216);
            ChatEntryTextEdit.Size = new Vector2(295, 17);

            OKButton.Disabled = true;
            OKButton.OnButtonClick += SendMessage;

            CloseButton.OnButtonClick += CloseButton_OnButtonClick;
        }
Ejemplo n.º 9
0
        public UIPieMenu(List<VMPieMenuInteraction> pie, VMEntity obj, VMEntity caller, UILotControl parent)
        {
            if (FSOEnvironment.UIZoomFactor>1.33f) ScaleX = ScaleY = FSOEnvironment.UIZoomFactor*0.75f;
            TrueScale = ScaleX *FSOEnvironment.DPIScaleFactor;
            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 == null)?new string[] { "???" } :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,
                    Param0 = pie[i].Param0
                };
                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();
        }
Ejemplo n.º 10
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();

            if (options.ProgressBar)
            {
                _ProgressBar          = new UIProgressBar();
                _ProgressBar.Mode     = ProgressBarMode.Animated;
                _ProgressBar.Position = new Microsoft.Xna.Framework.Vector2(32, 0);
                _ProgressBar.SetSize(options.Width - 64, 26);
                this.Add(_ProgressBar);
            }

            /** Add buttons **/
            Buttons = new List <UIButton>();

            foreach (var button in options.Buttons)
            {
                string buttonText = "";
                if (button.Text != null)
                {
                    buttonText = button.Text;
                }
                else
                {
                    switch (button.Type)
                    {
                    case UIAlertButtonType.OK:
                        buttonText = GameFacade.Strings.GetString("142", "ok button");
                        break;

                    case UIAlertButtonType.Yes:
                        buttonText = GameFacade.Strings.GetString("142", "yes button");
                        break;

                    case UIAlertButtonType.No:
                        buttonText = GameFacade.Strings.GetString("142", "no button");
                        break;

                    case UIAlertButtonType.Cancel:
                        buttonText = GameFacade.Strings.GetString("142", "cancel button");
                        break;
                    }
                }
                var btnElem = AddButton(buttonText, button.Type, button.Handler == null);
                Buttons.Add(btnElem);
                if (button.Handler != null)
                {
                    btnElem.OnButtonClick += button.Handler;
                }
            }

            if (options.TextEntry)
            {
                TextBox          = new UITextBox();
                TextBox.MaxChars = options.MaxChars;
                this.Add(TextBox);
            }

            if (options.Color)
            {
                ColorEntry = new UIColorPicker();
                Add(ColorEntry);
            }

            /** Position buttons **/
            RefreshSize();
        }
Ejemplo n.º 11
0
        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);
                }
            }
        }
Ejemplo n.º 12
0
        /// <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);
            DeleteAvatarButton.OnButtonClick += new ButtonClickDelegate(DeleteAvatarButton_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);
        }
Ejemplo n.º 13
0
        public LoadingScreen()
            : base()
        {
            HITVM.Get().PlaySoundEvent(UIMusic.LoadLoop);

            /**
             * Scale the whole screen to 1024
             */
            BackgroundCtnr = new UIContainer();
            var scale = ScreenHeight / 600.0f;
            BackgroundCtnr.ScaleX = BackgroundCtnr.ScaleY = scale;

            /** Background image **/
            Texture2D setupTex;
            if (File.Exists(Path.Combine(FSOEnvironment.ContentDir, "setup.png")))
            {
                using (var logostrm = File.OpenRead(Path.Combine(FSOEnvironment.ContentDir, "setup.png")))
                    setupTex = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);
            }
            else setupTex = GetTexture((ulong)FileIDs.UIFileIDs.setup);
            Background = new UIImage(setupTex);
            var bgScale = 600f / setupTex.Height;
            Background.SetSize(setupTex.Width * bgScale, 600);
            Background.X = (800 - bgScale * setupTex.Width) / 2;
            BackgroundCtnr.Add(Background);
            BackgroundCtnr.X = (ScreenWidth - (800 * scale)) / 2;

            Texture2D splashSeg;
            using (var logostrm = File.OpenRead(Path.Combine(FSOEnvironment.ContentDir, "Textures/splashSeg.png")))
                splashSeg = ImageLoader.FromStream(GameFacade.GraphicsDevice, logostrm);

            var bgEdge = new UIImage(splashSeg).With9Slice(64, 64, 1, 1);
            BackgroundCtnr.AddAt(0,bgEdge);
            bgEdge.Y = -1;
            bgEdge.X = Background.X-64;
            bgEdge.SetSize(Background.Width+64*2, Background.Height + 2);

            //TODO: Letter spacing is a bit wrong on this label
            var lbl = new UILabel();
            lbl.Caption = GameFacade.Strings.GetString("154", "5");
            lbl.X = 0;
            lbl.Size = new Microsoft.Xna.Framework.Vector2(800, 100);
            lbl.Y = 508;

            var style = lbl.CaptionStyle.Clone();
            style.Size = 17;
            lbl.CaptionStyle = style;
            BackgroundCtnr.Add(lbl);
            this.Add(BackgroundCtnr);

            ProgressLabel1 = new UILabel
            {
                X = 0,
                Y = 550,
                Size = new Microsoft.Xna.Framework.Vector2(800, 100),
                CaptionStyle = style
            };

            ProgressLabel2 = new UILabel
            {
                X = 0,
                Y = 550,
                Size = new Microsoft.Xna.Framework.Vector2(800, 100),
                CaptionStyle = style
            };

            BackgroundCtnr.Add(ProgressLabel1);
            BackgroundCtnr.Add(ProgressLabel2);

            PreloadLabels = new string[]{
                GameFacade.Strings.GetString("155", "6"),
                GameFacade.Strings.GetString("155", "7"),
                GameFacade.Strings.GetString("155", "8"),
                GameFacade.Strings.GetString("155", "9")
            };

            CurrentPreloadLabel = 0;
            AnimateLabel("", PreloadLabels[0]);

            CheckProgressTimer = new Timer();
            CheckProgressTimer.Interval = 5;
            CheckProgressTimer.Elapsed += new ElapsedEventHandler(CheckProgressTimer_Elapsed);
            CheckProgressTimer.Start();

            //GameFacade.Screens.Tween.To(rect, 10.0f, new Dictionary<string, float>() {
            //    {"X", 500.0f}
            //}, TweenQuad.EaseInOut);
        }
Ejemplo n.º 14
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 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;
        }
Ejemplo n.º 15
0
        public PersonSelectionEdit()
            : base()
        {
            /**
            * Data
            */
            var content = Content.Content.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 = this.RenderScript("personselectionedit1024.uis");

            Position = new Vector2((GlobalSettings.Default.GraphicsWidth-1024)/2, (GlobalSettings.Default.GraphicsHeight-768)/2) * FSOEnvironment.DPIScaleFactor;
            Console.WriteLine(Position.ToString());

            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);
            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();
            this.Add(m_HeadSkinBrowser);

            m_BodySkinBrowser = ui.Create<UICollectionViewer>("BodySkinBrowser");
            m_BodySkinBrowser.OnChange += new ChangeDelegate(BodySkinBrowser_OnChange);
            m_BodySkinBrowser.Init();
            this.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);
            this.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);

            var offset = new Vector2(0, 0);
            if (BackgroundImageDialog != null)
            {
                offset = new Vector2(112, 84);

                this.AddAt(1, new UIImage(BackgroundImageDialog)
                {
                    X = 112,
                    Y = 84
                });
            }

            /**
             * Music
             */
            HIT.HITVM.Get().PlaySoundEvent(UIMusic.CAS);
            /*
            PlayBackgroundMusic(
                new string[] { GlobalSettings.Default.StartupPath + "\\music\\modes\\create\\tsocas1_v2.mp3" }
            );*/

            SimBox = new UISim(Guid.NewGuid().ToString());

            SimBox.SimScale = 0.5f;
            SimBox.Position = new Microsoft.Xna.Framework.Vector2(offset.X + 70, offset.Y + 88);

            SimBox.AutoRotate = true;
            this.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);

            NetworkFacade.Controller.OnCharacterCreationProgress += new OnCharacterCreationProgressDelegate(Controller_OnCharacterCreationStatus);
        }