private async void AnimatePanel() { const uint duration = 150u; if (ViewModel.IsAddingAgent) { if (_isPanelVisible) { return; } _isPanelVisible = true; PanelBackground.IsVisible = true; await Task.WhenAll( // Show PanelBackground.ColorTo(Color.FromRgba(0, 0, 0, 0x00), Color.FromRgba(0, 0, 0, 0xBB), color => PanelBackground.BackgroundColor = color, duration), AddAgentPanel.TranslateTo(0, 0, duration)); } else { _isPanelVisible = false; await Task.WhenAll( // Hide PanelBackground.ColorTo(Color.FromRgba(0, 0, 0, 0xBB), Color.FromRgba(0, 0, 0, 0x00), color => PanelBackground.BackgroundColor = color, duration), AddAgentPanel.TranslateTo(0, 180, duration)); PanelBackground.IsVisible = false; } }
private void load(BeatmapManager manager, BeatmapSetOverlay beatmapOverlay, DialogOverlay overlay) { restoreHiddenRequested = s => s.Beatmaps.ForEach(manager.Restore); dialogOverlay = overlay; if (beatmapOverlay != null) { viewDetails = beatmapOverlay.FetchAndShowBeatmapSet; } Children = new Drawable[] { new DelayedLoadUnloadWrapper(() => { var background = new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault())) { RelativeSizeAxes = Axes.Both, }; background.OnLoadComplete += d => d.FadeInFromZero(1000, Easing.OutQuint); return(background); }, 300, 5000 ), new FillFlowContainer { Direction = FillDirection.Vertical, Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 }, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new OsuSpriteText { Text = new LocalisedString((beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title)), Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 22, italics: true), Shadow = true, },
protected override Drawable CreateContent() { Action <SpriteText> fontParameters = s => s.Font = OsuFont.Default.With(weight: FontWeight.SemiBold); return(maskingContainer = new Container { RelativeSizeAxes = Axes.X, Height = HEIGHT, Masking = true, CornerRadius = 10, Children = new Drawable[] { new Box // A transparent box that forces the border to be drawn if the panel background is opaque { RelativeSizeAxes = Axes.Both, Alpha = 0, AlwaysPresent = true }, panelBackground = new PanelBackground { RelativeSizeAxes = Axes.Both, }, new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(), new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.AutoSize) }, Content = new[] { new Drawable[] { difficultyIconContainer = new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Left = 8, Right = 8 }, }, new FillFlowContainer { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Direction = FillDirection.Vertical, Children = new Drawable[] { beatmapText = new LinkFlowContainer(fontParameters) { RelativeSizeAxes = Axes.X, // workaround to ensure only the first line of text shows, emulating truncation (but without ellipsis at the end). // TODO: remove when text/link flow can support truncation with ellipsis natively. Height = OsuFont.DEFAULT_FONT_SIZE, Masking = true }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0), Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0), Children = new Drawable[] { authorText = new LinkFlowContainer(fontParameters) { AutoSizeAxes = Axes.Both }, explicitContentPill = new ExplicitContentBeatmapPill { Alpha = 0f, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Margin = new MarginPadding { Top = 3f }, } }, }, new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Child = modDisplay = new ModDisplay { Scale = new Vector2(0.4f), ExpansionMode = ExpansionMode.AlwaysExpanded } } } } } }, new FillFlowContainer { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Direction = FillDirection.Horizontal, Margin = new MarginPadding { Horizontal = 8 }, AutoSizeAxes = Axes.Both, Spacing = new Vector2(5), ChildrenEnumerable = CreateButtons().Select(button => button.With(b => { b.Anchor = Anchor.Centre; b.Origin = Anchor.Centre; })) }, ownerAvatar = new OwnerAvatar { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(ICON_HEIGHT), Margin = new MarginPadding { Right = 8 }, Masking = true, CornerRadius = 4, Alpha = showItemOwner ? 1 : 0 }, } } }, } }); }