예제 #1
0
        private async void loadVideo()
        {
            var wr = new WebRequest("https://assets.ppy.sh/media/landing.mp4");
            await wr.PerformAsync();

            Schedule(() =>
            {
                Clear();

                videoSprite = new VideoSprite(wr.ResponseStream);
                Add(videoSprite);
                videoSprite.Loop = false;

                clock             = new ManualClock();
                videoSprite.Clock = new FramedClock(clock);

                Add(timeText = new TextFlowContainer {
                    AutoSizeAxes = Axes.Both
                });

                AddStep("Jump ahead by 10 seconds", () => clock.CurrentTime += 10_000.0);
                AddStep("Jump back by 10 seconds", () => clock.CurrentTime   = Math.Max(0, clock.CurrentTime - 10_000.0));
                AddToggleStep("Toggle looping", newState =>
                {
                    videoSprite.Loop  = newState;
                    clock.CurrentTime = 0;
                });
            });
        }
예제 #2
0
            private void load(OverlayColourProvider colourProvider)
            {
                TextFlowContainer textFlow;

                AutoSizeAxes  = Axes.Both;
                Anchor        = Anchor.TopRight;
                Origin        = Anchor.TopRight;
                InternalChild = textFlow = new TextFlowContainer(t =>
                {
                    t.Colour = colourProvider.Light1;
                })
                {
                    Anchor       = Anchor.TopRight,
                    Origin       = Anchor.TopRight,
                    AutoSizeAxes = Axes.Both,
                    Direction    = FillDirection.Horizontal,
                    Margin       = new MarginPadding {
                        Vertical = 5
                    }
                };

                textFlow.AddText($"{date:dd}", t =>
                {
                    t.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold);
                });

                textFlow.AddText($"{date: MMM}", t =>
                {
                    t.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Regular);
                });
            }
        private TestCaseButton()
        {
            AutoSizeAxes = Axes.Y;
            RelativeSizeAxes = Axes.X;

            Padding = new MarginPadding { Bottom = 3 };

            InternalChildren = new Drawable[]
            {
                box = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour = new Color4(140, 140, 140, 255),
                    Alpha = 0.7f
                },
                content = new Container
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes = Axes.Y,
                    Child = text = new TextFlowContainer
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes = Axes.Y,
                        Padding = new MarginPadding
                        {
                            Left = 4,
                            Right = 4,
                            Bottom = 2,
                        },
                    }
                },
            };
        }
예제 #4
0
        public void TestChangeLocalisationBeforeAfterLoadComplete()
        {
            AddStep("change locale to en", () => configManager.SetValue(FrameworkSetting.Locale, "en"));

            TextFlowContainer textFlowContainer = null;
            ITextPart         textPart          = null;

            AddStep("create text flow", () =>
            {
                textFlowContainer = new TextFlowContainer(text => text.Font = FrameworkFont.Condensed)
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Origin           = Anchor.Centre,
                    Anchor           = Anchor.Centre,
                };
            });

            AddStep("Add text", () => textPart = textFlowContainer.AddText(new TranslatableString(simple, "fallback")));

            AddStep("Add text flow to hierarchy", () => Child = textFlowContainer);

            // Parts are created eagerly during async load to alleviate synchronous overhead.
            AddAssert("Ensure parts are correct", () =>
                      textPart.Drawables.OfType <SpriteText>().ElementAtOrDefault(0)?.Text == "simple " &&
                      textPart.Drawables.OfType <SpriteText>().ElementAtOrDefault(1)?.Text == "english");

            AddStep("change locale to fr", () => configManager.SetValue(FrameworkSetting.Locale, "fr"));

            AddAssert("Ensure parts are correct", () =>
                      textPart.Drawables.OfType <SpriteText>().ElementAtOrDefault(0)?.Text == "simple " &&
                      textPart.Drawables.OfType <SpriteText>().ElementAtOrDefault(1)?.Text == "french"
                      );
        }
예제 #5
0
        private void Load()
        {
            RelativePositionAxes = Axes.X;

            Add(new Box
            {
                RelativeSizeAxes = Axes.Both,
                Size             = new Vector2(1f),
            });

            if (Parent)
            {
                return;
            }

            Add(textFlowContainer = new TextFlowContainer
            {
                Anchor = Anchor.TopLeft,
                Origin = Anchor.TopLeft,
                RelativePositionAxes = Axes.Both,
                Colour       = Color4.Black.Opacity(0.8f),
                TextAnchor   = Anchor.Centre,
                X            = 0.01f,
                Depth        = -1f,
                Size         = new Vector2(0f, this.DrawHeight),
                AutoSizeAxes = Axes.X
            }
                );

            textFlowContainer.AddText($"Title: {map.DifficultyName}", x => x.Font = new FontUsage("Roboto-Medium", 20));
        }
예제 #6
0
        public ProgressNotification()
        {
            IconContent.Add(new Box
            {
                RelativeSizeAxes = Axes.Both,
            });

            Content.Add(textDrawable = new TextFlowContainer(t =>
            {
                t.TextSize = 16;
            })
            {
                Colour           = OsuColour.Gray(128),
                AutoSizeAxes     = Axes.Y,
                RelativeSizeAxes = Axes.X,
            });

            NotificationContent.Add(progressBar = new ProgressBar
            {
                Origin           = Anchor.BottomLeft,
                Anchor           = Anchor.BottomLeft,
                RelativeSizeAxes = Axes.X,
            });

            State = ProgressNotificationState.Queued;

            // don't close on click by default.
            Activated = () => false;
        }
예제 #7
0
            public MetadataSection(string title)
            {
                RelativeSizeAxes = Axes.X;
                AutoSizeAxes     = Axes.Y;
                Alpha            = 0;

                InternalChild = textContainer = new FillFlowContainer
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Spacing          = new Vector2(spacing / 2),
                    Children         = new Drawable[]
                    {
                        new Container
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Child            = new OsuSpriteText
                            {
                                Text     = title,
                                Font     = @"Exo2.0-Bold",
                                TextSize = 14,
                            },
                        },
                        textFlow = new OsuTextFlowContainer
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                        },
                    },
                };
            }
예제 #8
0
        public SimpleNotification()
        {
            IconContent.AddRange(new Drawable[]
            {
                IconBackgound = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = ColourInfo.GradientVertical(OsuColour.Gray(0.2f), OsuColour.Gray(0.6f))
                },
                iconDrawable = new SpriteIcon
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Icon   = icon,
                    Size   = new Vector2(20),
                }
            });

            Content.Add(textDrawable = new OsuTextFlowContainer(t => t.TextSize = 16)
            {
                Colour           = OsuColour.Gray(128),
                AutoSizeAxes     = Axes.Y,
                RelativeSizeAxes = Axes.X,
                Text             = text
            });
        }
예제 #9
0
        public void TestTextFlowLocalisation()
        {
            Container         textFlowParent    = null;
            TextFlowContainer textFlowContainer = null;

            AddStep("create text flow", () => Child = textFlowParent = new Container
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Origin           = Anchor.Centre,
                Anchor           = Anchor.Centre,
                Children         = new Drawable[]
                {
                    new Box
                    {
                        RelativeSizeAxes = Axes.Both,
                        Colour           = Colour4.FromHex("#333")
                    },
                    textFlowContainer = new TextFlowContainer(text => text.Font = FrameworkFont.Condensed)
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y,
                        Origin           = Anchor.Centre,
                        Anchor           = Anchor.Centre,
                    },
                }
            });
            AddStep("add text", () =>
            {
                const string player = "spaceman_atlas";
                var rankAchieved    = 12_345_678.ToLocalisableString("N0");
                var beatmap         = new RomanisableString(
                    "ELFENSJóN - ASH OF ROUGE (HeTo's Normal)",
                    "ELFENSJoN - ASH OF ROUGE (HeTo's Normal)");
                const string mode = "osu!";

                textFlowContainer.AddText(new TranslatableString(rank, rank_default, player, rankAchieved, beatmap, mode));
                textFlowContainer.NewParagraph();
                textFlowContainer.AddText(new TranslatableString(rank_lost, rank_lost_default, player, beatmap, mode), text =>
                {
                    text.Font   = FontUsage.Default;
                    text.Colour = Colour4.Red;
                });
            });

            AddStep("change locale to en", () => configManager.SetValue(FrameworkSetting.Locale, "en"));
            AddStep("change locale to fr", () => configManager.SetValue(FrameworkSetting.Locale, "fr"));
            AddStep("change locale to tr", () => configManager.SetValue(FrameworkSetting.Locale, "tr"));

            AddToggleStep("toggle romanisation", romanised => configManager.SetValue(FrameworkSetting.ShowUnicode, romanised));

            AddSliderStep("change text flow width", 0, 1f, 1f, width =>
            {
                if (textFlowParent != null)
                {
                    textFlowParent.Width = width;
                }
            });
        }
예제 #10
0
파일: Console.cs 프로젝트: jorolf/baumRPE
        public Console()
        {
            TextBox input;

            AddInternal(content = new Container
            {
                RelativeSizeAxes = Axes.X,
                Height           = height,
                Depth            = float.MinValue,
                Position         = new Vector2(0, -height),
            });

            Children = new Drawable[]
            {
                new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.Black,
                    Alpha            = 0.5f
                },
                new ScrollContainer
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = height - 20,

                    Child = consoleLog = new TextFlowContainer(text => text.Font = text.Font.With(size: 20))
                    {
                        RelativeSizeAxes = Axes.X,
                        AutoSizeAxes     = Axes.Y
                    }
                },
                new Box
                {
                    Anchor           = Anchor.BottomCentre,
                    Origin           = Anchor.BottomCentre,
                    RelativeSizeAxes = Axes.X,
                    Height           = 20,
                    Colour           = Color4.Black,
                    Alpha            = 0.5f
                },
                input = new TextBox
                {
                    Anchor               = Anchor.BottomCentre,
                    Origin               = Anchor.BottomCentre,
                    RelativeSizeAxes     = Axes.X,
                    Height               = 20,
                    ReleaseFocusOnCommit = false
                }
            };

            input.OnCommit += (sender, text) =>
            {
                ExecuteCommand(sender.Text);
                sender.Text = string.Empty;
            };

            Logger.NewEntry += log;
        }
예제 #11
0
        private void Load()
        {
            var textSize = SizeConsts.TextSize1;

            NameColumn = new TextFlowContainer(s => s.Font = new FontUsage("default", textSize))
            {
                AutoSizeAxes = Axes.Both,
                Anchor       = Anchor.TopLeft,
                Origin       = Anchor.TopLeft,
                TextAnchor   = Anchor.TopLeft,
                Colour       = Color4.White,
                Margin       = new MarginPadding {
                    Horizontal = textSize / 2,
                },
            };
            ScoreColumn = new TextFlowContainer(s => s.Font = new FontUsage("default", textSize))
            {
                AutoSizeAxes = Axes.Both,
                Anchor       = Anchor.TopRight,
                Origin       = Anchor.TopRight,
                TextAnchor   = Anchor.TopRight,
                Colour       = Color4.White,
                Margin       = new MarginPadding {
                    Horizontal = textSize / 2,
                },
            };
            var nameAndScore = new Container {
                Width        = Width,
                AutoSizeAxes = Axes.Y,
                Children     = new[] {
                    NameColumn,
                    ScoreColumn
                },
            };

            if (ScoreStatistics == null)
            {
                // Read-only leaderboard
                Child = nameAndScore;
            }
            else
            {
                Child = new FillFlowContainer {
                    Width        = Width,
                    AutoSizeAxes = Axes.Y,
                    Children     = new Drawable[] {
                        new AddLeaderboardEntryContainer(this, ScoreStatistics.Score),
                        nameAndScore
                    }
                };
            }

            if (File.Exists(LeaderboardPath))
            {
                LoadLeaderboard();
            }
        }
예제 #12
0
 private void setTextAsync(string text)
 {
     textFlow?.Expire();
     TextContainer.Add(textFlow = new OsuTextFlowContainer(s => s.Font = s.Font.With(size: 14))
     {
         RelativeSizeAxes = Axes.X,
         AutoSizeAxes     = Axes.Y,
         Colour           = Color4.White.Opacity(0.75f),
         Text             = text
     });
 }
예제 #13
0
            public PostButton(APINewsPost post)
            {
                this.post = post;

                RelativeSizeAxes = Axes.X;
                AutoSizeAxes     = Axes.Y;
                Child            = text = new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 12))
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Text             = post.Title
                };
            }
예제 #14
0
            public PostButton(APIChangelogBuild post)
            {
                this.post = post;

                RelativeSizeAxes = Axes.X;
                AutoSizeAxes     = Axes.Y;
                Child            = text = new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 12))
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Text             = post.DisplayVersion
                };
            }
예제 #15
0
 public TestSceneDisplayMode()
 {
     Child = new BasicScrollContainer
     {
         RelativeSizeAxes = Axes.Both,
         Child            = new FillFlowContainer
         {
             RelativeSizeAxes = Axes.X,
             AutoSizeAxes     = Axes.Y,
             Direction        = FillDirection.Vertical,
             Padding          = new MarginPadding(10),
             Spacing          = new Vector2(10),
             Children         = new Drawable[]
             {
                 new SpriteText
                 {
                     Text = "FrameworkConfigManager settings: ",
                     Font = FrameworkFont.Regular.With(size: 24),
                 },
                 new SpriteText {
                     Current = textConfigSizeFullscreen, Font = FrameworkFont.Condensed
                 },
                 new SpriteText {
                     Current = textConfigWindowMode, Font = FrameworkFont.Condensed
                 },
                 new SpriteText
                 {
                     Text   = "IWindow properties: ",
                     Font   = FrameworkFont.Regular.With(size: 24),
                     Margin = new MarginPadding {
                         Top = 7
                     },
                 },
                 new SpriteText {
                     Current = textCurrentDisplay, Font = FrameworkFont.Condensed
                 },
                 new SpriteText {
                     Current = textCurrentDisplayMode, Font = FrameworkFont.Condensed.With(size: 16)
                 },
                 new SpriteText {
                     Text = "Available display modes for current display:", Font = FrameworkFont.Condensed
                 },
                 textWindowDisplayModes = new TextFlowContainer(text => text.Font = FrameworkFont.Condensed.With(size: 16))
                 {
                     Width        = 1000,
                     AutoSizeAxes = Axes.Y,
                 }
             },
         },
     };
 }
예제 #16
0
파일: UserOverlay.cs 프로젝트: Mempler/Qsor
        private void Load(UserManager userManager)
        {
            _activeUser = userManager.User;

            Width  = 256;
            Height = 80;

            _textFlowContainer = new TextFlowContainer
            {
                AutoSizeAxes   = Axes.Both,
                Padding        = new MarginPadding(4),
                OriginPosition = new Vector2(-75, 0)
            };

            _textFlowContainer.AddParagraph($"{_activeUser.Username}", text => text.Font = new FontUsage(size: 24, weight: "Bold"));
            _textFlowContainer.AddParagraph($"Performance: {_activeUser.Statistics.PerformancePoints}pp", text => text.Font = new FontUsage(size: 14));
            _textFlowContainer.AddParagraph($"Accuracy: {_activeUser.Statistics.Accuracy:0.00}%", text => text.Font         = new FontUsage(size: 14));
            _textFlowContainer.AddParagraph($"Level: {_activeUser.Statistics.GetLevel()}", text => text.Font = new FontUsage(size: 14));

            AddRangeInternal(new Drawable[]
            {
                _background = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                    Colour           = Color4.White,
                    Alpha            = 0f
                },
                _avatar = new DrawableAvatar(),
                new SpriteText
                {
                    Font   = new FontUsage(size: 32, weight: "Bold"),
                    Colour = Color4.DarkGray,
                    Text   = new LocalisedString("#1"),

                    Anchor   = Anchor.BottomRight,
                    Origin   = Anchor.BottomRight,
                    Padding  = new MarginPadding(0),
                    Position = new Vector2(0, -5)
                },
                _textFlowContainer,
                _levelBar = new DrawableLevelBar(_activeUser)
                {
                    Anchor = Anchor.BottomRight,
                    Origin = Anchor.BottomRight,
                }
            });

            _avatar.User.Value = _activeUser;
        }
예제 #17
0
        /// <summary>
        /// Drawable Notification
        /// </summary>
        /// <param name="text"></param>
        /// <param name="colourInfo"></param>
        /// <param name="duration">Hide after X amount of MS, -1 = PositiveInfinity</param>
        /// <param name="clickAction"></param>
        public DrawableNotification(LocalisedString text, ColourInfo colourInfo, int duration = -1, Action clickAction = null)
        {
            _clock             = new StopwatchClock();
            _clickAction       = clickAction;
            _borderColour      = colourInfo;
            _textFlowContainer = new TextFlowContainer
            {
                Direction    = FillDirection.Full,
                AutoSizeAxes = Axes.Both,
                MaximumSize  = new Vector2(290, float.MaxValue),
                Padding      = new MarginPadding(10)
            };
            _duration = duration == -1 ? Math.Max(3000, (double)(text.ToString().Length * 100)) : duration;

            _textFlowContainer.AddText(text);
        }
예제 #18
0
            private void setTextAsync(string text)
            {
                LoadComponentAsync(new OsuTextFlowContainer(s => s.TextSize = 14)
                {
                    RelativeSizeAxes = Axes.X,
                    AutoSizeAxes     = Axes.Y,
                    Colour           = Color4.White.Opacity(0.75f),
                    Text             = text
                }, loaded =>
                {
                    textFlow?.Expire();
                    textContainer.Add(textFlow = loaded);

                    // fade in if we haven't yet.
                    this.FadeIn(transition_duration);
                });
            }
예제 #19
0
파일: NewsTitleLink.cs 프로젝트: Wieku/osu
        private void load(GameHost host, OverlayColourProvider colourProvider)
        {
            Child = new TextFlowContainer(t =>
            {
                t.Font = OsuFont.GetFont(weight: FontWeight.Bold);
            })
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Text             = post.Title
            };

            HoverColour = colourProvider.Light1;

            TooltipText = "view in browser";
            Action      = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
        }
예제 #20
0
        protected HelpScreen()
        {
            RelativeSizeAxes = Axes.Both;

            AddInternal(new InfoText
            {
                Text = "Help"
            });

            AddInternal(textFlow = new TextFlowContainer
            {
                RelativeSizeAxes = Axes.X,
                Anchor           = Anchor.Centre,
                Origin           = Anchor.Centre,
                TextAnchor       = Anchor.Centre
            });
        }
예제 #21
0
        private void setTextAsync(string text)
        {
            LoadComponentAsync(new LinkFlowContainer(s => s.Font = s.Font.With(size: 14))
            {
                RelativeSizeAxes = Axes.X,
                AutoSizeAxes     = Axes.Y,
                Colour           = Colour4.White.Opacity(0.75f),
            }, loaded =>
            {
                textFlow?.Expire();

                switch (type)
                {
                case MetadataType.Tags:
                    string[] tags = text.Split(" ");

                    for (int i = 0; i <= tags.Length - 1; i++)
                    {
                        loaded.AddLink(tags[i], LinkAction.SearchBeatmapSet, tags[i]);

                        if (i != tags.Length - 1)
                        {
                            loaded.AddText(" ");
                        }
                    }

                    break;

                case MetadataType.Source:
                    loaded.AddLink(text, LinkAction.SearchBeatmapSet, text);
                    break;

                default:
                    loaded.AddText(text);
                    break;
                }

                textContainer.Add(textFlow = loaded);

                // fade in if we haven't yet.
                textContainer.FadeIn(transition_duration);
            });
        }
예제 #22
0
        public TestSceneFonts()
        {
            TextFlowContainer flow;

            Add(flow = new TextFlowContainer());

            flow.AddParagraph("Default", s => s.Font       = HoloTrackFont.Default);
            flow.AddParagraph("DefaultItalic", s => s.Font = HoloTrackFont.Default.With(italics: true));

            flow.AddParagraph("Light", s => s.Font       = HoloTrackFont.Light);
            flow.AddParagraph("LightItalic", s => s.Font = HoloTrackFont.Light.With(italics: true));

            flow.AddParagraph("Bold", s => s.Font       = HoloTrackFont.Bold);
            flow.AddParagraph("BoldItalic", s => s.Font = HoloTrackFont.Bold.With(italics: true));

            flow.AddParagraph("Medium", s => s.Font       = HoloTrackFont.Medium);
            flow.AddParagraph("MediumItalic", s => s.Font = HoloTrackFont.Medium.With(italics: true));

            flow.AddParagraph("Black", s => s.Font       = HoloTrackFont.Black);
            flow.AddParagraph("BlackItalic", s => s.Font = HoloTrackFont.Black.With(italics: true));
        }
예제 #23
0
        private Drawable createMessage()
        {
            if (string.IsNullOrEmpty(entry.MessageHtml))
            {
                return(Empty());
            }

            var message = new TextFlowContainer
            {
                AutoSizeAxes     = Axes.Y,
                RelativeSizeAxes = Axes.X,
            };

            // todo: use markdown parsing once API returns markdown
            message.AddText(WebUtility.HtmlDecode(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty)), t =>
            {
                t.Font   = fontMedium;
                t.Colour = colourProvider.Foreground1;
            });

            return(message);
        }
예제 #24
0
        private void load(OsuColour colours)
        {
            this.colours = colours;

            MatchLeaderboard leaderboard;

            Children = new Drawable[]
            {
                new Box
                {
                    Colour           = colours.Gray6,
                    RelativeSizeAxes = Axes.Both,
                },
                new BufferedContainer
                {
                    RelativeSizeAxes = Axes.Both,
                    BackgroundColour = colours.Gray6,
                    Child            = leaderboard = CreateLeaderboard()
                },
                rankText = new TextFlowContainer
                {
                    Anchor           = Anchor.TopCentre,
                    Origin           = Anchor.TopCentre,
                    RelativeSizeAxes = Axes.X,
                    Width            = 0.5f,
                    AutoSizeAxes     = Axes.Y,
                    Y          = 50,
                    TextAnchor = Anchor.TopCentre
                },
            };

            leaderboard.Origin           = Anchor.Centre;
            leaderboard.Anchor           = Anchor.Centre;
            leaderboard.RelativeSizeAxes = Axes.Both;
            leaderboard.Height           = 0.8f;
            leaderboard.Y            = 55;
            leaderboard.ScoresLoaded = scoresLoaded;
        }
예제 #25
0
        protected FillFlowContainer CreateStatusMessage(bool rightAlignedChildren)
        {
            var statusContainer = new FillFlowContainer
            {
                AutoSizeAxes = Axes.Both,
                Direction    = FillDirection.Vertical
            };

            var alignment = rightAlignedChildren ? Anchor.CentreRight : Anchor.CentreLeft;

            statusContainer.Add(LastVisitMessage = new TextFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)).With(text =>
            {
                text.Anchor       = alignment;
                text.Origin       = alignment;
                text.AutoSizeAxes = Axes.Both;
                text.Alpha        = 0;

                if (User.LastVisit.HasValue)
                {
                    text.AddText(@"Last seen ");
                    text.AddText(new DrawableDate(User.LastVisit.Value, italic: false)
                    {
                        Shadow = false
                    });
                }
            }));

            statusContainer.Add(statusMessage = new OsuSpriteText
            {
                Anchor = alignment,
                Origin = alignment,
                Font   = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold)
            });

            return(statusContainer);
        }
예제 #26
0
 private void Load()
 {
     Children = new Drawable[]
     {
         new Box
         {
             Depth = 0,
             RelativePositionAxes = Axes.Both,
             Anchor           = Anchor.Centre,
             Origin           = Anchor.Centre,
             RelativeSizeAxes = Axes.Both,
             Size             = new Vector2(1f),
             Colour           = Color4.Black.Opacity(0.75f),
         },
         modBox = new Mods
         {
             Depth = -2,
             RelativePositionAxes = Axes.Both,
             Anchor           = Anchor.Centre,
             Origin           = Anchor.Centre,
             RelativeSizeAxes = Axes.Both,
             Size             = new Vector2(0.6f, 0.3f),
             Colour           = Color4.Green.Opacity(0.8f),
         },
         _text = new TextFlowContainer
         {
             Depth = -1,
             RelativePositionAxes = Axes.Both,
             Anchor       = Anchor.Centre,
             Origin       = Anchor.Centre,
             TextAnchor   = Anchor.Centre,
             Spacing      = new Vector2(2f),
             AutoSizeAxes = Axes.Both,
         }
     };
 }
예제 #27
0
 public BeatmapCard()
 {
     Size             = SIZE;
     InternalChildren = new Drawable[]
     {
         sprite = new BeatmapBackgroundSprite
         {
             Anchor = Anchor.Centre,
             Origin = Anchor.Centre,
         },
         new Box
         {
             RelativeSizeAxes = Axes.Both,
             Colour           = Color4.Black,
             Alpha            = 0.3f
         },
         new Container
         {
             RelativeSizeAxes = Axes.Both,
             Padding          = new MarginPadding(5),
             Child            = text = new TextFlowContainer(s =>
             {
                 s.Font   = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold);
                 s.Shadow = true;
                 s.Anchor = Anchor.BottomCentre;
                 s.Origin = Anchor.BottomCentre;
             })
             {
                 AutoSizeAxes     = Axes.Y,
                 RelativeSizeAxes = Axes.X,
                 Anchor           = Anchor.BottomCentre,
                 Origin           = Anchor.BottomCentre
             }
         }
     };
 }
 public void Setup() => Schedule(() =>
 {
     Child = new Container
     {
         Anchor       = Anchor.Centre,
         Origin       = Anchor.Centre,
         Width        = 300,
         AutoSizeAxes = Axes.Y,
         Children     = new Drawable[]
         {
             new Box
             {
                 RelativeSizeAxes = Axes.Both,
                 Colour           = Color4.White.Opacity(0.1f)
             },
             textContainer = new TextFlowContainer
             {
                 RelativeSizeAxes = Axes.X,
                 AutoSizeAxes     = Axes.Y,
                 Text             = default_text
             }
         }
     };
 });
예제 #29
0
        private void load(OsuColour colours, OverlayColourProvider colourProvider)
        {
            foreach (var categoryEntries in Build.ChangelogEntries.GroupBy(b => b.Category).OrderBy(c => c.Key))
            {
                ChangelogEntries.Add(new OsuSpriteText
                {
                    Text   = categoryEntries.Key,
                    Font   = OsuFont.GetFont(weight: FontWeight.Bold, size: 18),
                    Margin = new MarginPadding {
                        Top = 35, Bottom = 15
                    },
                });

                var fontLarge  = OsuFont.GetFont(size: 16);
                var fontMedium = OsuFont.GetFont(size: 12);

                foreach (var entry in categoryEntries)
                {
                    var entryColour = entry.Major ? colours.YellowLight : Color4.White;

                    LinkFlowContainer title;

                    var titleContainer = new Container
                    {
                        AutoSizeAxes     = Axes.Y,
                        RelativeSizeAxes = Axes.X,
                        Margin           = new MarginPadding {
                            Vertical = 5
                        },
                        Children = new Drawable[]
                        {
                            new SpriteIcon
                            {
                                Anchor = Anchor.CentreLeft,
                                Origin = Anchor.CentreRight,
                                Size   = new Vector2(10),
                                Icon   = entry.Type == ChangelogEntryType.Fix ? FontAwesome.Solid.Check : FontAwesome.Solid.Plus,
                                Colour = entryColour.Opacity(0.5f),
                                Margin = new MarginPadding {
                                    Right = 5
                                },
                            },
                            title = new LinkFlowContainer
                            {
                                Direction        = FillDirection.Full,
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                            }
                        }
                    };

                    title.AddText(entry.Title, t =>
                    {
                        t.Font   = fontLarge;
                        t.Colour = entryColour;
                    });

                    if (!string.IsNullOrEmpty(entry.Repository))
                    {
                        title.AddText(" (", t =>
                        {
                            t.Font   = fontLarge;
                            t.Colour = entryColour;
                        });
                        title.AddLink($"{entry.Repository.Replace("ppy/", "")}#{entry.GithubPullRequestId}", entry.GithubUrl,
                                      creationParameters: t =>
                        {
                            t.Font   = fontLarge;
                            t.Colour = entryColour;
                        });
                        title.AddText(")", t =>
                        {
                            t.Font   = fontLarge;
                            t.Colour = entryColour;
                        });
                    }

                    title.AddText("by ", t =>
                    {
                        t.Font    = fontMedium.With(italics: true);
                        t.Colour  = entryColour;
                        t.Padding = new MarginPadding {
                            Left = 10
                        };
                    });

                    if (entry.GithubUser.UserId != null)
                    {
                        title.AddUserLink(new User
                        {
                            Username = entry.GithubUser.OsuUsername,
                            Id       = entry.GithubUser.UserId.Value
                        }, t =>
                        {
                            t.Font   = fontMedium.With(italics: true);
                            t.Colour = entryColour;
                        });
                    }
                    else if (entry.GithubUser.GithubUrl != null)
                    {
                        title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t =>
                        {
                            t.Font   = fontMedium.With(italics: true);
                            t.Colour = entryColour;
                        });
                    }
                    else
                    {
                        title.AddText(entry.GithubUser.DisplayName, t =>
                        {
                            t.Font   = fontMedium.With(italics: true);
                            t.Colour = entryColour;
                        });
                    }

                    ChangelogEntries.Add(titleContainer);

                    if (!string.IsNullOrEmpty(entry.MessageHtml))
                    {
                        var message = new TextFlowContainer
                        {
                            AutoSizeAxes     = Axes.Y,
                            RelativeSizeAxes = Axes.X,
                        };

                        // todo: use markdown parsing once API returns markdown
                        message.AddText(WebUtility.HtmlDecode(Regex.Replace(entry.MessageHtml, @"<(.|\n)*?>", string.Empty)), t =>
                        {
                            t.Font   = fontMedium;
                            t.Colour = colourProvider.Foreground1;
                        });

                        ChangelogEntries.Add(message);
                    }
                }
            }
        }
예제 #30
0
        public PreviousUsernames()
        {
            HoverIconContainer hoverIcon;

            AutoSizeAxes = Axes.Y;
            Width        = width;
            Masking      = true;
            CornerRadius = 5;

            AddRangeInternal(new Drawable[]
            {
                background = new Box
                {
                    RelativeSizeAxes = Axes.Both,
                },
                new GridContainer
                {
                    AutoSizeAxes     = Axes.Y,
                    RelativeSizeAxes = Axes.X,
                    RowDimensions    = new[]
                    {
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(GridSizeMode.AutoSize)
                    },
                    ColumnDimensions = new[]
                    {
                        new Dimension(GridSizeMode.AutoSize),
                        new Dimension(GridSizeMode.Distributed)
                    },
                    Content = new[]
                    {
                        new Drawable[]
                        {
                            hoverIcon = new HoverIconContainer(),
                            header    = new SpriteText
                            {
                                Anchor = Anchor.BottomLeft,
                                Origin = Anchor.BottomLeft,
                                Text   = @"formerly known as",
                                Font   = OsuFont.GetFont(size: 10, italics: true)
                            }
                        },
                        new Drawable[]
                        {
                            new Container
                            {
                                RelativeSizeAxes = Axes.Both,
                            },
                            text = new TextFlowContainer(s => s.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold, italics: true))
                            {
                                RelativeSizeAxes = Axes.X,
                                AutoSizeAxes     = Axes.Y,
                                Direction        = FillDirection.Full,
                                Margin           = new MarginPadding {
                                    Bottom = margin, Top = margin / 2f
                                }
                            }
                        }
                    }
                }
            });

            hoverIcon.ActivateHover += showContent;
            hideContent();
        }