1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-17 22:17:25 +08:00

Remove match info

This commit is contained in:
smoogipoo 2020-02-14 20:14:25 +09:00
parent b0793b06ed
commit c0dba63278
8 changed files with 2 additions and 382 deletions

View File

@ -1,35 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Screens.Multi.Match.Components;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.Multiplayer
{
public class TestSceneMatchHostInfo : OsuTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(HostInfo)
};
private readonly Bindable<User> host = new Bindable<User>(new User { Username = "SomeHost" });
public TestSceneMatchHostInfo()
{
HostInfo hostInfo;
Child = hostInfo = new HostInfo
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
};
hostInfo.Host.BindTo(host);
}
}
}

View File

@ -1,52 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Game.Screens.Multi.Match.Components;
using osu.Game.Users;
namespace osu.Game.Tests.Visual.Multiplayer
{
[TestFixture]
public class TestSceneMatchParticipants : MultiplayerTestScene
{
public TestSceneMatchParticipants()
{
Add(new Participants { RelativeSizeAxes = Axes.Both });
AddStep(@"set max to null", () => Room.MaxParticipants.Value = null);
AddStep(@"set users", () => Room.Participants.AddRange(new[]
{
new User
{
Username = @"Feppla",
Id = 4271601,
Country = new Country { FlagName = @"SE" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c2.jpg",
IsSupporter = true,
},
new User
{
Username = @"Xilver",
Id = 3099689,
Country = new Country { FlagName = @"IL" },
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c2.jpg",
IsSupporter = true,
},
new User
{
Username = @"Wucki",
Id = 5287410,
Country = new Country { FlagName = @"FI" },
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/5287410/5cfeaa9dd41cbce038ecdc9d781396ed4b0108089170bf7f50492ef8eadeb368.jpeg",
IsSupporter = true,
},
}));
AddStep(@"set max", () => Room.MaxParticipants.Value = 10);
AddStep(@"clear users", () => Room.Participants.Clear());
AddStep(@"set max to null", () => Room.MaxParticipants.Value = null);
}
}
}

View File

@ -1,47 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Multi.Match.Components
{
public class HeaderButton : TriangleButton
{
[BackgroundDependencyLoader]
private void load()
{
BackgroundColour = OsuColour.FromHex(@"1187aa");
Triangles.ColourLight = OsuColour.FromHex(@"277b9c");
Triangles.ColourDark = OsuColour.FromHex(@"1f6682");
Triangles.TriangleScale = 1.5f;
Add(new Container
{
RelativeSizeAxes = Axes.Both,
Alpha = 1f,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Alpha = 0.15f,
Blending = BlendingParameters.Additive,
},
});
}
protected override SpriteText CreateText() => new OsuSpriteText
{
Depth = -1,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 30),
};
}
}

View File

@ -1,61 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Users;
using osu.Game.Users.Drawables;
using osuTK;
namespace osu.Game.Screens.Multi.Match.Components
{
public class HostInfo : CompositeDrawable
{
public readonly IBindable<User> Host = new Bindable<User>();
private readonly LinkFlowContainer linkContainer;
private readonly UpdateableAvatar avatar;
public HostInfo()
{
AutoSizeAxes = Axes.X;
Height = 50;
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{
avatar = new UpdateableAvatar { Size = new Vector2(50) },
new FillFlowContainer
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Child = linkContainer = new LinkFlowContainer { AutoSizeAxes = Axes.Both }
}
}
};
Host.BindValueChanged(host => updateHost(host.NewValue));
}
private void updateHost(User host)
{
avatar.User = host;
if (host != null)
{
linkContainer.AddText("hosted by");
linkContainer.NewLine();
linkContainer.AddUserLink(host, s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true));
}
}
}
}

View File

@ -1,107 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.SearchableList;
using osu.Game.Screens.Multi.Components;
using osuTK;
namespace osu.Game.Screens.Multi.Match.Components
{
public class Info : MultiplayerComposite
{
public Action OnStart;
private ReadyButton readyButton;
public Info()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
}
[BackgroundDependencyLoader]
private void load()
{
HostInfo hostInfo;
InternalChildren = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.FromHex(@"28242d"),
},
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
Padding = new MarginPadding { Vertical = 20 },
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new OsuSpriteText
{
Font = OsuFont.GetFont(size: 30),
Current = RoomName
},
new RoomStatusInfo(),
}
},
hostInfo = new HostInfo(),
},
},
new FillFlowContainer
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.X,
Height = 70,
Spacing = new Vector2(10, 0),
Direction = FillDirection.Horizontal,
Children = new Drawable[]
{
readyButton = new ReadyButton
{
Action = () => OnStart?.Invoke()
}
}
}
},
},
};
hostInfo.Host.BindTo(Host);
Playlist.ItemsAdded += _ => updateBeatmap();
Playlist.ItemsRemoved += _ => updateBeatmap();
updateBeatmap();
}
private void updateBeatmap()
{
readyButton.Beatmap.Value = Playlist.FirstOrDefault()?.Beatmap.Value;
}
}
}

View File

@ -1,77 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays.SearchableList;
using osu.Game.Screens.Multi.Components;
using osu.Game.Users;
using osuTK;
namespace osu.Game.Screens.Multi.Match.Components
{
public class Participants : MultiplayerComposite
{
[BackgroundDependencyLoader]
private void load()
{
FillFlowContainer<UserPanel> usersFlow;
InternalChild = new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING },
Children = new Drawable[]
{
new OsuScrollContainer
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = 10 },
Children = new Drawable[]
{
new ParticipantCountDisplay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
},
usersFlow = new FillFlowContainer<UserPanel>
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(5),
Padding = new MarginPadding { Top = 40 },
LayoutDuration = 200,
LayoutEasing = Easing.OutQuint,
},
},
},
},
};
Participants.ItemsAdded += users =>
{
usersFlow.AddRange(users.Select(u =>
{
var panel = new UserPanel(u)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Width = 300,
};
panel.OnLoadComplete += d => d.FadeInFromZero(60);
return panel;
}).ToList());
};
Participants.ItemsRemoved += users =>
{
usersFlow.RemoveAll(p => users.Contains(p.User));
};
}
}
}

View File

@ -7,12 +7,13 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer;
using osuTK;
namespace osu.Game.Screens.Multi.Match.Components
{
public class ReadyButton : HeaderButton
public class ReadyButton : OsuButton
{
public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();

View File

@ -61,7 +61,6 @@ namespace osu.Game.Screens.Multi.Match
private void load()
{
Components.Header header;
Info info;
GridContainer bottomRow;
MatchSettingsOverlay settings;
@ -79,7 +78,6 @@ namespace osu.Game.Screens.Multi.Match
Depth = -1,
}
},
new Drawable[] { info = new Info { OnStart = onStart } },
new Drawable[]
{
bottomRow = new GridContainer