예제 #1
0
        public void TestPartManagement()
        {
            ITextPart part = null;

            AddStep("clear text", () => textContainer.Clear());
            assertSpriteTextCount(0);

            AddStep("add text", () => part = textContainer.AddText("this is some text"));
            AddStep("set text colour to red manually", () => part.Drawables.ForEach(p => p.Colour = Colour4.Red));
            assertSpriteTextCount(4);

            AddStep("add more text", () => textContainer.AddText("and some more of it too"));
            assertSpriteTextCount(10);

            AddStep("add manual drawable", () => textContainer.AddPart(new TextPartManual(new[]
            {
                new SpriteIcon
                {
                    Icon = FontAwesome.Regular.Clipboard,
                    Size = new Vector2(16)
                }
            })));
            assertSpriteTextCount(10);
            assertTotalChildCount(11);

            AddStep("remove original text", () => textContainer.RemovePart(part));
            assertSpriteTextCount(6);
            assertTotalChildCount(7);

            AddStep("clear text", () => textContainer.Clear());
            assertSpriteTextCount(0);
        }
예제 #2
0
        private void recreateText()
        {
            text.Clear();

            //space after the title to put a space between the title and artist
            titleSprites = text.AddText(titleBind.Value + @"  ", sprite => sprite.Font = OsuFont.GetFont(weight: FontWeight.Regular)).OfType <SpriteText>();

            text.AddText(artistBind.Value, sprite =>
            {
                sprite.Font    = OsuFont.GetFont(size: 14, weight: FontWeight.Bold);
                sprite.Colour  = artistColour;
                sprite.Padding = new MarginPadding {
                    Top = 1
                };
            });
        }
예제 #3
0
        private void recreateText()
        {
            text.Clear();

            //space after the title to put a space between the title and artist
            titleSprites = text.AddText(titleBind.Value + @"  ", sprite =>
            {
                sprite.TextSize = 16;
                sprite.Font     = @"Exo2.0-Regular";
            });

            text.AddText(artistBind.Value, sprite =>
            {
                sprite.TextSize = 14;
                sprite.Font     = @"Exo2.0-Bold";
                sprite.Colour   = artistColour;
                sprite.Padding  = new MarginPadding {
                    Top = 1
                };
            });
        }