mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 14:53:01 +08:00
Merge pull request #4786 from peppy/fullscreen-overlay
Centralise full screen overlay logic into a base class
This commit is contained in:
commit
c9e5d30744
@ -11,7 +11,7 @@ using osu.Game.Rulesets;
|
|||||||
namespace osu.Game.Tests.Visual.Online
|
namespace osu.Game.Tests.Visual.Online
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestCaseDirect : OsuTestCase
|
public class TestCaseDirectOverlay : OsuTestCase
|
||||||
{
|
{
|
||||||
private DirectOverlay direct;
|
private DirectOverlay direct;
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
40
osu.Game.Tests/Visual/Online/TestCaseFullscreenOverlay.cs
Normal file
40
osu.Game.Tests/Visual/Online/TestCaseFullscreenOverlay.cs
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Overlays;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual.Online
|
||||||
|
{
|
||||||
|
[TestFixture]
|
||||||
|
public class TestCaseFullscreenOverlay : OsuTestCase
|
||||||
|
{
|
||||||
|
private FullscreenOverlay overlay;
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
Add(overlay = new TestFullscreenOverlay());
|
||||||
|
AddStep(@"toggle", overlay.ToggleVisibility);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class TestFullscreenOverlay : FullscreenOverlay
|
||||||
|
{
|
||||||
|
public TestFullscreenOverlay()
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Black,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,19 +11,18 @@ using osu.Game.Users;
|
|||||||
namespace osu.Game.Tests.Visual.Online
|
namespace osu.Game.Tests.Visual.Online
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestCaseSocial : OsuTestCase
|
public class TestCaseSocialOverlay : OsuTestCase
|
||||||
{
|
{
|
||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(UserPanel),
|
typeof(UserPanel),
|
||||||
typeof(SocialPanel),
|
typeof(SocialPanel),
|
||||||
typeof(FilterControl),
|
typeof(FilterControl),
|
||||||
typeof(SocialOverlay),
|
|
||||||
typeof(SocialGridPanel),
|
typeof(SocialGridPanel),
|
||||||
typeof(SocialListPanel)
|
typeof(SocialListPanel)
|
||||||
};
|
};
|
||||||
|
|
||||||
public TestCaseSocial()
|
public TestCaseSocialOverlay()
|
||||||
{
|
{
|
||||||
SocialOverlay s = new SocialOverlay
|
SocialOverlay s = new SocialOverlay
|
||||||
{
|
{
|
@ -38,7 +38,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
header = new ProfileHeader();
|
header = new ProfileHeader();
|
||||||
Add(header);
|
Add(header);
|
||||||
|
|
||||||
AddStep("Show offline dummy", () => header.User.Value = TestCaseUserProfile.TEST_USER);
|
AddStep("Show offline dummy", () => header.User.Value = TestCaseUserProfileOverlay.TEST_USER);
|
||||||
|
|
||||||
AddStep("Show null dummy", () => header.User.Value = new User
|
AddStep("Show null dummy", () => header.User.Value = new User
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ using osu.Game.Users;
|
|||||||
namespace osu.Game.Tests.Visual.Online
|
namespace osu.Game.Tests.Visual.Online
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class TestCaseUserProfile : OsuTestCase
|
public class TestCaseUserProfileOverlay : OsuTestCase
|
||||||
{
|
{
|
||||||
private readonly TestUserProfileOverlay profile;
|
private readonly TestUserProfileOverlay profile;
|
||||||
|
|
||||||
@ -27,7 +27,6 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
public override IReadOnlyList<Type> RequiredTypes => new[]
|
public override IReadOnlyList<Type> RequiredTypes => new[]
|
||||||
{
|
{
|
||||||
typeof(ProfileHeader),
|
typeof(ProfileHeader),
|
||||||
typeof(UserProfileOverlay),
|
|
||||||
typeof(RankGraph),
|
typeof(RankGraph),
|
||||||
typeof(LineGraph),
|
typeof(LineGraph),
|
||||||
typeof(SectionsContainer<>),
|
typeof(SectionsContainer<>),
|
||||||
@ -72,7 +71,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
Achievements = new User.UserAchievement[0],
|
Achievements = new User.UserAchievement[0],
|
||||||
};
|
};
|
||||||
|
|
||||||
public TestCaseUserProfile()
|
public TestCaseUserProfileOverlay()
|
||||||
{
|
{
|
||||||
Add(profile = new TestUserProfileOverlay());
|
Add(profile = new TestUserProfileOverlay());
|
||||||
}
|
}
|
@ -4,26 +4,22 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Effects;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API;
|
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Overlays.BeatmapSet;
|
using osu.Game.Overlays.BeatmapSet;
|
||||||
using osu.Game.Overlays.BeatmapSet.Scores;
|
using osu.Game.Overlays.BeatmapSet.Scores;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class BeatmapSetOverlay : WaveOverlayContainer
|
public class BeatmapSetOverlay : FullscreenOverlay
|
||||||
{
|
{
|
||||||
private const int fade_duration = 300;
|
private const int fade_duration = 300;
|
||||||
|
|
||||||
@ -32,7 +28,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private readonly Header header;
|
private readonly Header header;
|
||||||
|
|
||||||
private IAPIProvider api;
|
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
private readonly ScrollContainer scroll;
|
private readonly ScrollContainer scroll;
|
||||||
@ -46,24 +41,6 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Info info;
|
Info info;
|
||||||
ScoresContainer scores;
|
ScoresContainer scores;
|
||||||
Waves.FirstWaveColour = OsuColour.Gray(0.4f);
|
|
||||||
Waves.SecondWaveColour = OsuColour.Gray(0.3f);
|
|
||||||
Waves.ThirdWaveColour = OsuColour.Gray(0.2f);
|
|
||||||
Waves.FourthWaveColour = OsuColour.Gray(0.1f);
|
|
||||||
|
|
||||||
Anchor = Anchor.TopCentre;
|
|
||||||
Origin = Anchor.TopCentre;
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
Width = 0.85f;
|
|
||||||
|
|
||||||
Masking = true;
|
|
||||||
EdgeEffect = new EdgeEffectParameters
|
|
||||||
{
|
|
||||||
Colour = Color4.Black.Opacity(0),
|
|
||||||
Type = EdgeEffectType.Shadow,
|
|
||||||
Radius = 3,
|
|
||||||
Offset = new Vector2(0f, 1f),
|
|
||||||
};
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -102,22 +79,15 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(IAPIProvider api, RulesetStore rulesets)
|
private void load(RulesetStore rulesets)
|
||||||
{
|
{
|
||||||
this.api = api;
|
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopOutComplete()
|
||||||
{
|
{
|
||||||
base.PopIn();
|
base.PopOutComplete();
|
||||||
FadeEdgeEffectTo(0.25f, WaveContainer.APPEAR_DURATION, Easing.In);
|
beatmapSet.Value = null;
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopOut()
|
|
||||||
{
|
|
||||||
base.PopOut();
|
|
||||||
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => beatmapSet.Value = null);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnClick(ClickEvent e)
|
protected override bool OnClick(ClickEvent e)
|
||||||
@ -135,7 +105,7 @@ namespace osu.Game.Overlays
|
|||||||
beatmapSet.Value = res.ToBeatmapSet(rulesets);
|
beatmapSet.Value = res.ToBeatmapSet(rulesets);
|
||||||
header.Picker.Beatmap.Value = header.BeatmapSet.Value.Beatmaps.First(b => b.OnlineBeatmapID == beatmapId);
|
header.Picker.Beatmap.Value = header.BeatmapSet.Value.Beatmaps.First(b => b.OnlineBeatmapID == beatmapId);
|
||||||
};
|
};
|
||||||
api.Queue(req);
|
API.Queue(req);
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -144,7 +114,7 @@ namespace osu.Game.Overlays
|
|||||||
beatmapSet.Value = null;
|
beatmapSet.Value = null;
|
||||||
var req = new GetBeatmapSetRequest(beatmapSetId);
|
var req = new GetBeatmapSetRequest(beatmapSetId);
|
||||||
req.Success += res => beatmapSet.Value = res.ToBeatmapSet(rulesets);
|
req.Success += res => beatmapSet.Value = res.ToBeatmapSet(rulesets);
|
||||||
api.Queue(req);
|
API.Queue(req);
|
||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ using osu.Game.Audio;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Online.API;
|
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Overlays.Direct;
|
using osu.Game.Overlays.Direct;
|
||||||
using osu.Game.Overlays.SearchableList;
|
using osu.Game.Overlays.SearchableList;
|
||||||
@ -28,7 +27,6 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
private const float panel_padding = 10f;
|
private const float panel_padding = 10f;
|
||||||
|
|
||||||
private IAPIProvider api;
|
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
|
|
||||||
private readonly FillFlowContainer resultCountsContainer;
|
private readonly FillFlowContainer resultCountsContainer;
|
||||||
@ -87,8 +85,6 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
public DirectOverlay()
|
public DirectOverlay()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
|
|
||||||
// osu!direct colours are not part of the standard palette
|
// osu!direct colours are not part of the standard palette
|
||||||
|
|
||||||
Waves.FirstWaveColour = OsuColour.FromHex(@"19b0e2");
|
Waves.FirstWaveColour = OsuColour.FromHex(@"19b0e2");
|
||||||
@ -165,9 +161,8 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours, IAPIProvider api, RulesetStore rulesets, PreviewTrackManager previewTrackManager)
|
private void load(OsuColour colours, RulesetStore rulesets, PreviewTrackManager previewTrackManager)
|
||||||
{
|
{
|
||||||
this.api = api;
|
|
||||||
this.rulesets = rulesets;
|
this.rulesets = rulesets;
|
||||||
this.previewTrackManager = previewTrackManager;
|
this.previewTrackManager = previewTrackManager;
|
||||||
|
|
||||||
@ -260,7 +255,7 @@ namespace osu.Game.Overlays
|
|||||||
if (State == Visibility.Hidden)
|
if (State == Visibility.Hidden)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (api == null)
|
if (API == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
previewTrackManager.StopAnyPlaying(this);
|
previewTrackManager.StopAnyPlaying(this);
|
||||||
@ -286,7 +281,7 @@ namespace osu.Game.Overlays
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
api.Queue(getSetsRequest);
|
API.Queue(getSetsRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int distinctCount(List<string> list) => list.Distinct().ToArray().Length;
|
private int distinctCount(List<string> list) => list.Distinct().ToArray().Length;
|
||||||
|
75
osu.Game/Overlays/FullscreenOverlay.cs
Normal file
75
osu.Game/Overlays/FullscreenOverlay.cs
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Effects;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Online.API;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays
|
||||||
|
{
|
||||||
|
public abstract class FullscreenOverlay : WaveOverlayContainer, IOnlineComponent
|
||||||
|
{
|
||||||
|
[Resolved]
|
||||||
|
protected IAPIProvider API { get; private set; }
|
||||||
|
|
||||||
|
protected FullscreenOverlay()
|
||||||
|
{
|
||||||
|
Waves.FirstWaveColour = OsuColour.Gray(0.4f);
|
||||||
|
Waves.SecondWaveColour = OsuColour.Gray(0.3f);
|
||||||
|
Waves.ThirdWaveColour = OsuColour.Gray(0.2f);
|
||||||
|
Waves.FourthWaveColour = OsuColour.Gray(0.1f);
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
RelativePositionAxes = Axes.Both;
|
||||||
|
Width = 0.85f;
|
||||||
|
Anchor = Anchor.TopCentre;
|
||||||
|
Origin = Anchor.TopCentre;
|
||||||
|
|
||||||
|
Masking = true;
|
||||||
|
|
||||||
|
EdgeEffect = new EdgeEffectParameters
|
||||||
|
{
|
||||||
|
Colour = Color4.Black.Opacity(0),
|
||||||
|
Type = EdgeEffectType.Shadow,
|
||||||
|
Radius = 10
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PopIn()
|
||||||
|
{
|
||||||
|
base.PopIn();
|
||||||
|
FadeEdgeEffectTo(0.4f, WaveContainer.APPEAR_DURATION, Easing.Out);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PopOut()
|
||||||
|
{
|
||||||
|
base.PopOut();
|
||||||
|
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.In).OnComplete(_ => PopOutComplete());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void PopOutComplete()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
API.Register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
API?.Unregister(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void APIStateChanged(IAPIProvider api, APIState state)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,7 +11,7 @@ using osu.Game.Graphics.Containers;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.SearchableList
|
namespace osu.Game.Overlays.SearchableList
|
||||||
{
|
{
|
||||||
public abstract class SearchableListOverlay : WaveOverlayContainer
|
public abstract class SearchableListOverlay : FullscreenOverlay
|
||||||
{
|
{
|
||||||
public static readonly float WIDTH_PADDING = 80;
|
public static readonly float WIDTH_PADDING = 80;
|
||||||
}
|
}
|
||||||
@ -32,8 +32,6 @@ namespace osu.Game.Overlays.SearchableList
|
|||||||
|
|
||||||
protected SearchableListOverlay()
|
protected SearchableListOverlay()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -20,9 +19,8 @@ using osu.Framework.Threading;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class SocialOverlay : SearchableListOverlay<SocialTab, SocialSortCriteria, SortDirection>, IOnlineComponent
|
public class SocialOverlay : SearchableListOverlay<SocialTab, SocialSortCriteria, SortDirection>
|
||||||
{
|
{
|
||||||
private IAPIProvider api;
|
|
||||||
private readonly LoadingAnimation loading;
|
private readonly LoadingAnimation loading;
|
||||||
private FillFlowContainer<SocialPanel> panels;
|
private FillFlowContainer<SocialPanel> panels;
|
||||||
|
|
||||||
@ -88,13 +86,6 @@ namespace osu.Game.Overlays
|
|||||||
currentQuery.BindTo(Filter.Search.Current);
|
currentQuery.BindTo(Filter.Search.Current);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(IAPIProvider api)
|
|
||||||
{
|
|
||||||
this.api = api;
|
|
||||||
api.Register(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void recreatePanels(PanelDisplayStyle displayStyle)
|
private void recreatePanels(PanelDisplayStyle displayStyle)
|
||||||
{
|
{
|
||||||
clearPanels();
|
clearPanels();
|
||||||
@ -159,7 +150,7 @@ namespace osu.Game.Overlays
|
|||||||
loading.Hide();
|
loading.Hide();
|
||||||
getUsersRequest?.Cancel();
|
getUsersRequest?.Cancel();
|
||||||
|
|
||||||
if (api?.IsLoggedIn != true)
|
if (API?.IsLoggedIn != true)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (Header.Tabs.Current.Value)
|
switch (Header.Tabs.Current.Value)
|
||||||
@ -167,13 +158,13 @@ namespace osu.Game.Overlays
|
|||||||
case SocialTab.Friends:
|
case SocialTab.Friends:
|
||||||
var friendRequest = new GetFriendsRequest(); // TODO filter arguments?
|
var friendRequest = new GetFriendsRequest(); // TODO filter arguments?
|
||||||
friendRequest.Success += updateUsers;
|
friendRequest.Success += updateUsers;
|
||||||
api.Queue(getUsersRequest = friendRequest);
|
API.Queue(getUsersRequest = friendRequest);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
var userRequest = new GetUsersRequest(); // TODO filter arguments!
|
var userRequest = new GetUsersRequest(); // TODO filter arguments!
|
||||||
userRequest.Success += response => updateUsers(response.Select(r => r.User));
|
userRequest.Success += response => updateUsers(response.Select(r => r.User));
|
||||||
api.Queue(getUsersRequest = userRequest);
|
API.Queue(getUsersRequest = userRequest);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,7 +187,7 @@ namespace osu.Game.Overlays
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void APIStateChanged(IAPIProvider api, APIState state)
|
public override void APIStateChanged(IAPIProvider api, APIState state)
|
||||||
{
|
{
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
|
@ -3,76 +3,31 @@
|
|||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Effects;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API;
|
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Overlays.Profile;
|
using osu.Game.Overlays.Profile;
|
||||||
using osu.Game.Overlays.Profile.Sections;
|
using osu.Game.Overlays.Profile.Sections;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public class UserProfileOverlay : WaveOverlayContainer
|
public class UserProfileOverlay : FullscreenOverlay
|
||||||
{
|
{
|
||||||
private ProfileSection lastSection;
|
private ProfileSection lastSection;
|
||||||
private ProfileSection[] sections;
|
private ProfileSection[] sections;
|
||||||
private GetUserRequest userReq;
|
private GetUserRequest userReq;
|
||||||
private IAPIProvider api;
|
|
||||||
protected ProfileHeader Header;
|
protected ProfileHeader Header;
|
||||||
private SectionsContainer<ProfileSection> sectionsContainer;
|
private SectionsContainer<ProfileSection> sectionsContainer;
|
||||||
private ProfileTabControl tabs;
|
private ProfileTabControl tabs;
|
||||||
|
|
||||||
public const float CONTENT_X_MARGIN = 70;
|
public const float CONTENT_X_MARGIN = 70;
|
||||||
|
|
||||||
public UserProfileOverlay()
|
|
||||||
{
|
|
||||||
Waves.FirstWaveColour = OsuColour.Gray(0.4f);
|
|
||||||
Waves.SecondWaveColour = OsuColour.Gray(0.3f);
|
|
||||||
Waves.ThirdWaveColour = OsuColour.Gray(0.2f);
|
|
||||||
Waves.FourthWaveColour = OsuColour.Gray(0.1f);
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
RelativePositionAxes = Axes.Both;
|
|
||||||
Width = 0.85f;
|
|
||||||
Anchor = Anchor.TopCentre;
|
|
||||||
Origin = Anchor.TopCentre;
|
|
||||||
|
|
||||||
Masking = true;
|
|
||||||
EdgeEffect = new EdgeEffectParameters
|
|
||||||
{
|
|
||||||
Colour = Color4.Black.Opacity(0),
|
|
||||||
Type = EdgeEffectType.Shadow,
|
|
||||||
Radius = 10
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(IAPIProvider api)
|
|
||||||
{
|
|
||||||
this.api = api;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopIn()
|
|
||||||
{
|
|
||||||
base.PopIn();
|
|
||||||
FadeEdgeEffectTo(0.5f, WaveContainer.APPEAR_DURATION, Easing.In);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void PopOut()
|
|
||||||
{
|
|
||||||
base.PopOut();
|
|
||||||
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ShowUser(long userId) => ShowUser(new User { Id = userId });
|
public void ShowUser(long userId) => ShowUser(new User { Id = userId });
|
||||||
|
|
||||||
public void ShowUser(User user, bool fetchOnline = true)
|
public void ShowUser(User user, bool fetchOnline = true)
|
||||||
@ -154,7 +109,7 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
userReq = new GetUserRequest(user.Id);
|
userReq = new GetUserRequest(user.Id);
|
||||||
userReq.Success += userLoadComplete;
|
userReq.Success += userLoadComplete;
|
||||||
api.Queue(userReq);
|
API.Queue(userReq);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user