mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Merge branch 'custom-data-directory' into migration-backend
This commit is contained in:
@ -149,6 +149,11 @@ namespace osu.Game.Beatmaps
|
||||
}
|
||||
}
|
||||
|
||||
public string[] SearchableTerms => new[]
|
||||
{
|
||||
Version
|
||||
}.Concat(Metadata?.SearchableTerms ?? Enumerable.Empty<string>()).Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
string version = string.IsNullOrEmpty(Version) ? string.Empty : $"[{Version}]";
|
||||
|
@ -381,7 +381,7 @@ namespace osu.Game.Beatmaps
|
||||
foreach (var file in files.Where(f => f.Filename.EndsWith(".osu")))
|
||||
{
|
||||
using (var raw = Files.Store.GetStream(file.FileInfo.StoragePath))
|
||||
using (var ms = new MemoryStream()) //we need a memory stream so we can seek
|
||||
using (var ms = new MemoryStream()) // we need a memory stream so we can seek
|
||||
using (var sr = new LineBufferedReader(ms))
|
||||
{
|
||||
raw.CopyTo(ms);
|
||||
|
@ -193,8 +193,8 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
|
||||
float u1 = 1 - RNG.NextSingle(); //uniform(0,1] random floats
|
||||
float u2 = 1 - RNG.NextSingle();
|
||||
float randStdNormal = (float)(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2)); //random normal(0,1)
|
||||
var scale = Math.Max(triangleScale * (mean + std_dev * randStdNormal), 0.1f); //random normal(mean,stdDev^2)
|
||||
float randStdNormal = (float)(Math.Sqrt(-2.0 * Math.Log(u1)) * Math.Sin(2.0 * Math.PI * u2)); // random normal(0,1)
|
||||
var scale = Math.Max(triangleScale * (mean + std_dev * randStdNormal), 0.1f); // random normal(mean,stdDev^2)
|
||||
|
||||
return new TriangleParticle { Scale = scale };
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
if (!base.OnMouseDown(e)) return false;
|
||||
|
||||
//note that we are changing the colour of the box here as to not interfere with the hover effect.
|
||||
// note that we are changing the colour of the box here as to not interfere with the hover effect.
|
||||
box.FadeColour(highlightColour, 100);
|
||||
return true;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ namespace osu.Game.Graphics
|
||||
return false;
|
||||
|
||||
dateText.Text = $"{date:d MMMM yyyy} ";
|
||||
timeText.Text = $"{date:hh:mm:ss \"UTC\"z}";
|
||||
timeText.Text = $"{date:HH:mm:ss \"UTC\"z}";
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace osu.Game.IPC
|
||||
{
|
||||
if (importer == null)
|
||||
{
|
||||
//we want to contact a remote osu! to handle the import.
|
||||
// we want to contact a remote osu! to handle the import.
|
||||
await SendMessageAsync(new ArchiveImportMessage { Path = path });
|
||||
return;
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ namespace osu.Game.Online.API
|
||||
|
||||
case APIState.Offline:
|
||||
case APIState.Connecting:
|
||||
//work to restore a connection...
|
||||
// work to restore a connection...
|
||||
if (!HasLogin)
|
||||
{
|
||||
State = APIState.Offline;
|
||||
@ -180,7 +180,7 @@ namespace osu.Game.Online.API
|
||||
break;
|
||||
}
|
||||
|
||||
//hard bail if we can't get a valid access token.
|
||||
// hard bail if we can't get a valid access token.
|
||||
if (authentication.RequestAccessToken() == null)
|
||||
{
|
||||
Logout();
|
||||
@ -274,7 +274,7 @@ namespace osu.Game.Online.API
|
||||
{
|
||||
req.Perform(this);
|
||||
|
||||
//we could still be in initialisation, at which point we don't want to say we're Online yet.
|
||||
// we could still be in initialisation, at which point we don't want to say we're Online yet.
|
||||
if (IsLoggedIn) State = APIState.Online;
|
||||
|
||||
failureCount = 0;
|
||||
@ -339,7 +339,7 @@ namespace osu.Game.Online.API
|
||||
log.Add($@"API failure count is now {failureCount}");
|
||||
|
||||
if (failureCount < 3)
|
||||
//we might try again at an api level.
|
||||
// we might try again at an api level.
|
||||
return false;
|
||||
|
||||
if (State == APIState.Online)
|
||||
|
@ -98,7 +98,7 @@ namespace osu.Game.Online.API
|
||||
if (checkAndScheduleFailure())
|
||||
return;
|
||||
|
||||
if (!WebRequest.Aborted) //could have been aborted by a Cancel() call
|
||||
if (!WebRequest.Aborted) // could have been aborted by a Cancel() call
|
||||
{
|
||||
Logger.Log($@"Performing request {this}", LoggingTarget.Network);
|
||||
WebRequest.Perform();
|
||||
|
@ -61,7 +61,7 @@ namespace osu.Game.Online.Chat
|
||||
/// </summary>
|
||||
public event Action<Message> MessageRemoved;
|
||||
|
||||
public bool ReadOnly => false; //todo not yet used.
|
||||
public bool ReadOnly => false; // todo: not yet used.
|
||||
|
||||
public override string ToString() => Name;
|
||||
|
||||
|
@ -78,13 +78,13 @@ namespace osu.Game.Online.Chat
|
||||
{
|
||||
result.Text = result.Text.Remove(index, m.Length).Insert(index, displayText);
|
||||
|
||||
//since we just changed the line display text, offset any already processed links.
|
||||
// since we just changed the line display text, offset any already processed links.
|
||||
result.Links.ForEach(l => l.Index -= l.Index > index ? m.Length - displayText.Length : 0);
|
||||
|
||||
var details = GetLinkDetails(linkText);
|
||||
result.Links.Add(new Link(linkText, index, displayText.Length, linkActionOverride ?? details.Action, details.Argument));
|
||||
|
||||
//adjust the offset for processing the current matches group.
|
||||
// adjust the offset for processing the current matches group.
|
||||
captureOffset += m.Length - displayText.Length;
|
||||
}
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ namespace osu.Game
|
||||
|
||||
loadComponentSingleFile(screenshotManager, Add);
|
||||
|
||||
//overlay elements
|
||||
// overlay elements
|
||||
loadComponentSingleFile(beatmapListing = new BeatmapListingOverlay(), overlayContent.Add, true);
|
||||
loadComponentSingleFile(dashboard = new DashboardOverlay(), overlayContent.Add, true);
|
||||
var rankingsOverlay = loadComponentSingleFile(new RankingsOverlay(), overlayContent.Add, true);
|
||||
@ -781,7 +781,7 @@ namespace osu.Game
|
||||
{
|
||||
var previousLoadStream = asyncLoadStream;
|
||||
|
||||
//chain with existing load stream
|
||||
// chain with existing load stream
|
||||
asyncLoadStream = Task.Run(async () =>
|
||||
{
|
||||
if (previousLoadStream != null)
|
||||
|
@ -302,7 +302,8 @@ namespace osu.Game
|
||||
{
|
||||
base.SetHost(host);
|
||||
|
||||
Storage = new OsuStorage(host);
|
||||
if (Storage == null) // may be non-null for certain tests
|
||||
Storage = new OsuStorage(host);
|
||||
|
||||
if (LocalConfig == null)
|
||||
LocalConfig = new OsuConfigManager(Storage);
|
||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Overlays.BeatmapListing.Panels
|
||||
: base(beatmap)
|
||||
{
|
||||
Width = 380;
|
||||
Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image)
|
||||
Height = 140 + vertical_padding; // full height of all the elements plus vertical padding (autosize uses the image)
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
|
@ -140,7 +140,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Margin = new MarginPadding { Left = 3, Bottom = 4 }, //To better lineup with the font
|
||||
Margin = new MarginPadding { Left = 3, Bottom = 4 }, // To better lineup with the font
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -358,7 +358,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override void OnFocus(FocusEvent e)
|
||||
{
|
||||
//this is necessary as textbox is masked away and therefore can't get focus :(
|
||||
// this is necessary as textbox is masked away and therefore can't get focus :(
|
||||
textbox.TakeFocus();
|
||||
base.OnFocus(e);
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
if (v != Visibility.Hidden) return;
|
||||
|
||||
//handle the dialog being dismissed.
|
||||
// handle the dialog being dismissed.
|
||||
dialog.Delay(PopupDialog.EXIT_DURATION).Expire();
|
||||
|
||||
if (dialog == CurrentDialog)
|
||||
|
@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Music
|
||||
{
|
||||
text.Clear();
|
||||
|
||||
//space after the title to put a space between the title and artist
|
||||
// space after the title to put a space between the title and artist
|
||||
titleSprites = text.AddText(title.Value + @" ", sprite => sprite.Font = OsuFont.GetFont(weight: FontWeight.Regular)).OfType<SpriteText>();
|
||||
|
||||
text.AddText(artist.Value, sprite =>
|
||||
|
@ -250,7 +250,7 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
else
|
||||
{
|
||||
//figure out the best direction based on order in playlist.
|
||||
// figure out the best direction based on order in playlist.
|
||||
var last = BeatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count();
|
||||
var next = beatmap.NewValue == null ? -1 : BeatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count();
|
||||
|
||||
|
@ -162,7 +162,7 @@ namespace osu.Game.Overlays.News
|
||||
public string TooltipText => date.ToString("dddd dd MMMM yyyy hh:mm:ss UTCz").ToUpper();
|
||||
}
|
||||
|
||||
//fake API data struct to use for now as a skeleton for data, as there is no API struct for news article info for now
|
||||
// fake API data struct to use for now as a skeleton for data, as there is no API struct for news article info for now
|
||||
public class ArticleInfo
|
||||
{
|
||||
public string Title { get; set; }
|
||||
|
@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
//we may have received changes before we were displayed.
|
||||
// we may have received changes before we were displayed.
|
||||
updateState();
|
||||
}
|
||||
|
||||
|
@ -261,7 +261,7 @@ namespace osu.Game.Overlays
|
||||
// todo: this can likely be replaced with WorkingBeatmap.GetBeatmapAsync()
|
||||
Task.Run(() =>
|
||||
{
|
||||
if (beatmap?.Beatmap == null) //this is not needed if a placeholder exists
|
||||
if (beatmap?.Beatmap == null) // this is not needed if a placeholder exists
|
||||
{
|
||||
title.Text = @"Nothing to play";
|
||||
artist.Text = @"Nothing to play";
|
||||
|
@ -31,7 +31,7 @@ namespace osu.Game.Overlays.OSD
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new Container //this container exists just to set a minimum width for the toast
|
||||
new Container // this container exists just to set a minimum width for the toast
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
Font = OsuFont.GetFont(size: big ? 40 : 18, weight: FontWeight.Light)
|
||||
},
|
||||
new Container //Add a minimum size to the FillFlowContainer
|
||||
new Container // Add a minimum size to the FillFlowContainer
|
||||
{
|
||||
Width = minimumWidth,
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Profile.Header
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = colourProvider.Background5,
|
||||
},
|
||||
new Container //artificial shadow
|
||||
new Container // artificial shadow
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 3,
|
||||
|
@ -91,6 +91,8 @@ namespace osu.Game.Overlays.SearchableList
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
bindable.ValueChanged -= Bindable_ValueChanged;
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ namespace osu.Game.Overlays.SearchableList
|
||||
RelativeSizeAxes = Axes.X,
|
||||
},
|
||||
},
|
||||
new Box //keep the tab strip part of autosize, but don't put it in the flow container
|
||||
new Box // keep the tab strip part of autosize, but don't put it in the flow container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = 1,
|
||||
|
@ -110,7 +110,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
tooltipContainer = new FillFlowContainer
|
||||
{
|
||||
Direction = FillDirection.Vertical,
|
||||
RelativeSizeAxes = Axes.Both, //stops us being considered in parent's autosize
|
||||
RelativeSizeAxes = Axes.Both, // stops us being considered in parent's autosize
|
||||
Anchor = TooltipAnchor.HasFlag(Anchor.x0) ? Anchor.BottomLeft : Anchor.BottomRight,
|
||||
Origin = TooltipAnchor,
|
||||
Position = new Vector2(TooltipAnchor.HasFlag(Anchor.x0) ? 5 : -5, 5),
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
volumeMeterEffect = new VolumeMeter("EFFECTS", 125, colours.BlueDarker)
|
||||
{
|
||||
Margin = new MarginPadding { Top = 100 + MuteButton.HEIGHT } //to counter the mute button and re-center the volume meters
|
||||
Margin = new MarginPadding { Top = 100 + MuteButton.HEIGHT } // to counter the mute button and re-center the volume meters
|
||||
},
|
||||
volumeMeterMaster = new VolumeMeter("MASTER", 150, colours.PinkDarker),
|
||||
volumeMeterMusic = new VolumeMeter("MUSIC", 125, colours.BlueDarker),
|
||||
|
@ -62,7 +62,7 @@ namespace osu.Game.Rulesets.Replays
|
||||
{
|
||||
int newFrame = nextFrameIndex;
|
||||
|
||||
//ensure we aren't at an extent.
|
||||
// ensure we aren't at an extent.
|
||||
if (newFrame == currentFrameIndex) return false;
|
||||
|
||||
currentFrameIndex = newFrame;
|
||||
@ -99,8 +99,8 @@ namespace osu.Game.Rulesets.Replays
|
||||
if (frame == null)
|
||||
return false;
|
||||
|
||||
return IsImportant(frame) && //a button is in a pressed state
|
||||
Math.Abs(CurrentTime - NextFrame?.Time ?? 0) <= AllowedImportantTimeSpan; //the next frame is within an allowable time span
|
||||
return IsImportant(frame) && // a button is in a pressed state
|
||||
Math.Abs(CurrentTime - NextFrame?.Time ?? 0) <= AllowedImportantTimeSpan; // the next frame is within an allowable time span
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Rulesets
|
||||
@ -15,7 +16,20 @@ namespace osu.Game.Rulesets
|
||||
|
||||
public string ShortName { get; set; }
|
||||
|
||||
public string InstantiationInfo { get; set; }
|
||||
private string instantiationInfo;
|
||||
|
||||
public string InstantiationInfo
|
||||
{
|
||||
get => instantiationInfo;
|
||||
set => instantiationInfo = abbreviateInstantiationInfo(value);
|
||||
}
|
||||
|
||||
private string abbreviateInstantiationInfo(string value)
|
||||
{
|
||||
// exclude version onwards, matching only on namespace and type.
|
||||
// this is mainly to allow for new versions of already loaded rulesets to "upgrade" from old.
|
||||
return string.Join(',', value.Split(',').Take(2));
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
public bool Available { get; set; }
|
||||
|
@ -81,7 +81,7 @@ namespace osu.Game.Rulesets
|
||||
|
||||
var instances = loadedAssemblies.Values.Select(r => (Ruleset)Activator.CreateInstance(r)).ToList();
|
||||
|
||||
//add all legacy rulesets first to ensure they have exclusive choice of primary key.
|
||||
// add all legacy rulesets first to ensure they have exclusive choice of primary key.
|
||||
foreach (var r in instances.Where(r => r is ILegacyRuleset))
|
||||
{
|
||||
if (context.RulesetInfo.SingleOrDefault(dbRuleset => dbRuleset.ID == r.RulesetInfo.ID) == null)
|
||||
@ -90,27 +90,23 @@ namespace osu.Game.Rulesets
|
||||
|
||||
context.SaveChanges();
|
||||
|
||||
//add any other modes
|
||||
// add any other modes
|
||||
foreach (var r in instances.Where(r => !(r is ILegacyRuleset)))
|
||||
{
|
||||
if (context.RulesetInfo.FirstOrDefault(ri => ri.InstantiationInfo == r.RulesetInfo.InstantiationInfo) == null)
|
||||
// todo: StartsWith can be changed to Equals on 2020-11-08
|
||||
// This is to give users enough time to have their database use new abbreviated info).
|
||||
if (context.RulesetInfo.FirstOrDefault(ri => ri.InstantiationInfo.StartsWith(r.RulesetInfo.InstantiationInfo)) == null)
|
||||
context.RulesetInfo.Add(r.RulesetInfo);
|
||||
}
|
||||
|
||||
context.SaveChanges();
|
||||
|
||||
//perform a consistency check
|
||||
// perform a consistency check
|
||||
foreach (var r in context.RulesetInfo)
|
||||
{
|
||||
try
|
||||
{
|
||||
var instanceInfo = ((Ruleset)Activator.CreateInstance(Type.GetType(r.InstantiationInfo, asm =>
|
||||
{
|
||||
// for the time being, let's ignore the version being loaded.
|
||||
// this allows for debug builds to successfully load rulesets (even though debug rulesets have a 0.0.0 version).
|
||||
asm.Version = null;
|
||||
return Assembly.Load(asm);
|
||||
}, null))).RulesetInfo;
|
||||
var instanceInfo = ((Ruleset)Activator.CreateInstance(Type.GetType(r.InstantiationInfo))).RulesetInfo;
|
||||
|
||||
r.Name = instanceInfo.Name;
|
||||
r.ShortName = instanceInfo.ShortName;
|
||||
|
@ -43,5 +43,25 @@ namespace osu.Game.Rulesets.Scoring
|
||||
/// </summary>
|
||||
[Description(@"Perfect")]
|
||||
Perfect,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates small tick miss.
|
||||
/// </summary>
|
||||
SmallTickMiss,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates a small tick hit.
|
||||
/// </summary>
|
||||
SmallTickHit,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates a large tick miss.
|
||||
/// </summary>
|
||||
LargeTickMiss,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates a large tick hit.
|
||||
/// </summary>
|
||||
LargeTickHit
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Scoring.Legacy
|
||||
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
|
||||
{
|
||||
case 3:
|
||||
return scoreInfo.Statistics[HitResult.Perfect];
|
||||
return getCount(scoreInfo, HitResult.Perfect);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -35,10 +35,10 @@ namespace osu.Game.Scoring.Legacy
|
||||
case 0:
|
||||
case 1:
|
||||
case 3:
|
||||
return scoreInfo.Statistics[HitResult.Great];
|
||||
return getCount(scoreInfo, HitResult.Great);
|
||||
|
||||
case 2:
|
||||
return scoreInfo.Statistics[HitResult.Perfect];
|
||||
return getCount(scoreInfo, HitResult.Perfect);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -65,7 +65,10 @@ namespace osu.Game.Scoring.Legacy
|
||||
switch (scoreInfo.Ruleset?.ID ?? scoreInfo.RulesetID)
|
||||
{
|
||||
case 3:
|
||||
return scoreInfo.Statistics[HitResult.Good];
|
||||
return getCount(scoreInfo, HitResult.Good);
|
||||
|
||||
case 2:
|
||||
return getCount(scoreInfo, HitResult.SmallTickMiss);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -78,6 +81,10 @@ namespace osu.Game.Scoring.Legacy
|
||||
case 3:
|
||||
scoreInfo.Statistics[HitResult.Good] = value;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
scoreInfo.Statistics[HitResult.SmallTickMiss] = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,10 +94,13 @@ namespace osu.Game.Scoring.Legacy
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
return scoreInfo.Statistics[HitResult.Good];
|
||||
return getCount(scoreInfo, HitResult.Good);
|
||||
|
||||
case 3:
|
||||
return scoreInfo.Statistics[HitResult.Ok];
|
||||
return getCount(scoreInfo, HitResult.Ok);
|
||||
|
||||
case 2:
|
||||
return getCount(scoreInfo, HitResult.LargeTickHit);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -108,6 +118,10 @@ namespace osu.Game.Scoring.Legacy
|
||||
case 3:
|
||||
scoreInfo.Statistics[HitResult.Ok] = value;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
scoreInfo.Statistics[HitResult.LargeTickHit] = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +131,10 @@ namespace osu.Game.Scoring.Legacy
|
||||
{
|
||||
case 0:
|
||||
case 3:
|
||||
return scoreInfo.Statistics[HitResult.Meh];
|
||||
return getCount(scoreInfo, HitResult.Meh);
|
||||
|
||||
case 2:
|
||||
return getCount(scoreInfo, HitResult.SmallTickHit);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -131,13 +148,25 @@ namespace osu.Game.Scoring.Legacy
|
||||
case 3:
|
||||
scoreInfo.Statistics[HitResult.Meh] = value;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
scoreInfo.Statistics[HitResult.SmallTickHit] = value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static int? GetCountMiss(this ScoreInfo scoreInfo) =>
|
||||
scoreInfo.Statistics[HitResult.Miss];
|
||||
getCount(scoreInfo, HitResult.Miss);
|
||||
|
||||
public static void SetCountMiss(this ScoreInfo scoreInfo, int value) =>
|
||||
scoreInfo.Statistics[HitResult.Miss] = value;
|
||||
|
||||
private static int? getCount(ScoreInfo scoreInfo, HitResult result)
|
||||
{
|
||||
if (scoreInfo.Statistics.TryGetValue(result, out var existing))
|
||||
return existing;
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Screens
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
{
|
||||
//we don't want to handle escape key.
|
||||
// we don't want to handle escape key.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ namespace osu.Game.Screens.Menu
|
||||
this.FadeIn(300);
|
||||
|
||||
double fadeOutTime = exit_delay;
|
||||
//we also handle the exit transition.
|
||||
// we also handle the exit transition.
|
||||
if (MenuVoice.Value)
|
||||
seeya.Play();
|
||||
else
|
||||
|
@ -162,7 +162,7 @@ namespace osu.Game.Screens.Menu
|
||||
private IShader shader;
|
||||
private Texture texture;
|
||||
|
||||
//Assuming the logo is a circle, we don't need a second dimension.
|
||||
// Assuming the logo is a circle, we don't need a second dimension.
|
||||
private float size;
|
||||
|
||||
private Color4 colour;
|
||||
@ -209,13 +209,13 @@ namespace osu.Game.Screens.Menu
|
||||
float rotation = MathUtils.DegreesToRadians(i / (float)bars_per_visualiser * 360 + j * 360 / visualiser_rounds);
|
||||
float rotationCos = MathF.Cos(rotation);
|
||||
float rotationSin = MathF.Sin(rotation);
|
||||
//taking the cos and sin to the 0..1 range
|
||||
// taking the cos and sin to the 0..1 range
|
||||
var barPosition = new Vector2(rotationCos / 2 + 0.5f, rotationSin / 2 + 0.5f) * size;
|
||||
|
||||
var barSize = new Vector2(size * MathF.Sqrt(2 * (1 - MathF.Cos(MathUtils.DegreesToRadians(360f / bars_per_visualiser)))) / 2f, bar_length * audioData[i]);
|
||||
//The distance between the position and the sides of the bar.
|
||||
// The distance between the position and the sides of the bar.
|
||||
var bottomOffset = new Vector2(-rotationSin * barSize.X / 2, rotationCos * barSize.X / 2);
|
||||
//The distance between the bottom side of the bar and the top side.
|
||||
// The distance between the bottom side of the bar and the top side.
|
||||
var amplitudeOffset = new Vector2(rotationCos * barSize.Y, rotationSin * barSize.Y);
|
||||
|
||||
var rectangle = new Quad(
|
||||
@ -231,7 +231,7 @@ namespace osu.Game.Screens.Menu
|
||||
colourInfo,
|
||||
null,
|
||||
vertexBatch.AddAction,
|
||||
//barSize by itself will make it smooth more in the X axis than in the Y axis, this reverts that.
|
||||
// barSize by itself will make it smooth more in the X axis than in the Y axis, this reverts that.
|
||||
Vector2.Divide(inflation, barSize.Yx));
|
||||
}
|
||||
}
|
||||
|
@ -250,7 +250,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
(Background as BackgroundScreenDefault)?.Next();
|
||||
|
||||
//we may have consumed our preloaded instance, so let's make another.
|
||||
// we may have consumed our preloaded instance, so let's make another.
|
||||
preloadSongSelect();
|
||||
|
||||
if (Beatmap.Value.Track != null && music?.IsUserPaused != true)
|
||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Screens
|
||||
{
|
||||
/// <summary>
|
||||
/// The amount of negative padding that should be applied to game background content which touches both the left and right sides of the screen.
|
||||
/// This allows for the game content to be pushed byt he options/notification overlays without causing black areas to appear.
|
||||
/// This allows for the game content to be pushed by the options/notification overlays without causing black areas to appear.
|
||||
/// </summary>
|
||||
public const float HORIZONTAL_OVERFLOW_PADDING = 50;
|
||||
|
||||
|
@ -119,7 +119,7 @@ namespace osu.Game.Screens.Play
|
||||
FinishTransforms(true);
|
||||
Scheduler.CancelDelayedTasks();
|
||||
|
||||
if (breaks == null) return; //we need breaks.
|
||||
if (breaks == null) return; // we need breaks.
|
||||
|
||||
foreach (var b in breaks)
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
protected override void PopIn() => this.FadeIn(fade_duration);
|
||||
protected override void PopOut() => this.FadeOut(fade_duration);
|
||||
|
||||
//We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible
|
||||
// We want to handle keyboard inputs all the time in order to trigger ToggleVisibility() when not visible
|
||||
public override bool PropagateNonPositionalInputSubTree => true;
|
||||
|
||||
protected override bool OnKeyDown(KeyDownEvent e)
|
||||
|
@ -124,8 +124,8 @@ namespace osu.Game.Screens.Play
|
||||
}
|
||||
}
|
||||
};
|
||||
//Set this manually because an element with Alpha=0 won't take it size to AutoSizeContainer,
|
||||
//so the size can be changing between buttonSprite and glowSprite.
|
||||
// Set this manually because an element with Alpha=0 won't take it size to AutoSizeContainer,
|
||||
// so the size can be changing between buttonSprite and glowSprite.
|
||||
Height = buttonSprite.DrawHeight;
|
||||
Width = buttonSprite.DrawWidth;
|
||||
}
|
||||
|
@ -314,8 +314,8 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
LoadTask = null;
|
||||
|
||||
//By default, we want to load the player and never be returned to.
|
||||
//Note that this may change if the player we load requested a re-run.
|
||||
// By default, we want to load the player and never be returned to.
|
||||
// Note that this may change if the player we load requested a re-run.
|
||||
ValidForResume = false;
|
||||
|
||||
if (player.LoadedBeatmapSuccessfully)
|
||||
@ -360,7 +360,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
if (!muteWarningShownOnce.Value)
|
||||
{
|
||||
//Checks if the notification has not been shown yet and also if master volume is muted, track/music volume is muted or if the whole game is muted.
|
||||
// Checks if the notification has not been shown yet and also if master volume is muted, track/music volume is muted or if the whole game is muted.
|
||||
if (volumeOverlay?.IsMuted.Value == true || audioManager.Volume.Value <= audioManager.Volume.MinValue || audioManager.VolumeTrack.Value <= audioManager.VolumeTrack.MinValue)
|
||||
{
|
||||
notificationOverlay?.Post(new MutedNotification());
|
||||
|
@ -208,7 +208,7 @@ namespace osu.Game.Screens.Select
|
||||
// without this, during a large beatmap import it is impossible to navigate the carousel.
|
||||
applyActiveCriteria(false, alwaysResetScrollPosition: false);
|
||||
|
||||
//check if we can/need to maintain our current selection.
|
||||
// check if we can/need to maintain our current selection.
|
||||
if (previouslySelectedID != null)
|
||||
select((CarouselItem)newSet.Beatmaps.FirstOrDefault(b => b.Beatmap.ID == previouslySelectedID) ?? newSet);
|
||||
|
||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Screens.Select
|
||||
set => tabs.Current = value;
|
||||
}
|
||||
|
||||
public Action<BeatmapDetailAreaTabItem, bool> OnFilter; //passed the selected tab and if mods is checked
|
||||
public Action<BeatmapDetailAreaTabItem, bool> OnFilter; // passed the selected tab and if mods is checked
|
||||
|
||||
public IReadOnlyList<BeatmapDetailAreaTabItem> TabItems
|
||||
{
|
||||
|
@ -201,7 +201,7 @@ namespace osu.Game.Screens.Select
|
||||
Schedule(() =>
|
||||
{
|
||||
if (beatmap != requestedBeatmap)
|
||||
//the beatmap has been changed since we started the lookup.
|
||||
// the beatmap has been changed since we started the lookup.
|
||||
return;
|
||||
|
||||
var b = res.ToBeatmap(rulesets);
|
||||
@ -222,7 +222,7 @@ namespace osu.Game.Screens.Select
|
||||
Schedule(() =>
|
||||
{
|
||||
if (beatmap != requestedBeatmap)
|
||||
//the beatmap has been changed since we started the lookup.
|
||||
// the beatmap has been changed since we started the lookup.
|
||||
return;
|
||||
|
||||
updateMetrics();
|
||||
|
@ -2,7 +2,6 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Screens.Select.Filter;
|
||||
@ -55,10 +54,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
if (match)
|
||||
{
|
||||
var terms = new List<string>();
|
||||
|
||||
terms.AddRange(Beatmap.Metadata.SearchableTerms);
|
||||
terms.Add(Beatmap.Version);
|
||||
var terms = Beatmap.SearchableTerms;
|
||||
|
||||
foreach (var criteriaTerm in criteria.SearchTerms)
|
||||
match &= terms.Any(term => term.IndexOf(criteriaTerm, StringComparison.InvariantCultureIgnoreCase) >= 0);
|
||||
|
@ -52,7 +52,7 @@ namespace osu.Game.Screens.Select.Details
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new[]
|
||||
{
|
||||
FirstValue = new StatisticRow(), //circle size/key amount
|
||||
FirstValue = new StatisticRow(), // circle size/key amount
|
||||
HpDrain = new StatisticRow { Title = "HP Drain" },
|
||||
Accuracy = new StatisticRow { Title = "Accuracy" },
|
||||
ApproachRate = new StatisticRow { Title = "Approach Rate" },
|
||||
|
@ -7,6 +7,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using osu.Game.Users;
|
||||
@ -32,9 +33,12 @@ namespace osu.Game.Screens.Select
|
||||
Edit();
|
||||
}, Key.Number4);
|
||||
|
||||
((PlayBeatmapDetailArea)BeatmapDetails).Leaderboard.ScoreSelected += score => this.Push(new ResultsScreen(score));
|
||||
((PlayBeatmapDetailArea)BeatmapDetails).Leaderboard.ScoreSelected += PresentScore;
|
||||
}
|
||||
|
||||
protected void PresentScore(ScoreInfo score) =>
|
||||
FinaliseSelection(score.Beatmap, score.Ruleset, () => this.Push(new ResultsScreen(score)));
|
||||
|
||||
protected override BeatmapDetailArea CreateBeatmapDetailArea() => new PlayBeatmapDetailArea();
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
|
@ -342,13 +342,17 @@ namespace osu.Game.Screens.Select
|
||||
/// Call to make a selection and perform the default action for this SongSelect.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">An optional beatmap to override the current carousel selection.</param>
|
||||
/// <param name="performStartAction">Whether to trigger <see cref="OnStart"/>.</param>
|
||||
public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true)
|
||||
/// <param name="ruleset">An optional ruleset to override the current carousel selection.</param>
|
||||
/// <param name="customStartAction">An optional custom action to perform instead of <see cref="OnStart"/>.</param>
|
||||
public void FinaliseSelection(BeatmapInfo beatmap = null, RulesetInfo ruleset = null, Action customStartAction = null)
|
||||
{
|
||||
// This is very important as we have not yet bound to screen-level bindables before the carousel load is completed.
|
||||
if (!Carousel.BeatmapSetsLoaded)
|
||||
return;
|
||||
|
||||
if (ruleset != null)
|
||||
Ruleset.Value = ruleset;
|
||||
|
||||
transferRulesetValue();
|
||||
|
||||
// while transferRulesetValue will flush, it only does so if the ruleset changes.
|
||||
@ -369,7 +373,12 @@ namespace osu.Game.Screens.Select
|
||||
selectionChangedDebounce = null;
|
||||
}
|
||||
|
||||
if (performStartAction && OnStart())
|
||||
if (customStartAction != null)
|
||||
{
|
||||
customStartAction();
|
||||
Carousel.AllowSelection = false;
|
||||
}
|
||||
else if (OnStart())
|
||||
Carousel.AllowSelection = false;
|
||||
}
|
||||
|
||||
@ -798,7 +807,7 @@ namespace osu.Game.Screens.Select
|
||||
Masking = true;
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
Width = panel_overflow; //avoid horizontal masking so the panels don't clip when screen stack is pushed.
|
||||
Width = panel_overflow; // avoid horizontal masking so the panels don't clip when screen stack is pushed.
|
||||
InternalChild = Content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
|
@ -20,11 +20,11 @@
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="Dapper" Version="2.0.35" />
|
||||
<PackageReference Include="DiffPlex" Version="1.6.1" />
|
||||
<PackageReference Include="Humanizer" Version="2.8.2" />
|
||||
<PackageReference Include="Humanizer" Version="2.8.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.507.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2020.508.1" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.427.0" />
|
||||
<PackageReference Include="Sentry" Version="2.1.1" />
|
||||
<PackageReference Include="SharpCompress" Version="0.25.0" />
|
||||
|
Reference in New Issue
Block a user