示例#1
0
        public UIRatingContainer(bool rating)
        {
            Edit = new UITextEdit();
            Edit.SetSize(420, 75);
            Edit.Mode      = UITextEditMode.Editor;
            Edit.OnChange += Edit_OnChange;
            Edit.MaxLines  = 4;
            Edit.MaxChars  = 140;
            Edit.BackgroundTextureReference = UITextBox.StandardBackground;
            Edit.TextMargin = new Rectangle(8, 2, 8, 3);

            Add(Edit);

            Rating              = new UIRatingDisplay(true);
            Rating.Position     = new Vector2(5, 80);
            Rating.Settable     = true;
            Rating.DisplayStars = 0;
            Rating.Visible      = rating;
            Add(Rating);

            CurrentRatingLabel                     = new UILabel();
            CurrentRatingLabel.Position            = new Vector2(75, 77);
            CurrentRatingLabel.CaptionStyle        = TextStyle.DefaultTitle.Clone();
            CurrentRatingLabel.CaptionStyle.Shadow = true;
            CurrentRatingLabel.Caption             = "0 Stars";
            CurrentRatingLabel.Visible             = rating;
            Add(CurrentRatingLabel);

            CharacterLimitDisplay                     = new UILabel();
            CharacterLimitDisplay.Position            = new Vector2(414, 77);
            CharacterLimitDisplay.Alignment           = TextAlignment.Right | TextAlignment.Top;
            CharacterLimitDisplay.Size                = new Vector2(1, 1);
            CharacterLimitDisplay.CaptionStyle        = TextStyle.DefaultTitle.Clone();
            CharacterLimitDisplay.CaptionStyle.Shadow = true;
            CharacterLimitDisplay.Caption             = "0/140";
            Add(CharacterLimitDisplay);

            var emoji = new UIEmojiSuggestions(Edit);

            Add(emoji);
        }
示例#2
0
        public UIBulletinPost()
        {
            var ui = Content.Content.Get().CustomUI;
            var gd = GameFacade.GraphicsDevice;

            var bigCaption = TextStyle.DefaultLabel.Clone();

            bigCaption.Color  = Color.White;
            bigCaption.Shadow = true;
            bigCaption.Size   = 28;
            BaseTitleStyle    = bigCaption.Clone();
            Add(TitleEdit     = new UITextEdit()
            {
                Position     = new Vector2(27, 40),
                Size         = new Vector2(542, 44),
                TextStyle    = bigCaption,
                Alignment    = TextAlignment.Middle | TextAlignment.Center,
                CurrentText  = "",
                MaxChars     = 64,
                FlashOnEmpty = true
            });

            var semiT = bigCaption.Clone();

            semiT.Color         *= 0.6f;
            semiT.Shadow         = false;
            Add(TitlePlaceholder = new UILabel()
            {
                Position     = new Vector2(27, 40),
                Size         = new Vector2(542, 44),
                CaptionStyle = semiT,
                Alignment    = TextAlignment.Middle | TextAlignment.Center,
                Caption      = GameFacade.Strings.GetString("f120", "23")
            });

            BackButton                     = new UIButton(ui.Get("vote_big_btn.png").Get(gd));
            BackButton.Width               = 150;
            BackButton.Caption             = GameFacade.Strings.GetString("f120", "13");
            BackButton.Tooltip             = GameFacade.Strings.GetString("f120", "15");
            BackButton.CaptionStyle        = BackButton.CaptionStyle.Clone();
            BackButton.CaptionStyle.Color  = Color.White;
            BackButton.CaptionStyle.Shadow = true;
            BackButton.CaptionStyle.Size   = 22;
            BackButton.Position            = new Vector2(30, 481);
            Add(BackButton);

            BackButton.OnButtonClick += GoBack;

            MiddleButton                     = new UIButton(ui.Get("vote_big_btn.png").Get(gd));
            MiddleButton.Width               = 150;
            MiddleButton.Caption             = GameFacade.Strings.GetString("f120", "35");
            MiddleButton.CaptionStyle        = BackButton.CaptionStyle.Clone();
            MiddleButton.CaptionStyle.Color  = Color.White;
            MiddleButton.CaptionStyle.Shadow = true;
            MiddleButton.CaptionStyle.Size   = 22;
            MiddleButton.Position            = new Vector2(220, 481);
            Add(MiddleButton);

            MiddleButton.OnButtonClick += MButtonClick;

            RightButton                     = new UIButton(ui.Get("vote_big_btn.png").Get(gd));
            RightButton.Width               = 150;
            RightButton.Caption             = GameFacade.Strings.GetString("f120", "12");
            RightButton.CaptionStyle        = BackButton.CaptionStyle.Clone();
            RightButton.CaptionStyle.Color  = Color.White;
            RightButton.CaptionStyle.Shadow = true;
            RightButton.CaptionStyle.Size   = 22;
            RightButton.Position            = new Vector2(410, 481);
            Add(RightButton);

            RightButton.OnButtonClick += RButtonClick;

            BodyText = new UITextEdit();
            BodyText.BackgroundTextureReference = UITextBox.StandardBackground;
            BodyText.TextMargin      = new Rectangle(8, 3, 8, 3);
            BodyText.FlashOnEmpty    = true;
            BodyText.MaxChars        = 1000;
            BodyText.ScrollbarGutter = 7;
            BodyText.TextMargin      = new Rectangle(12, 10, 12, 10);
            BodyText.SetSize(388, 346);
            BodyText.Position = new Vector2(22, 96);
            Add(BodyText);
            BodyText.ScrollbarImage = GetTexture(0x4AB00000001);
            BodyText.InitDefaultSlider();
            BodyText.OnChange += BodyText_OnChange;

            var emojis = new UIEmojiSuggestions(BodyText);

            DynamicOverlay.Add(emojis);
            emojis.Parent = this;

            var whiteText = TextStyle.DefaultLabel.Clone();

            whiteText.Color  = Color.White;
            whiteText.Shadow = true;

            Add(TimeLabel = new UILabel()
            {
                Position     = new Vector2(34, 442),
                CaptionStyle = whiteText
            });

            Add(TypeLabel = new UILabel()
            {
                Position     = new Vector2(34, 442),
                Size         = new Vector2(388 - 24, 1),
                Alignment    = TextAlignment.Right | TextAlignment.Top,
                CaptionStyle = whiteText
            });


            Add(PropertyButtonBG = new UIImage(ui.Get("bulletin_post_lot_bg.png").Get(gd))
            {
                Position = new Vector2(440, 101)
            });

            Add(PersonButtonBG = new UIImage(ui.Get("bulletin_post_ava_bg.png").Get(gd))
            {
                Position = new Vector2(449, 266 - 23)
            });

            Add(LotThumbButton = new UILotThumbButtonAuto()
            {
                Position = new Vector2(446, 107)
            });
            LotThumbButton.OnNameChange += (id, name) =>
            {
                if (id == 0)
                {
                    PropertyButtonName.Caption = GameFacade.Strings.GetString("f120", "28");
                }
                else
                {
                    PropertyButtonName.Caption = name;
                }
                if (EditorMode)
                {
                    LotThumbButton.LotTooltip = GameFacade.Strings.GetString("f120", "29");
                }
            };
            LotThumbButton.OnLotClick += PropertyButtonClick;
            LotThumbButton.Init(GetTexture(0x0000079300000001), GetTexture(0x0000079300000001));

            DynamicOverlay.Add(PersonButton = new UIBigPersonButton()
            {
                Position = new Vector2(452, 269 - 23)
            });

            PersonButton.OnNameChange += (id, name) =>
            {
                PersonButtonName.Caption = name;
            };

            Add(PropertyButtonName = new UILabel()
            {
                Position     = new Vector2(435, 202),
                Size         = new Vector2(151, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = whiteText,
                Caption      = "",
                Wrapped      = true,
                MaxLines     = 4
            });

            Add(PersonButtonName = new UILabel()
            {
                Position     = new Vector2(435, 442 - 23),
                Size         = new Vector2(151, 1),
                Alignment    = TextAlignment.Center | TextAlignment.Top,
                CaptionStyle = whiteText,
                Caption      = "",
                Wrapped      = true,
                MaxLines     = 3
            });

            Size = new Vector2(600, 550);
        }