Esempio n. 1
0
        public UINewspaperItemButton()
        {
            BaseButton = new UINineSliceButton();
            BaseButton.SetNineSlice(15, 15, 15, 15);
            BaseButton.Width          = 180;
            BaseButton.Height         = 48;
            BaseButton.OnButtonClick += (btn) => OnClicked?.Invoke(btn);
            Add(BaseButton);

            Title = new UILabel();
            Title.CaptionStyle       = Title.CaptionStyle.Clone();
            Title.CaptionStyle.Size  = 12;
            Title.CaptionStyle.Color = Color.White;
            Title.Alignment          = TextAlignment.Left | TextAlignment.Top;
            Title.Position           = new Vector2(7, -1);
            Add(Title);

            Body                = new UITextEdit();
            Body.TextStyle      = Body.TextStyle.Clone();
            Body.TextStyle.Size = 9;
            Body.TextStyle.LineHeightModifier = -5;
            Body.SetSize(167, 32);
            Body.Mode     = UITextEditMode.ReadOnly;
            Body.Position = new Vector2(7, 15);
            Body.RemoveMouseEvent();
            Add(Body);
        }
Esempio n. 2
0
        public UIRatingSummaryPanel()
        {
            Body                = new UITextEdit();
            Body.TextStyle      = Body.TextStyle.Clone();
            Body.TextStyle.Size = 9;
            Body.TextStyle.LineHeightModifier = -4;
            Body.Position = new Vector2(5, 5);
            Body.SetSize(118, 81);
            Body.MaxLines      = 5;
            Body.Mode          = UITextEditMode.ReadOnly;
            Body.Position      = new Vector2(7, 3);
            Body.BBCodeEnabled = true;
            Body.RemoveMouseEvent();
            Add(Body);

            Body.Tooltip = GameFacade.Strings.GetString("f115", "94");

            NameLabel = new UILabel();
            NameLabel.CaptionStyle      = NameLabel.CaptionStyle.Clone();
            NameLabel.CaptionStyle.Size = 9;
            NameLabel.Position          = new Vector2(122, 77);
            NameLabel.Alignment         = TextAlignment.Right | TextAlignment.Top;
            NameLabel.Size = new Vector2(1, 1);
            NameLabel.CaptionStyle.Size = 9;
            Add(NameLabel);

            Rating          = new UIRatingDisplay(true);
            Rating.Position = new Vector2(7, 80);
            Add(Rating);

            CurrentRating = new Binding <MayorRating>()
                            .WithBinding(this, "Message", "MayorRating_Comment")
                            .WithBinding(this, "HalfStars", "MayorRating_HalfStars")
                            .WithBinding(this, "Name", "MayorRating_FromAvatar", (object id) =>
            {
                return(((uint)id == 0) ? "Anon" : "unknown");
            });

            Size = new Vector2(128, 96);

            ClickHandler =
                ListenForMouse(new Rectangle(0, 0, 128, 96), new UIMouseEvent(OnMouseEvent));
        }
        public UIFullRatingItem(uint ratingID)
        {
            RatingID = ratingID;

            Body                 = new UITextEdit();
            Body.TextStyle       = Body.TextStyle.Clone();
            Body.TextStyle.Size  = 8;
            Body.TextStyle.Color = Color.White;
            Body.SetSize(454, 42);
            Body.MaxLines      = 3;
            Body.Mode          = UITextEditMode.ReadOnly;
            Body.Position      = new Vector2(15, 20);
            Body.BBCodeEnabled = true;
            Body.RemoveMouseEvent();
            Add(Body);

            StarLabel           = new UILabel();
            StarLabel.Position  = new Vector2(75, 4);
            StarLabel.Alignment = TextAlignment.Left | TextAlignment.Top;
            StarLabel.Size      = new Vector2(1, 1);
            Add(StarLabel);

            NameLabel           = new UILabel();
            NameLabel.Position  = new Vector2(465, 4);
            NameLabel.Alignment = TextAlignment.Right | TextAlignment.Top;
            NameLabel.Size      = new Vector2(1, 1);
            Add(NameLabel);

            Rating          = new UIRatingDisplay(true);
            Rating.Position = new Vector2(9, 7);
            Add(Rating);

            CurrentRating = new Binding <MayorRating>()
                            .WithBinding(this, "Message", "MayorRating_Comment")
                            .WithBinding(this, "HalfStars", "MayorRating_HalfStars")
                            .WithBinding(this, "Name", "MayorRating_FromAvatar", (object id) =>
            {
                return(((uint)id == 0) ? "Anon" : "unknown");
            });

            var ui     = Content.Content.Get().CustomUI;
            var btnTex = ui.Get("chat_cat.png").Get(GameFacade.GraphicsDevice);

            var btnCaption = TextStyle.DefaultLabel.Clone();

            btnCaption.Size   = 8;
            btnCaption.Shadow = true;

            if (GameFacade.EnableMod)
            {
                DeleteButton                = new UIButton(btnTex);
                DeleteButton.Caption        = "Delete";
                DeleteButton.CaptionStyle   = btnCaption;
                DeleteButton.OnButtonClick += DeletePost;
                DeleteButton.Width          = 64;
                DeleteButton.X              = 135;
                DeleteButton.Y              = 4;
                Add(DeleteButton);
            }

            Size    = new Vector2(475, 70);
            PxWhite = TextureGenerator.GetPxWhite(GameFacade.GraphicsDevice);
        }