mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 21:32:56 +08:00
Merge branch 'master' into move-state-logic
This commit is contained in:
commit
9b526ef61e
@ -29,29 +29,36 @@ namespace osu.Desktop
|
||||
|
||||
if (!host.IsPrimaryInstance)
|
||||
{
|
||||
var importer = new ArchiveImportIPCChannel(host);
|
||||
// Restore the cwd so relative paths given at the command line work correctly
|
||||
Directory.SetCurrentDirectory(cwd);
|
||||
|
||||
foreach (var file in args)
|
||||
if (args.Length > 0 && args[0].Contains('.')) // easy way to check for a file import in args
|
||||
{
|
||||
Console.WriteLine(@"Importing {0}", file);
|
||||
if (!importer.ImportAsync(Path.GetFullPath(file)).Wait(3000))
|
||||
throw new TimeoutException(@"IPC took too long to send");
|
||||
var importer = new ArchiveImportIPCChannel(host);
|
||||
// Restore the cwd so relative paths given at the command line work correctly
|
||||
Directory.SetCurrentDirectory(cwd);
|
||||
|
||||
foreach (var file in args)
|
||||
{
|
||||
Console.WriteLine(@"Importing {0}", file);
|
||||
if (!importer.ImportAsync(Path.GetFullPath(file)).Wait(3000))
|
||||
throw new TimeoutException(@"IPC took too long to send");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// we want to allow multiple instances to be started when in debug.
|
||||
if (!DebugUtils.IsDebugBuild)
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (args.FirstOrDefault() ?? string.Empty)
|
||||
{
|
||||
default:
|
||||
host.Run(new OsuGameDesktop(args));
|
||||
break;
|
||||
|
||||
case "--tournament":
|
||||
host.Run(new TournamentGame());
|
||||
break;
|
||||
}
|
||||
switch (args.FirstOrDefault() ?? string.Empty)
|
||||
{
|
||||
default:
|
||||
host.Run(new OsuGameDesktop(args));
|
||||
break;
|
||||
|
||||
case "--tournament":
|
||||
host.Run(new TournamentGame());
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components
|
||||
this.hitCircle = hitCircle;
|
||||
Origin = Anchor.Centre;
|
||||
|
||||
Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2);
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
Scale = new Vector2(hitCircle.Scale);
|
||||
CornerRadius = Size.X / 2;
|
||||
|
||||
|
@ -24,7 +24,6 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
InternalChild = body = new ManualSliderBody
|
||||
{
|
||||
AccentColour = Color4.Transparent,
|
||||
PathRadius = slider.Scale * 64
|
||||
};
|
||||
}
|
||||
|
||||
@ -34,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components
|
||||
body.BorderColour = colours.Yellow;
|
||||
|
||||
PositionBindable.BindValueChanged(_ => updatePosition(), true);
|
||||
ScaleBindable.BindValueChanged(scale => body.PathRadius = scale.NewValue * 64, true);
|
||||
ScaleBindable.BindValueChanged(scale => body.PathRadius = scale.NewValue * OsuHitObject.OBJECT_RADIUS, true);
|
||||
}
|
||||
|
||||
private void updatePosition() => Position = slider.StackedPosition;
|
||||
|
@ -11,6 +11,8 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override string Acronym => "TD";
|
||||
public override double ScoreMultiplier => 1;
|
||||
|
||||
public override ModType Type => ModType.System;
|
||||
|
||||
public override bool Ranked => true;
|
||||
}
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
Body = new SnakingSliderBody(s)
|
||||
{
|
||||
PathRadius = s.Scale * 64,
|
||||
PathRadius = s.Scale * OsuHitObject.OBJECT_RADIUS,
|
||||
},
|
||||
ticks = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
|
||||
repeatPoints = new Container<DrawableRepeatPoint> { RelativeSizeAxes = Axes.Both },
|
||||
|
@ -34,11 +34,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
CornerRadius = Size.X / 2,
|
||||
Colour = AccentColour.Value,
|
||||
|
||||
BorderThickness = 2,
|
||||
BorderColour = Color4.White,
|
||||
|
||||
Child = new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
|
||||
public CirclePiece()
|
||||
{
|
||||
Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2);
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
Masking = true;
|
||||
CornerRadius = Size.X / 2;
|
||||
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public ExplodePiece()
|
||||
{
|
||||
Size = new Vector2(128);
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// 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.Graphics;
|
||||
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public FlashPiece()
|
||||
{
|
||||
Size = new Vector2(128);
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// 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.Graphics;
|
||||
@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public RingPiece()
|
||||
{
|
||||
Size = new Vector2(128);
|
||||
Size = new Vector2(OsuHitObject.OBJECT_RADIUS * 2);
|
||||
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
|
@ -17,8 +17,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
public class SliderBall : CircularContainer, ISliderProgress, IRequireHighFrequencyMousePosition
|
||||
{
|
||||
private const float width = 128;
|
||||
|
||||
private Color4 accentColour = Color4.Black;
|
||||
|
||||
public Func<OsuAction?> GetInitialHitAction;
|
||||
@ -57,8 +55,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Width = width,
|
||||
Height = width,
|
||||
Width = OsuHitObject.OBJECT_RADIUS * 2,
|
||||
Height = OsuHitObject.OBJECT_RADIUS * 2,
|
||||
Alpha = 0,
|
||||
Child = new SkinnableDrawable("Play/osu/sliderfollowcircle", _ => new CircularContainer
|
||||
{
|
||||
@ -84,8 +82,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
Alpha = 1,
|
||||
Child = new Container
|
||||
{
|
||||
Width = width,
|
||||
Height = width,
|
||||
Width = OsuHitObject.OBJECT_RADIUS * 2,
|
||||
Height = OsuHitObject.OBJECT_RADIUS * 2,
|
||||
// TODO: support skin filename animation (sliderb0, sliderb1...)
|
||||
Child = new SkinnableDrawable("Play/osu/sliderb", _ => new CircularContainer
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
{
|
||||
public abstract class OsuHitObject : HitObject, IHasComboInformation, IHasPosition
|
||||
{
|
||||
public const double OBJECT_RADIUS = 64;
|
||||
public const float OBJECT_RADIUS = 64;
|
||||
|
||||
public double TimePreempt = 600;
|
||||
public double TimeFadeIn = 400;
|
||||
|
@ -138,6 +138,12 @@ namespace osu.Game.Rulesets.Osu
|
||||
new MultiMod(new ModWindUp<OsuHitObject>(), new ModWindDown<OsuHitObject>()),
|
||||
};
|
||||
|
||||
case ModType.System:
|
||||
return new Mod[]
|
||||
{
|
||||
new OsuModTouchDevice(),
|
||||
};
|
||||
|
||||
default:
|
||||
return new Mod[] { };
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual.Online
|
||||
{
|
||||
typeof(HistoricalSection),
|
||||
typeof(PaginatedMostPlayedBeatmapContainer),
|
||||
typeof(DrawableMostPlayedRow),
|
||||
typeof(DrawableMostPlayedBeatmap),
|
||||
typeof(DrawableProfileRow)
|
||||
};
|
||||
|
||||
|
@ -66,6 +66,11 @@ namespace osu.Game.Beatmaps
|
||||
/// </summary>
|
||||
public int FavouriteCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this beatmap set has been favourited by the current user.
|
||||
/// </summary>
|
||||
public bool HasFavourited { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The availability of this beatmap set.
|
||||
/// </summary>
|
||||
|
@ -247,7 +247,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
// cancelling the beatmap load is safe for now since the retrieval is a synchronous
|
||||
// operation. if we add an async retrieval method this may need to be reconsidered.
|
||||
beatmapCancellation.Cancel();
|
||||
beatmapCancellation?.Cancel();
|
||||
total_count.Value--;
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
{
|
||||
base.Draw(vertexAction);
|
||||
|
||||
if (vertexBatch == null || vertexBatch.Size != Source.AimCount)
|
||||
if (Source.AimCount > 0 && (vertexBatch == null || vertexBatch.Size != Source.AimCount))
|
||||
{
|
||||
vertexBatch?.Dispose();
|
||||
vertexBatch = new TriangleBatch<TexturedVertex2D>(Source.AimCount, 1);
|
||||
|
26
osu.Game/Graphics/OpenGL/Vertices/PositionAndColourVertex.cs
Normal file
26
osu.Game/Graphics/OpenGL/Vertices/PositionAndColourVertex.cs
Normal file
@ -0,0 +1,26 @@
|
||||
// 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 System;
|
||||
using System.Runtime.InteropServices;
|
||||
using osu.Framework.Graphics.OpenGL.Vertices;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osuTK.Graphics.ES30;
|
||||
|
||||
namespace osu.Game.Graphics.OpenGL.Vertices
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct PositionAndColourVertex : IEquatable<PositionAndColourVertex>, IVertex
|
||||
{
|
||||
[VertexMember(2, VertexAttribPointerType.Float)]
|
||||
public Vector2 Position;
|
||||
|
||||
[VertexMember(4, VertexAttribPointerType.Float)]
|
||||
public Color4 Colour;
|
||||
|
||||
public bool Equals(PositionAndColourVertex other)
|
||||
=> Position.Equals(other.Position)
|
||||
&& Colour.Equals(other.Colour);
|
||||
}
|
||||
}
|
80
osu.Game/Graphics/Sprites/GlowingSpriteText.cs
Normal file
80
osu.Game/Graphics/Sprites/GlowingSpriteText.cs
Normal file
@ -0,0 +1,80 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Graphics.Sprites
|
||||
{
|
||||
public class GlowingSpriteText : Container, IHasText
|
||||
{
|
||||
private readonly OsuSpriteText spriteText, blurredText;
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => spriteText.Text;
|
||||
set => blurredText.Text = spriteText.Text = value;
|
||||
}
|
||||
|
||||
public FontUsage Font
|
||||
{
|
||||
get => spriteText.Font;
|
||||
set => blurredText.Font = spriteText.Font = value.With(fixedWidth: true);
|
||||
}
|
||||
|
||||
public Vector2 TextSize
|
||||
{
|
||||
get => spriteText.Size;
|
||||
set => blurredText.Size = spriteText.Size = value;
|
||||
}
|
||||
|
||||
public ColourInfo TextColour
|
||||
{
|
||||
get => spriteText.Colour;
|
||||
set => spriteText.Colour = value;
|
||||
}
|
||||
|
||||
public ColourInfo GlowColour
|
||||
{
|
||||
get => blurredText.Colour;
|
||||
set => blurredText.Colour = value;
|
||||
}
|
||||
|
||||
public GlowingSpriteText()
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new BufferedContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
BlurSigma = new Vector2(4),
|
||||
CacheDrawnFrameBuffer = true,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Blending = BlendingMode.Additive,
|
||||
Size = new Vector2(3f),
|
||||
Children = new[]
|
||||
{
|
||||
blurredText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Shadow = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
spriteText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Shadow = false,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Input.Events;
|
||||
using osuTK;
|
||||
using osuTK.Input;
|
||||
@ -33,6 +34,17 @@ namespace osu.Game.Graphics.UserInterface
|
||||
PlaceholderText = "type to search";
|
||||
}
|
||||
|
||||
public override bool OnPressed(PlatformAction action)
|
||||
{
|
||||
// Shift+delete is handled via PlatformAction on macOS. this is not so useful in the context of a SearchTextBox
|
||||
// as we do not allow arrow key navigation in the first place (ie. the care should always be at the end of text)
|
||||
// Avoid handling it here to allow other components to potentially consume the shortcut.
|
||||
if (action.ActionType == PlatformActionType.CharNext && action.ActionMethod == PlatformActionMethod.Delete)
|
||||
return false;
|
||||
|
||||
return base.OnPressed(action);
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
if (!e.ControlPressed && !e.ShiftPressed)
|
||||
|
@ -30,6 +30,9 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty(@"preview_url")]
|
||||
private string preview { get; set; }
|
||||
|
||||
[JsonProperty(@"has_favourited")]
|
||||
private bool hasFavourited { get; set; }
|
||||
|
||||
[JsonProperty(@"play_count")]
|
||||
private int playCount { get; set; }
|
||||
|
||||
@ -91,6 +94,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
Ranked = ranked,
|
||||
LastUpdated = lastUpdated,
|
||||
Availability = availability,
|
||||
HasFavourited = hasFavourited,
|
||||
},
|
||||
Beatmaps = beatmaps?.Select(b => b.ToBeatmap(rulesets)).ToList(),
|
||||
};
|
||||
|
@ -187,7 +187,13 @@ namespace osu.Game.Online.Leaderboards
|
||||
Spacing = new Vector2(5f, 0f),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
scoreLabel = new GlowingSpriteText(score.TotalScore.ToString(@"N0"), OsuFont.Numeric.With(size: 23), Color4.White, OsuColour.FromHex(@"83ccfa")),
|
||||
scoreLabel = new GlowingSpriteText
|
||||
{
|
||||
TextColour = Color4.White,
|
||||
GlowColour = OsuColour.FromHex(@"83ccfa"),
|
||||
Text = score.TotalScore.ToString(@"N0"),
|
||||
Font = OsuFont.Numeric.With(size: 23),
|
||||
},
|
||||
RankContainer = new Container
|
||||
{
|
||||
Size = new Vector2(40f, 20f),
|
||||
@ -275,49 +281,6 @@ namespace osu.Game.Online.Leaderboards
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
private class GlowingSpriteText : Container
|
||||
{
|
||||
public GlowingSpriteText(string text, FontUsage font, Color4 textColour, Color4 glowColour)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new BufferedContainer
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
BlurSigma = new Vector2(4),
|
||||
CacheDrawnFrameBuffer = true,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Blending = BlendingMode.Additive,
|
||||
Size = new Vector2(3f),
|
||||
Children = new[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = font.With(fixedWidth: true),
|
||||
Text = text,
|
||||
Colour = glowColour,
|
||||
Shadow = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = font.With(fixedWidth: true),
|
||||
Text = text,
|
||||
Colour = textColour,
|
||||
Shadow = false,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private class ScoreComponentLabel : Container, IHasTooltip
|
||||
{
|
||||
private const float icon_size = 20;
|
||||
@ -367,10 +330,14 @@ namespace osu.Game.Online.Leaderboards
|
||||
},
|
||||
},
|
||||
},
|
||||
new GlowingSpriteText(statistic.Value, OsuFont.GetFont(size: 17, weight: FontWeight.Bold), Color4.White, OsuColour.FromHex(@"83ccfa"))
|
||||
new GlowingSpriteText
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
TextColour = Color4.White,
|
||||
GlowColour = OsuColour.FromHex(@"83ccfa"),
|
||||
Text = statistic.Value,
|
||||
Font = OsuFont.GetFont(size: 17, weight: FontWeight.Bold),
|
||||
},
|
||||
},
|
||||
};
|
||||
|
@ -20,6 +20,7 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Development;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input;
|
||||
@ -153,7 +154,7 @@ namespace osu.Game
|
||||
{
|
||||
this.frameworkConfig = frameworkConfig;
|
||||
|
||||
if (!Host.IsPrimaryInstance)
|
||||
if (!Host.IsPrimaryInstance && !DebugUtils.IsDebugBuild)
|
||||
{
|
||||
Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error);
|
||||
Environment.Exit(0);
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osuTK;
|
||||
@ -15,7 +16,9 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
{
|
||||
public class FavouriteButton : HeaderButton
|
||||
{
|
||||
public readonly Bindable<bool> Favourited = new Bindable<bool>();
|
||||
public readonly Bindable<BeatmapSetInfo> BeatmapSet = new Bindable<BeatmapSetInfo>();
|
||||
|
||||
private readonly Bindable<bool> favourited = new Bindable<bool>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
@ -54,7 +57,15 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
},
|
||||
});
|
||||
|
||||
Favourited.ValueChanged += favourited =>
|
||||
BeatmapSet.BindValueChanged(setInfo =>
|
||||
{
|
||||
if (setInfo.NewValue?.OnlineInfo?.HasFavourited == null)
|
||||
return;
|
||||
|
||||
favourited.Value = setInfo.NewValue.OnlineInfo.HasFavourited;
|
||||
});
|
||||
|
||||
favourited.ValueChanged += favourited =>
|
||||
{
|
||||
if (favourited.NewValue)
|
||||
{
|
||||
@ -67,8 +78,6 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
|
||||
icon.Icon = FontAwesome.Regular.Heart;
|
||||
}
|
||||
};
|
||||
|
||||
Action = () => Favourited.Value = !Favourited.Value;
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
|
@ -161,7 +161,10 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
favouriteButton = new FavouriteButton(),
|
||||
favouriteButton = new FavouriteButton
|
||||
{
|
||||
BeatmapSet = { BindTarget = BeatmapSet }
|
||||
},
|
||||
downloadButtonsContainer = new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -85,6 +85,7 @@ namespace osu.Game.Overlays.Chat
|
||||
|
||||
Drawable effectedUsername = username = new OsuSpriteText
|
||||
{
|
||||
Shadow = false,
|
||||
Colour = hasBackground ? customUsernameColour : username_colours[message.Sender.Id % username_colours.Length],
|
||||
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true)
|
||||
};
|
||||
@ -133,6 +134,7 @@ namespace osu.Game.Overlays.Chat
|
||||
{
|
||||
timestamp = new OsuSpriteText
|
||||
{
|
||||
Shadow = false,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Font = OsuFont.GetFont(size: TextSize * 0.75f, weight: FontWeight.SemiBold, fixedWidth: true)
|
||||
@ -155,6 +157,8 @@ namespace osu.Game.Overlays.Chat
|
||||
{
|
||||
contentFlow = new LinkFlowContainer(t =>
|
||||
{
|
||||
t.Shadow = false;
|
||||
|
||||
if (Message.IsAction)
|
||||
{
|
||||
t.Font = OsuFont.GetFont(italics: true);
|
||||
|
@ -4,26 +4,23 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections
|
||||
{
|
||||
/// <summary>
|
||||
/// Display artist/title/mapper information, commonly used as the left portion of a profile or score display row (see <see cref="DrawableProfileRow"/>).
|
||||
/// </summary>
|
||||
public class BeatmapMetadataContainer : OsuHoverContainer
|
||||
public abstract class BeatmapMetadataContainer : OsuHoverContainer
|
||||
{
|
||||
private readonly BeatmapInfo beatmap;
|
||||
|
||||
public BeatmapMetadataContainer(BeatmapInfo beatmap)
|
||||
protected BeatmapMetadataContainer(BeatmapInfo beatmap)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
TooltipText = $"{beatmap.Metadata.Artist} - {beatmap.Metadata.Title}";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
@ -40,23 +37,10 @@ namespace osu.Game.Overlays.Profile.Sections
|
||||
Child = new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = new LocalisedString((
|
||||
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
|
||||
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
|
||||
Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold, italics: true)
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
|
||||
Padding = new MarginPadding { Top = 3 },
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true)
|
||||
},
|
||||
},
|
||||
Children = CreateText(beatmap),
|
||||
};
|
||||
}
|
||||
|
||||
protected abstract Drawable[] CreateText(BeatmapInfo beatmap);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,182 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
{
|
||||
public class DrawableMostPlayedBeatmap : OsuHoverContainer
|
||||
{
|
||||
private const int cover_width = 100;
|
||||
private const int corner_radius = 6;
|
||||
private const int height = 50;
|
||||
|
||||
private readonly BeatmapInfo beatmap;
|
||||
private readonly int playCount;
|
||||
|
||||
private Box background;
|
||||
|
||||
protected override IEnumerable<Drawable> EffectTargets => new[] { background };
|
||||
|
||||
public DrawableMostPlayedBeatmap(BeatmapInfo beatmap, int playCount)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
this.playCount = playCount;
|
||||
Enabled.Value = true; //manually enabled, because we have no action
|
||||
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = height;
|
||||
|
||||
Masking = true;
|
||||
CornerRadius = corner_radius;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
IdleColour = colours.GreySeafoam;
|
||||
HoverColour = colours.GreySeafoamLight;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new UpdateableBeatmapSetCover
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Width = cover_width,
|
||||
BeatmapSet = beatmap.BeatmapSet,
|
||||
CoverType = BeatmapSetCoverType.List,
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Left = cover_width - corner_radius },
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Masking = true,
|
||||
CornerRadius = corner_radius,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
background = new Box { RelativeSizeAxes = Axes.Both },
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding(10),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new MostPlayedBeatmapMetadataContainer(beatmap),
|
||||
new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular))
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Colour = colours.GreySeafoamLighter
|
||||
}.With(d =>
|
||||
{
|
||||
d.AddText("mapped by ");
|
||||
d.AddUserLink(beatmap.Metadata.Author);
|
||||
}),
|
||||
}
|
||||
},
|
||||
new PlayCountText(playCount)
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private class MostPlayedBeatmapMetadataContainer : BeatmapMetadataContainer
|
||||
{
|
||||
public MostPlayedBeatmapMetadataContainer(BeatmapInfo beatmap)
|
||||
: base(beatmap)
|
||||
{
|
||||
}
|
||||
|
||||
protected override Drawable[] CreateText(BeatmapInfo beatmap) => new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = new LocalisedString((
|
||||
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
|
||||
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold)
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = "by " + new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Regular)
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
private class PlayCountText : CompositeDrawable, IHasTooltip
|
||||
{
|
||||
public string TooltipText => "times played";
|
||||
|
||||
public PlayCountText(int playCount)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
InternalChild = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.CentreRight,
|
||||
Origin = Anchor.CentreRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Spacing = new Vector2(5, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new SpriteIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Size = new Vector2(12),
|
||||
Icon = FontAwesome.Solid.Play,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Text = playCount.ToString(),
|
||||
Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular),
|
||||
},
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.Yellow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,77 +0,0 @@
|
||||
// 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.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
{
|
||||
public class DrawableMostPlayedRow : DrawableProfileRow
|
||||
{
|
||||
private readonly BeatmapInfo beatmap;
|
||||
private readonly int playCount;
|
||||
|
||||
public DrawableMostPlayedRow(BeatmapInfo beatmap, int playCount)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
this.playCount = playCount;
|
||||
}
|
||||
|
||||
protected override Drawable CreateLeftVisual() => new UpdateableBeatmapSetCover
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Size = new Vector2(80, 50),
|
||||
BeatmapSet = beatmap.BeatmapSet,
|
||||
CoverType = BeatmapSetCoverType.List,
|
||||
};
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
LeftFlowContainer.Add(new BeatmapMetadataContainer(beatmap));
|
||||
LeftFlowContainer.Add(new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 12))
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Horizontal,
|
||||
}.With(d =>
|
||||
{
|
||||
d.AddText("mapped by ");
|
||||
d.AddUserLink(beatmap.Metadata.Author);
|
||||
}));
|
||||
|
||||
RightFlowContainer.Add(new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
Text = playCount.ToString(),
|
||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.SemiBold, italics: true)
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
Text = @"times played ",
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true)
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -40,7 +40,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
|
||||
|
||||
foreach (var beatmap in beatmaps)
|
||||
{
|
||||
ItemsContainer.Add(new DrawableMostPlayedRow(beatmap.GetBeatmapInfo(Rulesets), beatmap.PlayCount));
|
||||
ItemsContainer.Add(new DrawableMostPlayedBeatmap(beatmap.GetBeatmapInfo(Rulesets), beatmap.PlayCount));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -10,6 +10,8 @@ using osu.Game.Online.Leaderboards;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
{
|
||||
@ -51,7 +53,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
|
||||
RightFlowContainer.Insert(1, text);
|
||||
|
||||
LeftFlowContainer.Add(new BeatmapMetadataContainer(Score.Beatmap));
|
||||
LeftFlowContainer.Add(new ProfileScoreBeatmapMetadataContainer(Score.Beatmap));
|
||||
LeftFlowContainer.Add(new DrawableDate(Score.Date));
|
||||
|
||||
foreach (Mod mod in Score.Mods)
|
||||
@ -64,5 +66,30 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
Width = 60,
|
||||
FillMode = FillMode.Fit,
|
||||
};
|
||||
|
||||
private class ProfileScoreBeatmapMetadataContainer : BeatmapMetadataContainer
|
||||
{
|
||||
public ProfileScoreBeatmapMetadataContainer(BeatmapInfo beatmap)
|
||||
: base(beatmap)
|
||||
{
|
||||
}
|
||||
|
||||
protected override Drawable[] CreateText(BeatmapInfo beatmap) => new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = new LocalisedString((
|
||||
$"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ",
|
||||
$"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")),
|
||||
Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold, italics: true)
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)),
|
||||
Padding = new MarginPadding { Top = 3 },
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true)
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -71,16 +71,11 @@ namespace osu.Game.Overlays.Toolbar
|
||||
// Scheduled to allow the flow layout to be computed before the line position is updated
|
||||
private void moveLineToCurrent() => ScheduleAfterChildren(() =>
|
||||
{
|
||||
foreach (var tabItem in TabContainer)
|
||||
if (SelectedTab != null)
|
||||
{
|
||||
if (tabItem.Value.Equals(Current.Value))
|
||||
{
|
||||
ModeButtonLine.MoveToX(tabItem.DrawPosition.X, !hasInitialPosition ? 0 : 200, Easing.OutQuint);
|
||||
break;
|
||||
}
|
||||
ModeButtonLine.MoveToX(SelectedTab.DrawPosition.X, !hasInitialPosition ? 0 : 200, Easing.OutQuint);
|
||||
hasInitialPosition = true;
|
||||
}
|
||||
|
||||
hasInitialPosition = true;
|
||||
});
|
||||
|
||||
public override bool HandleNonPositionalInput => !Current.Disabled && base.HandleNonPositionalInput;
|
||||
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Batches;
|
||||
using osu.Framework.Graphics.OpenGL.Vertices;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Shaders;
|
||||
@ -13,6 +14,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.OpenGL.Vertices;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
@ -153,9 +155,17 @@ namespace osu.Game.Rulesets.Mods
|
||||
private Vector2 flashlightSize;
|
||||
private float flashlightDim;
|
||||
|
||||
private readonly VertexBatch<PositionAndColourVertex> quadBatch = new QuadBatch<PositionAndColourVertex>(1, 1);
|
||||
private readonly Action<TexturedVertex2D> addAction;
|
||||
|
||||
public FlashlightDrawNode(Flashlight source)
|
||||
: base(source)
|
||||
{
|
||||
addAction = v => quadBatch.Add(new PositionAndColourVertex
|
||||
{
|
||||
Position = v.Position,
|
||||
Colour = v.Colour
|
||||
});
|
||||
}
|
||||
|
||||
public override void ApplyState()
|
||||
@ -179,7 +189,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
shader.GetUniform<Vector2>("flashlightSize").UpdateValue(ref flashlightSize);
|
||||
shader.GetUniform<float>("flashlightDim").UpdateValue(ref flashlightDim);
|
||||
|
||||
DrawQuad(Texture.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: vertexAction);
|
||||
DrawQuad(Texture.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: addAction);
|
||||
|
||||
shader.Unbind();
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
DifficultyIncrease,
|
||||
Conversion,
|
||||
Automation,
|
||||
Fun
|
||||
Fun,
|
||||
System
|
||||
}
|
||||
}
|
||||
|
@ -120,7 +120,8 @@ namespace osu.Game.Screens.Select
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 24,
|
||||
Width = 0.5f,
|
||||
AutoSort = true
|
||||
AutoSort = true,
|
||||
Current = { Value = GroupMode.Title }
|
||||
},
|
||||
//spriteText = new OsuSpriteText
|
||||
//{
|
||||
@ -139,6 +140,7 @@ namespace osu.Game.Screens.Select
|
||||
Width = 0.5f,
|
||||
Height = 24,
|
||||
AutoSort = true,
|
||||
Current = { Value = SortMode.Title }
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user