mirror of
https://github.com/ppy/osu.git
synced 2025-01-22 10:33:13 +08:00
Merge branch 'master' into user-dropdown
This commit is contained in:
commit
df8c13c12d
osu.Desktop.VisualTests
osu.Game.Rulesets.Osu/Objects
osu.Game.Rulesets.Taiko
osu.Game
74
osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs
Normal file
74
osu.Desktop.VisualTests/Tests/TestCaseDrawableRoom.cs
Normal file
@ -0,0 +1,74 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Screens.Multiplayer;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Database;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
internal class TestCaseDrawableRoom : TestCase
|
||||
{
|
||||
public override string Description => @"Select your favourite room";
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
DrawableRoom first;
|
||||
DrawableRoom second;
|
||||
Add(new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = 500f,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
first = new DrawableRoom(new Room()),
|
||||
second = new DrawableRoom(new Room()),
|
||||
}
|
||||
});
|
||||
|
||||
first.Room.Name.Value = @"Great Room Right Here";
|
||||
first.Room.Host.Value = new User { Username = @"Naeferith", Id = 9492835, Country = new Country { FlagName = @"FR" }};
|
||||
first.Room.Status.Value = new RoomStatusOpen();
|
||||
first.Room.Beatmap.Value = new BeatmapMetadata { Title = @"Seiryu", Artist = @"Critical Crystal" };
|
||||
|
||||
second.Room.Name.Value = @"Relax It's The Weekend";
|
||||
second.Room.Host.Value = new User { Username = @"peppy", Id = 2, Country = new Country { FlagName = @"AU" }};
|
||||
second.Room.Status.Value = new RoomStatusPlaying();
|
||||
second.Room.Beatmap.Value = new BeatmapMetadata { Title = @"ZAQ", Artist = @"Serendipity" };
|
||||
|
||||
AddStep(@"change state", () =>
|
||||
{
|
||||
first.Room.Status.Value = new RoomStatusPlaying();
|
||||
});
|
||||
|
||||
AddStep(@"change name", () =>
|
||||
{
|
||||
first.Room.Name.Value = @"I Changed Name";
|
||||
});
|
||||
|
||||
AddStep(@"change host", () =>
|
||||
{
|
||||
first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } };
|
||||
});
|
||||
|
||||
AddStep(@"change beatmap", () =>
|
||||
{
|
||||
first.Room.Beatmap.Value = null;
|
||||
});
|
||||
|
||||
AddStep(@"change state", () =>
|
||||
{
|
||||
first.Room.Status.Value = new RoomStatusOpen();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -220,6 +220,7 @@
|
||||
<Compile Include="Tests\TestCaseLeaderboard.cs" />
|
||||
<Compile Include="Beatmaps\TestWorkingBeatmap.cs" />
|
||||
<Compile Include="Tests\TestCaseBeatmapDetailArea.cs" />
|
||||
<Compile Include="Tests\TestCaseDrawableRoom.cs" />
|
||||
<Compile Include="Tests\TestCaseUserPanel.cs" />
|
||||
<Compile Include="Tests\TestCaseDirect.cs" />
|
||||
</ItemGroup>
|
||||
|
@ -24,6 +24,9 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
base.ApplyDefaults(controlPointInfo, difficulty);
|
||||
|
||||
SpinsRequired = (int)(Duration / 1000 * BeatmapDifficulty.DifficultyRange(difficulty.OverallDifficulty, 3, 5, 7.5));
|
||||
|
||||
// spinning doesn't match 1:1 with stable, so let's fudge them easier for the time being.
|
||||
SpinsRequired = (int)(SpinsRequired * 0.6);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,8 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Framework.Audio.Track;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
|
||||
{
|
||||
@ -22,6 +24,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
|
||||
public const float SYMBOL_SIZE = TaikoHitObject.DEFAULT_CIRCLE_DIAMETER * 0.45f;
|
||||
public const float SYMBOL_BORDER = 8;
|
||||
public const float SYMBOL_INNER_SIZE = SYMBOL_SIZE - 2 * SYMBOL_BORDER;
|
||||
private const double pre_beat_transition_time = 80;
|
||||
|
||||
/// <summary>
|
||||
/// The colour of the inner circle and outer glows.
|
||||
@ -63,6 +66,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
|
||||
|
||||
public CirclePiece(bool isStrong = false)
|
||||
{
|
||||
EarlyActivationMilliseconds = pre_beat_transition_time;
|
||||
|
||||
AddInternal(new Drawable[]
|
||||
{
|
||||
background = new CircularContainer
|
||||
@ -139,14 +144,31 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
|
||||
Content.Width = 1 / Content.Scale.X;
|
||||
}
|
||||
|
||||
private const float edge_alpha_kiai = 0.5f;
|
||||
|
||||
private void resetEdgeEffects()
|
||||
{
|
||||
background.EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = AccentColour,
|
||||
Radius = KiaiMode ? 50 : 8
|
||||
Colour = AccentColour.Opacity(KiaiMode ? edge_alpha_kiai : 1f),
|
||||
Radius = KiaiMode ? 32 : 8
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, TrackAmplitudes amplitudes)
|
||||
{
|
||||
if (!effectPoint.KiaiMode)
|
||||
return;
|
||||
|
||||
if (beatIndex % (int)timingPoint.TimeSignature != 0)
|
||||
return;
|
||||
|
||||
double duration = timingPoint.BeatLength * 2;
|
||||
|
||||
background.FadeEdgeEffectTo(1, pre_beat_transition_time, EasingTypes.OutQuint);
|
||||
using (background.BeginDelayedSequence(pre_beat_transition_time))
|
||||
background.FadeEdgeEffectTo(edge_alpha_kiai, duration, EasingTypes.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,14 +1,14 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
|
||||
{
|
||||
public class TaikoPiece : Container, IHasAccentColour
|
||||
public class TaikoPiece : BeatSyncedContainer, IHasAccentColour
|
||||
{
|
||||
private Color4 accentColour;
|
||||
/// <summary>
|
||||
@ -17,10 +17,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces
|
||||
public virtual Color4 AccentColour
|
||||
{
|
||||
get { return accentColour; }
|
||||
set
|
||||
{
|
||||
accentColour = value;
|
||||
}
|
||||
set { accentColour = value; }
|
||||
}
|
||||
|
||||
private bool kiaiMode;
|
||||
|
@ -13,12 +13,12 @@ namespace osu.Game.Rulesets.Taiko.Objects
|
||||
/// <summary>
|
||||
/// Diameter of a circle relative to the size of the <see cref="TaikoPlayfield"/>.
|
||||
/// </summary>
|
||||
public const float PLAYFIELD_RELATIVE_DIAMETER = 0.5f;
|
||||
public const float PLAYFIELD_RELATIVE_DIAMETER = 0.45f;
|
||||
|
||||
/// <summary>
|
||||
/// Scale multiplier for a strong circle.
|
||||
/// </summary>
|
||||
public const float STRONG_CIRCLE_DIAMETER_SCALE = 1.5f;
|
||||
public const float STRONG_CIRCLE_DIAMETER_SCALE = 1.4f;
|
||||
|
||||
/// <summary>
|
||||
/// Default circle diameter.
|
||||
|
@ -18,22 +18,23 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
/// </summary>
|
||||
internal class HitExplosion : CircularContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// The judgement this hit explosion visualises.
|
||||
/// </summary>
|
||||
public readonly TaikoJudgement Judgement;
|
||||
|
||||
private readonly Box innerFill;
|
||||
|
||||
public HitExplosion(TaikoJudgement judgement)
|
||||
{
|
||||
Judgement = judgement;
|
||||
private readonly bool isRim;
|
||||
|
||||
Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER);
|
||||
public HitExplosion(TaikoJudgement judgement, bool isRim)
|
||||
{
|
||||
this.isRim = isRim;
|
||||
|
||||
Judgement = judgement;
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
Size = new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_CIRCLE_DIAMETER);
|
||||
|
||||
RelativePositionAxes = Axes.Both;
|
||||
|
||||
BorderColour = Color4.White;
|
||||
@ -54,22 +55,14 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
switch (Judgement.TaikoResult)
|
||||
{
|
||||
case TaikoHitResult.Good:
|
||||
innerFill.Colour = colours.Green;
|
||||
break;
|
||||
case TaikoHitResult.Great:
|
||||
innerFill.Colour = colours.Blue;
|
||||
break;
|
||||
}
|
||||
innerFill.Colour = isRim ? colours.BlueDarker : colours.PinkDarker;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ScaleTo(5f, 1000, EasingTypes.OutQuint);
|
||||
ScaleTo(3f, 1000, EasingTypes.OutQuint);
|
||||
FadeOut(500);
|
||||
|
||||
Expire();
|
||||
@ -80,7 +73,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
/// </summary>
|
||||
public void VisualiseSecondHit()
|
||||
{
|
||||
ResizeTo(Size * TaikoHitObject.STRONG_CIRCLE_DIAMETER_SCALE, 50);
|
||||
ResizeTo(new Vector2(TaikoPlayfield.HIT_TARGET_OFFSET + TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER), 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
68
osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs
Normal file
68
osu.Game.Rulesets.Taiko/UI/KiaiHitExplosion.cs
Normal file
@ -0,0 +1,68 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Rulesets.Taiko.Judgements;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
public class KiaiHitExplosion : CircularContainer
|
||||
{
|
||||
public readonly TaikoJudgement Judgement;
|
||||
|
||||
private readonly bool isRim;
|
||||
|
||||
public KiaiHitExplosion(TaikoJudgement judgement, bool isRim)
|
||||
{
|
||||
this.isRim = isRim;
|
||||
|
||||
Judgement = judgement;
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
Size = new Vector2(TaikoHitObject.DEFAULT_CIRCLE_DIAMETER, 1);
|
||||
|
||||
Masking = true;
|
||||
Alpha = 0.25f;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0,
|
||||
AlwaysPresent = true
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Glow,
|
||||
Colour = isRim ? colours.BlueDarker : colours.PinkDarker,
|
||||
Radius = 60,
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ScaleTo(new Vector2(1, 3f), 500, EasingTypes.OutQuint);
|
||||
FadeOut(250);
|
||||
|
||||
Expire();
|
||||
}
|
||||
}
|
||||
}
|
@ -24,12 +24,12 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
/// <summary>
|
||||
/// The default play field height.
|
||||
/// </summary>
|
||||
public const float DEFAULT_PLAYFIELD_HEIGHT = 168f;
|
||||
public const float DEFAULT_PLAYFIELD_HEIGHT = 178f;
|
||||
|
||||
/// <summary>
|
||||
/// The offset from <see cref="left_area_size"/> which the center of the hit target lies at.
|
||||
/// </summary>
|
||||
private const float hit_target_offset = TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER / 2f + 40;
|
||||
public const float HIT_TARGET_OFFSET = TaikoHitObject.DEFAULT_STRONG_CIRCLE_DIAMETER / 2f + 40;
|
||||
|
||||
/// <summary>
|
||||
/// The size of the left area of the playfield. This area contains the input drum.
|
||||
@ -39,15 +39,18 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
protected override Container<Drawable> Content => hitObjectContainer;
|
||||
|
||||
private readonly Container<HitExplosion> hitExplosionContainer;
|
||||
private readonly Container<KiaiHitExplosion> kiaiExplosionContainer;
|
||||
private readonly Container<DrawableBarLine> barLineContainer;
|
||||
private readonly Container<DrawableTaikoJudgement> judgementContainer;
|
||||
|
||||
private readonly Container hitObjectContainer;
|
||||
private readonly Container topLevelHitContainer;
|
||||
private readonly Container leftBackgroundContainer;
|
||||
private readonly Container rightBackgroundContainer;
|
||||
private readonly Box leftBackground;
|
||||
private readonly Box rightBackground;
|
||||
|
||||
private readonly Container overlayBackgroundContainer;
|
||||
private readonly Container backgroundContainer;
|
||||
|
||||
private readonly Box overlayBackground;
|
||||
private readonly Box background;
|
||||
|
||||
public TaikoPlayfield()
|
||||
{
|
||||
@ -59,7 +62,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
Height = DEFAULT_PLAYFIELD_HEIGHT,
|
||||
Children = new[]
|
||||
{
|
||||
rightBackgroundContainer = new Container
|
||||
backgroundContainer = new Container
|
||||
{
|
||||
Name = "Transparent playfield background",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -73,7 +76,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
rightBackground = new Box
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.6f
|
||||
@ -82,24 +85,23 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Name = "Transparent playfield elements",
|
||||
Name = "Right area",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = left_area_size },
|
||||
Margin = new MarginPadding { Left = left_area_size },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Name = "Hit target container",
|
||||
X = hit_target_offset,
|
||||
Name = "Masked elements",
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = HIT_TARGET_OFFSET },
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
hitExplosionContainer = new Container<HitExplosion>
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
BlendingMode = BlendingMode.Additive
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
},
|
||||
barLineContainer = new Container<DrawableBarLine>
|
||||
{
|
||||
@ -114,23 +116,32 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
judgementContainer = new Container<DrawableTaikoJudgement>
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
BlendingMode = BlendingMode.Additive
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
kiaiExplosionContainer = new Container<KiaiHitExplosion>
|
||||
{
|
||||
Name = "Kiai hit explosions",
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Margin = new MarginPadding { Left = HIT_TARGET_OFFSET },
|
||||
BlendingMode = BlendingMode.Additive
|
||||
},
|
||||
judgementContainer = new Container<DrawableTaikoJudgement>
|
||||
{
|
||||
Name = "Judgements",
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Margin = new MarginPadding { Left = HIT_TARGET_OFFSET },
|
||||
BlendingMode = BlendingMode.Additive
|
||||
},
|
||||
}
|
||||
},
|
||||
leftBackgroundContainer = new Container
|
||||
overlayBackgroundContainer = new Container
|
||||
{
|
||||
Name = "Left overlay",
|
||||
Size = new Vector2(left_area_size, DEFAULT_PLAYFIELD_HEIGHT),
|
||||
BorderThickness = 1,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
leftBackground = new Box
|
||||
overlayBackground = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
@ -164,11 +175,11 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
leftBackgroundContainer.BorderColour = colours.Gray0;
|
||||
leftBackground.Colour = colours.Gray1;
|
||||
overlayBackgroundContainer.BorderColour = colours.Gray0;
|
||||
overlayBackground.Colour = colours.Gray1;
|
||||
|
||||
rightBackgroundContainer.BorderColour = colours.Gray1;
|
||||
rightBackground.Colour = colours.Gray0;
|
||||
backgroundContainer.BorderColour = colours.Gray1;
|
||||
background.Colour = colours.Gray0;
|
||||
}
|
||||
|
||||
public override void Add(DrawableHitObject<TaikoHitObject, TaikoJudgement> h)
|
||||
@ -204,6 +215,8 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
if (!wasHit)
|
||||
return;
|
||||
|
||||
bool isRim = judgedObject.HitObject is RimHit;
|
||||
|
||||
if (!secondHit)
|
||||
{
|
||||
if (judgedObject.X >= -0.05f && !(judgedObject is DrawableSwell))
|
||||
@ -212,7 +225,11 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
topLevelHitContainer.Add(judgedObject.CreateProxy());
|
||||
}
|
||||
|
||||
hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement));
|
||||
hitExplosionContainer.Add(new HitExplosion(judgedObject.Judgement, isRim));
|
||||
|
||||
if (judgedObject.HitObject.Kiai)
|
||||
kiaiExplosionContainer.Add(new KiaiHitExplosion(judgedObject.Judgement, isRim));
|
||||
|
||||
}
|
||||
else
|
||||
hitExplosionContainer.Children.FirstOrDefault(e => e.Judgement == judgedObject.Judgement)?.VisualiseSecondHit();
|
||||
@ -221,7 +238,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
/// <summary>
|
||||
/// This is a very special type of container. It serves a similar purpose to <see cref="FillMode.Fit"/>, however unlike <see cref="FillMode.Fit"/>,
|
||||
/// this will only adjust the scale relative to the height of its parent and will maintain the original width relative to its parent.
|
||||
///
|
||||
///
|
||||
/// <para>
|
||||
/// By adjusting the scale relative to the height of its parent, the aspect ratio of this container's children is maintained, however this is undesirable
|
||||
/// in the case where the hit object container should not have its width adjusted by scale. To counteract this, another container is nested inside this
|
||||
|
@ -87,6 +87,7 @@
|
||||
<Compile Include="Scoring\TaikoScoreProcessor.cs" />
|
||||
<Compile Include="UI\HitTarget.cs" />
|
||||
<Compile Include="UI\InputDrum.cs" />
|
||||
<Compile Include="UI\KiaiHitExplosion.cs" />
|
||||
<Compile Include="UI\DrawableTaikoJudgement.cs" />
|
||||
<Compile Include="UI\HitExplosion.cs" />
|
||||
<Compile Include="UI\TaikoHitRenderer.cs" />
|
||||
|
17
osu.Game/Online/Multiplayer/Room.cs
Normal file
17
osu.Game/Online/Multiplayer/Room.cs
Normal file
@ -0,0 +1,17 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Online.Multiplayer
|
||||
{
|
||||
public class Room
|
||||
{
|
||||
public Bindable<string> Name = new Bindable<string>();
|
||||
public Bindable<User> Host = new Bindable<User>();
|
||||
public Bindable<RoomStatus> Status = new Bindable<RoomStatus>();
|
||||
public Bindable<BeatmapMetadata> Beatmap = new Bindable<BeatmapMetadata>();
|
||||
}
|
||||
}
|
26
osu.Game/Online/Multiplayer/RoomStatus.cs
Normal file
26
osu.Game/Online/Multiplayer/RoomStatus.cs
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Online.Multiplayer
|
||||
{
|
||||
public abstract class RoomStatus
|
||||
{
|
||||
public abstract string Message { get; }
|
||||
public abstract Color4 GetAppropriateColour(OsuColour colours);
|
||||
}
|
||||
|
||||
public class RoomStatusOpen : RoomStatus
|
||||
{
|
||||
public override string Message => @"Welcoming Players";
|
||||
public override Color4 GetAppropriateColour(OsuColour colours) => colours.GreenLight;
|
||||
}
|
||||
|
||||
public class RoomStatusPlaying : RoomStatus
|
||||
{
|
||||
public override string Message => @"Now Playing";
|
||||
public override Color4 GetAppropriateColour(OsuColour colours) => colours.Purple;
|
||||
}
|
||||
}
|
@ -36,6 +36,8 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
public MenuSideFlashes()
|
||||
{
|
||||
EarlyActivationMilliseconds = box_fade_in_time;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
259
osu.Game/Screens/Multiplayer/DrawableRoom.cs
Normal file
259
osu.Game/Screens/Multiplayer/DrawableRoom.cs
Normal file
@ -0,0 +1,259 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Screens.Multiplayer
|
||||
{
|
||||
public class DrawableRoom : ClickableContainer
|
||||
{
|
||||
private const float content_padding = 5;
|
||||
private const float height = 90;
|
||||
|
||||
private readonly Box sideStrip;
|
||||
private readonly UpdateableAvatar avatar;
|
||||
private readonly OsuSpriteText name;
|
||||
private readonly Container flagContainer;
|
||||
private readonly OsuSpriteText host;
|
||||
private readonly OsuSpriteText rankBounds;
|
||||
private readonly OsuSpriteText status;
|
||||
private readonly FillFlowContainer<OsuSpriteText> beatmapInfoFlow;
|
||||
private readonly OsuSpriteText beatmapTitle;
|
||||
private readonly OsuSpriteText beatmapDash;
|
||||
private readonly OsuSpriteText beatmapArtist;
|
||||
|
||||
private OsuColour colours;
|
||||
private LocalisationEngine localisation;
|
||||
|
||||
public readonly Room Room;
|
||||
|
||||
public DrawableRoom(Room room)
|
||||
{
|
||||
Room = room;
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = height;
|
||||
CornerRadius = 5;
|
||||
Masking = true;
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = Color4.Black.Opacity(40),
|
||||
Radius = 5,
|
||||
};
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(34),
|
||||
},
|
||||
sideStrip = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = content_padding,
|
||||
},
|
||||
avatar = new UpdateableAvatar
|
||||
{
|
||||
Size = new Vector2(Height - content_padding* 2),
|
||||
Masking = true,
|
||||
CornerRadius = 5f,
|
||||
Margin = new MarginPadding { Left = content_padding * 2, Top = content_padding },
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Top = content_padding, Bottom = content_padding, Left = Height + content_padding * 2, Right = content_padding },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Spacing = new Vector2(5f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
name = new OsuSpriteText
|
||||
{
|
||||
TextSize = 18,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 20f,
|
||||
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 = 30f,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
Width = 40f,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
},
|
||||
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",
|
||||
},
|
||||
},
|
||||
},
|
||||
rankBounds = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
Text = "#0 - #0",
|
||||
TextSize = 14,
|
||||
Margin = new MarginPadding { Right = 10 },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Vertical,
|
||||
Margin = new MarginPadding { Bottom = content_padding },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
status = new OsuSpriteText
|
||||
{
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-Bold",
|
||||
},
|
||||
beatmapInfoFlow = new FillFlowContainer<OsuSpriteText>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new[]
|
||||
{
|
||||
beatmapTitle = new OsuSpriteText
|
||||
{
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-BoldItalic",
|
||||
},
|
||||
beatmapDash = new OsuSpriteText
|
||||
{
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-RegularItalic",
|
||||
},
|
||||
beatmapArtist = new OsuSpriteText
|
||||
{
|
||||
TextSize = 14,
|
||||
Font = @"Exo2.0-RegularItalic",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Room.Name.ValueChanged += displayName;
|
||||
Room.Host.ValueChanged += displayUser;
|
||||
Room.Status.ValueChanged += displayStatus;
|
||||
Room.Beatmap.ValueChanged += displayBeatmap;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, LocalisationEngine localisation)
|
||||
{
|
||||
this.localisation = localisation;
|
||||
this.colours = colours;
|
||||
|
||||
beatmapInfoFlow.Colour = rankBounds.Colour = colours.Gray9;
|
||||
host.Colour = colours.Blue;
|
||||
|
||||
displayStatus(Room.Status.Value);
|
||||
}
|
||||
|
||||
private void displayName(string value)
|
||||
{
|
||||
name.Text = value;
|
||||
}
|
||||
|
||||
private void displayUser(User value)
|
||||
{
|
||||
avatar.User = value;
|
||||
host.Text = value.Username;
|
||||
flagContainer.Children = new[] { new DrawableFlag(value.Country?.FlagName ?? @"__") { RelativeSizeAxes = Axes.Both } };
|
||||
}
|
||||
|
||||
private void displayStatus(RoomStatus value)
|
||||
{
|
||||
if (value == null) return;
|
||||
status.Text = value.Message;
|
||||
|
||||
foreach (Drawable d in new Drawable[] { sideStrip, status })
|
||||
d.FadeColour(value.GetAppropriateColour(colours), 100);
|
||||
}
|
||||
|
||||
private void displayBeatmap(BeatmapMetadata value)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
beatmapTitle.Current = localisation.GetUnicodePreference(value.TitleUnicode, value.Title);
|
||||
beatmapDash.Text = @" - ";
|
||||
beatmapArtist.Current = localisation.GetUnicodePreference(value.ArtistUnicode, value.Artist);
|
||||
}
|
||||
else
|
||||
{
|
||||
beatmapTitle.Current = null;
|
||||
beatmapArtist.Current = null;
|
||||
|
||||
beatmapTitle.Text = @"Changing map";
|
||||
beatmapDash.Text = string.Empty;
|
||||
beatmapArtist.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
Room.Name.ValueChanged -= displayName;
|
||||
Room.Host.ValueChanged -= displayUser;
|
||||
Room.Status.ValueChanged -= displayStatus;
|
||||
Room.Beatmap.ValueChanged -= displayBeatmap;
|
||||
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
}
|
||||
}
|
@ -432,6 +432,9 @@
|
||||
<Compile Include="Overlays\Music\PlaylistOverlay.cs" />
|
||||
<Compile Include="Rulesets\Replays\IAutoGenerator.cs" />
|
||||
<Compile Include="Rulesets\Replays\AutoGenerator.cs" />
|
||||
<Compile Include="Screens\Multiplayer\DrawableRoom.cs" />
|
||||
<Compile Include="Online\Multiplayer\Room.cs" />
|
||||
<Compile Include="Online\Multiplayer\RoomStatus.cs" />
|
||||
<Compile Include="Users\UserPanel.cs" />
|
||||
<Compile Include="Users\UserStatus.cs" />
|
||||
<Compile Include="Overlays\DirectOverlay.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user