public LeaderboardScore(Score score, int rank) { Score = score; RankPosition = rank; RelativeSizeAxes = Axes.X; Height = HEIGHT; Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Y, Width = rank_width, Children = new[] { new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = @"Exo2.0-MediumItalic", TextSize = 22, Text = RankPosition.ToString(), }, }, }, content = new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = rank_width, }, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, CornerRadius = corner_radius, Masking = true, Children = new[] { background = new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, Alpha = background_alpha, }, }, }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(edge_margin), Children = new Drawable[] { avatar = new DelayedLoadWrapper( new Avatar(Score.User) { RelativeSizeAxes = Axes.Both, CornerRadius = corner_radius, Masking = true, OnLoadComplete = d => d.FadeInFromZero(200), EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Radius = 1, Colour = Color4.Black.Opacity(0.2f), }, }) { TimeBeforeLoad = 500, RelativeSizeAxes = Axes.None, Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), }, new Container { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Position = new Vector2(HEIGHT - edge_margin, 0f), Children = new Drawable[] { nameLabel = new OsuSpriteText { Text = Score.User.Username, Font = @"Exo2.0-BoldItalic", TextSize = 23, }, new FillFlowContainer { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0f), Children = new Drawable[] { flagBadgeContainer = new Container { Size = new Vector2(87f, 20f), Masking = true, Children = new Drawable[] { new DrawableFlag(Score.User?.Country?.FlagName) { Width = 30, RelativeSizeAxes = Axes.Y, }, }, }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0f), Margin = new MarginPadding { Left = edge_margin, }, Children = new Drawable[] { maxCombo = new ScoreComponentLabel(FontAwesome.fa_link, Score.MaxCombo.ToString()), accuracy = new ScoreComponentLabel(FontAwesome.fa_crosshairs, string.Format(Score.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", Score.Accuracy)), }, }, }, }, }, }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Direction = FillDirection.Horizontal, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { scoreLabel = new GlowingSpriteText(Score.TotalScore.ToString(@"N0"), @"Venera", 23, Color4.White, OsuColour.FromHex(@"83ccfa")), new Container { Size = new Vector2(40f, 20f), Children = new[] { scoreRank = new DrawableRank(Score.Rank) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(40f), }, }, }, }, }, modsContainer = new FillFlowContainer <ModIcon> { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, }, }, }, }, }, }; foreach (Mod mod in Score.Mods) { modsContainer.Add(new ModIcon(mod) { AutoSizeAxes = Axes.Both, Scale = new Vector2(0.375f) }); } }
private void load(IAPIProvider api, OsuColour colour, ScoreManager scoreManager) { var user = score.User; statisticsLabels = GetStatistics(score).Select(s => new ScoreComponentLabel(s)).ToList(); ClickableAvatar innerAvatar; Children = new Drawable[] { new RankLabel(rank) { RelativeSizeAxes = Axes.Y, Width = rank_width, }, content = new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = rank_width, }, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, CornerRadius = corner_radius, Masking = true, Children = new[] { background = new Box { RelativeSizeAxes = Axes.Both, Colour = user.Id == api.LocalUser.Value.Id && allowHighlight ? colour.Green : Color4.Black, Alpha = background_alpha, }, }, }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(edge_margin), Children = new[] { avatar = new DelayedLoadWrapper( innerAvatar = new ClickableAvatar(user) { RelativeSizeAxes = Axes.Both, CornerRadius = corner_radius, Masking = true, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Radius = 1, Colour = Color4.Black.Opacity(0.2f), }, }) { RelativeSizeAxes = Axes.None, Size = new Vector2(HEIGHT - edge_margin * 2, HEIGHT - edge_margin * 2), }, new Container { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Position = new Vector2(HEIGHT - edge_margin, 0f), Children = new Drawable[] { nameLabel = new OsuSpriteText { Text = user.Username, Font = OsuFont.GetFont(size: 23, weight: FontWeight.Bold, italics: true) }, new FillFlowContainer { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0f), Children = new Drawable[] { flagBadgeContainer = new Container { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, Size = new Vector2(87f, 20f), Masking = true, Children = new Drawable[] { new UpdateableFlag(user.Country) { Width = 30, RelativeSizeAxes = Axes.Y, }, }, }, new FillFlowContainer { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10f, 0f), Margin = new MarginPadding { Left = edge_margin }, Children = statisticsLabels }, }, }, }, }, new FillFlowContainer { AutoSizeAxes = Axes.Both, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Direction = FillDirection.Horizontal, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { scoreLabel = new GlowingSpriteText { TextColour = Color4.White, GlowColour = Color4Extensions.FromHex(@"83ccfa"), Current = scoreManager.GetBindableTotalScoreString(score), Font = OsuFont.Numeric.With(size: 23), }, RankContainer = new Container { Size = new Vector2(40f, 20f), Children = new[] { scoreRank = new UpdateableRank(score.Rank) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(40f) }, }, }, }, }, modsContainer = new FillFlowContainer <ModIcon> { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(1), ChildrenEnumerable = score.Mods.Select(mod => new ModIcon(mod) { Scale = new Vector2(0.375f) }) }, }, }, }, }, }; innerAvatar.OnLoadComplete += d => d.FadeInFromZero(200); }
public TranslateEditSection() { Padding = new MarginPadding(10); var columnDimensions = new[] { new Dimension(GridSizeMode.Absolute, 200), new Dimension(GridSizeMode.Absolute, column_spacing), new Dimension(GridSizeMode.Absolute, 400), new Dimension(GridSizeMode.Absolute, column_spacing), new Dimension() }; Child = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new Drawable[] { new GridContainer { Name = "LanguageSelection", RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, ColumnDimensions = columnDimensions, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Content = new Drawable[][] { new[] { null, null, null, null, new GridContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, ColumnDimensions = new[] { new Dimension(GridSizeMode.Distributed), new Dimension(GridSizeMode.Absolute, column_spacing), new Dimension(GridSizeMode.Absolute, 50), new Dimension(GridSizeMode.Absolute, column_spacing), new Dimension(GridSizeMode.Absolute, 50), }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), }, Content = new[] { new Drawable[] { languageDropdown = new LanguageDropdown { RelativeSizeAxes = Axes.X, }, null, new IconButton { Y = 5, Icon = FontAwesome.Solid.Plus, Action = () => { LanguageSelectionDialog.Show(); } }, null, new IconButton { Y = 5, Icon = FontAwesome.Solid.Trash, Action = () => { var currentLanguage = languageDropdown.Current.Value; if (translateManager.LanguageContainsTranslateAmount(currentLanguage) > 0) { DialogOverlay.Push(new DeleteLanguagePopupDialog(currentLanguage, isOk => { if (isOk) { translateManager.RemoveLanguage(currentLanguage); } })); } else { translateManager.RemoveLanguage(currentLanguage); } } }, } } } }, } }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Children = new[] { new GridContainer { Name = "Background", RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, ColumnDimensions = columnDimensions, RelativeSizeAxes = Axes.Both, Content = new[] { new[] { new CornerBackground { Alpha = 0, }, null, null, null, null, }, new[] { timeSectionBackground = new CornerBackground { RelativeSizeAxes = Axes.Both }, null, lyricSectionBackground = new CornerBackground { RelativeSizeAxes = Axes.Both }, null, null, }, } }, translateGrid = new GridContainer { Name = "Translates", ColumnDimensions = columnDimensions, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, } } } }, }; NewLanguage.BindValueChanged(e => { translateManager.AddLanguage(e.NewValue); }); }
public ParticipantInfo(string rankPrefix = null) { RelativeSizeAxes = Axes.X; Height = 15f; Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Direction = FillDirection.Horizontal, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { flagContainer = new Container { Width = 22f, RelativeSizeAxes = Axes.Y, }, new Container //todo: team banners { Width = 38f, RelativeSizeAxes = Axes.Y, CornerRadius = 2f, Masking = true, Children = new[] { new Box { RelativeSizeAxes = Axes.Both, Colour = OsuColour.FromHex(@"ad387e"), }, }, }, new OsuSpriteText { Text = "hosted by", Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, TextSize = 14, }, host = new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, TextSize = 14, Font = @"Exo2.0-BoldItalic", }, }, }, levelRangeContainer = new FillFlowContainer { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Children = new[] { new OsuSpriteText { Text = rankPrefix, TextSize = 14, }, new OsuSpriteText { Text = "#", TextSize = 14, }, levelRangeLower = new OsuSpriteText { TextSize = 14, Font = @"Exo2.0-Bold", }, new OsuSpriteText { Text = " - ", TextSize = 14, }, new OsuSpriteText { Text = "#", TextSize = 14, }, levelRangeHigher = new OsuSpriteText { TextSize = 14, Font = @"Exo2.0-Bold", }, }, }, }; }
public void TestMultipleStatuses() { AddStep("create rooms", () => { Child = new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Size = new Vector2(0.9f), Spacing = new Vector2(10), Children = new Drawable[] { createDrawableRoom(new Room { Name = { Value = "Flyte's Trash Playlist" }, Status = { Value = new RoomStatusOpen() }, EndDate = { Value = DateTimeOffset.Now.AddDays(1) }, Playlist = { new PlaylistItem { Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo) { BeatmapInfo = { StarDifficulty = 2.5 } }.BeatmapInfo, } } } }), createDrawableRoom(new Room { Name = { Value = "Room 2" }, Status = { Value = new RoomStatusPlaying() }, EndDate = { Value = DateTimeOffset.Now.AddDays(1) }, Playlist = { new PlaylistItem { Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo) { BeatmapInfo = { StarDifficulty = 2.5 } }.BeatmapInfo, } }, new PlaylistItem { Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo) { BeatmapInfo = { StarDifficulty = 4.5 } }.BeatmapInfo, } } } }), createDrawableRoom(new Room { Name = { Value = "Room 3" }, Status = { Value = new RoomStatusEnded() }, EndDate = { Value = DateTimeOffset.Now }, }), createDrawableRoom(new Room { Name = { Value = "Room 4 (spotlight)" }, Status = { Value = new RoomStatusOpen() }, Category = { Value = RoomCategory.Spotlight }, }), } }; }); }
private void load(OverlayColourProvider colours) { InternalChildren = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = 10, Shear = new Vector2(0.2f, 0), Child = new Box { RelativeSizeAxes = Axes.Both, Colour = colours.Background4, } }, new FillFlowContainer { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Children = new Drawable[] { new FillFlowContainer { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Spacing = new Vector2(8), Padding = new MarginPadding { Left = 8, Right = 16 }, Children = new Drawable[] { hostAvatar = new CircularAvatar { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, hostText = new LinkFlowContainer { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both } } }, new Container { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = 10, Shear = new Vector2(0.2f, 0), Child = new Box { RelativeSizeAxes = Axes.Both, Colour = colours.Background3, } }, new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(4), Padding = new MarginPadding { Left = 8, Right = 16 }, Children = new Drawable[] { new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(16), Icon = FontAwesome.Solid.User, }, totalCount = new OsuSpriteText { Font = OsuFont.Default.With(weight: FontWeight.Bold), Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, }, avatarFlow = new FillFlowContainer <CircularAvatar> { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(4), Margin = new MarginPadding { Left = 4 }, }, hiddenUsers = new HiddenUserCount { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, } } } } }, } } }; }
private void load(OsuColour colours) { Children = new Drawable[] { new SettingsCheckbox { LabelText = CommonStrings.Enabled, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Current = enabled, }, noTabletMessage = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Padding = new MarginPadding { Horizontal = SettingsPanel.CONTENT_MARGINS }, Spacing = new Vector2(5f), Children = new Drawable[] { new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = TabletSettingsStrings.NoTabletDetected, }, new SettingsNoticeText(colours) { TextAnchor = Anchor.TopCentre, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }.With(t => { if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows || RuntimeInfo.OS == RuntimeInfo.Platform.Linux) { t.NewLine(); t.AddText("If your tablet is not detected, please read "); t.AddLink("this FAQ", LinkAction.External, RuntimeInfo.OS == RuntimeInfo.Platform.Windows ? @"https://github.com/OpenTabletDriver/OpenTabletDriver/wiki/Windows-FAQ" : @"https://github.com/OpenTabletDriver/OpenTabletDriver/wiki/Linux-FAQ"); t.AddText(" for troubleshooting steps."); } }), } }, mainSettings = new FillFlowContainer { Alpha = 0, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(0, 8), Direction = FillDirection.Vertical, Children = new Drawable[] { AreaSelection = new TabletAreaSelection(tabletHandler) { RelativeSizeAxes = Axes.X, Height = 300, }, new DangerousSettingsButton { Text = TabletSettingsStrings.ResetToFullArea, Action = () => { aspectLock.Value = false; areaOffset.SetDefault(); areaSize.SetDefault(); }, }, new SettingsButton { Text = TabletSettingsStrings.ConformToCurrentGameAspectRatio, Action = () => { forceAspectRatio((float)host.Window.ClientSize.Width / host.Window.ClientSize.Height); } }, new SettingsSlider <float> { TransferValueOnCommit = true, LabelText = TabletSettingsStrings.XOffset, Current = offsetX }, new SettingsSlider <float> { TransferValueOnCommit = true, LabelText = TabletSettingsStrings.YOffset, Current = offsetY }, new SettingsSlider <float> { TransferValueOnCommit = true, LabelText = TabletSettingsStrings.Rotation, Current = rotation }, new RotationPresetButtons(tabletHandler), new SettingsSlider <float> { TransferValueOnCommit = true, LabelText = TabletSettingsStrings.AspectRatio, Current = aspectRatio }, new SettingsCheckbox { LabelText = TabletSettingsStrings.LockAspectRatio, Current = aspectLock }, new SettingsSlider <float> { TransferValueOnCommit = true, LabelText = CommonStrings.Width, Current = sizeX }, new SettingsSlider <float> { TransferValueOnCommit = true, LabelText = CommonStrings.Height, Current = sizeY }, } }, }; }
private void load(OverlayColourProvider colourProvider, TextureStore textures) { Container <Drawable> hiddenDetailContainer; Container <Drawable> expandedDetailContainer; InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background4 }, new FillFlowContainer { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Direction = FillDirection.Horizontal, Padding = new MarginPadding { Vertical = 10 }, Margin = new MarginPadding { Left = UserProfileOverlay.CONTENT_X_MARGIN }, Spacing = new Vector2(10, 0), Children = new Drawable[] { new AddFriendButton { RelativeSizeAxes = Axes.Y, User = { BindTarget = User } }, new MessageUserButton { User = { BindTarget = User } }, } }, new Container { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Y, Padding = new MarginPadding { Vertical = 10 }, Width = UserProfileOverlay.CONTENT_X_MARGIN, Child = new ExpandDetailsButton { RelativeSizeAxes = Axes.Y, Anchor = Anchor.Centre, Origin = Anchor.Centre, DetailsVisible = { BindTarget = DetailsVisible } }, }, new Container { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Right = UserProfileOverlay.CONTENT_X_MARGIN }, Children = new Drawable[] { new LevelBadge { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Size = new Vector2(40), User = { BindTarget = User } }, expandedDetailContainer = new Container { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Width = 200, Height = 6, Margin = new MarginPadding { Right = 50 }, Child = new LevelProgressBar { RelativeSizeAxes = Axes.Both, User = { BindTarget = User } } }, hiddenDetailContainer = new FillFlowContainer { Direction = FillDirection.Horizontal, Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Width = 200, AutoSizeAxes = Axes.Y, Alpha = 0, Spacing = new Vector2(10, 0), Margin = new MarginPadding { Right = 50 }, Children = new[] { hiddenDetailGlobal = new OverlinedInfoContainer { Title = "Глобальный ранг", LineColour = colourProvider.Highlight1 }, hiddenDetailCountry = new OverlinedInfoContainer { Title = "Ранг в стране", LineColour = colourProvider.Highlight1 }, } } } } }; DetailsVisible.BindValueChanged(visible => { hiddenDetailContainer.FadeTo(visible.NewValue ? 0 : 1, 200, Easing.OutQuint); expandedDetailContainer.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint); }); User.BindValueChanged(user => updateDisplay(user.NewValue)); }
private void load() { AddRangeInternal(new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(0.2f), }, new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Width = 0.9f, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Child = flow = new FillFlowContainer <TDrawable> { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, LayoutDuration = 200, LayoutEasing = Easing.OutQuint, Spacing = new Vector2(20) }, }, ControlPanel = new ControlPanel { Children = new Drawable[] { new TourneyButton { RelativeSizeAxes = Axes.X, Text = "Add new", Action = () => Storage.Add(new TModel()) }, new DangerousSettingsButton { RelativeSizeAxes = Axes.X, Text = "Clear all", Action = Storage.Clear }, } } }); Storage.CollectionChanged += (_, args) => { switch (args.Action) { case NotifyCollectionChangedAction.Add: args.NewItems.Cast <TModel>().ForEach(i => flow.Add(CreateDrawable(i))); break; case NotifyCollectionChangedAction.Remove: args.OldItems.Cast <TModel>().ForEach(i => flow.RemoveAll(d => d.Model == i)); break; } }; foreach (var model in Storage) { flow.Add(CreateDrawable(model)); } }
private void load() { InternalChild = new FillFlowContainer { AutoSizeAxes = Axes.X, Height = bar_height, Direction = FillDirection.Horizontal, Spacing = new Vector2(spacing, 0), Margin = new MarginPadding(2), Children = new Drawable[] { new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Width = chevron_size, RelativeSizeAxes = Axes.Y, Child = arrow = new SpriteIcon { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, RelativePositionAxes = Axes.Y, Y = 0.5f, Icon = FontAwesome.Solid.ChevronRight, Size = new Vector2(chevron_size), } }, colourBars = new Container { Width = bar_width, RelativeSizeAxes = Axes.Y, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Children = new Drawable[] { colourBarsEarly = new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.Both, Height = 0.5f, Scale = new Vector2(1, -1), }, colourBarsLate = new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.TopRight, RelativeSizeAxes = Axes.Both, Height = 0.5f, }, iconEarly = new SpriteIcon { Y = -10, Size = new Vector2(10), Icon = FontAwesome.Solid.ShippingFast, Anchor = Anchor.TopCentre, Origin = Anchor.Centre, }, iconLate = new SpriteIcon { Y = 10, Size = new Vector2(10), Icon = FontAwesome.Solid.Bicycle, Anchor = Anchor.BottomCentre, Origin = Anchor.Centre, } } }, judgementsContainer = new Container { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Width = judgement_line_width, RelativeSizeAxes = Axes.Y, }, } }; createColourBars(); }
private void load(TestBrowser browser) { this.browser = browser; SpriteText maxFrameCount, currentFrame; InternalChild = new FillFlowContainer { RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Direction = FillDirection.Horizontal, Spacing = new Vector2(10), Children = new Drawable[] { playbackControls = new FillFlowContainer { AutoSizeAxes = Axes.X, RelativeSizeAxes = Axes.Y, Spacing = new Vector2(5), Direction = FillDirection.Horizontal, Children = new Drawable[] { new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Icon = FontAwesome.Solid.Circle, Colour = Color4.Red, Size = new Vector2(20), }, currentFrame = new SpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Colour = FrameworkColour.Yellow, Text = "0", Font = FrameworkFont.Regular.With(fixedWidth: true) }, new BasicSliderBar <int> { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Height = 20, Width = 250, KeyboardStep = 1, Current = browser.CurrentFrame, BackgroundColour = FrameworkColour.Blue, }, maxFrameCount = new SpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Text = "0", Font = FrameworkFont.Regular.With(fixedWidth: true) }, } }, recordButton = new BasicButton { RelativeSizeAxes = Axes.Y, Width = 100, Action = changeState, }, } }; browser.RecordState.BindValueChanged(updateState, true); browser.CurrentFrame.ValueChanged += frame => currentFrame.Text = frame.NewValue.ToString("00000"); browser.CurrentFrame.MaxValueChanged += maxVal => maxFrameCount.Text = maxVal.ToString("00000"); }
private void load(BeatmapSetOverlay?beatmapSetOverlay) { Width = width; Height = height; FillFlowContainer leftIconArea = null !; GridContainer titleContainer = null !; GridContainer artistContainer = null !; Child = content.With(c => { c.MainContent = new Container { RelativeSizeAxes = Axes.Both, Children = new Drawable[] { thumbnail = new BeatmapCardThumbnail(BeatmapSet) { Name = @"Left (icon) area", Size = new Vector2(height), Padding = new MarginPadding { Right = CORNER_RADIUS }, Child = leftIconArea = new FillFlowContainer { Margin = new MarginPadding(5), AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(1) } }, buttonContainer = new CollapsibleButtonContainer(BeatmapSet) { X = height - CORNER_RADIUS, Width = width - height + CORNER_RADIUS, FavouriteState = { BindTarget = FavouriteState }, ButtonsCollapsedWidth = CORNER_RADIUS, ButtonsExpandedWidth = 30, ButtonsPadding = new MarginPadding { Vertical = 35 }, Children = new Drawable[] { new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { titleContainer = new GridContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, ColumnDimensions = new[] { new Dimension(), new Dimension(GridSizeMode.AutoSize) }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, Content = new[] { new[] { new OsuSpriteText { Text = new RomanisableString(BeatmapSet.TitleUnicode, BeatmapSet.Title), Font = OsuFont.Default.With(size: 22.5f, weight: FontWeight.SemiBold), RelativeSizeAxes = Axes.X, Truncate = true }, Empty() } } }, artistContainer = new GridContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, ColumnDimensions = new[] { new Dimension(), new Dimension(GridSizeMode.AutoSize) }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, Content = new[] { new[] { new OsuSpriteText { Text = createArtistText(), Font = OsuFont.Default.With(size: 17.5f, weight: FontWeight.SemiBold), RelativeSizeAxes = Axes.X, Truncate = true }, Empty() }, } }, new OsuSpriteText { RelativeSizeAxes = Axes.X, Truncate = true, Text = BeatmapSet.Source, Shadow = false, Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold), Colour = colourProvider.Content2 }, } }, new Container { Name = @"Bottom content", RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Children = new Drawable[] { idleBottomContent = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 3), AlwaysPresent = true, Children = new Drawable[] { new LinkFlowContainer(s => { s.Shadow = false; s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold); }).With(d => { d.AutoSizeAxes = Axes.Both; d.Margin = new MarginPadding { Top = 2 }; d.AddText("mapped by ", t => t.Colour = colourProvider.Content2); d.AddUserLink(BeatmapSet.Author); }), statisticsContainer = new GridContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.AutoSize) }, ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.AutoSize), new Dimension() }, Content = new[] { new Drawable[3], new Drawable[3] } }, new BeatmapCardExtraInfoRow(BeatmapSet) } }, downloadProgressBar = new BeatmapCardDownloadProgressBar { RelativeSizeAxes = Axes.X, Height = 6, Anchor = Anchor.Centre, Origin = Anchor.Centre, State = { BindTarget = DownloadTracker.State }, Progress = { BindTarget = DownloadTracker.Progress } } } } } } } }; c.ExpandedContent = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Horizontal = 10, Vertical = 13 }, Child = new BeatmapCardDifficultyList(BeatmapSet) }; c.Expanded.BindTarget = Expanded; }); if (BeatmapSet.HasVideo) { leftIconArea.Add(new IconPill(FontAwesome.Solid.Film) { IconSize = new Vector2(20) }); } if (BeatmapSet.HasStoryboard) { leftIconArea.Add(new IconPill(FontAwesome.Solid.Image) { IconSize = new Vector2(20) }); } if (BeatmapSet.HasExplicitContent) { titleContainer.Content[0][1] = new ExplicitContentBeatmapPill { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding { Left = 5 } }; } if (BeatmapSet.TrackId != null) { artistContainer.Content[0][1] = new FeaturedArtistBeatmapPill { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding { Left = 5 } }; } createStatistics(); Action = () => beatmapSetOverlay?.FetchAndShowBeatmapSet(BeatmapSet.OnlineID); }
public VisualisedDrawable(VisualisedDrawable parent, Drawable d, TreeContainer tree) { this.tree = tree; nestingDepth = (parent?.nestingDepth ?? 0) + 1; Target = d; attachEvents(); var sprite = Target as Sprite; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Add(new[] { activityInvalidate = new Box { Colour = Color4.Yellow, Size = new Vector2(2, line_height), Position = new Vector2(6, 0), Alpha = 0 }, activityLayout = new Box { Colour = Color4.Orange, Size = new Vector2(2, line_height), Position = new Vector2(3, 0), Alpha = 0 }, activityAutosize = new Box { Colour = Color4.Red, Size = new Vector2(2, line_height), Position = new Vector2(0, 0), Alpha = 0 }, previewBox = sprite?.Texture == null ? previewBox = new Box { Colour = Color4.White } : new Sprite { Texture = sprite.Texture, Scale = new Vector2(sprite.Texture.DisplayWidth / sprite.Texture.DisplayHeight, 1), }, new Container { AutoSizeAxes = Axes.Both, Position = new Vector2(24, -3), Children = new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both, Size = new Vector2(1, 0.8f), Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Colour = Color4.Transparent, }, highlightBackground = new Box { RelativeSizeAxes = Axes.Both, Size = new Vector2(1, 0.8f), Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Colour = Color4.Khaki.Opacity(0.4f), Alpha = 0 }, text = new SpriteText() } }, Flow = new FillFlowContainer <VisualisedDrawable> { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Position = new Vector2(10, 14) }, }); previewBox.Position = new Vector2(9, 0); previewBox.Size = new Vector2(line_height, line_height); updateSpecifics(); }
private void load(OsuColour colours, AudioManager audio) { colourNormal = colours.Yellow; colourHover = colours.YellowDark; sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); Children = new Drawable[] { background = new Box { Alpha = 0.2f, Colour = Color4.Black, RelativeSizeAxes = Axes.Both, }, aspect = new AspectContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Y, Height = 0.6f, Masking = true, CornerRadius = 15, Children = new Drawable[] { box = new Box { RelativeSizeAxes = Axes.Both, Colour = colourNormal, }, flow = new FillFlowContainer { Anchor = Anchor.TopCentre, RelativePositionAxes = Axes.Y, Y = 0.4f, AutoSizeAxes = Axes.Both, Origin = Anchor.Centre, Direction = FillDirection.Horizontal, Children = new[] { new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.fa_chevron_right }, new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.fa_chevron_right }, new SpriteIcon { Size = new Vector2(15), Shadow = true, Icon = FontAwesome.fa_chevron_right }, } }, new OsuSpriteText { Anchor = Anchor.TopCentre, RelativePositionAxes = Axes.Y, Y = 0.7f, TextSize = 12, Font = @"Exo2.0-Bold", Origin = Anchor.Centre, Text = @"SKIP", }, } } }; }
private void buildTest() { Add(new Container { Padding = new MarginPadding(25f), RelativeSizeAxes = Axes.Both, Children = new Drawable[] { fillContainer = new FillFlowContainer { RelativeSizeAxes = Axes.Both, AutoSizeAxes = Axes.None, }, new Box { Anchor = Anchor.CentreLeft, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Y, Size = new Vector2(3, 1), Colour = Color4.HotPink, }, new Box { Anchor = Anchor.CentreRight, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Y, Size = new Vector2(3, 1), Colour = Color4.HotPink, }, new Box { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, Size = new Vector2(1, 3), Colour = Color4.HotPink, }, new Box { Anchor = Anchor.BottomCentre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, Size = new Vector2(1, 3), Colour = Color4.HotPink, } } }); AddToggleStep("Rotate Container", state => { fillContainer.RotateTo(state ? 45f : 0, 1000); }); AddToggleStep("Scale Container", state => { fillContainer.ScaleTo(state ? 1.2f : 1f, 1000); }); AddToggleStep("Shear Container", state => { fillContainer.Shear = state ? new Vector2(0.5f, 0f) : new Vector2(0f, 0f); }); AddToggleStep("Center Container Anchor", state => { fillContainer.Anchor = state ? Anchor.Centre : Anchor.TopLeft; }); AddToggleStep("Center Container Origin", state => { fillContainer.Origin = state ? Anchor.Centre : Anchor.TopLeft; }); AddToggleStep("Autosize Container", state => { if (state) { fillContainer.RelativeSizeAxes = Axes.None; fillContainer.AutoSizeAxes = Axes.Both; } else { fillContainer.AutoSizeAxes = Axes.None; fillContainer.RelativeSizeAxes = Axes.Both; fillContainer.Width = 1; fillContainer.Height = 1; } }); AddToggleStep("Rotate children", state => { if (state) { foreach (var child in fillContainer.Children) { child.RotateTo(45f, 1000); } } else { foreach (var child in fillContainer.Children) { child.RotateTo(0f, 1000); } } }); AddToggleStep("Shear children", state => { if (state) { foreach (var child in fillContainer.Children) { child.Shear = new Vector2(0.2f, 0.2f); } } else { foreach (var child in fillContainer.Children) { child.Shear = Vector2.Zero; } } }); AddToggleStep("Scale children", state => { if (state) { foreach (var child in fillContainer.Children) { child.ScaleTo(1.25f, 1000); } } else { foreach (var child in fillContainer.Children) { child.ScaleTo(1f, 1000); } } }); AddToggleStep("Randomly scale children", state => { if (state) { foreach (var child in fillContainer.Children) { child.ScaleTo(RNG.NextSingle(1, 2), 1000); } } else { foreach (var child in fillContainer.Children) { child.ScaleTo(1f, 1000); } } }); AddToggleStep("Randomly set child origins", state => { if (state) { foreach (var child in fillContainer.Children) { switch (RNG.Next(9)) { case 0: child.Origin = Anchor.TopLeft; break; case 1: child.Origin = Anchor.TopCentre; break; case 2: child.Origin = Anchor.TopRight; break; case 3: child.Origin = Anchor.CentreLeft; break; case 4: child.Origin = Anchor.Centre; break; case 5: child.Origin = Anchor.CentreRight; break; case 6: child.Origin = Anchor.BottomLeft; break; case 7: child.Origin = Anchor.BottomCentre; break; case 8: child.Origin = Anchor.BottomRight; break; } } } else { foreach (var child in fillContainer.Children) { child.Origin = originDropdown.Current; } } }); AddToggleStep("Stop adding children", state => { doNotAddChildren = state; }); scheduledAdder?.Cancel(); scheduledAdder = Scheduler.AddDelayed( () => { if (fillContainer.Parent == null) { scheduledAdder.Cancel(); } if (doNotAddChildren) { fillContainer.Invalidate(); } if (fillContainer.Children.Count < 1000 && !doNotAddChildren) { fillContainer.Add(new Container { Anchor = childAnchor, Origin = childOrigin, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new Box { Width = 50, Height = 50, Colour = Color4.White }, new SpriteText { Colour = Color4.Black, RelativePositionAxes = Axes.Both, Position = new Vector2(0.5f, 0.5f), Origin = Anchor.Centre, Text = fillContainer.Children.Count.ToString() } } }); } }, 100, true ); }
public UnderConstructionMessage(string name) { RelativeSizeAxes = Axes.Both; Size = new Vector2(0.3f); Anchor = Anchor.Centre; Origin = Anchor.Centre; var colour = getColourFor(name); InternalChildren = new Drawable[] { boxContainer = new Container { CornerRadius = 20, Masking = true, RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = colour, Alpha = 0.2f, Blending = BlendingParameters.Additive, }, TextContainer = new FillFlowContainer { AutoSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, Direction = FillDirection.Vertical, Children = new Drawable[] { new SpriteIcon { Icon = FontAwesome.Solid.UniversalAccess, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Size = new Vector2(50), }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = name, Colour = colour.Lighten(0.8f), Font = OsuFont.GetFont(size: 36), }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = "this preview is not yet ready for use!", Font = OsuFont.GetFont(size: 20), }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = "please check back a bit later.", Font = OsuFont.GetFont(size: 14), }, } }, } }, }; }
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, GameHost host) { scalingMode = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling); sizeFullscreen = config.GetBindable <Size>(FrameworkSetting.SizeFullscreen); scalingSizeX = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeX); scalingSizeY = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeY); scalingPositionX = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionX); scalingPositionY = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionY); if (host.Window != null) { currentDisplay.BindTo(host.Window.CurrentDisplayBindable); windowModes.BindTo(host.Window.SupportedWindowModes); } Children = new Drawable[] { windowModeDropdown = new SettingsDropdown <WindowMode> { LabelText = "Screen mode", ItemSource = windowModes, Current = config.GetBindable <WindowMode>(FrameworkSetting.WindowMode), }, resolutionDropdown = new ResolutionSettingsDropdown { LabelText = "Resolution", ShowsDefaultIndicator = false, ItemSource = resolutions, Current = sizeFullscreen }, new SettingsSlider <float, UIScaleSlider> { LabelText = "UI Scaling", TransferValueOnCommit = true, Current = osuConfig.GetBindable <float>(OsuSetting.UIScale), KeyboardStep = 0.01f, Keywords = new[] { "scale", "letterbox" }, }, new SettingsEnumDropdown <ScalingMode> { LabelText = "Screen Scaling", Current = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling), Keywords = new[] { "scale", "letterbox" }, }, scalingSettings = new FillFlowContainer <SettingsSlider <float> > { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, AutoSizeDuration = transition_duration, AutoSizeEasing = Easing.OutQuint, Masking = true, Children = new[] { new SettingsSlider <float> { LabelText = "Horizontal position", Current = scalingPositionX, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Vertical position", Current = scalingPositionY, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Horizontal scale", Current = scalingSizeX, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Vertical scale", Current = scalingSizeY, KeyboardStep = 0.01f, DisplayAsPercentage = true }, } }, }; }
public ModSelectOverlay() { FirstWaveColour = OsuColour.FromHex(@"19b0e2"); SecondWaveColour = OsuColour.FromHex(@"2280a2"); ThirdWaveColour = OsuColour.FromHex(@"005774"); FourthWaveColour = OsuColour.FromHex(@"003a4e"); Height = 510; Content.RelativeSizeAxes = Axes.X; Content.AutoSizeAxes = Axes.Y; Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Masking = true, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = new Color4(36, 50, 68, 255) }, new Triangles { TriangleScale = 5, RelativeSizeAxes = Axes.X, Height = Height, //set the height from the start to ensure correct triangle density. ColourLight = new Color4(53, 66, 82, 255), ColourDark = new Color4(41, 54, 70, 255), }, }, }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Direction = FillDirection.Vertical, Spacing = new Vector2(0f, 10f), Children = new Drawable[] { // Header new Container { RelativeSizeAxes = Axes.X, Height = 82, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = OsuColour.Gray(10).Opacity(100), }, new FillFlowContainer { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Width = content_width, Padding = new MarginPadding { Top = 10, Bottom = 10, }, Children = new Drawable[] { new OsuSpriteText { Font = @"Exo2.0-Bold", Text = @"Gameplay Mods", TextSize = 22, Shadow = true, Margin = new MarginPadding { Bottom = 4, }, }, new OsuSpriteText { Text = @"Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.", TextSize = 18, Shadow = true, }, new OsuSpriteText { Text = @"Others are just for fun.", TextSize = 18, Shadow = true, }, }, }, }, }, // Body ModSectionsContainer = new FillFlowContainer <ModSection> { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(0f, 10f), Width = content_width, Children = new ModSection[] { new DifficultyReductionSection { RelativeSizeAxes = Axes.X, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Action = modButtonPressed, }, new DifficultyIncreaseSection { RelativeSizeAxes = Axes.X, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Action = modButtonPressed, }, new AssistedSection { RelativeSizeAxes = Axes.X, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Action = modButtonPressed, }, } }, // Footer new Container { RelativeSizeAxes = Axes.X, Height = 70, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = new Color4(172, 20, 116, 255), Alpha = 0.5f, }, footerContainer = new FillFlowContainer { Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Width = content_width, Direction = FillDirection.Horizontal, Padding = new MarginPadding { Vertical = 15 }, Children = new Drawable[] { DeselectAllButton = new TriangleButton { Width = 180, Text = "Deselect All", Action = DeselectAll, Margin = new MarginPadding { Right = 20 } }, new OsuSpriteText { Text = @"Score Multiplier: ", TextSize = 30, Shadow = true, Margin = new MarginPadding { Top = 5 } }, MultiplierLabel = new OsuSpriteText { Font = @"Exo2.0-Bold", TextSize = 30, Shadow = true, Margin = new MarginPadding { Top = 5 } } } } }, }, }, }, }; }
public Stage(int firstColumnIndex, StageDefinition definition, ref ManiaAction normalColumnStartAction, ref ManiaAction specialColumnStartAction) { this.firstColumnIndex = firstColumnIndex; Name = "Stage"; Anchor = Anchor.Centre; Origin = Anchor.Centre; RelativeSizeAxes = Axes.Y; AutoSizeAxes = Axes.X; InternalChildren = new Drawable[] { new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Children = new Drawable[] { new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.StageBackground), _ => new DefaultStageBackground()) { RelativeSizeAxes = Axes.Both }, columnFlow = new FillFlowContainer <Column> { Name = "Columns", RelativeSizeAxes = Axes.Y, AutoSizeAxes = Axes.X, Direction = FillDirection.Horizontal, Padding = new MarginPadding { Left = COLUMN_SPACING, Right = COLUMN_SPACING }, }, new Container { Name = "Barlines mask", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Y, Width = 1366, // Bar lines should only be masked on the vertical axis BypassAutoSizeAxes = Axes.Both, Masking = true, Child = barLineContainer = new HitObjectArea(HitObjectContainer) { Name = "Bar lines", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.Y, } }, new SkinnableDrawable(new ManiaSkinComponent(ManiaSkinComponents.StageForeground), _ => null) { RelativeSizeAxes = Axes.Both }, judgements = new JudgementContainer <DrawableManiaJudgement> { Anchor = Anchor.TopCentre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Y = HIT_TARGET_POSITION + 150, }, topLevelContainer = new Container { RelativeSizeAxes = Axes.Both } } } }; for (int i = 0; i < definition.Columns; i++) { var columnType = definition.GetTypeOfColumn(i); var column = new Column(firstColumnIndex + i) { ColumnType = columnType, AccentColour = columnColours[columnType], Action = { Value = columnType == ColumnType.Special ? specialColumnStartAction++ : normalColumnStartAction++ } }; AddColumn(column); } }
private void load(BeatmapDifficultyCache beatmapDifficultyCache) { var beatmap = score.Beatmap; var metadata = beatmap.BeatmapSet?.Metadata ?? beatmap.Metadata; var creator = metadata.Author?.Username; var topStatistics = new List <StatisticDisplay> { new AccuracyStatistic(score.Accuracy), new ComboStatistic(score.MaxCombo, !score.Statistics.TryGetValue(HitResult.Miss, out var missCount) || missCount == 0), new PerformanceStatistic(score), }; var bottomStatistics = new List <HitResultStatistic>(); foreach (var result in score.GetStatisticsForDisplay()) { bottomStatistics.Add(new HitResultStatistic(result)); } statisticDisplays.AddRange(topStatistics); statisticDisplays.AddRange(bottomStatistics); var starDifficulty = beatmapDifficultyCache.GetDifficultyAsync(beatmap, score.Ruleset, score.Mods).Result; InternalChildren = new Drawable[] { new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(20), Children = new Drawable[] { new FillFlowContainer { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = new RomanisableString(metadata.TitleUnicode, metadata.Title), Font = OsuFont.Torus.With(size: 20, weight: FontWeight.SemiBold), MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2, Truncate = true, }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = new RomanisableString(metadata.ArtistUnicode, metadata.Artist), Font = OsuFont.Torus.With(size: 14, weight: FontWeight.SemiBold), MaxWidth = ScorePanel.EXPANDED_WIDTH - padding * 2, Truncate = true, }, new Container { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Margin = new MarginPadding { Top = 40 }, RelativeSizeAxes = Axes.X, Height = 230, Child = new AccuracyCircle(score) { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, } }, scoreCounter = new TotalScoreCounter { Margin = new MarginPadding { Top = 0, Bottom = 5 }, Current = { Value = 0 }, Alpha = 0, AlwaysPresent = true }, starAndModDisplay = new FillFlowContainer { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both, Spacing = new Vector2(5, 0), Children = new Drawable[] { new StarRatingDisplay(starDifficulty) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft }, } }, new FillFlowContainer { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Direction = FillDirection.Vertical, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = beatmap.Version, Font = OsuFont.Torus.With(size: 16, weight: FontWeight.SemiBold), }, new OsuTextFlowContainer(s => s.Font = OsuFont.Torus.With(size: 12)) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, }.With(t => { if (!string.IsNullOrEmpty(creator)) { t.AddText("mapped by "); t.AddText(creator, s => s.Font = s.Font.With(weight: FontWeight.SemiBold)); } }) } }, } }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5), Children = new Drawable[] { new GridContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Content = new[] { topStatistics.Cast <Drawable>().ToArray() }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), } }, new GridContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Content = new[] { bottomStatistics.Where(s => s.Result <= HitResult.Perfect).ToArray() }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), } }, new GridContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Content = new[] { bottomStatistics.Where(s => s.Result > HitResult.Perfect).ToArray() }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), } } } } } }, new OsuSpriteText { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold), Text = $"Played on {score.Date.ToLocalTime():d MMMM yyyy HH:mm}" } }; if (score.Mods.Any()) { starAndModDisplay.Add(new ModDisplay { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, DisplayUnrankedText = false, ExpansionMode = ExpansionMode.AlwaysExpanded, Scale = new Vector2(0.5f), Current = { Value = score.Mods } }); } }
public TopScoreUserSection() { AutoSizeAxes = Axes.Both; InternalChild = new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10, 0), Children = new Drawable[] { new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { rankText = new OsuSpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold) }, rank = new UpdateableRank(ScoreRank.D) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(28), FillMode = FillMode.Fit, }, } }, avatar = new UpdateableAvatar { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(70), Masking = true, CornerRadius = 5, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Colour = Color4.Black.Opacity(0.25f), Offset = new Vector2(0, 2), Radius = 1, }, ShowGuestOnNull = false, }, new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 3), Children = new Drawable[] { usernameText = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true)) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, }, date = new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(size: 10) }, flag = new UpdateableFlag { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Size = new Vector2(19, 13), Margin = new MarginPadding { Top = 3 }, // makes spacing look more even ShowPlaceholderOnNull = false, }, } } } }; }
private void load() { LinkFlowContainer username; FillFlowContainer info; LinkFlowContainer message; GridContainer content; VotePill votePill; RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; InternalChildren = new Drawable[] { new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding(margin) { Left = margin + 5 }, Child = content = new GridContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, ColumnDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(), }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, Content = new[] { new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Margin = new MarginPadding { Horizontal = margin }, Direction = FillDirection.Horizontal, Spacing = new Vector2(5, 0), Children = new Drawable[] { new Container { Anchor = Anchor.Centre, Origin = Anchor.Centre, Width = 40, AutoSizeAxes = Axes.Y, Child = votePill = new VotePill(Comment) { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, } }, new UpdateableAvatar(Comment.User) { Anchor = Anchor.Centre, Origin = Anchor.Centre, Size = new Vector2(avatar_size), Masking = true, CornerRadius = avatar_size / 2f, CornerExponent = 2, }, } }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(0, 3), Children = new Drawable[] { new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(7, 0), Children = new Drawable[] { username = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true)) { AutoSizeAxes = Axes.Both, }, new ParentUsername(Comment), new OsuSpriteText { Alpha = Comment.IsDeleted ? 1 : 0, Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold, italics: true), Text = @"deleted", } } }, message = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(size: 14)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Right = 40 } }, info = new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10, 0), Children = new Drawable[] { new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(size: 12), Colour = OsuColour.Gray(0.7f), Text = HumanizerUtils.Humanize(Comment.CreatedAt) }, repliesButton = new RepliesButton(Comment.RepliesCount) { Expanded = { BindTarget = childrenExpanded } }, loadMoreCommentsButton = new LoadMoreCommentsButton { Action = () => RepliesRequested(this, ++currentPage) } } } } } } } } }, childCommentsVisibilityContainer = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { childCommentsContainer = new FillFlowContainer { Padding = new MarginPadding { Left = 20 }, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical }, deletedCommentsCounter = new DeletedCommentsCounter { ShowDeleted = { BindTarget = ShowDeleted } }, showMoreButton = new ShowMoreButton { Action = () => RepliesRequested(this, ++currentPage) } } }, } }, chevronButton = new ChevronButton { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Margin = new MarginPadding { Right = 30, Top = margin }, Expanded = { BindTarget = childrenExpanded }, Alpha = 0 } }; if (Comment.UserId.HasValue) { username.AddUserLink(Comment.User); } else { username.AddText(Comment.LegacyName); } if (Comment.EditedAt.HasValue) { info.Add(new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(size: 12), Text = $@"edited {HumanizerUtils.Humanize(Comment.EditedAt.Value)} by {Comment.EditedUser.Username}" }); } if (Comment.HasMessage) { var formattedSource = MessageFormatter.FormatText(Comment.Message); message.AddLinks(formattedSource.Text, formattedSource.Links); } if (Comment.IsDeleted) { content.FadeColour(OsuColour.Gray(0.5f)); votePill.Hide(); } if (Comment.IsTopLevel) { AddInternal(new Box { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, RelativeSizeAxes = Axes.X, Height = 1.5f, Colour = OsuColour.Gray(0.1f) }); } if (Replies.Any()) { onRepliesAdded(Replies); } Replies.CollectionChanged += (_, args) => { switch (args.Action) { case NotifyCollectionChangedAction.Add: onRepliesAdded(args.NewItems.Cast <DrawableComment>()); break; default: throw new NotSupportedException(@"You can only add replies to this list. Other actions are not supported."); } }; }
private void load(Storage storage) { config = new TestBrowserConfig(storage); Children = new Drawable[] { //Main category new Container { RelativeSizeAxes = Axes.Y, Size = new Vector2(200, 1), Children = new Drawable[] { new Box { Colour = Color4.DimGray, RelativeSizeAxes = Axes.Both }, new ScrollContainer { RelativeSizeAxes = Axes.Both, ScrollbarOverlapsContent = false, Children = new[] { //main category leftFlowContainer = new FillFlowContainer <TestCaseCategoryButton> { Padding = new MarginPadding(3), Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5), AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }, } } } }, //Same category list new Container { RelativeSizeAxes = Axes.Y, Size = new Vector2(240, 1), Position = new Vector2(205, 1), Children = new Drawable[] { new Box { Colour = new Color4(142, 101, 142, 150), RelativeSizeAxes = Axes.Both }, new ScrollContainer { RelativeSizeAxes = Axes.Both, ScrollbarOverlapsContent = false, Children = new[] { //sub category secondaryFlowContainer = new FillFlowContainer <TestCaseButton> { Colour = new Color4(255, 255, 255, 255), Padding = new MarginPadding(3), Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5), AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, } } } } }, //TestSpace testContentContainer = new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = 450 }, Children = new Drawable[] { compilingNotice = new Container { Alpha = 0, Anchor = Anchor.Centre, Origin = Anchor.Centre, Masking = true, Depth = float.MinValue, CornerRadius = 5, AutoSizeAxes = Axes.Both, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, new SpriteText { TextSize = 30, Text = @"Compiling new version..." } }, } } } }; //Background backgroundCompiler = new DynamicClassCompiler <CategoryTestCase>() { CompilationStarted = compileStarted, CompilationFinished = compileFinished, WatchDirectory = @"Tests", }; //update category updateCategory(); //TODO : get first category's name UpdateCategoryItem(""); try { backgroundCompiler.Start(); } catch { //it's okay for this to fail for now. } }
public void TestUnloadAndReload() { OsuScrollContainer scroll = null; List <UpdateableBeatmapSetCover> covers = new List <UpdateableBeatmapSetCover>(); AddStep("setup covers", () => { BeatmapSetInfo setInfo = CreateBeatmap(Ruleset.Value).BeatmapInfo.BeatmapSet; FillFlowContainer fillFlow; Child = scroll = new OsuScrollContainer { Size = new Vector2(500f), Child = fillFlow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Spacing = new Vector2(10), Padding = new MarginPadding { Bottom = 550 } } }; var coverTypes = Enum.GetValues(typeof(BeatmapSetCoverType)) .Cast <BeatmapSetCoverType>() .ToList(); for (int i = 0; i < 25; i++) { var coverType = coverTypes[i % coverTypes.Count]; var cover = new UpdateableBeatmapSetCover(coverType) { BeatmapSet = setInfo, Height = 100, Masking = true, }; if (coverType == BeatmapSetCoverType.Cover) { cover.Width = 500; } else if (coverType == BeatmapSetCoverType.Card) { cover.Width = 400; } else if (coverType == BeatmapSetCoverType.List) { cover.Size = new Vector2(100, 50); } fillFlow.Add(cover); covers.Add(cover); } }); var loadedCovers = covers.Where(c => c.ChildrenOfType <BeatmapSetCover>().SingleOrDefault()?.IsLoaded ?? false); AddUntilStep("some loaded", () => loadedCovers.Any()); AddStep("scroll to end", () => scroll.ScrollToEnd()); AddUntilStep("all unloaded", () => !loadedCovers.Any()); }
private void load(OsuColour colours) { Container audioTrackFileChooserContainer = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, }; Child = new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(50), Child = new Container { RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = 10, Children = new Drawable[] { new Box { Colour = colours.GreySeafoamDark, RelativeSizeAxes = Axes.Both, }, new OsuScrollContainer { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(10), Child = flow = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Spacing = new Vector2(20), Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = 250, Masking = true, CornerRadius = 10, Child = new BeatmapBackgroundSprite(Beatmap.Value) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, }, }, new OsuSpriteText { Text = "Resources" }, audioTrackTextBox = new FileChooserLabelledTextBox { Label = "Audio Track", Current = { Value = Beatmap.Value.Metadata.AudioFile ?? "Click to select a track" }, Target = audioTrackFileChooserContainer, TabbableContentContainer = this }, audioTrackFileChooserContainer, new OsuSpriteText { Text = "Beatmap metadata" }, artistTextBox = new LabelledTextBox { Label = "Artist", Current = { Value = Beatmap.Value.Metadata.Artist }, TabbableContentContainer = this }, titleTextBox = new LabelledTextBox { Label = "Title", Current = { Value = Beatmap.Value.Metadata.Title }, TabbableContentContainer = this }, creatorTextBox = new LabelledTextBox { Label = "Creator", Current = { Value = Beatmap.Value.Metadata.AuthorString }, TabbableContentContainer = this }, difficultyTextBox = new LabelledTextBox { Label = "Difficulty Name", Current = { Value = Beatmap.Value.BeatmapInfo.Version }, TabbableContentContainer = this }, } }, }, } } }; audioTrackTextBox.Current.BindValueChanged(audioTrackChanged); foreach (var item in flow.OfType <LabelledTextBox>()) { item.OnCommit += onCommit; } }
public void TestMultipleStatuses() { AddStep("create rooms", () => { Child = new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Size = new Vector2(0.9f), Spacing = new Vector2(10), Children = new Drawable[] { createLoungeRoom(new Room { Name = { Value = "Multiplayer room" }, Status = { Value = new RoomStatusOpen() }, EndDate = { Value = DateTimeOffset.Now.AddDays(1) }, Type = { Value = MatchType.HeadToHead }, Playlist = { new PlaylistItem { Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo) { BeatmapInfo = { StarDifficulty = 2.5 } }.BeatmapInfo, } } } }), createLoungeRoom(new Room { Name = { Value = "Multiplayer room" }, Status = { Value = new RoomStatusOpen() }, EndDate = { Value = DateTimeOffset.Now.AddDays(1) }, Type = { Value = MatchType.HeadToHead }, Playlist = { new PlaylistItem { Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo) { BeatmapInfo = { StarDifficulty = 2.5, Metadata = { Artist = "very very very very very very very very very long artist", ArtistUnicode = "very very very very very very very very very long artist", Title = "very very very very very very very very very very very long title", TitleUnicode = "very very very very very very very very very very very long title", } } }.BeatmapInfo, } } } }), createLoungeRoom(new Room { Name = { Value = "Playlist room with multiple beatmaps" }, Status = { Value = new RoomStatusPlaying() }, EndDate = { Value = DateTimeOffset.Now.AddDays(1) }, Playlist = { new PlaylistItem { Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo) { BeatmapInfo = { StarDifficulty = 2.5 } }.BeatmapInfo, } }, new PlaylistItem { Beatmap = { Value = new TestBeatmap(new OsuRuleset().RulesetInfo) { BeatmapInfo = { StarDifficulty = 4.5 } }.BeatmapInfo, } } } }), createLoungeRoom(new Room { Name = { Value = "Finished room" }, Status = { Value = new RoomStatusEnded() }, EndDate = { Value = DateTimeOffset.Now }, }), createLoungeRoom(new Room { Name = { Value = "Spotlight room" }, Status = { Value = new RoomStatusOpen() }, Category = { Value = RoomCategory.Spotlight }, }), } }; }); }
private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, GameHost host) { scalingMode = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling); sizeFullscreen = config.GetBindable <Size>(FrameworkSetting.SizeFullscreen); scalingSizeX = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeX); scalingSizeY = osuConfig.GetBindable <float>(OsuSetting.ScalingSizeY); scalingPositionX = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionX); scalingPositionY = osuConfig.GetBindable <float>(OsuSetting.ScalingPositionY); if (host.Window != null) { windowModes.BindTo(host.Window.SupportedWindowModes); } Container resolutionSettingsContainer; Children = new Drawable[] { windowModeDropdown = new SettingsDropdown <WindowMode> { LabelText = "Screen mode", Current = config.GetBindable <WindowMode>(FrameworkSetting.WindowMode), ItemSource = windowModes, }, resolutionSettingsContainer = new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y }, new SettingsSlider <float, UIScaleSlider> { LabelText = "UI Scaling", TransferValueOnCommit = true, Current = osuConfig.GetBindable <float>(OsuSetting.UIScale), KeyboardStep = 0.01f, Keywords = new[] { "scale", "letterbox" }, }, new SettingsEnumDropdown <ScalingMode> { LabelText = "Screen Scaling", Current = osuConfig.GetBindable <ScalingMode>(OsuSetting.Scaling), Keywords = new[] { "scale", "letterbox" }, }, scalingSettings = new FillFlowContainer <SettingsSlider <float> > { Direction = FillDirection.Vertical, RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, AutoSizeDuration = transition_duration, AutoSizeEasing = Easing.OutQuint, Masking = true, Children = new[] { new SettingsSlider <float> { LabelText = "Horizontal position", Current = scalingPositionX, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Vertical position", Current = scalingPositionY, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Horizontal scale", Current = scalingSizeX, KeyboardStep = 0.01f, DisplayAsPercentage = true }, new SettingsSlider <float> { LabelText = "Vertical scale", Current = scalingSizeY, KeyboardStep = 0.01f, DisplayAsPercentage = true }, } }, }; scalingSettings.ForEach(s => bindPreviewEvent(s.Current)); var resolutions = getResolutions(); if (resolutions.Count > 1) { resolutionSettingsContainer.Child = resolutionDropdown = new ResolutionSettingsDropdown { LabelText = "Resolution", ShowsDefaultIndicator = false, Items = resolutions, Current = sizeFullscreen }; windowModeDropdown.Current.BindValueChanged(mode => { if (mode.NewValue == WindowMode.Fullscreen) { resolutionDropdown.Show(); sizeFullscreen.TriggerChange(); } else { resolutionDropdown.Hide(); } }, true); } scalingMode.BindValueChanged(mode => { scalingSettings.ClearTransforms(); scalingSettings.AutoSizeAxes = mode.NewValue != ScalingMode.Off ? Axes.Y : Axes.None; if (mode.NewValue == ScalingMode.Off) { scalingSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint); } scalingSettings.ForEach(s => s.TransferValueOnCommit = mode.NewValue == ScalingMode.Everything); }, true); windowModes.CollectionChanged += (sender, args) => windowModesChanged(); windowModesChanged(); }
public TestSceneDrawableTournamentMatch() { Container <DrawableTournamentMatch> level1; Container <DrawableTournamentMatch> level2; var match1 = new TournamentMatch( new TournamentTeam { FlagName = { Value = "AU" }, FullName = { Value = "Australia" }, }, new TournamentTeam { FlagName = { Value = "JP" }, FullName = { Value = "Japan" }, Acronym = { Value = "JPN" } }) { Team1Score = { Value = 4 }, Team2Score = { Value = 1 }, }; var match2 = new TournamentMatch( new TournamentTeam { FlagName = { Value = "RO" }, FullName = { Value = "Romania" }, } ); Child = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Children = new Drawable[] { level1 = new FillFlowContainer <DrawableTournamentMatch> { AutoSizeAxes = Axes.X, Direction = FillDirection.Vertical, Children = new[] { new DrawableTournamentMatch(match1), new DrawableTournamentMatch(match2), new DrawableTournamentMatch(new TournamentMatch()), } }, level2 = new FillFlowContainer <DrawableTournamentMatch> { AutoSizeAxes = Axes.X, Direction = FillDirection.Vertical, Margin = new MarginPadding(20), Children = new[] { new DrawableTournamentMatch(new TournamentMatch()), new DrawableTournamentMatch(new TournamentMatch()) } } } }; level1.Children[0].Match.Progression.Value = level2.Children[0].Match; level1.Children[1].Match.Progression.Value = level2.Children[0].Match; AddRepeatStep("change scores", () => match1.Team2Score.Value++, 4); AddStep("add new team", () => match2.Team2.Value = new TournamentTeam { FlagName = { Value = "PT" }, FullName = { Value = "Portugal" } }); AddStep("Add progression", () => level1.Children[2].Match.Progression.Value = level2.Children[1].Match); AddStep("start match", () => match2.StartMatch()); AddRepeatStep("change scores", () => match2.Team1Score.Value++, 10); AddStep("start submatch", () => level2.Children[0].Match.StartMatch()); AddRepeatStep("change scores", () => level2.Children[0].Match.Team1Score.Value++, 5); AddRepeatStep("change scores", () => level2.Children[0].Match.Team2Score.Value++, 4); }
protected override Drawable CreateMainContent() => new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Horizontal = 5, Vertical = 10 }, Child = new GridContainer { RelativeSizeAxes = Axes.Both, ColumnDimensions = new[] { new Dimension(), new Dimension(GridSizeMode.Absolute, 10), new Dimension(), new Dimension(GridSizeMode.Absolute, 10), new Dimension(), }, Content = new[] { new Drawable[] { // Participants column new GridContainer { RelativeSizeAxes = Axes.Both, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) }, Content = new[] { new Drawable[] { new ParticipantsListHeader() }, new Drawable[] { new ParticipantsList { RelativeSizeAxes = Axes.Both }, } } }, // Spacer null, // Beatmap column new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new Drawable[] { new OverlinedHeader("Beatmap") }, new Drawable[] { AddOrEditPlaylistButton = new PurpleTriangleButton { RelativeSizeAxes = Axes.X, Height = 40, Action = SelectBeatmap, Alpha = 0 }, }, null, new Drawable[] { new MultiplayerPlaylist { RelativeSizeAxes = Axes.Both } }, new[] { UserModsSection = new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Top = 10 }, Alpha = 0, Children = new Drawable[] { new OverlinedHeader("Extra mods"), new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(10, 0), Children = new Drawable[] { new UserModSelectButton { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Width = 90, Text = "Select", Action = ShowUserModSelect, }, new ModDisplay { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Current = UserMods, Scale = new Vector2(0.8f), }, } }, } }, }, }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.AutoSize), new Dimension(GridSizeMode.Absolute, 5), new Dimension(), new Dimension(GridSizeMode.AutoSize), } }, // Spacer null, // Main right column new GridContainer { RelativeSizeAxes = Axes.Both, Content = new[] { new Drawable[] { new OverlinedHeader("Chat") }, new Drawable[] { new MatchChatDisplay(Room) { RelativeSizeAxes = Axes.Both } } }, RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize), new Dimension(), } }, } } } };
private void load(OsuColour colours, UserProfileOverlay profile) { if (colours == null) { throw new ArgumentNullException(nameof(colours)); } FillFlowContainer infoContainer; UserCoverBackground coverBackground; AddInternal(content = new Container { RelativeSizeAxes = Axes.Both, Masking = true, CornerRadius = 5, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Colour = Color4.Black.Opacity(0.25f), Radius = 4, }, Children = new Drawable[] { new DelayedLoadWrapper(coverBackground = new UserCoverBackground(user) { RelativeSizeAxes = Axes.Both, Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, }, 300) { RelativeSizeAxes = Axes.Both }, new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black.Opacity(0.7f), }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Top = content_padding, Horizontal = content_padding }, Children = new Drawable[] { new UpdateableAvatar { Size = new Vector2(height - status_height - content_padding * 2), User = user, Masking = true, CornerRadius = 5, OpenOnClick = { Value = false }, EdgeEffect = new EdgeEffectParameters { Type = EdgeEffectType.Shadow, Colour = Color4.Black.Opacity(0.25f), Radius = 4, }, }, new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Left = height - status_height - content_padding }, Children = new Drawable[] { new OsuSpriteText { Text = user.Username, Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 18, italics: true), }, infoContainer = new FillFlowContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, AutoSizeAxes = Axes.X, Height = 20f, Direction = FillDirection.Horizontal, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { new DrawableFlag(user.Country) { Width = 30f, RelativeSizeAxes = Axes.Y, }, }, }, }, }, }, }, statusBar = new Container { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, Alpha = 0f, Children = new Drawable[] { statusBg = new Box { RelativeSizeAxes = Axes.Both, Alpha = 0.5f, }, new FillFlowContainer { Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.Both, Spacing = new Vector2(5f, 0f), Children = new Drawable[] { new SpriteIcon { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Icon = FontAwesome.fa_circle_o, Shadow = true, Size = new Vector2(14), }, statusMessage = new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Font = OsuFont.GetFont(weight: FontWeight.SemiBold), }, }, }, }, }, } }); coverBackground.OnLoadComplete += d => d.FadeInFromZero(400, Easing.Out); if (user.IsSupporter) { infoContainer.Add(new SupporterIcon { RelativeSizeAxes = Axes.Y, Width = 20f, }); } Status.ValueChanged += status => displayStatus(status.NewValue); Status.ValueChanged += status => statusBg.FadeColour(status.NewValue?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); base.Action = ViewProfile = () => { Action?.Invoke(); profile?.ShowUser(user); }; }