/// <summary> /// Blits sprite to OpenGL display with specified parameters. /// </summary> public abstract void Draw(Quad vertexQuad, RectangleF?textureRect, ColourInfo drawColour, VertexBatch <TexturedVertex2D> spriteBatch = null, Vector2?inflationPercentage = null);
protected OnlinePlayScreen() { Anchor = Anchor.Centre; Origin = Anchor.Centre; RelativeSizeAxes = Axes.Both; Padding = new MarginPadding { Horizontal = -HORIZONTAL_OVERFLOW_PADDING }; var backgroundColour = Color4Extensions.FromHex(@"3e3a44"); InternalChild = waves = new MultiplayerWaveContainer { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = backgroundColour, }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = Header.HEIGHT }, Children = new[] { header = new Container { RelativeSizeAxes = Axes.X, Height = 400, Children = new[] { headerBackground = new Container { RelativeSizeAxes = Axes.Both, Width = 1.25f, Masking = true, Children = new Drawable[] { new HeaderBackgroundSprite { RelativeSizeAxes = Axes.X, Height = 400 // Keep a static height so the header doesn't change as it's resized between subscreens }, } }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Bottom = -1 }, // 1px padding to avoid a 1px gap due to masking Child = new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(backgroundColour.Opacity(0.5f), backgroundColour) }, } } }, screenStack = new OnlinePlaySubScreenStack { RelativeSizeAxes = Axes.Both } } }, new Header(ScreenTitle, screenStack), createButton = CreateNewMultiplayerGameButton().With(button => { button.Anchor = Anchor.TopRight; button.Origin = Anchor.TopRight; button.Size = new Vector2(150, Header.HEIGHT - 20); button.Margin = new MarginPadding { Top = 10, Right = 10 + HORIZONTAL_OVERFLOW_PADDING, }; button.Action = () => OpenNewRoom(); }), RoomManager = CreateRoomManager() } }; screenStack.ScreenPushed += screenPushed; screenStack.ScreenExited += screenExited; screenStack.Push(loungeSubScreen = CreateLounge()); }
public ProfileHeader(User user) { RelativeSizeAxes = Axes.X; Height = cover_height + info_height; Children = new Drawable[] { coverContainer = new Container { RelativeSizeAxes = Axes.X, Height = cover_height, Masking = true, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.75f)) }, new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN, Bottom = 20, Right = stats_width + UserProfileOverlay.CONTENT_X_MARGIN }, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Children = new Drawable[] { new UpdateableAvatar { User = user, Size = new Vector2(avatar_size), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Masking = true, CornerRadius = 5, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Colour = Color4.Black.Opacity(0.25f), Radius = 4, }, }, new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, X = avatar_size + 10, AutoSizeAxes = Axes.Both, Children = new Drawable[] { SupporterTag = new SupporterIcon { Alpha = 0, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Y = -75, Size = new Vector2(25, 25) }, new FillFlowContainer { Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Y = -48, Children = new Drawable[] { new OsuSpriteText { Text = user.Username, Font = @"Exo2.0-RegularItalic", TextSize = 30, }, new ExternalLinkButton($@"https://osu.ppy.sh/users/{user.Id}") { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Margin = new MarginPadding { Left = 3, Bottom = 3 }, //To better lineup with the font }, } }, countryFlag = new DrawableFlag(user.Country) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Width = 30, Height = 20 } } }, badgeContainer = new BadgeContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Origin = Anchor.BottomLeft, Margin = new MarginPadding { Bottom = 5 }, Alpha = 0, }, } }, colourBar = new Box { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, X = UserProfileOverlay.CONTENT_X_MARGIN, Height = 5, Width = info_width, Alpha = 0 } } }, new Box // this is a temporary workaround for incorrect masking behaviour of FillMode.Fill used in UserCoverBackground (see https://github.com/ppy/osu-framework/issues/1675) { RelativeSizeAxes = Axes.X, Height = 1, Y = cover_height, Colour = OsuColour.Gray(34), }, infoTextLeft = new LinkFlowContainer(t => t.TextSize = 14) { X = UserProfileOverlay.CONTENT_X_MARGIN, Y = cover_height + 20, Width = info_width, AutoSizeAxes = Axes.Y, ParagraphSpacing = 0.8f, LineSpacing = 0.2f }, infoTextRight = new LinkFlowContainer(t => { t.TextSize = 14; t.Font = @"Exo2.0-RegularItalic"; }) { X = UserProfileOverlay.CONTENT_X_MARGIN + info_width + 20, Y = cover_height + 20, Width = info_width, AutoSizeAxes = Axes.Y, ParagraphSpacing = 0.8f, LineSpacing = 0.2f }, new Container { X = -UserProfileOverlay.CONTENT_X_MARGIN, RelativeSizeAxes = Axes.Y, Width = stats_width, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Y = level_position, Height = level_height, Children = new Drawable[] { new Box { Colour = Color4.Black.Opacity(0.5f), RelativeSizeAxes = Axes.Both }, levelBadge = new Sprite { Anchor = Anchor.Centre, Origin = Anchor.Centre, Height = 50, Width = 50, Alpha = 0 }, levelText = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = 11, TextSize = 20 } } }, new Container { RelativeSizeAxes = Axes.X, Y = cover_height, Anchor = Anchor.TopCentre, Origin = Anchor.BottomCentre, Height = cover_height - level_height - level_position - 5, Children = new Drawable[] { new Box { Colour = Color4.Black.Opacity(0.5f), RelativeSizeAxes = Axes.Both }, scoreText = new FillFlowContainer <SpriteText> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Padding = new MarginPadding { Horizontal = 20, Vertical = 18 }, Spacing = new Vector2(0, 2) }, scoreNumberText = new FillFlowContainer <SpriteText> { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Padding = new MarginPadding { Horizontal = 20, Vertical = 18 }, Spacing = new Vector2(0, 2) }, new FillFlowContainer <GradeBadge> { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Y = -64, Spacing = new Vector2(20, 0), Children = new[] { gradeSSPlus = new GradeBadge("SSPlus") { Alpha = 0 }, gradeSS = new GradeBadge("SS") { Alpha = 0 }, } }, new FillFlowContainer <GradeBadge> { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Y = -18, Spacing = new Vector2(20, 0), Children = new[] { gradeSPlus = new GradeBadge("SPlus") { Alpha = 0 }, gradeS = new GradeBadge("S") { Alpha = 0 }, gradeA = new GradeBadge("A") { Alpha = 0 }, } } } }, new Container { RelativeSizeAxes = Axes.X, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Height = info_height - 15, Children = new Drawable[] { new Box { Colour = Color4.Black.Opacity(0.25f), RelativeSizeAxes = Axes.Both }, rankGraph = new RankGraph { RelativeSizeAxes = Axes.Both } } } } } }; }
private void load(OsuColour colours) { const float user_header_height = 120; Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = user_header_height }, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.White, }, } }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new UserHeader(Score.User) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, Height = user_header_height, }, new UpdateableRank(Score.Rank) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Size = new Vector2(150, 60), Margin = new MarginPadding(20), }, scoreContainer = new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, Height = 60, Children = new Drawable[] { new SongProgressGraph { RelativeSizeAxes = Axes.Both, Alpha = 0.5f, Objects = Beatmap.Beatmap.HitObjects, }, scoreCounter = new SlowScoreCounter(6) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = colours.PinkDarker, Y = 10, TextSize = 56, }, } }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = colours.PinkDarker, Shadow = false, Font = OsuFont.GetFont(weight: FontWeight.Bold), Text = "total score", Margin = new MarginPadding { Bottom = 15 }, }, new BeatmapDetails(Beatmap.BeatmapInfo) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Margin = new MarginPadding { Bottom = 10 }, }, new DateTimeDisplay(Score.Date.LocalDateTime) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, new Container { RelativeSizeAxes = Axes.X, Size = new Vector2(0.75f, 1), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Margin = new MarginPadding { Top = 10, Bottom = 10 }, Children = new Drawable[] { new Box { Colour = ColourInfo.GradientHorizontal( colours.GrayC.Opacity(0), colours.GrayC.Opacity(0.9f)), RelativeSizeAxes = Axes.Both, Size = new Vector2(0.5f, 1), }, new Box { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Colour = ColourInfo.GradientHorizontal( colours.GrayC.Opacity(0.9f), colours.GrayC.Opacity(0)), RelativeSizeAxes = Axes.Both, Size = new Vector2(0.5f, 1), }, } }, statisticsContainer = new FillFlowContainer <DrawableScoreStatistic> { AutoSizeAxes = Axes.Both, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Direction = FillDirection.Horizontal, LayoutDuration = 200, LayoutEasing = Easing.OutQuint }, }, }, new FillFlowContainer { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Margin = new MarginPadding { Bottom = 10 }, Spacing = new Vector2(5), AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Children = new Drawable[] { new ReplayDownloadButton(score), new RetryButton() } }, }; statisticsContainer.ChildrenEnumerable = Score.Statistics.OrderByDescending(p => p.Key).Select(s => new DrawableScoreStatistic(s)); }
private void createColourBars(OsuColour colours) { var windows = HitWindows.GetAllAvailableWindows().ToArray(); // max to avoid div-by-zero. maxHitWindow = Math.Max(1, windows.First().length); for (int i = 0; i < windows.Length; i++) { (var result, double length) = windows[i]; float hitWindow = (float)(length / maxHitWindow); colourBarsEarly.Add(createColourBar(result, hitWindow, i == 0)); colourBarsLate.Add(createColourBar(result, hitWindow, i == 0)); } // a little nub to mark the centre point. var centre = createColourBar(windows.Last().result, 0.01f); centre.Anchor = centre.Origin = Anchor.CentreLeft; centre.Width = 2.5f; colourBars.Add(centre); Drawable createColourBar(HitResult result, float height, bool first = false) { var colour = GetColourForHitResult(result); if (first) { // the first bar needs gradient rendering. const float gradient_start = 0.8f; return(new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = colour, Height = height * gradient_start }, new Box { RelativeSizeAxes = Axes.Both, RelativePositionAxes = Axes.Both, Colour = ColourInfo.GradientVertical(colour, colour.Opacity(0)), Y = gradient_start, Height = height * (1 - gradient_start) }, } }); } return(new Box { RelativeSizeAxes = Axes.Both, Colour = colour, Height = height }); } }
public Header() { RelativeSizeAxes = Axes.X; Height = 400; Masking = true; EdgeEffect = new EdgeEffectParameters { Colour = Color4.Black.Opacity(0.25f), Type = EdgeEffectType.Shadow, Radius = 3, Offset = new Vector2(0f, 1f), }; Container noVideoButtons; FillFlowContainer videoButtons; Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = tabs_height, Children = new[] { tabsBg = new Box { RelativeSizeAxes = Axes.Both, }, }, }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = tabs_height }, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, coverContainer = new Container { RelativeSizeAxes = Axes.Both, }, new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.3f), Color4.Black.Opacity(0.8f)), }, }, }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = 20, Bottom = 30, Horizontal = BeatmapSetOverlay.X_PADDING }, Child = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = 113, Child = Picker = new BeatmapPicker(), }, title = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", TextSize = 37, }, artist = new OsuSpriteText { Font = @"Exo2.0-SemiBoldItalic", TextSize = 25, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Top = 20 }, Child = author = new AuthorInfo(), }, new Container { RelativeSizeAxes = Axes.X, Height = buttons_height, Margin = new MarginPadding { Top = 10 }, Children = new Drawable[] { new FavouriteButton(), new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = buttons_height + buttons_spacing }, Children = new Drawable[] { noVideoButtons = new Container { RelativeSizeAxes = Axes.Both, Alpha = 0f, Child = new DownloadButton("Download", @""), }, videoButtons = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Spacing = new Vector2(buttons_spacing), Alpha = 0f, Children = new[] { new DownloadButton("Download", "with Video"), new DownloadButton("Download", "without Video"), }, }, }, }, }, }, }, }, }, details = new Details { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding { Right = BeatmapSetOverlay.X_PADDING }, }, }, }, }; Picker.Beatmap.ValueChanged += b => { details.Beatmap = b; if (b.OnlineInfo.HasVideo) { noVideoButtons.FadeOut(transition_duration); videoButtons.FadeIn(transition_duration); } else { noVideoButtons.FadeIn(transition_duration); videoButtons.FadeOut(transition_duration); } }; }
private void load() { var user = User.User; var backgroundColour = Color4Extensions.FromHex("#33413C"); InternalChild = new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.Absolute, 18), new Dimension(GridSizeMode.AutoSize), new Dimension(), new Dimension(GridSizeMode.AutoSize), }, Content = new[] { new Drawable[] { crown = new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Icon = FontAwesome.Solid.Crown, Size = new Vector2(14), Colour = Color4Extensions.FromHex("#F7E65D"), Alpha = 0 }, new TeamDisplay(User), new Container { RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = 5, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = backgroundColour }, new UserCoverBackground { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Both, Width = 0.75f, User = user, Colour = ColourInfo.GradientHorizontal(Color4.White.Opacity(0), Color4.White.Opacity(0.25f)) }, new FillFlowContainer { RelativeSizeAxes = Axes.Both, Spacing = new Vector2(10), Direction = FillDirection.Horizontal, Children = new Drawable[] { new UpdateableAvatar { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, User = user }, new UpdateableFlag { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(30, 20), Country = user?.Country }, new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18), Text = user?.Username }, userRankText = new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(size: 14), } } }, new Container { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Right = 70 }, Child = userModsDisplay = new ModDisplay { Scale = new Vector2(0.5f), ExpansionMode = ExpansionMode.AlwaysContracted, } }, userStateDisplay = new StateDisplay { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Margin = new MarginPadding { Right = 10 }, } } }, kickButton = new KickButton { Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0, Margin = new MarginPadding(4), Action = () => Client.KickUser(User.UserID), }, }, } }; }
public DrawColourInfo(ColourInfo?colour = null, BlendingParameters?blending = null) { Colour = colour ?? ColourInfo.SingleColour(Color4.White); Blending = blending ?? BlendingParameters.Inherit; }
private void load(OsuColour colours) { BeatmapSelectButton beatmapButton; ModDisplay modDisplay; InternalChildren = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Masking = true, Children = new Drawable[] { new HeaderBackgroundSprite { RelativeSizeAxes = Axes.Both }, new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.7f), Color4.Black.Opacity(0.8f)), }, beatmapPanel = new MatchBeatmapPanel { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Margin = new MarginPadding { Right = 100 }, } } }, new Box { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, Height = 1, Colour = colours.Yellow }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING }, Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Padding = new MarginPadding { Top = 20 }, Direction = FillDirection.Vertical, Children = new Drawable[] { new BeatmapTypeInfo(), modDisplay = new ModDisplay { Scale = new Vector2(0.75f), DisplayUnrankedText = false }, } }, new Container { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.Y, Width = 200, Padding = new MarginPadding { Vertical = 10 }, Child = beatmapButton = new BeatmapSelectButton { RelativeSizeAxes = Axes.Both, Height = 1, }, }, Tabs = new MatchTabControl { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X }, }, }, }; CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods?.ToArray() ?? Array.Empty <Mod>(), true); beatmapButton.Action = () => RequestBeatmapSelection?.Invoke(); }
public NewsArticleCover(ArticleInfo info) { RelativeSizeAxes = Axes.X; Masking = true; CornerRadius = 4; NewsBackground bg; Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(OsuColour.Gray(0.2f), OsuColour.Gray(0.1f)) }, new DelayedLoadWrapper(bg = new NewsBackground(info.CoverUrl) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, Alpha = 0 }) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, }, gradient = new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.1f), Color4.Black.Opacity(0.7f)), Alpha = 0 }, new DateContainer(info.Time) { Margin = new MarginPadding { Right = 20, Top = 20, } }, new OsuSpriteText { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Margin = new MarginPadding { Left = 25, Bottom = 50, }, Font = OsuFont.GetFont(Typeface.Torus, 24, FontWeight.Bold), Text = info.Title, }, new OsuSpriteText { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Margin = new MarginPadding { Left = 25, Bottom = 30, }, Font = OsuFont.GetFont(Typeface.Torus, 16, FontWeight.Bold), Text = "by " + info.Author } }; bg.OnLoadComplete += d => d.FadeIn(250, Easing.In); }
private void load(OverlayColourProvider colours) { ButtonsContainer = new Container { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X }; InternalChildren = new[] { // This resolves internal 1px gaps due to applying the (parenting) corner radius and masking across multiple filling background sprites. new Box { RelativeSizeAxes = Axes.Both, Colour = colours.Background5, }, CreateBackground().With(d => { d.RelativeSizeAxes = Axes.Both; }), wrapper = new DelayedLoadWrapper(() => new Container { Name = @"Room content", RelativeSizeAxes = Axes.Both, // This negative padding resolves 1px gaps between this background and the background above. Padding = new MarginPadding { Left = 20, Vertical = -0.5f }, Child = new Container { RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = CORNER_RADIUS, Children = new Drawable[] { new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.Relative, 0.2f) }, Content = new[] { new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = colours.Background5, }, new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientHorizontal(colours.Background5, colours.Background5.Opacity(0.3f)) }, } } }, new Container { Name = @"Left details", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = 20, Vertical = 5 }, Children = new Drawable[] { new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(5), Children = new Drawable[] { new RoomStatusPill { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft }, specialCategoryPill = new RoomSpecialCategoryPill { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft }, endDateInfo = new EndDateInfo { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, } }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Top = 3 }, Direction = FillDirection.Vertical, Children = new Drawable[] { new RoomNameText(), new RoomStatusText() } } }, }, new FillFlowContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(5), Children = new Drawable[] { new PlaylistCountPill { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, new StarRatingRangeDisplay { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Scale = new Vector2(0.8f) } } } } }, new FillFlowContainer { Name = "Right content", Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Spacing = new Vector2(5), Padding = new MarginPadding { Right = 10, Vertical = 20, }, Children = new Drawable[] { ButtonsContainer, drawableRoomParticipantsList = new DrawableRoomParticipantsList { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, NumberOfCircles = NumberOfAvatars } } }, passwordIcon = new PasswordProtectedIcon { Alpha = 0 } }, }, }, 0) { RelativeSizeAxes = Axes.Both, } }; }
public Column() { RelativeSizeAxes = Axes.Y; Width = column_width; Children = new Drawable[] { background = new Box { Name = "Foreground", RelativeSizeAxes = Axes.Both, Alpha = 0.2f }, new Container { Name = "Hit target + hit objects", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = ManiaPlayfield.HIT_TARGET_POSITION }, Children = new Drawable[] { new Container { Name = "Hit target", RelativeSizeAxes = Axes.X, Height = hit_target_height, Children = new Drawable[] { new Box { Name = "Background", RelativeSizeAxes = Axes.Both, Colour = Color4.Black }, hitTargetBar = new Container { Name = "Bar", RelativeSizeAxes = Axes.X, Height = hit_target_bar_height, Masking = true, Children = new[] { new Box { RelativeSizeAxes = Axes.Both } } } } }, speedAdjustments = new SpeedAdjustmentCollection(Axes.Y) { Name = "Hit objects", RelativeSizeAxes = Axes.Both, VisibleTimeRange = VisibleTimeRange }, // For column lighting, we need to capture input events before the notes new InputTarget { KeyDown = onKeyDown, KeyUp = onKeyUp } } }, new Container { Name = "Key", RelativeSizeAxes = Axes.X, Height = ManiaPlayfield.HIT_TARGET_POSITION, Children = new Drawable[] { new Box { Name = "Key gradient", RelativeSizeAxes = Axes.Both, ColourInfo = ColourInfo.GradientVertical(Color4.Black, Color4.Black.Opacity(0)), Alpha = 0.5f }, keyIcon = new Container { Name = "Key icon", Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(key_icon_size), Masking = true, CornerRadius = key_icon_corner_radius, BorderThickness = 2, BorderColour = Color4.White, // Not true Children = new[] { new Box { RelativeSizeAxes = Axes.Both, Alpha = 0, AlwaysPresent = true } } } } } }; }
/// <summary> /// Blits sprite to OpenGL display with specified parameters. /// </summary> public override void Draw(Quad vertexQuad, RectangleF?textureRect, ColourInfo drawColour, Action <TexturedVertex2D> vertexAction = null, Vector2?inflationPercentage = null) { parent.Draw(vertexQuad, BoundsInParent(textureRect), drawColour, vertexAction, inflationPercentage); }
/// <summary> /// Blits sprite to OpenGL display with specified parameters. /// </summary> public abstract void Draw(Quad vertexQuad, RectangleF?textureRect, ColourInfo drawColour, Action <TexturedVertex2D> vertexAction = null, Vector2?inflationPercentage = null);
private void updateGlow() { leftGlow.ColourInfo = ColourInfo.GradientHorizontal(new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f), ButtonColour); centerGlow.Colour = ButtonColour; rightGlow.ColourInfo = ColourInfo.GradientHorizontal(ButtonColour, new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f)); }
public override void Draw(Action <TexturedVertex2D> vertexAction) { if (Shared.VertexBuffer == null) { Shared.VertexBuffer = new QuadVertexBuffer <TexturedVertex2D>(max_sprites, BufferUsageHint.DynamicDraw); } Shader.GetUniform <float>("g_FadeClock").Value = Time; int updateStart = -1, updateEnd = 0; for (int i = 0; i < Parts.Length; ++i) { if (Parts[i].WasUpdated) { if (updateStart == -1) { updateStart = i; } updateEnd = i + 1; int start = i * 4; int end = start; Vector2 pos = Parts[i].Position; ColourInfo colour = DrawInfo.Colour; colour.TopLeft.Linear.A = Parts[i].Time + colour.TopLeft.Linear.A; colour.TopRight.Linear.A = Parts[i].Time + colour.TopRight.Linear.A; colour.BottomLeft.Linear.A = Parts[i].Time + colour.BottomLeft.Linear.A; colour.BottomRight.Linear.A = Parts[i].Time + colour.BottomRight.Linear.A; Texture.DrawQuad( new Quad(pos.X - Size.X / 2, pos.Y - Size.Y / 2, Size.X, Size.Y), colour, null, v => Shared.VertexBuffer.Vertices[end++] = v); Parts[i].WasUpdated = false; } else if (updateStart != -1) { Shared.VertexBuffer.UpdateRange(updateStart * 4, updateEnd * 4); updateStart = -1; } } // Update all remaining vertices that have been changed. if (updateStart != -1) { Shared.VertexBuffer.UpdateRange(updateStart * 4, updateEnd * 4); } base.Draw(vertexAction); Shader.Bind(); Texture.TextureGL.Bind(); Shared.VertexBuffer.Draw(); Shader.Unbind(); }
private void load(GameHost host) { InternalChildren = new Drawable[] { new SmoothCircularProgress { Name = "Background circle", Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(47), Alpha = 0.5f, InnerRadius = accuracy_circle_radius + 0.01f, // Extends a little bit into the circle Current = { Value = 1 }, }, accuracyCircle = new SmoothCircularProgress { Name = "Accuracy circle", Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4Extensions.FromHex("#7CF6FF"), Color4Extensions.FromHex("#BAFFA9")), InnerRadius = accuracy_circle_radius, }, new BufferedContainer { Name = "Graded circles", Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Size = new Vector2(0.8f), Padding = new MarginPadding(2), Children = new Drawable[] { new SmoothCircularProgress { RelativeSizeAxes = Axes.Both, Colour = OsuColour.ForRank(ScoreRank.X), InnerRadius = RANK_CIRCLE_RADIUS, Current = { Value = 1 } }, new SmoothCircularProgress { RelativeSizeAxes = Axes.Both, Colour = OsuColour.ForRank(ScoreRank.S), InnerRadius = RANK_CIRCLE_RADIUS, Current = { Value = 1 - virtual_ss_percentage } }, new SmoothCircularProgress { RelativeSizeAxes = Axes.Both, Colour = OsuColour.ForRank(ScoreRank.A), InnerRadius = RANK_CIRCLE_RADIUS, Current = { Value = 0.95f } }, new SmoothCircularProgress { RelativeSizeAxes = Axes.Both, Colour = OsuColour.ForRank(ScoreRank.B), InnerRadius = RANK_CIRCLE_RADIUS, Current = { Value = 0.9f } }, new SmoothCircularProgress { RelativeSizeAxes = Axes.Both, Colour = OsuColour.ForRank(ScoreRank.C), InnerRadius = RANK_CIRCLE_RADIUS, Current = { Value = 0.8f } }, new SmoothCircularProgress { RelativeSizeAxes = Axes.Both, Colour = OsuColour.ForRank(ScoreRank.D), InnerRadius = RANK_CIRCLE_RADIUS, Current = { Value = 0.7f } }, new RankNotch(0), new RankNotch((float)(1 - virtual_ss_percentage)), new RankNotch(0.95f), new RankNotch(0.9f), new RankNotch(0.8f), new RankNotch(0.7f), new BufferedContainer { Name = "Graded circle mask", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(1), Blending = new BlendingParameters { Source = BlendingType.DstColor, Destination = BlendingType.OneMinusSrcAlpha, SourceAlpha = BlendingType.One, DestinationAlpha = BlendingType.SrcAlpha }, Child = innerMask = new SmoothCircularProgress { RelativeSizeAxes = Axes.Both, InnerRadius = RANK_CIRCLE_RADIUS - 0.01f, } } } }, badges = new Container <RankBadge> { Name = "Rank badges", RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Vertical = -15, Horizontal = -20 }, Children = new[] { new RankBadge(1f, getRank(ScoreRank.X)), new RankBadge(0.95f, getRank(ScoreRank.S)), new RankBadge(0.9f, getRank(ScoreRank.A)), new RankBadge(0.8f, getRank(ScoreRank.B)), new RankBadge(0.7f, getRank(ScoreRank.C)), new RankBadge(0.35f, getRank(ScoreRank.D)), } }, rankText = new RankText(score.Rank) }; if (withFlair) { AddRangeInternal(new Drawable[] { rankImpactSound = new PoolableSkinnableSample(new SampleInfo(impactSampleName)), rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", applauseSampleName)), scoreTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/score-tick")), badgeTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink")), badgeMaxSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink-max")), swooshUpSound = new PoolableSkinnableSample(new SampleInfo(@"Results/swoosh-up")), }); } }
/// <summary> /// Smoothly adjusts <see cref="Drawable.Colour"/> over time. /// </summary> /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> public static TransformSequence <T> FadeColour <T>(this T drawable, ColourInfo newColour, double duration = 0, Easing easing = Easing.None) where T : Drawable => drawable.TransformTo(nameof(drawable.Colour), newColour, duration, easing);
private void load(OsuColour colours) { InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex(@"343138"), }, new GridContainer { RelativeSizeAxes = Axes.Both, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Distributed), }, Content = new[] { new Drawable[] { new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = 200, Masking = true, Children = new Drawable[] { new MultiplayerBackgroundSprite { RelativeSizeAxes = Axes.Both }, new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)), }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(20), Children = new Drawable[] { participantCount = new ParticipantCountDisplay { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, }, name = new OsuSpriteText { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Font = OsuFont.GetFont(size: 30), Current = RoomName }, }, }, }, }, new StatusColouredContainer(transition_duration) { RelativeSizeAxes = Axes.X, Height = 5, Child = new Box { RelativeSizeAxes = Axes.Both } }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex(@"28242d"), }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, LayoutDuration = transition_duration, Padding = contentPadding, Spacing = new Vector2(0f, 5f), Children = new Drawable[] { new StatusColouredContainer(transition_duration) { AutoSizeAxes = Axes.Both, Child = new StatusText { Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14), } }, beatmapTypeInfo = new BeatmapTypeInfo(), }, }, }, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = contentPadding, Children = new Drawable[] { participantInfo = new ParticipantInfo(), }, }, }, }, }, new Drawable[] { new MatchParticipants { RelativeSizeAxes = Axes.Both, } } } } }; Status.BindValueChanged(_ => updateStatus(), true); RoomID.BindValueChanged(_ => updateStatus(), true); }
/// <summary> /// Instantaneously flashes <see cref="Drawable.Colour"/>, then smoothly changes it back over time. /// </summary> /// <returns>A <see cref="TransformSequence{T}"/> to which further transforms can be added.</returns> public static TransformSequence <T> FlashColour <T>(this T drawable, ColourInfo flashColour, double duration, Easing easing = Easing.None) where T : Drawable { ColourInfo endValue = (drawable.Transforms.LastOrDefault(t => t.TargetMember == nameof(drawable.Colour)) as Transform <ColourInfo>)?.EndValue ?? drawable.Colour; return(drawable.FadeColour(flashColour).FadeColour(endValue, duration, easing)); }
public BufferedWedgeInfo(WorkingBeatmap beatmap) { BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; BeatmapMetadata metadata = beatmapInfo.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); List <InfoLabel> labels = new List <InfoLabel>(); if (beatmap.Beatmap != null) { HitObject lastObject = beatmap.Beatmap.HitObjects.LastOrDefault(); double endTime = (lastObject as IHasEndTime)?.EndTime ?? lastObject?.StartTime ?? 0; labels.Add(new InfoLabel(new BeatmapStatistic { Name = "Length", Icon = FontAwesome.fa_clock_o, Content = beatmap.Beatmap.HitObjects.Count == 0 ? "-" : TimeSpan.FromMilliseconds(endTime - beatmap.Beatmap.HitObjects.First().StartTime).ToString(@"m\:ss"), })); labels.Add(new InfoLabel(new BeatmapStatistic { Name = "BPM", Icon = FontAwesome.fa_circle, Content = getBPMRange(beatmap.Beatmap), })); //get statistics from the current ruleset. labels.AddRange(beatmapInfo.Ruleset.CreateInstance().GetBeatmapStatistics(beatmap).Select(s => new InfoLabel(s))); } PixelSnapping = true; CacheDrawnFrameBuffer = true; RelativeSizeAxes = Axes.Both; Children = new Drawable[] { // We will create the white-to-black gradient by modulating transparency and having // a black backdrop. This results in an sRGB-space gradient and not linear space, // transitioning from white to black more perceptually uniformly. new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, // We use a container, such that we can set the colour gradient to go across the // vertices of the masked container instead of the vertices of the (larger) sprite. new Container { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)), Children = new[] { // Zoomed-in and cropped beatmap background new BeatmapBackgroundSprite(beatmap) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, }, }, }, new DifficultyColourBar(beatmap.BeatmapInfo) { RelativeSizeAxes = Axes.Y, Width = 20, }, new FillFlowContainer { Name = "Top-aligned metadata", Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new OsuSpriteText { Font = @"Exo2.0-MediumItalic", Text = beatmapInfo.Version, TextSize = 24, }, } }, new FillFlowContainer { Name = "Bottom-aligned metadata", Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = 15, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new OsuSpriteText { Font = @"Exo2.0-MediumItalic", Text = !string.IsNullOrEmpty(metadata.Source) ? metadata.Source + " — " + metadata.Title : metadata.Title, TextSize = 28, }, new OsuSpriteText { Font = @"Exo2.0-MediumItalic", Text = metadata.Artist, TextSize = 17, }, new FillFlowContainer { Margin = new MarginPadding { Top = 10 }, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, Children = new[] { new OsuSpriteText { Font = @"Exo2.0-Medium", Text = "mapped by ", TextSize = 15, }, new OsuSpriteText { Font = @"Exo2.0-Bold", Text = metadata.Author, TextSize = 15, }, } }, new FillFlowContainer { Margin = new MarginPadding { Top = 20, Left = 10 }, Spacing = new Vector2(40, 0), AutoSizeAxes = Axes.Both, Children = labels }, } }, }; }
public Header() { ExternalLinkButton externalLink; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Masking = true; EdgeEffect = new EdgeEffectParameters { Colour = Color4.Black.Opacity(0.25f), Type = EdgeEffectType.Shadow, Radius = 3, Offset = new Vector2(0f, 1f), }; InternalChildren = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = tabs_height, Children = new[] { tabsBg = new Box { RelativeSizeAxes = Axes.Both, }, }, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Top = tabs_height }, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { cover = new UpdateableBeatmapSetCover { RelativeSizeAxes = Axes.Both, Masking = true, }, new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.3f), Color4.Black.Opacity(0.8f)), }, }, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Top = 20, Bottom = 30, Left = BeatmapSetOverlay.X_PADDING, Right = BeatmapSetOverlay.X_PADDING + BeatmapSetOverlay.RIGHT_WIDTH, }, Children = new Drawable[] { fadeContent = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Child = Picker = new BeatmapPicker(), }, new FillFlowContainer { Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, Children = new Drawable[] { title = new OsuSpriteText { Font = OsuFont.GetFont(size: 37, weight: FontWeight.Bold, italics: true) }, externalLink = new ExternalLinkButton { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Margin = new MarginPadding { Left = 3, Bottom = 4 }, //To better lineup with the font }, } }, artist = new OsuSpriteText { Font = OsuFont.GetFont(size: 25, weight: FontWeight.SemiBold, italics: true) }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Top = 20 }, Child = author = new AuthorInfo(), }, beatmapAvailability = new BeatmapAvailability(), new Container { RelativeSizeAxes = Axes.X, Height = buttons_height, Margin = new MarginPadding { Top = 10 }, Children = new Drawable[] { favouriteButton = new FavouriteButton(), downloadButtonsContainer = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = buttons_height + buttons_spacing }, Spacing = new Vector2(buttons_spacing), }, }, }, }, }, } }, loading = new LoadingAnimation { Anchor = Anchor.Centre, Origin = Anchor.Centre, Scale = new Vector2(1.5f), }, new FillFlowContainer { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Top = BeatmapSetOverlay.TOP_PADDING, Right = BeatmapSetOverlay.X_PADDING }, Direction = FillDirection.Vertical, Spacing = new Vector2(10), Children = new Drawable[] { onlineStatusPill = new BeatmapSetOnlineStatusPill { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, TextSize = 14, TextPadding = new MarginPadding { Horizontal = 25, Vertical = 8 } }, Details = new Details(), }, }, }, }, }; Picker.Beatmap.ValueChanged += b => { Details.Beatmap = b.NewValue; externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}"; }; }
public ProfileHeader() { CentreHeaderContainer centreHeaderContainer; DetailHeaderContainer detailHeaderContainer; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = cover_height, Masking = true, Children = new Drawable[] { coverContainer = new UserCoverBackground { RelativeSizeAxes = Axes.Both, }, new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(OsuColour.FromHex("222").Opacity(0.8f), OsuColour.FromHex("222").Opacity(0.2f)) }, } }, new Container { Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }, Y = cover_height, Height = cover_info_height, RelativeSizeAxes = Axes.X, Anchor = Anchor.TopLeft, Origin = Anchor.BottomLeft, Depth = -float.MaxValue, Children = new Drawable[] { new ProfileHeaderTitle { X = -ScreenTitle.ICON_WIDTH, }, infoTabControl = new ProfileHeaderTabControl { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, Height = cover_info_height - 30, Margin = new MarginPadding { Left = -UserProfileOverlay.CONTENT_X_MARGIN }, Padding = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN } } } }, new FillFlowContainer { Margin = new MarginPadding { Top = cover_height }, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new TopHeaderContainer { RelativeSizeAxes = Axes.X, User = { BindTarget = User }, }, centreHeaderContainer = new CentreHeaderContainer { RelativeSizeAxes = Axes.X, User = { BindTarget = User }, }, detailHeaderContainer = new DetailHeaderContainer { RelativeSizeAxes = Axes.X, User = { BindTarget = User }, }, new MedalHeaderContainer { RelativeSizeAxes = Axes.X, User = { BindTarget = User }, }, new BottomHeaderContainer { RelativeSizeAxes = Axes.X, User = { BindTarget = User }, }, } } }; infoTabControl.AddItem("Info"); infoTabControl.AddItem("Modding"); centreHeaderContainer.DetailsVisible.BindValueChanged(visible => detailHeaderContainer.Expanded = visible.NewValue, true); User.ValueChanged += e => updateDisplay(e.NewValue); }
private void checkColour(ColourInfo expectedColour) => AddAssert($"Check colour to be '{expectedColour}'", () => currentColour.Equals(expectedColour));
private void load() { InternalChild = new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Masking = true, CornerExponent = 2.5f, CornerRadius = 20, EdgeEffect = new EdgeEffectParameters { Colour = Color4.Black.Opacity(0.25f), Type = EdgeEffectType.Shadow, Radius = 1, Offset = new Vector2(0, 4) }, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4Extensions.FromHex("444") }, new UserCoverBackground { RelativeSizeAxes = Axes.Both, User = score.User, Colour = ColourInfo.GradientVertical(Color4.White.Opacity(0.5f), Color4Extensions.FromHex("#444").Opacity(0)) }, new FillFlowContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(10), Direction = FillDirection.Vertical, Spacing = new Vector2(0, 10), Children = new Drawable[] { new UpdateableAvatar(score.User) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Size = new Vector2(110), Masking = true, CornerExponent = 2.5f, CornerRadius = 20, EdgeEffect = new EdgeEffectParameters { Colour = Color4.Black.Opacity(0.25f), Type = EdgeEffectType.Shadow, Radius = 8, Offset = new Vector2(0, 4), } }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = score.RealmUser.Username, Font = OsuFont.GetFont(size: 16, weight: FontWeight.SemiBold) }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5), ChildrenEnumerable = score.GetStatisticsForDisplay().Where(s => !s.Result.IsBonus()).Select(createStatistic) }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Top = 10 }, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5), Children = new[] { createStatistic("Max Combo", $"x{score.MaxCombo}"), createStatistic("Accuracy", $"{score.Accuracy.FormatAccuracy()}"), } }, new ModFlowDisplay { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Current = { Value = score.Mods }, IconScale = 0.5f, } } } } }, }, new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Vertical = 5 }, Child = new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new Drawable[] { new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Current = scoreManager.GetBindableTotalScoreString(score), Font = OsuFont.GetFont(size: 20, weight: FontWeight.Medium, fixedWidth: true), Spacing = new Vector2(-1, 0) }, }, new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = 2 }, Child = new DrawableRank(score.Rank) { Anchor = Anchor.Centre, Origin = Anchor.Centre, } } }, }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), } } } }, }, RowDimensions = new[] { new Dimension(), new Dimension(GridSizeMode.Absolute, 45), } }; }
private void waitUntilColourIs(ColourInfo expectedColour) => AddUntilStep($"Wait until hover colour is {expectedColour}", () => currentColour.Equals(expectedColour));
public override void DrawTriangle(Triangle vertexTriangle, RectangleF?textureRect, ColourInfo drawColour, Action <TexturedVertex2D> vertexAction = null, Vector2?inflationPercentage = null) { if (IsDisposed) { throw new ObjectDisposedException(ToString(), "Can not draw a triangle with a disposed texture."); } RectangleF texRect = GetTextureRect(textureRect); Vector2 inflationAmount = inflationPercentage.HasValue ? new Vector2(inflationPercentage.Value.X * texRect.Width, inflationPercentage.Value.Y * texRect.Height) : Vector2.Zero; RectangleF inflatedTexRect = texRect.Inflate(inflationAmount); if (vertexAction == null) { vertexAction = default_triangle_action; } // We split the triangle into two, such that we can obtain smooth edges with our // texture coordinate trick. We might want to revert this to drawing a single // triangle in case we ever need proper texturing, or if the additional vertices // end up becoming an overhead (unlikely). SRGBColour topColour = (drawColour.TopLeft + drawColour.TopRight) / 2; SRGBColour bottomColour = (drawColour.BottomLeft + drawColour.BottomRight) / 2; // Left triangle half vertexAction(new TexturedVertex2D { Position = vertexTriangle.P0, TexturePosition = new Vector2(inflatedTexRect.Left, inflatedTexRect.Top), TextureRect = new Vector4(texRect.Left, texRect.Top, texRect.Right, texRect.Bottom), BlendRange = inflationAmount, Colour = topColour.Linear, }); vertexAction(new TexturedVertex2D { Position = vertexTriangle.P1, TexturePosition = new Vector2(inflatedTexRect.Left, inflatedTexRect.Bottom), TextureRect = new Vector4(texRect.Left, texRect.Top, texRect.Right, texRect.Bottom), BlendRange = inflationAmount, Colour = drawColour.BottomLeft.Linear, }); vertexAction(new TexturedVertex2D { Position = (vertexTriangle.P1 + vertexTriangle.P2) / 2, TexturePosition = new Vector2((inflatedTexRect.Left + inflatedTexRect.Right) / 2, inflatedTexRect.Bottom), TextureRect = new Vector4(texRect.Left, texRect.Top, texRect.Right, texRect.Bottom), BlendRange = inflationAmount, Colour = bottomColour.Linear, }); // Right triangle half vertexAction(new TexturedVertex2D { Position = vertexTriangle.P0, TexturePosition = new Vector2(inflatedTexRect.Right, inflatedTexRect.Top), TextureRect = new Vector4(texRect.Left, texRect.Top, texRect.Right, texRect.Bottom), BlendRange = inflationAmount, Colour = topColour.Linear, }); vertexAction(new TexturedVertex2D { Position = (vertexTriangle.P1 + vertexTriangle.P2) / 2, TexturePosition = new Vector2((inflatedTexRect.Left + inflatedTexRect.Right) / 2, inflatedTexRect.Bottom), TextureRect = new Vector4(texRect.Left, texRect.Top, texRect.Right, texRect.Bottom), BlendRange = inflationAmount, Colour = bottomColour.Linear, }); vertexAction(new TexturedVertex2D { Position = vertexTriangle.P2, TexturePosition = new Vector2(inflatedTexRect.Right, inflatedTexRect.Bottom), TextureRect = new Vector4(texRect.Left, texRect.Top, texRect.Right, texRect.Bottom), BlendRange = inflationAmount, Colour = drawColour.BottomRight.Linear, }); FrameStatistics.Add(StatisticsCounterType.Pixels, (long)vertexTriangle.ConservativeArea); }
private void load(LocalisationEngine localisation) { var beatmapInfo = working.BeatmapInfo; var metadata = beatmapInfo.Metadata ?? working.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); PixelSnapping = true; CacheDrawnFrameBuffer = true; RelativeSizeAxes = Axes.Both; titleBinding = localisation.GetUnicodePreference(metadata.TitleUnicode, metadata.Title); artistBinding = localisation.GetUnicodePreference(metadata.ArtistUnicode, metadata.Artist); Children = new Drawable[] { // We will create the white-to-black gradient by modulating transparency and having // a black backdrop. This results in an sRGB-space gradient and not linear space, // transitioning from white to black more perceptually uniformly. new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, // We use a container, such that we can set the colour gradient to go across the // vertices of the masked container instead of the vertices of the (larger) sprite. new Container { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4.White, Color4.White.Opacity(0.3f)), Children = new[] { // Zoomed-in and cropped beatmap background new BeatmapBackgroundSprite(working) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, }, }, }, new DifficultyColourBar(beatmapInfo) { RelativeSizeAxes = Axes.Y, Width = 20, }, new FillFlowContainer { Name = "Top-aligned metadata", Anchor = Anchor.TopLeft, Origin = Anchor.TopLeft, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, Children = new Drawable[] { VersionLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", Text = beatmapInfo.Version, TextSize = 24, }, } }, new FillFlowContainer { Name = "Centre-aligned metadata", Anchor = Anchor.CentreLeft, Origin = Anchor.TopLeft, Y = -22, Direction = FillDirection.Vertical, Margin = new MarginPadding { Top = 15, Left = 25, Right = 10, Bottom = 20 }, AutoSizeAxes = Axes.Both, Children = new Drawable[] { TitleLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", TextSize = 28, }, ArtistLabel = new OsuSpriteText { Font = @"Exo2.0-MediumItalic", TextSize = 17, }, MapperContainer = new FillFlowContainer { Margin = new MarginPadding { Top = 10 }, Direction = FillDirection.Horizontal, AutoSizeAxes = Axes.Both, Children = getMapper(metadata) }, InfoLabelContainer = new FillFlowContainer { Margin = new MarginPadding { Top = 20 }, Spacing = new Vector2(20, 0), AutoSizeAxes = Axes.Both, Children = getInfoLabels() } } } }; artistBinding.ValueChanged += value => setMetadata(metadata.Source); artistBinding.TriggerChange(); }
private void load() { const float winner_background_half_height = 250; VerticalScrollContent.Anchor = VerticalScrollContent.Origin = Anchor.TopCentre; VerticalScrollContent.Scale = new Vector2(0.9f); VerticalScrollContent.Y = 75; var redScore = teamScores.First().Value; var blueScore = teamScores.Last().Value; LocalisableString winner; Colour4 winnerColour; int comparison = redScore.Value.CompareTo(blueScore.Value); if (comparison < 0) { // team name should eventually be coming from the multiplayer match state. winner = MultiplayerTeamResultsScreenStrings.TeamWins(@"Blue"); winnerColour = colours.TeamColourBlue; } else if (comparison > 0) { // team name should eventually be coming from the multiplayer match state. winner = MultiplayerTeamResultsScreenStrings.TeamWins(@"Red"); winnerColour = colours.TeamColourRed; } else { winner = MultiplayerTeamResultsScreenStrings.TheTeamsAreTied; winnerColour = Colour4.White.Opacity(0.5f); } AddRangeInternal(new Drawable[] { new MatchScoreDisplay { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Team1Score = { BindTarget = redScore }, Team2Score = { BindTarget = blueScore }, }, winnerBackground = new Container { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0, Children = new[] { new Box { RelativeSizeAxes = Axes.X, Height = winner_background_half_height, Anchor = Anchor.Centre, Origin = Anchor.BottomCentre, Colour = ColourInfo.GradientVertical(Colour4.Black.Opacity(0), Colour4.Black.Opacity(0.4f)) }, new Box { RelativeSizeAxes = Axes.X, Height = winner_background_half_height, Anchor = Anchor.Centre, Origin = Anchor.TopCentre, Colour = ColourInfo.GradientVertical(Colour4.Black.Opacity(0.4f), Colour4.Black.Opacity(0)) } } }, (winnerText = new OsuSpriteText { Alpha = 0, Font = OsuFont.Torus.With(size: 80, weight: FontWeight.Bold), Text = winner, Blending = BlendingParameters.Additive }).WithEffect(new GlowEffect { Colour = winnerColour, }).With(e => { e.Anchor = Anchor.Centre; e.Origin = Anchor.Centre; }) }); }
public RoomInspector() { Width = 520; RelativeSizeAxes = Axes.Y; Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex(@"343138"), }, topFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = 200, Masking = true, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, coverContainer = new Container { RelativeSizeAxes = Axes.Both, }, }, }, new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0)), }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(20), Children = new Drawable[] { new FillFlowContainer { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, LayoutDuration = transition_duration, Children = new[] { participants = new OsuSpriteText { TextSize = 30, Font = @"Exo2.0-Bold" }, participantsSlash = new OsuSpriteText { Text = @"/", TextSize = 30, Font = @"Exo2.0-Light" }, maxParticipants = new OsuSpriteText { TextSize = 30, Font = @"Exo2.0-Light" }, }, }, name = new OsuSpriteText { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, TextSize = 30, }, }, }, }, }, statusStrip = new Box { RelativeSizeAxes = Axes.X, Height = 5, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex(@"28242d"), }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Padding = contentPadding, Spacing = new Vector2(0f, 5f), Children = new Drawable[] { status = new OsuSpriteText { TextSize = 14, Font = @"Exo2.0-Bold", }, new FillFlowContainer { AutoSizeAxes = Axes.X, Height = 30, Direction = FillDirection.Horizontal, LayoutDuration = transition_duration, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { modeTypeInfo = new ModeTypeInfo(), new Container { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Margin = new MarginPadding { Left = 5 }, Children = new[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Children = new[] { beatmapTitle = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", }, beatmapDash = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", }, beatmapArtist = new OsuSpriteText { Font = @"Exo2.0-RegularItalic", }, }, }, beatmapAuthor = new OsuSpriteText { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, TextSize = 14, }, }, }, }, }, }, }, }, }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = contentPadding, Children = new Drawable[] { participantInfo = new ParticipantInfo(@"Rank Range "), }, }, }, }, participantsScroll = new OsuScrollContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, Padding = new MarginPadding { Top = contentPadding.Top, Left = 38, Right = 37 }, Children = new[] { participantsFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, LayoutDuration = transition_duration, Spacing = new Vector2(5f), }, }, }, }; nameBind.ValueChanged += displayName; hostBind.ValueChanged += displayUser; typeBind.ValueChanged += displayGameType; maxParticipantsBind.ValueChanged += displayMaxParticipants; participantsBind.ValueChanged += displayParticipants; }