mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge branch 'master' into Private_Messages
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -16,6 +17,8 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
protected override SpriteText CreateSpriteText() => new OsuSpriteText();
|
||||
|
||||
public void AddArbitraryDrawable(Drawable drawable) => AddInternal(drawable);
|
||||
|
||||
public void AddIcon(FontAwesome icon, Action<SpriteText> creationParameters = null) => AddText(((char)icon).ToString(), creationParameters);
|
||||
}
|
||||
}
|
||||
|
@ -12,14 +12,14 @@ namespace osu.Game.Graphics
|
||||
{
|
||||
public class DrawableDate : OsuSpriteText, IHasTooltip
|
||||
{
|
||||
private readonly DateTimeOffset date;
|
||||
protected readonly DateTimeOffset Date;
|
||||
|
||||
public DrawableDate(DateTimeOffset date)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
Font = "Exo2.0-RegularItalic";
|
||||
|
||||
this.date = date.ToLocalTime();
|
||||
Date = date.ToLocalTime();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -38,7 +38,7 @@ namespace osu.Game.Graphics
|
||||
{
|
||||
updateTime();
|
||||
|
||||
var diffToNow = DateTimeOffset.Now.Subtract(date);
|
||||
var diffToNow = DateTimeOffset.Now.Subtract(Date);
|
||||
|
||||
double timeUntilNextUpdate = 1000;
|
||||
if (diffToNow.TotalSeconds > 60)
|
||||
@ -58,8 +58,10 @@ namespace osu.Game.Graphics
|
||||
|
||||
public override bool HandleMouseInput => true;
|
||||
|
||||
private void updateTime() => Text = date.Humanize();
|
||||
protected virtual string Format() => Date.Humanize();
|
||||
|
||||
public string TooltipText => date.ToString();
|
||||
private void updateTime() => Text = Format();
|
||||
|
||||
public virtual string TooltipText => string.Format($"{Date:MMMM d, yyyy h:mm tt \"UTC\"z}");
|
||||
}
|
||||
}
|
||||
|
@ -4,12 +4,17 @@
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class LoadingAnimation : VisibilityContainer
|
||||
{
|
||||
private readonly SpriteIcon spinner;
|
||||
private readonly SpriteIcon spinnerShadow;
|
||||
|
||||
private const float spin_duration = 600;
|
||||
private const float transition_duration = 200;
|
||||
|
||||
public LoadingAnimation()
|
||||
{
|
||||
@ -20,12 +25,22 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
spinner = new SpriteIcon
|
||||
spinnerShadow = new SpriteIcon
|
||||
{
|
||||
Size = new Vector2(20),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = FontAwesome.fa_spinner
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Position = new Vector2(1, 1),
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.4f,
|
||||
Icon = FontAwesome.fa_circle_o_notch
|
||||
},
|
||||
spinner = new SpriteIcon
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Icon = FontAwesome.fa_circle_o_notch
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -34,12 +49,11 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
spinner.Spin(2000, RotationDirection.Clockwise);
|
||||
spinner.Spin(spin_duration, RotationDirection.Clockwise);
|
||||
spinnerShadow.Spin(spin_duration, RotationDirection.Clockwise);
|
||||
}
|
||||
|
||||
private const float transition_duration = 500;
|
||||
|
||||
protected override void PopIn() => this.FadeIn(transition_duration * 5, Easing.OutQuint);
|
||||
protected override void PopIn() => this.FadeIn(transition_duration * 2, Easing.OutQuint);
|
||||
|
||||
protected override void PopOut() => this.FadeOut(transition_duration, Easing.OutQuint);
|
||||
}
|
||||
|
Reference in New Issue
Block a user