Merge branch 'master' into fix-beatmap-id-conflicts

This commit is contained in:
Dan Balasescu 2018-07-10 15:49:30 +09:00 committed by GitHub
commit 8cc042bd5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 89 additions and 36 deletions

View File

@ -88,7 +88,7 @@ namespace osu.Game.Tests.Visual
private class TestOnScreenDisplay : OnScreenDisplay
{
protected override void Display(Drawable toDisplay) => toDisplay.FadeIn().ResizeHeightTo(110);
protected override void DisplayTemporarily(Drawable toDisplay) => toDisplay.FadeIn().ResizeHeightTo(110);
}
}
}

View File

@ -16,8 +16,8 @@ namespace osu.Game.Tests.Visual
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ToolbarButton),
typeof(ToolbarModeSelector),
typeof(ToolbarModeButton),
typeof(ToolbarRulesetSelector),
typeof(ToolbarRulesetButton),
typeof(ToolbarNotificationButton),
};

View File

@ -53,7 +53,6 @@ namespace osu.Game.Tests.Visual
CoverUrl = @"https://osu.ppy.sh/images/headers/profile-covers/c1.jpg",
JoinDate = DateTimeOffset.Now.AddDays(-1),
LastVisit = DateTimeOffset.Now,
Age = 1,
ProfileOrder = new[] { "me" },
Statistics = new UserStatistics
{

View File

@ -20,6 +20,7 @@ using osu.Game.Graphics.Cursor;
using osu.Game.Online.API;
using osu.Framework.Graphics.Performance;
using osu.Framework.Graphics.Textures;
using osu.Framework.Input;
using osu.Framework.Logging;
using osu.Game.Audio;
using osu.Game.Database;
@ -30,6 +31,7 @@ using osu.Game.IO;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Scoring;
using osu.Game.Skinning;
using OpenTK.Input;
using DebugUtils = osu.Game.Utils.DebugUtils;
namespace osu.Game
@ -98,6 +100,8 @@ namespace osu.Game
private DatabaseContextFactory contextFactory;
protected override UserInputManager CreateUserInputManager() => new OsuUserInputManager();
[BackgroundDependencyLoader]
private void load()
{
@ -267,5 +271,31 @@ namespace osu.Game
return copy;
}
}
private class OsuUserInputManager : UserInputManager
{
protected override MouseButtonEventManager CreateButtonManagerFor(MouseButton button)
{
switch (button)
{
case MouseButton.Right:
return new RightMouseManager(button);
}
return base.CreateButtonManagerFor(button);
}
private class RightMouseManager : MouseButtonEventManager
{
public RightMouseManager(MouseButton button)
: base(button)
{
}
public override bool EnableDrag => true; // allow right-mouse dragging for absolute scroll in scroll containers.
public override bool EnableClick => false;
public override bool ChangeFocusOnClick => false;
}
}
}
}

View File

@ -14,6 +14,8 @@ using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics.Transforms;
using osu.Framework.Threading;
using osu.Game.Configuration;
using osu.Game.Graphics.Sprites;
@ -135,7 +137,7 @@ namespace osu.Game.Overlays
/// <exception cref="InvalidOperationException">If <paramref name="configManager"/> is already being tracked from the same <paramref name="source"/>.</exception>
public void BeginTracking(object source, ITrackableConfigManager configManager)
{
if (configManager == null) throw new ArgumentNullException(nameof(configManager));
if (configManager == null) throw new ArgumentNullException(nameof(configManager));
if (trackedConfigManagers.ContainsKey((source, configManager)))
throw new InvalidOperationException($"{nameof(configManager)} is already registered.");
@ -159,7 +161,7 @@ namespace osu.Game.Overlays
/// <exception cref="InvalidOperationException">If <paramref name="configManager"/> is not being tracked from the same <see cref="source"/>.</exception>
public void StopTracking(object source, ITrackableConfigManager configManager)
{
if (configManager == null) throw new ArgumentNullException(nameof(configManager));
if (configManager == null) throw new ArgumentNullException(nameof(configManager));
if (!trackedConfigManagers.TryGetValue((source, configManager), out var existing))
throw new InvalidOperationException($"{nameof(configManager)} is not registered.");
@ -181,7 +183,7 @@ namespace osu.Game.Overlays
if (string.IsNullOrEmpty(textLine3.Text))
textLine3.Text = "NO KEY BOUND";
Display(box);
DisplayTemporarily(box);
int optionCount = 0;
int selectedOption = -1;
@ -213,15 +215,29 @@ namespace osu.Game.Overlays
});
}
protected virtual void Display(Drawable toDisplay)
private TransformSequence<Drawable> fadeIn;
private ScheduledDelegate fadeOut;
protected virtual void DisplayTemporarily(Drawable toDisplay)
{
toDisplay.Animate(
b => b.FadeIn(500, Easing.OutQuint),
b => b.ResizeHeightTo(height, 500, Easing.OutQuint)
).Then(
b => b.FadeOutFromOne(1500, Easing.InQuint),
b => b.ResizeHeightTo(height_contracted, 1500, Easing.InQuint)
);
// avoid starting a new fade-in if one is already active.
if (fadeIn == null)
{
fadeIn = toDisplay.Animate(
b => b.FadeIn(500, Easing.OutQuint),
b => b.ResizeHeightTo(height, 500, Easing.OutQuint)
);
fadeIn.Finally(_ => fadeIn = null);
}
fadeOut?.Cancel();
fadeOut = Scheduler.AddDelayed(() =>
{
toDisplay.Animate(
b => b.FadeOutFromOne(1500, Easing.InQuint),
b => b.ResizeHeightTo(height_contracted, 1500, Easing.InQuint));
}, 500);
}
private class OptionLight : Container

View File

@ -360,11 +360,6 @@ namespace osu.Game.Overlays.Profile
Text = text
};
if (user.Age != null)
{
infoTextLeft.AddText($"{user.Age} years old ", boldItalic);
}
if (user.Country != null)
{
infoTextLeft.AddText("From ", lightText);

View File

@ -50,7 +50,7 @@ namespace osu.Game.Overlays.Toolbar
{
Action = () => OnHome?.Invoke()
},
new ToolbarModeSelector()
new ToolbarRulesetSelector()
}
},
new FillFlowContainer

View File

@ -7,7 +7,7 @@ using OpenTK.Graphics;
namespace osu.Game.Overlays.Toolbar
{
public class ToolbarModeButton : ToolbarButton
public class ToolbarRulesetButton : ToolbarButton
{
private RulesetInfo ruleset;
public RulesetInfo Ruleset

View File

@ -16,18 +16,18 @@ using osu.Game.Rulesets;
namespace osu.Game.Overlays.Toolbar
{
public class ToolbarModeSelector : Container
public class ToolbarRulesetSelector : Container
{
private const float padding = 10;
private readonly FillFlowContainer modeButtons;
private readonly Drawable modeButtonLine;
private ToolbarModeButton activeButton;
private ToolbarRulesetButton activeButton;
private RulesetStore rulesets;
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
public ToolbarModeSelector()
public ToolbarRulesetSelector()
{
RelativeSizeAxes = Axes.Y;
@ -73,7 +73,7 @@ namespace osu.Game.Overlays.Toolbar
this.rulesets = rulesets;
foreach (var r in rulesets.AvailableRulesets)
{
modeButtons.Add(new ToolbarModeButton
modeButtons.Add(new ToolbarRulesetButton
{
Ruleset = r,
Action = delegate { ruleset.Value = r; }
@ -115,7 +115,7 @@ namespace osu.Game.Overlays.Toolbar
private void rulesetChanged(RulesetInfo ruleset)
{
foreach (ToolbarModeButton m in modeButtons.Children.Cast<ToolbarModeButton>())
foreach (ToolbarRulesetButton m in modeButtons.Children.Cast<ToolbarRulesetButton>())
{
bool isActive = m.Ruleset.ID == ruleset.ID;
m.Active = isActive;

View File

@ -46,7 +46,9 @@ namespace osu.Game.Screens.Select.Leaderboards
public void UpdateRank(ScoreRank newRank)
{
Rank = newRank;
updateTexture();
if (IsLoaded)
updateTexture();
}
}
}

View File

@ -138,7 +138,11 @@ namespace osu.Game.Screens.Select
Height = filter_height,
FilterChanged = c => Carousel.Filter(c),
Background = { Width = 2 },
Exit = Exit,
Exit = () =>
{
if (IsCurrentScreen)
Exit();
},
},
}
},
@ -189,8 +193,6 @@ namespace osu.Game.Screens.Select
dependencies.CacheAs(Ruleset);
dependencies.CacheAs<IBindable<RulesetInfo>>(Ruleset);
base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce);
if (Footer != null)
{
Footer.AddButton(@"random", colours.Green, triggerRandom, Key.F2);
@ -218,6 +220,12 @@ namespace osu.Game.Screens.Select
Beatmap.BindValueChanged(workingBeatmapChanged);
}
protected override void LoadComplete()
{
base.LoadComplete();
base.Ruleset.ValueChanged += r => updateSelectedBeatmap(beatmapNoDebounce);
}
public void Edit(BeatmapInfo beatmap)
{
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap, Beatmap.Value);
@ -231,6 +239,10 @@ namespace osu.Game.Screens.Select
/// <param name="performStartAction">Whether to trigger <see cref="OnStart"/>.</param>
public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true)
{
// avoid attempting to continue before a selection has been obtained.
// this could happen via a user interaction while the carousel is still in a loading state.
if (Carousel.SelectedBeatmap == null) return;
// if we have a pending filter operation, we want to run it now.
// it could change selection (ie. if the ruleset has been changed).
Carousel.FlushPendingFilterOperations();

View File

@ -42,7 +42,9 @@ namespace osu.Game.Users
return;
country = value;
sprite.Texture = getFlagTexture();
if (IsLoaded)
sprite.Texture = getFlagTexture();
}
}

View File

@ -23,9 +23,6 @@ namespace osu.Game.Users
public Bindable<UserStatus> Status = new Bindable<UserStatus>();
[JsonProperty(@"age")]
public int? Age;
//public Team Team;
[JsonProperty(@"profile_colour")]

View File

@ -18,7 +18,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.1.1" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />
<PackageReference Include="ppy.osu.Framework" Version="2018.705.0" />
<PackageReference Include="ppy.osu.Framework" Version="2018.709.0" />
<PackageReference Include="SharpCompress" Version="0.17.1" />
<PackageReference Include="NUnit" Version="3.10.1" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />