mirror of
https://github.com/ppy/osu.git
synced 2026-05-15 11:23:04 +08:00
Compare commits
146 Commits
+1
-1
Submodule osu-framework updated: 5dbb4a5134...798409058a
+1
-1
Submodule osu-resources updated: 51f2b9b37f...93eb5bf99b
@@ -74,7 +74,7 @@ namespace osu.Desktop.Deploy
|
||||
refreshDirectory(StagingFolder);
|
||||
|
||||
//increment build number until we have a unique one.
|
||||
string verBase = DateTime.Now.ToString("yyyy.Md.");
|
||||
string verBase = DateTime.Now.ToString("yyyy.Mdd.");
|
||||
int increment = 0;
|
||||
while (Directory.GetFiles(ReleasesFolder, $"*{verBase}{increment}*").Any())
|
||||
increment++;
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Screens.Testing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Screens.Select.Options;
|
||||
|
||||
namespace osu.Desktop.VisualTests
|
||||
{
|
||||
class TestCaseBeatmapOptionsOverlay : TestCase
|
||||
{
|
||||
public override string Name => @"Beatmap Options";
|
||||
public override string Description => @"Beatmap options in song select";
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
var overlay = new BeatmapOptionsOverlay();
|
||||
|
||||
Add(overlay);
|
||||
|
||||
AddButton(@"Toggle", overlay.ToggleVisibility);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Framework.Screens.Testing;
|
||||
using osu.Game.Screens.Tournament;
|
||||
using osu.Game.Screens.Tournament.Teams;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
class TestCaseDrawings : TestCase
|
||||
{
|
||||
public override string Name => @"Drawings";
|
||||
public override string Description => "Tournament drawings";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(Storage storage)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
Add(new Drawings
|
||||
{
|
||||
TeamList = new TestTeamList(),
|
||||
});
|
||||
}
|
||||
|
||||
class TestTeamList : ITeamList
|
||||
{
|
||||
public IEnumerable<Team> Teams { get; } = new[]
|
||||
{
|
||||
new Team
|
||||
{
|
||||
FlagName = "GB",
|
||||
FullName = "United Kingdom",
|
||||
Acronym = "UK"
|
||||
},
|
||||
new Team
|
||||
{
|
||||
FlagName = "FR",
|
||||
FullName = "France",
|
||||
Acronym = "FRA"
|
||||
},
|
||||
new Team
|
||||
{
|
||||
FlagName = "CN",
|
||||
FullName = "China",
|
||||
Acronym = "CHN"
|
||||
},
|
||||
new Team
|
||||
{
|
||||
FlagName = "AU",
|
||||
FullName = "Australia",
|
||||
Acronym = "AUS"
|
||||
},
|
||||
new Team
|
||||
{
|
||||
FlagName = "JP",
|
||||
FullName = "Japan",
|
||||
Acronym = "JPN"
|
||||
},
|
||||
new Team
|
||||
{
|
||||
FlagName = "RO",
|
||||
FullName = "Romania",
|
||||
Acronym = "ROM"
|
||||
},
|
||||
new Team
|
||||
{
|
||||
FlagName = "IT",
|
||||
FullName = "Italy",
|
||||
Acronym = "PIZZA"
|
||||
},
|
||||
new Team
|
||||
{
|
||||
FlagName = "VE",
|
||||
FullName = "Venezuela",
|
||||
Acronym = "VNZ"
|
||||
},
|
||||
new Team
|
||||
{
|
||||
FlagName = "US",
|
||||
FullName = "United States of America",
|
||||
Acronym = "USA"
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Framework.Screens.Testing;
|
||||
using osu.Game.Modes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
class TestCaseModSelectOverlay : TestCase
|
||||
{
|
||||
public override string Name => @"Mod Select";
|
||||
|
||||
public override string Description => @"Tests the mod select overlay";
|
||||
|
||||
private ModSelectOverlay modSelect;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
Add(modSelect = new ModSelectOverlay
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
});
|
||||
|
||||
AddButton("Toggle", modSelect.ToggleVisibility);
|
||||
AddButton("osu!", () => modSelect.PlayMode.Value = PlayMode.Osu);
|
||||
AddButton("osu!taiko", () => modSelect.PlayMode.Value = PlayMode.Taiko);
|
||||
AddButton("osu!catch", () => modSelect.PlayMode.Value = PlayMode.Catch);
|
||||
AddButton("osu!mania", () => modSelect.PlayMode.Value = PlayMode.Mania);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Overlays.Pause;
|
||||
using osu.Framework.Screens.Testing;
|
||||
using osu.Game.Screens.Play;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
|
||||
@@ -179,6 +179,7 @@
|
||||
<Compile Include="Benchmark.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Tests\TestCaseChatDisplay.cs" />
|
||||
<Compile Include="Tests\TestCaseDrawings.cs" />
|
||||
<Compile Include="Tests\TestCaseGamefield.cs" />
|
||||
<Compile Include="Tests\TestCaseMusicController.cs" />
|
||||
<Compile Include="Tests\TestCaseNotificationManager.cs" />
|
||||
@@ -194,7 +195,9 @@
|
||||
<Compile Include="Platform\TestStorage.cs" />
|
||||
<Compile Include="Tests\TestCaseOptions.cs" />
|
||||
<Compile Include="Tests\TestCasePauseOverlay.cs" />
|
||||
<Compile Include="Tests\TestCaseModSelectOverlay.cs" />
|
||||
<Compile Include="Tests\TestCaseDialogOverlay.cs" />
|
||||
<Compile Include="Tests\TestCaseBeatmapOptionsOverlay.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup />
|
||||
|
||||
@@ -18,6 +18,7 @@ using osu.Game.Graphics;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using System.Net.Http;
|
||||
using osu.Framework.Logging;
|
||||
|
||||
namespace osu.Desktop.Overlays
|
||||
{
|
||||
@@ -159,15 +160,21 @@ namespace osu.Desktop.Overlays
|
||||
|
||||
Schedule(() => notification.State = ProgressNotificationState.Completed);
|
||||
}
|
||||
catch (Exception)
|
||||
catch (Exception e)
|
||||
{
|
||||
if (useDeltaPatching)
|
||||
{
|
||||
Logger.Error(e, @"delta patching failed!");
|
||||
|
||||
//could fail if deltas are unavailable for full update path (https://github.com/Squirrel/Squirrel.Windows/issues/959)
|
||||
//try again without deltas.
|
||||
checkForUpdateAsync(false, notification);
|
||||
scheduleRetry = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Logger.Error(e, @"update failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (HttpRequestException)
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Modes.Catch
|
||||
{
|
||||
public class CatchModNoFail : ModNoFail
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class CatchModEasy : ModEasy
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class CatchModHidden : ModHidden
|
||||
{
|
||||
public override string Description => @"Play with no approach circles and fading notes for a slight score advantage.";
|
||||
public override double ScoreMultiplier => 1.06;
|
||||
public override Mods[] DisablesMods => new Mods[] { };
|
||||
}
|
||||
|
||||
public class CatchModHardRock : ModHardRock
|
||||
{
|
||||
public override double ScoreMultiplier => 1.12;
|
||||
public override bool Ranked => true;
|
||||
}
|
||||
|
||||
public class CatchModSuddenDeath : ModSuddenDeath
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class CatchModDoubleTime : ModDoubleTime
|
||||
{
|
||||
public override double ScoreMultiplier => 1.06;
|
||||
}
|
||||
|
||||
public class CatchModRelax : ModRelax
|
||||
{
|
||||
public override string Description => @"Use the mouse to control the catcher.";
|
||||
}
|
||||
|
||||
public class CatchModHalfTime : ModHalfTime
|
||||
{
|
||||
public override double ScoreMultiplier => 0.5;
|
||||
}
|
||||
|
||||
public class CatchModNightcore : ModNightcore
|
||||
{
|
||||
public override double ScoreMultiplier => 1.06;
|
||||
}
|
||||
|
||||
public class CatchModFlashlight : ModFlashlight
|
||||
{
|
||||
public override double ScoreMultiplier => 1.12;
|
||||
public override Mods[] DisablesMods => new Mods[] { };
|
||||
}
|
||||
|
||||
public class CatchModPerfect : ModPerfect
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Catch.UI;
|
||||
using osu.Game.Modes.Objects;
|
||||
@@ -16,6 +17,61 @@ namespace osu.Game.Modes.Catch
|
||||
|
||||
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new CatchHitRenderer { Beatmap = beatmap };
|
||||
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ModType.DifficultyReduction:
|
||||
return new Mod[]
|
||||
{
|
||||
new CatchModEasy(),
|
||||
new CatchModNoFail(),
|
||||
new CatchModHalfTime(),
|
||||
};
|
||||
|
||||
case ModType.DifficultyIncrease:
|
||||
return new Mod[]
|
||||
{
|
||||
new CatchModHardRock(),
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new CatchModSuddenDeath(),
|
||||
new CatchModPerfect(),
|
||||
},
|
||||
},
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new CatchModDoubleTime(),
|
||||
new CatchModNightcore(),
|
||||
},
|
||||
},
|
||||
new CatchModHidden(),
|
||||
new CatchModFlashlight(),
|
||||
};
|
||||
|
||||
case ModType.Special:
|
||||
return new Mod[]
|
||||
{
|
||||
new CatchModRelax(),
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new ModAutoplay(),
|
||||
new ModCinema(),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
default:
|
||||
return new Mod[] { };
|
||||
}
|
||||
}
|
||||
|
||||
protected override PlayMode PlayMode => PlayMode.Catch;
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_fruits_o;
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<Compile Include="UI\CatchHitRenderer.cs" />
|
||||
<Compile Include="UI\CatchPlayfield.cs" />
|
||||
<Compile Include="CatchRuleset.cs" />
|
||||
<Compile Include="CatchMod.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\osu.licenseheader">
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Mania
|
||||
{
|
||||
public class ManiaModNoFail : ModNoFail
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class ManiaModEasy : ModEasy
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class ManiaModHidden : ModHidden
|
||||
{
|
||||
public override string Description => @"The notes fade out before you hit them!";
|
||||
public override double ScoreMultiplier => 1.0;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.Flashlight };
|
||||
}
|
||||
|
||||
public class ManiaModHardRock : ModHardRock
|
||||
{
|
||||
public override double ScoreMultiplier => 1.0;
|
||||
public override bool Ranked => false;
|
||||
}
|
||||
|
||||
public class ManiaModSuddenDeath : ModSuddenDeath
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class ManiaModDoubleTime : ModDoubleTime
|
||||
{
|
||||
public override double ScoreMultiplier => 1.0;
|
||||
}
|
||||
|
||||
public class ManiaModHalfTime : ModHalfTime
|
||||
{
|
||||
public override double ScoreMultiplier => 0.3;
|
||||
}
|
||||
|
||||
public class ManiaModNightcore : ModNightcore
|
||||
{
|
||||
public override double ScoreMultiplier => 1.0;
|
||||
}
|
||||
|
||||
public class ManiaModFlashlight : ModFlashlight
|
||||
{
|
||||
public override double ScoreMultiplier => 1.0;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.Hidden };
|
||||
}
|
||||
|
||||
public class ManiaModPerfect : ModPerfect
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class ManiaModFadeIn : Mod
|
||||
{
|
||||
public override Mods Name => Mods.FadeIn;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
||||
public override string Description => @"";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override bool Ranked => true;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.Flashlight };
|
||||
}
|
||||
|
||||
public class ManiaModRandom : Mod
|
||||
{
|
||||
public override Mods Name => Mods.Random;
|
||||
public override FontAwesome Icon => FontAwesome.fa_close;
|
||||
public override string Description => @"Shuffle around the notes!";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override bool Ranked => false;
|
||||
public override Mods[] DisablesMods => new Mods[] { };
|
||||
}
|
||||
|
||||
public abstract class ManiaKeyMod : Mod
|
||||
{
|
||||
public abstract int KeyCount { get; }
|
||||
public override FontAwesome Icon => FontAwesome.fa_close; // TODO: Add proper key icons
|
||||
public override string Description => @"";
|
||||
public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier
|
||||
public override bool Ranked => true;
|
||||
public override Mods[] DisablesMods => new Mods[] { };
|
||||
}
|
||||
|
||||
public class ManiaModKey1 : ManiaKeyMod
|
||||
{
|
||||
public override int KeyCount => 1;
|
||||
public override Mods Name => Mods.Key1;
|
||||
}
|
||||
|
||||
public class ManiaModKey2 : ManiaKeyMod
|
||||
{
|
||||
public override int KeyCount => 2;
|
||||
public override Mods Name => Mods.Key2;
|
||||
}
|
||||
|
||||
public class ManiaModKey3 : ManiaKeyMod
|
||||
{
|
||||
public override int KeyCount => 3;
|
||||
public override Mods Name => Mods.Key3;
|
||||
}
|
||||
|
||||
public class ManiaModKey4 : ManiaKeyMod
|
||||
{
|
||||
public override int KeyCount => 4;
|
||||
public override Mods Name => Mods.Key4;
|
||||
}
|
||||
|
||||
public class ManiaModKey5 : ManiaKeyMod
|
||||
{
|
||||
public override int KeyCount => 5;
|
||||
public override Mods Name => Mods.Key5;
|
||||
}
|
||||
|
||||
public class ManiaModKey6 : ManiaKeyMod
|
||||
{
|
||||
public override int KeyCount => 6;
|
||||
public override Mods Name => Mods.Key6;
|
||||
}
|
||||
|
||||
public class ManiaModKey7 : ManiaKeyMod
|
||||
{
|
||||
public override int KeyCount => 7;
|
||||
public override Mods Name => Mods.Key7;
|
||||
}
|
||||
|
||||
public class ManiaModKey8 : ManiaKeyMod
|
||||
{
|
||||
public override int KeyCount => 8;
|
||||
public override Mods Name => Mods.Key8;
|
||||
}
|
||||
|
||||
public class ManiaModKey9 : ManiaKeyMod
|
||||
{
|
||||
public override int KeyCount => 9;
|
||||
public override Mods Name => Mods.Key9;
|
||||
}
|
||||
|
||||
public class ManiaModKeyCoop : Mod
|
||||
{
|
||||
public override Mods Name => Mods.KeyCoop;
|
||||
public override FontAwesome Icon => FontAwesome.fa_close;
|
||||
public override string Description => @"Double the key amount, double the fun!";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override bool Ranked => true;
|
||||
public override Mods[] DisablesMods => new Mods[] { };
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Mania.UI;
|
||||
using osu.Game.Modes.Objects;
|
||||
@@ -16,6 +17,77 @@ namespace osu.Game.Modes.Mania
|
||||
|
||||
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new ManiaHitRenderer { Beatmap = beatmap };
|
||||
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ModType.DifficultyReduction:
|
||||
return new Mod[]
|
||||
{
|
||||
new ManiaModEasy(),
|
||||
new ManiaModNoFail(),
|
||||
new ManiaModHalfTime(),
|
||||
};
|
||||
|
||||
case ModType.DifficultyIncrease:
|
||||
return new Mod[]
|
||||
{
|
||||
new ManiaModHardRock(),
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new ManiaModSuddenDeath(),
|
||||
new ManiaModPerfect(),
|
||||
},
|
||||
},
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new ManiaModDoubleTime(),
|
||||
new ManiaModNightcore(),
|
||||
},
|
||||
},
|
||||
new ManiaModHidden(),
|
||||
new ManiaModFlashlight(),
|
||||
};
|
||||
|
||||
case ModType.Special:
|
||||
return new Mod[]
|
||||
{
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new ManiaModKey4(),
|
||||
new ManiaModKey5(),
|
||||
new ManiaModKey6(),
|
||||
new ManiaModKey7(),
|
||||
new ManiaModKey8(),
|
||||
new ManiaModKey9(),
|
||||
new ManiaModKey1(),
|
||||
new ManiaModKey2(),
|
||||
new ManiaModKey3(),
|
||||
},
|
||||
},
|
||||
new ManiaModKeyCoop(),
|
||||
new ManiaModRandom(),
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new ModAutoplay(),
|
||||
new ModCinema(),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
default:
|
||||
return new Mod[] { };
|
||||
}
|
||||
}
|
||||
|
||||
protected override PlayMode PlayMode => PlayMode.Mania;
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mania_o;
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
<Compile Include="UI\ManiaHitRenderer.cs" />
|
||||
<Compile Include="UI\ManiaPlayfield.cs" />
|
||||
<Compile Include="ManiaRuleset.cs" />
|
||||
<Compile Include="ManiaMod.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Osu
|
||||
{
|
||||
public class OsuModNoFail : ModNoFail
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class OsuModEasy : ModEasy
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class OsuModHidden : ModHidden
|
||||
{
|
||||
public override string Description => @"Play with no approach circles and fading notes for a slight score advantage.";
|
||||
public override double ScoreMultiplier => 1.06;
|
||||
public override Mods[] DisablesMods => new Mods[] { };
|
||||
}
|
||||
|
||||
public class OsuModHardRock : ModHardRock
|
||||
{
|
||||
public override double ScoreMultiplier => 1.06;
|
||||
public override bool Ranked => true;
|
||||
}
|
||||
|
||||
public class OsuModSuddenDeath : ModSuddenDeath
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class OsuModDoubleTime : ModDoubleTime
|
||||
{
|
||||
public override double ScoreMultiplier => 1.12;
|
||||
}
|
||||
|
||||
public class OsuModRelax : ModRelax
|
||||
{
|
||||
public override string Description => "You don't need to click.\nGive your clicking/tapping finger a break from the heat of things.";
|
||||
}
|
||||
|
||||
public class OsuModHalfTime : ModHalfTime
|
||||
{
|
||||
public override double ScoreMultiplier => 0.5;
|
||||
}
|
||||
|
||||
public class OsuModNightcore : ModNightcore
|
||||
{
|
||||
public override double ScoreMultiplier => 1.12;
|
||||
}
|
||||
|
||||
public class OsuModFlashlight : ModFlashlight
|
||||
{
|
||||
public override double ScoreMultiplier => 1.12;
|
||||
public override Mods[] DisablesMods => new Mods[] { };
|
||||
}
|
||||
|
||||
public class OsuModPerfect : ModPerfect
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class OsuModSpunOut : Mod
|
||||
{
|
||||
public override Mods Name => Mods.SpunOut;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_spunout;
|
||||
public override string Description => @"Spinners will be automatically completed";
|
||||
public override double ScoreMultiplier => 0.9;
|
||||
public override bool Ranked => true;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.Autoplay, Mods.Cinema, Mods.Autopilot };
|
||||
}
|
||||
|
||||
public class OsuModAutopilot : Mod
|
||||
{
|
||||
public override Mods Name => Mods.Autopilot;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_autopilot;
|
||||
public override string Description => @"Automatic cursor movement - just follow the rhythm.";
|
||||
public override double ScoreMultiplier => 0;
|
||||
public override bool Ranked => false;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.SpunOut, Mods.Relax, Mods.SuddenDeath, Mods.Perfect, Mods.NoFail, Mods.Autoplay, Mods.Cinema };
|
||||
}
|
||||
|
||||
public class OsuModTarget : Mod
|
||||
{
|
||||
public override Mods Name => Mods.Target;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_target;
|
||||
public override string Description => @"";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override bool Ranked => false;
|
||||
public override Mods[] DisablesMods => new Mods[] { };
|
||||
}
|
||||
}
|
||||
@@ -34,6 +34,64 @@ namespace osu.Game.Modes.Osu
|
||||
}
|
||||
};
|
||||
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ModType.DifficultyReduction:
|
||||
return new Mod[]
|
||||
{
|
||||
new OsuModEasy(),
|
||||
new OsuModNoFail(),
|
||||
new OsuModHalfTime(),
|
||||
};
|
||||
|
||||
case ModType.DifficultyIncrease:
|
||||
return new Mod[]
|
||||
{
|
||||
new OsuModHardRock(),
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new OsuModSuddenDeath(),
|
||||
new OsuModPerfect(),
|
||||
},
|
||||
},
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new OsuModDoubleTime(),
|
||||
new OsuModNightcore(),
|
||||
},
|
||||
},
|
||||
new OsuModHidden(),
|
||||
new OsuModFlashlight(),
|
||||
};
|
||||
|
||||
case ModType.Special:
|
||||
return new Mod[]
|
||||
{
|
||||
new OsuModRelax(),
|
||||
new OsuModAutopilot(),
|
||||
new OsuModTarget(),
|
||||
new OsuModSpunOut(),
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new ModAutoplay(),
|
||||
new ModCinema(),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
default:
|
||||
return new Mod[] { };
|
||||
}
|
||||
}
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_osu_o;
|
||||
|
||||
public override HitObjectParser CreateHitObjectParser() => new OsuHitObjectParser();
|
||||
|
||||
@@ -85,6 +85,7 @@
|
||||
<Compile Include="Objects\Spinner.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="UI\OsuScoreOverlay.cs" />
|
||||
<Compile Include="OsuMod.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Modes.Taiko
|
||||
{
|
||||
public class TaikoModNoFail : ModNoFail
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class TaikoModEasy : ModEasy
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class TaikoModHidden : ModHidden
|
||||
{
|
||||
public override string Description => @"The notes fade out before you hit them!";
|
||||
public override double ScoreMultiplier => 1.06;
|
||||
public override Mods[] DisablesMods => new Mods[] { };
|
||||
}
|
||||
|
||||
public class TaikoModHardRock : ModHardRock
|
||||
{
|
||||
public override double ScoreMultiplier => 1.06;
|
||||
public override bool Ranked => true;
|
||||
}
|
||||
|
||||
public class TaikoModSuddenDeath : ModSuddenDeath
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class TaikoModDoubleTime : ModDoubleTime
|
||||
{
|
||||
public override double ScoreMultiplier => 1.12;
|
||||
}
|
||||
|
||||
public class TaikoModRelax : ModRelax
|
||||
{
|
||||
public override string Description => @"Relax! You will no longer get dizzyfied by ninja-like spinners, demanding drumrolls or unexpected katu's.";
|
||||
}
|
||||
|
||||
public class TaikoModHalfTime : ModHalfTime
|
||||
{
|
||||
public override double ScoreMultiplier => 0.5;
|
||||
}
|
||||
|
||||
public class TaikoModNightcore : ModNightcore
|
||||
{
|
||||
public override double ScoreMultiplier => 1.12;
|
||||
}
|
||||
|
||||
public class TaikoModFlashlight : ModFlashlight
|
||||
{
|
||||
public override double ScoreMultiplier => 1.12;
|
||||
public override Mods[] DisablesMods => new Mods[] { };
|
||||
}
|
||||
|
||||
public class TaikoModPerfect : ModPerfect
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes.Objects;
|
||||
using osu.Game.Modes.Osu.UI;
|
||||
@@ -16,6 +17,61 @@ namespace osu.Game.Modes.Taiko
|
||||
|
||||
public override HitRenderer CreateHitRendererWith(Beatmap beatmap) => new TaikoHitRenderer { Beatmap = beatmap };
|
||||
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case ModType.DifficultyReduction:
|
||||
return new Mod[]
|
||||
{
|
||||
new TaikoModEasy(),
|
||||
new TaikoModNoFail(),
|
||||
new TaikoModHalfTime(),
|
||||
};
|
||||
|
||||
case ModType.DifficultyIncrease:
|
||||
return new Mod[]
|
||||
{
|
||||
new TaikoModHardRock(),
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new TaikoModSuddenDeath(),
|
||||
new TaikoModPerfect(),
|
||||
},
|
||||
},
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new TaikoModDoubleTime(),
|
||||
new TaikoModNightcore(),
|
||||
},
|
||||
},
|
||||
new TaikoModHidden(),
|
||||
new TaikoModFlashlight(),
|
||||
};
|
||||
|
||||
case ModType.Special:
|
||||
return new Mod[]
|
||||
{
|
||||
new TaikoModRelax(),
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new ModAutoplay(),
|
||||
new ModCinema(),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
default:
|
||||
return new Mod[] { };
|
||||
}
|
||||
}
|
||||
|
||||
protected override PlayMode PlayMode => PlayMode.Taiko;
|
||||
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_taiko_o;
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
<Compile Include="UI\TaikoHitRenderer.cs" />
|
||||
<Compile Include="UI\TaikoPlayfield.cs" />
|
||||
<Compile Include="TaikoRuleset.cs" />
|
||||
<Compile Include="TaikoMod.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\osu.licenseheader">
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
@@ -40,8 +41,16 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
using (HeadlessGameHost host = new HeadlessGameHost())
|
||||
{
|
||||
var osu = loadOsu(host);
|
||||
osu.Dependencies.Get<BeatmapDatabase>().Import(osz_path);
|
||||
|
||||
var temp = prepareTempCopy(osz_path);
|
||||
|
||||
Assert.IsTrue(File.Exists(temp));
|
||||
|
||||
osu.Dependencies.Get<BeatmapDatabase>().Import(temp);
|
||||
|
||||
ensureLoaded(osu);
|
||||
|
||||
Assert.IsFalse(File.Exists(temp));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,14 +65,51 @@ namespace osu.Game.Tests.Beatmaps.IO
|
||||
|
||||
var osu = loadOsu(host);
|
||||
|
||||
var temp = prepareTempCopy(osz_path);
|
||||
|
||||
Assert.IsTrue(File.Exists(temp));
|
||||
|
||||
var importer = new BeatmapImporter(client);
|
||||
if (!importer.ImportAsync(osz_path).Wait(1000))
|
||||
if (!importer.ImportAsync(temp).Wait(1000))
|
||||
Assert.Fail(@"IPC took too long to send");
|
||||
|
||||
ensureLoaded(osu);
|
||||
|
||||
Assert.IsFalse(File.Exists(temp));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestImportWhenFileOpen()
|
||||
{
|
||||
//unfortunately for the time being we need to reference osu.Framework.Desktop for a game host here.
|
||||
using (HeadlessGameHost host = new HeadlessGameHost())
|
||||
{
|
||||
var osu = loadOsu(host);
|
||||
|
||||
var temp = prepareTempCopy(osz_path);
|
||||
|
||||
Assert.IsTrue(File.Exists(temp));
|
||||
|
||||
using (FileStream stream = File.OpenRead(temp))
|
||||
osu.Dependencies.Get<BeatmapDatabase>().Import(temp);
|
||||
|
||||
ensureLoaded(osu);
|
||||
|
||||
Assert.IsTrue(File.Exists(temp));
|
||||
|
||||
File.Delete(temp);
|
||||
|
||||
Assert.IsFalse(File.Exists(temp));
|
||||
}
|
||||
}
|
||||
|
||||
private string prepareTempCopy(string path)
|
||||
{
|
||||
var temp = Path.GetTempFileName();
|
||||
return new FileInfo(osz_path).CopyTo(temp, true).FullName;
|
||||
}
|
||||
|
||||
private OsuGameBase loadOsu(GameHost host)
|
||||
{
|
||||
var osu = new OsuGameBase();
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
},
|
||||
artist = new OsuSpriteText
|
||||
{
|
||||
Margin = new MarginPadding { Top = -1 },
|
||||
Font = @"Exo2.0-SemiBoldItalic",
|
||||
Text = beatmap.BeatmapSetInfo.Metadata.Artist,
|
||||
TextSize = 17,
|
||||
|
||||
@@ -116,13 +116,61 @@ namespace osu.Game.Database
|
||||
connection.DeleteAll<BeatmapInfo>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Import multiple <see cref="BeatmapSetInfo"/> from <paramref name="paths"/>.
|
||||
/// </summary>
|
||||
/// <param name="paths">Multiple locations on disk</param>
|
||||
public void Import(IEnumerable<string> paths)
|
||||
{
|
||||
Stack<BeatmapSetInfo> sets = new Stack<BeatmapSetInfo>();
|
||||
|
||||
foreach (string p in paths)
|
||||
Import(p);
|
||||
try
|
||||
{
|
||||
BeatmapSetInfo set = getBeatmapSet(p);
|
||||
|
||||
//If we have an ID then we already exist in the database.
|
||||
if (set.ID == 0)
|
||||
sets.Push(set);
|
||||
|
||||
// We may or may not want to delete the file depending on where it is stored.
|
||||
// e.g. reconstructing/repairing database with beatmaps from default storage.
|
||||
// Also, not always a single file, i.e. for LegacyFilesystemReader
|
||||
// TODO: Add a check to prevent files from storage to be deleted.
|
||||
try
|
||||
{
|
||||
File.Delete(p);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error(e, $@"Could not delete file at {p}");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e = e.InnerException ?? e;
|
||||
Logger.Error(e, $@"Could not import beatmap set");
|
||||
}
|
||||
|
||||
// Batch commit with multiple sets to database
|
||||
Import(sets);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Import <see cref="BeatmapSetInfo"/> from <paramref name="path"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">Location on disk</param>
|
||||
public void Import(string path)
|
||||
{
|
||||
Import(new [] { path });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Duplicates content from <paramref name="path"/> to storage and returns a representing <see cref="BeatmapSetInfo"/>.
|
||||
/// </summary>
|
||||
/// <param name="path">Content location</param>
|
||||
/// <returns><see cref="BeatmapSetInfo"/></returns>
|
||||
private BeatmapSetInfo getBeatmapSet(string path)
|
||||
{
|
||||
string hash = null;
|
||||
|
||||
@@ -156,7 +204,7 @@ namespace osu.Game.Database
|
||||
BeatmapSetAdded?.Invoke(existing);
|
||||
}
|
||||
|
||||
return;
|
||||
return existing;
|
||||
}
|
||||
|
||||
var beatmapSet = new BeatmapSetInfo
|
||||
@@ -172,7 +220,6 @@ namespace osu.Game.Database
|
||||
{
|
||||
string[] mapNames = reader.BeatmapFilenames;
|
||||
foreach (var name in mapNames)
|
||||
{
|
||||
using (var stream = new StreamReader(reader.GetStream(name)))
|
||||
{
|
||||
var decoder = BeatmapDecoder.GetDecoder(stream);
|
||||
@@ -184,11 +231,10 @@ namespace osu.Game.Database
|
||||
|
||||
beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
|
||||
}
|
||||
beatmapSet.StoryboardFile = reader.StoryboardFilename;
|
||||
}
|
||||
beatmapSet.StoryboardFile = reader.StoryboardFilename;
|
||||
}
|
||||
|
||||
Import(new[] { beatmapSet });
|
||||
return beatmapSet;
|
||||
}
|
||||
|
||||
public void Import(IEnumerable<BeatmapSetInfo> beatmapSets)
|
||||
|
||||
@@ -10,7 +10,6 @@ using osu.Framework.MathUtils;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using System;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
|
||||
namespace osu.Game.Graphics.Backgrounds
|
||||
{
|
||||
|
||||
@@ -902,6 +902,6 @@ namespace osu.Game.Graphics
|
||||
fa_osu_mod_spunout = 0xe046,
|
||||
fa_osu_mod_suddendeath = 0xe047,
|
||||
fa_osu_mod_target = 0xe048,
|
||||
fa_osu_mod_bg = 0xe049,
|
||||
fa_osu_mod_bg = 0xe04a,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
protected override Drawable GetDrawableCharacter(char c) => new PasswordMaskChar(CalculatedTextSize);
|
||||
|
||||
public override bool AllowClipboardExport => false;
|
||||
|
||||
public class PasswordMaskChar : Container
|
||||
{
|
||||
private CircularContainer circle;
|
||||
|
||||
@@ -57,10 +57,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
c1.Origin = c1.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopLeft : Anchor.TopRight;
|
||||
c2.Origin = c2.Anchor = (value & Anchor.x2) > 0 ? Anchor.TopRight : Anchor.TopLeft;
|
||||
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Right = (value & Anchor.x2) > 0 ? -SIZE_RETRACTED.X * shear * 0.5f : 0
|
||||
};
|
||||
X = (value & Anchor.x2) > 0 ? SIZE_RETRACTED.X * shear * 0.5f : 0;
|
||||
|
||||
c1.Depth = (value & Anchor.x2) > 0 ? 0 : 1;
|
||||
c2.Depth = (value & Anchor.x2) > 0 ? 1 : 0;
|
||||
|
||||
@@ -0,0 +1,272 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes
|
||||
{
|
||||
/// <summary>
|
||||
/// The base class for gameplay modifiers.
|
||||
/// </summary>
|
||||
public abstract class Mod
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of this mod.
|
||||
/// </summary>
|
||||
public abstract Mods Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The icon of this mod.
|
||||
/// </summary>
|
||||
public abstract FontAwesome Icon { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The user readable description of this mod.
|
||||
/// </summary>
|
||||
public abstract string Description { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The score multiplier of this mod.
|
||||
/// </summary>
|
||||
public abstract double ScoreMultiplier { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns if this mod is ranked.
|
||||
/// </summary>
|
||||
public abstract bool Ranked { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The mods this mod cannot be enabled with.
|
||||
/// </summary>
|
||||
public abstract Mods[] DisablesMods { get; }
|
||||
}
|
||||
|
||||
public class MultiMod : Mod
|
||||
{
|
||||
public override Mods Name => Modes.Mods.None;
|
||||
public override FontAwesome Icon => FontAwesome.fa_close;
|
||||
public override string Description => @"";
|
||||
public override double ScoreMultiplier => 0.0;
|
||||
public override bool Ranked => false;
|
||||
public override Mods[] DisablesMods => new Mods[] { };
|
||||
|
||||
public Mod[] Mods;
|
||||
}
|
||||
|
||||
public abstract class ModNoFail : Mod
|
||||
{
|
||||
public override Mods Name => Mods.NoFail;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail;
|
||||
public override string Description => @"You can't fail, no matter what.";
|
||||
public override double ScoreMultiplier => 0.5;
|
||||
public override bool Ranked => true;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.Relax, Mods.Autopilot, Mods.SuddenDeath, Mods.Perfect };
|
||||
}
|
||||
|
||||
public abstract class ModEasy : Mod
|
||||
{
|
||||
public override Mods Name => Mods.Easy;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy;
|
||||
public override string Description => @"Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required.";
|
||||
public override double ScoreMultiplier => 0.5;
|
||||
public override bool Ranked => true;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.HardRock };
|
||||
}
|
||||
|
||||
public abstract class ModHidden : Mod
|
||||
{
|
||||
public override Mods Name => Mods.Hidden;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
||||
public override bool Ranked => true;
|
||||
}
|
||||
|
||||
public abstract class ModHardRock : Mod
|
||||
{
|
||||
public override Mods Name => Mods.HardRock;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock;
|
||||
public override string Description => @"Everything just got a bit harder...";
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.Easy };
|
||||
}
|
||||
|
||||
public abstract class ModSuddenDeath : Mod
|
||||
{
|
||||
public override Mods Name => Mods.SuddenDeath;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
|
||||
public override string Description => @"Miss a note and fail.";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override bool Ranked => true;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.NoFail, Mods.Relax, Mods.Autopilot, Mods.Autoplay, Mods.Cinema };
|
||||
}
|
||||
|
||||
public abstract class ModDoubleTime : Mod
|
||||
{
|
||||
public override Mods Name => Mods.DoubleTime;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime;
|
||||
public override string Description => @"Zoooooooooom";
|
||||
public override bool Ranked => true;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.HalfTime };
|
||||
}
|
||||
|
||||
public abstract class ModRelax : Mod
|
||||
{
|
||||
public override Mods Name => Mods.Relax;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax;
|
||||
public override double ScoreMultiplier => 0;
|
||||
public override bool Ranked => false;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.Autopilot, Mods.Autoplay, Mods.Cinema, Mods.NoFail, Mods.SuddenDeath, Mods.Perfect };
|
||||
}
|
||||
|
||||
public abstract class ModHalfTime : Mod
|
||||
{
|
||||
public override Mods Name => Mods.HalfTime;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
|
||||
public override string Description => @"Less zoom";
|
||||
public override bool Ranked => true;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.DoubleTime, Mods.Nightcore };
|
||||
}
|
||||
|
||||
public abstract class ModNightcore : ModDoubleTime
|
||||
{
|
||||
public override Mods Name => Mods.Nightcore;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nightcore;
|
||||
public override string Description => @"uguuuuuuuu";
|
||||
}
|
||||
|
||||
public abstract class ModFlashlight : Mod
|
||||
{
|
||||
public override Mods Name => Mods.Flashlight;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight;
|
||||
public override string Description => @"Restricted view area.";
|
||||
public override bool Ranked => true;
|
||||
}
|
||||
|
||||
public class ModAutoplay : Mod
|
||||
{
|
||||
public override Mods Name => Mods.Autoplay;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto;
|
||||
public override string Description => @"Watch a perfect automated play through the song";
|
||||
public override double ScoreMultiplier => 0;
|
||||
public override bool Ranked => false;
|
||||
public override Mods[] DisablesMods => new Mods[] { Mods.Relax, Mods.Autopilot, Mods.SpunOut, Mods.SuddenDeath, Mods.Perfect };
|
||||
}
|
||||
|
||||
public abstract class ModPerfect : ModSuddenDeath
|
||||
{
|
||||
public override Mods Name => Mods.Perfect;
|
||||
public override FontAwesome Icon => FontAwesome.fa_close;
|
||||
public override string Description => @"SS or quit.";
|
||||
}
|
||||
|
||||
public class ModCinema : ModAutoplay
|
||||
{
|
||||
public override Mods Name => Mods.Cinema;
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_cinema;
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum Mods
|
||||
{
|
||||
None = 0,
|
||||
|
||||
[Description(@"No Fail")]
|
||||
NoFail = 1 << 0,
|
||||
|
||||
[Description(@"Easy")]
|
||||
Easy = 1 << 1,
|
||||
|
||||
//NoVideo = 1 << 2,
|
||||
|
||||
[Description(@"Hidden")]
|
||||
Hidden = 1 << 3,
|
||||
|
||||
[Description(@"Hard Rock")]
|
||||
HardRock = 1 << 4,
|
||||
|
||||
[Description(@"Sudden Death")]
|
||||
SuddenDeath = 1 << 5,
|
||||
|
||||
[Description(@"Double Time")]
|
||||
DoubleTime = 1 << 6,
|
||||
|
||||
[Description(@"Relax")]
|
||||
Relax = 1 << 7,
|
||||
|
||||
[Description(@"Halftime")]
|
||||
HalfTime = 1 << 8,
|
||||
|
||||
[Description(@"Nightcore")]
|
||||
Nightcore = 1 << 9,
|
||||
|
||||
[Description(@"Flashlight")]
|
||||
Flashlight = 1 << 10,
|
||||
|
||||
[Description(@"Auto")]
|
||||
Autoplay = 1 << 11,
|
||||
|
||||
[Description(@"Spun Out")]
|
||||
SpunOut = 1 << 12,
|
||||
|
||||
[Description(@"Autopilot")]
|
||||
Autopilot = 1 << 13,
|
||||
|
||||
[Description(@"Perfect")]
|
||||
Perfect = 1 << 14,
|
||||
|
||||
[Description(@"4K")]
|
||||
Key4 = 1 << 15,
|
||||
|
||||
[Description(@"5K")]
|
||||
Key5 = 1 << 16,
|
||||
|
||||
[Description(@"6K")]
|
||||
Key6 = 1 << 17,
|
||||
|
||||
[Description(@"7K")]
|
||||
Key7 = 1 << 18,
|
||||
|
||||
[Description(@"8K")]
|
||||
Key8 = 1 << 19,
|
||||
|
||||
[Description(@"Fade In")]
|
||||
FadeIn = 1 << 20,
|
||||
|
||||
[Description(@"Random")]
|
||||
Random = 1 << 21,
|
||||
|
||||
[Description(@"Cinema")]
|
||||
Cinema = 1 << 22,
|
||||
|
||||
[Description(@"Target Practice")]
|
||||
Target = 1 << 23,
|
||||
|
||||
[Description(@"9K")]
|
||||
Key9 = 1 << 24,
|
||||
|
||||
[Description(@"Co-Op")]
|
||||
KeyCoop = 1 << 25,
|
||||
|
||||
[Description(@"1K")]
|
||||
Key1 = 1 << 26,
|
||||
|
||||
[Description(@"3K")]
|
||||
Key3 = 1 << 27,
|
||||
|
||||
[Description(@"2K")]
|
||||
Key2 = 1 << 28,
|
||||
|
||||
LastMod = 1 << 29,
|
||||
|
||||
KeyMod = Key1 | Key2 | Key3 | Key4 | Key5 | Key6 | Key7 | Key8 | Key9 | KeyCoop,
|
||||
FreeModAllowed = NoFail | Easy | Hidden | HardRock | SuddenDeath | Flashlight | FadeIn | Relax | Autopilot | SpunOut | KeyMod,
|
||||
ScoreIncreaseMods = Hidden | HardRock | DoubleTime | Flashlight | FadeIn
|
||||
}
|
||||
|
||||
public enum ModType
|
||||
{
|
||||
DifficultyReduction,
|
||||
DifficultyIncrease,
|
||||
Special,
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ using System;
|
||||
using System.Collections.Concurrent;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Mods;
|
||||
|
||||
namespace osu.Game.Modes
|
||||
{
|
||||
@@ -26,6 +27,8 @@ namespace osu.Game.Modes
|
||||
|
||||
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
|
||||
|
||||
public abstract IEnumerable<Mod> GetModsFor(ModType type);
|
||||
|
||||
public abstract ScoreProcessor CreateScoreProcessor(int hitObjectCount);
|
||||
|
||||
public abstract HitRenderer CreateHitRendererWith(Beatmap beatmap);
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.UI
|
||||
{
|
||||
public class ModIcon : Container
|
||||
{
|
||||
private TextAwesome modIcon, background;
|
||||
|
||||
private float iconSize = 80;
|
||||
public float IconSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return iconSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
iconSize = value;
|
||||
reapplySize();
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 backgroundColour;
|
||||
new public Color4 Colour
|
||||
{
|
||||
get
|
||||
{
|
||||
return backgroundColour;
|
||||
}
|
||||
set
|
||||
{
|
||||
backgroundColour = value;
|
||||
background.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
private FontAwesome icon;
|
||||
public FontAwesome Icon
|
||||
{
|
||||
get
|
||||
{
|
||||
return icon;
|
||||
}
|
||||
set
|
||||
{
|
||||
icon = value;
|
||||
modIcon.Icon = value;
|
||||
}
|
||||
}
|
||||
|
||||
private void reapplySize()
|
||||
{
|
||||
background.TextSize = iconSize;
|
||||
modIcon.TextSize = iconSize - 35;
|
||||
}
|
||||
|
||||
public ModIcon()
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new TextAwesome
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Icon = FontAwesome.fa_osu_mod_bg,
|
||||
Shadow = true,
|
||||
},
|
||||
modIcon = new TextAwesome
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Colour = OsuColour.Gray(84),
|
||||
},
|
||||
};
|
||||
|
||||
reapplySize();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ using osu.Framework.Graphics.Transforms;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
@@ -211,7 +212,7 @@ namespace osu.Game.Overlays.Dialog
|
||||
},
|
||||
},
|
||||
},
|
||||
header = new SpriteText
|
||||
header = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
@@ -219,7 +220,7 @@ namespace osu.Game.Overlays.Dialog
|
||||
TextSize = 25,
|
||||
Shadow = true,
|
||||
},
|
||||
body = new SpriteText
|
||||
body = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class AssistedSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new Key[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M };
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.Blue;
|
||||
SelectedColour = colours.BlueLight;
|
||||
}
|
||||
|
||||
public AssistedSection()
|
||||
{
|
||||
Header = @"Assisted";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class DifficultyIncreaseSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new Key[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L };
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.Yellow;
|
||||
SelectedColour = colours.YellowLight;
|
||||
}
|
||||
|
||||
public DifficultyIncreaseSection()
|
||||
{
|
||||
Header = @"Gameplay Difficulty Increase";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class DifficultyReductionSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new Key[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P };
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.Green;
|
||||
SelectedColour = colours.GreenLight;
|
||||
}
|
||||
|
||||
public DifficultyReductionSection()
|
||||
{
|
||||
Header = @"Gameplay Difficulty Reduction";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Modes;
|
||||
using osu.Game.Modes.UI;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class ModButton : FillFlowContainer
|
||||
{
|
||||
private ModIcon[] icons;
|
||||
private ModIcon displayIcon => icons[icons.Length - 1];
|
||||
private SpriteText text;
|
||||
private Container iconsContainer;
|
||||
private SampleChannel sampleOn, sampleOff;
|
||||
|
||||
public Action<Mod> Action; // Passed the selected mod or null if none
|
||||
|
||||
private int _selectedMod = -1;
|
||||
private int selectedMod
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedMod;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _selectedMod) return;
|
||||
_selectedMod = value;
|
||||
|
||||
if (value >= Mods.Length)
|
||||
{
|
||||
_selectedMod = -1;
|
||||
}
|
||||
else if (value <= -2)
|
||||
{
|
||||
_selectedMod = Mods.Length - 1;
|
||||
}
|
||||
|
||||
iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic);
|
||||
iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic);
|
||||
for (int i = 0; i < icons.Length; i++)
|
||||
{
|
||||
if (Selected && i == icons.Length - 1) icons[i].Colour = SelectedColour;
|
||||
else icons[i].Colour = Colour;
|
||||
}
|
||||
|
||||
displaySelectedMod();
|
||||
}
|
||||
}
|
||||
|
||||
public bool Selected => selectedMod != -1;
|
||||
|
||||
private Color4 backgroundColour;
|
||||
public new Color4 Colour
|
||||
{
|
||||
get
|
||||
{
|
||||
return backgroundColour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == backgroundColour) return;
|
||||
backgroundColour = value;
|
||||
foreach (ModIcon icon in icons)
|
||||
{
|
||||
icon.Colour = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 selectedColour;
|
||||
public Color4 SelectedColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return selectedColour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == selectedColour) return;
|
||||
selectedColour = value;
|
||||
if (Selected) icons[0].Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Mod mod;
|
||||
public Mod Mod
|
||||
{
|
||||
get
|
||||
{
|
||||
return mod;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (mod == value) return;
|
||||
mod = value;
|
||||
|
||||
if (mod is MultiMod)
|
||||
{
|
||||
mods = ((MultiMod)mod).Mods;
|
||||
}
|
||||
else
|
||||
{
|
||||
mods = new Mod[] { mod };
|
||||
}
|
||||
|
||||
createIcons();
|
||||
if (mods.Length > 0)
|
||||
{
|
||||
displayMod(mods[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Mod[] mods;
|
||||
public Mod[] Mods => mods; // the mods from Mod, only multiple if Mod is a MultiMod
|
||||
|
||||
public Mod SelectedMod => Mods.ElementAtOrDefault(selectedMod);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
sampleOn = audio.Sample.Get(@"Checkbox/check-on");
|
||||
sampleOff = audio.Sample.Get(@"Checkbox/check-off");
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
(args.Button == MouseButton.Right ? (Action)SelectPrevious : SelectNext)();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SelectNext()
|
||||
{
|
||||
selectedMod++;
|
||||
if (selectedMod == -1)
|
||||
{
|
||||
sampleOff.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleOn.Play();
|
||||
}
|
||||
|
||||
Action?.Invoke(SelectedMod);
|
||||
}
|
||||
|
||||
public void SelectPrevious()
|
||||
{
|
||||
selectedMod--;
|
||||
if (selectedMod == -1)
|
||||
{
|
||||
sampleOff.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleOn.Play();
|
||||
}
|
||||
|
||||
Action?.Invoke(SelectedMod);
|
||||
}
|
||||
|
||||
public void Deselect()
|
||||
{
|
||||
selectedMod = -1;
|
||||
}
|
||||
|
||||
private void displayMod(Mod mod)
|
||||
{
|
||||
displayIcon.Icon = mod.Icon;
|
||||
text.Text = mod.Name.GetDescription();
|
||||
}
|
||||
|
||||
private void displaySelectedMod()
|
||||
{
|
||||
var modIndex = selectedMod;
|
||||
if (modIndex <= -1)
|
||||
{
|
||||
modIndex = 0;
|
||||
}
|
||||
|
||||
displayMod(Mods[modIndex]);
|
||||
}
|
||||
|
||||
private void createIcons()
|
||||
{
|
||||
if (Mods.Length > 1)
|
||||
{
|
||||
iconsContainer.Add(icons = new ModIcon[]
|
||||
{
|
||||
new ModIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(1.5f),
|
||||
},
|
||||
new ModIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(-1.5f),
|
||||
},
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
iconsContainer.Add(icons = new ModIcon[]
|
||||
{
|
||||
new ModIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public ModButton(Mod m)
|
||||
{
|
||||
Direction = FillDirection.Down;
|
||||
Spacing = new Vector2(0f, -5f);
|
||||
Size = new Vector2(100f);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Size = new Vector2(77f, 80f),
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
iconsContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
}
|
||||
}
|
||||
},
|
||||
text = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
TextSize = 18,
|
||||
},
|
||||
};
|
||||
|
||||
Mod = m;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
class AlwaysPresentFlowContainer : FillFlowContainer
|
||||
{
|
||||
public override bool IsPresent => true;
|
||||
}
|
||||
|
||||
public class ModSection : Container
|
||||
{
|
||||
private OsuSpriteText headerLabel;
|
||||
|
||||
private AlwaysPresentFlowContainer buttonsContainer;
|
||||
public FillFlowContainer ButtonsContainer => buttonsContainer;
|
||||
|
||||
public Action<Mod> Action;
|
||||
protected virtual Key[] ToggleKeys => new Key[] { };
|
||||
|
||||
public Mod[] SelectedMods
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Mod> selectedMods = new List<Mod>();
|
||||
|
||||
foreach (ModButton button in Buttons)
|
||||
{
|
||||
Mod selectedMod = button.SelectedMod;
|
||||
if (selectedMod != null)
|
||||
selectedMods.Add(selectedMod);
|
||||
}
|
||||
|
||||
return selectedMods.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
private string header;
|
||||
public string Header
|
||||
{
|
||||
get
|
||||
{
|
||||
return header;
|
||||
}
|
||||
set
|
||||
{
|
||||
header = value;
|
||||
headerLabel.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
private ModButton[] buttons = {};
|
||||
public ModButton[] Buttons
|
||||
{
|
||||
get
|
||||
{
|
||||
return buttons;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == buttons) return;
|
||||
buttons = value;
|
||||
|
||||
foreach (ModButton button in value)
|
||||
{
|
||||
button.Colour = Colour;
|
||||
button.SelectedColour = selectedColour;
|
||||
button.Action = buttonPressed;
|
||||
}
|
||||
|
||||
buttonsContainer.Add(value);
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 colour = Color4.White;
|
||||
new public Color4 Colour
|
||||
{
|
||||
get
|
||||
{
|
||||
return colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == colour) return;
|
||||
colour = value;
|
||||
|
||||
foreach (ModButton button in buttons)
|
||||
{
|
||||
button.Colour = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 selectedColour = Color4.White;
|
||||
public Color4 SelectedColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return selectedColour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == selectedColour) return;
|
||||
selectedColour = value;
|
||||
|
||||
foreach (ModButton button in buttons)
|
||||
{
|
||||
button.SelectedColour = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
var index = Array.IndexOf(ToggleKeys, args.Key);
|
||||
if (index > -1 && index < Buttons.Length)
|
||||
Buttons[index].SelectNext();
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
|
||||
public void DeselectAll()
|
||||
{
|
||||
foreach (ModButton button in buttons)
|
||||
{
|
||||
button.Deselect();
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonPressed(Mod mod)
|
||||
{
|
||||
Action?.Invoke(mod);
|
||||
}
|
||||
|
||||
public ModSection()
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
headerLabel = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopLeft,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Position = new Vector2(0f, 0f),
|
||||
Font = @"Exo2.0-Bold",
|
||||
Text = Header,
|
||||
},
|
||||
buttonsContainer = new AlwaysPresentFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Spacing = new Vector2(50f, 0f),
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Top = 6,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,369 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class ModSelectOverlay : WaveOverlayContainer
|
||||
{
|
||||
private const int button_duration = 700;
|
||||
private const int ranked_multiplier_duration = 700;
|
||||
private const float content_width = 0.8f;
|
||||
|
||||
private Color4 lowMultiplierColour, highMultiplierColour;
|
||||
|
||||
private OsuSpriteText rankedLabel, multiplierLabel;
|
||||
private FillFlowContainer rankedMultiplerContainer;
|
||||
|
||||
private FillFlowContainer<ModSection> modSectionsContainer;
|
||||
|
||||
public Bindable<Mod[]> SelectedMods = new Bindable<Mod[]>();
|
||||
|
||||
public readonly Bindable<PlayMode> PlayMode = new Bindable<PlayMode>();
|
||||
|
||||
private void modeChanged(object sender, EventArgs eventArgs)
|
||||
{
|
||||
var ruleset = Ruleset.GetRuleset(PlayMode);
|
||||
|
||||
modSectionsContainer.Children = new ModSection[]
|
||||
{
|
||||
new DifficultyReductionSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.DifficultyReduction).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
new DifficultyIncreaseSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.DifficultyIncrease).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
new AssistedSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.Special).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls:true)]
|
||||
private void load(OsuColour colours, OsuGame osu)
|
||||
{
|
||||
lowMultiplierColour = colours.Red;
|
||||
highMultiplierColour = colours.Green;
|
||||
|
||||
if (osu != null)
|
||||
PlayMode.BindTo(osu.PlayMode);
|
||||
PlayMode.ValueChanged += modeChanged;
|
||||
PlayMode.TriggerChange();
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, APPEAR_DURATION, EasingTypes.InSine);
|
||||
rankedMultiplerContainer.FadeOut(APPEAR_DURATION, EasingTypes.InSine);
|
||||
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
{
|
||||
section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), APPEAR_DURATION, EasingTypes.InSine);
|
||||
section.ButtonsContainer.MoveToX(100f, APPEAR_DURATION, EasingTypes.InSine);
|
||||
section.ButtonsContainer.FadeOut(APPEAR_DURATION, EasingTypes.InSine);
|
||||
}
|
||||
|
||||
TriggerFocusLost();
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, EasingTypes.OutQuint);
|
||||
rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, EasingTypes.OutQuint);
|
||||
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
{
|
||||
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, EasingTypes.OutQuint);
|
||||
section.ButtonsContainer.MoveToX(0, button_duration, EasingTypes.OutQuint);
|
||||
section.ButtonsContainer.FadeIn(button_duration, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
Schedule(TriggerFocusContention);
|
||||
}
|
||||
|
||||
public void DeselectAll()
|
||||
{
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
{
|
||||
foreach (ModButton button in section.Buttons)
|
||||
{
|
||||
button.Deselect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DeselectMod(Modes.Mods modName)
|
||||
{
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
{
|
||||
foreach (ModButton button in section.Buttons)
|
||||
{
|
||||
foreach (Mod mod in button.Mods)
|
||||
{
|
||||
if (mod.Name == modName)
|
||||
{
|
||||
button.Deselect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void modButtonPressed(Mod selectedMod)
|
||||
{
|
||||
if (selectedMod != null)
|
||||
{
|
||||
foreach (Modes.Mods disableMod in selectedMod.DisablesMods)
|
||||
{
|
||||
DeselectMod(disableMod);
|
||||
}
|
||||
}
|
||||
|
||||
refreshSelectedMods();
|
||||
|
||||
double multiplier = 1.0;
|
||||
bool ranked = true;
|
||||
|
||||
foreach (Mod mod in SelectedMods.Value)
|
||||
{
|
||||
multiplier *= mod.ScoreMultiplier;
|
||||
|
||||
if (ranked)
|
||||
ranked = mod.Ranked;
|
||||
}
|
||||
|
||||
// 1.00x
|
||||
// 1.05x
|
||||
// 1.20x
|
||||
|
||||
multiplierLabel.Text = string.Format("{0:N2}x", multiplier);
|
||||
string rankedString = ranked ? "Ranked" : "Unranked";
|
||||
rankedLabel.Text = $@"{rankedString}, Score Multiplier: ";
|
||||
|
||||
if (multiplier > 1.0)
|
||||
{
|
||||
multiplierLabel.FadeColour(highMultiplierColour, 200);
|
||||
}
|
||||
else if (multiplier < 1.0)
|
||||
{
|
||||
multiplierLabel.FadeColour(lowMultiplierColour, 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
multiplierLabel.FadeColour(Color4.White, 200);
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshSelectedMods()
|
||||
{
|
||||
List<Mod> selectedMods = new List<Mod>();
|
||||
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
{
|
||||
foreach (Mod mod in section.SelectedMods)
|
||||
{
|
||||
selectedMods.Add(mod);
|
||||
}
|
||||
}
|
||||
|
||||
SelectedMods.Value = selectedMods.ToArray();
|
||||
}
|
||||
|
||||
public ModSelectOverlay()
|
||||
{
|
||||
FirstWaveColour = OsuColour.FromHex(@"19b0e2");
|
||||
SecondWaveColour = OsuColour.FromHex(@"2280a2");
|
||||
ThirdWaveColour = OsuColour.FromHex(@"005774");
|
||||
FourthWaveColour = OsuColour.FromHex(@"003a4e");
|
||||
|
||||
Height = 510;
|
||||
Content.RelativeSizeAxes = Axes.X;
|
||||
Content.AutoSizeAxes = Axes.Y;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(36, 50, 68, 255)
|
||||
},
|
||||
new Triangles
|
||||
{
|
||||
TriangleScale = 5,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = Height, //set the height from the start to ensure correct triangle density.
|
||||
ColourLight = new Color4(53, 66, 82, 255),
|
||||
ColourDark = new Color4(41, 54, 70, 255),
|
||||
},
|
||||
},
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Direction = FillDirection.Down,
|
||||
Spacing = new Vector2(0f, 10f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
// Header
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 82,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.Gray(10).Opacity(100),
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Down,
|
||||
Width = content_width,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Top = 10,
|
||||
Bottom = 10,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-Bold",
|
||||
Text = @"Gameplay Mods",
|
||||
TextSize = 22,
|
||||
Shadow = true,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Bottom = 4,
|
||||
},
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = @"Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.",
|
||||
TextSize = 18,
|
||||
Shadow = true,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = @"Others are just for fun",
|
||||
TextSize = 18,
|
||||
Shadow = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
// Body
|
||||
modSectionsContainer = new FillFlowContainer<ModSection>
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(0f, 10f),
|
||||
Width = content_width,
|
||||
},
|
||||
// Footer
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 70,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(172, 20, 116, 255),
|
||||
Alpha = 0.5f,
|
||||
},
|
||||
rankedMultiplerContainer = new FillFlowContainer
|
||||
{
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = content_width,
|
||||
Direction = FillDirection.Right,
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Top = 20,
|
||||
Bottom = 20,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
rankedLabel = new OsuSpriteText
|
||||
{
|
||||
Text = @"Ranked, Score Multiplier: ",
|
||||
TextSize = 30,
|
||||
Shadow = true,
|
||||
},
|
||||
multiplierLabel = new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-Bold",
|
||||
Text = @"1.00x",
|
||||
TextSize = 30,
|
||||
Shadow = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,8 @@ namespace osu.Game.Overlays.Options.Sections.General
|
||||
{
|
||||
PlaceholderText = "Password",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this
|
||||
TabbableContentContainer = this,
|
||||
OnCommit = (TextBox sender, bool newText) => performLogin()
|
||||
},
|
||||
new OsuCheckbox
|
||||
{
|
||||
|
||||
@@ -55,7 +55,10 @@ namespace osu.Game.Overlays.Toolbar
|
||||
},
|
||||
modeSelector = new ToolbarModeSelector
|
||||
{
|
||||
OnPlayModeChange = OnPlayModeChange
|
||||
OnPlayModeChange = (PlayMode mode) =>
|
||||
{
|
||||
OnPlayModeChange?.Invoke(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public abstract class WaveOverlayContainer : FocusedOverlayContainer
|
||||
{
|
||||
protected const float APPEAR_DURATION = 800;
|
||||
protected const float DISAPPEAR_DURATION = 500;
|
||||
|
||||
private const EasingTypes easing_show = EasingTypes.OutSine;
|
||||
private const EasingTypes easing_hide = EasingTypes.InSine;
|
||||
|
||||
private Wave firstWave, secondWave, thirdWave, fourthWave;
|
||||
|
||||
private Container<Wave> wavesContainer;
|
||||
|
||||
private readonly Container contentContainer;
|
||||
|
||||
protected override Container<Drawable> Content => contentContainer;
|
||||
|
||||
protected Color4 FirstWaveColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return firstWave.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (firstWave.Colour == value) return;
|
||||
firstWave.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected Color4 SecondWaveColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return secondWave.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (secondWave.Colour == value) return;
|
||||
secondWave.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected Color4 ThirdWaveColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return thirdWave.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (thirdWave.Colour == value) return;
|
||||
thirdWave.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected Color4 FourthWaveColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return fourthWave.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (fourthWave.Colour == value) return;
|
||||
fourthWave.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected WaveOverlayContainer()
|
||||
{
|
||||
Masking = true;
|
||||
|
||||
AddInternal(wavesContainer = new Container<Wave>
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Children = new[]
|
||||
{
|
||||
firstWave = new Wave
|
||||
{
|
||||
Rotation = 13,
|
||||
FinalPosition = -930,
|
||||
},
|
||||
secondWave = new Wave
|
||||
{
|
||||
Origin = Anchor.TopRight,
|
||||
Anchor = Anchor.TopRight,
|
||||
Rotation = -7,
|
||||
FinalPosition = -560,
|
||||
},
|
||||
thirdWave = new Wave
|
||||
{
|
||||
Rotation = 4,
|
||||
FinalPosition = -390,
|
||||
},
|
||||
fourthWave = new Wave
|
||||
{
|
||||
Origin = Anchor.TopRight,
|
||||
Anchor = Anchor.TopRight,
|
||||
Rotation = -2,
|
||||
FinalPosition = -220,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
AddInternal(contentContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.White.Opacity(50),
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
foreach (var w in wavesContainer.Children)
|
||||
w.State = Visibility.Visible;
|
||||
|
||||
contentContainer.FadeIn(APPEAR_DURATION, EasingTypes.OutQuint);
|
||||
contentContainer.MoveToY(0, APPEAR_DURATION, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
contentContainer.FadeOut(DISAPPEAR_DURATION, EasingTypes.In);
|
||||
contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, EasingTypes.In);
|
||||
|
||||
foreach (var w in wavesContainer.Children)
|
||||
w.State = Visibility.Hidden;
|
||||
}
|
||||
|
||||
private class Wave : Container, IStateful<Visibility>
|
||||
{
|
||||
public float FinalPosition;
|
||||
|
||||
public Wave()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
Size = new Vector2(1.5f);
|
||||
Masking = true;
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = Color4.Black.Opacity(50),
|
||||
Radius = 20f,
|
||||
};
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private Visibility state;
|
||||
public Visibility State
|
||||
{
|
||||
get { return state; }
|
||||
set
|
||||
{
|
||||
state = value;
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case Visibility.Hidden:
|
||||
MoveToY(DrawHeight / Height, DISAPPEAR_DURATION, easing_hide);
|
||||
break;
|
||||
case Visibility.Visible:
|
||||
MoveToY(FinalPosition, APPEAR_DURATION, easing_show);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,8 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
if (args.Repeat) return false;
|
||||
if (args.Repeat || state.Keyboard.ControlPressed || state.Keyboard.ShiftPressed || state.Keyboard.AltPressed)
|
||||
return false;
|
||||
|
||||
if (triggerKey == args.Key && triggerKey != Key.Unknown)
|
||||
{
|
||||
|
||||
@@ -13,6 +13,9 @@ using osu.Game.Screens.Direct;
|
||||
using osu.Game.Screens.Multiplayer;
|
||||
using OpenTK;
|
||||
using osu.Game.Screens.Select;
|
||||
using osu.Game.Screens.Tournament;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Screens.Menu
|
||||
{
|
||||
@@ -97,5 +100,16 @@ namespace osu.Game.Screens.Menu
|
||||
Content.FadeOut(3000);
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
if (!args.Repeat && state.Keyboard.ControlPressed && state.Keyboard.ShiftPressed && args.Key == Key.D)
|
||||
{
|
||||
Push(new Drawings());
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
class ModSelect : ScreenWhiteBox
|
||||
{
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
|
||||
|
||||
protected override void OnEntering(Screen last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
Background.Schedule(() => Background.FadeColour(Color4.DarkGray, 500));
|
||||
}
|
||||
|
||||
protected override bool OnExiting(Screen next)
|
||||
{
|
||||
Background.Schedule(() => Background.FadeColour(Color4.White, 500));
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -1,15 +1,15 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Beatmaps;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
namespace osu.Game.Screens.Play.Pause
|
||||
{
|
||||
public class PauseProgressBar : Container
|
||||
{
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
namespace osu.Game.Screens.Play.Pause
|
||||
{
|
||||
public class PauseProgressGraph : Container
|
||||
{
|
||||
@@ -1,13 +1,12 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
namespace osu.Game.Screens.Play.Pause
|
||||
{
|
||||
public class QuitButton : DialogButton
|
||||
{
|
||||
+1
-1
@@ -6,7 +6,7 @@ using osu.Framework.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
namespace osu.Game.Screens.Play.Pause
|
||||
{
|
||||
public class ResumeButton : DialogButton
|
||||
{
|
||||
@@ -6,7 +6,7 @@ using osu.Framework.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
namespace osu.Game.Screens.Play.Pause
|
||||
{
|
||||
public class RetryButton : DialogButton
|
||||
{
|
||||
@@ -2,19 +2,20 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using OpenTK;
|
||||
using OpenTK.Input;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Screens.Play.Pause;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class PauseOverlay : OverlayContainer
|
||||
{
|
||||
@@ -16,7 +16,6 @@ using osu.Framework.Screens;
|
||||
using osu.Game.Modes.UI;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Overlays.Pause;
|
||||
using osu.Framework.Configuration;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
@@ -8,7 +8,7 @@ using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
|
||||
namespace osu.Game
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class BeatmapDeleteDialog : PopupDialog
|
||||
{
|
||||
|
||||
@@ -192,8 +192,10 @@ namespace osu.Game.Screens.Select
|
||||
ScrollTo(selectedY, animated);
|
||||
}
|
||||
|
||||
public void Sort(FilterControl.SortMode mode) {
|
||||
switch (mode) {
|
||||
public void Sort(FilterControl.SortMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case FilterControl.SortMode.Artist:
|
||||
groups.Sort((x, y) => string.Compare(x.BeatmapSet.Metadata.Artist, y.BeatmapSet.Metadata.Artist));
|
||||
break;
|
||||
@@ -206,15 +208,17 @@ namespace osu.Game.Screens.Select
|
||||
case FilterControl.SortMode.Difficulty:
|
||||
groups.Sort((x, y) =>
|
||||
{
|
||||
float xAverage=0, yAverage=0;
|
||||
int counter=0;
|
||||
foreach (BeatmapInfo set in x.BeatmapSet.Beatmaps) {
|
||||
float xAverage = 0, yAverage = 0;
|
||||
int counter = 0;
|
||||
foreach (BeatmapInfo set in x.BeatmapSet.Beatmaps)
|
||||
{
|
||||
xAverage += set.StarDifficulty;
|
||||
counter++;
|
||||
}
|
||||
xAverage /= counter;
|
||||
counter = 0;
|
||||
foreach (BeatmapInfo set in y.BeatmapSet.Beatmaps) {
|
||||
foreach (BeatmapInfo set in y.BeatmapSet.Beatmaps)
|
||||
{
|
||||
yAverage += set.StarDifficulty;
|
||||
counter++;
|
||||
}
|
||||
@@ -241,7 +245,7 @@ namespace osu.Game.Screens.Select
|
||||
scrollableContent.Add(panel);
|
||||
}
|
||||
}
|
||||
SelectGroup(groups.FirstOrDefault(), groups.First().BeatmapPanels.FirstOrDefault());
|
||||
|
||||
}
|
||||
|
||||
private static float offsetX(float dist, float halfHeight)
|
||||
@@ -344,7 +348,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public void SelectNext(int direction = 1, bool skipDifficulties = true)
|
||||
{
|
||||
if (!skipDifficulties)
|
||||
if (!skipDifficulties && SelectedGroup != null)
|
||||
{
|
||||
int i = SelectedGroup.BeatmapPanels.IndexOf(SelectedPanel) + direction;
|
||||
|
||||
|
||||
@@ -0,0 +1,152 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Screens.Select.Options
|
||||
{
|
||||
public class BeatmapOptionsButton : ClickableContainer
|
||||
{
|
||||
private static readonly float width = 130;
|
||||
|
||||
private Box background, flash;
|
||||
private TextAwesome iconText;
|
||||
private OsuSpriteText firstLine, secondLine;
|
||||
private Container box;
|
||||
|
||||
public Color4 ButtonColour
|
||||
{
|
||||
get { return background.Colour; }
|
||||
set { background.Colour = value; }
|
||||
}
|
||||
|
||||
public FontAwesome Icon
|
||||
{
|
||||
get { return iconText.Icon; }
|
||||
set { iconText.Icon = value; }
|
||||
}
|
||||
|
||||
public string FirstLineText
|
||||
{
|
||||
get { return firstLine.Text; }
|
||||
set { firstLine.Text = value; }
|
||||
}
|
||||
|
||||
public string SecondLineText
|
||||
{
|
||||
get { return secondLine.Text; }
|
||||
set { secondLine.Text = value; }
|
||||
}
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
flash.FadeTo(0.1f, 1000, EasingTypes.OutQuint);
|
||||
return base.OnMouseDown(state, args);
|
||||
}
|
||||
|
||||
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||
{
|
||||
flash.FadeTo(0, 1000, EasingTypes.OutQuint);
|
||||
return base.OnMouseUp(state, args);
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
flash.ClearTransforms();
|
||||
flash.Alpha = 0.9f;
|
||||
flash.FadeOut(800, EasingTypes.OutExpo);
|
||||
|
||||
return base.OnClick(state);
|
||||
}
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
|
||||
|
||||
public BeatmapOptionsButton()
|
||||
{
|
||||
Width = width;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
box = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Shear = new Vector2(0.2f, 0f),
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = Color4.Black.Opacity(0.2f),
|
||||
Roundness = 5,
|
||||
Radius = 8,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
EdgeSmoothness = new Vector2(1.5f, 0),
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
flash = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
EdgeSmoothness = new Vector2(1.5f, 0),
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
Colour = Color4.White,
|
||||
Alpha = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Down,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
iconText = new TextAwesome
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
TextSize = 30,
|
||||
Shadow = true,
|
||||
Icon = FontAwesome.fa_close,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Bottom = 5,
|
||||
},
|
||||
},
|
||||
firstLine = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Font = @"Exo2.0-Bold",
|
||||
Text = @"",
|
||||
},
|
||||
secondLine = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Font = @"Exo2.0-Bold",
|
||||
Text = @"",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Select.Options
|
||||
{
|
||||
public class BeatmapOptionsClearLocalScoresButton : BeatmapOptionsButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
{
|
||||
ButtonColour = colour.Purple;
|
||||
}
|
||||
|
||||
public BeatmapOptionsClearLocalScoresButton()
|
||||
{
|
||||
Icon = FontAwesome.fa_eraser;
|
||||
FirstLineText = @"Clear";
|
||||
SecondLineText = @"local scores";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Select.Options
|
||||
{
|
||||
public class BeatmapOptionsDeleteButton : BeatmapOptionsButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
{
|
||||
ButtonColour = colour.Pink;
|
||||
}
|
||||
|
||||
public BeatmapOptionsDeleteButton()
|
||||
{
|
||||
Icon = FontAwesome.fa_trash;
|
||||
FirstLineText = @"Delete";
|
||||
SecondLineText = @"Beatmap";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Select.Options
|
||||
{
|
||||
public class BeatmapOptionsEditButton : BeatmapOptionsButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
{
|
||||
ButtonColour = colour.Yellow;
|
||||
}
|
||||
|
||||
public BeatmapOptionsEditButton()
|
||||
{
|
||||
Icon = FontAwesome.fa_pencil;
|
||||
FirstLineText = @"Edit";
|
||||
SecondLineText = @"Beatmap";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
// Copyright (c) 2007-2017 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 System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Select.Options
|
||||
{
|
||||
public class BeatmapOptionsOverlay : FocusedOverlayContainer
|
||||
{
|
||||
private const float transition_duration = 500;
|
||||
private const float x_position = 290;
|
||||
|
||||
private const float height = 100;
|
||||
|
||||
private Box holder;
|
||||
private FillFlowContainer<BeatmapOptionsButton> buttonsContainer;
|
||||
|
||||
public Action OnRemoveFromUnplayed;
|
||||
public Action OnClearLocalScores;
|
||||
public Action OnEdit;
|
||||
public Action OnDelete;
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
if (buttonsContainer.Position.X >= DrawWidth || buttonsContainer.Alpha <= 0)
|
||||
buttonsContainer.MoveToX(-buttonsContainer.DrawWidth);
|
||||
|
||||
buttonsContainer.Alpha = 1;
|
||||
|
||||
holder.ScaleTo(new Vector2(1, 1), transition_duration / 2, EasingTypes.OutQuint);
|
||||
|
||||
buttonsContainer.MoveToX(x_position, transition_duration, EasingTypes.OutQuint);
|
||||
buttonsContainer.TransformSpacingTo(Vector2.Zero, transition_duration, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
holder.ScaleTo(new Vector2(1, 0), transition_duration / 2, EasingTypes.InSine);
|
||||
|
||||
buttonsContainer.MoveToX(DrawWidth, transition_duration, EasingTypes.InSine);
|
||||
buttonsContainer.TransformSpacingTo(new Vector2(200f, 0f), transition_duration, EasingTypes.InSine);
|
||||
|
||||
Delay(transition_duration);
|
||||
Schedule(() =>
|
||||
{
|
||||
if (State == Visibility.Hidden)
|
||||
buttonsContainer.Alpha = 0;
|
||||
});
|
||||
}
|
||||
|
||||
public BeatmapOptionsOverlay()
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Anchor = Anchor.BottomLeft;
|
||||
Origin = Anchor.BottomLeft;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
holder = new Box
|
||||
{
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Height = 0.5f,
|
||||
Scale = new Vector2(1, 0),
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
},
|
||||
buttonsContainer = new ButtonFlow
|
||||
{
|
||||
Height = height,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Children = new BeatmapOptionsButton[]
|
||||
{
|
||||
new BeatmapOptionsRemoveFromUnplayedButton
|
||||
{
|
||||
Action = () =>
|
||||
{
|
||||
Hide();
|
||||
OnRemoveFromUnplayed?.Invoke();
|
||||
},
|
||||
},
|
||||
new BeatmapOptionsClearLocalScoresButton
|
||||
{
|
||||
Action = () =>
|
||||
{
|
||||
Hide();
|
||||
OnClearLocalScores?.Invoke();
|
||||
},
|
||||
},
|
||||
new BeatmapOptionsEditButton
|
||||
{
|
||||
Action = () =>
|
||||
{
|
||||
Hide();
|
||||
OnEdit?.Invoke();
|
||||
},
|
||||
},
|
||||
new BeatmapOptionsDeleteButton
|
||||
{
|
||||
Action = () =>
|
||||
{
|
||||
Hide();
|
||||
OnDelete?.Invoke();
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
class ButtonFlow : FillFlowContainer<BeatmapOptionsButton>
|
||||
{
|
||||
protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer();
|
||||
protected override IEnumerable<BeatmapOptionsButton> FlowingChildren => base.FlowingChildren.Reverse();
|
||||
|
||||
public ButtonFlow()
|
||||
{
|
||||
Direction = FillDirection.Right;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Select.Options
|
||||
{
|
||||
public class BeatmapOptionsRemoveFromUnplayedButton : BeatmapOptionsButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
{
|
||||
ButtonColour = colour.Purple;
|
||||
}
|
||||
|
||||
public BeatmapOptionsRemoveFromUnplayedButton()
|
||||
{
|
||||
Icon = FontAwesome.fa_times_circle_o;
|
||||
FirstLineText = @"Remove";
|
||||
SecondLineText = @"from Unplayed";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,13 +27,15 @@ using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Overlays.Mods;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Screens.Select.Options;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class PlaySongSelect : OsuScreen
|
||||
{
|
||||
private Bindable<PlayMode> playMode;
|
||||
private Bindable<PlayMode> playMode = new Bindable<PlayMode>();
|
||||
private BeatmapDatabase database;
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
|
||||
|
||||
@@ -44,6 +46,8 @@ namespace osu.Game.Screens.Select
|
||||
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225);
|
||||
private BeatmapInfoWedge beatmapInfoWedge;
|
||||
|
||||
private ModSelectOverlay modSelect;
|
||||
|
||||
private static readonly Vector2 background_blur = new Vector2(20);
|
||||
private CancellationTokenSource initialAddSetsTask;
|
||||
|
||||
@@ -52,6 +56,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private List<BeatmapGroup> beatmapGroups;
|
||||
|
||||
private BeatmapOptionsOverlay beatmapOptions;
|
||||
private Footer footer;
|
||||
|
||||
OsuScreen player;
|
||||
@@ -75,7 +80,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, Framework.Game game,
|
||||
OsuGame osuGame, OsuColour colours)
|
||||
OsuGame osu, OsuColour colours)
|
||||
{
|
||||
const float carousel_width = 640;
|
||||
const float filter_height = 100;
|
||||
@@ -111,7 +116,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = filter_height,
|
||||
FilterChanged = filterChanged,
|
||||
FilterChanged = () => filterChanged(),
|
||||
Exit = Exit,
|
||||
},
|
||||
beatmapInfoWedge = new BeatmapInfoWedge
|
||||
@@ -125,6 +130,27 @@ namespace osu.Game.Screens.Select
|
||||
Right = 20,
|
||||
},
|
||||
},
|
||||
beatmapOptions = new BeatmapOptionsOverlay
|
||||
{
|
||||
OnRemoveFromUnplayed = null,
|
||||
OnClearLocalScores = null,
|
||||
OnEdit = null,
|
||||
OnDelete = promptDelete,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Bottom = 50,
|
||||
},
|
||||
},
|
||||
modSelect = new ModSelectOverlay
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Bottom = 50,
|
||||
},
|
||||
},
|
||||
footer = new Footer
|
||||
{
|
||||
OnBack = Exit,
|
||||
@@ -142,15 +168,13 @@ namespace osu.Game.Screens.Select
|
||||
},
|
||||
};
|
||||
|
||||
footer.AddButton(@"mods", colours.Yellow, null);
|
||||
footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility);
|
||||
footer.AddButton(@"random", colours.Green, carousel.SelectRandom);
|
||||
footer.AddButton(@"options", colours.Blue, null);
|
||||
footer.AddButton(@"options", colours.Blue, beatmapOptions.ToggleVisibility);
|
||||
|
||||
if (osuGame != null)
|
||||
{
|
||||
playMode = osuGame.PlayMode;
|
||||
playMode.ValueChanged += playMode_ValueChanged;
|
||||
}
|
||||
if (osu != null)
|
||||
playMode.BindTo(osu.PlayMode);
|
||||
playMode.ValueChanged += playMode_ValueChanged;
|
||||
|
||||
if (database == null)
|
||||
database = beatmaps;
|
||||
@@ -171,7 +195,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private ScheduledDelegate filterTask;
|
||||
|
||||
private void filterChanged()
|
||||
private void filterChanged(bool debounce = true, bool eagerSelection = true)
|
||||
{
|
||||
filterTask?.Cancel();
|
||||
filterTask = Scheduler.AddDelayed(() =>
|
||||
@@ -183,25 +207,42 @@ namespace osu.Game.Screens.Select
|
||||
foreach (var beatmapGroup in carousel)
|
||||
{
|
||||
var set = beatmapGroup.BeatmapSet;
|
||||
bool match = string.IsNullOrEmpty(search)
|
||||
|
||||
bool hasCurrentMode = set.Beatmaps.Any(bm => bm.Mode == playMode);
|
||||
|
||||
bool match = hasCurrentMode;
|
||||
|
||||
match &= string.IsNullOrEmpty(search)
|
||||
|| (set.Metadata.Artist ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1
|
||||
|| (set.Metadata.ArtistUnicode ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1
|
||||
|| (set.Metadata.Title ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1
|
||||
|| (set.Metadata.TitleUnicode ?? "").IndexOf(search, StringComparison.InvariantCultureIgnoreCase) != -1;
|
||||
|
||||
if (match)
|
||||
{
|
||||
beatmapGroup.State = BeatmapGroupState.Collapsed;
|
||||
if (newSelection == null || beatmapGroup.BeatmapSet.OnlineBeatmapSetID == Beatmap.BeatmapSetInfo.OnlineBeatmapSetID)
|
||||
{
|
||||
if (newSelection != null)
|
||||
newSelection.State = BeatmapGroupState.Collapsed;
|
||||
newSelection = beatmapGroup;
|
||||
}
|
||||
else
|
||||
beatmapGroup.State = BeatmapGroupState.Collapsed;
|
||||
}
|
||||
else
|
||||
{
|
||||
beatmapGroup.State = BeatmapGroupState.Hidden;
|
||||
}
|
||||
}
|
||||
|
||||
if (newSelection != null)
|
||||
carousel.SelectBeatmap(newSelection.BeatmapSet.Beatmaps[0], false);
|
||||
}, 250);
|
||||
{
|
||||
if (newSelection.BeatmapPanels.Any(b => b.Beatmap.ID == Beatmap.BeatmapInfo.ID))
|
||||
carousel.SelectBeatmap(Beatmap.BeatmapInfo, false);
|
||||
else if (eagerSelection)
|
||||
carousel.SelectBeatmap(newSelection.BeatmapSet.Beatmaps[0], false);
|
||||
}
|
||||
}, debounce ? 250 : 0);
|
||||
}
|
||||
|
||||
private void onBeatmapSetAdded(BeatmapSetInfo s) => Schedule(() => addBeatmapSet(s, Game, true));
|
||||
@@ -262,8 +303,6 @@ namespace osu.Game.Screens.Select
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
if (playMode != null)
|
||||
playMode.ValueChanged -= playMode_ValueChanged;
|
||||
|
||||
database.BeatmapSetAdded -= onBeatmapSetAdded;
|
||||
database.BeatmapSetRemoved -= onBeatmapSetRemoved;
|
||||
@@ -273,6 +312,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private void playMode_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
filterChanged(false);
|
||||
}
|
||||
|
||||
private void changeBackground(WorkingBeatmap beatmap)
|
||||
@@ -358,6 +398,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
carousel.AddGroup(group);
|
||||
|
||||
filterChanged(false, false);
|
||||
|
||||
if (Beatmap == null || select)
|
||||
carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
|
||||
else
|
||||
@@ -391,7 +433,12 @@ namespace osu.Game.Screens.Select
|
||||
if (token.IsCancellationRequested) return;
|
||||
addBeatmapSet(beatmapSet, game);
|
||||
}
|
||||
filterChanged();
|
||||
}
|
||||
|
||||
private void promptDelete()
|
||||
{
|
||||
if (Beatmap != null)
|
||||
dialogOverlay?.Push(new BeatmapDeleteDialog(Beatmap));
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
@@ -404,9 +451,7 @@ namespace osu.Game.Screens.Select
|
||||
case Key.Delete:
|
||||
if (state.Keyboard.ShiftPressed)
|
||||
{
|
||||
if (Beatmap != null)
|
||||
dialogOverlay?.Push(new BeatmapDeleteDialog(Beatmap));
|
||||
|
||||
promptDelete();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Platform;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.Screens.Tournament.Components
|
||||
{
|
||||
public class DrawingsConfigManager : ConfigManager<DrawingsConfig>
|
||||
{
|
||||
public override string Filename => @"drawings.ini";
|
||||
|
||||
protected override void InitialiseDefaults()
|
||||
{
|
||||
Set(DrawingsConfig.Groups, 8, 1, 8);
|
||||
Set(DrawingsConfig.TeamsPerGroup, 8, 1, 8);
|
||||
}
|
||||
|
||||
public DrawingsConfigManager(Storage storage)
|
||||
: base(storage)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
public enum DrawingsConfig
|
||||
{
|
||||
Groups,
|
||||
TeamsPerGroup
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Batches;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.OpenGL;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Shaders;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Framework.Timing;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace osu.Game.Screens.Tournament.Components
|
||||
{
|
||||
class VisualiserContainer : Container
|
||||
{
|
||||
/// <summary>
|
||||
/// Number of lines in the visualiser.
|
||||
/// </summary>
|
||||
public int Lines
|
||||
{
|
||||
get { return allLines.Count; }
|
||||
set
|
||||
{
|
||||
while (value > allLines.Count)
|
||||
addLine();
|
||||
|
||||
while (value < allLines.Count)
|
||||
removeLine();
|
||||
}
|
||||
}
|
||||
|
||||
private List<VisualiserLine> allLines = new List<VisualiserLine>();
|
||||
|
||||
private float offset;
|
||||
|
||||
private void addLine()
|
||||
{
|
||||
VisualiserLine newLine = new VisualiserLine()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
||||
Offset = offset,
|
||||
CycleTime = RNG.Next(10000, 12000),
|
||||
};
|
||||
|
||||
allLines.Add(newLine);
|
||||
Add(newLine);
|
||||
|
||||
offset += RNG.Next(100, 5000);
|
||||
}
|
||||
|
||||
private void removeLine()
|
||||
{
|
||||
if (allLines.Count == 0)
|
||||
return;
|
||||
|
||||
Remove(allLines.First());
|
||||
allLines.Remove(allLines.First());
|
||||
}
|
||||
|
||||
class VisualiserLine : Container
|
||||
{
|
||||
/// <summary>
|
||||
/// Time offset.
|
||||
/// </summary>
|
||||
public float Offset;
|
||||
|
||||
public double CycleTime;
|
||||
|
||||
private float leftPos => -(float)((Time.Current + Offset) / CycleTime) + expiredCount;
|
||||
|
||||
private Texture texture;
|
||||
|
||||
private int expiredCount = 0;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
texture = textures.Get("Drawings/visualiser-line");
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
while (Children.Count() < 3)
|
||||
addLine();
|
||||
|
||||
float pos = leftPos;
|
||||
|
||||
foreach (var c in Children)
|
||||
{
|
||||
if (c.Position.X < -1)
|
||||
{
|
||||
c.ClearTransforms();
|
||||
c.Expire();
|
||||
expiredCount++;
|
||||
}
|
||||
else
|
||||
c.MoveToX(pos, 100);
|
||||
|
||||
pos += 1;
|
||||
}
|
||||
}
|
||||
|
||||
private void addLine()
|
||||
{
|
||||
Add(new Sprite()
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
|
||||
RelativePositionAxes = Axes.Both,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
||||
Texture = texture,
|
||||
|
||||
X = leftPos + 1
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
// Copyright (c) 2007-2017 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 System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Tournament.Components;
|
||||
using osu.Game.Screens.Tournament.Teams;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Tournament
|
||||
{
|
||||
public class Drawings : OsuScreen
|
||||
{
|
||||
private const string results_filename = "drawings_results.txt";
|
||||
|
||||
internal override bool ShowOverlays => false;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
||||
|
||||
private ScrollingTeamContainer teamsContainer;
|
||||
private GroupContainer groupsContainer;
|
||||
private OsuSpriteText fullTeamNameText;
|
||||
|
||||
private List<Team> allTeams = new List<Team>();
|
||||
|
||||
private DrawingsConfigManager drawingsConfig;
|
||||
|
||||
private Task writeOp;
|
||||
|
||||
private Storage storage;
|
||||
|
||||
public ITeamList TeamList;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures, Storage storage)
|
||||
{
|
||||
this.storage = storage;
|
||||
|
||||
if (TeamList == null)
|
||||
TeamList = new StorageBackedTeamList(storage);
|
||||
|
||||
if (!TeamList.Teams.Any())
|
||||
{
|
||||
Exit();
|
||||
return;
|
||||
}
|
||||
|
||||
drawingsConfig = new DrawingsConfigManager(storage);
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(77, 77, 77, 255)
|
||||
},
|
||||
new Sprite
|
||||
{
|
||||
FillMode = FillMode.Fill,
|
||||
Texture = textures.Get(@"Backgrounds/Drawings/background.png")
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Right,
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
// Main container
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.85f,
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
// Visualiser
|
||||
new VisualiserContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Size = new Vector2(1, 10),
|
||||
|
||||
Colour = new Color4(255, 204, 34, 255),
|
||||
|
||||
Lines = 6
|
||||
},
|
||||
// Groups
|
||||
groupsContainer = new GroupContainer(drawingsConfig.Get<int>(DrawingsConfig.Groups), drawingsConfig.Get<int>(DrawingsConfig.TeamsPerGroup))
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Top = 35f,
|
||||
Bottom = 35f
|
||||
}
|
||||
},
|
||||
// Scrolling teams
|
||||
teamsContainer = new ScrollingTeamContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
// Scrolling team name
|
||||
fullTeamNameText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
Position = new Vector2(0, 45f),
|
||||
|
||||
Alpha = 0,
|
||||
|
||||
Font = "Exo2.0-Light",
|
||||
TextSize = 42f
|
||||
}
|
||||
}
|
||||
},
|
||||
// Control panel container
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.15f,
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(54, 54, 54, 255)
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
Text = "Control Panel",
|
||||
TextSize = 22f,
|
||||
Font = "Exo2.0-Boldd"
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = 0.75f,
|
||||
|
||||
Position = new Vector2(0, 35f),
|
||||
|
||||
Direction = FillDirection.Down,
|
||||
Spacing = new Vector2(0, 5f),
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
Text = "Begin random",
|
||||
Action = teamsContainer.StartScrolling,
|
||||
},
|
||||
new OsuButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
Text = "Stop random",
|
||||
Action = teamsContainer.StopScrolling,
|
||||
},
|
||||
new OsuButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
Text = "Reload",
|
||||
Action = reloadTeams
|
||||
}
|
||||
}
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = 0.75f,
|
||||
|
||||
Position = new Vector2(0, -5f),
|
||||
|
||||
Direction = FillDirection.Down,
|
||||
Spacing = new Vector2(0, 5f),
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
||||
Text = "Reset",
|
||||
Action = () => reset(false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
teamsContainer.OnSelected += onTeamSelected;
|
||||
teamsContainer.OnScrollStarted += () => fullTeamNameText.FadeOut(200);
|
||||
|
||||
reset(true);
|
||||
}
|
||||
|
||||
private void onTeamSelected(Team team)
|
||||
{
|
||||
groupsContainer.AddTeam(team);
|
||||
|
||||
fullTeamNameText.Text = team.FullName;
|
||||
fullTeamNameText.FadeIn(200);
|
||||
|
||||
writeResults(groupsContainer.GetStringRepresentation());
|
||||
}
|
||||
|
||||
private void writeResults(string text)
|
||||
{
|
||||
Action writeAction = () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
// Write to drawings_results
|
||||
using (Stream stream = storage.GetStream(results_filename, FileAccess.Write, FileMode.Create))
|
||||
using (StreamWriter sw = new StreamWriter(stream))
|
||||
{
|
||||
sw.Write(text);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex, "Failed to write results.");
|
||||
}
|
||||
};
|
||||
|
||||
if (writeOp == null)
|
||||
writeOp = Task.Run(writeAction);
|
||||
else
|
||||
writeOp = writeOp.ContinueWith(t => { writeAction(); });
|
||||
}
|
||||
|
||||
private void reloadTeams()
|
||||
{
|
||||
teamsContainer.ClearTeams();
|
||||
allTeams.Clear();
|
||||
|
||||
foreach (Team t in TeamList.Teams)
|
||||
{
|
||||
if (groupsContainer.ContainsTeam(t.FullName))
|
||||
continue;
|
||||
|
||||
allTeams.Add(t);
|
||||
teamsContainer.AddTeam(t);
|
||||
}
|
||||
}
|
||||
|
||||
private void reset(bool loadLastResults = false)
|
||||
{
|
||||
groupsContainer.ClearTeams();
|
||||
|
||||
reloadTeams();
|
||||
|
||||
if (loadLastResults)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Read from drawings_results
|
||||
using (Stream stream = storage.GetStream(results_filename, FileAccess.Read, FileMode.Open))
|
||||
using (StreamReader sr = new StreamReader(stream))
|
||||
{
|
||||
string line;
|
||||
while ((line = sr.ReadLine()?.Trim()) != null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(line))
|
||||
continue;
|
||||
|
||||
if (line.ToUpper().StartsWith("GROUP"))
|
||||
continue;
|
||||
|
||||
Team teamToAdd = allTeams.FirstOrDefault(t => t.FullName == line);
|
||||
|
||||
if (teamToAdd == null)
|
||||
continue;
|
||||
|
||||
groupsContainer.AddTeam(teamToAdd);
|
||||
teamsContainer.RemoveTeam(teamToAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex, "Failed to read last drawings results.");
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
writeResults(string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Screens.Tournament.Teams;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Tournament
|
||||
{
|
||||
public class Group : Container
|
||||
{
|
||||
public readonly string GroupName;
|
||||
|
||||
public int TeamsCount { get; private set; }
|
||||
|
||||
private FlowContainer<GroupTeam> teams;
|
||||
|
||||
private List<GroupTeam> allTeams = new List<GroupTeam>();
|
||||
|
||||
public Group(string name)
|
||||
{
|
||||
GroupName = name;
|
||||
|
||||
Size = new Vector2(176, 128);
|
||||
|
||||
Masking = true;
|
||||
CornerRadius = 4;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = new Color4(54, 54, 54, 255)
|
||||
},
|
||||
// Group name
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
Position = new Vector2(0, 7f),
|
||||
|
||||
Text = $"GROUP {name.ToUpper()}",
|
||||
TextSize = 8f,
|
||||
Font = @"Exo2.0-Bold",
|
||||
Colour = new Color4(255, 204, 34, 255),
|
||||
},
|
||||
teams = new FillFlowContainer<GroupTeam>
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
||||
Spacing = new Vector2(6f, 22),
|
||||
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Top = 21f,
|
||||
Bottom = 7f,
|
||||
Left = 7f,
|
||||
Right = 7f
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public void AddTeam(Team team)
|
||||
{
|
||||
GroupTeam gt = new GroupTeam(team);
|
||||
|
||||
if (TeamsCount < 8)
|
||||
{
|
||||
teams.Add(gt);
|
||||
allTeams.Add(gt);
|
||||
|
||||
TeamsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ContainsTeam(string fullName)
|
||||
{
|
||||
return allTeams.Any(t => t.Team.FullName == fullName);
|
||||
}
|
||||
|
||||
public bool RemoveTeam(Team team)
|
||||
{
|
||||
allTeams.RemoveAll(gt => gt.Team == team);
|
||||
|
||||
if (teams.RemoveAll(gt => gt.Team == team) > 0)
|
||||
{
|
||||
TeamsCount--;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void ClearTeams()
|
||||
{
|
||||
allTeams.Clear();
|
||||
teams.Clear();
|
||||
|
||||
TeamsCount = 0;
|
||||
}
|
||||
|
||||
public string GetStringRepresentation()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (GroupTeam gt in allTeams)
|
||||
sb.AppendLine(gt.Team.FullName);
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
class GroupTeam : Container
|
||||
{
|
||||
public Team Team;
|
||||
|
||||
private FillFlowContainer innerContainer;
|
||||
private Sprite flagSprite;
|
||||
|
||||
public GroupTeam(Team team)
|
||||
{
|
||||
Team = team;
|
||||
|
||||
Width = 36;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
innerContainer = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
|
||||
Direction = FillDirection.Down,
|
||||
Spacing = new Vector2(0, 5f),
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
flagSprite = new Sprite
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
FillMode = FillMode.Fit
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
Text = team.Acronym.ToUpper(),
|
||||
TextSize = 10f,
|
||||
Font = @"Exo2.0-Bold"
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
innerContainer.ScaleTo(1.5f);
|
||||
innerContainer.ScaleTo(1f, 200);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Screens.Tournament.Teams;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Screens.Tournament
|
||||
{
|
||||
public class GroupContainer : Container
|
||||
{
|
||||
private List<Group> groups = new List<Group>();
|
||||
|
||||
private int maxTeams;
|
||||
private int currentGroup;
|
||||
|
||||
public GroupContainer(int numGroups, int teamsPerGroup)
|
||||
{
|
||||
FlowContainer<Group> bottomGroups;
|
||||
FlowContainer<Group> topGroups;
|
||||
|
||||
maxTeams = teamsPerGroup;
|
||||
|
||||
char nextGroupName = 'A';
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
topGroups = new FillFlowContainer<Group>
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
|
||||
AutoSizeAxes = Axes.Both,
|
||||
|
||||
Spacing = new Vector2(7f, 0)
|
||||
},
|
||||
bottomGroups = new FillFlowContainer<Group>
|
||||
{
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
|
||||
AutoSizeAxes = Axes.Both,
|
||||
|
||||
Spacing = new Vector2(7f, 0)
|
||||
}
|
||||
};
|
||||
|
||||
for (int i = 0; i < numGroups; i++)
|
||||
{
|
||||
Group g = new Group(nextGroupName.ToString());
|
||||
|
||||
groups.Add(g);
|
||||
nextGroupName++;
|
||||
|
||||
if (i < (int)Math.Ceiling(numGroups / 2f))
|
||||
topGroups.Add(g);
|
||||
else
|
||||
bottomGroups.Add(g);
|
||||
}
|
||||
}
|
||||
|
||||
public void AddTeam(Team team)
|
||||
{
|
||||
if (groups[currentGroup].TeamsCount == maxTeams)
|
||||
return;
|
||||
|
||||
groups[currentGroup].AddTeam(team);
|
||||
|
||||
currentGroup = (currentGroup + 1) % groups.Count;
|
||||
}
|
||||
|
||||
public bool ContainsTeam(string fullName)
|
||||
{
|
||||
return groups.Any(g => g.ContainsTeam(fullName));
|
||||
}
|
||||
|
||||
public void ClearTeams()
|
||||
{
|
||||
foreach (Group g in groups)
|
||||
g.ClearTeams();
|
||||
|
||||
currentGroup = 0;
|
||||
}
|
||||
|
||||
public string GetStringRepresentation()
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
foreach (Group g in groups)
|
||||
{
|
||||
if (g != groups.First())
|
||||
sb.AppendLine();
|
||||
sb.AppendLine($"Group {g.GroupName}");
|
||||
sb.Append(g.GetStringRepresentation());
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,379 @@
|
||||
// Copyright (c) 2007-2017 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 System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Screens.Tournament.Teams;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Tournament
|
||||
{
|
||||
public class ScrollingTeamContainer : Container
|
||||
{
|
||||
public event Action OnScrollStarted;
|
||||
public event Action<Team> OnSelected;
|
||||
|
||||
private readonly List<Team> availableTeams = new List<Team>();
|
||||
|
||||
private Container tracker;
|
||||
|
||||
private float speed;
|
||||
private int expiredCount;
|
||||
|
||||
private float offset;
|
||||
private float timeOffset;
|
||||
private float leftPos => offset + timeOffset + expiredCount * ScrollingTeam.WIDTH;
|
||||
|
||||
private double lastTime;
|
||||
|
||||
private ScheduledDelegate delayedStateChangeDelegate;
|
||||
|
||||
public ScrollingTeamContainer()
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
tracker = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
AutoSizeAxes = Axes.Both,
|
||||
|
||||
Masking = true,
|
||||
CornerRadius = 10f,
|
||||
Alpha = 0,
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Size = new Vector2(2, 55),
|
||||
|
||||
ColourInfo = ColourInfo.GradientVertical(Color4.Transparent, Color4.White)
|
||||
},
|
||||
new Box
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Size = new Vector2(2, 55),
|
||||
|
||||
ColourInfo = ColourInfo.GradientVertical(Color4.White, Color4.Transparent)
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private ScrollState _scrollState;
|
||||
private ScrollState scrollState
|
||||
{
|
||||
get { return _scrollState; }
|
||||
set
|
||||
{
|
||||
if (_scrollState == value)
|
||||
return;
|
||||
|
||||
_scrollState = value;
|
||||
|
||||
delayedStateChangeDelegate?.Cancel();
|
||||
|
||||
switch (value)
|
||||
{
|
||||
case ScrollState.Scrolling:
|
||||
resetSelected();
|
||||
|
||||
OnScrollStarted?.Invoke();
|
||||
|
||||
speedTo(1000f, 200);
|
||||
tracker.FadeOut(100);
|
||||
break;
|
||||
case ScrollState.Stopping:
|
||||
speedTo(0f, 2000);
|
||||
tracker.FadeIn(200);
|
||||
|
||||
delayedStateChangeDelegate = Delay(2300).Schedule(() => scrollState = ScrollState.Stopped);
|
||||
break;
|
||||
case ScrollState.Stopped:
|
||||
// Find closest to center
|
||||
Drawable closest = null;
|
||||
foreach (var c in Children)
|
||||
{
|
||||
if (!(c is ScrollingTeam))
|
||||
continue;
|
||||
|
||||
if (closest == null)
|
||||
{
|
||||
closest = c;
|
||||
continue;
|
||||
}
|
||||
|
||||
float offset = Math.Abs(c.Position.X + c.DrawWidth / 2f - DrawWidth / 2f);
|
||||
float lastOffset = Math.Abs(closest.Position.X + closest.DrawWidth / 2f - DrawWidth / 2f);
|
||||
|
||||
if (offset < lastOffset)
|
||||
closest = c;
|
||||
}
|
||||
|
||||
offset += DrawWidth / 2f - (closest.Position.X + closest.DrawWidth / 2f);
|
||||
|
||||
ScrollingTeam st = closest as ScrollingTeam;
|
||||
|
||||
availableTeams.RemoveAll(at => at == st.Team);
|
||||
|
||||
st.Selected = true;
|
||||
OnSelected?.Invoke(st.Team);
|
||||
|
||||
delayedStateChangeDelegate = Delay(10000).Schedule(() => scrollState = ScrollState.Idle);
|
||||
break;
|
||||
case ScrollState.Idle:
|
||||
resetSelected();
|
||||
|
||||
OnScrollStarted?.Invoke();
|
||||
|
||||
speedTo(40f, 200);
|
||||
tracker.FadeOut(100);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void AddTeam(Team team)
|
||||
{
|
||||
if (availableTeams.Contains(team))
|
||||
return;
|
||||
|
||||
availableTeams.Add(team);
|
||||
|
||||
RemoveAll(c => c is ScrollingTeam);
|
||||
scrollState = ScrollState.Idle;
|
||||
}
|
||||
|
||||
public void AddTeams(IEnumerable<Team> teams)
|
||||
{
|
||||
if (teams == null)
|
||||
return;
|
||||
|
||||
foreach (Team t in teams)
|
||||
AddTeam(t);
|
||||
}
|
||||
|
||||
public void ClearTeams()
|
||||
{
|
||||
availableTeams.Clear();
|
||||
RemoveAll(c => c is ScrollingTeam);
|
||||
scrollState = ScrollState.Idle;
|
||||
}
|
||||
|
||||
public void RemoveTeam(Team team)
|
||||
{
|
||||
availableTeams.Remove(team);
|
||||
|
||||
foreach (var c in Children)
|
||||
{
|
||||
ScrollingTeam st = c as ScrollingTeam;
|
||||
|
||||
if (st == null)
|
||||
continue;
|
||||
|
||||
if (st.Team == team)
|
||||
{
|
||||
st.FadeOut(200);
|
||||
st.Expire();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void StartScrolling()
|
||||
{
|
||||
if (availableTeams.Count == 0)
|
||||
return;
|
||||
|
||||
scrollState = ScrollState.Scrolling;
|
||||
}
|
||||
|
||||
public void StopScrolling()
|
||||
{
|
||||
if (availableTeams.Count == 0)
|
||||
return;
|
||||
|
||||
switch (scrollState)
|
||||
{
|
||||
case ScrollState.Stopped:
|
||||
case ScrollState.Idle:
|
||||
return;
|
||||
}
|
||||
|
||||
scrollState = ScrollState.Stopping;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
scrollState = ScrollState.Idle;
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
timeOffset -= (float)(Time.Current - lastTime) / 1000 * speed;
|
||||
lastTime = Time.Current;
|
||||
|
||||
if (availableTeams.Count > 0)
|
||||
{
|
||||
// Fill more than required to account for transformation + scrolling speed
|
||||
while (Children.Count(c => c is ScrollingTeam) < DrawWidth * 2 / ScrollingTeam.WIDTH)
|
||||
addFlags();
|
||||
}
|
||||
|
||||
float pos = leftPos;
|
||||
|
||||
foreach (var c in Children)
|
||||
{
|
||||
if (!(c is ScrollingTeam))
|
||||
continue;
|
||||
|
||||
if (c.Position.X + c.DrawWidth < 0)
|
||||
{
|
||||
c.ClearTransforms();
|
||||
c.Expire();
|
||||
expiredCount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
c.MoveToX(pos, 100);
|
||||
c.FadeTo(1.0f - Math.Abs(pos - DrawWidth / 2f) / (DrawWidth / 2.5f), 100);
|
||||
}
|
||||
|
||||
pos += ScrollingTeam.WIDTH;
|
||||
}
|
||||
}
|
||||
|
||||
private void addFlags()
|
||||
{
|
||||
for (int i = 0; i < availableTeams.Count; i++)
|
||||
{
|
||||
Add(new ScrollingTeam(availableTeams[i])
|
||||
{
|
||||
X = leftPos + DrawWidth
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private void resetSelected()
|
||||
{
|
||||
foreach (var c in Children)
|
||||
{
|
||||
ScrollingTeam st = c as ScrollingTeam;
|
||||
if (st == null)
|
||||
continue;
|
||||
|
||||
if (st.Selected)
|
||||
{
|
||||
st.Selected = false;
|
||||
RemoveTeam(st.Team);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void speedTo(float value, double duration = 0, EasingTypes easing = EasingTypes.None)
|
||||
{
|
||||
DelayReset();
|
||||
|
||||
UpdateTransformsOfType(typeof(TransformScrollSpeed));
|
||||
TransformFloatTo(speed, value, duration, easing, new TransformScrollSpeed());
|
||||
}
|
||||
|
||||
enum ScrollState
|
||||
{
|
||||
None,
|
||||
Idle,
|
||||
Stopping,
|
||||
Stopped,
|
||||
Scrolling
|
||||
}
|
||||
|
||||
public class TransformScrollSpeed : TransformFloat
|
||||
{
|
||||
public override void Apply(Drawable d)
|
||||
{
|
||||
base.Apply(d);
|
||||
(d as ScrollingTeamContainer).speed = CurrentValue;
|
||||
}
|
||||
}
|
||||
|
||||
public class ScrollingTeam : Container
|
||||
{
|
||||
public const float WIDTH = 58;
|
||||
public const float HEIGHT = 41;
|
||||
|
||||
public Team Team;
|
||||
|
||||
private Sprite flagSprite;
|
||||
private Box outline;
|
||||
|
||||
private bool selected;
|
||||
public bool Selected
|
||||
{
|
||||
get { return selected; }
|
||||
set
|
||||
{
|
||||
selected = value;
|
||||
|
||||
if (selected)
|
||||
outline.FadeIn(100);
|
||||
else
|
||||
outline.FadeOut(100);
|
||||
}
|
||||
}
|
||||
|
||||
public ScrollingTeam(Team team)
|
||||
{
|
||||
Team = team;
|
||||
|
||||
Anchor = Anchor.CentreLeft;
|
||||
Origin = Anchor.CentreLeft;
|
||||
|
||||
Size = new Vector2(WIDTH, HEIGHT);
|
||||
Masking = true;
|
||||
CornerRadius = 8f;
|
||||
|
||||
Alpha = 0;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
outline = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0
|
||||
},
|
||||
flagSprite = new Sprite
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
||||
Size = new Vector2(WIDTH, HEIGHT) - new Vector2(8)
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
flagSprite.Texture = textures.Get($@"Flags/{Team.FlagName}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Screens.Tournament.Teams
|
||||
{
|
||||
public interface ITeamList
|
||||
{
|
||||
IEnumerable<Team> Teams { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// Copyright (c) 2007-2017 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 System.IO;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Framework.Platform;
|
||||
|
||||
namespace osu.Game.Screens.Tournament.Teams
|
||||
{
|
||||
public class StorageBackedTeamList : ITeamList
|
||||
{
|
||||
private const string teams_filename = "drawings.txt";
|
||||
|
||||
private Storage storage;
|
||||
|
||||
public StorageBackedTeamList(Storage storage)
|
||||
{
|
||||
this.storage = storage;
|
||||
}
|
||||
|
||||
public IEnumerable<Team> Teams
|
||||
{
|
||||
get
|
||||
{
|
||||
var teams = new List<Team>();
|
||||
|
||||
try
|
||||
{
|
||||
using (Stream stream = storage.GetStream(teams_filename, FileAccess.Read, FileMode.Open))
|
||||
using (StreamReader sr = new StreamReader(stream))
|
||||
{
|
||||
while (sr.Peek() != -1)
|
||||
{
|
||||
string line = sr.ReadLine().Trim();
|
||||
|
||||
if (string.IsNullOrEmpty(line))
|
||||
continue;
|
||||
|
||||
string[] split = line.Split(':');
|
||||
|
||||
if (split.Length < 2)
|
||||
{
|
||||
Logger.Log($"Invalid team definition: {line}. Expected \"flag_name : team_name : team_acronym\".");
|
||||
continue;
|
||||
}
|
||||
|
||||
string flagName = split[0].Trim();
|
||||
string teamName = split[1].Trim();
|
||||
|
||||
string acronym = split.Length >= 3 ? split[2].Trim() : teamName;
|
||||
acronym = acronym.Substring(0, Math.Min(3, acronym.Length));
|
||||
|
||||
teams.Add(new Team()
|
||||
{
|
||||
FlagName = flagName,
|
||||
FullName = teamName,
|
||||
Acronym = acronym
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.Error(ex, "Failed to read teams.");
|
||||
}
|
||||
|
||||
return teams;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Screens.Tournament.Teams
|
||||
{
|
||||
public class Team
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of this team.
|
||||
/// </summary>
|
||||
public string FullName;
|
||||
|
||||
/// <summary>
|
||||
/// Short acronym which appears in the group boxes post-selection.
|
||||
/// </summary>
|
||||
public string Acronym;
|
||||
|
||||
/// <summary>
|
||||
/// Two-letter flag acronym (ISO 3166 standard)
|
||||
/// </summary>
|
||||
public string FlagName;
|
||||
}
|
||||
}
|
||||
+31
-10
@@ -156,7 +156,6 @@
|
||||
<Compile Include="Screens\Select\CarouselContainer.cs" />
|
||||
<Compile Include="Screens\Select\MatchSongSelect.cs" />
|
||||
<Compile Include="Screens\OsuGameScreen.cs" />
|
||||
<Compile Include="Screens\Play\ModSelect.cs" />
|
||||
<Compile Include="Beatmaps\Drawables\BeatmapGroup.cs" />
|
||||
<Compile Include="Beatmaps\Drawables\BeatmapPanel.cs" />
|
||||
<Compile Include="Screens\Play\Player.cs" />
|
||||
@@ -211,6 +210,15 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Screens\Select\BeatmapInfoWedge.cs" />
|
||||
<Compile Include="Screens\Select\WedgeBackground.cs" />
|
||||
<Compile Include="Screens\Tournament\Components\DrawingsConfigManager.cs" />
|
||||
<Compile Include="Screens\Tournament\Components\VisualiserContainer.cs" />
|
||||
<Compile Include="Screens\Tournament\Drawings.cs" />
|
||||
<Compile Include="Screens\Tournament\Group.cs" />
|
||||
<Compile Include="Screens\Tournament\GroupContainer.cs" />
|
||||
<Compile Include="Screens\Tournament\Teams\ITeamList.cs" />
|
||||
<Compile Include="Screens\Tournament\ScrollingTeamContainer.cs" />
|
||||
<Compile Include="Screens\Tournament\Teams\Team.cs" />
|
||||
<Compile Include="Screens\Tournament\Teams\StorageBackedTeamList.cs" />
|
||||
<Compile Include="Users\User.cs" />
|
||||
<Compile Include="Graphics\UserInterface\Volume\VolumeControl.cs" />
|
||||
<Compile Include="Database\BeatmapDatabase.cs" />
|
||||
@@ -274,12 +282,19 @@
|
||||
<Compile Include="Screens\Select\SearchTextBox.cs" />
|
||||
<Compile Include="Screens\Select\FooterButton.cs" />
|
||||
<Compile Include="Screens\Select\Footer.cs" />
|
||||
<Compile Include="Overlays\Pause\PauseOverlay.cs" />
|
||||
<Compile Include="Overlays\Pause\PauseProgressBar.cs" />
|
||||
<Compile Include="Overlays\Pause\PauseProgressGraph.cs" />
|
||||
<Compile Include="Overlays\Pause\ResumeButton.cs" />
|
||||
<Compile Include="Overlays\Pause\RetryButton.cs" />
|
||||
<Compile Include="Overlays\Pause\QuitButton.cs" />
|
||||
<Compile Include="Screens\Play\PauseOverlay.cs" />
|
||||
<Compile Include="Screens\Play\Pause\PauseProgressBar.cs" />
|
||||
<Compile Include="Screens\Play\Pause\PauseProgressGraph.cs" />
|
||||
<Compile Include="Screens\Play\Pause\ResumeButton.cs" />
|
||||
<Compile Include="Screens\Play\Pause\RetryButton.cs" />
|
||||
<Compile Include="Screens\Play\Pause\QuitButton.cs" />
|
||||
<Compile Include="Overlays\Mods\ModSelectOverlay.cs" />
|
||||
<Compile Include="Modes\Mod.cs" />
|
||||
<Compile Include="Overlays\Mods\ModButton.cs" />
|
||||
<Compile Include="Modes\UI\ModIcon.cs" />
|
||||
<Compile Include="Overlays\Mods\ModSection.cs" />
|
||||
<Compile Include="Overlays\Mods\DifficultyReductionSection.cs" />
|
||||
<Compile Include="Overlays\Mods\DifficultyIncreaseSection.cs" />
|
||||
<Compile Include="Overlays\Dialog\PopupDialog.cs" />
|
||||
<Compile Include="Graphics\UserInterface\DialogButton.cs" />
|
||||
<Compile Include="Overlays\Dialog\PopupDialogButton.cs" />
|
||||
@@ -287,6 +302,14 @@
|
||||
<Compile Include="Overlays\Dialog\PopupDialogCancelButton.cs" />
|
||||
<Compile Include="Screens\Select\BeatmapDeleteDialog.cs" />
|
||||
<Compile Include="Overlays\DialogOverlay.cs" />
|
||||
<Compile Include="Overlays\Mods\AssistedSection.cs" />
|
||||
<Compile Include="Overlays\WaveOverlayContainer.cs" />
|
||||
<Compile Include="Screens\Select\Options\BeatmapOptionsButton.cs" />
|
||||
<Compile Include="Screens\Select\Options\BeatmapOptionsClearLocalScoresButton.cs" />
|
||||
<Compile Include="Screens\Select\Options\BeatmapOptionsDeleteButton.cs" />
|
||||
<Compile Include="Screens\Select\Options\BeatmapOptionsEditButton.cs" />
|
||||
<Compile Include="Screens\Select\Options\BeatmapOptionsOverlay.cs" />
|
||||
<Compile Include="Screens\Select\Options\BeatmapOptionsRemoveFromUnplayedButton.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="$(SolutionDir)\osu-framework\osu.Framework\osu.Framework.csproj">
|
||||
@@ -307,9 +330,7 @@
|
||||
<ItemGroup />
|
||||
<ItemGroup />
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<Folder Include="Overlays\Dialog\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
Reference in New Issue
Block a user