1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 07:32:55 +08:00

Share ruleset and type displaying, fix tag team icon.

This commit is contained in:
DrabWeb 2017-06-24 05:43:52 -03:00
parent 35951ffc40
commit fe875957a7
5 changed files with 118 additions and 67 deletions

View File

@ -52,10 +52,32 @@ namespace osu.Game.Online.Multiplayer
public override string Name => "Tag Team";
public override Drawable GetIcon(OsuColour colours, float size)
{
return new VersusRow(colours.Blue, colours.Blue, size * 0.6f)
return new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(2f),
Children = new[]
{
new TextAwesome
{
Icon = FontAwesome.fa_refresh,
TextSize = size * 0.75f,
Colour = colours.Blue,
Shadow = false,
UseFullGlyphHeight = false,
},
new TextAwesome
{
Icon = FontAwesome.fa_refresh,
TextSize = size * 0.75f,
Colour = colours.Pink,
Shadow = false,
UseFullGlyphHeight = false,
},
},
};
}
}

View File

@ -27,12 +27,12 @@ namespace osu.Game.Screens.Multiplayer
private const float height = 100;
private const float side_strip_width = 5;
private const float cover_width = 145;
private const float ruleset_height = 30;
private readonly Box sideStrip;
private readonly Container coverContainer, rulesetContainer, gameTypeContainer;
private readonly Container coverContainer;
private readonly OsuSpriteText name;
private readonly ParticipantInfo participantInfo;
private readonly ModeTypeInfo modeTypeInfo;
private readonly OsuSpriteText status;
private readonly FillFlowContainer<OsuSpriteText> beatmapInfoFlow;
private readonly OsuSpriteText beatmapTitle;
@ -159,29 +159,10 @@ namespace osu.Game.Screens.Multiplayer
},
},
},
new FillFlowContainer
modeTypeInfo = new ModeTypeInfo
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Height = ruleset_height,
Direction = FillDirection.Horizontal,
LayoutDuration = transition_duration,
Spacing = new Vector2(5f, 0f),
Children = new[]
{
rulesetContainer = new Container
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
},
gameTypeContainer = new Container
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
},
},
},
},
},
@ -239,17 +220,13 @@ namespace osu.Game.Screens.Multiplayer
private void displayGameType(GameType value)
{
gameTypeContainer.Children = new[]
{
new DrawableGameType(value)
{
Size = new Vector2(ruleset_height),
},
};
modeTypeInfo.Type = value;
}
private void displayBeatmap(BeatmapInfo value)
{
modeTypeInfo.Beatmap = value;
if (value != null)
{
coverContainer.FadeIn(transition_duration);
@ -264,15 +241,6 @@ namespace osu.Game.Screens.Multiplayer
}) { RelativeSizeAxes = Axes.Both }
};
rulesetContainer.FadeIn(transition_duration);
rulesetContainer.Children = new[]
{
new DifficultyIcon(value)
{
Size = new Vector2(ruleset_height),
}
};
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapDash.Text = @" - ";
beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
@ -280,7 +248,6 @@ namespace osu.Game.Screens.Multiplayer
else
{
coverContainer.FadeOut(transition_duration);
rulesetContainer.FadeOut(transition_duration);
beatmapTitle.Current = null;
beatmapArtist.Current = null;

View File

@ -0,0 +1,82 @@
using OpenTK;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Database;
using osu.Game.Online.Multiplayer;
namespace osu.Game.Screens.Multiplayer
{
public class ModeTypeInfo : Container
{
private const float height = 30;
private const float transition_duration = 100;
private readonly Container rulesetContainer, gameTypeContainer;
public BeatmapInfo Beatmap
{
set
{
if (value != null)
{
rulesetContainer.FadeIn(transition_duration);
rulesetContainer.Children = new[]
{
new DifficultyIcon(value)
{
Size = new Vector2(height),
}
};
}
else
{
rulesetContainer.FadeOut(transition_duration);
}
}
}
public GameType Type
{
set
{
gameTypeContainer.Children = new[]
{
new DrawableGameType(value)
{
Size = new Vector2(height),
},
};
}
}
public ModeTypeInfo()
{
AutoSizeAxes = Axes.Both;
Children = new[]
{
new FillFlowContainer
{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
LayoutDuration = transition_duration,
Spacing = new Vector2(5f, 0f),
Children = new[]
{
rulesetContainer = new Container
{
AutoSizeAxes = Axes.Both,
},
gameTypeContainer = new Container
{
AutoSizeAxes = Axes.Both,
},
},
},
};
}
}
}

View File

@ -27,11 +27,11 @@ namespace osu.Game.Screens.Multiplayer
{
private readonly MarginPadding contentPadding = new MarginPadding { Horizontal = 20, Vertical = 10 };
private const float transition_duration = 100;
private const float ruleset_height = 30;
private readonly Box statusStrip;
private readonly Container coverContainer, rulesetContainer, gameTypeContainer;
private readonly FillFlowContainer topFlow, participantsFlow;
private readonly ModeTypeInfo modeTypeInfo;
private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor;
private readonly ParticipantInfo participantInfo;
private readonly ScrollContainer participantsScroll;
@ -191,20 +191,13 @@ namespace osu.Game.Screens.Multiplayer
new FillFlowContainer
{
AutoSizeAxes = Axes.X,
Height = ruleset_height,
Height = 30,
Direction = FillDirection.Horizontal,
LayoutDuration = transition_duration,
Spacing = new Vector2(5f, 0f),
Children = new Drawable[]
{
rulesetContainer = new Container
{
AutoSizeAxes = Axes.Both,
},
gameTypeContainer = new Container
{
AutoSizeAxes = Axes.Both,
},
modeTypeInfo = new ModeTypeInfo(),
new Container
{
AutoSizeAxes = Axes.X,
@ -329,17 +322,13 @@ namespace osu.Game.Screens.Multiplayer
private void displayGameType(GameType value)
{
gameTypeContainer.Children = new[]
{
new DrawableGameType(value)
{
Size = new Vector2(ruleset_height),
},
};
modeTypeInfo.Type = value;
}
private void displayBeatmap(BeatmapInfo value)
{
modeTypeInfo.Beatmap = value;
if (value != null)
{
coverContainer.FadeIn(transition_duration);
@ -354,15 +343,6 @@ namespace osu.Game.Screens.Multiplayer
}) { RelativeSizeAxes = Axes.Both }
};
rulesetContainer.FadeIn(transition_duration);
rulesetContainer.Children = new[]
{
new DifficultyIcon(value)
{
Size = new Vector2(ruleset_height),
}
};
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
beatmapDash.Text = @" - ";
beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
@ -371,7 +351,6 @@ namespace osu.Game.Screens.Multiplayer
else
{
coverContainer.FadeOut(transition_duration);
rulesetContainer.FadeOut(transition_duration);
beatmapTitle.Current = null;
beatmapArtist.Current = null;

View File

@ -491,6 +491,7 @@
<Compile Include="Online\Multiplayer\GameType.cs" />
<Compile Include="Screens\Multiplayer\DrawableGameType.cs" />
<Compile Include="Screens\Multiplayer\ParticipantInfo.cs" />
<Compile Include="Screens\Multiplayer\ModeTypeInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj">