1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 09:47:52 +08:00

Merge remote-tracking branch 'origin/master' into timeshift-wip

This commit is contained in:
smoogipoo 2018-12-22 23:23:21 +09:00
commit 02365ee5ba
24 changed files with 914 additions and 42 deletions

View File

@ -21,7 +21,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected DrawableOsuHitObject(OsuHitObject hitObject)
: base(hitObject)
{
base.AddInternal(shakeContainer = new ShakeContainer { RelativeSizeAxes = Axes.Both });
base.AddInternal(shakeContainer = new ShakeContainer
{
ShakeDuration = 30,
RelativeSizeAxes = Axes.Both
});
Alpha = 0;
}

View File

@ -0,0 +1,32 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using osu.Framework.Graphics.Containers;
using osu.Game.Overlays;
using osu.Game.Overlays.AccountCreation;
namespace osu.Game.Tests.Visual
{
public class TestCaseAccountCreationOverlay : OsuTestCase
{
public override IReadOnlyList<Type> RequiredTypes => new[]
{
typeof(ErrorTextFlowContainer),
typeof(AccountCreationBackground),
typeof(ScreenEntry),
typeof(ScreenWarning),
typeof(ScreenWelcome),
typeof(AccountCreationScreen),
};
public TestCaseAccountCreationOverlay()
{
var accountCreation = new AccountCreationOverlay();
Child = accountCreation;
accountCreation.State = Visibility.Visible;
}
}
}

View File

@ -26,7 +26,6 @@ namespace osu.Game.Graphics.Containers
private PreviewTrackManager previewTrackManager;
protected readonly Bindable<OverlayActivation> OverlayActivationMode = new Bindable<OverlayActivation>(OverlayActivation.All);
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)

View File

@ -11,29 +11,43 @@ namespace osu.Game.Graphics.Containers
/// </summary>
public class ShakeContainer : Container
{
/// <summary>
/// The length of a single shake.
/// </summary>
public float ShakeDuration = 80;
/// <summary>
/// Total number of shakes. May be shortened if possible.
/// </summary>
public float TotalShakes = 4;
/// <summary>
/// Pixels of displacement per shake.
/// </summary>
public float ShakeMagnitude = 8;
/// <summary>
/// Shake the contents of this container.
/// </summary>
/// <param name="maximumLength">The maximum length the shake should last.</param>
public void Shake(double maximumLength)
public void Shake(double? maximumLength = null)
{
const float shake_amount = 8;
const float shake_duration = 30;
// if we don't have enough time, don't bother shaking.
if (maximumLength < shake_duration * 2)
if (maximumLength < ShakeDuration * 2)
return;
var sequence = this.MoveToX(shake_amount, shake_duration / 2, Easing.OutSine).Then()
.MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then();
var sequence = this.MoveToX(shake_amount, ShakeDuration / 2, Easing.OutSine).Then()
.MoveToX(-shake_amount, ShakeDuration, Easing.InOutSine).Then();
// if we don't have enough time for the second shake, skip it.
if (maximumLength > shake_duration * 4)
if (!maximumLength.HasValue || maximumLength >= ShakeDuration * 4)
sequence = sequence
.MoveToX(shake_amount, shake_duration, Easing.InOutSine).Then()
.MoveToX(-shake_amount, shake_duration, Easing.InOutSine).Then();
.MoveToX(shake_amount, ShakeDuration, Easing.InOutSine).Then()
.MoveToX(-shake_amount, ShakeDuration, Easing.InOutSine).Then();
sequence.MoveToX(0, shake_duration / 2, Easing.InSine);
sequence.MoveToX(0, ShakeDuration / 2, Easing.InSine);
}
}
}

View File

@ -8,6 +8,9 @@ using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// A loading spinner.
/// </summary>
public class LoadingAnimation : VisibilityContainer
{
private readonly SpriteIcon spinner;

View File

@ -0,0 +1,56 @@
// Copyright (c) 2007-2018 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events;
using osuTK.Graphics;
namespace osu.Game.Graphics.UserInterface
{
/// <summary>
/// An overlay that will consume all available space and block input when required.
/// Useful for disabling all elements in a form and showing we are waiting on a response, for instance.
/// </summary>
public class ProcessingOverlay : VisibilityContainer
{
private const float transition_duration = 200;
public ProcessingOverlay()
{
RelativeSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
InternalChildren = new Drawable[]
{
new Box
{
Colour = Color4.Black,
RelativeSizeAxes = Axes.Both,
Alpha = 0.9f,
},
new LoadingAnimation { State = Visibility.Visible }
};
}
protected override bool Handle(UIEvent e)
{
return true;
}
protected override void PopIn()
{
this.FadeIn(transition_duration * 2, Easing.OutQuint);
}
protected override void PopOut()
{
this.FadeOut(transition_duration, Easing.OutQuint);
}
}
}

View File

@ -5,7 +5,9 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Net;
using System.Net.Http;
using System.Threading;
using Newtonsoft.Json.Linq;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Logging;
@ -159,7 +161,7 @@ namespace osu.Game.Online.API
//hard bail if we can't get a valid access token.
if (authentication.RequestAccessToken() == null)
{
Logout(false);
Logout();
continue;
}
@ -188,6 +190,39 @@ namespace osu.Game.Online.API
this.password = password;
}
public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password)
{
Debug.Assert(State == APIState.Offline);
var req = new RegistrationRequest
{
Url = $@"{Endpoint}/users",
Method = HttpMethod.Post,
Username = username,
Email = email,
Password = password
};
try
{
req.Perform();
}
catch (Exception e)
{
try
{
return JObject.Parse(req.ResponseString).SelectToken("form_error", true).ToObject<RegistrationRequest.RegistrationRequestErrors>();
}
catch
{
// if we couldn't deserialize the error message let's throw the original exception outwards.
throw e;
}
}
return null;
}
/// <summary>
/// Handle a single API request.
/// Ensures all exceptions are caught and dealt with correctly.
@ -258,7 +293,7 @@ namespace osu.Game.Online.API
switch (statusCode)
{
case HttpStatusCode.Unauthorized:
Logout(false);
Logout();
return true;
case HttpStatusCode.RequestTimeout:
failureCount++;
@ -307,10 +342,9 @@ namespace osu.Game.Online.API
}
}
public void Logout(bool clearUsername = true)
public void Logout()
{
flushQueue();
if (clearUsername) ProvidedUsername = null;
password = null;
authentication.Clear();
LocalUser.Value = createGuestUser();

View File

@ -0,0 +1,41 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using Newtonsoft.Json;
using osu.Framework.IO.Network;
namespace osu.Game.Online.API
{
public class RegistrationRequest : WebRequest
{
internal string Username;
internal string Email;
internal string Password;
protected override void PrePerform()
{
AddParameter("user[username]", Username);
AddParameter("user[user_email]", Email);
AddParameter("user[password]", Password);
base.PrePerform();
}
public class RegistrationRequestErrors
{
public UserErrors User;
public class UserErrors
{
[JsonProperty("username")]
public string[] Username;
[JsonProperty("user_email")]
public string[] Email;
[JsonProperty("password")]
public string[] Password;
}
}
}
}

View File

@ -61,6 +61,8 @@ namespace osu.Game
private DialogOverlay dialogOverlay;
private AccountCreationOverlay accountCreation;
private DirectOverlay direct;
private SocialOverlay social;
@ -185,7 +187,13 @@ namespace osu.Game
}
private ExternalLinkOpener externalLinkOpener;
public void OpenUrlExternally(string url) => externalLinkOpener.OpenUrlExternally(url);
public void OpenUrlExternally(string url)
{
if (url.StartsWith("/"))
url = $"{API.Endpoint}{url}";
externalLinkOpener.OpenUrlExternally(url);
}
private ScheduledDelegate scoreLoad;
@ -400,11 +408,21 @@ namespace osu.Game
Origin = Anchor.TopRight,
}, overlayContent.Add);
loadComponentSingleFile(dialogOverlay = new DialogOverlay
loadComponentSingleFile(accountCreation = new AccountCreationOverlay
{
Depth = -6,
}, overlayContent.Add);
loadComponentSingleFile(dialogOverlay = new DialogOverlay
{
Depth = -7,
}, overlayContent.Add);
loadComponentSingleFile(externalLinkOpener = new ExternalLinkOpener
{
Depth = -8,
}, overlayContent.Add);
dependencies.Cache(idleTracker);
dependencies.Cache(settings);
dependencies.Cache(onscreenDisplay);
@ -417,6 +435,7 @@ namespace osu.Game
dependencies.Cache(beatmapSetOverlay);
dependencies.Cache(notifications);
dependencies.Cache(dialogOverlay);
dependencies.Cache(accountCreation);
chatOverlay.StateChanged += state => channelManager.HighPollRate.Value = state == Visibility.Visible;

View File

@ -60,6 +60,8 @@ namespace osu.Game
protected RulesetConfigCache RulesetConfigCache;
protected APIAccess API;
protected MenuCursorContainer MenuCursorContainer;
private Container content;
@ -146,14 +148,14 @@ namespace osu.Game
dependencies.Cache(SkinManager = new SkinManager(Host.Storage, contextFactory, Host, Audio));
dependencies.CacheAs<ISkinSource>(SkinManager);
var api = new APIAccess(LocalConfig);
API = new APIAccess(LocalConfig);
dependencies.Cache(api);
dependencies.CacheAs<IAPIProvider>(api);
dependencies.Cache(API);
dependencies.CacheAs<IAPIProvider>(API);
dependencies.Cache(RulesetStore = new RulesetStore(contextFactory));
dependencies.Cache(FileStore = new FileStore(contextFactory, Host.Storage));
dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, api, Audio, Host));
dependencies.Cache(BeatmapManager = new BeatmapManager(Host.Storage, contextFactory, RulesetStore, API, Audio, Host));
dependencies.Cache(ScoreManager = new ScoreManager(RulesetStore, BeatmapManager, Host.Storage, contextFactory, Host));
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
@ -177,7 +179,7 @@ namespace osu.Game
FileStore.Cleanup();
AddInternal(api);
AddInternal(API);
GlobalActionContainer globalBinding;

View File

@ -0,0 +1,48 @@
// Copyright (c) 2007-2018 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.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
namespace osu.Game.Overlays.AccountCreation
{
public class AccountCreationBackground : Sprite
{
public AccountCreationBackground()
{
FillMode = FillMode.Fill;
RelativeSizeAxes = Axes.Both;
Anchor = Anchor.CentreRight;
Origin = Anchor.CentreRight;
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore textures)
{
Texture = textures.Get("Backgrounds/registration");
}
protected override void LoadComplete()
{
const float x_movement = 80;
const float initial_move_time = 5000;
const float loop_move_time = 10000;
base.LoadComplete();
this.FadeInFromZero(initial_move_time / 4, Easing.OutQuint);
this.MoveToX(x_movement / 2).MoveToX(0, initial_move_time, Easing.OutQuint);
using (BeginDelayedSequence(initial_move_time))
{
this
.MoveToX(x_movement, loop_move_time, Easing.InOutSine)
.Then().MoveToX(0, loop_move_time, Easing.InOutSine)
.Loop();
}
}
}
}

View File

@ -0,0 +1,29 @@
// Copyright (c) 2007-2018 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;
namespace osu.Game.Overlays.AccountCreation
{
public abstract class AccountCreationScreen : Screen
{
protected override void OnEntering(Screen last)
{
base.OnEntering(last);
Content.FadeOut().Delay(200).FadeIn(200);
}
protected override void OnResuming(Screen last)
{
base.OnResuming(last);
Content.FadeIn(200);
}
protected override void OnSuspending(Screen next)
{
base.OnSuspending(next);
Content.FadeOut(200);
}
}
}

View File

@ -0,0 +1,35 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using osu.Framework.Graphics;
using osu.Game.Graphics.Containers;
using osuTK.Graphics;
namespace osu.Game.Overlays.AccountCreation
{
public class ErrorTextFlowContainer : OsuTextFlowContainer
{
private readonly List<Drawable> errorDrawables = new List<Drawable>();
public ErrorTextFlowContainer()
: base(cp => { cp.TextSize = 12; })
{
}
public void ClearErrors()
{
errorDrawables.ForEach(d => d.Expire());
}
public void AddErrors(string[] errors)
{
ClearErrors();
if (errors == null) return;
foreach (var error in errors)
errorDrawables.AddRange(AddParagraph(error, cp => cp.Colour = Color4.Red));
}
}
}

View File

@ -0,0 +1,220 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using osu.Framework.Allocation;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.MathUtils;
using osu.Framework.Screens;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Overlays.Settings;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.AccountCreation
{
public class ScreenEntry : AccountCreationScreen
{
private ErrorTextFlowContainer usernameDescription;
private ErrorTextFlowContainer emailAddressDescription;
private ErrorTextFlowContainer passwordDescription;
private OsuTextBox usernameTextBox;
private OsuTextBox emailTextBox;
private OsuPasswordTextBox passwordTextBox;
private APIAccess api;
private ShakeContainer registerShake;
private IEnumerable<Drawable> characterCheckText;
private OsuTextBox[] textboxes;
private ProcessingOverlay processingOverlay;
[BackgroundDependencyLoader]
private void load(OsuColour colours, APIAccess api)
{
this.api = api;
Children = new Drawable[]
{
new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding(20),
Spacing = new Vector2(0, 10),
Children = new Drawable[]
{
new OsuSpriteText
{
TextSize = 20,
Margin = new MarginPadding { Vertical = 10 },
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "Let's create an account!",
},
usernameTextBox = new OsuTextBox
{
PlaceholderText = "username",
RelativeSizeAxes = Axes.X,
TabbableContentContainer = this
},
usernameDescription = new ErrorTextFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
},
emailTextBox = new OsuTextBox
{
PlaceholderText = "email address",
RelativeSizeAxes = Axes.X,
TabbableContentContainer = this
},
emailAddressDescription = new ErrorTextFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
},
passwordTextBox = new OsuPasswordTextBox
{
PlaceholderText = "password",
RelativeSizeAxes = Axes.X,
TabbableContentContainer = this,
},
passwordDescription = new ErrorTextFlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
},
new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Children = new Drawable[]
{
registerShake = new ShakeContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Child = new SettingsButton
{
Text = "Register",
Margin = new MarginPadding { Vertical = 20 },
Action = performRegistration
}
}
}
},
},
},
processingOverlay = new ProcessingOverlay { Alpha = 0 }
};
textboxes = new[] { usernameTextBox, emailTextBox, passwordTextBox };
usernameDescription.AddText("This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!");
emailAddressDescription.AddText("Will be used for notifications, account verification and in the case you forget your password. No spam, ever.");
emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = "Exo2.0-Bold");
passwordDescription.AddText("At least ");
characterCheckText = passwordDescription.AddText("8 characters long");
passwordDescription.AddText(". Choose something long but also something you will remember, like a line from your favourite song.");
passwordTextBox.Current.ValueChanged += text => { characterCheckText.ForEach(s => s.Colour = text.Length == 0 ? Color4.White : Interpolation.ValueAt(text.Length, Color4.OrangeRed, Color4.YellowGreen, 0, 8, Easing.In)); };
}
protected override void Update()
{
base.Update();
if (!textboxes.Any(t => t.HasFocus))
focusNextTextbox();
}
protected override void OnEntering(Screen last)
{
base.OnEntering(last);
processingOverlay.Hide();
}
private void performRegistration()
{
if (focusNextTextbox())
{
registerShake.Shake();
return;
}
usernameDescription.ClearErrors();
emailAddressDescription.ClearErrors();
passwordDescription.ClearErrors();
processingOverlay.Show();
Task.Run(() =>
{
bool success;
RegistrationRequest.RegistrationRequestErrors errors = null;
try
{
errors = api.CreateAccount(emailTextBox.Text, usernameTextBox.Text, passwordTextBox.Text);
success = errors == null;
}
catch (Exception)
{
success = false;
}
Schedule(() =>
{
if (!success)
{
if (errors != null)
{
usernameDescription.AddErrors(errors.User.Username);
emailAddressDescription.AddErrors(errors.User.Email);
passwordDescription.AddErrors(errors.User.Password);
}
else
{
passwordDescription.AddErrors(new[] { "Something happened... but we're not sure what." });
}
registerShake.Shake();
processingOverlay.Hide();
return;
}
api.Login(emailTextBox.Text, passwordTextBox.Text);
});
});
}
private bool focusNextTextbox()
{
var nextTextbox = nextUnfilledTextbox();
if (nextTextbox != null)
{
Schedule(() => GetContainingInputManager().ChangeFocus(nextTextbox));
return true;
}
return false;
}
private OsuTextBox nextUnfilledTextbox() => textboxes.FirstOrDefault(t => string.IsNullOrEmpty(t.Text));
}
}

View File

@ -0,0 +1,133 @@
// Copyright (c) 2007-2018 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Framework.Screens;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API;
using osu.Game.Overlays.Settings;
using osu.Game.Screens.Menu;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays.AccountCreation
{
public class ScreenWarning : AccountCreationScreen
{
private OsuTextFlowContainer multiAccountExplanationText;
private LinkFlowContainer furtherAssistance;
private APIAccess api;
private const string help_centre_url = "/help/wiki/Help_Centre#login";
protected override void OnEntering(Screen last)
{
if (string.IsNullOrEmpty(api.ProvidedUsername))
{
Content.FadeOut();
Push(new ScreenEntry());
return;
}
base.OnEntering(last);
}
[BackgroundDependencyLoader(true)]
private void load(OsuColour colours, APIAccess api, OsuGame game, TextureStore textures)
{
this.api = api;
if (string.IsNullOrEmpty(api.ProvidedUsername))
return;
Children = new Drawable[]
{
new Sprite
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Texture = textures.Get(@"Menu/dev-build-footer"),
},
new Sprite
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Texture = textures.Get(@"Menu/dev-build-footer"),
},
new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding(20),
Spacing = new Vector2(0, 5),
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.X,
Height = 150,
Child = new OsuLogo
{
Scale = new Vector2(0.1f),
Anchor = Anchor.Centre,
Triangles = false,
},
},
new OsuSpriteText
{
TextSize = 28,
Font = "Exo2.0-Light",
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Colour = Color4.Red,
Text = "Warning! 注意!",
},
multiAccountExplanationText = new OsuTextFlowContainer(cp => { cp.TextSize = 12; })
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y
},
new SettingsButton
{
Text = "Help, I can't access my account!",
Margin = new MarginPadding { Top = 50 },
Action = () => game?.OpenUrlExternally(help_centre_url)
},
new DangerousSettingsButton
{
Text = "I understand. This account isn't for me.",
Action = () => Push(new ScreenEntry())
},
furtherAssistance = new LinkFlowContainer(cp => { cp.TextSize = 12; })
{
Margin = new MarginPadding { Top = 20 },
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both
},
}
}
};
multiAccountExplanationText.AddText("Are you ");
multiAccountExplanationText.AddText(api.ProvidedUsername, cp => cp.Colour = colours.BlueLight);
multiAccountExplanationText.AddText("? osu! has a policy of ");
multiAccountExplanationText.AddText("one account per person!", cp => cp.Colour = colours.Yellow);
multiAccountExplanationText.AddText(" Please be aware that creating more than one account per person may result in ");
multiAccountExplanationText.AddText("permanent deactivation of accounts", cp => cp.Colour = colours.Yellow);
multiAccountExplanationText.AddText(".");
furtherAssistance.AddText("Need further assistance? Contact us via our ");
furtherAssistance.AddLink("support system", help_centre_url);
furtherAssistance.AddText(".");
}
}
}

View File

@ -0,0 +1,65 @@
// Copyright (c) 2007-2018 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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.Settings;
using osu.Game.Screens.Menu;
using osuTK;
namespace osu.Game.Overlays.AccountCreation
{
public class ScreenWelcome : AccountCreationScreen
{
[BackgroundDependencyLoader]
private void load()
{
Child = new FillFlowContainer
{
RelativeSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Padding = new MarginPadding(20),
Spacing = new Vector2(0, 5),
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.X,
Height = 150,
Child = new OsuLogo
{
Scale = new Vector2(0.1f),
Anchor = Anchor.Centre,
Triangles = false,
},
},
new OsuSpriteText
{
TextSize = 24,
Font = "Exo2.0-Light",
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "New Player Registration",
},
new OsuSpriteText
{
TextSize = 12,
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
Text = "let's get you started",
},
new SettingsButton
{
Text = "Let's create an account!",
Margin = new MarginPadding { Vertical = 120 },
Action = () => Push(new ScreenWarning())
}
}
};
}
}
}

View File

@ -0,0 +1,110 @@
// Copyright (c) 2007-2018 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.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Overlays.AccountCreation;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Overlays
{
public class AccountCreationOverlay : OsuFocusedOverlayContainer, IOnlineComponent
{
private const float transition_time = 400;
private ScreenWelcome welcomeScreen;
public AccountCreationOverlay()
{
Size = new Vector2(620, 450);
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours, APIAccess api)
{
api.Register(this);
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Radius = 5,
Colour = Color4.Black.Opacity(0.2f),
},
Masking = true,
CornerRadius = 10,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.6f,
},
new DelayedLoadWrapper(new AccountCreationBackground(), 0),
new Container
{
RelativeSizeAxes = Axes.Both,
Width = 0.6f,
AutoSizeDuration = transition_time,
AutoSizeEasing = Easing.OutQuint,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.Black,
Alpha = 0.9f,
},
welcomeScreen = new ScreenWelcome(),
}
}
}
}
};
}
protected override void PopIn()
{
base.PopIn();
this.FadeIn(transition_time, Easing.OutQuint);
if (welcomeScreen.ChildScreen != null)
welcomeScreen.MakeCurrent();
}
protected override void PopOut()
{
base.PopOut();
this.FadeOut(100);
}
public void APIStateChanged(APIAccess api, APIState state)
{
switch (state)
{
case APIState.Offline:
case APIState.Failing:
break;
case APIState.Connecting:
break;
case APIState.Online:
State = Visibility.Hidden;
break;
}
}
}
}

View File

@ -52,6 +52,7 @@ namespace osu.Game.Overlays.Chat.Tabs
Child = new DelayedLoadWrapper(new Avatar(value.Users.First())
{
RelativeSizeAxes = Axes.Both,
OpenOnClick = { Value = false },
OnLoadComplete = d => d.FadeInFromZero(300, Easing.OutQuint),
})
{

View File

@ -79,7 +79,10 @@ namespace osu.Game.Overlays.Settings.Sections.General
Margin = new MarginPadding { Bottom = 5 },
Font = @"Exo2.0-Black",
},
form = new LoginForm()
form = new LoginForm
{
RequestHide = RequestHide
}
};
break;
case APIState.Failing:
@ -189,6 +192,8 @@ namespace osu.Game.Overlays.Settings.Sections.General
private TextBox password;
private APIAccess api;
public Action RequestHide;
private void performLogin()
{
if (!string.IsNullOrEmpty(username.Text) && !string.IsNullOrEmpty(password.Text))
@ -196,7 +201,7 @@ namespace osu.Game.Overlays.Settings.Sections.General
}
[BackgroundDependencyLoader(permitNulls: true)]
private void load(APIAccess api, OsuConfigManager config)
private void load(APIAccess api, OsuConfigManager config, AccountCreationOverlay accountCreation)
{
this.api = api;
Direction = FillDirection.Vertical;
@ -207,14 +212,14 @@ namespace osu.Game.Overlays.Settings.Sections.General
{
username = new OsuTextBox
{
PlaceholderText = "Email address",
PlaceholderText = "email address",
RelativeSizeAxes = Axes.X,
Text = api?.ProvidedUsername ?? string.Empty,
TabbableContentContainer = this
},
password = new OsuPasswordTextBox
{
PlaceholderText = "Password",
PlaceholderText = "password",
RelativeSizeAxes = Axes.X,
TabbableContentContainer = this,
OnCommit = (sender, newText) => performLogin()
@ -237,7 +242,11 @@ namespace osu.Game.Overlays.Settings.Sections.General
new SettingsButton
{
Text = "Register",
//Action = registerLink
Action = () =>
{
RequestHide();
accountCreation.Show();
}
}
};
}
@ -322,12 +331,10 @@ namespace osu.Game.Overlays.Settings.Sections.General
public const float LABEL_LEFT_MARGIN = 20;
private readonly SpriteIcon statusIcon;
public Color4 StatusColour
{
set
{
statusIcon.FadeColour(value, 500, Easing.OutQuint);
}
set { statusIcon.FadeColour(value, 500, Easing.OutQuint); }
}
public UserDropdownHeader()
@ -368,10 +375,13 @@ namespace osu.Game.Overlays.Settings.Sections.General
private enum UserAction
{
Online,
[Description(@"Do not disturb")]
DoNotDisturb,
[Description(@"Appear offline")]
AppearOffline,
[Description(@"Sign out")]
SignOut,
}

View File

@ -79,8 +79,6 @@ namespace osu.Game.Screens.Menu
private readonly Container impactContainer;
private const float default_size = 480;
private const double early_activation = 60;
public override bool IsPresent => base.IsPresent || Scheduler.HasPendingTasks;
@ -89,8 +87,6 @@ namespace osu.Game.Screens.Menu
{
EarlyActivationMilliseconds = early_activation;
Size = new Vector2(default_size);
Origin = Anchor.Centre;
AutoSizeAxes = Axes.Both;

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osuTK;
@ -13,7 +14,7 @@ using osu.Framework.Graphics.Shapes;
namespace osu.Game.Screens.Ranking
{
public class ResultModeButton : TabItem<IResultPageInfo>
public class ResultModeButton : TabItem<IResultPageInfo>, IHasTooltip
{
private readonly FontAwesome icon;
private Color4 activeColour;
@ -24,6 +25,7 @@ namespace osu.Game.Screens.Ranking
: base(mode)
{
icon = mode.Icon;
TooltipText = mode.Name;
}
[BackgroundDependencyLoader]
@ -85,5 +87,7 @@ namespace osu.Game.Screens.Ranking
protected override void OnActivated() => colouredPart.FadeColour(activeColour, 200, Easing.OutQuint);
protected override void OnDeactivated() => colouredPart.FadeColour(inactiveColour, 200, Easing.OutQuint);
public string TooltipText { get; private set; }
}
}

View File

@ -24,12 +24,12 @@ namespace osu.Game.Screens.Select.Carousel
{
base.Filter(criteria);
bool match = criteria.Ruleset == null || Beatmap.RulesetID == criteria.Ruleset.ID || Beatmap.RulesetID == 0 && criteria.Ruleset.ID > 0 && criteria.AllowConvertedBeatmaps;
bool match = criteria.Ruleset == null || Beatmap.RulesetID == criteria.Ruleset.ID || (Beatmap.RulesetID == 0 && criteria.Ruleset.ID > 0 && criteria.AllowConvertedBeatmaps);
if (!string.IsNullOrEmpty(criteria.SearchText))
foreach (var criteriaTerm in criteria.SearchTerms)
match &=
Beatmap.Metadata.SearchableTerms.Any(term => term.IndexOf(criteria.SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0) ||
Beatmap.Version.IndexOf(criteria.SearchText, StringComparison.InvariantCultureIgnoreCase) >= 0;
Beatmap.Metadata.SearchableTerms.Any(term => term.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0) ||
Beatmap.Version.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0;
Filtered.Value = !match;
}

View File

@ -1,6 +1,8 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using osu.Game.Rulesets;
using osu.Game.Screens.Select.Filter;
@ -10,8 +12,22 @@ namespace osu.Game.Screens.Select
{
public GroupMode Group;
public SortMode Sort;
public string SearchText;
public string[] SearchTerms = Array.Empty<string>();
public RulesetInfo Ruleset;
public bool AllowConvertedBeatmaps;
private string searchText;
public string SearchText
{
get { return searchText; }
set
{
searchText = value;
SearchTerms = searchText.Split(',', ' ', '!').Where(s => !string.IsNullOrEmpty(s)).ToArray();
}
}
}
}

View File

@ -8,7 +8,8 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">SOLUTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeAccessorOwnerBody/@EntryIndexedValue">HINT</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeModifiersOrder/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeRedundantParentheses/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeRedundantParentheses/@EntryIndexedValue"></s:String>
<s:Boolean x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeRedundantParentheses/@EntryIndexRemoved">True</s:Boolean>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTypeMemberModifiers/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeTypeModifiers/@EntryIndexedValue">WARNING</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=AssignedValueIsNeverUsed/@EntryIndexedValue">HINT</s:String>