Merge branch 'master' into better-filter-bypass

This commit is contained in:
Dean Herbert 2020-03-11 02:55:14 +09:00 committed by GitHub
commit a2d3f20409
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
97 changed files with 2180 additions and 1064 deletions

View File

@ -52,6 +52,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.305.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2020.310.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,54 @@
// 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.Game.Rulesets.Catch.Mods;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Tests.Visual;
using osuTK;
namespace osu.Game.Rulesets.Catch.Tests.Mods
{
public class TestSceneCatchModPerfect : ModPerfectTestScene
{
public TestSceneCatchModPerfect()
: base(new CatchRuleset(), new CatchModPerfect())
{
}
[TestCase(false)]
[TestCase(true)]
public void TestBananaShower(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new BananaShower { StartTime = 1000, EndTime = 3000 }, false), shouldMiss);
[TestCase(false)]
[TestCase(true)]
public void TestFruit(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new Fruit { StartTime = 1000 }), shouldMiss);
[TestCase(false)]
[TestCase(true)]
public void TestJuiceStream(bool shouldMiss)
{
var stream = new JuiceStream
{
StartTime = 1000,
Path = new SliderPath(PathType.Linear, new[]
{
Vector2.Zero,
new Vector2(100, 0),
})
};
CreateHitObjectTest(new HitObjectTestData(stream), shouldMiss);
}
// We only care about testing misses, hits are tested via JuiceStream
[TestCase(true)]
public void TestDroplet(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new Droplet { StartTime = 1000 }), shouldMiss);
// We only care about testing misses, hits are tested via JuiceStream
[TestCase(true)]
public void TestTinyDroplet(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new TinyDroplet { StartTime = 1000 }), shouldMiss);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 130 KiB

View File

@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Catch.Tests
public override IReadOnlyList<Type> RequiredTypes => new[] public override IReadOnlyList<Type> RequiredTypes => new[]
{ {
typeof(CatcherArea), typeof(CatcherArea),
typeof(CatcherSprite)
}; };
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -1,9 +1,13 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Testing;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Tests.Visual; using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Catch.Tests namespace osu.Game.Rulesets.Catch.Tests
@ -22,7 +26,16 @@ namespace osu.Game.Rulesets.Catch.Tests
public void TestHyperDash() public void TestHyperDash()
{ {
AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash); AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash);
AddUntilStep("wait for left hyperdash", () => getCatcher().Scale.X < 0 && getCatcher().HyperDashing);
for (int i = 0; i < 2; i++)
{
AddUntilStep("wait for right hyperdash", () => getCatcher().Scale.X > 0 && getCatcher().HyperDashing);
AddUntilStep("wait for left hyperdash", () => getCatcher().Scale.X < 0 && getCatcher().HyperDashing);
} }
}
private CatcherArea.Catcher getCatcher() => Player.ChildrenOfType<CatcherArea>().First().MovableCatcher;
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) protected override IBeatmap CreateBeatmap(RulesetInfo ruleset)
{ {
@ -35,17 +48,40 @@ namespace osu.Game.Rulesets.Catch.Tests
} }
}; };
// Should produce a hyper-dash // Should produce a hyper-dash (edge case test)
beatmap.HitObjects.Add(new Fruit { StartTime = 816, X = 308 / 512f, NewCombo = true }); beatmap.HitObjects.Add(new Fruit { StartTime = 1816, X = 308 / 512f, NewCombo = true });
beatmap.HitObjects.Add(new Fruit { StartTime = 1008, X = 56 / 512f, }); beatmap.HitObjects.Add(new JuiceStream { StartTime = 2008, X = 56 / 512f, });
for (int i = 0; i < 512; i++) double startTime = 3000;
{
if (i % 5 < 3) const float left_x = 0.02f;
beatmap.HitObjects.Add(new Fruit { X = i % 10 < 5 ? 0.02f : 0.98f, StartTime = 2000 + i * 100, NewCombo = i % 8 == 0 }); const float right_x = 0.98f;
}
createObjects(() => new Fruit(), left_x);
createObjects(() => new JuiceStream(), right_x);
createObjects(() => new JuiceStream(), left_x);
createObjects(() => new Fruit(), right_x);
createObjects(() => new Fruit(), left_x);
createObjects(() => new Fruit(), right_x);
createObjects(() => new JuiceStream(), left_x);
return beatmap; return beatmap;
void createObjects(Func<CatchHitObject> createObject, float x)
{
const float spacing = 140;
for (int i = 0; i < 3; i++)
{
var hitObject = createObject();
hitObject.X = x;
hitObject.StartTime = startTime + i * spacing;
beatmap.HitObjects.Add(hitObject);
}
startTime += 700;
}
} }
} }
} }

View File

@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Catch
FruitGrapes, FruitGrapes,
FruitOrange, FruitOrange,
FruitPear, FruitPear,
Droplet Droplet,
CatcherIdle
} }
} }

View File

@ -1,11 +1,17 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using osu.Game.Rulesets.Catch.Judgements;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Rulesets.Catch.Mods namespace osu.Game.Rulesets.Catch.Mods
{ {
public class CatchModPerfect : ModPerfect public class CatchModPerfect : ModPerfect
{ {
protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result)
=> !(result.Judgement is CatchBananaJudgement)
&& base.FailCondition(healthProcessor, result);
} }
} }

View File

@ -44,6 +44,10 @@ namespace osu.Game.Rulesets.Catch.Skinning
return new LegacyFruitPiece("fruit-drop") { Scale = new Vector2(0.8f) }; return new LegacyFruitPiece("fruit-drop") { Scale = new Vector2(0.8f) };
break; break;
case CatchSkinComponents.CatcherIdle:
return this.GetAnimation("fruit-catcher-idle", true, true, true) ??
this.GetAnimation("fruit-ryuuta", true, true, true);
} }
return null; return null;

View File

@ -155,7 +155,10 @@ namespace osu.Game.Rulesets.Catch.UI
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.BottomCentre,
}, },
createCatcherSprite(), createCatcherSprite().With(c =>
{
c.Anchor = Anchor.TopCentre;
})
}; };
} }
@ -205,12 +208,11 @@ namespace osu.Game.Rulesets.Catch.UI
var additive = createCatcherSprite(); var additive = createCatcherSprite();
additive.Anchor = Anchor; additive.Anchor = Anchor;
additive.OriginPosition += new Vector2(DrawWidth / 2, 0); // also temporary to align sprite correctly.
additive.Position = Position;
additive.Scale = Scale; additive.Scale = Scale;
additive.Colour = HyperDashing ? Color4.Red : Color4.White; additive.Colour = HyperDashing ? Color4.Red : Color4.White;
additive.RelativePositionAxes = RelativePositionAxes;
additive.Blending = BlendingParameters.Additive; additive.Blending = BlendingParameters.Additive;
additive.RelativePositionAxes = RelativePositionAxes;
additive.Position = Position;
AdditiveTarget.Add(additive); AdditiveTarget.Add(additive);
@ -270,6 +272,10 @@ namespace osu.Game.Rulesets.Catch.UI
catchObjectPosition >= catcherPosition - halfCatchWidth && catchObjectPosition >= catcherPosition - halfCatchWidth &&
catchObjectPosition <= catcherPosition + halfCatchWidth; catchObjectPosition <= catcherPosition + halfCatchWidth;
// only update hyperdash state if we are catching a fruit.
// exceptions are Droplets and JuiceStreams.
if (!(fruit is Fruit)) return validCatch;
if (validCatch && fruit.HyperDash) if (validCatch && fruit.HyperDash)
{ {
var target = fruit.HyperDashTarget; var target = fruit.HyperDashTarget;

View File

@ -3,31 +3,35 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Skinning; using osu.Game.Skinning;
using osuTK; using osuTK;
namespace osu.Game.Rulesets.Catch.UI namespace osu.Game.Rulesets.Catch.UI
{ {
public class CatcherSprite : CompositeDrawable public class CatcherSprite : SkinnableDrawable
{ {
protected override bool ApplySizeRestrictionsToDefault => true;
public CatcherSprite() public CatcherSprite()
: base(new CatchSkinComponent(CatchSkinComponents.CatcherIdle), _ =>
new DefaultCatcherSprite(), confineMode: ConfineMode.ScaleDownToFit)
{ {
RelativeSizeAxes = Axes.None;
Size = new Vector2(CatcherArea.CATCHER_SIZE); Size = new Vector2(CatcherArea.CATCHER_SIZE);
// Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling. // Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling.
OriginPosition = new Vector2(-0.02f, 0.06f) * CatcherArea.CATCHER_SIZE; OriginPosition = new Vector2(0.5f, 0.06f) * CatcherArea.CATCHER_SIZE;
} }
private class DefaultCatcherSprite : Sprite
{
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(TextureStore textures)
{ {
InternalChild = new SkinnableSprite("Gameplay/catch/fruit-catcher-idle", confineMode: ConfineMode.ScaleDownToFit) Texture = textures.Get("Gameplay/catch/fruit-catcher-idle");
{ }
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
};
} }
} }
} }

View File

@ -0,0 +1,26 @@
// 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.Game.Rulesets.Mania.Mods;
using osu.Game.Rulesets.Mania.Objects;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Mania.Tests.Mods
{
public class TestSceneManiaModPerfect : ModPerfectTestScene
{
public TestSceneManiaModPerfect()
: base(new ManiaRuleset(), new ManiaModPerfect())
{
}
[TestCase(false)]
[TestCase(true)]
public void TestNote(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new Note { StartTime = 1000 }), shouldMiss);
[TestCase(false)]
[TestCase(true)]
public void TestHoldNote(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new HoldNote { StartTime = 1000, EndTime = 3000 }), shouldMiss);
}
}

View File

@ -0,0 +1,35 @@
// 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.Utils;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Osu.Tests.Mods
{
public class TestSceneOsuModDoubleTime : ModTestScene
{
public TestSceneOsuModDoubleTime()
: base(new OsuRuleset())
{
}
[TestCase(0.5)]
[TestCase(1.01)]
[TestCase(1.5)]
[TestCase(2)]
[TestCase(5)]
public void TestSpeedChangeCustomisation(double rate)
{
var mod = new OsuModDoubleTime { SpeedChange = { Value = rate } };
CreateModTest(new ModTestData
{
Mod = mod,
PassCondition = () => Player.ScoreProcessor.JudgedHits >= 2 &&
Precision.AlmostEquals(Player.GameplayClockContainer.GameplayClock.Rate, mod.SpeedChange.Value)
});
}
}
}

View File

@ -0,0 +1,52 @@
// 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.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Tests.Visual;
using osuTK;
namespace osu.Game.Rulesets.Osu.Tests.Mods
{
public class TestSceneOsuModPerfect : ModPerfectTestScene
{
public TestSceneOsuModPerfect()
: base(new OsuRuleset(), new OsuModPerfect())
{
}
[TestCase(false)]
[TestCase(true)]
public void TestHitCircle(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new HitCircle { StartTime = 1000 }), shouldMiss);
[TestCase(false)]
[TestCase(true)]
public void TestSlider(bool shouldMiss)
{
var slider = new Slider
{
StartTime = 1000,
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(100, 0), })
};
CreateHitObjectTest(new HitObjectTestData(slider), shouldMiss);
}
[TestCase(false)]
[TestCase(true)]
public void TestSpinner(bool shouldMiss)
{
var spinner = new Spinner
{
StartTime = 1000,
EndTime = 3000,
Position = new Vector2(256, 192)
};
CreateHitObjectTest(new HitObjectTestData(spinner), shouldMiss);
}
}
}

View File

@ -0,0 +1,108 @@
// 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 NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
using osuTK;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestSceneHitCircleArea : ManualInputManagerTestScene
{
private HitCircle hitCircle;
private DrawableHitCircle drawableHitCircle;
private DrawableHitCircle.HitReceptor hitAreaReceptor => drawableHitCircle.HitArea;
[SetUp]
public new void SetUp()
{
base.SetUp();
Schedule(() =>
{
hitCircle = new HitCircle
{
Position = new Vector2(100, 100),
StartTime = Time.Current + 500
};
hitCircle.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty());
Child = new SkinProvidingContainer(new DefaultSkin())
{
RelativeSizeAxes = Axes.Both,
Child = drawableHitCircle = new DrawableHitCircle(hitCircle)
{
Size = new Vector2(100)
}
};
});
}
[Test]
public void TestCircleHitCentre()
{
AddStep("move mouse to centre", () => InputManager.MoveMouseTo(hitAreaReceptor.ScreenSpaceDrawQuad.Centre));
scheduleHit();
AddAssert("hit registered", () => hitAreaReceptor.HitAction == OsuAction.LeftButton);
}
[Test]
public void TestCircleHitLeftEdge()
{
AddStep("move mouse to left edge", () =>
{
var drawQuad = hitAreaReceptor.ScreenSpaceDrawQuad;
var mousePosition = new Vector2(drawQuad.TopLeft.X, drawQuad.Centre.Y);
InputManager.MoveMouseTo(mousePosition);
});
scheduleHit();
AddAssert("hit registered", () => hitAreaReceptor.HitAction == OsuAction.LeftButton);
}
[TestCase(0.95f, OsuAction.LeftButton)]
[TestCase(1.05f, null)]
public void TestHitsCloseToEdge(float relativeDistanceFromCentre, OsuAction? expectedAction)
{
AddStep("move mouse to top left circle edge", () =>
{
var drawQuad = hitAreaReceptor.ScreenSpaceDrawQuad;
// sqrt(2) / 2 = sin(45deg) = cos(45deg)
// draw width halved to get radius
float correction = relativeDistanceFromCentre * (float)Math.Sqrt(2) / 2 * (drawQuad.Width / 2);
var mousePosition = new Vector2(drawQuad.Centre.X - correction, drawQuad.Centre.Y - correction);
InputManager.MoveMouseTo(mousePosition);
});
scheduleHit();
AddAssert($"hit {(expectedAction == null ? "not " : string.Empty)}registered", () => hitAreaReceptor.HitAction == expectedAction);
}
[Test]
public void TestCircleMissBoundingBoxCorner()
{
AddStep("move mouse to top left corner of bounding box", () => InputManager.MoveMouseTo(hitAreaReceptor.ScreenSpaceDrawQuad.TopLeft));
scheduleHit();
AddAssert("hit not registered", () => hitAreaReceptor.HitAction == null);
}
private void scheduleHit() => AddStep("schedule action", () =>
{
var delay = hitCircle.StartTime - hitCircle.HitWindows.WindowFor(HitResult.Great) - Time.Current;
Scheduler.AddDelayed(() => hitAreaReceptor.OnPressed(OsuAction.LeftButton), delay);
});
}
}

View File

@ -0,0 +1,101 @@
// 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.Game.Beatmaps;
using osu.Game.Replays;
using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Osu.Objects;
using osu.Game.Rulesets.Osu.Replays;
using osu.Game.Rulesets.Osu.Scoring;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Tests.Visual;
using osu.Game.Users;
using osuTK;
namespace osu.Game.Rulesets.Osu.Tests
{
public class TestSceneMissHitWindowJudgements : ModTestScene
{
public TestSceneMissHitWindowJudgements()
: base(new OsuRuleset())
{
}
[Test]
public void TestMissViaEarlyHit()
{
var beatmap = new Beatmap
{
HitObjects = { new HitCircle { Position = new Vector2(256, 192) } }
};
var hitWindows = new OsuHitWindows();
hitWindows.SetDifficulty(beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty);
CreateModTest(new ModTestData
{
Autoplay = false,
Mod = new TestAutoMod(),
Beatmap = new Beatmap
{
HitObjects = { new HitCircle { Position = new Vector2(256, 192) } }
},
PassCondition = () => Player.Results.Count > 0 && Player.Results[0].TimeOffset < -hitWindows.WindowFor(HitResult.Meh) && Player.Results[0].Type == HitResult.Miss
});
}
[Test]
public void TestMissViaNotHitting()
{
var beatmap = new Beatmap
{
HitObjects = { new HitCircle { Position = new Vector2(256, 192) } }
};
var hitWindows = new OsuHitWindows();
hitWindows.SetDifficulty(beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty);
CreateModTest(new ModTestData
{
Autoplay = false,
Beatmap = beatmap,
PassCondition = () => Player.Results.Count > 0 && Player.Results[0].TimeOffset >= hitWindows.WindowFor(HitResult.Meh) && Player.Results[0].Type == HitResult.Miss
});
}
private class TestAutoMod : OsuModAutoplay
{
public override Score CreateReplayScore(IBeatmap beatmap) => new Score
{
ScoreInfo = new ScoreInfo { User = new User { Username = "Autoplay" } },
Replay = new MissingAutoGenerator(beatmap).Generate()
};
}
private class MissingAutoGenerator : OsuAutoGeneratorBase
{
public new OsuBeatmap Beatmap => (OsuBeatmap)base.Beatmap;
public MissingAutoGenerator(IBeatmap beatmap)
: base(beatmap)
{
}
public override Replay Generate()
{
AddFrameToReplay(new OsuReplayFrame(-100000, new Vector2(256, 500)));
AddFrameToReplay(new OsuReplayFrame(Beatmap.HitObjects[0].StartTime - 1500, new Vector2(256, 500)));
AddFrameToReplay(new OsuReplayFrame(Beatmap.HitObjects[0].StartTime - 1500, new Vector2(256, 500)));
AddFrameToReplay(new OsuReplayFrame(Beatmap.HitObjects[0].StartTime - 450, Beatmap.HitObjects[0].StackedPosition));
AddFrameToReplay(new OsuReplayFrame(Beatmap.HitObjects[0].StartTime - 350, Beatmap.HitObjects[0].StackedPosition, OsuAction.LeftButton));
AddFrameToReplay(new OsuReplayFrame(Beatmap.HitObjects[0].StartTime - 325, Beatmap.HitObjects[0].StackedPosition));
return Replay;
}
}
}
}

View File

@ -170,7 +170,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public Drawable ProxiedLayer => ApproachCircle; public Drawable ProxiedLayer => ApproachCircle;
public class HitReceptor : Drawable, IKeyBindingHandler<OsuAction> public class HitReceptor : CompositeDrawable, IKeyBindingHandler<OsuAction>
{ {
// IsHovered is used // IsHovered is used
public override bool HandlePositionalInput => true; public override bool HandlePositionalInput => true;
@ -185,6 +185,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
Anchor = Anchor.Centre; Anchor = Anchor.Centre;
Origin = Anchor.Centre; Origin = Anchor.Centre;
CornerRadius = OsuHitObject.OBJECT_RADIUS;
CornerExponent = 2;
} }
public bool OnPressed(OsuAction action) public bool OnPressed(OsuAction action)

View File

@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Scoring
new DifficultyRange(HitResult.Great, 80, 50, 20), new DifficultyRange(HitResult.Great, 80, 50, 20),
new DifficultyRange(HitResult.Good, 140, 100, 60), new DifficultyRange(HitResult.Good, 140, 100, 60),
new DifficultyRange(HitResult.Meh, 200, 150, 100), new DifficultyRange(HitResult.Meh, 200, 150, 100),
new DifficultyRange(HitResult.Miss, 200, 200, 200), new DifficultyRange(HitResult.Miss, 400, 400, 400),
}; };
public override bool IsHitResultAllowed(HitResult result) public override bool IsHitResultAllowed(HitResult result)

View File

@ -0,0 +1,47 @@
// 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.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Mods;
using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Rulesets.Taiko.Scoring;
using osu.Game.Tests.Visual;
namespace osu.Game.Rulesets.Taiko.Tests.Mods
{
public class TestSceneTaikoModPerfect : ModPerfectTestScene
{
public TestSceneTaikoModPerfect()
: base(new TestTaikoRuleset(), new TaikoModPerfect())
{
}
[TestCase(false)]
[TestCase(true)]
public void TestHit(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new CentreHit { StartTime = 1000 }), shouldMiss);
[TestCase(false)]
[TestCase(true)]
public void TestDrumRoll(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new DrumRoll { StartTime = 1000, EndTime = 3000 }), shouldMiss);
[TestCase(false)]
[TestCase(true)]
public void TestSwell(bool shouldMiss) => CreateHitObjectTest(new HitObjectTestData(new Swell { StartTime = 1000, EndTime = 3000 }), shouldMiss);
private class TestTaikoRuleset : TaikoRuleset
{
public override HealthProcessor CreateHealthProcessor(double drainStartTime) => new TestTaikoHealthProcessor();
private class TestTaikoHealthProcessor : TaikoHealthProcessor
{
protected override void Reset(bool storeResults)
{
base.Reset(storeResults);
Health.Value = 1; // Don't care about the health condition (only the mod condition)
}
}
}
}
}

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq; using System.Linq;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
@ -39,7 +40,7 @@ namespace osu.Game.Rulesets.Taiko.Scoring
{ {
base.ApplyBeatmap(beatmap); base.ApplyBeatmap(beatmap);
hpMultiplier = 1 / (object_count_factor * beatmap.HitObjects.OfType<Hit>().Count() * BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.5, 0.75, 0.98)); hpMultiplier = 1 / (object_count_factor * Math.Max(1, beatmap.HitObjects.OfType<Hit>().Count()) * BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.5, 0.75, 0.98));
hpMissMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.0018, 0.0075, 0.0120); hpMissMultiplier = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.DrainRate, 0.0018, 0.0075, 0.0120);
} }

View File

@ -99,7 +99,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
var storyboard = decoder.Decode(stream); var storyboard = decoder.Decode(stream);
StoryboardLayer background = storyboard.Layers.Single(l => l.Depth == 3); StoryboardLayer background = storyboard.Layers.Single(l => l.Depth == 3);
Assert.AreEqual(123456, ((StoryboardSprite)background.Elements.Single()).InitialPosition.X); Assert.AreEqual(3456, ((StoryboardSprite)background.Elements.Single()).InitialPosition.X);
} }
} }
} }

View File

@ -1,5 +1,5 @@
[Variables] [Variables]
$var=1234 $var=34
[Events] [Events]
Sprite,Background,TopCentre,"img.jpg",$var56,240 Sprite,Background,TopCentre,"img.jpg",$var56,240

View File

@ -3,10 +3,8 @@
using System.ComponentModel; using System.ComponentModel;
using System.Linq; using System.Linq;
using osu.Game.Beatmaps;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Storyboards;
namespace osu.Game.Tests.Visual.Gameplay namespace osu.Game.Tests.Visual.Gameplay
{ {
@ -15,8 +13,6 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
protected new TestPlayer Player => (TestPlayer)base.Player; protected new TestPlayer Player => (TestPlayer)base.Player;
private ClockBackedTestWorkingBeatmap.TrackVirtualManual track;
protected override Player CreatePlayer(Ruleset ruleset) protected override Player CreatePlayer(Ruleset ruleset)
{ {
SelectedMods.Value = SelectedMods.Value.Concat(new[] { ruleset.GetAutoplayMod() }).ToArray(); SelectedMods.Value = SelectedMods.Value.Concat(new[] { ruleset.GetAutoplayMod() }).ToArray();
@ -27,17 +23,12 @@ namespace osu.Game.Tests.Visual.Gameplay
{ {
AddUntilStep("score above zero", () => Player.ScoreProcessor.TotalScore.Value > 0); AddUntilStep("score above zero", () => Player.ScoreProcessor.TotalScore.Value > 0);
AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 2)); AddUntilStep("key counter counted keys", () => Player.HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 2));
AddStep("rewind", () => track.Seek(-10000)); AddStep("seek to break time", () => Player.GameplayClockContainer.Seek(Player.BreakOverlay.Breaks.First().StartTime));
AddUntilStep("wait for seek to complete", () =>
Player.HUDOverlay.Progress.ReferenceClock.CurrentTime >= Player.BreakOverlay.Breaks.First().StartTime);
AddAssert("test keys not counting", () => !Player.HUDOverlay.KeyCounter.IsCounting);
AddStep("rewind", () => Player.GameplayClockContainer.Seek(-80000));
AddUntilStep("key counter reset", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses == 0)); AddUntilStep("key counter reset", () => Player.HUDOverlay.KeyCounter.Children.All(kc => kc.CountPresses == 0));
} }
protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, Storyboard storyboard = null)
{
var working = base.CreateWorkingBeatmap(beatmap, storyboard);
track = (ClockBackedTestWorkingBeatmap.TrackVirtualManual)working.Track;
return working;
}
} }
} }

View File

@ -47,21 +47,22 @@ namespace osu.Game.Tests.Visual.Gameplay
Key testKey = ((KeyCounterKeyboard)kc.Children.First()).Key; Key testKey = ((KeyCounterKeyboard)kc.Children.First()).Key;
void addPressKeyStep()
{
AddStep($"Press {testKey} key", () => AddStep($"Press {testKey} key", () =>
{ {
InputManager.PressKey(testKey); InputManager.PressKey(testKey);
InputManager.ReleaseKey(testKey); InputManager.ReleaseKey(testKey);
}); });
}
addPressKeyStep();
AddAssert($"Check {testKey} counter after keypress", () => testCounter.CountPresses == 1); AddAssert($"Check {testKey} counter after keypress", () => testCounter.CountPresses == 1);
addPressKeyStep();
AddStep($"Press {testKey} key", () =>
{
InputManager.PressKey(testKey);
InputManager.ReleaseKey(testKey);
});
AddAssert($"Check {testKey} counter after keypress", () => testCounter.CountPresses == 2); AddAssert($"Check {testKey} counter after keypress", () => testCounter.CountPresses == 2);
AddStep("Disable counting", () => testCounter.IsCounting = false);
addPressKeyStep();
AddAssert($"Check {testKey} count has not changed", () => testCounter.CountPresses == 2);
Add(kc); Add(kc);
} }

View File

@ -3,9 +3,6 @@
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Utils;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.HUD;
using osuTK; using osuTK;
@ -45,32 +42,12 @@ namespace osu.Game.Tests.Visual.Gameplay
}; };
Add(accuracyCounter); Add(accuracyCounter);
StarCounter stars = new StarCounter
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Position = new Vector2(20, -160),
CountStars = 5,
};
Add(stars);
SpriteText starsLabel = new OsuSpriteText
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Position = new Vector2(20, -190),
Text = stars.CountStars.ToString("0.00"),
};
Add(starsLabel);
AddStep(@"Reset all", delegate AddStep(@"Reset all", delegate
{ {
score.Current.Value = 0; score.Current.Value = 0;
comboCounter.Current.Value = 0; comboCounter.Current.Value = 0;
numerator = denominator = 0; numerator = denominator = 0;
accuracyCounter.SetFraction(0, 0); accuracyCounter.SetFraction(0, 0);
stars.CountStars = 0;
starsLabel.Text = stars.CountStars.ToString("0.00");
}); });
AddStep(@"Hit! :D", delegate AddStep(@"Hit! :D", delegate
@ -88,20 +65,6 @@ namespace osu.Game.Tests.Visual.Gameplay
denominator++; denominator++;
accuracyCounter.SetFraction(numerator, denominator); accuracyCounter.SetFraction(numerator, denominator);
}); });
AddStep(@"Alter stars", delegate
{
stars.CountStars = RNG.NextSingle() * (stars.StarCount + 1);
starsLabel.Text = stars.CountStars.ToString("0.00");
});
AddStep(@"Stop counters", delegate
{
score.StopRolling();
comboCounter.StopRolling();
accuracyCounter.StopRolling();
stars.StopAnimation();
});
} }
} }
} }

View File

@ -0,0 +1,57 @@
// 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.Framework.Graphics.Sprites;
using osu.Framework.Utils;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osuTK;
namespace osu.Game.Tests.Visual.Gameplay
{
[TestFixture]
public class TestSceneStarCounter : OsuTestScene
{
public TestSceneStarCounter()
{
StarCounter stars = new StarCounter
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Current = 5,
};
Add(stars);
SpriteText starsLabel = new OsuSpriteText
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Scale = new Vector2(2),
Y = 50,
Text = stars.Current.ToString("0.00"),
};
Add(starsLabel);
AddRepeatStep(@"random value", delegate
{
stars.Current = RNG.NextSingle() * (stars.StarCount + 1);
starsLabel.Text = stars.Current.ToString("0.00");
}, 10);
AddStep(@"Stop animation", delegate
{
stars.StopAnimation();
});
AddStep(@"Reset", delegate
{
stars.Current = 0;
starsLabel.Text = stars.Current.ToString("0.00");
});
}
}
}

View File

@ -0,0 +1,125 @@
// 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.Tests.Visual;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Drawings.Components;
using osu.Game.Tournament.Screens.Gameplay.Components;
using osu.Game.Tournament.Screens.Ladder.Components;
using osu.Game.Users;
namespace osu.Game.Tournament.Tests.Components
{
public class TestSceneDrawableTournamentTeam : OsuGridTestScene
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(DrawableTeamFlag),
typeof(DrawableTeamTitle),
typeof(DrawableTeamTitleWithHeader),
typeof(DrawableMatchTeam),
typeof(DrawableTeamWithPlayers),
typeof(GroupTeam),
typeof(TeamDisplay),
};
public TestSceneDrawableTournamentTeam()
: base(4, 3)
{
var team = new TournamentTeam
{
FlagName = { Value = "AU" },
FullName = { Value = "Australia" },
Players =
{
new User { Username = "ASecretBox" },
new User { Username = "Dereban" },
new User { Username = "mReKk" },
new User { Username = "uyghti" },
new User { Username = "Parkes" },
new User { Username = "Shiroha" },
new User { Username = "Jordan The Bear" },
}
};
var match = new TournamentMatch { Team1 = { Value = team } };
int i = 0;
Cell(i++).AddRange(new Drawable[]
{
new TournamentSpriteText { Text = "DrawableTeamFlag" },
new DrawableTeamFlag(team)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
});
Cell(i++).AddRange(new Drawable[]
{
new TournamentSpriteText { Text = "DrawableTeamTitle" },
new DrawableTeamTitle(team)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
});
Cell(i++).AddRange(new Drawable[]
{
new TournamentSpriteText { Text = "DrawableTeamTitleWithHeader" },
new DrawableTeamTitleWithHeader(team, TeamColour.Red)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
});
Cell(i++).AddRange(new Drawable[]
{
new TournamentSpriteText { Text = "DrawableMatchTeam" },
new DrawableMatchTeam(team, match, false)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
});
Cell(i++).AddRange(new Drawable[]
{
new TournamentSpriteText { Text = "TeamWithPlayers" },
new DrawableTeamWithPlayers(team, TeamColour.Blue)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
});
Cell(i++).AddRange(new Drawable[]
{
new TournamentSpriteText { Text = "GroupTeam" },
new GroupTeam(team)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
});
Cell(i).AddRange(new Drawable[]
{
new TournamentSpriteText { Text = "TeamDisplay" },
new TeamDisplay(team, TeamColour.Red, new Bindable<int?>(2), 6)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
});
}
}
}

View File

@ -1,16 +1,31 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens;
using osu.Game.Tournament.Screens.Gameplay; using osu.Game.Tournament.Screens.Gameplay;
using osu.Game.Tournament.Screens.Gameplay.Components;
namespace osu.Game.Tournament.Tests.Screens namespace osu.Game.Tournament.Tests.Screens
{ {
public class TestSceneGameplayScreen : TournamentTestScene public class TestSceneGameplayScreen : TournamentTestScene
{ {
[Cached] [Cached]
private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay(); private TournamentMatchChatDisplay chat = new TournamentMatchChatDisplay { Width = 0.5f };
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(TeamScore),
typeof(TeamScoreDisplay),
typeof(TeamDisplay),
typeof(MatchHeader),
typeof(MatchScoreDisplay),
typeof(BeatmapInfoScreen),
typeof(SongBar),
};
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()

View File

@ -2,6 +2,8 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Screens.Schedule; using osu.Game.Tournament.Screens.Schedule;
namespace osu.Game.Tournament.Tests.Screens namespace osu.Game.Tournament.Tests.Screens
@ -11,6 +13,7 @@ namespace osu.Game.Tournament.Tests.Screens
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
Add(new TourneyVideo("main") { RelativeSizeAxes = Axes.Both });
Add(new ScheduleScreen()); Add(new ScheduleScreen());
} }
} }

View File

@ -0,0 +1,33 @@
// 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 JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Components
{
public class DrawableTeamFlag : Sprite
{
private readonly TournamentTeam team;
[UsedImplicitly]
private Bindable<string> flag;
public DrawableTeamFlag(TournamentTeam team)
{
this.team = team;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
if (team == null) return;
(flag = team.FlagName.GetBoundCopy()).BindValueChanged(acronym => Texture = textures.Get($@"Flags/{team.FlagName}"), true);
}
}
}

View File

@ -0,0 +1,20 @@
// 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.Game.Tournament.Models;
using osuTK;
namespace osu.Game.Tournament.Components
{
public class DrawableTeamHeader : TournamentSpriteTextWithBackground
{
public DrawableTeamHeader(TeamColour colour)
{
Background.Colour = TournamentGame.GetTeamColour(colour);
Text.Colour = TournamentGame.TEXT_COLOUR;
Text.Text = $"Team {colour}".ToUpperInvariant();
Text.Scale = new Vector2(0.6f);
}
}
}

View File

@ -0,0 +1,32 @@
// 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 JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Textures;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Components
{
public class DrawableTeamTitle : TournamentSpriteTextWithBackground
{
private readonly TournamentTeam team;
[UsedImplicitly]
private Bindable<string> acronym;
public DrawableTeamTitle(TournamentTeam team)
{
this.team = team;
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{
if (team == null) return;
(acronym = team.Acronym.GetBoundCopy()).BindValueChanged(acronym => Text.Text = team?.FullName.Value ?? string.Empty, true);
}
}
}

View File

@ -0,0 +1,30 @@
// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Tournament.Models;
using osuTK;
namespace osu.Game.Tournament.Components
{
public class DrawableTeamTitleWithHeader : CompositeDrawable
{
public DrawableTeamTitleWithHeader(TournamentTeam team, TeamColour colour)
{
AutoSizeAxes = Axes.Both;
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
Children = new Drawable[]
{
new DrawableTeamHeader(colour),
new DrawableTeamTitle(team),
}
};
}
}
}

View File

@ -0,0 +1,66 @@
// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Tournament.Models;
using osu.Game.Users;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tournament.Components
{
public class DrawableTeamWithPlayers : CompositeDrawable
{
public DrawableTeamWithPlayers(TournamentTeam team, TeamColour colour)
{
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(30),
Children = new Drawable[]
{
new DrawableTeamTitleWithHeader(team, colour),
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Padding = new MarginPadding { Left = 10 },
Spacing = new Vector2(30),
Children = new Drawable[]
{
new FillFlowContainer
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
ChildrenEnumerable = team?.Players.Select(createPlayerText).Take(5) ?? Enumerable.Empty<Drawable>()
},
new FillFlowContainer
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
ChildrenEnumerable = team?.Players.Select(createPlayerText).Skip(5) ?? Enumerable.Empty<Drawable>()
},
}
},
}
},
};
TournamentSpriteText createPlayerText(User p) =>
new TournamentSpriteText
{
Text = p.Username,
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold),
Colour = Color4.White,
};
}
}
}

View File

@ -23,14 +23,11 @@ namespace osu.Game.Tournament.Components
[UsedImplicitly] [UsedImplicitly]
private Bindable<string> acronym; private Bindable<string> acronym;
[UsedImplicitly]
private Bindable<string> flag;
protected DrawableTournamentTeam(TournamentTeam team) protected DrawableTournamentTeam(TournamentTeam team)
{ {
Team = team; Team = team;
Flag = new Sprite Flag = new DrawableTeamFlag(team)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit FillMode = FillMode.Fit
@ -48,7 +45,6 @@ namespace osu.Game.Tournament.Components
if (Team == null) return; if (Team == null) return;
(acronym = Team.Acronym.GetBoundCopy()).BindValueChanged(acronym => AcronymText.Text = Team?.Acronym.Value?.ToUpperInvariant() ?? string.Empty, true); (acronym = Team.Acronym.GetBoundCopy()).BindValueChanged(acronym => AcronymText.Text = Team?.Acronym.Value?.ToUpperInvariant() ?? string.Empty, true);
(flag = Team.FlagName.GetBoundCopy()).BindValueChanged(acronym => Flag.Texture = textures.Get($@"Flags/{Team.FlagName}"), true);
} }
} }
} }

View File

@ -0,0 +1,16 @@
// 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.Game.Graphics;
namespace osu.Game.Tournament.Components
{
public class DrawableTournamentTitleText : TournamentSpriteText
{
public DrawableTournamentTitleText()
{
Text = "osu!taiko world cup 2020";
Font = OsuFont.Torus.With(size: 26, weight: FontWeight.SemiBold);
}
}
}

View File

@ -0,0 +1,36 @@
// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Components
{
public class RoundDisplay : CompositeDrawable
{
public RoundDisplay(TournamentMatch match)
{
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new DrawableTournamentTitleText(),
new TournamentSpriteText
{
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Font = OsuFont.Torus.With(size: 26, weight: FontWeight.SemiBold)
},
}
}
};
}
}
}

View File

@ -4,10 +4,8 @@
using System; using System;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -24,6 +22,8 @@ namespace osu.Game.Tournament.Components
{ {
private BeatmapInfo beatmap; private BeatmapInfo beatmap;
private const float height = 145;
[Resolved] [Resolved]
private IBindable<RulesetInfo> ruleset { get; set; } private IBindable<RulesetInfo> ruleset { get; set; }
@ -52,15 +52,7 @@ namespace osu.Game.Tournament.Components
} }
} }
private Container panelContents; private FillFlowContainer flow;
private Container innerPanel;
private Container outerPanel;
private TournamentBeatmapPanel panel;
private float panelWidth => expanded ? 0.6f : 1;
private const float main_width = 0.97f;
private const float inner_panel_width = 0.7f;
private bool expanded; private bool expanded;
@ -70,86 +62,27 @@ namespace osu.Game.Tournament.Components
set set
{ {
expanded = value; expanded = value;
panel?.ResizeWidthTo(panelWidth, 800, Easing.OutQuint); flow.Direction = expanded ? FillDirection.Full : FillDirection.Vertical;
if (expanded)
{
innerPanel.ResizeWidthTo(inner_panel_width, 800, Easing.OutQuint);
outerPanel.ResizeWidthTo(main_width, 800, Easing.OutQuint);
}
else
{
innerPanel.ResizeWidthTo(1, 800, Easing.OutQuint);
outerPanel.ResizeWidthTo(0.25f, 800, Easing.OutQuint);
}
} }
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
outerPanel = new Container flow = new FillFlowContainer
{ {
Masking = true,
EdgeEffect = new EdgeEffectParameters
{
Colour = Color4.Black.Opacity(0.2f),
Type = EdgeEffectType.Shadow,
Radius = 5,
},
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
LayoutDuration = 500,
LayoutEasing = Easing.OutQuint,
Direction = FillDirection.Full,
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,
RelativePositionAxes = Axes.X,
X = -(1 - main_width) / 2,
Y = -10,
Width = main_width,
Height = TournamentBeatmapPanel.HEIGHT,
CornerRadius = TournamentBeatmapPanel.HEIGHT / 2,
CornerExponent = 2,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.93f),
},
new OsuLogo
{
Triangles = false,
Colour = OsuColour.Gray(0.33f),
Scale = new Vector2(0.08f),
Margin = new MarginPadding(50),
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
},
innerPanel = new Container
{
Masking = true,
CornerRadius = TournamentBeatmapPanel.HEIGHT / 2,
CornerExponent = 2,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Width = inner_panel_width,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(0.86f),
},
panelContents = new Container
{
RelativeSizeAxes = Axes.Both,
}
}
}
}
} }
}; };
@ -160,7 +93,7 @@ namespace osu.Game.Tournament.Components
{ {
if (beatmap == null) if (beatmap == null)
{ {
panelContents.Clear(); flow.Clear();
return; return;
} }
@ -219,34 +152,86 @@ namespace osu.Game.Tournament.Components
break; break;
} }
panelContents.Children = new Drawable[] flow.Children = new Drawable[]
{ {
new DiffPiece(("Length", TimeSpan.FromMilliseconds(length).ToString(@"mm\:ss"))) new Container
{ {
Anchor = Anchor.CentreLeft, RelativeSizeAxes = Axes.X,
Origin = Anchor.BottomLeft, Height = height / 2,
}, Width = 0.5f,
new DiffPiece(("BPM", $"{bpm:0.#}")) Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Children = new Drawable[]
{ {
Anchor = Anchor.CentreLeft, new GridContainer
Origin = Anchor.TopLeft
},
new DiffPiece(stats)
{ {
Anchor = Anchor.CentreRight, RelativeSizeAxes = Axes.Both,
Origin = Anchor.BottomRight
}, Content = new[]
new DiffPiece(("Star Rating", $"{beatmap.StarDifficulty:0.#}{srExtra}"))
{ {
Anchor = Anchor.CentreRight, new Drawable[]
Origin = Anchor.TopRight
},
panel = new TournamentBeatmapPanel(beatmap)
{ {
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new DiffPiece(stats),
new DiffPiece(("Star Rating", $"{beatmap.StarDifficulty:0.#}{srExtra}"))
}
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new DiffPiece(("Length", TimeSpan.FromMilliseconds(length).ToString(@"mm\:ss"))),
new DiffPiece(("BPM", $"{bpm:0.#}"))
}
},
new Container
{
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Size = new Vector2(panelWidth, 1) Children = new Drawable[]
{
new Box
{
Colour = Color4.Black,
RelativeSizeAxes = Axes.Both,
Alpha = 0.1f,
},
new OsuLogo
{
Triangles = false,
Scale = new Vector2(0.08f),
Margin = new MarginPadding(50),
X = -10,
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
},
}
},
},
}
}
}
},
new TournamentBeatmapPanel(beatmap)
{
RelativeSizeAxes = Axes.X,
Width = 0.5f,
Height = height / 2,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
} }
}; };
} }
@ -258,10 +243,9 @@ namespace osu.Game.Tournament.Components
Margin = new MarginPadding { Horizontal = 15, Vertical = 1 }; Margin = new MarginPadding { Horizontal = 15, Vertical = 1 };
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
static void cp(SpriteText s, Color4 colour) static void cp(SpriteText s, bool bold)
{ {
s.Colour = colour; s.Font = OsuFont.Torus.With(weight: bold ? FontWeight.Bold : FontWeight.Regular, size: 15);
s.Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 15);
} }
for (var i = 0; i < tuples.Length; i++) for (var i = 0; i < tuples.Length; i++)
@ -272,14 +256,14 @@ namespace osu.Game.Tournament.Components
{ {
AddText(" / ", s => AddText(" / ", s =>
{ {
cp(s, OsuColour.Gray(0.33f)); cp(s, false);
s.Spacing = new Vector2(-2, 0); s.Spacing = new Vector2(-2, 0);
}); });
} }
AddText(new TournamentSpriteText { Text = heading }, s => cp(s, OsuColour.Gray(0.33f))); AddText(new TournamentSpriteText { Text = heading }, s => cp(s, false));
AddText(" ", s => cp(s, OsuColour.Gray(0.33f))); AddText(" ", s => cp(s, false));
AddText(new TournamentSpriteText { Text = content }, s => cp(s, OsuColour.Gray(0.5f))); AddText(new TournamentSpriteText { Text = content }, s => cp(s, true));
} }
} }
} }

View File

@ -27,7 +27,7 @@ namespace osu.Game.Tournament.Components
private readonly string mods; private readonly string mods;
private const float horizontal_padding = 10; private const float horizontal_padding = 10;
private const float vertical_padding = 5; private const float vertical_padding = 10;
public const float HEIGHT = 50; public const float HEIGHT = 50;
@ -50,8 +50,6 @@ namespace osu.Game.Tournament.Components
currentMatch.BindValueChanged(matchChanged); currentMatch.BindValueChanged(matchChanged);
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
CornerRadius = HEIGHT / 2;
CornerExponent = 2;
Masking = true; Masking = true;
AddRangeInternal(new Drawable[] AddRangeInternal(new Drawable[]
@ -70,16 +68,14 @@ namespace osu.Game.Tournament.Components
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre, Anchor = Anchor.CentreLeft,
Origin = Anchor.TopCentre, Origin = Anchor.CentreLeft,
Padding = new MarginPadding(vertical_padding), Padding = new MarginPadding(15),
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
Children = new Drawable[] Children = new Drawable[]
{ {
new TournamentSpriteText new TournamentSpriteText
{ {
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = new LocalisedString(( Text = new LocalisedString((
$"{Beatmap.Metadata.ArtistUnicode ?? Beatmap.Metadata.Artist} - {Beatmap.Metadata.TitleUnicode ?? Beatmap.Metadata.Title}", $"{Beatmap.Metadata.ArtistUnicode ?? Beatmap.Metadata.Artist} - {Beatmap.Metadata.TitleUnicode ?? Beatmap.Metadata.Title}",
$"{Beatmap.Metadata.Artist} - {Beatmap.Metadata.Title}")), $"{Beatmap.Metadata.Artist} - {Beatmap.Metadata.Title}")),
@ -88,9 +84,6 @@ namespace osu.Game.Tournament.Components
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding(vertical_padding),
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Children = new Drawable[] Children = new Drawable[]
{ {
@ -137,8 +130,8 @@ namespace osu.Game.Tournament.Components
Texture = textures.Get($"mods/{mods}"), Texture = textures.Get($"mods/{mods}"),
Anchor = Anchor.CentreRight, Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight, Origin = Anchor.CentreRight,
Margin = new MarginPadding(20), Margin = new MarginPadding(10),
Scale = new Vector2(0.5f) Scale = new Vector2(0.8f)
}); });
} }
} }
@ -170,16 +163,7 @@ namespace osu.Game.Tournament.Components
BorderThickness = 6; BorderThickness = 6;
switch (found.Team) BorderColour = TournamentGame.GetTeamColour(found.Team);
{
case TeamColour.Red:
BorderColour = Color4.Red;
break;
case TeamColour.Blue:
BorderColour = Color4.Blue;
break;
}
switch (found.Type) switch (found.Type)
{ {

View File

@ -9,8 +9,6 @@ using osu.Game.Online.Chat;
using osu.Game.Overlays.Chat; using osu.Game.Overlays.Chat;
using osu.Game.Tournament.IPC; using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tournament.Components namespace osu.Game.Tournament.Components
{ {
@ -23,11 +21,11 @@ namespace osu.Game.Tournament.Components
public TournamentMatchChatDisplay() public TournamentMatchChatDisplay()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Y = 100; Height = 144;
Size = new Vector2(0.45f, 112); Anchor = Anchor.BottomLeft;
Margin = new MarginPadding(10); Origin = Anchor.BottomLeft;
Anchor = Anchor.BottomCentre;
Origin = Anchor.BottomCentre; CornerRadius = 0;
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
@ -66,6 +64,10 @@ namespace osu.Game.Tournament.Components
} }
} }
public void Expand() => this.FadeIn(300);
public void Contract() => this.FadeOut(200);
protected override ChatLine CreateMessage(Message message) => new MatchMessage(message); protected override ChatLine CreateMessage(Message message) => new MatchMessage(message);
protected class MatchMessage : StandAloneMessage protected class MatchMessage : StandAloneMessage
@ -75,19 +77,15 @@ namespace osu.Game.Tournament.Components
{ {
} }
[BackgroundDependencyLoader]
private void load(LadderInfo info) private void load(LadderInfo info)
{ {
// if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.Id == Message.Sender.Id)) // if (info.CurrentMatch.Value.Team1.Value.Players.Any(u => u.Id == Message.Sender.Id))
// ColourBox.Colour = red; // SenderText.Colour = TournamentGame.COLOUR_RED;
// else if (info.CurrentMatch.Value.Team2.Value.Players.Any(u => u.Id == Message.Sender.Id)) // else if (info.CurrentMatch.Value.Team2.Value.Players.Any(u => u.Id == Message.Sender.Id))
// ColourBox.Colour = blue; // SenderText.Colour = TournamentGame.COLOUR_BLUE;
// else if (Message.Sender.Colour != null) // else if (Message.Sender.Colour != null)
// SenderText.Colour = ColourBox.Colour = OsuColour.FromHex(Message.Sender.Colour); // SenderText.Colour = ColourBox.Colour = OsuColour.FromHex(Message.Sender.Colour);
} }
private readonly Color4 red = new Color4(186, 0, 18, 255);
private readonly Color4 blue = new Color4(17, 136, 170, 255);
} }
} }
} }

View File

@ -0,0 +1,37 @@
// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
namespace osu.Game.Tournament.Components
{
public class TournamentSpriteTextWithBackground : CompositeDrawable
{
protected readonly TournamentSpriteText Text;
protected readonly Box Background;
public TournamentSpriteTextWithBackground(string text = "")
{
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
{
Background = new Box
{
Colour = TournamentGame.ELEMENT_BACKGROUND_COLOUR,
RelativeSizeAxes = Axes.Both,
},
Text = new TournamentSpriteText
{
Colour = TournamentGame.ELEMENT_FOREGROUND_COLOUR,
Font = OsuFont.Torus.With(weight: FontWeight.SemiBold, size: 50),
Padding = new MarginPadding { Left = 10, Right = 20 },
Text = text
}
};
}
}
}

View File

@ -1,12 +1,13 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System.IO; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Video; using osu.Framework.Graphics.Video;
using osu.Framework.Platform;
using osu.Framework.Timing; using osu.Framework.Timing;
using osu.Game.Graphics; using osu.Game.Graphics;
@ -14,13 +15,34 @@ namespace osu.Game.Tournament.Components
{ {
public class TourneyVideo : CompositeDrawable public class TourneyVideo : CompositeDrawable
{ {
private readonly VideoSprite video; private readonly string filename;
private readonly bool drawFallbackGradient;
private VideoSprite video;
private readonly ManualClock manualClock; private ManualClock manualClock;
public TourneyVideo(Stream stream) public TourneyVideo(string filename, bool drawFallbackGradient = false)
{ {
if (stream == null) this.filename = filename;
this.drawFallbackGradient = drawFallbackGradient;
}
[BackgroundDependencyLoader]
private void load(Storage storage)
{
var stream = storage.GetStream($@"videos/{filename}.m4v");
if (stream != null)
{
InternalChild = video = new VideoSprite(stream)
{
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
Clock = new FramedClock(manualClock = new ManualClock()),
Loop = loop,
};
}
else if (drawFallbackGradient)
{ {
InternalChild = new Box InternalChild = new Box
{ {
@ -28,26 +50,26 @@ namespace osu.Game.Tournament.Components
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}; };
} }
else
{
InternalChild = video = new VideoSprite(stream)
{
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
Clock = new FramedClock(manualClock = new ManualClock())
};
}
} }
private bool loop;
public bool Loop public bool Loop
{ {
set set
{ {
loop = value;
if (video != null) if (video != null)
video.Loop = value; video.Loop = value;
} }
} }
public void Reset()
{
if (manualClock != null)
manualClock.CurrentTime = 0;
}
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();

View File

@ -90,6 +90,8 @@ namespace osu.Game.Tournament.Models
[JsonIgnore] [JsonIgnore]
public TournamentTeam Loser => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team2.Value : Team1.Value; public TournamentTeam Loser => !Completed.Value ? null : Team1Score.Value > Team2Score.Value ? Team2.Value : Team1.Value;
public TeamColour WinnerColour => Winner == Team1.Value ? TeamColour.Red : TeamColour.Blue;
public int PointsToWin => Round.Value?.BestOf.Value / 2 + 1 ?? 0; public int PointsToWin => Round.Value?.BestOf.Value / 2 + 1 ?? 0;
/// <summary> /// <summary>

View File

@ -21,6 +21,7 @@ namespace osu.Game.Tournament.Screens
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight, Origin = Anchor.BottomRight,
Depth = float.MinValue,
}); });
} }

View File

@ -8,7 +8,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.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -116,53 +115,5 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
sb.AppendLine(gt.Team.FullName.Value); sb.AppendLine(gt.Team.FullName.Value);
return sb.ToString(); return sb.ToString();
} }
private class GroupTeam : DrawableTournamentTeam
{
private readonly FillFlowContainer innerContainer;
public GroupTeam(TournamentTeam team)
: base(team)
{
Width = 36;
AutoSizeAxes = Axes.Y;
Flag.Anchor = Anchor.TopCentre;
Flag.Origin = Anchor.TopCentre;
AcronymText.Anchor = Anchor.TopCentre;
AcronymText.Origin = Anchor.TopCentre;
AcronymText.Text = team.Acronym.Value.ToUpperInvariant();
AcronymText.Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 10);
InternalChildren = new Drawable[]
{
innerContainer = new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5f),
Children = new Drawable[]
{
Flag,
AcronymText
}
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
innerContainer.ScaleTo(1.5f);
innerContainer.ScaleTo(1f, 200);
}
}
} }
} }

View File

@ -0,0 +1,60 @@
// 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models;
using osuTK;
namespace osu.Game.Tournament.Screens.Drawings.Components
{
public class GroupTeam : DrawableTournamentTeam
{
private readonly FillFlowContainer innerContainer;
public GroupTeam(TournamentTeam team)
: base(team)
{
Width = 36;
AutoSizeAxes = Axes.Y;
Flag.Anchor = Anchor.TopCentre;
Flag.Origin = Anchor.TopCentre;
AcronymText.Anchor = Anchor.TopCentre;
AcronymText.Origin = Anchor.TopCentre;
AcronymText.Text = team.Acronym.Value.ToUpperInvariant();
AcronymText.Font = OsuFont.Torus.With(weight: FontWeight.Bold, size: 10);
InternalChildren = new Drawable[]
{
innerContainer = new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 5f),
Children = new Drawable[]
{
Flag,
AcronymText
}
}
};
}
protected override void LoadComplete()
{
base.LoadComplete();
innerContainer.ScaleTo(1.5f);
innerContainer.ScaleTo(1f, 200);
}
}
}

View File

@ -129,8 +129,6 @@ namespace osu.Game.Tournament.Screens.Editors
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
LayoutDuration = 200,
LayoutEasing = Easing.OutQuint,
ChildrenEnumerable = round.Beatmaps.Select(p => new RoundBeatmapRow(round, p)) ChildrenEnumerable = round.Beatmaps.Select(p => new RoundBeatmapRow(round, p))
}; };
} }

View File

@ -124,8 +124,6 @@ namespace osu.Game.Tournament.Screens.Editors
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
LayoutDuration = 200,
LayoutEasing = Easing.OutQuint,
ChildrenEnumerable = round.Beatmaps.Select(p => new SeedingBeatmapRow(round, p)) ChildrenEnumerable = round.Beatmaps.Select(p => new SeedingBeatmapRow(round, p))
}; };
} }

View File

@ -172,19 +172,6 @@ namespace osu.Game.Tournament.Screens.Editors
drawableContainer.Child = new DrawableTeamFlag(Model); drawableContainer.Child = new DrawableTeamFlag(Model);
} }
private class DrawableTeamFlag : DrawableTournamentTeam
{
public DrawableTeamFlag(TournamentTeam team)
: base(team)
{
InternalChild = Flag;
RelativeSizeAxes = Axes.Both;
Flag.Anchor = Anchor.Centre;
Flag.Origin = Anchor.Centre;
}
}
public class PlayerEditor : CompositeDrawable public class PlayerEditor : CompositeDrawable
{ {
private readonly TournamentTeam team; private readonly TournamentTeam team;
@ -202,8 +189,6 @@ namespace osu.Game.Tournament.Screens.Editors
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
LayoutDuration = 200,
LayoutEasing = Easing.OutQuint,
ChildrenEnumerable = team.Players.Select(p => new PlayerRow(team, p)) ChildrenEnumerable = team.Players.Select(p => new PlayerRow(team, p))
}; };
} }

View File

@ -40,7 +40,6 @@ namespace osu.Game.Tournament.Screens.Editors
new OsuScrollContainer new OsuScrollContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.9f,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Child = flow = new FillFlowContainer<TDrawable> Child = flow = new FillFlowContainer<TDrawable>
@ -48,8 +47,6 @@ namespace osu.Game.Tournament.Screens.Editors
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
LayoutDuration = 200,
LayoutEasing = Easing.OutQuint,
Spacing = new Vector2(20) Spacing = new Vector2(20)
}, },
}, },

View File

@ -5,21 +5,28 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Showcase;
using osuTK; using osuTK;
using osuTK.Graphics;
using osuTK.Input; using osuTK.Input;
namespace osu.Game.Tournament.Screens.Gameplay.Components namespace osu.Game.Tournament.Screens.Gameplay.Components
{ {
public class MatchHeader : Container public class MatchHeader : Container
{ {
private TeamScoreDisplay teamDisplay1;
private TeamScoreDisplay teamDisplay2;
public bool ShowScores
{
set
{
teamDisplay1.ShowScore = value;
teamDisplay2.ShowScore = value;
}
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -27,27 +34,42 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
Height = 95; Height = 95;
Children = new Drawable[] Children = new Drawable[]
{ {
new TournamentLogo(), new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(5),
Children = new Drawable[]
{
new DrawableTournamentTitleText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(1.2f)
},
new RoundDisplay new RoundDisplay
{ {
Y = 5, Anchor = Anchor.Centre,
Anchor = Anchor.BottomCentre, Origin = Anchor.Centre,
Origin = Anchor.TopCentre, Scale = new Vector2(0.4f)
}, },
new TeamScoreDisplay(TeamColour.Red) }
},
teamDisplay1 = new TeamScoreDisplay(TeamColour.Red)
{ {
Anchor = Anchor.TopLeft, Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft, Origin = Anchor.TopLeft,
}, },
new TeamScoreDisplay(TeamColour.Blue) teamDisplay2 = new TeamScoreDisplay(TeamColour.Blue)
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
}, },
}; };
} }
}
private class TeamScoreDisplay : CompositeDrawable public class TeamScoreDisplay : CompositeDrawable
{ {
private readonly TeamColour teamColour; private readonly TeamColour teamColour;
@ -55,28 +77,35 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>(); private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>();
private readonly Bindable<int?> currentTeamScore = new Bindable<int?>(); private readonly Bindable<int?> currentTeamScore = new Bindable<int?>();
private TeamDisplay teamDisplay;
public bool ShowScore { set => teamDisplay.ShowScore = value; }
public TeamScoreDisplay(TeamColour teamColour) public TeamScoreDisplay(TeamColour teamColour)
{ {
this.teamColour = teamColour; this.teamColour = teamColour;
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
Width = 300; AutoSizeAxes = Axes.X;
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(LadderInfo ladder) private void load(LadderInfo ladder)
{ {
currentMatch.BindValueChanged(matchChanged);
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
currentMatch.BindValueChanged(matchChanged, true);
} }
private void matchChanged(ValueChangedEvent<TournamentMatch> match) private void matchChanged(ValueChangedEvent<TournamentMatch> match)
{ {
currentTeamScore.UnbindBindings(); currentTeamScore.UnbindBindings();
currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1Score : match.NewValue.Team2Score);
currentTeam.UnbindBindings(); currentTeam.UnbindBindings();
if (match.NewValue != null)
{
currentTeamScore.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1Score : match.NewValue.Team2Score);
currentTeam.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1 : match.NewValue.Team2); currentTeam.BindTo(teamColour == TeamColour.Red ? match.NewValue.Team1 : match.NewValue.Team2);
}
// team may change to same team, which means score is not in a good state. // team may change to same team, which means score is not in a good state.
// thus we handle this manually. // thus we handle this manually.
@ -103,124 +132,10 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
private void teamChanged(TournamentTeam team) private void teamChanged(TournamentTeam team)
{ {
var colour = teamColour == TeamColour.Red ? TournamentGame.COLOUR_RED : TournamentGame.COLOUR_BLUE;
var flip = teamColour != TeamColour.Red;
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TeamDisplay(team, colour, flip), teamDisplay = new TeamDisplay(team, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0),
new TeamScore(currentTeamScore, flip, currentMatch.Value.PointsToWin)
{
Colour = colour
}
}; };
} }
} }
private class TeamScore : CompositeDrawable
{
private readonly Bindable<int?> currentTeamScore = new Bindable<int?>();
private readonly StarCounter counter;
public TeamScore(Bindable<int?> score, bool flip, int count)
{
var anchor = flip ? Anchor.CentreRight : Anchor.CentreLeft;
Anchor = anchor;
Origin = anchor;
InternalChild = counter = new StarCounter(count)
{
Anchor = anchor,
X = (flip ? -1 : 1) * 90,
Y = 5,
Scale = flip ? new Vector2(-1, 1) : Vector2.One,
};
currentTeamScore.BindValueChanged(scoreChanged);
currentTeamScore.BindTo(score);
}
private void scoreChanged(ValueChangedEvent<int?> score) => counter.CountStars = score.NewValue ?? 0;
}
private class TeamDisplay : DrawableTournamentTeam
{
public TeamDisplay(TournamentTeam team, Color4 colour, bool flip)
: base(team)
{
RelativeSizeAxes = Axes.Both;
var anchor = flip ? Anchor.CentreRight : Anchor.CentreLeft;
Anchor = Origin = anchor;
Flag.Anchor = Flag.Origin = anchor;
Flag.RelativeSizeAxes = Axes.None;
Flag.Size = new Vector2(60, 40);
Flag.Margin = new MarginPadding(20);
InternalChild = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
Flag,
new TournamentSpriteText
{
Text = team?.FullName.Value.ToUpper() ?? "???",
X = (flip ? -1 : 1) * 90,
Y = -10,
Colour = colour,
Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 20),
Origin = anchor,
Anchor = anchor,
},
}
};
}
}
private class RoundDisplay : CompositeDrawable
{
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private readonly TournamentSpriteText text;
public RoundDisplay()
{
Width = 200;
Height = 20;
Masking = true;
CornerRadius = 10;
InternalChildren = new Drawable[]
{
new Box
{
Colour = OsuColour.Gray(0.18f),
RelativeSizeAxes = Axes.Both,
},
text = new TournamentSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = Color4.White,
Font = OsuFont.Torus.With(weight: FontWeight.Regular, size: 16),
},
};
}
[BackgroundDependencyLoader]
private void load(LadderInfo ladder)
{
currentMatch.BindValueChanged(matchChanged);
currentMatch.BindTo(ladder.CurrentMatch);
}
private void matchChanged(ValueChangedEvent<TournamentMatch> match) =>
text.Text = match.NewValue.Round.Value?.Name.Value ?? "Unknown Round";
}
}
} }

View File

@ -11,16 +11,12 @@ using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.IPC; using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Gameplay.Components namespace osu.Game.Tournament.Screens.Gameplay.Components
{ {
public class MatchScoreDisplay : CompositeDrawable public class MatchScoreDisplay : CompositeDrawable
{ {
private readonly Color4 red = new Color4(186, 0, 18, 255); private const float bar_height = 18;
private readonly Color4 blue = new Color4(17, 136, 170, 255);
private const float bar_height = 20;
private readonly BindableInt score1 = new BindableInt(); private readonly BindableInt score1 = new BindableInt();
private readonly BindableInt score2 = new BindableInt(); private readonly BindableInt score2 = new BindableInt();
@ -28,45 +24,63 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
private readonly MatchScoreCounter score1Text; private readonly MatchScoreCounter score1Text;
private readonly MatchScoreCounter score2Text; private readonly MatchScoreCounter score2Text;
private readonly Circle score1Bar; private readonly Drawable score1Bar;
private readonly Circle score2Bar; private readonly Drawable score2Bar;
public MatchScoreDisplay() public MatchScoreDisplay()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
InternalChildren = new Drawable[] InternalChildren = new[]
{ {
score1Bar = new Circle new Box
{
Name = "top bar red (static)",
RelativeSizeAxes = Axes.X,
Height = bar_height / 4,
Width = 0.5f,
Colour = TournamentGame.COLOUR_RED,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopRight
},
new Box
{
Name = "top bar blue (static)",
RelativeSizeAxes = Axes.X,
Height = bar_height / 4,
Width = 0.5f,
Colour = TournamentGame.COLOUR_BLUE,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopLeft
},
score1Bar = new Box
{ {
Name = "top bar red", Name = "top bar red",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = bar_height, Height = bar_height,
Width = 0, Width = 0,
Colour = red, Colour = TournamentGame.COLOUR_RED,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopRight Origin = Anchor.TopRight
}, },
score1Text = new MatchScoreCounter score1Text = new MatchScoreCounter
{ {
Colour = red,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre Origin = Anchor.TopCentre
}, },
score2Bar = new Circle score2Bar = new Box
{ {
Name = "top bar blue", Name = "top bar blue",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = bar_height, Height = bar_height,
Width = 0, Width = 0,
Colour = blue, Colour = TournamentGame.COLOUR_BLUE,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopLeft Origin = Anchor.TopLeft
}, },
score2Text = new MatchScoreCounter score2Text = new MatchScoreCounter
{ {
Colour = blue,
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre Origin = Anchor.TopCentre
}, },
@ -103,10 +117,9 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
winningBar.ResizeWidthTo(Math.Min(0.4f, MathF.Pow(diff / 1500000f, 0.5f) / 2), 400, Easing.OutQuint); winningBar.ResizeWidthTo(Math.Min(0.4f, MathF.Pow(diff / 1500000f, 0.5f) / 2), 400, Easing.OutQuint);
} }
protected override void Update() protected override void UpdateAfterChildren()
{ {
base.Update(); base.UpdateAfterChildren();
score1Text.X = -Math.Max(5 + score1Text.DrawWidth / 2, score1Bar.DrawWidth); score1Text.X = -Math.Max(5 + score1Text.DrawWidth / 2, score1Bar.DrawWidth);
score2Text.X = Math.Max(5 + score2Text.DrawWidth / 2, score2Bar.DrawWidth); score2Text.X = Math.Max(5 + score2Text.DrawWidth / 2, score2Bar.DrawWidth);
} }
@ -115,7 +128,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
{ {
public MatchScoreCounter() public MatchScoreCounter()
{ {
Margin = new MarginPadding { Top = bar_height + 5, Horizontal = 10 }; Margin = new MarginPadding { Top = bar_height, Horizontal = 10 };
Winning = false; Winning = false;
} }
@ -123,8 +136,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
public bool Winning public bool Winning
{ {
set => DisplayedCountSpriteText.Font = value set => DisplayedCountSpriteText.Font = value
? OsuFont.Torus.With(weight: FontWeight.Regular, size: 60) ? OsuFont.Torus.With(weight: FontWeight.Bold, size: 50)
: OsuFont.Torus.With(weight: FontWeight.Light, size: 40); : OsuFont.Torus.With(weight: FontWeight.Regular, size: 40);
} }
} }
} }

View File

@ -0,0 +1,25 @@
// 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.Bindables;
using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models;
namespace osu.Game.Tournament.Screens.Gameplay.Components
{
public class RoundDisplay : TournamentSpriteTextWithBackground
{
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
[BackgroundDependencyLoader]
private void load(LadderInfo ladder)
{
currentMatch.BindValueChanged(matchChanged);
currentMatch.BindTo(ladder.CurrentMatch);
}
private void matchChanged(ValueChangedEvent<TournamentMatch> match) =>
Text.Text = match.NewValue.Round.Value?.Name.Value ?? "Unknown Round";
}
}

View File

@ -0,0 +1,91 @@
// 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.Tournament.Components;
using osu.Game.Tournament.Models;
using osuTK;
namespace osu.Game.Tournament.Screens.Gameplay.Components
{
public class TeamDisplay : DrawableTournamentTeam
{
private readonly TeamScore score;
public bool ShowScore { set => score.FadeTo(value ? 1 : 0, 200); }
public TeamDisplay(TournamentTeam team, TeamColour colour, Bindable<int?> currentTeamScore, int pointsToWin)
: base(team)
{
AutoSizeAxes = Axes.Both;
bool flip = colour == TeamColour.Red;
var anchor = flip ? Anchor.TopLeft : Anchor.TopRight;
Flag.RelativeSizeAxes = Axes.None;
Flag.Size = new Vector2(60, 40);
Flag.Origin = anchor;
Flag.Anchor = anchor;
Margin = new MarginPadding(20);
InternalChild = new Container
{
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5),
Children = new Drawable[]
{
Flag,
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Origin = anchor,
Anchor = anchor,
Spacing = new Vector2(5),
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5),
Children = new Drawable[]
{
new DrawableTeamHeader(colour)
{
Scale = new Vector2(0.75f),
Origin = anchor,
Anchor = anchor,
},
score = new TeamScore(currentTeamScore, colour, pointsToWin)
{
Origin = anchor,
Anchor = anchor,
}
}
},
new TournamentSpriteTextWithBackground(team?.FullName.Value ?? "???")
{
Scale = new Vector2(0.5f),
Origin = anchor,
Anchor = anchor,
},
}
},
}
},
}
};
}
}
}

View File

@ -0,0 +1,103 @@
// 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.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.Models;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Gameplay.Components
{
public class TeamScore : CompositeDrawable
{
private readonly Bindable<int?> currentTeamScore = new Bindable<int?>();
private readonly StarCounter counter;
public TeamScore(Bindable<int?> score, TeamColour colour, int count)
{
bool flip = colour == TeamColour.Blue;
var anchor = flip ? Anchor.TopRight : Anchor.TopLeft;
AutoSizeAxes = Axes.Both;
InternalChild = counter = new TeamScoreStarCounter(count)
{
Anchor = anchor,
Scale = flip ? new Vector2(-1, 1) : Vector2.One,
};
currentTeamScore.BindValueChanged(scoreChanged);
currentTeamScore.BindTo(score);
}
private void scoreChanged(ValueChangedEvent<int?> score) => counter.Current = score.NewValue ?? 0;
public class TeamScoreStarCounter : StarCounter
{
public TeamScoreStarCounter(int count)
: base(count)
{
}
public override Star CreateStar() => new LightSquare();
public class LightSquare : Star
{
private readonly Box box;
public LightSquare()
{
Size = new Vector2(22.5f);
InternalChildren = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
BorderColour = OsuColour.Gray(0.5f),
BorderThickness = 3,
Children = new Drawable[]
{
new Box
{
Colour = Color4.Transparent,
RelativeSizeAxes = Axes.Both,
AlwaysPresent = true,
},
}
},
box = new Box
{
Colour = OsuColour.FromHex("#FFE8AD"),
RelativeSizeAxes = Axes.Both,
},
};
Masking = true;
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Colour = OsuColour.FromHex("#FFE8AD").Opacity(0.1f),
Hollow = true,
Radius = 20,
Roundness = 10,
};
}
public override void DisplayAt(float scale)
{
box.FadeTo(scale, 500, Easing.OutQuint);
FadeEdgeEffectTo(0.2f * scale, 500, Easing.OutQuint);
}
}
}
}
}

View File

@ -6,6 +6,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; 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.Platform;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
@ -14,12 +15,11 @@ using osu.Game.Tournament.Models;
using osu.Game.Tournament.Screens.Gameplay.Components; using osu.Game.Tournament.Screens.Gameplay.Components;
using osu.Game.Tournament.Screens.MapPool; using osu.Game.Tournament.Screens.MapPool;
using osu.Game.Tournament.Screens.TeamWin; using osu.Game.Tournament.Screens.TeamWin;
using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Gameplay namespace osu.Game.Tournament.Screens.Gameplay
{ {
public class GameplayScreen : BeatmapInfoScreen public class GameplayScreen : BeatmapInfoScreen, IProvideVideo
{ {
private readonly BindableBool warmup = new BindableBool(); private readonly BindableBool warmup = new BindableBool();
@ -29,9 +29,6 @@ namespace osu.Game.Tournament.Screens.Gameplay
private OsuButton warmupButton; private OsuButton warmupButton;
private MatchIPCInfo ipc; private MatchIPCInfo ipc;
private readonly Color4 red = new Color4(186, 0, 18, 255);
private readonly Color4 blue = new Color4(17, 136, 170, 255);
[Resolved(canBeNull: true)] [Resolved(canBeNull: true)]
private TournamentSceneManager sceneManager { get; set; } private TournamentSceneManager sceneManager { get; set; }
@ -39,20 +36,25 @@ namespace osu.Game.Tournament.Screens.Gameplay
private TournamentMatchChatDisplay chat { get; set; } private TournamentMatchChatDisplay chat { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(LadderInfo ladder, MatchIPCInfo ipc) private void load(LadderInfo ladder, MatchIPCInfo ipc, Storage storage)
{ {
this.ipc = ipc; this.ipc = ipc;
AddRangeInternal(new Drawable[] AddRangeInternal(new Drawable[]
{ {
new MatchHeader(), new TourneyVideo("gameplay")
{
Loop = true,
RelativeSizeAxes = Axes.Both,
},
header = new MatchHeader(),
new Container new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Y = 5, Y = 110,
Anchor = Anchor.Centre, Anchor = Anchor.TopCentre,
Origin = Anchor.Centre, Origin = Anchor.TopCentre,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box new Box
@ -60,44 +62,18 @@ namespace osu.Game.Tournament.Screens.Gameplay
// chroma key area for stable gameplay // chroma key area for stable gameplay
Name = "chroma", Name = "chroma",
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Height = 512, Height = 512,
Colour = new Color4(0, 255, 0, 255), Colour = new Color4(0, 255, 0, 255),
}, },
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Y = -4,
Children = new Drawable[]
{
new Circle
{
Name = "top bar red",
RelativeSizeAxes = Axes.X,
Height = 8,
Width = 0.5f,
Colour = red,
},
new Circle
{
Name = "top bar blue",
RelativeSizeAxes = Axes.X,
Height = 8,
Width = 0.5f,
Colour = blue,
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
},
}
},
} }
}, },
scoreDisplay = new MatchScoreDisplay scoreDisplay = new MatchScoreDisplay
{ {
Y = -60, Y = -147,
Scale = new Vector2(0.8f),
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre, Origin = Anchor.TopCentre,
}, },
new ControlPanel new ControlPanel
{ {
@ -130,13 +106,18 @@ namespace osu.Game.Tournament.Screens.Gameplay
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
warmup.BindValueChanged(w => warmupButton.Alpha = !w.NewValue ? 0.5f : 1, true); warmup.BindValueChanged(w =>
{
warmupButton.Alpha = !w.NewValue ? 0.5f : 1;
header.ShowScores = !w.NewValue;
}, true);
} }
private ScheduledDelegate scheduledOperation; private ScheduledDelegate scheduledOperation;
private MatchScoreDisplay scoreDisplay; private MatchScoreDisplay scoreDisplay;
private TourneyState lastState; private TourneyState lastState;
private MatchHeader header;
private void stateChanged(ValueChangedEvent<TourneyState> state) private void stateChanged(ValueChangedEvent<TourneyState> state)
{ {
@ -156,7 +137,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
void expand() void expand()
{ {
chat?.Expand(); chat?.Contract();
using (BeginDelayedSequence(300, true)) using (BeginDelayedSequence(300, true))
{ {
@ -170,7 +151,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
SongBar.Expanded = false; SongBar.Expanded = false;
scoreDisplay.FadeOut(100); scoreDisplay.FadeOut(100);
using (chat?.BeginDelayedSequence(500)) using (chat?.BeginDelayedSequence(500))
chat?.Contract(); chat?.Expand();
} }
switch (state.NewValue) switch (state.NewValue)
@ -197,7 +178,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
break; break;
default: default:
chat.Expand(); chat.Contract();
expand(); expand();
break; break;
} }

View File

@ -27,21 +27,23 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private readonly bool losers; private readonly bool losers;
private TournamentSpriteText scoreText; private TournamentSpriteText scoreText;
private Box background; private Box background;
private Box backgroundRight;
private readonly Bindable<int?> score = new Bindable<int?>(); private readonly Bindable<int?> score = new Bindable<int?>();
private readonly BindableBool completed = new BindableBool(); private readonly BindableBool completed = new BindableBool();
private Color4 colourWinner; private Color4 colourWinner;
private Color4 colourNormal;
private readonly Func<bool> isWinner; private readonly Func<bool> isWinner;
private LadderEditorScreen ladderEditor; private LadderEditorScreen ladderEditor;
[Resolved] [Resolved(canBeNull: true)]
private LadderInfo ladderInfo { get; set; } private LadderInfo ladderInfo { get; set; }
private void setCurrent() private void setCurrent()
{ {
if (ladderInfo == null) return;
//todo: tournamentgamebase? //todo: tournamentgamebase?
if (ladderInfo.CurrentMatch.Value != null) if (ladderInfo.CurrentMatch.Value != null)
ladderInfo.CurrentMatch.Value.Current.Value = false; ladderInfo.CurrentMatch.Value.Current.Value = false;
@ -60,15 +62,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
this.losers = losers; this.losers = losers;
Size = new Vector2(150, 40); Size = new Vector2(150, 40);
Masking = true;
CornerRadius = 5;
Flag.Scale = new Vector2(0.9f); Flag.Scale = new Vector2(0.9f);
Flag.Anchor = Flag.Origin = Anchor.CentreLeft; Flag.Anchor = Flag.Origin = Anchor.CentreLeft;
AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft; AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft;
AcronymText.Padding = new MarginPadding { Left = 50 }; AcronymText.Padding = new MarginPadding { Left = 50 };
AcronymText.Font = OsuFont.Torus.With(size: 24); AcronymText.Font = OsuFont.Torus.With(size: 22, weight: FontWeight.Bold);
if (match != null) if (match != null)
{ {
@ -85,8 +84,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
this.ladderEditor = ladderEditor; this.ladderEditor = ladderEditor;
colourWinner = losers ? colours.YellowDarker : colours.BlueDarker; colourWinner = losers
colourNormal = OsuColour.Gray(0.2f); ? OsuColour.FromHex("#8E7F48")
: OsuColour.FromHex("#1462AA");
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
@ -102,17 +102,18 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
AcronymText, AcronymText,
Flag, Flag,
}
},
new Container new Container
{ {
Masking = true, Masking = true,
CornerRadius = 5,
Width = 0.3f, Width = 0.3f,
Anchor = Anchor.CentreRight, Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight, Origin = Anchor.CentreRight,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new Box backgroundRight = new Box
{ {
Colour = OsuColour.Gray(0.1f), Colour = OsuColour.Gray(0.1f),
Alpha = 0.8f, Alpha = 0.8f,
@ -122,9 +123,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Font = OsuFont.Torus.With(size: 20), Font = OsuFont.Torus.With(size: 22),
}
}
} }
} }
} }
@ -181,9 +180,12 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
bool winner = completed.Value && isWinner?.Invoke() == true; bool winner = completed.Value && isWinner?.Invoke() == true;
background.FadeColour(winner ? colourWinner : colourNormal, winner ? 500 : 0, Easing.OutQuint); background.FadeColour(winner ? Color4.White : OsuColour.FromHex("#444"), winner ? 500 : 0, Easing.OutQuint);
backgroundRight.FadeColour(winner ? colourWinner : OsuColour.FromHex("#333"), winner ? 500 : 0, Easing.OutQuint);
scoreText.Font = AcronymText.Font = OsuFont.Torus.With(weight: winner ? FontWeight.Bold : FontWeight.Regular); AcronymText.Colour = winner ? Color4.Black : Color4.White;
scoreText.Font = scoreText.Font.With(weight: winner ? FontWeight.Bold : FontWeight.Regular);
} }
public MenuItem[] ContextMenuItems public MenuItem[] ContextMenuItems

View File

@ -23,7 +23,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private readonly bool editor; private readonly bool editor;
protected readonly FillFlowContainer<DrawableMatchTeam> Flow; protected readonly FillFlowContainer<DrawableMatchTeam> Flow;
private readonly Drawable selectionBox; private readonly Drawable selectionBox;
private readonly Drawable currentMatchSelectionBox; protected readonly Drawable CurrentMatchSelectionBox;
private Bindable<TournamentMatch> globalSelection; private Bindable<TournamentMatch> globalSelection;
[Resolved(CanBeNull = true)] [Resolved(CanBeNull = true)]
@ -45,9 +45,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
selectionBox = new Container selectionBox = new Container
{ {
CornerRadius = 5, Scale = new Vector2(1.1f),
Masking = true,
Scale = new Vector2(1.05f),
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -55,16 +53,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
Colour = Color4.YellowGreen, Colour = Color4.YellowGreen,
Child = new Box { RelativeSizeAxes = Axes.Both } Child = new Box { RelativeSizeAxes = Axes.Both }
}, },
currentMatchSelectionBox = new Container CurrentMatchSelectionBox = new Container
{ {
CornerRadius = 5, Scale = new Vector2(1.05f, 1.1f),
Masking = true,
Scale = new Vector2(1.05f),
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Alpha = 0, Alpha = 0,
Colour = Color4.OrangeRed, Colour = Color4.White,
Child = new Box { RelativeSizeAxes = Axes.Both } Child = new Box { RelativeSizeAxes = Axes.Both }
}, },
Flow = new FillFlowContainer<DrawableMatchTeam> Flow = new FillFlowContainer<DrawableMatchTeam>
@ -128,9 +124,9 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
private void updateCurrentMatch() private void updateCurrentMatch()
{ {
if (Match.Current.Value) if (Match.Current.Value)
currentMatchSelectionBox.Show(); CurrentMatchSelectionBox.Show();
else else
currentMatchSelectionBox.Hide(); CurrentMatchSelectionBox.Hide();
} }
private bool selected; private bool selected;

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Ladder.Components namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
@ -33,14 +32,14 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
{ {
textDescription = new TournamentSpriteText textDescription = new TournamentSpriteText
{ {
Colour = Color4.Black, Colour = TournamentGame.TEXT_COLOUR,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre Anchor = Anchor.TopCentre
}, },
textName = new TournamentSpriteText textName = new TournamentSpriteText
{ {
Font = OsuFont.Torus.With(weight: FontWeight.Bold), Font = OsuFont.Torus.With(weight: FontWeight.Bold),
Colour = Color4.Black, Colour = TournamentGame.TEXT_COLOUR,
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre Anchor = Anchor.TopCentre
}, },

View File

@ -32,8 +32,8 @@ namespace osu.Game.Tournament.Screens.Ladder
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, Storage storage) private void load(OsuColour colours, Storage storage)
{ {
normalPathColour = colours.BlueDarker.Darken(2); normalPathColour = OsuColour.FromHex("#66D1FF");
losersPathColour = colours.YellowDarker.Darken(2); losersPathColour = OsuColour.FromHex("#FFC700");
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
@ -42,11 +42,17 @@ namespace osu.Game.Tournament.Screens.Ladder
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new TourneyVideo(storage.GetStream(@"videos/ladder.m4v")) new TourneyVideo("ladder")
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
}, },
new DrawableTournamentTitleText
{
Y = 100,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
},
ScrollContent = new LadderDragContainer ScrollContent = new LadderDragContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -42,6 +42,11 @@ namespace osu.Game.Tournament.Screens.MapPool
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TourneyVideo("gameplay")
{
Loop = true,
RelativeSizeAxes = Axes.Both,
},
new MatchHeader(), new MatchHeader(),
mapFlows = new FillFlowContainer<FillFlowContainer<TournamentBeatmapPanel>> mapFlows = new FillFlowContainer<FillFlowContainer<TournamentBeatmapPanel>>
{ {

View File

@ -18,7 +18,7 @@ using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.Schedule namespace osu.Game.Tournament.Screens.Schedule
{ {
public class ScheduleScreen : TournamentScreen, IProvideVideo public class ScheduleScreen : TournamentScreen // IProvidesVideo
{ {
private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>(); private readonly Bindable<TournamentMatch> currentMatch = new Bindable<TournamentMatch>();
private Container mainContainer; private Container mainContainer;
@ -33,15 +33,68 @@ namespace osu.Game.Tournament.Screens.Schedule
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TourneyVideo(storage.GetStream(@"videos/schedule.m4v")) new TourneyVideo("schedule")
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
}, },
new Container
{
RelativeSizeAxes = Axes.Both,
Padding = new MarginPadding(100) { Bottom = 50 },
Children = new Drawable[]
{
new GridContainer
{
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(),
},
Content = new[]
{
new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new DrawableTournamentTitleText(),
new Container
{
Margin = new MarginPadding { Top = 40 },
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
{
Colour = Color4.White,
Size = new Vector2(50, 10),
},
new TournamentSpriteTextWithBackground("Schedule")
{
X = 60,
Scale = new Vector2(0.8f)
}
}
},
}
},
},
new Drawable[]
{
mainContainer = new Container mainContainer = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
} }
}
}
}
}
},
}; };
currentMatch.BindValueChanged(matchChanged); currentMatch.BindValueChanged(matchChanged);
@ -62,7 +115,7 @@ namespace osu.Game.Tournament.Screens.Schedule
.SelectMany(m => m.ConditionalMatches.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a)))); .SelectMany(m => m.ConditionalMatches.Where(cp => m.Acronyms.TrueForAll(a => cp.Acronyms.Contains(a))));
upcoming = upcoming.Concat(conditionals); upcoming = upcoming.Concat(conditionals);
upcoming = upcoming.OrderBy(p => p.Date.Value).Take(12); upcoming = upcoming.OrderBy(p => p.Date.Value).Take(8);
mainContainer.Child = new FillFlowContainer mainContainer.Child = new FillFlowContainer
{ {
@ -73,7 +126,7 @@ namespace osu.Game.Tournament.Screens.Schedule
new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.65f, Height = 0.74f,
Child = new FillFlowContainer Child = new FillFlowContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -91,7 +144,7 @@ namespace osu.Game.Tournament.Screens.Schedule
.Take(8) .Take(8)
.Select(p => new ScheduleMatch(p)) .Select(p => new ScheduleMatch(p))
}, },
new ScheduleContainer("match overview") new ScheduleContainer("upcoming matches")
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.6f, Width = 0.6f,
@ -100,26 +153,57 @@ namespace osu.Game.Tournament.Screens.Schedule
} }
} }
}, },
new ScheduleContainer("current match") new ScheduleContainer("coming up next")
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.25f, Height = 0.25f,
Children = new Drawable[] Children = new Drawable[]
{ {
new TournamentSpriteText new FillFlowContainer
{ {
Margin = new MarginPadding { Left = -10, Bottom = 10, Top = -5 }, AutoSizeAxes = Axes.Both,
Spacing = new Vector2(10, 0), Direction = FillDirection.Horizontal,
Text = match.NewValue.Round.Value?.Name.Value, Spacing = new Vector2(30),
Colour = Color4.Black, Children = new Drawable[]
Font = OsuFont.Torus.With(size: 20) {
new ScheduleMatch(match.NewValue, false)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
new TournamentSpriteTextWithBackground(match.NewValue.Round.Value?.Name.Value)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Scale = new Vector2(0.5f)
}, },
new ScheduleMatch(match.NewValue, false),
new TournamentSpriteText new TournamentSpriteText
{ {
Text = "Start Time " + match.NewValue.Date.Value.ToUniversalTime().ToString("HH:mm UTC"), Anchor = Anchor.CentreLeft,
Colour = Color4.Black, Origin = Anchor.CentreLeft,
Font = OsuFont.Torus.With(size: 20) Text = match.NewValue.Team1.Value?.FullName + " vs " + match.NewValue.Team2.Value?.FullName,
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold)
},
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Children = new Drawable[]
{
new TournamentSpriteText
{
Text = "Starting ",
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.Regular)
},
new DrawableDate(match.NewValue.Date.Value)
{
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.Regular)
}
}
},
}
}, },
} }
} }
@ -134,6 +218,10 @@ namespace osu.Game.Tournament.Screens.Schedule
{ {
Flow.Direction = FillDirection.Horizontal; Flow.Direction = FillDirection.Horizontal;
Scale = new Vector2(0.8f);
CurrentMatchSelectionBox.Scale = new Vector2(1.02f, 1.15f);
bool conditional = match is ConditionalTournamentMatch; bool conditional = match is ConditionalTournamentMatch;
if (conditional) if (conditional)
@ -145,15 +233,16 @@ namespace osu.Game.Tournament.Screens.Schedule
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopLeft, Origin = Anchor.TopLeft,
Colour = Color4.Black, Colour = OsuColour.Gray(0.7f),
Alpha = conditional ? 0.6f : 1, Alpha = conditional ? 0.6f : 1,
Font = OsuFont.Torus,
Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 },
}); });
AddInternal(new TournamentSpriteText AddInternal(new TournamentSpriteText
{ {
Anchor = Anchor.BottomRight, Anchor = Anchor.BottomRight,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Colour = Color4.Black, Colour = OsuColour.Gray(0.7f),
Alpha = conditional ? 0.6f : 1, Alpha = conditional ? 0.6f : 1,
Margin = new MarginPadding { Horizontal = 10, Vertical = 5 }, Margin = new MarginPadding { Horizontal = 10, Vertical = 5 },
Text = match.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + (conditional ? " (conditional)" : "") Text = match.Date.Value.ToUniversalTime().ToString("HH:mm UTC") + (conditional ? " (conditional)" : "")
@ -170,29 +259,27 @@ namespace osu.Game.Tournament.Screens.Schedule
public ScheduleContainer(string title) public ScheduleContainer(string title)
{ {
Padding = new MarginPadding { Left = 30, Top = 30 }; Padding = new MarginPadding { Left = 60, Top = 10 };
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TournamentSpriteText new FillFlowContainer
{ {
X = 30, RelativeSizeAxes = Axes.Both,
Text = title, Direction = FillDirection.Vertical,
Colour = Color4.Black, Children = new Drawable[]
Spacing = new Vector2(10, 0), {
Font = OsuFont.Torus.With(size: 30) new TournamentSpriteTextWithBackground(title.ToUpperInvariant())
{
Scale = new Vector2(0.5f)
}, },
content = new FillFlowContainer content = new FillFlowContainer
{ {
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Margin = new MarginPadding(40) Margin = new MarginPadding(10)
}, },
new Circle
{
Colour = new Color4(233, 187, 79, 255),
Width = 5,
RelativeSizeAxes = Axes.Y,
} }
},
}; };
} }
} }

View File

@ -34,7 +34,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TourneyVideo(storage.GetStream(@"videos/seeding.m4v")) new TourneyVideo("seeding")
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,

View File

@ -6,7 +6,6 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Graphics;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK; using osuTK;
@ -26,7 +25,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TourneyVideo(storage.GetStream(@"videos/teamintro.m4v")) new TourneyVideo("teamintro")
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
@ -49,141 +48,33 @@ namespace osu.Game.Tournament.Screens.TeamIntro
return; return;
} }
const float y_flag_offset = 292;
const float y_offset = 460;
mainContainer.Children = new Drawable[] mainContainer.Children = new Drawable[]
{ {
new TeamWithPlayers(match.NewValue.Team1.Value, true)
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
Height = 0.6f,
Anchor = Anchor.Centre,
Origin = Anchor.CentreRight
},
new TeamWithPlayers(match.NewValue.Team2.Value)
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
Height = 0.6f,
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft
},
new RoundDisplay(match.NewValue) new RoundDisplay(match.NewValue)
{ {
RelativeSizeAxes = Axes.Both, Position = new Vector2(100, 100)
Height = 0.25f,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Y = 180,
}
};
}
private class RoundDisplay : CompositeDrawable
{
public RoundDisplay(TournamentMatch match)
{
InternalChildren = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
Children = new Drawable[]
{
new TournamentSpriteText
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Colour = OsuColour.Gray(0.33f),
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Font = OsuFont.Torus.With(size: 26, weight: FontWeight.Light)
}, },
} new DrawableTeamFlag(match.NewValue.Team1.Value)
}
};
}
}
private class TeamWithPlayers : CompositeDrawable
{ {
public TeamWithPlayers(TournamentTeam team, bool left = false) Position = new Vector2(165, y_flag_offset),
{
FillFlowContainer players;
var colour = left ? TournamentGame.COLOUR_RED : TournamentGame.COLOUR_BLUE;
InternalChildren = new Drawable[]
{
new TeamDisplay(team)
{
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = Anchor.TopCentre,
RelativePositionAxes = Axes.Both,
X = (left ? -1 : 1) * 0.3145f,
Y = -0.077f,
}, },
players = new FillFlowContainer new DrawableTeamWithPlayers(match.NewValue.Team1.Value, TeamColour.Red)
{ {
Direction = FillDirection.Vertical, Position = new Vector2(165, y_offset),
AutoSizeAxes = Axes.Both, },
Spacing = new Vector2(0, 5), new DrawableTeamFlag(match.NewValue.Team2.Value)
Padding = new MarginPadding(20), {
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft, Position = new Vector2(740, y_flag_offset),
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft, },
RelativePositionAxes = Axes.Both, new DrawableTeamWithPlayers(match.NewValue.Team2.Value, TeamColour.Blue)
X = (left ? -1 : 1) * 0.58f, {
Position = new Vector2(740, y_offset),
}, },
}; };
if (team != null)
{
foreach (var p in team.Players)
{
players.Add(new TournamentSpriteText
{
Text = p.Username,
Font = OsuFont.Torus.With(size: 24),
Colour = colour,
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
});
}
}
}
private class TeamDisplay : DrawableTournamentTeam
{
public TeamDisplay(TournamentTeam team)
: base(team)
{
AutoSizeAxes = Axes.Both;
Flag.Anchor = Flag.Origin = Anchor.TopCentre;
Flag.RelativeSizeAxes = Axes.None;
Flag.Size = new Vector2(300, 200);
Flag.Scale = new Vector2(0.32f);
InternalChild = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(160),
Children = new Drawable[]
{
Flag,
new TournamentSpriteText
{
Text = team?.FullName.Value ?? "???",
Font = OsuFont.Torus.With(size: 20, weight: FontWeight.Regular),
Colour = OsuColour.Gray(0.2f),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
},
}
};
}
}
} }
} }
} }

View File

@ -10,7 +10,6 @@ using osu.Game.Graphics;
using osu.Game.Tournament.Components; using osu.Game.Tournament.Components;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osuTK; using osuTK;
using osuTK.Graphics;
namespace osu.Game.Tournament.Screens.TeamWin namespace osu.Game.Tournament.Screens.TeamWin
{ {
@ -31,13 +30,13 @@ namespace osu.Game.Tournament.Screens.TeamWin
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
blueWinVideo = new TourneyVideo(storage.GetStream(@"videos/teamwin-blue.m4v")) blueWinVideo = new TourneyVideo("teamwin-blue")
{ {
Alpha = 1, Alpha = 1,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Loop = true, Loop = true,
}, },
redWinVideo = new TourneyVideo(storage.GetStream(@"videos/teamwin-red.m4v")) redWinVideo = new TourneyVideo("teamwin-red")
{ {
Alpha = 0, Alpha = 0,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -63,7 +62,9 @@ namespace osu.Game.Tournament.Screens.TeamWin
update(); update();
} }
private void update() private bool firstDisplay = true;
private void update() => Schedule(() =>
{ {
var match = currentMatch.Value; var match = currentMatch.Value;
@ -73,105 +74,53 @@ namespace osu.Game.Tournament.Screens.TeamWin
return; return;
} }
bool redWin = match.Winner == match.Team1.Value; redWinVideo.Alpha = match.WinnerColour == TeamColour.Red ? 1 : 0;
redWinVideo.Alpha = redWin ? 1 : 0; blueWinVideo.Alpha = match.WinnerColour == TeamColour.Blue ? 1 : 0;
blueWinVideo.Alpha = redWin ? 0 : 1;
if (firstDisplay)
{
if (match.WinnerColour == TeamColour.Red)
redWinVideo.Reset();
else
blueWinVideo.Reset();
firstDisplay = false;
}
mainContainer.Children = new Drawable[] mainContainer.Children = new Drawable[]
{ {
new TeamFlagDisplay(match.Winner) new DrawableTeamFlag(match.Winner)
{ {
Size = new Vector2(300, 200), Size = new Vector2(300, 200),
Scale = new Vector2(0.5f), Scale = new Vector2(0.5f),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
X = -387, Position = new Vector2(-300, 10),
}, },
new TournamentSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.TopLeft,
Position = new Vector2(78, -70),
Colour = OsuColour.Gray(0.33f),
Text = match.Round.Value?.Name.Value ?? "Unknown Round",
Font = OsuFont.Torus.With(size: 30, weight: FontWeight.Regular)
},
new TeamWithPlayers(match.Winner, redWin)
{
RelativeSizeAxes = Axes.Both,
Width = 0.5f,
Height = 0.6f,
Anchor = Anchor.Centre,
Origin = Anchor.TopLeft,
Position = new Vector2(78, 0),
},
};
}
private class TeamWithPlayers : CompositeDrawable
{
public TeamWithPlayers(TournamentTeam team, bool left = false)
{
FillFlowContainer players;
var colour = left ? TournamentGame.COLOUR_RED : TournamentGame.COLOUR_BLUE;
InternalChildren = new Drawable[]
{
new FillFlowContainer new FillFlowContainer
{ {
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
X = 260,
Children = new Drawable[] Children = new Drawable[]
{ {
new RoundDisplay(match)
{
Margin = new MarginPadding { Bottom = 30 },
},
new TournamentSpriteText new TournamentSpriteText
{ {
Text = "WINNER", Text = "WINNER",
Font = OsuFont.Torus.With(size: 24, weight: FontWeight.SemiBold), Font = OsuFont.Torus.With(size: 100, weight: FontWeight.Bold),
Colour = Color4.Black, Margin = new MarginPadding { Bottom = 50 },
},
new TournamentSpriteText
{
Text = team?.FullName.Value ?? "???",
Font = OsuFont.Torus.With(size: 30, weight: FontWeight.SemiBold),
Colour = Color4.Black,
},
players = new FillFlowContainer
{
Direction = FillDirection.Vertical,
AutoSizeAxes = Axes.Both,
Padding = new MarginPadding { Top = 10 },
}, },
new DrawableTeamWithPlayers(match.Winner, match.WinnerColour)
} }
}, },
}; };
mainContainer.FadeOut();
if (team != null) mainContainer.Delay(2000).FadeIn(1600, Easing.OutQuint);
{
foreach (var p in team.Players)
{
players.Add(new TournamentSpriteText
{
Text = p.Username,
Font = OsuFont.Torus.With(size: 24),
Colour = colour,
Anchor = left ? Anchor.CentreRight : Anchor.CentreLeft,
Origin = left ? Anchor.CentreRight : Anchor.CentreLeft,
}); });
} }
} }
}
}
private class TeamFlagDisplay : DrawableTournamentTeam
{
public TeamFlagDisplay(TournamentTeam team)
: base(team)
{
InternalChildren = new Drawable[]
{
Flag
};
}
}
}
}

View File

@ -18,6 +18,9 @@ namespace osu.Game.Tournament.Screens
protected TournamentScreen() protected TournamentScreen()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
FillMode = FillMode.Fit;
FillAspectRatio = 16 / 9f;
} }
public override void Hide() => this.FadeOut(FADE_DELAY); public override void Hide() => this.FadeOut(FADE_DELAY);

View File

@ -2,15 +2,25 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Game.Graphics;
using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Cursor;
using osu.Game.Tournament.Models;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Tournament namespace osu.Game.Tournament
{ {
public class TournamentGame : TournamentGameBase public class TournamentGame : TournamentGameBase
{ {
public static readonly Color4 COLOUR_RED = new Color4(144, 0, 0, 255); public static ColourInfo GetTeamColour(TeamColour teamColour) => teamColour == TeamColour.Red ? COLOUR_RED : COLOUR_BLUE;
public static readonly Color4 COLOUR_BLUE = new Color4(0, 84, 144, 255);
public static readonly Color4 COLOUR_RED = OsuColour.FromHex("#AA1414");
public static readonly Color4 COLOUR_BLUE = OsuColour.FromHex("#1462AA");
public static readonly Color4 ELEMENT_BACKGROUND_COLOUR = OsuColour.FromHex("#fff");
public static readonly Color4 ELEMENT_FOREGROUND_COLOUR = OsuColour.FromHex("#000");
public static readonly Color4 TEXT_COLOUR = OsuColour.FromHex("#fff");
protected override void LoadComplete() protected override void LoadComplete()
{ {

View File

@ -22,6 +22,7 @@ using osu.Game.Online.API.Requests;
using osu.Game.Tournament.IPC; using osu.Game.Tournament.IPC;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
using osu.Game.Users; using osu.Game.Users;
using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
using osuTK.Input; using osuTK.Input;
@ -74,17 +75,41 @@ namespace osu.Game.Tournament
AddRange(new[] AddRange(new[]
{ {
new Container
{
CornerRadius = 10,
Depth = float.MinValue,
Position = new Vector2(5),
Masking = true,
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Children = new Drawable[]
{
new Box
{
Colour = OsuColour.Gray(0.2f),
RelativeSizeAxes = Axes.Both,
},
new TourneyButton new TourneyButton
{ {
Text = "Save Changes", Text = "Save Changes",
Width = 140, Width = 140,
Height = 50, Height = 50,
Depth = float.MinValue, Padding = new MarginPadding
Anchor = Anchor.BottomRight, {
Origin = Anchor.BottomRight, Top = 10,
Padding = new MarginPadding(10), Left = 10,
},
Margin = new MarginPadding
{
Right = 10,
Bottom = 10,
},
Action = SaveChanges, Action = SaveChanges,
}, },
}
},
heightWarning = new Container heightWarning = new Container
{ {
Masking = true, Masking = true,

View File

@ -61,7 +61,7 @@ namespace osu.Game.Tournament
//Masking = true, //Masking = true,
Children = new Drawable[] Children = new Drawable[]
{ {
video = new TourneyVideo(storage.GetStream("videos/main.m4v")) video = new TourneyVideo("main", true)
{ {
Loop = true, Loop = true,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -194,9 +194,14 @@ namespace osu.Game.Tournament
switch (currentScreen) switch (currentScreen)
{ {
case GameplayScreen _:
case MapPoolScreen _: case MapPoolScreen _:
chatContainer.FadeIn(TournamentScreen.FADE_DELAY); chatContainer.FadeIn(TournamentScreen.FADE_DELAY);
chatContainer.ResizeWidthTo(1, 500, Easing.OutQuint);
break;
case GameplayScreen _:
chatContainer.FadeIn(TournamentScreen.FADE_DELAY);
chatContainer.ResizeWidthTo(0.5f, 500, Easing.OutQuint);
break; break;
default: default:

View File

@ -3,7 +3,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Globalization;
using System.IO; using System.IO;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -93,8 +92,8 @@ namespace osu.Game.Beatmaps.Formats
var layer = parseLayer(split[1]); var layer = parseLayer(split[1]);
var origin = parseOrigin(split[2]); var origin = parseOrigin(split[2]);
var path = CleanFilename(split[3]); var path = CleanFilename(split[3]);
var x = float.Parse(split[4], NumberFormatInfo.InvariantInfo); var x = Parsing.ParseFloat(split[4], Parsing.MAX_COORDINATE_VALUE);
var y = float.Parse(split[5], NumberFormatInfo.InvariantInfo); var y = Parsing.ParseFloat(split[5], Parsing.MAX_COORDINATE_VALUE);
storyboardSprite = new StoryboardSprite(path, origin, new Vector2(x, y)); storyboardSprite = new StoryboardSprite(path, origin, new Vector2(x, y));
storyboard.GetLayer(layer).Add(storyboardSprite); storyboard.GetLayer(layer).Add(storyboardSprite);
break; break;
@ -105,10 +104,10 @@ namespace osu.Game.Beatmaps.Formats
var layer = parseLayer(split[1]); var layer = parseLayer(split[1]);
var origin = parseOrigin(split[2]); var origin = parseOrigin(split[2]);
var path = CleanFilename(split[3]); var path = CleanFilename(split[3]);
var x = float.Parse(split[4], NumberFormatInfo.InvariantInfo); var x = Parsing.ParseFloat(split[4], Parsing.MAX_COORDINATE_VALUE);
var y = float.Parse(split[5], NumberFormatInfo.InvariantInfo); var y = Parsing.ParseFloat(split[5], Parsing.MAX_COORDINATE_VALUE);
var frameCount = int.Parse(split[6]); var frameCount = Parsing.ParseInt(split[6]);
var frameDelay = double.Parse(split[7], NumberFormatInfo.InvariantInfo); var frameDelay = Parsing.ParseDouble(split[7]);
var loopType = split.Length > 8 ? (AnimationLoopType)Enum.Parse(typeof(AnimationLoopType), split[8]) : AnimationLoopType.LoopForever; var loopType = split.Length > 8 ? (AnimationLoopType)Enum.Parse(typeof(AnimationLoopType), split[8]) : AnimationLoopType.LoopForever;
storyboardSprite = new StoryboardAnimation(path, origin, new Vector2(x, y), frameCount, frameDelay, loopType); storyboardSprite = new StoryboardAnimation(path, origin, new Vector2(x, y), frameCount, frameDelay, loopType);
storyboard.GetLayer(layer).Add(storyboardSprite); storyboard.GetLayer(layer).Add(storyboardSprite);
@ -117,10 +116,10 @@ namespace osu.Game.Beatmaps.Formats
case LegacyEventType.Sample: case LegacyEventType.Sample:
{ {
var time = double.Parse(split[1], CultureInfo.InvariantCulture); var time = Parsing.ParseDouble(split[1]);
var layer = parseLayer(split[2]); var layer = parseLayer(split[2]);
var path = CleanFilename(split[3]); var path = CleanFilename(split[3]);
var volume = split.Length > 4 ? float.Parse(split[4], CultureInfo.InvariantCulture) : 100; var volume = split.Length > 4 ? Parsing.ParseFloat(split[4]) : 100;
storyboard.GetLayer(layer).Add(new StoryboardSampleInfo(path, time, (int)volume)); storyboard.GetLayer(layer).Add(new StoryboardSampleInfo(path, time, (int)volume));
break; break;
} }
@ -138,17 +137,17 @@ namespace osu.Game.Beatmaps.Formats
case "T": case "T":
{ {
var triggerName = split[1]; var triggerName = split[1];
var startTime = split.Length > 2 ? double.Parse(split[2], CultureInfo.InvariantCulture) : double.MinValue; var startTime = split.Length > 2 ? Parsing.ParseDouble(split[2]) : double.MinValue;
var endTime = split.Length > 3 ? double.Parse(split[3], CultureInfo.InvariantCulture) : double.MaxValue; var endTime = split.Length > 3 ? Parsing.ParseDouble(split[3]) : double.MaxValue;
var groupNumber = split.Length > 4 ? int.Parse(split[4]) : 0; var groupNumber = split.Length > 4 ? Parsing.ParseInt(split[4]) : 0;
timelineGroup = storyboardSprite?.AddTrigger(triggerName, startTime, endTime, groupNumber); timelineGroup = storyboardSprite?.AddTrigger(triggerName, startTime, endTime, groupNumber);
break; break;
} }
case "L": case "L":
{ {
var startTime = double.Parse(split[1], CultureInfo.InvariantCulture); var startTime = Parsing.ParseDouble(split[1]);
var loopCount = int.Parse(split[2]); var loopCount = Parsing.ParseInt(split[2]);
timelineGroup = storyboardSprite?.AddLoop(startTime, loopCount); timelineGroup = storyboardSprite?.AddLoop(startTime, loopCount);
break; break;
} }
@ -158,52 +157,52 @@ namespace osu.Game.Beatmaps.Formats
if (string.IsNullOrEmpty(split[3])) if (string.IsNullOrEmpty(split[3]))
split[3] = split[2]; split[3] = split[2];
var easing = (Easing)int.Parse(split[1]); var easing = (Easing)Parsing.ParseInt(split[1]);
var startTime = double.Parse(split[2], CultureInfo.InvariantCulture); var startTime = Parsing.ParseDouble(split[2]);
var endTime = double.Parse(split[3], CultureInfo.InvariantCulture); var endTime = Parsing.ParseDouble(split[3]);
switch (commandType) switch (commandType)
{ {
case "F": case "F":
{ {
var startValue = float.Parse(split[4], CultureInfo.InvariantCulture); var startValue = Parsing.ParseFloat(split[4]);
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue; var endValue = split.Length > 5 ? Parsing.ParseFloat(split[5]) : startValue;
timelineGroup?.Alpha.Add(easing, startTime, endTime, startValue, endValue); timelineGroup?.Alpha.Add(easing, startTime, endTime, startValue, endValue);
break; break;
} }
case "S": case "S":
{ {
var startValue = float.Parse(split[4], CultureInfo.InvariantCulture); var startValue = Parsing.ParseFloat(split[4]);
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue; var endValue = split.Length > 5 ? Parsing.ParseFloat(split[5]) : startValue;
timelineGroup?.Scale.Add(easing, startTime, endTime, startValue, endValue); timelineGroup?.Scale.Add(easing, startTime, endTime, startValue, endValue);
break; break;
} }
case "V": case "V":
{ {
var startX = float.Parse(split[4], CultureInfo.InvariantCulture); var startX = Parsing.ParseFloat(split[4]);
var startY = float.Parse(split[5], CultureInfo.InvariantCulture); var startY = Parsing.ParseFloat(split[5]);
var endX = split.Length > 6 ? float.Parse(split[6], CultureInfo.InvariantCulture) : startX; var endX = split.Length > 6 ? Parsing.ParseFloat(split[6]) : startX;
var endY = split.Length > 7 ? float.Parse(split[7], CultureInfo.InvariantCulture) : startY; var endY = split.Length > 7 ? Parsing.ParseFloat(split[7]) : startY;
timelineGroup?.VectorScale.Add(easing, startTime, endTime, new Vector2(startX, startY), new Vector2(endX, endY)); timelineGroup?.VectorScale.Add(easing, startTime, endTime, new Vector2(startX, startY), new Vector2(endX, endY));
break; break;
} }
case "R": case "R":
{ {
var startValue = float.Parse(split[4], CultureInfo.InvariantCulture); var startValue = Parsing.ParseFloat(split[4]);
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue; var endValue = split.Length > 5 ? Parsing.ParseFloat(split[5]) : startValue;
timelineGroup?.Rotation.Add(easing, startTime, endTime, MathUtils.RadiansToDegrees(startValue), MathUtils.RadiansToDegrees(endValue)); timelineGroup?.Rotation.Add(easing, startTime, endTime, MathUtils.RadiansToDegrees(startValue), MathUtils.RadiansToDegrees(endValue));
break; break;
} }
case "M": case "M":
{ {
var startX = float.Parse(split[4], CultureInfo.InvariantCulture); var startX = Parsing.ParseFloat(split[4]);
var startY = float.Parse(split[5], CultureInfo.InvariantCulture); var startY = Parsing.ParseFloat(split[5]);
var endX = split.Length > 6 ? float.Parse(split[6], CultureInfo.InvariantCulture) : startX; var endX = split.Length > 6 ? Parsing.ParseFloat(split[6]) : startX;
var endY = split.Length > 7 ? float.Parse(split[7], CultureInfo.InvariantCulture) : startY; var endY = split.Length > 7 ? Parsing.ParseFloat(split[7]) : startY;
timelineGroup?.X.Add(easing, startTime, endTime, startX, endX); timelineGroup?.X.Add(easing, startTime, endTime, startX, endX);
timelineGroup?.Y.Add(easing, startTime, endTime, startY, endY); timelineGroup?.Y.Add(easing, startTime, endTime, startY, endY);
break; break;
@ -211,28 +210,28 @@ namespace osu.Game.Beatmaps.Formats
case "MX": case "MX":
{ {
var startValue = float.Parse(split[4], CultureInfo.InvariantCulture); var startValue = Parsing.ParseFloat(split[4]);
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue; var endValue = split.Length > 5 ? Parsing.ParseFloat(split[5]) : startValue;
timelineGroup?.X.Add(easing, startTime, endTime, startValue, endValue); timelineGroup?.X.Add(easing, startTime, endTime, startValue, endValue);
break; break;
} }
case "MY": case "MY":
{ {
var startValue = float.Parse(split[4], CultureInfo.InvariantCulture); var startValue = Parsing.ParseFloat(split[4]);
var endValue = split.Length > 5 ? float.Parse(split[5], CultureInfo.InvariantCulture) : startValue; var endValue = split.Length > 5 ? Parsing.ParseFloat(split[5]) : startValue;
timelineGroup?.Y.Add(easing, startTime, endTime, startValue, endValue); timelineGroup?.Y.Add(easing, startTime, endTime, startValue, endValue);
break; break;
} }
case "C": case "C":
{ {
var startRed = float.Parse(split[4], CultureInfo.InvariantCulture); var startRed = Parsing.ParseFloat(split[4]);
var startGreen = float.Parse(split[5], CultureInfo.InvariantCulture); var startGreen = Parsing.ParseFloat(split[5]);
var startBlue = float.Parse(split[6], CultureInfo.InvariantCulture); var startBlue = Parsing.ParseFloat(split[6]);
var endRed = split.Length > 7 ? float.Parse(split[7], CultureInfo.InvariantCulture) : startRed; var endRed = split.Length > 7 ? Parsing.ParseFloat(split[7]) : startRed;
var endGreen = split.Length > 8 ? float.Parse(split[8], CultureInfo.InvariantCulture) : startGreen; var endGreen = split.Length > 8 ? Parsing.ParseFloat(split[8]) : startGreen;
var endBlue = split.Length > 9 ? float.Parse(split[9], CultureInfo.InvariantCulture) : startBlue; var endBlue = split.Length > 9 ? Parsing.ParseFloat(split[9]) : startBlue;
timelineGroup?.Colour.Add(easing, startTime, endTime, timelineGroup?.Colour.Add(easing, startTime, endTime,
new Color4(startRed / 255f, startGreen / 255f, startBlue / 255f, 1), new Color4(startRed / 255f, startGreen / 255f, startBlue / 255f, 1),
new Color4(endRed / 255f, endGreen / 255f, endBlue / 255f, 1)); new Color4(endRed / 255f, endGreen / 255f, endBlue / 255f, 1));

View File

@ -18,7 +18,11 @@ namespace osu.Game.Graphics.UserInterface
{ {
public class OsuPasswordTextBox : OsuTextBox, ISuppressKeyEventLogging public class OsuPasswordTextBox : OsuTextBox, ISuppressKeyEventLogging
{ {
protected override Drawable GetDrawableCharacter(char c) => new PasswordMaskChar(CalculatedTextSize); protected override Drawable GetDrawableCharacter(char c) => new FallingDownContainer
{
AutoSizeAxes = Axes.Both,
Child = new PasswordMaskChar(CalculatedTextSize),
};
protected override bool AllowClipboardExport => false; protected override bool AllowClipboardExport => false;

View File

@ -63,7 +63,11 @@ namespace osu.Game.Graphics.UserInterface
base.OnFocusLost(e); base.OnFocusLost(e);
} }
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) }; protected override Drawable GetDrawableCharacter(char c) => new FallingDownContainer
{
AutoSizeAxes = Axes.Both,
Child = new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) },
};
protected override Caret CreateCaret() => new OsuCaret protected override Caret CreateCaret() => new OsuCaret
{ {

View File

@ -13,7 +13,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
public class StarCounter : Container public class StarCounter : Container
{ {
private readonly Container<Star> stars; private readonly FillFlowContainer<Star> stars;
/// <summary> /// <summary>
/// Maximum amount of stars displayed. /// Maximum amount of stars displayed.
@ -23,34 +23,29 @@ namespace osu.Game.Graphics.UserInterface
/// </remarks> /// </remarks>
public int StarCount { get; } public int StarCount { get; }
private double animationDelay => 80; /// <summary>
/// The added delay for each subsequent star to be animated.
/// </summary>
protected virtual double AnimationDelay => 80;
private double scalingDuration => 1000;
private Easing scalingEasing => Easing.OutElasticHalf;
private float minStarScale => 0.4f;
private double fadingDuration => 100;
private float minStarAlpha => 0.5f;
private const float star_size = 20;
private const float star_spacing = 4; private const float star_spacing = 4;
private float countStars; private float current;
/// <summary> /// <summary>
/// Amount of stars represented. /// Amount of stars represented.
/// </summary> /// </summary>
public float CountStars public float Current
{ {
get => countStars; get => current;
set set
{ {
if (countStars == value) return; if (current == value) return;
if (IsLoaded) if (IsLoaded)
transformCount(value); animate(value);
countStars = value; current = value;
} }
} }
@ -71,11 +66,13 @@ namespace osu.Game.Graphics.UserInterface
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Spacing = new Vector2(star_spacing), Spacing = new Vector2(star_spacing),
ChildrenEnumerable = Enumerable.Range(0, StarCount).Select(i => new Star { Alpha = minStarAlpha }) ChildrenEnumerable = Enumerable.Range(0, StarCount).Select(i => CreateStar())
} }
}; };
} }
public virtual Star CreateStar() => new DefaultStar();
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();
@ -86,63 +83,60 @@ namespace osu.Game.Graphics.UserInterface
public void ResetCount() public void ResetCount()
{ {
countStars = 0; current = 0;
StopAnimation(); StopAnimation();
} }
public void ReplayAnimation() public void ReplayAnimation()
{ {
var t = countStars; var t = current;
ResetCount(); ResetCount();
CountStars = t; Current = t;
} }
public void StopAnimation() public void StopAnimation()
{ {
int i = 0; animate(current);
foreach (var star in stars.Children) foreach (var star in stars.Children)
{ star.FinishTransforms(true);
star.ClearTransforms(true);
star.FadeTo(i < countStars ? 1.0f : minStarAlpha);
star.Icon.ScaleTo(getStarScale(i, countStars));
i++;
}
} }
private float getStarScale(int i, float value) private float getStarScale(int i, float value) => i + 1 <= value ? 1.0f : Interpolation.ValueAt(value, 0, 1.0f, i, i + 1);
{
if (value <= i)
return minStarScale;
return i + 1 <= value ? 1.0f : Interpolation.ValueAt(value, minStarScale, 1.0f, i, i + 1); private void animate(float newValue)
}
private void transformCount(float newValue)
{ {
int i = 0; for (var i = 0; i < stars.Children.Count; i++)
foreach (var star in stars.Children)
{ {
var star = stars.Children[i];
star.ClearTransforms(true); star.ClearTransforms(true);
var delay = (countStars <= newValue ? Math.Max(i - countStars, 0) : Math.Max(countStars - 1 - i, 0)) * animationDelay; double delay = (current <= newValue ? Math.Max(i - current, 0) : Math.Max(current - 1 - i, 0)) * AnimationDelay;
star.Delay(delay).FadeTo(i < newValue ? 1.0f : minStarAlpha, fadingDuration);
star.Icon.Delay(delay).ScaleTo(getStarScale(i, newValue), scalingDuration, scalingEasing);
i++; using (star.BeginDelayedSequence(delay, true))
star.DisplayAt(getStarScale(i, newValue));
} }
} }
private class Star : Container public class DefaultStar : Star
{ {
private const double scaling_duration = 1000;
private const double fading_duration = 100;
private const Easing scaling_easing = Easing.OutElasticHalf;
private const float min_star_scale = 0.4f;
private const float star_size = 20;
public readonly SpriteIcon Icon; public readonly SpriteIcon Icon;
public Star() public DefaultStar()
{ {
Size = new Vector2(star_size); Size = new Vector2(star_size);
Child = Icon = new SpriteIcon InternalChild = Icon = new SpriteIcon
{ {
Size = new Vector2(star_size), Size = new Vector2(star_size),
Icon = FontAwesome.Solid.Star, Icon = FontAwesome.Solid.Star,
@ -150,6 +144,19 @@ namespace osu.Game.Graphics.UserInterface
Origin = Anchor.Centre, Origin = Anchor.Centre,
}; };
} }
public override void DisplayAt(float scale)
{
scale = Math.Clamp(scale, min_star_scale, 1);
this.FadeTo(scale, fading_duration);
Icon.ScaleTo(scale, scaling_duration, scaling_easing);
}
}
public abstract class Star : CompositeDrawable
{
public abstract void DisplayAt(float scale);
} }
} }
} }

View File

@ -92,18 +92,6 @@ namespace osu.Game.Online.Chat
textbox.Text = string.Empty; textbox.Text = string.Empty;
} }
public void Contract()
{
this.FadeIn(300);
this.MoveToY(0, 500, Easing.OutQuint);
}
public void Expand()
{
this.FadeOut(200);
this.MoveToY(100, 500, Easing.In);
}
protected virtual ChatLine CreateMessage(Message message) => new StandAloneMessage(message); protected virtual ChatLine CreateMessage(Message message) => new StandAloneMessage(message);
private void channelChanged(ValueChangedEvent<Channel> e) private void channelChanged(ValueChangedEvent<Channel> e)

View File

@ -52,22 +52,28 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
highAccuracyColour = colours.GreenLight; highAccuracyColour = colours.GreenLight;
} }
public IReadOnlyList<ScoreInfo> Scores private bool showPerformancePoints;
public void DisplayScores(IReadOnlyList<ScoreInfo> scores, bool showPerformanceColumn)
{ {
set ClearScores();
if (!scores.Any())
return;
showPerformancePoints = showPerformanceColumn;
for (int i = 0; i < scores.Count; i++)
backgroundFlow.Add(new ScoreTableRowBackground(i, scores[i], row_height));
Columns = createHeaders(scores.FirstOrDefault());
Content = scores.Select((s, i) => createContent(i, s)).ToArray().ToRectangular();
}
public void ClearScores()
{ {
Content = null; Content = null;
backgroundFlow.Clear(); backgroundFlow.Clear();
if (value?.Any() != true)
return;
for (int i = 0; i < value.Count; i++)
backgroundFlow.Add(new ScoreTableRowBackground(i, value[i], row_height));
Columns = createHeaders(value[0]);
Content = value.Select((s, i) => createContent(i, s)).ToArray().ToRectangular();
}
} }
private TableColumn[] createHeaders(ScoreInfo score) private TableColumn[] createHeaders(ScoreInfo score)
@ -88,11 +94,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
columns.Add(new TableColumn(score.SortedStatistics.LastOrDefault().Key.GetDescription(), Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 45, maxSize: 95))); columns.Add(new TableColumn(score.SortedStatistics.LastOrDefault().Key.GetDescription(), Anchor.CentreLeft, new Dimension(GridSizeMode.Distributed, minSize: 45, maxSize: 95)));
columns.AddRange(new[] if (showPerformancePoints)
{ columns.Add(new TableColumn("pp", Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, 30)));
new TableColumn("pp", Anchor.CentreLeft, new Dimension(GridSizeMode.Absolute, 30)),
new TableColumn("mods", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)), columns.Add(new TableColumn("mods", Anchor.CentreLeft, new Dimension(GridSizeMode.AutoSize)));
});
return columns.ToArray(); return columns.ToArray();
} }
@ -150,14 +155,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
}); });
} }
content.AddRange(new Drawable[] if (showPerformancePoints)
{ {
new OsuSpriteText content.Add(new OsuSpriteText
{ {
Text = $@"{score.PP:N0}", Text = $@"{score.PP:N0}",
Font = OsuFont.GetFont(size: text_size) Font = OsuFont.GetFont(size: text_size)
}, });
new FillFlowContainer }
content.Add(new FillFlowContainer
{ {
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
@ -167,7 +174,6 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Scale = new Vector2(0.3f) Scale = new Vector2(0.3f)
}) })
},
}); });
return content.ToArray(); return content.ToArray();

View File

@ -52,17 +52,17 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
if (value?.Scores.Any() != true) if (value?.Scores.Any() != true)
{ {
scoreTable.Scores = null; scoreTable.ClearScores();
scoreTable.Hide(); scoreTable.Hide();
return; return;
} }
var scoreInfos = value.Scores.Select(s => s.CreateScoreInfo(rulesets)).ToList(); var scoreInfos = value.Scores.Select(s => s.CreateScoreInfo(rulesets)).ToList();
var topScore = scoreInfos.First();
scoreTable.Scores = scoreInfos; scoreTable.DisplayScores(scoreInfos, topScore.Beatmap?.Status == BeatmapSetOnlineStatus.Ranked);
scoreTable.Show(); scoreTable.Show();
var topScore = scoreInfos.First();
var userScore = value.UserScore; var userScore = value.UserScore;
var userScoreInfo = userScore?.Score.CreateScoreInfo(rulesets); var userScoreInfo = userScore?.Score.CreateScoreInfo(rulesets);

View File

@ -10,6 +10,7 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
@ -96,6 +97,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
totalScoreColumn.Text = $@"{value.TotalScore:N0}"; totalScoreColumn.Text = $@"{value.TotalScore:N0}";
accuracyColumn.Text = value.DisplayAccuracy; accuracyColumn.Text = value.DisplayAccuracy;
maxComboColumn.Text = $@"{value.MaxCombo:N0}x"; maxComboColumn.Text = $@"{value.MaxCombo:N0}x";
ppColumn.Alpha = value.Beatmap?.Status == BeatmapSetOnlineStatus.Ranked ? 1 : 0;
ppColumn.Text = $@"{value.PP:N0}"; ppColumn.Text = $@"{value.PP:N0}";
statisticsColumns.ChildrenEnumerable = value.SortedStatistics.Select(kvp => createStatisticsColumn(kvp.Key, kvp.Value)); statisticsColumns.ChildrenEnumerable = value.SortedStatistics.Select(kvp => createStatisticsColumn(kvp.Key, kvp.Value));

View File

@ -158,7 +158,11 @@ namespace osu.Game.Overlays.Comments
Font = OsuFont.GetFont(weight: FontWeight.Regular), Font = OsuFont.GetFont(weight: FontWeight.Regular),
}; };
protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) }; protected override Drawable GetDrawableCharacter(char c) => new FallingDownContainer
{
AutoSizeAxes = Axes.Both,
Child = new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) },
};
} }
private class CommitButton : LoadingButton private class CommitButton : LoadingButton

View File

@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) private void load(OverlayColourProvider colourProvider)
{ {
AddRangeInternal(new Drawable[] AddRangeInternal(new Drawable[]
{ {
@ -61,7 +61,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
CornerRadius = corner_radius, CornerRadius = corner_radius,
Children = new Drawable[] Children = new Drawable[]
{ {
new ProfileItemContainer new MostPlayedBeatmapContainer
{ {
Child = new Container Child = new Container
{ {
@ -78,11 +78,14 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
Children = new Drawable[] Children = new Drawable[]
{ {
new MostPlayedBeatmapMetadataContainer(beatmap), new MostPlayedBeatmapMetadataContainer(beatmap),
new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular)) new LinkFlowContainer(t =>
{
t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular);
t.Colour = colourProvider.Foreground1;
})
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Colour = colours.GreySeafoamLighter
}.With(d => }.With(d =>
{ {
d.AddText("mapped by "); d.AddText("mapped by ");
@ -105,6 +108,16 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
}); });
} }
private class MostPlayedBeatmapContainer : ProfileItemContainer
{
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
IdleColour = colourProvider.Background4;
HoverColour = colourProvider.Background3;
}
}
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer
{ {
public MostPlayedBeatmapMetadataContainer(BeatmapInfo beatmap) public MostPlayedBeatmapMetadataContainer(BeatmapInfo beatmap)

View File

@ -16,12 +16,33 @@ namespace osu.Game.Overlays.Profile.Sections
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
private Color4 idleColour;
private Color4 hoverColour;
private readonly Box background; private readonly Box background;
private readonly Container content; private readonly Container content;
private Color4 idleColour;
protected Color4 IdleColour
{
get => idleColour;
set
{
idleColour = value;
fadeBackgroundColour();
}
}
private Color4 hoverColour;
protected Color4 HoverColour
{
get => hoverColour;
set
{
hoverColour = value;
fadeBackgroundColour();
}
}
public ProfileItemContainer() public ProfileItemContainer()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
@ -44,20 +65,25 @@ namespace osu.Game.Overlays.Profile.Sections
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider) private void load(OverlayColourProvider colourProvider)
{ {
background.Colour = idleColour = colourProvider.Background3; IdleColour = colourProvider.Background3;
hoverColour = colourProvider.Background2; HoverColour = colourProvider.Background2;
} }
protected override bool OnHover(HoverEvent e) protected override bool OnHover(HoverEvent e)
{ {
background.FadeColour(hoverColour, hover_duration, Easing.OutQuint); fadeBackgroundColour(hover_duration);
return base.OnHover(e); return true;
} }
protected override void OnHoverLost(HoverLostEvent e) protected override void OnHoverLost(HoverLostEvent e)
{ {
base.OnHoverLost(e); base.OnHoverLost(e);
background.FadeColour(idleColour, hover_duration, Easing.OutQuint); fadeBackgroundColour(hover_duration);
}
private void fadeBackgroundColour(double fadeDuration = 0)
{
background.FadeColour(IsHovered ? HoverColour : IdleColour, fadeDuration, Easing.OutQuint);
} }
} }
} }

View File

@ -15,6 +15,8 @@ namespace osu.Game.Rulesets.Mods
public override IconUsage? Icon => OsuIcon.ModPerfect; public override IconUsage? Icon => OsuIcon.ModPerfect;
public override string Description => "SS or quit."; public override string Description => "SS or quit.";
protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result) => result.Type != result.Judgement.MaxResult; protected override bool FailCondition(HealthProcessor healthProcessor, JudgementResult result)
=> !(result.Judgement is IgnoreJudgement)
&& result.Type != result.Judgement.MaxResult;
} }
} }

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
@ -240,7 +241,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
, arrow_move_duration, Easing.Out); , arrow_move_duration, Easing.Out);
} }
private float getRelativeJudgementPosition(double value) => (float)((value / maxHitWindow) + 1) / 2; private float getRelativeJudgementPosition(double value) => Math.Clamp((float)((value / maxHitWindow) + 1) / 2, 0, 1);
private class JudgementLine : CompositeDrawable private class JudgementLine : CompositeDrawable
{ {

View File

@ -184,7 +184,7 @@ namespace osu.Game.Screens.Play
foreach (var mod in Mods.Value.OfType<IApplicableToHealthProcessor>()) foreach (var mod in Mods.Value.OfType<IApplicableToHealthProcessor>())
mod.ApplyToHealthProcessor(HealthProcessor); mod.ApplyToHealthProcessor(HealthProcessor);
BreakOverlay.IsBreakTime.ValueChanged += _ => updatePauseOnFocusLostState(); BreakOverlay.IsBreakTime.BindValueChanged(onBreakTimeChanged, true);
} }
private void addUnderlayComponents(Container target) private void addUnderlayComponents(Container target)
@ -229,7 +229,11 @@ namespace osu.Game.Screens.Play
IsPaused = { BindTarget = GameplayClockContainer.IsPaused } IsPaused = { BindTarget = GameplayClockContainer.IsPaused }
}, },
PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } }, PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } },
KeyCounter = { AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded } }, KeyCounter =
{
AlwaysVisible = { BindTarget = DrawableRuleset.HasReplayLoaded },
IsCounting = false
},
RequestSeek = GameplayClockContainer.Seek, RequestSeek = GameplayClockContainer.Seek,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre Origin = Anchor.Centre
@ -286,6 +290,12 @@ namespace osu.Game.Screens.Play
HealthProcessor.IsBreakTime.BindTo(BreakOverlay.IsBreakTime); HealthProcessor.IsBreakTime.BindTo(BreakOverlay.IsBreakTime);
} }
private void onBreakTimeChanged(ValueChangedEvent<bool> isBreakTime)
{
updatePauseOnFocusLostState();
HUDOverlay.KeyCounter.IsCounting = !isBreakTime.NewValue;
}
private void updatePauseOnFocusLostState() => private void updatePauseOnFocusLostState() =>
HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost HUDOverlay.HoldToQuit.PauseOnFocusLost = PauseOnFocusLost
&& !DrawableRuleset.HasReplayLoaded.Value && !DrawableRuleset.HasReplayLoaded.Value

View File

@ -116,7 +116,7 @@ namespace osu.Game.Screens.Play
{ {
base.Update(); base.Update();
var progress = Math.Max(0, 1 - (gameplayClock.CurrentTime - displayTime) / (fadeOutBeginTime - displayTime)); var progress = fadeOutBeginTime <= displayTime ? 1 : Math.Max(0, 1 - (gameplayClock.CurrentTime - displayTime) / (fadeOutBeginTime - displayTime));
remainingTimeBox.Width = (float)Interpolation.Lerp(remainingTimeBox.Width, progress, Math.Clamp(Time.Elapsed / 40, 0, 1)); remainingTimeBox.Width = (float)Interpolation.Lerp(remainingTimeBox.Width, progress, Math.Clamp(Time.Elapsed / 40, 0, 1));

View File

@ -123,7 +123,7 @@ namespace osu.Game.Screens.Select.Carousel
}, },
starCounter = new StarCounter starCounter = new StarCounter
{ {
CountStars = (float)beatmap.StarDifficulty, Current = (float)beatmap.StarDifficulty,
Scale = new Vector2(0.8f), Scale = new Vector2(0.8f),
} }
} }

View File

@ -0,0 +1,67 @@
// 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.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
namespace osu.Game.Tests.Visual
{
public abstract class ModPerfectTestScene : ModTestScene
{
private readonly Ruleset ruleset;
private readonly ModPerfect mod;
protected ModPerfectTestScene(Ruleset ruleset, ModPerfect mod)
: base(ruleset)
{
this.ruleset = ruleset;
this.mod = mod;
}
protected void CreateHitObjectTest(HitObjectTestData testData, bool shouldMiss) => CreateModTest(new ModTestData
{
Mod = mod,
Beatmap = new Beatmap
{
BeatmapInfo = { Ruleset = ruleset.RulesetInfo },
HitObjects = { testData.HitObject }
},
Autoplay = !shouldMiss,
PassCondition = () => ((PerfectModTestPlayer)Player).CheckFailed(shouldMiss && testData.FailOnMiss)
});
protected override TestPlayer CreateModPlayer(Ruleset ruleset) => new PerfectModTestPlayer();
private class PerfectModTestPlayer : TestPlayer
{
public PerfectModTestPlayer()
: base(showResults: false)
{
}
protected override bool AllowFail => true;
public bool CheckFailed(bool failed)
{
if (!failed)
return ScoreProcessor.HasCompleted && !HealthProcessor.HasFailed;
return HealthProcessor.HasFailed;
}
}
protected class HitObjectTestData
{
public readonly HitObject HitObject;
public readonly bool FailOnMiss;
public HitObjectTestData(HitObject hitObject, bool failOnMiss = true)
{
HitObject = hitObject;
FailOnMiss = failOnMiss;
}
}
}
}

View File

@ -57,9 +57,11 @@ namespace osu.Game.Tests.Visual
SelectedMods.Value = mods; SelectedMods.Value = mods;
return new ModTestPlayer(AllowFail); return CreateModPlayer(ruleset);
} }
protected virtual TestPlayer CreateModPlayer(Ruleset ruleset) => new ModTestPlayer(AllowFail);
protected class ModTestPlayer : TestPlayer protected class ModTestPlayer : TestPlayer
{ {
protected override bool AllowFail { get; } protected override bool AllowFail { get; }

View File

@ -231,15 +231,8 @@ namespace osu.Game.Tests.Visual
{ {
private readonly IFrameBasedClock referenceClock; private readonly IFrameBasedClock referenceClock;
private readonly ManualClock clock = new ManualClock();
private bool running; private bool running;
/// <summary>
/// Local offset added to the reference clock to resolve correct time.
/// </summary>
private double offset;
public TrackVirtualManual(IFrameBasedClock referenceClock) public TrackVirtualManual(IFrameBasedClock referenceClock)
{ {
this.referenceClock = referenceClock; this.referenceClock = referenceClock;
@ -248,10 +241,10 @@ namespace osu.Game.Tests.Visual
public override bool Seek(double seek) public override bool Seek(double seek)
{ {
offset = Math.Clamp(seek, 0, Length); accumulated = Math.Clamp(seek, 0, Length);
lastReferenceTime = null; lastReferenceTime = null;
return offset == seek; return accumulated == seek;
} }
public override void Start() public override void Start()
@ -270,9 +263,6 @@ namespace osu.Game.Tests.Visual
if (running) if (running)
{ {
running = false; running = false;
// on stopping, the current value should be transferred out of the clock, as we can no longer rely on
// the referenceClock (which will still be counting time).
offset = clock.CurrentTime;
lastReferenceTime = null; lastReferenceTime = null;
} }
} }
@ -281,7 +271,9 @@ namespace osu.Game.Tests.Visual
private double? lastReferenceTime; private double? lastReferenceTime;
public override double CurrentTime => clock.CurrentTime; private double accumulated;
public override double CurrentTime => Math.Min(accumulated, Length);
protected override void UpdateState() protected override void UpdateState()
{ {
@ -291,18 +283,12 @@ namespace osu.Game.Tests.Visual
{ {
double refTime = referenceClock.CurrentTime; double refTime = referenceClock.CurrentTime;
if (!lastReferenceTime.HasValue) if (lastReferenceTime.HasValue)
{ accumulated += (refTime - lastReferenceTime.Value) * Rate;
// if the clock just started running, the current value should be transferred to the offset
// (to zero the progression of time).
offset -= refTime;
}
lastReferenceTime = refTime; lastReferenceTime = refTime;
} }
clock.CurrentTime = Math.Min((lastReferenceTime ?? 0) + offset, Length);
if (CurrentTime >= Length) if (CurrentTime >= Length)
{ {
Stop(); Stop();

View File

@ -66,6 +66,7 @@ namespace osu.Game.Tests.Visual
var beatmap = CreateBeatmap(ruleset.RulesetInfo); var beatmap = CreateBeatmap(ruleset.RulesetInfo);
Beatmap.Value = CreateWorkingBeatmap(beatmap); Beatmap.Value = CreateWorkingBeatmap(beatmap);
Ruleset.Value = ruleset.RulesetInfo;
SelectedMods.Value = Array.Empty<Mod>(); SelectedMods.Value = Array.Empty<Mod>();

View File

@ -43,6 +43,8 @@ namespace osu.Game.Users.Drawables
set => base.EdgeEffect = value; set => base.EdgeEffect = value;
} }
protected override double LoadDelay => 200;
/// <summary> /// <summary>
/// Whether to show a default guest representation on null user (as opposed to nothing). /// Whether to show a default guest representation on null user (as opposed to nothing).
/// </summary> /// </summary>

View File

@ -23,7 +23,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.305.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.310.0" />
<PackageReference Include="Sentry" Version="2.1.0" /> <PackageReference Include="Sentry" Version="2.1.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" /> <PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />

View File

@ -71,7 +71,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.304.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.305.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2020.310.0" />
</ItemGroup> </ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. --> <!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
<ItemGroup Label="Transitive Dependencies"> <ItemGroup Label="Transitive Dependencies">
@ -79,7 +79,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.305.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.310.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" /> <PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />