mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Merge branch 'master' into refactor-api
This commit is contained in:
@ -26,7 +26,7 @@
|
|||||||
<ProjectReference Include="..\osu.Game.Rulesets.Mania\osu.Game.Rulesets.Mania.csproj" />
|
<ProjectReference Include="..\osu.Game.Rulesets.Mania\osu.Game.Rulesets.Mania.csproj" />
|
||||||
<ProjectReference Include="..\osu.Game.Rulesets.Taiko\osu.Game.Rulesets.Taiko.csproj" />
|
<ProjectReference Include="..\osu.Game.Rulesets.Taiko\osu.Game.Rulesets.Taiko.csproj" />
|
||||||
<ProjectReference Include="..\osu-resources\osu.Game.Resources\osu.Game.Resources.csproj" />
|
<ProjectReference Include="..\osu-resources\osu.Game.Resources\osu.Game.Resources.csproj" />
|
||||||
<PackageReference Include="Microsoft.Win32.Registry" Version="4.4.0" />
|
<PackageReference Include="Microsoft.Win32.Registry" Version="4.5.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
|
||||||
|
@ -82,56 +82,25 @@ namespace osu.Game.Rulesets.Catch
|
|||||||
{
|
{
|
||||||
new CatchModEasy(),
|
new CatchModEasy(),
|
||||||
new CatchModNoFail(),
|
new CatchModNoFail(),
|
||||||
new MultiMod
|
new MultiMod(new CatchModHalfTime(), new CatchModDaycore())
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new CatchModHalfTime(),
|
|
||||||
new CatchModDaycore(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.DifficultyIncrease:
|
case ModType.DifficultyIncrease:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new CatchModHardRock(),
|
new CatchModHardRock(),
|
||||||
new MultiMod
|
new MultiMod(new CatchModSuddenDeath(), new CatchModPerfect()),
|
||||||
{
|
new MultiMod(new CatchModDoubleTime(), new CatchModNightcore()),
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new CatchModSuddenDeath(),
|
|
||||||
new CatchModPerfect(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new MultiMod
|
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new CatchModDoubleTime(),
|
|
||||||
new CatchModNightcore(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new CatchModHidden(),
|
new CatchModHidden(),
|
||||||
new CatchModFlashlight(),
|
new CatchModFlashlight(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Special:
|
case ModType.Special:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new CatchModRelax(),
|
new CatchModRelax(),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
new MultiMod
|
new MultiMod(new CatchModAutoplay(), new ModCinema()),
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new CatchModAutoplay(),
|
|
||||||
new ModCinema(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return new Mod[] { };
|
return new Mod[] { };
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Difficulty;
|
using osu.Game.Rulesets.Difficulty;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mania.Mods;
|
||||||
using osu.Game.Rulesets.Mania.Objects;
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
@ -141,5 +142,22 @@ namespace osu.Game.Rulesets.Mania.Difficulty
|
|||||||
|
|
||||||
return difficulty;
|
return difficulty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Mod[] DifficultyAdjustmentMods => new Mod[]
|
||||||
|
{
|
||||||
|
new ManiaModDoubleTime(),
|
||||||
|
new ManiaModHalfTime(),
|
||||||
|
new ManiaModEasy(),
|
||||||
|
new ManiaModHardRock(),
|
||||||
|
new ManiaModKey1(),
|
||||||
|
new ManiaModKey2(),
|
||||||
|
new ManiaModKey3(),
|
||||||
|
new ManiaModKey4(),
|
||||||
|
new ManiaModKey5(),
|
||||||
|
new ManiaModKey6(),
|
||||||
|
new ManiaModKey7(),
|
||||||
|
new ManiaModKey8(),
|
||||||
|
new ManiaModKey9(),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,55 +105,21 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
{
|
{
|
||||||
new ManiaModEasy(),
|
new ManiaModEasy(),
|
||||||
new ManiaModNoFail(),
|
new ManiaModNoFail(),
|
||||||
new MultiMod
|
new MultiMod(new ManiaModHalfTime(), new ManiaModDaycore()),
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new ManiaModHalfTime(),
|
|
||||||
new ManiaModDaycore(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.DifficultyIncrease:
|
case ModType.DifficultyIncrease:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new ManiaModHardRock(),
|
new ManiaModHardRock(),
|
||||||
new MultiMod
|
new MultiMod(new ManiaModSuddenDeath(), new ManiaModPerfect()),
|
||||||
{
|
new MultiMod(new ManiaModDoubleTime(), new ManiaModNightcore()),
|
||||||
Mods = new Mod[]
|
new MultiMod(new ManiaModFadeIn(), new ManiaModHidden()),
|
||||||
{
|
|
||||||
new ManiaModSuddenDeath(),
|
|
||||||
new ManiaModPerfect(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new MultiMod
|
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new ManiaModDoubleTime(),
|
|
||||||
new ManiaModNightcore(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new MultiMod
|
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new ManiaModFadeIn(),
|
|
||||||
new ManiaModHidden(),
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new ManiaModFlashlight(),
|
new ManiaModFlashlight(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Special:
|
case ModType.Special:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new MultiMod
|
new MultiMod(new ManiaModKey4(),
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new ManiaModKey4(),
|
|
||||||
new ManiaModKey5(),
|
new ManiaModKey5(),
|
||||||
new ManiaModKey6(),
|
new ManiaModKey6(),
|
||||||
new ManiaModKey7(),
|
new ManiaModKey7(),
|
||||||
@ -161,22 +127,12 @@ namespace osu.Game.Rulesets.Mania
|
|||||||
new ManiaModKey9(),
|
new ManiaModKey9(),
|
||||||
new ManiaModKey1(),
|
new ManiaModKey1(),
|
||||||
new ManiaModKey2(),
|
new ManiaModKey2(),
|
||||||
new ManiaModKey3(),
|
new ManiaModKey3()),
|
||||||
},
|
|
||||||
},
|
|
||||||
new ManiaModRandom(),
|
new ManiaModRandom(),
|
||||||
new ManiaModDualStages(),
|
new ManiaModDualStages(),
|
||||||
new ManiaModMirror(),
|
new ManiaModMirror(),
|
||||||
new MultiMod
|
new MultiMod(new ManiaModAutoplay(), new ModCinema()),
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new ManiaModAutoplay(),
|
|
||||||
new ModCinema(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return new Mod[] { };
|
return new Mod[] { };
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mania.Beatmaps;
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -24,5 +26,18 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
|
|
||||||
mbc.TargetColumns = KeyCount;
|
mbc.TargetColumns = KeyCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override Type[] IncompatibleMods => new[]
|
||||||
|
{
|
||||||
|
typeof(ManiaModKey1),
|
||||||
|
typeof(ManiaModKey2),
|
||||||
|
typeof(ManiaModKey3),
|
||||||
|
typeof(ManiaModKey4),
|
||||||
|
typeof(ManiaModKey5),
|
||||||
|
typeof(ManiaModKey6),
|
||||||
|
typeof(ManiaModKey7),
|
||||||
|
typeof(ManiaModKey8),
|
||||||
|
typeof(ManiaModKey9),
|
||||||
|
}.Except(new[] { GetType() }).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -277,8 +277,13 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
if (action != Action)
|
if (action != Action)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var hitObject = HitObjects.Objects.LastOrDefault(h => h.HitObject.StartTime > Time.Current) ?? HitObjects.Objects.FirstOrDefault();
|
var nextObject =
|
||||||
hitObject?.PlaySamples();
|
HitObjects.AliveObjects.FirstOrDefault(h => h.HitObject.StartTime > Time.Current) ??
|
||||||
|
// fallback to non-alive objects to find next off-screen object
|
||||||
|
HitObjects.Objects.FirstOrDefault(h => h.HitObject.StartTime > Time.Current) ??
|
||||||
|
HitObjects.Objects.LastOrDefault();
|
||||||
|
|
||||||
|
nextObject?.PlaySamples();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using osu.Game.Rulesets.Difficulty;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
|
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
|
||||||
using osu.Game.Rulesets.Osu.Difficulty.Skills;
|
using osu.Game.Rulesets.Osu.Difficulty.Skills;
|
||||||
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Objects;
|
using osu.Game.Rulesets.Osu.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Osu.Difficulty
|
namespace osu.Game.Rulesets.Osu.Difficulty
|
||||||
@ -71,5 +72,13 @@ namespace osu.Game.Rulesets.Osu.Difficulty
|
|||||||
|
|
||||||
return starRating;
|
return starRating;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Mod[] DifficultyAdjustmentMods => new Mod[]
|
||||||
|
{
|
||||||
|
new OsuModDoubleTime(),
|
||||||
|
new OsuModHalfTime(),
|
||||||
|
new OsuModEasy(),
|
||||||
|
new OsuModHardRock(),
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,57 +93,26 @@ namespace osu.Game.Rulesets.Osu
|
|||||||
{
|
{
|
||||||
new OsuModEasy(),
|
new OsuModEasy(),
|
||||||
new OsuModNoFail(),
|
new OsuModNoFail(),
|
||||||
new MultiMod
|
new MultiMod(new OsuModHalfTime(), new OsuModDaycore()),
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new OsuModHalfTime(),
|
|
||||||
new OsuModDaycore(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.DifficultyIncrease:
|
case ModType.DifficultyIncrease:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new OsuModHardRock(),
|
new OsuModHardRock(),
|
||||||
new MultiMod
|
new MultiMod(new OsuModSuddenDeath(), new OsuModPerfect()),
|
||||||
{
|
new MultiMod(new OsuModDoubleTime(), new OsuModNightcore()),
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new OsuModSuddenDeath(),
|
|
||||||
new OsuModPerfect(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new MultiMod
|
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new OsuModDoubleTime(),
|
|
||||||
new OsuModNightcore(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new OsuModHidden(),
|
new OsuModHidden(),
|
||||||
new OsuModFlashlight(),
|
new OsuModFlashlight(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Special:
|
case ModType.Special:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new OsuModRelax(),
|
new OsuModRelax(),
|
||||||
new OsuModAutopilot(),
|
new OsuModAutopilot(),
|
||||||
new OsuModSpunOut(),
|
new OsuModSpunOut(),
|
||||||
new MultiMod
|
new MultiMod(new OsuModAutoplay(), new ModCinema()),
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new OsuModAutoplay(),
|
|
||||||
new ModCinema(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new OsuModTarget(),
|
new OsuModTarget(),
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return new Mod[] { };
|
return new Mod[] { };
|
||||||
}
|
}
|
||||||
|
@ -64,9 +64,7 @@ namespace osu.Game.Rulesets.Osu.UI
|
|||||||
|
|
||||||
public override void PostProcess()
|
public override void PostProcess()
|
||||||
{
|
{
|
||||||
connectionLayer.HitObjects = HitObjects.Objects
|
connectionLayer.HitObjects = HitObjects.Objects.Select(d => d.HitObject).OfType<OsuHitObject>();
|
||||||
.Select(d => d.HitObject)
|
|
||||||
.OrderBy(h => h.StartTime).OfType<OsuHitObject>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
private void onJudgement(DrawableHitObject judgedObject, Judgement judgement)
|
||||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Rulesets.Difficulty;
|
using osu.Game.Rulesets.Difficulty;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.Taiko.Mods;
|
||||||
using osu.Game.Rulesets.Taiko.Objects;
|
using osu.Game.Rulesets.Taiko.Objects;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.Difficulty
|
namespace osu.Game.Rulesets.Taiko.Difficulty
|
||||||
@ -62,6 +63,14 @@ namespace osu.Game.Rulesets.Taiko.Difficulty
|
|||||||
return starRating;
|
return starRating;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Mod[] DifficultyAdjustmentMods => new Mod[]
|
||||||
|
{
|
||||||
|
new TaikoModDoubleTime(),
|
||||||
|
new TaikoModHalfTime(),
|
||||||
|
new TaikoModEasy(),
|
||||||
|
new TaikoModHardRock(),
|
||||||
|
};
|
||||||
|
|
||||||
private bool calculateStrainValues()
|
private bool calculateStrainValues()
|
||||||
{
|
{
|
||||||
// Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment.
|
// Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment.
|
||||||
|
@ -84,56 +84,25 @@ namespace osu.Game.Rulesets.Taiko
|
|||||||
{
|
{
|
||||||
new TaikoModEasy(),
|
new TaikoModEasy(),
|
||||||
new TaikoModNoFail(),
|
new TaikoModNoFail(),
|
||||||
new MultiMod
|
new MultiMod(new TaikoModHalfTime(), new TaikoModDaycore()),
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new TaikoModHalfTime(),
|
|
||||||
new TaikoModDaycore(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.DifficultyIncrease:
|
case ModType.DifficultyIncrease:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new TaikoModHardRock(),
|
new TaikoModHardRock(),
|
||||||
new MultiMod
|
new MultiMod(new TaikoModSuddenDeath(), new TaikoModPerfect()),
|
||||||
{
|
new MultiMod(new TaikoModDoubleTime(), new TaikoModDaycore()),
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new TaikoModSuddenDeath(),
|
|
||||||
new TaikoModPerfect(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new MultiMod
|
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new TaikoModDoubleTime(),
|
|
||||||
new TaikoModNightcore(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new TaikoModHidden(),
|
new TaikoModHidden(),
|
||||||
new TaikoModFlashlight(),
|
new TaikoModFlashlight(),
|
||||||
};
|
};
|
||||||
|
|
||||||
case ModType.Special:
|
case ModType.Special:
|
||||||
return new Mod[]
|
return new Mod[]
|
||||||
{
|
{
|
||||||
new TaikoModRelax(),
|
new TaikoModRelax(),
|
||||||
null,
|
null,
|
||||||
null,
|
null,
|
||||||
new MultiMod
|
new MultiMod(new TaikoModAutoplay(), new ModCinema()),
|
||||||
{
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new TaikoModAutoplay(),
|
|
||||||
new ModCinema(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return new Mod[] { };
|
return new Mod[] { };
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,152 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Game.Rulesets.Difficulty;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.NonVisual
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class DifficultyAdjustmentModCombinationsTest
|
||||||
|
{
|
||||||
|
[Test]
|
||||||
|
public void TestNoMods()
|
||||||
|
{
|
||||||
|
var combinations = new TestDifficultyCalculator().CreateDifficultyAdjustmentModCombinations();
|
||||||
|
|
||||||
|
Assert.AreEqual(1, combinations.Length);
|
||||||
|
Assert.IsTrue(combinations[0] is NoModMod);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestSingleMod()
|
||||||
|
{
|
||||||
|
var combinations = new TestDifficultyCalculator(new ModA()).CreateDifficultyAdjustmentModCombinations();
|
||||||
|
|
||||||
|
Assert.AreEqual(2, combinations.Length);
|
||||||
|
Assert.IsTrue(combinations[0] is NoModMod);
|
||||||
|
Assert.IsTrue(combinations[1] is ModA);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDoubleMod()
|
||||||
|
{
|
||||||
|
var combinations = new TestDifficultyCalculator(new ModA(), new ModB()).CreateDifficultyAdjustmentModCombinations();
|
||||||
|
|
||||||
|
Assert.AreEqual(4, combinations.Length);
|
||||||
|
Assert.IsTrue(combinations[0] is NoModMod);
|
||||||
|
Assert.IsTrue(combinations[1] is ModA);
|
||||||
|
Assert.IsTrue(combinations[2] is MultiMod);
|
||||||
|
Assert.IsTrue(combinations[3] is ModB);
|
||||||
|
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[2]).Mods[0] is ModA);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[2]).Mods[1] is ModB);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestIncompatibleMods()
|
||||||
|
{
|
||||||
|
var combinations = new TestDifficultyCalculator(new ModA(), new ModIncompatibleWithA()).CreateDifficultyAdjustmentModCombinations();
|
||||||
|
|
||||||
|
Assert.AreEqual(3, combinations.Length);
|
||||||
|
Assert.IsTrue(combinations[0] is NoModMod);
|
||||||
|
Assert.IsTrue(combinations[1] is ModA);
|
||||||
|
Assert.IsTrue(combinations[2] is ModIncompatibleWithA);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDoubleIncompatibleMods()
|
||||||
|
{
|
||||||
|
var combinations = new TestDifficultyCalculator(new ModA(), new ModB(), new ModIncompatibleWithA(), new ModIncompatibleWithAAndB()).CreateDifficultyAdjustmentModCombinations();
|
||||||
|
|
||||||
|
Assert.AreEqual(8, combinations.Length);
|
||||||
|
Assert.IsTrue(combinations[0] is NoModMod);
|
||||||
|
Assert.IsTrue(combinations[1] is ModA);
|
||||||
|
Assert.IsTrue(combinations[2] is MultiMod);
|
||||||
|
Assert.IsTrue(combinations[3] is ModB);
|
||||||
|
Assert.IsTrue(combinations[4] is MultiMod);
|
||||||
|
Assert.IsTrue(combinations[5] is ModIncompatibleWithA);
|
||||||
|
Assert.IsTrue(combinations[6] is MultiMod);
|
||||||
|
Assert.IsTrue(combinations[7] is ModIncompatibleWithAAndB);
|
||||||
|
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[2]).Mods[0] is ModA);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[2]).Mods[1] is ModB);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[4]).Mods[0] is ModB);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[4]).Mods[1] is ModIncompatibleWithA);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[6]).Mods[0] is ModIncompatibleWithA);
|
||||||
|
Assert.IsTrue(((MultiMod)combinations[6]).Mods[1] is ModIncompatibleWithAAndB);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestIncompatibleThroughBaseType()
|
||||||
|
{
|
||||||
|
var combinations = new TestDifficultyCalculator(new ModAofA(), new ModIncompatibleWithAofA()).CreateDifficultyAdjustmentModCombinations();
|
||||||
|
|
||||||
|
Assert.AreEqual(3, combinations.Length);
|
||||||
|
Assert.IsTrue(combinations[0] is NoModMod);
|
||||||
|
Assert.IsTrue(combinations[1] is ModAofA);
|
||||||
|
Assert.IsTrue(combinations[2] is ModIncompatibleWithAofA);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ModA : Mod
|
||||||
|
{
|
||||||
|
public override string Name => nameof(ModA);
|
||||||
|
public override string ShortenedName => nameof(ModA);
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
|
||||||
|
public override Type[] IncompatibleMods => new[] { typeof(ModIncompatibleWithA), typeof(ModIncompatibleWithAAndB) };
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ModB : Mod
|
||||||
|
{
|
||||||
|
public override string Name => nameof(ModB);
|
||||||
|
public override string ShortenedName => nameof(ModB);
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
|
||||||
|
public override Type[] IncompatibleMods => new[] { typeof(ModIncompatibleWithAAndB) };
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ModIncompatibleWithA : Mod
|
||||||
|
{
|
||||||
|
public override string Name => $"Incompatible With {nameof(ModA)}";
|
||||||
|
public override string ShortenedName => $"Incompatible With {nameof(ModA)}";
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
|
||||||
|
public override Type[] IncompatibleMods => new[] { typeof(ModA) };
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ModAofA : ModA
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ModIncompatibleWithAofA : ModIncompatibleWithA
|
||||||
|
{
|
||||||
|
// Incompatible through base type
|
||||||
|
}
|
||||||
|
|
||||||
|
private class ModIncompatibleWithAAndB : Mod
|
||||||
|
{
|
||||||
|
public override string Name => $"Incompatible With {nameof(ModA)} and {nameof(ModB)}";
|
||||||
|
public override string ShortenedName => $"Incompatible With {nameof(ModA)} and {nameof(ModB)}";
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
|
||||||
|
public override Type[] IncompatibleMods => new[] { typeof(ModA), typeof(ModB) };
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestDifficultyCalculator : DifficultyCalculator
|
||||||
|
{
|
||||||
|
public TestDifficultyCalculator(params Mod[] mods)
|
||||||
|
: base(null)
|
||||||
|
{
|
||||||
|
DifficultyAdjustmentMods = mods;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override double Calculate(Dictionary<string, double> categoryDifficulty = null) => throw new NotImplementedException();
|
||||||
|
|
||||||
|
protected override Mod[] DifficultyAdjustmentMods { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
84
osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs
Normal file
84
osu.Game/Beatmaps/Drawables/BeatmapSetDownloader.cs
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps.Drawables
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A component to allow downloading of a beatmap set. Automatically handles state syncing between other instances.
|
||||||
|
/// </summary>
|
||||||
|
public class BeatmapSetDownloader : Component
|
||||||
|
{
|
||||||
|
private readonly BeatmapSetInfo set;
|
||||||
|
private readonly bool noVideo;
|
||||||
|
|
||||||
|
private BeatmapManager beatmaps;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the associated beatmap set has been downloading (by this instance or any other instance).
|
||||||
|
/// </summary>
|
||||||
|
public readonly BindableBool Downloaded = new BindableBool();
|
||||||
|
|
||||||
|
public BeatmapSetDownloader(BeatmapSetInfo set, bool noVideo = false)
|
||||||
|
{
|
||||||
|
this.set = set;
|
||||||
|
this.noVideo = noVideo;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(BeatmapManager beatmaps)
|
||||||
|
{
|
||||||
|
this.beatmaps = beatmaps;
|
||||||
|
|
||||||
|
beatmaps.ItemAdded += setAdded;
|
||||||
|
beatmaps.ItemRemoved += setRemoved;
|
||||||
|
|
||||||
|
// initial value
|
||||||
|
if (set.OnlineBeatmapSetID != null)
|
||||||
|
Downloaded.Value = beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID && !s.DeletePending).Any();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
if (beatmaps != null)
|
||||||
|
{
|
||||||
|
beatmaps.ItemAdded -= setAdded;
|
||||||
|
beatmaps.ItemRemoved -= setRemoved;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Begin downloading the associated beatmap set.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>True if downloading began. False if an existing download is active or completed.</returns>
|
||||||
|
public bool Download()
|
||||||
|
{
|
||||||
|
if (Downloaded.Value)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (beatmaps.GetExistingDownload(set) != null)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
beatmaps.Download(set, noVideo);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setAdded(BeatmapSetInfo s)
|
||||||
|
{
|
||||||
|
if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID)
|
||||||
|
Downloaded.Value = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setRemoved(BeatmapSetInfo s)
|
||||||
|
{
|
||||||
|
if (s.OnlineBeatmapSetID == set.OnlineBeatmapSetID)
|
||||||
|
Downloaded.Value = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -5,6 +5,7 @@ using osu.Framework.Configuration;
|
|||||||
using osu.Framework.Configuration.Tracking;
|
using osu.Framework.Configuration.Tracking;
|
||||||
using osu.Framework.Platform;
|
using osu.Framework.Platform;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Select;
|
using osu.Game.Screens.Select;
|
||||||
|
|
||||||
namespace osu.Game.Configuration
|
namespace osu.Game.Configuration
|
||||||
@ -80,6 +81,8 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
Set(OsuSetting.FloatingComments, false);
|
Set(OsuSetting.FloatingComments, false);
|
||||||
|
|
||||||
|
Set(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised);
|
||||||
|
|
||||||
Set(OsuSetting.SpeedChangeVisualisation, SpeedChangeVisualisationMethod.Sequential);
|
Set(OsuSetting.SpeedChangeVisualisation, SpeedChangeVisualisationMethod.Sequential);
|
||||||
|
|
||||||
Set(OsuSetting.IncreaseFirstObjectVisibility, true);
|
Set(OsuSetting.IncreaseFirstObjectVisibility, true);
|
||||||
@ -147,6 +150,7 @@ namespace osu.Game.Configuration
|
|||||||
SongSelectRightMouseScroll,
|
SongSelectRightMouseScroll,
|
||||||
BeatmapSkins,
|
BeatmapSkins,
|
||||||
BeatmapHitsounds,
|
BeatmapHitsounds,
|
||||||
IncreaseFirstObjectVisibility
|
IncreaseFirstObjectVisibility,
|
||||||
|
ScoreDisplayMode
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
@ -11,10 +13,11 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
{
|
{
|
||||||
public class DownloadButton : HeaderButton
|
public class DownloadButton : HeaderButton
|
||||||
{
|
{
|
||||||
public DownloadButton(string title, string subtitle)
|
public DownloadButton(BeatmapSetInfo set, bool noVideo = false)
|
||||||
{
|
{
|
||||||
Width = 120;
|
Width = 120;
|
||||||
|
|
||||||
|
BeatmapSetDownloader downloader;
|
||||||
Add(new Container
|
Add(new Container
|
||||||
{
|
{
|
||||||
Depth = -1,
|
Depth = -1,
|
||||||
@ -22,6 +25,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
Padding = new MarginPadding { Horizontal = 10 },
|
Padding = new MarginPadding { Horizontal = 10 },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
downloader = new BeatmapSetDownloader(set, noVideo),
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.CentreLeft,
|
||||||
@ -32,13 +36,13 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = title,
|
Text = "Download",
|
||||||
TextSize = 13,
|
TextSize = 13,
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = subtitle,
|
Text = set.OnlineInfo.HasVideo && noVideo ? "without Video" : string.Empty,
|
||||||
TextSize = 11,
|
TextSize = 11,
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
},
|
},
|
||||||
@ -54,6 +58,25 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Action = () =>
|
||||||
|
{
|
||||||
|
if (!downloader.Download())
|
||||||
|
{
|
||||||
|
Content.MoveToX(-5, 50, Easing.OutSine).Then()
|
||||||
|
.MoveToX(5, 100, Easing.InOutSine).Then()
|
||||||
|
.MoveToX(-5, 100, Easing.InOutSine).Then()
|
||||||
|
.MoveToX(0, 50, Easing.InSine);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
downloader.Downloaded.ValueChanged += d =>
|
||||||
|
{
|
||||||
|
if (d)
|
||||||
|
this.FadeOut(200);
|
||||||
|
else
|
||||||
|
this.FadeIn(200);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,8 +35,6 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
private readonly BeatmapSetOnlineStatusPill onlineStatusPill;
|
private readonly BeatmapSetOnlineStatusPill onlineStatusPill;
|
||||||
public Details Details;
|
public Details Details;
|
||||||
|
|
||||||
private BeatmapManager beatmaps;
|
|
||||||
|
|
||||||
public readonly BeatmapPicker Picker;
|
public readonly BeatmapPicker Picker;
|
||||||
|
|
||||||
private BeatmapSetInfo beatmapSet;
|
private BeatmapSetInfo beatmapSet;
|
||||||
@ -68,8 +66,24 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
downloadButtonsContainer.FadeIn(transition_duration);
|
downloadButtonsContainer.FadeIn(transition_duration);
|
||||||
favouriteButton.FadeIn(transition_duration);
|
favouriteButton.FadeIn(transition_duration);
|
||||||
|
|
||||||
noVideoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 0 : 1, transition_duration);
|
if (BeatmapSet.OnlineInfo.HasVideo)
|
||||||
videoButtons.FadeTo(BeatmapSet.OnlineInfo.HasVideo ? 1 : 0, transition_duration);
|
{
|
||||||
|
videoButtons.Children = new[]
|
||||||
|
{
|
||||||
|
new DownloadButton(BeatmapSet),
|
||||||
|
new DownloadButton(BeatmapSet, true),
|
||||||
|
};
|
||||||
|
|
||||||
|
videoButtons.FadeIn(transition_duration);
|
||||||
|
noVideoButtons.FadeOut(transition_duration);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
noVideoButtons.Child = new DownloadButton(BeatmapSet);
|
||||||
|
|
||||||
|
noVideoButtons.FadeIn(transition_duration);
|
||||||
|
videoButtons.FadeOut(transition_duration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -192,27 +206,12 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Alpha = 0f,
|
Alpha = 0f,
|
||||||
Child = new DownloadButton("Download", @"")
|
|
||||||
{
|
|
||||||
Action = () => download(false),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
videoButtons = new FillFlowContainer
|
videoButtons = new FillFlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Spacing = new Vector2(buttons_spacing),
|
Spacing = new Vector2(buttons_spacing),
|
||||||
Alpha = 0f,
|
Alpha = 0f,
|
||||||
Children = new[]
|
|
||||||
{
|
|
||||||
new DownloadButton("Download", "with Video")
|
|
||||||
{
|
|
||||||
Action = () => download(false),
|
|
||||||
},
|
|
||||||
new DownloadButton("Download", "without Video")
|
|
||||||
{
|
|
||||||
Action = () => download(true),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -248,41 +247,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, BeatmapManager beatmaps)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
tabsBg.Colour = colours.Gray3;
|
tabsBg.Colour = colours.Gray3;
|
||||||
this.beatmaps = beatmaps;
|
|
||||||
|
|
||||||
beatmaps.ItemAdded += handleBeatmapAdd;
|
|
||||||
|
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
if (beatmaps != null) beatmaps.ItemAdded -= handleBeatmapAdd;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void handleBeatmapAdd(BeatmapSetInfo beatmap) => Schedule(() =>
|
|
||||||
{
|
|
||||||
if (beatmap.OnlineBeatmapSetID == BeatmapSet?.OnlineBeatmapSetID)
|
|
||||||
downloadButtonsContainer.FadeOut(transition_duration);
|
|
||||||
});
|
|
||||||
|
|
||||||
private void download(bool noVideo)
|
|
||||||
{
|
|
||||||
if (beatmaps.GetExistingDownload(BeatmapSet) != null)
|
|
||||||
{
|
|
||||||
downloadButtonsContainer.MoveToX(-5, 50, Easing.OutSine).Then()
|
|
||||||
.MoveToX(5, 100, Easing.InOutSine).Then()
|
|
||||||
.MoveToX(-5, 100, Easing.InOutSine).Then()
|
|
||||||
.MoveToX(0, 50, Easing.InSine).Then();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
beatmaps.Download(BeatmapSet, noVideo);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,14 +166,13 @@ namespace osu.Game.Overlays.Direct
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new DownloadButton
|
new DownloadButton(SetInfo)
|
||||||
{
|
{
|
||||||
Size = new Vector2(30),
|
Size = new Vector2(30),
|
||||||
Margin = new MarginPadding(horizontal_padding),
|
Margin = new MarginPadding(horizontal_padding),
|
||||||
Anchor = Anchor.CentreRight,
|
Anchor = Anchor.CentreRight,
|
||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
Colour = colours.Gray5,
|
Colour = colours.Gray5,
|
||||||
Action = StartDownload
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -12,28 +12,31 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Input;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Direct
|
namespace osu.Game.Overlays.Direct
|
||||||
{
|
{
|
||||||
public class DirectListPanel : DirectPanel
|
public class DirectListPanel : DirectPanel
|
||||||
{
|
{
|
||||||
|
private const float transition_duration = 120;
|
||||||
private const float horizontal_padding = 10;
|
private const float horizontal_padding = 10;
|
||||||
private const float vertical_padding = 5;
|
private const float vertical_padding = 5;
|
||||||
private const float height = 70;
|
private const float height = 70;
|
||||||
|
|
||||||
|
private PlayButton playButton;
|
||||||
|
private Box progressBar;
|
||||||
|
private Container downloadContainer;
|
||||||
|
|
||||||
|
protected override PlayButton PlayButton => playButton;
|
||||||
|
protected override Box PreviewBar => progressBar;
|
||||||
|
|
||||||
public DirectListPanel(BeatmapSetInfo beatmap) : base(beatmap)
|
public DirectListPanel(BeatmapSetInfo beatmap) : base(beatmap)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = height;
|
Height = height;
|
||||||
}
|
}
|
||||||
|
|
||||||
private PlayButton playButton;
|
|
||||||
private Box progressBar;
|
|
||||||
|
|
||||||
protected override PlayButton PlayButton => playButton;
|
|
||||||
protected override Box PreviewBar => progressBar;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(LocalisationEngine localisation, OsuColour colours)
|
private void load(LocalisationEngine localisation, OsuColour colours)
|
||||||
{
|
{
|
||||||
@ -59,7 +62,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
LayoutEasing = Easing.OutQuint,
|
LayoutEasing = Easing.OutQuint,
|
||||||
LayoutDuration = 120,
|
LayoutDuration = transition_duration,
|
||||||
Spacing = new Vector2(10, 0),
|
Spacing = new Vector2(10, 0),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -100,12 +103,33 @@ namespace osu.Game.Overlays.Direct
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
LayoutEasing = Easing.OutQuint,
|
||||||
|
LayoutDuration = transition_duration,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
downloadContainer = new Container
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Alpha = 0,
|
||||||
|
Child = new DownloadButton(SetInfo)
|
||||||
|
{
|
||||||
|
Size = new Vector2(height - vertical_padding * 2),
|
||||||
|
Margin = new MarginPadding { Left = vertical_padding },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
Margin = new MarginPadding { Right = height - vertical_padding * 2 + vertical_padding },
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0)
|
new Statistic(FontAwesome.fa_play_circle, SetInfo.OnlineInfo?.PlayCount ?? 0)
|
||||||
@ -144,12 +168,7 @@ namespace osu.Game.Overlays.Direct
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new DownloadButton
|
},
|
||||||
{
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
Size = new Vector2(height - vertical_padding * 2),
|
|
||||||
Action = StartDownload
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -165,5 +184,17 @@ namespace osu.Game.Overlays.Direct
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state)
|
||||||
|
{
|
||||||
|
downloadContainer.FadeIn(transition_duration, Easing.InOutQuint);
|
||||||
|
return base.OnHover(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(InputState state)
|
||||||
|
{
|
||||||
|
downloadContainer.FadeOut(transition_duration, Easing.InOutQuint);
|
||||||
|
base.OnHoverLost(state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,22 +147,6 @@ namespace osu.Game.Overlays.Direct
|
|||||||
|
|
||||||
protected void ShowInformation() => beatmapSetOverlay?.ShowBeatmapSet(SetInfo);
|
protected void ShowInformation() => beatmapSetOverlay?.ShowBeatmapSet(SetInfo);
|
||||||
|
|
||||||
protected void StartDownload()
|
|
||||||
{
|
|
||||||
if (beatmaps.GetExistingDownload(SetInfo) != null)
|
|
||||||
{
|
|
||||||
// we already have an active download running.
|
|
||||||
content.MoveToX(-5, 50, Easing.OutSine).Then()
|
|
||||||
.MoveToX(5, 100, Easing.InOutSine).Then()
|
|
||||||
.MoveToX(-5, 100, Easing.InOutSine).Then()
|
|
||||||
.MoveToX(0, 50, Easing.InSine).Then();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
beatmaps.Download(SetInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void attachDownload(DownloadBeatmapSetRequest request)
|
private void attachDownload(DownloadBeatmapSetRequest request)
|
||||||
{
|
{
|
||||||
if (request.BeatmapSet.OnlineBeatmapSetID != SetInfo.OnlineBeatmapSetID)
|
if (request.BeatmapSet.OnlineBeatmapSetID != SetInfo.OnlineBeatmapSetID)
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
@ -13,10 +15,12 @@ namespace osu.Game.Overlays.Direct
|
|||||||
{
|
{
|
||||||
private readonly SpriteIcon icon;
|
private readonly SpriteIcon icon;
|
||||||
|
|
||||||
public DownloadButton()
|
public DownloadButton(BeatmapSetInfo set, bool noVideo = false)
|
||||||
{
|
{
|
||||||
|
BeatmapSetDownloader downloader;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
downloader = new BeatmapSetDownloader(set, noVideo),
|
||||||
icon = new SpriteIcon
|
icon = new SpriteIcon
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
@ -25,6 +29,25 @@ namespace osu.Game.Overlays.Direct
|
|||||||
Icon = FontAwesome.fa_osu_chevron_down_o,
|
Icon = FontAwesome.fa_osu_chevron_down_o,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Action = () =>
|
||||||
|
{
|
||||||
|
if (!downloader.Download())
|
||||||
|
{
|
||||||
|
Content.MoveToX(-5, 50, Easing.OutSine).Then()
|
||||||
|
.MoveToX(5, 100, Easing.InOutSine).Then()
|
||||||
|
.MoveToX(-5, 100, Easing.InOutSine).Then()
|
||||||
|
.MoveToX(0, 50, Easing.InSine);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
downloader.Downloaded.ValueChanged += d =>
|
||||||
|
{
|
||||||
|
if (d)
|
||||||
|
this.FadeOut(200);
|
||||||
|
else
|
||||||
|
this.FadeIn(200);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
|
@ -28,7 +28,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private APIAccess api;
|
private APIAccess api;
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
private BeatmapManager beatmaps;
|
|
||||||
|
|
||||||
private readonly FillFlowContainer resultCountsContainer;
|
private readonly FillFlowContainer resultCountsContainer;
|
||||||
private readonly OsuSpriteText resultCountsText;
|
private readonly OsuSpriteText resultCountsText;
|
||||||
@ -177,24 +176,14 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, APIAccess api, RulesetStore rulesets, BeatmapManager beatmaps)
|
private void load(OsuColour colours, APIAccess api, RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
this.api = api;
|
this.api = api;
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
this.beatmaps = beatmaps;
|
|
||||||
|
|
||||||
resultCountsContainer.Colour = colours.Yellow;
|
resultCountsContainer.Colour = colours.Yellow;
|
||||||
|
|
||||||
beatmaps.ItemAdded += setAdded;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setAdded(BeatmapSetInfo set) => Schedule(() =>
|
|
||||||
{
|
|
||||||
// if a new map was imported, we should remove it from search results (download completed etc.)
|
|
||||||
panels?.FirstOrDefault(p => p.SetInfo.OnlineBeatmapSetID == set.OnlineBeatmapSetID)?.FadeOut(400).Expire();
|
|
||||||
BeatmapSets = BeatmapSets?.Where(b => b.OnlineBeatmapSetID != set.OnlineBeatmapSetID);
|
|
||||||
});
|
|
||||||
|
|
||||||
private void updateResultCounts()
|
private void updateResultCounts()
|
||||||
{
|
{
|
||||||
resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, Easing.OutQuint);
|
resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, Easing.OutQuint);
|
||||||
@ -297,9 +286,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
var onlineIds = response.Select(r => r.OnlineBeatmapSetID).ToList();
|
var sets = response.Select(r => r.ToBeatmapSet(rulesets)).ToList();
|
||||||
var presentOnlineIds = beatmaps.QueryBeatmapSets(s => onlineIds.Contains(s.OnlineBeatmapSetID) && !s.DeletePending).Select(r => r.OnlineBeatmapSetID).ToList();
|
|
||||||
var sets = response.Select(r => r.ToBeatmapSet(rulesets)).Where(b => !presentOnlineIds.Contains(b.OnlineBeatmapSetID)).ToList();
|
|
||||||
|
|
||||||
// may not need scheduling; loads async internally.
|
// may not need scheduling; loads async internally.
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
@ -323,14 +310,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private int distinctCount(List<string> list) => list.Distinct().ToArray().Length;
|
private int distinctCount(List<string> list) => list.Distinct().ToArray().Length;
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
|
||||||
{
|
|
||||||
base.Dispose(isDisposing);
|
|
||||||
|
|
||||||
if (beatmaps != null)
|
|
||||||
beatmaps.ItemAdded -= setAdded;
|
|
||||||
}
|
|
||||||
|
|
||||||
public class ResultCounts
|
public class ResultCounts
|
||||||
{
|
{
|
||||||
public readonly int Artists;
|
public readonly int Artists;
|
||||||
|
@ -107,13 +107,20 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
visibleBadge = 0;
|
visibleBadge = 0;
|
||||||
|
|
||||||
badgeFlowContainer.Clear();
|
badgeFlowContainer.Clear();
|
||||||
foreach (var badge in badges)
|
for (var index = 0; index < badges.Length; index++)
|
||||||
{
|
{
|
||||||
LoadComponentAsync(new DrawableBadge(badge)
|
int displayIndex = index;
|
||||||
|
LoadComponentAsync(new DrawableBadge(badges[index])
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
}, badgeFlowContainer.Add);
|
}, asyncBadge =>
|
||||||
|
{
|
||||||
|
badgeFlowContainer.Add(asyncBadge);
|
||||||
|
|
||||||
|
// load in stable order regardless of async load order.
|
||||||
|
badgeFlowContainer.SetLayoutPosition(asyncBadge, displayIndex);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
||||||
{
|
{
|
||||||
@ -38,6 +39,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
|
|||||||
LabelText = "Always show key overlay",
|
LabelText = "Always show key overlay",
|
||||||
Bindable = config.GetBindable<bool>(OsuSetting.KeyOverlay)
|
Bindable = config.GetBindable<bool>(OsuSetting.KeyOverlay)
|
||||||
},
|
},
|
||||||
|
new SettingsEnumDropdown<ScoringMode>
|
||||||
|
{
|
||||||
|
LabelText = "Score display mode",
|
||||||
|
Bindable = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,9 +167,25 @@ namespace osu.Game.Overlays.Volume
|
|||||||
private set => Bindable.Value = value;
|
private set => Bindable.Value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Increase() => Volume += 0.05f;
|
private const float adjust_step = 0.05f;
|
||||||
|
|
||||||
public void Decrease() => Volume -= 0.05f;
|
public void Increase() => adjust(1);
|
||||||
|
public void Decrease() => adjust(-1);
|
||||||
|
|
||||||
|
private void adjust(int direction)
|
||||||
|
{
|
||||||
|
float amount = adjust_step * direction;
|
||||||
|
|
||||||
|
var mouse = GetContainingInputManager().CurrentState.Mouse;
|
||||||
|
if (mouse.HasPreciseScroll)
|
||||||
|
{
|
||||||
|
float scrollDelta = mouse.ScrollDelta.Y;
|
||||||
|
if (scrollDelta != 0)
|
||||||
|
amount *= Math.Abs(scrollDelta / 10);
|
||||||
|
}
|
||||||
|
|
||||||
|
Volume += amount;
|
||||||
|
}
|
||||||
|
|
||||||
public bool OnPressed(GlobalAction action)
|
public bool OnPressed(GlobalAction action)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
@ -36,6 +37,44 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates all <see cref="Mod"/> combinations which adjust the <see cref="Beatmap"/> difficulty.
|
||||||
|
/// </summary>
|
||||||
|
public Mod[] CreateDifficultyAdjustmentModCombinations()
|
||||||
|
{
|
||||||
|
return createDifficultyAdjustmentModCombinations(Enumerable.Empty<Mod>(), DifficultyAdjustmentMods).ToArray();
|
||||||
|
|
||||||
|
IEnumerable<Mod> createDifficultyAdjustmentModCombinations(IEnumerable<Mod> currentSet, Mod[] adjustmentSet, int currentSetCount = 0, int adjustmentSetStart = 0)
|
||||||
|
{
|
||||||
|
// Initial-case: Empty current set
|
||||||
|
if (currentSetCount == 0)
|
||||||
|
yield return new NoModMod();
|
||||||
|
|
||||||
|
if (currentSetCount == 1)
|
||||||
|
yield return currentSet.Single();
|
||||||
|
|
||||||
|
if (currentSetCount > 1)
|
||||||
|
yield return new MultiMod(currentSet.ToArray());
|
||||||
|
|
||||||
|
// Apply mods in the adjustment set recursively. Using the entire adjustment set would result in duplicate multi-mod mod
|
||||||
|
// combinations in further recursions, so a moving subset is used to eliminate this effect
|
||||||
|
for (int i = adjustmentSetStart; i < adjustmentSet.Length; i++)
|
||||||
|
{
|
||||||
|
var adjustmentMod = adjustmentSet[i];
|
||||||
|
if (currentSet.Any(c => c.IncompatibleMods.Any(m => m.IsInstanceOfType(adjustmentMod))))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
foreach (var combo in createDifficultyAdjustmentModCombinations(currentSet.Append(adjustmentMod), adjustmentSet, currentSetCount + 1, i + 1))
|
||||||
|
yield return combo;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves all <see cref="Mod"/>s which adjust the <see cref="Beatmap"/> difficulty.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual Mod[] DifficultyAdjustmentMods => Array.Empty<Mod>();
|
||||||
|
|
||||||
public abstract double Calculate(Dictionary<string, double> categoryDifficulty = null);
|
public abstract double Calculate(Dictionary<string, double> categoryDifficulty = null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,8 +27,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
public virtual void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
public virtual void ApplyToDrawableHitObjects(IEnumerable<DrawableHitObject> drawables)
|
||||||
{
|
{
|
||||||
// todo: fix ordering of objects so we don't have to do this (#2740).
|
foreach (var d in drawables.Skip(IncreaseFirstObjectVisibility ? 1 : 0))
|
||||||
foreach (var d in drawables.Reverse().Skip(IncreaseFirstObjectVisibility ? 1 : 0))
|
|
||||||
d.ApplyCustomUpdateState += ApplyHiddenState;
|
d.ApplyCustomUpdateState += ApplyHiddenState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,6 +7,6 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
DifficultyReduction,
|
DifficultyReduction,
|
||||||
DifficultyIncrease,
|
DifficultyIncrease,
|
||||||
Special,
|
Special
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mods
|
namespace osu.Game.Rulesets.Mods
|
||||||
{
|
{
|
||||||
public class MultiMod : Mod
|
public class MultiMod : Mod
|
||||||
@ -10,6 +13,13 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
public override string Description => string.Empty;
|
public override string Description => string.Empty;
|
||||||
public override double ScoreMultiplier => 0;
|
public override double ScoreMultiplier => 0;
|
||||||
|
|
||||||
public Mod[] Mods;
|
public Mod[] Mods { get; }
|
||||||
|
|
||||||
|
public MultiMod(params Mod[] mods)
|
||||||
|
{
|
||||||
|
Mods = mods;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Type[] IncompatibleMods => Mods.SelectMany(m => m.IncompatibleMods).ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
15
osu.Game/Rulesets/Mods/NoModMod.cs
Normal file
15
osu.Game/Rulesets/Mods/NoModMod.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.Mods
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates a type of mod that doesn't do anything.
|
||||||
|
/// </summary>
|
||||||
|
public sealed class NoModMod : Mod
|
||||||
|
{
|
||||||
|
public override string Name => "No Mod";
|
||||||
|
public override string ShortenedName => "NM";
|
||||||
|
public override double ScoreMultiplier => 1;
|
||||||
|
}
|
||||||
|
}
|
@ -65,6 +65,11 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly BindableInt HighestCombo = new BindableInt();
|
public readonly BindableInt HighestCombo = new BindableInt();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The <see cref="ScoringMode"/> used to calculate scores.
|
||||||
|
/// </summary>
|
||||||
|
public readonly Bindable<ScoringMode> Mode = new Bindable<ScoringMode>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether all <see cref="Judgement"/>s have been processed.
|
/// Whether all <see cref="Judgement"/>s have been processed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -169,8 +174,6 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
private const double combo_portion = 0.7;
|
private const double combo_portion = 0.7;
|
||||||
private const double max_score = 1000000;
|
private const double max_score = 1000000;
|
||||||
|
|
||||||
public readonly Bindable<ScoringMode> Mode = new Bindable<ScoringMode>();
|
|
||||||
|
|
||||||
protected sealed override bool HasCompleted => JudgedHits == MaxHits;
|
protected sealed override bool HasCompleted => JudgedHits == MaxHits;
|
||||||
|
|
||||||
protected int MaxHits { get; private set; }
|
protected int MaxHits { get; private set; }
|
||||||
@ -199,16 +202,18 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
|
|
||||||
if (maxBaseScore == 0 || maxHighestCombo == 0)
|
if (maxBaseScore == 0 || maxHighestCombo == 0)
|
||||||
{
|
{
|
||||||
Mode.Value = ScoringMode.Exponential;
|
Mode.Value = ScoringMode.Classic;
|
||||||
Mode.Disabled = true;
|
Mode.Disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Mode.ValueChanged += _ => updateScore();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Simulates an autoplay of <see cref="HitObject"/>s that will be judged by this <see cref="ScoreProcessor{TObject}"/>
|
/// Simulates an autoplay of <see cref="HitObject"/>s that will be judged by this <see cref="ScoreProcessor{TObject}"/>
|
||||||
/// by adding <see cref="Judgement"/>s for each <see cref="HitObject"/> in the <see cref="Beatmap{TObject}"/>.
|
/// by adding <see cref="Judgement"/>s for each <see cref="HitObject"/> in the <see cref="Beatmap{TObject}"/>.
|
||||||
/// <para>
|
/// <para>
|
||||||
/// This is required for <see cref="ScoringMode.Standardised"/> to work, otherwise <see cref="ScoringMode.Exponential"/> will be used.
|
/// This is required for <see cref="ScoringMode.Standardised"/> to work, otherwise <see cref="ScoringMode.Classic"/> will be used.
|
||||||
/// </para>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="beatmap">The <see cref="Beatmap{TObject}"/> containing the <see cref="HitObject"/>s that will be judged by this <see cref="ScoreProcessor{TObject}"/>.</param>
|
/// <param name="beatmap">The <see cref="Beatmap{TObject}"/> containing the <see cref="HitObject"/>s that will be judged by this <see cref="ScoreProcessor{TObject}"/>.</param>
|
||||||
@ -295,8 +300,9 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
case ScoringMode.Standardised:
|
case ScoringMode.Standardised:
|
||||||
TotalScore.Value = max_score * (base_portion * baseScore / maxBaseScore + combo_portion * HighestCombo / maxHighestCombo) + bonusScore;
|
TotalScore.Value = max_score * (base_portion * baseScore / maxBaseScore + combo_portion * HighestCombo / maxHighestCombo) + bonusScore;
|
||||||
break;
|
break;
|
||||||
case ScoringMode.Exponential:
|
case ScoringMode.Classic:
|
||||||
TotalScore.Value = (baseScore + bonusScore) * Math.Log(HighestCombo + 1, 2);
|
// should emulate osu-stable's scoring as closely as we can (https://osu.ppy.sh/help/wiki/Score/ScoreV1)
|
||||||
|
TotalScore.Value = bonusScore + baseScore * (1 + Math.Max(0, HighestCombo - 1) / 25);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -322,6 +328,6 @@ namespace osu.Game.Rulesets.Scoring
|
|||||||
public enum ScoringMode
|
public enum ScoringMode
|
||||||
{
|
{
|
||||||
Standardised,
|
Standardised,
|
||||||
Exponential
|
Classic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
{
|
{
|
||||||
public class HitObjectContainer : CompositeDrawable
|
public class HitObjectContainer : CompositeDrawable
|
||||||
{
|
{
|
||||||
public virtual IEnumerable<DrawableHitObject> Objects => InternalChildren.Cast<DrawableHitObject>();
|
public IEnumerable<DrawableHitObject> Objects => InternalChildren.Cast<DrawableHitObject>().OrderBy(h => h.HitObject.StartTime);
|
||||||
public virtual IEnumerable<DrawableHitObject> AliveObjects => AliveInternalChildren.Cast<DrawableHitObject>();
|
public IEnumerable<DrawableHitObject> AliveObjects => AliveInternalChildren.Cast<DrawableHitObject>().OrderBy(h => h.HitObject.StartTime);
|
||||||
|
|
||||||
public virtual void Add(DrawableHitObject hitObject) => AddInternal(hitObject);
|
public virtual void Add(DrawableHitObject hitObject) => AddInternal(hitObject);
|
||||||
public virtual bool Remove(DrawableHitObject hitObject) => RemoveInternal(hitObject);
|
public virtual bool Remove(DrawableHitObject hitObject) => RemoveInternal(hitObject);
|
||||||
|
@ -121,6 +121,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private bool validState;
|
private bool validState;
|
||||||
|
|
||||||
|
protected override bool RequiresChildrenUpdate => base.RequiresChildrenUpdate && validState;
|
||||||
|
|
||||||
private bool isAttached => replayInputHandler != null && !UseParentState;
|
private bool isAttached => replayInputHandler != null && !UseParentState;
|
||||||
|
|
||||||
private const int max_catch_up_updates_per_frame = 50;
|
private const int max_catch_up_updates_per_frame = 50;
|
||||||
|
@ -158,6 +158,7 @@ namespace osu.Game.Screens.Play
|
|||||||
userAudioOffset.TriggerChange();
|
userAudioOffset.TriggerChange();
|
||||||
|
|
||||||
ScoreProcessor = RulesetContainer.CreateScoreProcessor();
|
ScoreProcessor = RulesetContainer.CreateScoreProcessor();
|
||||||
|
config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -17,8 +17,8 @@
|
|||||||
<PackageReference Include="Humanizer" Version="2.2.0" />
|
<PackageReference Include="Humanizer" Version="2.2.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2018.607.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2018.608.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.18.1" />
|
<PackageReference Include="SharpCompress" Version="0.18.1" />
|
||||||
<PackageReference Include="NUnit" Version="3.10.1" />
|
<PackageReference Include="NUnit" Version="3.10.1" />
|
||||||
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
|
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<ItemGroup Label="Package References">
|
<ItemGroup Label="Package References">
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.0" />
|
||||||
<PackageReference Include="DeepEqual" Version="1.6.0" />
|
<PackageReference Include="DeepEqual" Version="1.6.0" />
|
||||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.6.1" />
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.7.2" />
|
||||||
<PackageReference Include="NUnit" Version="3.10.1" />
|
<PackageReference Include="NUnit" Version="3.10.1" />
|
||||||
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
|
<PackageReference Include="NUnit3TestAdapter" Version="3.10.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
Reference in New Issue
Block a user