mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 00:23:59 +09:00
Move RoomInspector info panel content to BeatmapModeInfo to share with Match.
(cherry picked from commit 257d9d13ac81d85583314f8b5dfabf05661b1572)
This commit is contained in:
74
osu.Game/Screens/Multi/Components/BeatmapModeInfo.cs
Normal file
74
osu.Game/Screens/Multi/Components/BeatmapModeInfo.cs
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Online.Multiplayer;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Multi.Components
|
||||||
|
{
|
||||||
|
public class BeatmapModeInfo : FillFlowContainer
|
||||||
|
{
|
||||||
|
private readonly ModeTypeInfo modeTypeInfo;
|
||||||
|
private readonly BeatmapTitle beatmapTitle;
|
||||||
|
private readonly OsuSpriteText beatmapAuthor;
|
||||||
|
|
||||||
|
public BeatmapInfo Beatmap
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
modeTypeInfo.Beatmap = beatmapTitle.Beatmap = value;
|
||||||
|
|
||||||
|
if (value == null)
|
||||||
|
beatmapAuthor.Text = string.Empty;
|
||||||
|
else
|
||||||
|
beatmapAuthor.Text = $"mapped by {value.Metadata.Author}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public GameType Type
|
||||||
|
{
|
||||||
|
set { modeTypeInfo.Type = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeatmapModeInfo()
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Direction = FillDirection.Horizontal;
|
||||||
|
LayoutDuration = 100;
|
||||||
|
Spacing = new Vector2(5f, 0f);
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
modeTypeInfo = new ModeTypeInfo(),
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.X,
|
||||||
|
Height = 30,
|
||||||
|
Margin = new MarginPadding { Left = 5 },
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
beatmapTitle = new BeatmapTitle(),
|
||||||
|
beatmapAuthor = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
TextSize = 14,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
beatmapAuthor.Colour = colours.Gray9;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Localisation;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -108,7 +107,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, LocalisationEngine localisation)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Box sideStrip;
|
Box sideStrip;
|
||||||
UpdateableBeatmapSetCover cover;
|
UpdateableBeatmapSetCover cover;
|
||||||
|
@ -55,7 +55,8 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
|
|
||||||
public ModeTypeInfo()
|
public ModeTypeInfo()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.X;
|
||||||
|
Height = height;
|
||||||
|
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,6 @@ using osu.Framework.Graphics.Colour;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Localisation;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -39,8 +38,9 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
private OsuColour colours;
|
private OsuColour colours;
|
||||||
private Box statusStrip;
|
private Box statusStrip;
|
||||||
private UpdateableBeatmapSetCover cover;
|
private UpdateableBeatmapSetCover cover;
|
||||||
private FillFlowContainer topFlow, participantsFlow, participantNumbersFlow, infoPanelFlow;
|
private FillFlowContainer topFlow, participantsFlow, participantNumbersFlow;
|
||||||
private OsuSpriteText name, status;
|
private OsuSpriteText name, status;
|
||||||
|
private BeatmapModeInfo beatmapModeInfo;
|
||||||
private ScrollContainer participantsScroll;
|
private ScrollContainer participantsScroll;
|
||||||
private ParticipantInfo participantInfo;
|
private ParticipantInfo participantInfo;
|
||||||
|
|
||||||
@ -77,13 +77,12 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, LocalisationEngine localisation)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
this.colours = colours;
|
this.colours = colours;
|
||||||
|
|
||||||
ModeTypeInfo modeTypeInfo;
|
ModeTypeInfo modeTypeInfo;
|
||||||
OsuSpriteText participants, participantsSlash, maxParticipants, beatmapAuthor;
|
OsuSpriteText participants, participantsSlash, maxParticipants, beatmapAuthor;
|
||||||
BeatmapTitle beatmapTitle;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -189,35 +188,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
},
|
},
|
||||||
infoPanelFlow = new FillFlowContainer
|
beatmapModeInfo = new BeatmapModeInfo(),
|
||||||
{
|
|
||||||
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 Drawable[]
|
|
||||||
{
|
|
||||||
beatmapTitle = new BeatmapTitle(),
|
|
||||||
beatmapAuthor = new OsuSpriteText
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
TextSize = 14,
|
|
||||||
Colour = colours.Gray9,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -255,26 +226,13 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
|
|
||||||
nameBind.ValueChanged += n => name.Text = n;
|
nameBind.ValueChanged += n => name.Text = n;
|
||||||
hostBind.ValueChanged += h => participantInfo.Host = h;
|
hostBind.ValueChanged += h => participantInfo.Host = h;
|
||||||
typeBind.ValueChanged += t => modeTypeInfo.Type = t;
|
typeBind.ValueChanged += t => beatmapModeInfo.Type = t;
|
||||||
statusBind.ValueChanged += displayStatus;
|
statusBind.ValueChanged += displayStatus;
|
||||||
|
|
||||||
beatmapBind.ValueChanged += b =>
|
beatmapBind.ValueChanged += b =>
|
||||||
{
|
{
|
||||||
modeTypeInfo.Beatmap = b;
|
cover.BeatmapSet = b?.BeatmapSet;
|
||||||
|
beatmapModeInfo.Beatmap = b;
|
||||||
if (b != null)
|
|
||||||
{
|
|
||||||
cover.BeatmapSet = b.BeatmapSet;
|
|
||||||
beatmapTitle.Beatmap = b;
|
|
||||||
beatmapAuthor.Text = $"mapped by {b.Metadata.Author}";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
cover.BeatmapSet = null;
|
|
||||||
beatmapTitle.Beatmap = null;
|
|
||||||
|
|
||||||
beatmapAuthor.Text = string.Empty;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
maxParticipantsBind.ValueChanged += m =>
|
maxParticipantsBind.ValueChanged += m =>
|
||||||
@ -325,7 +283,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
cover.BeatmapSet = null;
|
cover.BeatmapSet = null;
|
||||||
participantsFlow.FadeOut(transition_duration);
|
participantsFlow.FadeOut(transition_duration);
|
||||||
participantNumbersFlow.FadeOut(transition_duration);
|
participantNumbersFlow.FadeOut(transition_duration);
|
||||||
infoPanelFlow.FadeOut(transition_duration);
|
beatmapModeInfo.FadeOut(transition_duration);
|
||||||
name.FadeOut(transition_duration);
|
name.FadeOut(transition_duration);
|
||||||
participantInfo.FadeOut(transition_duration);
|
participantInfo.FadeOut(transition_duration);
|
||||||
|
|
||||||
@ -335,7 +293,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
{
|
{
|
||||||
participantsFlow.FadeIn(transition_duration);
|
participantsFlow.FadeIn(transition_duration);
|
||||||
participantNumbersFlow.FadeIn(transition_duration);
|
participantNumbersFlow.FadeIn(transition_duration);
|
||||||
infoPanelFlow.FadeIn(transition_duration);
|
beatmapModeInfo.FadeIn(transition_duration);
|
||||||
name.FadeIn(transition_duration);
|
name.FadeIn(transition_duration);
|
||||||
participantInfo.FadeIn(transition_duration);
|
participantInfo.FadeIn(transition_duration);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user