mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 13:22:55 +08:00
Merge remote-tracking branch 'refs/remotes/ppy/master' into moarOptions
This commit is contained in:
commit
4888d8568c
@ -1 +1 @@
|
||||
Subproject commit 4c0762eec20d2a3063df908a49432326570bea9f
|
||||
Subproject commit 798409058a421307b5a92aeea4cd60a065f5a0d4
|
@ -1 +1 @@
|
||||
Subproject commit 51f2b9b37f38cd349a3dd728a78f8fffcb3a54f5
|
||||
Subproject commit 93eb5bf99bb642bf339d7dce09c2d946412dadd6
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
80
osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs
Normal file
80
osu.Desktop.VisualTests/Tests/TestCaseDialogOverlay.cs
Normal file
@ -0,0 +1,80 @@
|
||||
// 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.Overlays.Dialog;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
class TestCaseDialogOverlay : TestCase
|
||||
{
|
||||
public override string Name => @"Dialog Overlay";
|
||||
public override string Description => @"Display dialogs";
|
||||
|
||||
DialogOverlay overlay;
|
||||
|
||||
public override void Reset()
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
Add(overlay = new DialogOverlay());
|
||||
|
||||
AddButton("dialog #1", () => overlay.Push(new PopupDialog
|
||||
{
|
||||
Icon = FontAwesome.fa_trash_o,
|
||||
HeaderText = @"Confirm deletion of",
|
||||
BodyText = @"Ayase Rie - Yuima-ru*World TVver.",
|
||||
Buttons = new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = @"I never want to see this again.",
|
||||
Action = () => System.Console.WriteLine(@"OK"),
|
||||
},
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = @"Firetruck, I still want quick ranks!",
|
||||
Action = () => System.Console.WriteLine(@"Cancel"),
|
||||
},
|
||||
},
|
||||
}));
|
||||
|
||||
AddButton("dialog #2", () => overlay.Push(new PopupDialog
|
||||
{
|
||||
Icon = FontAwesome.fa_gear,
|
||||
HeaderText = @"What do you want to do with",
|
||||
BodyText = "Camellia as \"Bang Riot\" - Blastix Riotz",
|
||||
Buttons = new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = @"Manage collections",
|
||||
},
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = @"Delete...",
|
||||
},
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = @"Remove from unplayed",
|
||||
},
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = @"Clear local scores",
|
||||
},
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = @"Edit",
|
||||
},
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = @"Cancel",
|
||||
},
|
||||
},
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
94
osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs
Normal file
94
osu.Desktop.VisualTests/Tests/TestCaseDrawings.cs
Normal file
@ -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"
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -95,7 +95,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
AddButton(@"slider", () => load(HitObjectType.Slider));
|
||||
AddButton(@"spinner", () => load(HitObjectType.Spinner));
|
||||
|
||||
AddToggle(@"auto", () => { auto = !auto; load(mode); });
|
||||
AddToggle(@"auto", (state) => { auto = state; load(mode); });
|
||||
|
||||
ButtonsContainer.Add(new SpriteText { Text = "Playback Speed" });
|
||||
ButtonsContainer.Add(new BasicSliderBar<double>
|
||||
|
40
osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs
Normal file
40
osu.Desktop.VisualTests/Tests/TestCaseModSelectOverlay.cs
Normal file
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ using osu.Framework.Screens.Testing;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Timing;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
@ -30,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Anchor = Anchor.Centre
|
||||
};
|
||||
Add(mc);
|
||||
AddToggle(@"Show", mc.ToggleVisibility);
|
||||
AddToggle(@"Show", (state) => mc.State = state ? Visibility.Visible : Visibility.Hidden);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,6 +8,7 @@ using osu.Framework.MathUtils;
|
||||
using osu.Game.Overlays;
|
||||
using System.Linq;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
@ -30,7 +31,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Origin = Anchor.TopRight,
|
||||
});
|
||||
|
||||
AddToggle(@"show", manager.ToggleVisibility);
|
||||
AddToggle(@"show", (state) => manager.State = state ? Visibility.Visible : Visibility.Hidden);
|
||||
|
||||
AddButton(@"simple #1", sendNotification1);
|
||||
AddButton(@"simple #2", sendNotification2);
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -1,9 +1,11 @@
|
||||
// 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 osu.Desktop.VisualTests.Platform;
|
||||
using osu.Framework.Screens.Testing;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Modes;
|
||||
using osu.Game.Screens.Select;
|
||||
@ -14,6 +16,7 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
private BeatmapDatabase db, oldDb;
|
||||
private TestStorage storage;
|
||||
private PlaySongSelect songSelect;
|
||||
|
||||
public override string Name => @"Song Select";
|
||||
public override string Description => @"with fake data";
|
||||
@ -35,9 +38,15 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
|
||||
db.Import(sets);
|
||||
}
|
||||
Add(new PlaySongSelect());
|
||||
|
||||
Add(songSelect = new PlaySongSelect());
|
||||
|
||||
AddButton(@"Sort by Artist", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Artist; });
|
||||
AddButton(@"Sort by Title", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Title; });
|
||||
AddButton(@"Sort by Author", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Author; });
|
||||
AddButton(@"Sort by Difficulty", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Difficulty; });
|
||||
}
|
||||
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
if (oldDb != null)
|
||||
@ -59,9 +68,10 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
Metadata = new BeatmapMetadata
|
||||
{
|
||||
OnlineBeatmapSetID = 1234 + i,
|
||||
Artist = "MONACA",
|
||||
Title = "Black Song",
|
||||
Author = "Some Guy",
|
||||
// Create random metadata, then we can check if sorting works based on these
|
||||
Artist = "MONACA " + RNG.Next(0, 9),
|
||||
Title = "Black Song " + RNG.Next(0, 9),
|
||||
Author = "Some Guy " + RNG.Next(0, 9),
|
||||
},
|
||||
Beatmaps = new List<BeatmapInfo>(new[]
|
||||
{
|
||||
|
@ -22,9 +22,9 @@ namespace osu.Desktop.VisualTests.Tests
|
||||
{
|
||||
base.Reset();
|
||||
|
||||
FlowContainer flow;
|
||||
FillFlowContainer flow;
|
||||
|
||||
Add(flow = new FlowContainer()
|
||||
Add(flow = new FillFlowContainer()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(0.5f),
|
||||
|
@ -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,6 +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
|
||||
{
|
||||
@ -57,19 +58,19 @@ namespace osu.Desktop.Overlays
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
Spacing = new Vector2(5),
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Spacing = new Vector2(5),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
@ -95,6 +96,8 @@ namespace osu.Desktop.Overlays
|
||||
},
|
||||
new Sprite
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Texture = textures.Get(@"Menu/dev-build-footer"),
|
||||
},
|
||||
}
|
||||
@ -157,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)
|
||||
|
64
osu.Game.Modes.Catch/CatchMod.cs
Normal file
64
osu.Game.Modes.Catch/CatchMod.cs
Normal file
@ -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">
|
||||
|
155
osu.Game.Modes.Mania/ManiaMod.cs
Normal file
155
osu.Game.Modes.Mania/ManiaMod.cs
Normal file
@ -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">
|
||||
|
@ -13,7 +13,7 @@ using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
{
|
||||
public class HitExplosion : FlowContainer
|
||||
public class HitExplosion : FillFlowContainer
|
||||
{
|
||||
private readonly OsuJudgementInfo judgement;
|
||||
private SpriteText line1;
|
||||
@ -25,7 +25,7 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
Direction = FlowDirections.Vertical;
|
||||
Direction = FillDirection.Down;
|
||||
Spacing = new Vector2(0, 2);
|
||||
Position = (h?.StackedEndPosition ?? Vector2.Zero) + judgement.PositionOffset;
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Osu.Objects
|
||||
{
|
||||
public class HitCircle : OsuHitObject
|
||||
|
@ -1,4 +1,7 @@
|
||||
namespace osu.Game.Modes.Osu.Objects
|
||||
// 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.Osu.Objects
|
||||
{
|
||||
public class SliderTick : OsuHitObject
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Osu.Objects
|
||||
{
|
||||
public class Spinner : OsuHitObject
|
||||
|
96
osu.Game.Modes.Osu/OsuMod.cs
Normal file
96
osu.Game.Modes.Osu/OsuMod.cs
Normal file
@ -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();
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Osu
|
||||
{
|
||||
class OsuScore : Score
|
||||
|
@ -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">
|
||||
|
64
osu.Game.Modes.Taiko/TaikoMod.cs
Normal file
64
osu.Game.Modes.Taiko/TaikoMod.cs
Normal file
@ -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();
|
||||
|
@ -64,7 +64,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
BeatmapSet = beatmapSet;
|
||||
WorkingBeatmap beatmap = database.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault());
|
||||
foreach (var b in BeatmapSet.Beatmaps)
|
||||
b.StarDifficulty = (float)(database.GetWorkingBeatmap(b).Beatmap?.CalculateStarDifficulty() ?? 0);
|
||||
b.StarDifficulty = (float)(database.GetWorkingBeatmap(b).Beatmap?.CalculateStarDifficulty() ?? -1f);
|
||||
|
||||
Header = new BeatmapSetHeader(beatmap)
|
||||
{
|
||||
|
@ -83,10 +83,10 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
ColourLight = OsuColour.FromHex(@"3a7285"),
|
||||
ColourDark = OsuColour.FromHex(@"123744")
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Padding = new MarginPadding(5),
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
@ -98,18 +98,18 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Padding = new MarginPadding { Left = 5 },
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Direction = FlowDirections.Horizontal,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Right,
|
||||
Spacing = new Vector2(4, 0),
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
private OsuConfigManager config;
|
||||
private Bindable<bool> preferUnicode;
|
||||
private WorkingBeatmap beatmap;
|
||||
private FlowContainer difficultyIcons;
|
||||
private FillFlowContainer difficultyIcons;
|
||||
|
||||
public BeatmapSetHeader(WorkingBeatmap beatmap)
|
||||
{
|
||||
@ -36,9 +36,9 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
Padding = new MarginPadding { Top = 5, Left = 18, Right = 10, Bottom = 10 },
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
@ -52,13 +52,12 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
},
|
||||
artist = new OsuSpriteText
|
||||
{
|
||||
Margin = new MarginPadding { Top = -1 },
|
||||
Font = @"Exo2.0-SemiBoldItalic",
|
||||
Text = beatmap.BeatmapSetInfo.Metadata.Artist,
|
||||
TextSize = 17,
|
||||
Shadow = true,
|
||||
},
|
||||
difficultyIcons = new FlowContainer
|
||||
difficultyIcons = new FillFlowContainer
|
||||
{
|
||||
Margin = new MarginPadding { Top = 5 },
|
||||
AutoSizeAxes = Axes.Both,
|
||||
@ -109,10 +108,10 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Depth = -1,
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
// This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle
|
||||
Shear = new Vector2(0.8f, 0),
|
||||
|
@ -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)
|
||||
|
@ -88,7 +88,7 @@ namespace osu.Game.Database
|
||||
return ID == other?.ID;
|
||||
}
|
||||
|
||||
public bool AudioEquals(BeatmapInfo other) => other != null &&
|
||||
public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null &&
|
||||
BeatmapSet.Path == other.BeatmapSet.Path &&
|
||||
(Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile;
|
||||
}
|
||||
|
@ -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,
|
||||
}
|
||||
}
|
||||
|
@ -13,17 +13,15 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Pause
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class PauseButton : ClickableContainer
|
||||
public class DialogButton : ClickableContainer
|
||||
{
|
||||
private const float hover_width = 0.9f;
|
||||
private const float hover_duration = 500;
|
||||
private const float glow_fade_duration = 250;
|
||||
private const float click_duration = 200;
|
||||
|
||||
private Color4 backgroundColour = OsuColour.Gray(34);
|
||||
|
||||
private Color4 buttonColour;
|
||||
public Color4 ButtonColour
|
||||
{
|
||||
@ -35,8 +33,21 @@ namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
buttonColour = value;
|
||||
updateGlow();
|
||||
if (colourContainer == null) return;
|
||||
colourContainer.Colour = ButtonColour;
|
||||
colourContainer.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 backgroundColour = OsuColour.Gray(34);
|
||||
public Color4 BackgroundColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return backgroundColour;
|
||||
}
|
||||
set
|
||||
{
|
||||
backgroundColour = value;
|
||||
background.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,16 +61,30 @@ namespace osu.Game.Overlays.Pause
|
||||
set
|
||||
{
|
||||
text = value;
|
||||
if (spriteText == null) return;
|
||||
spriteText.Text = Text;
|
||||
}
|
||||
}
|
||||
|
||||
private float textSize = 28;
|
||||
internal float TextSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return textSize;
|
||||
}
|
||||
set
|
||||
{
|
||||
textSize = value;
|
||||
spriteText.TextSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
public SampleChannel SampleClick, SampleHover;
|
||||
|
||||
private Container backgroundContainer, colourContainer, glowContainer;
|
||||
private Box leftGlow, centerGlow, rightGlow;
|
||||
private Box leftGlow, centerGlow, rightGlow, background;
|
||||
private SpriteText spriteText;
|
||||
private Vector2 hoverSpacing => new Vector2(3f, 0f);
|
||||
|
||||
private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking
|
||||
|
||||
@ -85,8 +110,9 @@ namespace osu.Game.Overlays.Pause
|
||||
|
||||
protected override bool OnHover(Framework.Input.InputState state)
|
||||
{
|
||||
spriteText.TransformSpacingTo(hoverSpacing, hover_duration, EasingTypes.OutElastic);
|
||||
|
||||
colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, EasingTypes.OutElastic);
|
||||
spriteText.TransformSpacingTo(new Vector2(3f, 0f), hover_duration, EasingTypes.OutElastic);
|
||||
glowContainer.FadeIn(glow_fade_duration, EasingTypes.Out);
|
||||
SampleHover?.Play();
|
||||
return true;
|
||||
@ -127,8 +153,10 @@ namespace osu.Game.Overlays.Pause
|
||||
rightGlow.ColourInfo = ColourInfo.GradientHorizontal(ButtonColour, new Color4(ButtonColour.R, ButtonColour.G, ButtonColour.B, 0f));
|
||||
}
|
||||
|
||||
public PauseButton()
|
||||
public DialogButton()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
backgroundContainer = new Container
|
||||
@ -137,12 +165,12 @@ namespace osu.Game.Overlays.Pause
|
||||
Width = 1f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
background = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = backgroundColour
|
||||
}
|
||||
}
|
||||
Colour = backgroundColour,
|
||||
},
|
||||
},
|
||||
},
|
||||
glowContainer = new Container
|
||||
{
|
||||
@ -156,23 +184,23 @@ namespace osu.Game.Overlays.Pause
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.TopLeft,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Width = 0.125f
|
||||
Width = 0.125f,
|
||||
},
|
||||
centerGlow = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Width = 0.75f
|
||||
Width = 0.75f,
|
||||
},
|
||||
rightGlow = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.TopRight,
|
||||
Anchor = Anchor.TopRight,
|
||||
Width = 0.125f
|
||||
}
|
||||
}
|
||||
Width = 0.125f,
|
||||
},
|
||||
},
|
||||
},
|
||||
new Container
|
||||
{
|
||||
@ -194,7 +222,7 @@ namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = Color4.Black.Opacity(0.2f),
|
||||
Radius = 5
|
||||
Radius = 5,
|
||||
},
|
||||
Colour = ButtonColour,
|
||||
Shear = new Vector2(0.2f, 0),
|
||||
@ -203,7 +231,7 @@ namespace osu.Game.Overlays.Pause
|
||||
new Box
|
||||
{
|
||||
EdgeSmoothness = new Vector2(2, 0),
|
||||
RelativeSizeAxes = Axes.Both
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
@ -217,13 +245,13 @@ namespace osu.Game.Overlays.Pause
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
TriangleScale = 4,
|
||||
ColourDark = OsuColour.Gray(0.88f),
|
||||
Shear = new Vector2(-0.2f, 0)
|
||||
}
|
||||
}
|
||||
Shear = new Vector2(-0.2f, 0),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
spriteText = new OsuSpriteText
|
||||
{
|
||||
@ -234,8 +262,8 @@ namespace osu.Game.Overlays.Pause
|
||||
Font = "Exo2.0-Bold",
|
||||
Shadow = true,
|
||||
ShadowColour = new Color4(0, 0, 0, 0.1f),
|
||||
Colour = Color4.White
|
||||
}
|
||||
Colour = Color4.White,
|
||||
},
|
||||
};
|
||||
|
||||
updateGlow();
|
@ -1,4 +1,7 @@
|
||||
using OpenTK.Graphics;
|
||||
// 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 OpenTK.Input;
|
||||
using osu.Framework.Input;
|
||||
using System;
|
||||
|
@ -19,9 +19,9 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new Drawable[]
|
||||
|
@ -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;
|
||||
|
@ -68,10 +68,10 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
stars = new FlowContainer<Star>
|
||||
stars = new FillFlowContainer<Star>
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
Spacing = new Vector2(star_spacing),
|
||||
}
|
||||
};
|
||||
|
@ -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;
|
||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Graphics.UserInterface.Volume
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.BottomRight,
|
||||
|
272
osu.Game/Modes/Mod.cs
Normal file
272
osu.Game/Modes/Mod.cs
Normal file
@ -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,
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
// 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.Objects
|
||||
{
|
||||
public abstract class HitObjectParser
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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.Objects
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -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);
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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
|
||||
{
|
||||
public class Score
|
||||
|
@ -1,5 +1,5 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
|
85
osu.Game/Modes/UI/ModIcon.cs
Normal file
85
osu.Game/Modes/UI/ModIcon.cs
Normal file
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
// 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.Online.API
|
||||
{
|
||||
public interface IOnlineComponent
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Online.Chat.Drawables
|
||||
public class DrawableChannel : Container
|
||||
{
|
||||
private readonly Channel channel;
|
||||
private FlowContainer flow;
|
||||
private FillFlowContainer flow;
|
||||
private ScrollContainer scroll;
|
||||
|
||||
public DrawableChannel(Channel channel)
|
||||
@ -39,9 +39,9 @@ namespace osu.Game.Online.Chat.Drawables
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
flow = new FlowContainer
|
||||
flow = new FillFlowContainer
|
||||
{
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Padding = new MarginPadding { Left = 20, Right = 20 }
|
||||
|
@ -42,6 +42,8 @@ namespace osu.Game
|
||||
|
||||
private NotificationManager notificationManager;
|
||||
|
||||
private DialogOverlay dialogOverlay;
|
||||
|
||||
private Intro intro
|
||||
{
|
||||
get
|
||||
@ -142,6 +144,11 @@ namespace osu.Game
|
||||
Origin = Anchor.TopRight,
|
||||
}).LoadAsync(this, overlayContent.Add);
|
||||
|
||||
(dialogOverlay = new DialogOverlay
|
||||
{
|
||||
Depth = -4,
|
||||
}).LoadAsync(this, overlayContent.Add);
|
||||
|
||||
Logger.NewEntry += entry =>
|
||||
{
|
||||
if (entry.Level < LogLevel.Important) return;
|
||||
@ -155,6 +162,7 @@ namespace osu.Game
|
||||
Dependencies.Cache(options);
|
||||
Dependencies.Cache(musicController);
|
||||
Dependencies.Cache(notificationManager);
|
||||
Dependencies.Cache(dialogOverlay);
|
||||
|
||||
(Toolbar = new Toolbar
|
||||
{
|
||||
|
246
osu.Game/Overlays/Dialog/PopupDialog.cs
Normal file
246
osu.Game/Overlays/Dialog/PopupDialog.cs
Normal file
@ -0,0 +1,246 @@
|
||||
// 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 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.Backgrounds;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
|
||||
namespace osu.Game.Overlays.Dialog
|
||||
{
|
||||
public class PopupDialog : FocusedOverlayContainer
|
||||
{
|
||||
public static readonly float ENTER_DURATION = 500;
|
||||
public static readonly float EXIT_DURATION = 200;
|
||||
private readonly Vector2 ringSize = new Vector2(100f);
|
||||
private readonly Vector2 ringMinifiedSize = new Vector2(20f);
|
||||
private readonly Vector2 buttonsEnterSpacing = new Vector2(0f, 50f);
|
||||
|
||||
private Container content, ring;
|
||||
private FillFlowContainer<PopupDialogButton> buttonsContainer;
|
||||
private TextAwesome iconText;
|
||||
private SpriteText header, body;
|
||||
|
||||
public FontAwesome Icon
|
||||
{
|
||||
get { return iconText.Icon; }
|
||||
set { iconText.Icon = value; }
|
||||
}
|
||||
|
||||
public string HeaderText
|
||||
{
|
||||
get { return header.Text; }
|
||||
set { header.Text = value; }
|
||||
}
|
||||
|
||||
public string BodyText
|
||||
{
|
||||
get { return body.Text; }
|
||||
set { body.Text = value; }
|
||||
}
|
||||
|
||||
public IEnumerable<PopupDialogButton> Buttons
|
||||
{
|
||||
get { return buttonsContainer.Children; }
|
||||
set
|
||||
{
|
||||
buttonsContainer.Children = value;
|
||||
foreach (PopupDialogButton b in value)
|
||||
{
|
||||
var action = b.Action;
|
||||
b.Action = () =>
|
||||
{
|
||||
Hide();
|
||||
action?.Invoke();
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void pressButtonAtIndex(int index)
|
||||
{
|
||||
if (index < Buttons.Count())
|
||||
Buttons.Skip(index).First().TriggerClick();
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
{
|
||||
if (args.Repeat) return false;
|
||||
|
||||
if (args.Key == Key.Enter)
|
||||
{
|
||||
Buttons.OfType<PopupDialogOkButton>().FirstOrDefault()?.TriggerClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
// press button at number if 1-9 on number row or keypad are pressed
|
||||
var k = args.Key;
|
||||
if (k >= Key.Number1 && k <= Key.Number9)
|
||||
{
|
||||
pressButtonAtIndex(k - Key.Number1);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (k >= Key.Keypad1 && k <= Key.Keypad9)
|
||||
{
|
||||
pressButtonAtIndex(k - Key.Keypad1);
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
||||
// Reset various animations but only if the dialog animation fully completed
|
||||
if (content.Alpha == 0)
|
||||
{
|
||||
buttonsContainer.TransformSpacingTo(buttonsEnterSpacing);
|
||||
buttonsContainer.MoveToY(buttonsEnterSpacing.Y);
|
||||
ring.ResizeTo(ringMinifiedSize);
|
||||
}
|
||||
|
||||
content.FadeIn(ENTER_DURATION, EasingTypes.OutQuint);
|
||||
ring.ResizeTo(ringSize, ENTER_DURATION, EasingTypes.OutQuint);
|
||||
buttonsContainer.TransformSpacingTo(Vector2.Zero, ENTER_DURATION, EasingTypes.OutQuint);
|
||||
buttonsContainer.MoveToY(0, ENTER_DURATION, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
content.FadeOut(EXIT_DURATION, EasingTypes.InSine);
|
||||
}
|
||||
|
||||
public PopupDialog()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.BottomCentre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
Width = 0.4f,
|
||||
Alpha = 0f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
EdgeEffect = new EdgeEffect
|
||||
{
|
||||
Type = EdgeEffectType.Shadow,
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
Radius = 8,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = OsuColour.FromHex(@"221a21"),
|
||||
},
|
||||
new Triangles
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ColourLight = OsuColour.FromHex(@"271e26"),
|
||||
ColourDark = OsuColour.FromHex(@"1e171e"),
|
||||
TriangleScale = 4,
|
||||
},
|
||||
},
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.BottomCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Position = new Vector2(0f, -50f),
|
||||
Direction = FillDirection.Down,
|
||||
Spacing = new Vector2(0f, 10f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Size = ringSize,
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Bottom = 30,
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
ring = new CircularContainer
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
BorderColour = Color4.White,
|
||||
BorderThickness = 5f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black.Opacity(0),
|
||||
},
|
||||
iconText = new TextAwesome
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Icon = FontAwesome.fa_close,
|
||||
TextSize = 50,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
header = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Text = @"Header",
|
||||
TextSize = 25,
|
||||
Shadow = true,
|
||||
},
|
||||
body = new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Text = @"Body",
|
||||
TextSize = 18,
|
||||
Shadow = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
buttonsContainer = new FillFlowContainer<PopupDialogButton>
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.TopCentre,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Down,
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
20
osu.Game/Overlays/Dialog/PopupDialogButton.cs
Normal file
20
osu.Game/Overlays/Dialog/PopupDialogButton.cs
Normal file
@ -0,0 +1,20 @@
|
||||
// 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.Framework.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Dialog
|
||||
{
|
||||
public class PopupDialogButton : DialogButton
|
||||
{
|
||||
public PopupDialogButton()
|
||||
{
|
||||
Height = 50;
|
||||
BackgroundColour = OsuColour.FromHex(@"150e14");
|
||||
TextSize = 18;
|
||||
}
|
||||
}
|
||||
}
|
20
osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs
Normal file
20
osu.Game/Overlays/Dialog/PopupDialogCancelButton.cs
Normal file
@ -0,0 +1,20 @@
|
||||
// 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.Framework.Audio;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Dialog
|
||||
{
|
||||
public class PopupDialogCancelButton : PopupDialogButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, AudioManager audio)
|
||||
{
|
||||
ButtonColour = colours.Blue;
|
||||
SampleHover = audio.Sample.Get(@"Menu/menuclick");
|
||||
SampleClick = audio.Sample.Get(@"Menu/menuback");
|
||||
}
|
||||
}
|
||||
}
|
20
osu.Game/Overlays/Dialog/PopupDialogOKButton.cs
Normal file
20
osu.Game/Overlays/Dialog/PopupDialogOKButton.cs
Normal file
@ -0,0 +1,20 @@
|
||||
// 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.Framework.Audio;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Dialog
|
||||
{
|
||||
public class PopupDialogOkButton : PopupDialogButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours, AudioManager audio)
|
||||
{
|
||||
ButtonColour = colours.Pink;
|
||||
SampleHover = audio.Sample.Get(@"Menu/menuclick");
|
||||
SampleClick = audio.Sample.Get(@"Menu/menu-play-click");
|
||||
}
|
||||
}
|
||||
}
|
82
osu.Game/Overlays/DialogOverlay.cs
Normal file
82
osu.Game/Overlays/DialogOverlay.cs
Normal file
@ -0,0 +1,82 @@
|
||||
// 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.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class DialogOverlay : FocusedOverlayContainer
|
||||
{
|
||||
private Container dialogContainer;
|
||||
private PopupDialog currentDialog;
|
||||
|
||||
public void Push(PopupDialog dialog)
|
||||
{
|
||||
if (dialog == currentDialog) return;
|
||||
|
||||
currentDialog?.Hide();
|
||||
currentDialog = dialog;
|
||||
|
||||
dialogContainer.Add(currentDialog);
|
||||
|
||||
currentDialog.Show();
|
||||
currentDialog.StateChanged += onDialogOnStateChanged;
|
||||
State = Visibility.Visible;
|
||||
}
|
||||
|
||||
private void onDialogOnStateChanged(OverlayContainer dialog, Visibility v)
|
||||
{
|
||||
if (v != Visibility.Hidden) return;
|
||||
|
||||
//handle the dialog being dismissed.
|
||||
dialog.Delay(PopupDialog.EXIT_DURATION);
|
||||
dialog.Expire();
|
||||
|
||||
if (dialog == currentDialog)
|
||||
State = Visibility.Hidden;
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
FadeIn(PopupDialog.ENTER_DURATION, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
FadeOut(PopupDialog.EXIT_DURATION, EasingTypes.InSine);
|
||||
}
|
||||
|
||||
public DialogOverlay()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
},
|
||||
},
|
||||
},
|
||||
dialogContainer = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
26
osu.Game/Overlays/Mods/AssistedSection.cs
Normal file
26
osu.Game/Overlays/Mods/AssistedSection.cs
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.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";
|
||||
}
|
||||
}
|
||||
}
|
26
osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs
Normal file
26
osu.Game/Overlays/Mods/DifficultyIncreaseSection.cs
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.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";
|
||||
}
|
||||
}
|
||||
}
|
26
osu.Game/Overlays/Mods/DifficultyReductionSection.cs
Normal file
26
osu.Game/Overlays/Mods/DifficultyReductionSection.cs
Normal file
@ -0,0 +1,26 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using OpenTK.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";
|
||||
}
|
||||
}
|
||||
}
|
271
osu.Game/Overlays/Mods/ModButton.cs
Normal file
271
osu.Game/Overlays/Mods/ModButton.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
176
osu.Game/Overlays/Mods/ModSection.cs
Normal file
176
osu.Game/Overlays/Mods/ModSection.cs
Normal file
@ -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,
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
369
osu.Game/Overlays/Mods/ModSelectOverlay.cs
Normal file
369
osu.Game/Overlays/Mods/ModSelectOverlay.cs
Normal file
@ -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,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -44,9 +44,9 @@ namespace osu.Game.Overlays
|
||||
Margin = new MarginPadding { Top = Toolbar.Toolbar.HEIGHT },
|
||||
Children = new[]
|
||||
{
|
||||
sections = new FlowContainer<NotificationSection>
|
||||
sections = new FillFlowContainer<NotificationSection>
|
||||
{
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Children = new []
|
||||
|
@ -16,7 +16,7 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Overlays.Notifications
|
||||
{
|
||||
public class NotificationSection : FlowContainer
|
||||
public class NotificationSection : FillFlowContainer
|
||||
{
|
||||
private OsuSpriteText titleText;
|
||||
private OsuSpriteText countText;
|
||||
@ -60,7 +60,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Direction = FlowDirections.Vertical;
|
||||
Direction = FillDirection.Down;
|
||||
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
Origin = Anchor.TopRight,
|
||||
Action = clearAll
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
@ -110,7 +110,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
},
|
||||
},
|
||||
},
|
||||
notifications = new FlowContainer<Notification>
|
||||
notifications = new FillFlowContainer<Notification>
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
@ -14,7 +14,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class OptionDropDown<T> : FlowContainer
|
||||
public class OptionDropDown<T> : FillFlowContainer
|
||||
{
|
||||
private DropDownMenu<T> dropdown;
|
||||
private SpriteText text;
|
||||
@ -89,7 +89,7 @@ namespace osu.Game.Overlays.Options
|
||||
{
|
||||
Items = new KeyValuePair<string, T>[0];
|
||||
|
||||
Direction = FlowDirections.Vertical;
|
||||
Direction = FillDirection.Down;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Children = new Drawable[]
|
||||
|
@ -12,7 +12,7 @@ using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class OptionSlider<T> : FlowContainer where T : struct
|
||||
public class OptionSlider<T> : FillFlowContainer where T : struct
|
||||
{
|
||||
private SliderBar<T> slider;
|
||||
private SpriteText text;
|
||||
@ -40,7 +40,6 @@ namespace osu.Game.Overlays.Options
|
||||
|
||||
public OptionSlider()
|
||||
{
|
||||
Direction = FlowDirections.Vertical;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Padding = new MarginPadding { Right = 5 };
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public abstract class OptionsSection : Container
|
||||
{
|
||||
protected FlowContainer FlowContent;
|
||||
protected FillFlowContainer FlowContent;
|
||||
protected override Container<Drawable> Content => FlowContent;
|
||||
|
||||
public abstract FontAwesome Icon { get; }
|
||||
@ -58,10 +58,10 @@ namespace osu.Game.Overlays.Options
|
||||
TextSize = header_size,
|
||||
Text = Header,
|
||||
},
|
||||
FlowContent = new FlowContainer
|
||||
FlowContent = new FillFlowContainer
|
||||
{
|
||||
Margin = new MarginPadding { Top = header_size + header_margin },
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
Spacing = new Vector2(0, 30),
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
@ -9,7 +9,7 @@ using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public abstract class OptionsSubsection : FlowContainer
|
||||
public abstract class OptionsSubsection : FillFlowContainer
|
||||
{
|
||||
private Container<Drawable> content;
|
||||
protected override Container<Drawable> Content => content;
|
||||
@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Options
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Direction = FlowDirections.Vertical;
|
||||
Direction = FillDirection.Down;
|
||||
AddInternal(new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
@ -29,12 +29,12 @@ namespace osu.Game.Overlays.Options
|
||||
Margin = new MarginPadding { Bottom = 10 },
|
||||
Font = @"Exo2.0-Black",
|
||||
},
|
||||
content = new FlowContainer
|
||||
content = new FillFlowContainer
|
||||
{
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
Spacing = new Vector2(0, 5),
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(0, 5),
|
||||
},
|
||||
});
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Options.Sections.General
|
||||
}
|
||||
}
|
||||
|
||||
class LoginForm : FlowContainer
|
||||
class LoginForm : FillFlowContainer
|
||||
{
|
||||
private TextBox username;
|
||||
private TextBox password;
|
||||
@ -100,10 +100,10 @@ namespace osu.Game.Overlays.Options.Sections.General
|
||||
private void load(APIAccess api, OsuConfigManager config)
|
||||
{
|
||||
this.api = api;
|
||||
Direction = FlowDirections.Vertical;
|
||||
Direction = FillDirection.Down;
|
||||
Spacing = new Vector2(0, 5);
|
||||
AutoSizeAxes = Axes.Y;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Spacing = new Vector2(0, 5);
|
||||
Children = new Drawable[]
|
||||
{
|
||||
username = new OsuTextBox
|
||||
@ -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
|
||||
{
|
||||
|
@ -5,6 +5,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections
|
||||
{
|
||||
|
@ -8,6 +8,7 @@ using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections
|
||||
{
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class Sidebar : Container
|
||||
{
|
||||
private FlowContainer content;
|
||||
private FillFlowContainer content;
|
||||
internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH;
|
||||
internal const int EXPANDED_WIDTH = 200;
|
||||
protected override Container<Drawable> Content => content;
|
||||
@ -34,13 +34,13 @@ namespace osu.Game.Overlays.Options
|
||||
{
|
||||
Children = new []
|
||||
{
|
||||
content = new FlowContainer
|
||||
content = new FillFlowContainer
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FlowDirections.Vertical
|
||||
Direction = FillDirection.Down,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -73,11 +73,11 @@ namespace osu.Game.Overlays
|
||||
Margin = new MarginPadding { Left = SIDEBAR_WIDTH },
|
||||
Children = new[]
|
||||
{
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -94,11 +94,11 @@ namespace osu.Game.Overlays
|
||||
TextSize = 18,
|
||||
Margin = new MarginPadding { Left = CONTENT_MARGINS, Bottom = 30 },
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Y,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
Children = sections,
|
||||
}
|
||||
}
|
||||
|
@ -41,9 +41,9 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ToolbarBackground(),
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Children = new Drawable[]
|
||||
@ -55,7 +55,10 @@ namespace osu.Game.Overlays.Toolbar
|
||||
},
|
||||
modeSelector = new ToolbarModeSelector
|
||||
{
|
||||
OnPlayModeChange = OnPlayModeChange
|
||||
OnPlayModeChange = (PlayMode mode) =>
|
||||
{
|
||||
OnPlayModeChange?.Invoke(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -63,7 +66,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Children = new Drawable[]
|
||||
@ -141,7 +144,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
FadeOut(transition_time);
|
||||
}
|
||||
|
||||
class PassThroughFlowContainer : FlowContainer
|
||||
class PassThroughFlowContainer : FillFlowContainer
|
||||
{
|
||||
//needed to get input to the login overlay.
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
|
@ -62,10 +62,10 @@ namespace osu.Game.Overlays.Toolbar
|
||||
protected TextAwesome DrawableIcon;
|
||||
protected SpriteText DrawableText;
|
||||
protected Box HoverBackground;
|
||||
private FlowContainer tooltipContainer;
|
||||
private FillFlowContainer tooltipContainer;
|
||||
private SpriteText tooltip1;
|
||||
private SpriteText tooltip2;
|
||||
protected FlowContainer Flow;
|
||||
protected FillFlowContainer Flow;
|
||||
private SampleChannel sampleClick;
|
||||
|
||||
public ToolbarButton()
|
||||
@ -82,21 +82,21 @@ namespace osu.Game.Overlays.Toolbar
|
||||
BlendingMode = BlendingMode.Additive,
|
||||
Alpha = 0,
|
||||
},
|
||||
Flow = new FlowContainer
|
||||
Flow = new FillFlowContainer
|
||||
{
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
Spacing = new Vector2(5),
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Padding = new MarginPadding { Left = Toolbar.HEIGHT / 2, Right = Toolbar.HEIGHT / 2 },
|
||||
Spacing = new Vector2(5),
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
DrawableIcon = new TextAwesome
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
},
|
||||
DrawableText = new OsuSpriteText
|
||||
{
|
||||
@ -105,9 +105,9 @@ namespace osu.Game.Overlays.Toolbar
|
||||
},
|
||||
},
|
||||
},
|
||||
tooltipContainer = new FlowContainer
|
||||
tooltipContainer = new FillFlowContainer
|
||||
{
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize
|
||||
Anchor = (TooltipAnchor & Anchor.x0) > 0 ? Anchor.BottomLeft : Anchor.BottomRight,
|
||||
Origin = TooltipAnchor,
|
||||
|
@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
const float padding = 10;
|
||||
|
||||
private FlowContainer modeButtons;
|
||||
private FillFlowContainer modeButtons;
|
||||
private Drawable modeButtonLine;
|
||||
private ToolbarModeButton activeButton;
|
||||
|
||||
@ -32,11 +32,11 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OpaqueBackground(),
|
||||
modeButtons = new FlowContainer
|
||||
modeButtons = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Padding = new MarginPadding { Left = padding, Right = padding },
|
||||
|
201
osu.Game/Overlays/WaveOverlayContainer.cs
Normal file
201
osu.Game/Overlays/WaveOverlayContainer.cs
Normal file
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ namespace osu.Game.Screens
|
||||
|
||||
protected virtual IEnumerable<Type> PossibleChildren => null;
|
||||
|
||||
private FlowContainer childModeButtons;
|
||||
private FillFlowContainer childModeButtons;
|
||||
private Container textContainer;
|
||||
private Box box;
|
||||
|
||||
@ -124,9 +124,9 @@ namespace osu.Game.Screens
|
||||
Exit();
|
||||
}
|
||||
},
|
||||
childModeButtons = new FlowContainer
|
||||
childModeButtons = new FillFlowContainer
|
||||
{
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -114,7 +114,7 @@ namespace osu.Game.Screens.Menu
|
||||
new OsuSpriteText
|
||||
{
|
||||
Shadow = true,
|
||||
Direction = FlowDirections.Horizontal,
|
||||
AllowMultiline = false,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
TextSize = 16,
|
||||
@ -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)
|
||||
{
|
||||
|
@ -78,16 +78,16 @@ namespace osu.Game.Screens.Menu
|
||||
},
|
||||
buttonFlow = new FlowContainerWithOrigin
|
||||
{
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
Spacing = new Vector2(-WEDGE_WIDTH, 0),
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Spacing = new Vector2(-WEDGE_WIDTH, 0),
|
||||
Children = new[]
|
||||
{
|
||||
settingsButton = new Button(@"settings", @"options", FontAwesome.fa_gear, new Color4(85, 85, 85, 255), () => OnSettings?.Invoke(), -WEDGE_WIDTH, Key.O),
|
||||
backButton = new Button(@"back", @"back", FontAwesome.fa_osu_left_o, new Color4(51, 58, 94, 255), onBack, -WEDGE_WIDTH),
|
||||
iconFacade = new Container //need a container to make the osu! icon flow properly.
|
||||
{
|
||||
{
|
||||
Size = new Vector2(0, BUTTON_AREA_HEIGHT)
|
||||
}
|
||||
},
|
||||
|
@ -27,12 +27,12 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
Spacing = new Vector2(0, 2),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Screens.Menu
|
||||
/// <summary>
|
||||
/// A flow container with an origin based on one of its contained drawables.
|
||||
/// </summary>
|
||||
public class FlowContainerWithOrigin : FlowContainer
|
||||
public class FlowContainerWithOrigin : FillFlowContainer
|
||||
{
|
||||
/// <summary>
|
||||
/// A target drawable which this flowcontainer should be centered around.
|
||||
@ -22,7 +22,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer();
|
||||
|
||||
protected override IEnumerable<Drawable> SortedChildren => base.SortedChildren.Reverse();
|
||||
protected override IEnumerable<Drawable> FlowingChildren => base.FlowingChildren.Reverse();
|
||||
|
||||
public override Anchor Origin => Anchor.Custom;
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,11 +8,11 @@ using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class KeyCounterCollection : FlowContainer<KeyCounter>
|
||||
public class KeyCounterCollection : FillFlowContainer<KeyCounter>
|
||||
{
|
||||
public KeyCounterCollection()
|
||||
{
|
||||
Direction = FlowDirections.Horizontal;
|
||||
Direction = FillDirection.Right;
|
||||
AutoSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
@ -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,14 +1,14 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using 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 : PauseButton
|
||||
public class QuitButton : DialogButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
@ -4,10 +4,11 @@
|
||||
using osu.Framework.Allocation;
|
||||
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 : PauseButton
|
||||
public class ResumeButton : DialogButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
@ -4,10 +4,11 @@
|
||||
using osu.Framework.Allocation;
|
||||
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 : PauseButton
|
||||
public class RetryButton : DialogButton
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio, OsuColour colours)
|
@ -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
|
||||
{
|
||||
@ -66,7 +67,7 @@ namespace osu.Game.Overlays.Pause
|
||||
}
|
||||
}
|
||||
|
||||
private FlowContainer retryCounterContainer;
|
||||
private FillFlowContainer retryCounterContainer;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
public override bool HandleInput => State == Visibility.Visible;
|
||||
@ -100,21 +101,21 @@ namespace osu.Game.Overlays.Pause
|
||||
Colour = Color4.Black,
|
||||
Alpha = background_alpha,
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FlowDirections.Vertical,
|
||||
Spacing = new Vector2(0f, 50f),
|
||||
Direction = FillDirection.Down,
|
||||
Spacing = new Vector2(0, 50),
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FlowDirections.Vertical,
|
||||
Spacing = new Vector2(0f, 20f),
|
||||
Direction = FillDirection.Down,
|
||||
Spacing = new Vector2(0, 20),
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Children = new Drawable[]
|
||||
@ -141,7 +142,7 @@ namespace osu.Game.Overlays.Pause
|
||||
}
|
||||
}
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
@ -156,7 +157,6 @@ namespace osu.Game.Overlays.Pause
|
||||
{
|
||||
new ResumeButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = button_height,
|
||||
@ -164,7 +164,6 @@ namespace osu.Game.Overlays.Pause
|
||||
},
|
||||
new RetryButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = button_height,
|
||||
@ -176,7 +175,6 @@ namespace osu.Game.Overlays.Pause
|
||||
},
|
||||
new QuitButton
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Height = button_height,
|
||||
@ -188,7 +186,7 @@ namespace osu.Game.Overlays.Pause
|
||||
}
|
||||
}
|
||||
},
|
||||
retryCounterContainer = new FlowContainer
|
||||
retryCounterContainer = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.TopCentre,
|
@ -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;
|
||||
@ -152,7 +151,6 @@ namespace osu.Game.Screens.Play
|
||||
playerInputManager = new PlayerInputManager(game.Host)
|
||||
{
|
||||
Clock = new InterpolatingFramedClock(sourceClock),
|
||||
PassThrough = false,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
hitRenderer,
|
||||
@ -196,7 +194,6 @@ namespace osu.Game.Screens.Play
|
||||
if (canPause || force)
|
||||
{
|
||||
lastPauseActionTime = Time.Current;
|
||||
playerInputManager.PassThrough = true;
|
||||
scoreOverlay.KeyCounter.IsCounting = false;
|
||||
pauseOverlay.Retries = RestartCount;
|
||||
pauseOverlay.Show();
|
||||
@ -212,7 +209,6 @@ namespace osu.Game.Screens.Play
|
||||
public void Resume()
|
||||
{
|
||||
lastPauseActionTime = Time.Current;
|
||||
playerInputManager.PassThrough = false;
|
||||
scoreOverlay.KeyCounter.IsCounting = true;
|
||||
pauseOverlay.Hide();
|
||||
sourceClock.Start();
|
||||
|
@ -131,12 +131,12 @@ namespace osu.Game.Screens.Play
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FlowContainer()
|
||||
new FillFlowContainer()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user