1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 18:42:56 +08:00

Remove seed from the ScorePanel and "Paste" button

This commit is contained in:
Pasi4K5 2021-05-14 01:42:39 +02:00
parent 946abfbb83
commit a9d5211e81
5 changed files with 2 additions and 87 deletions

View File

@ -2,12 +2,10 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Platform;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -52,8 +50,6 @@ namespace osu.Game.Rulesets.Osu.Mods
if (CustomSeed.Value != null) if (CustomSeed.Value != null)
seed = (int)CustomSeed.Value; seed = (int)CustomSeed.Value;
Seed = seed;
var rng = new Random(seed); var rng = new Random(seed);
var prevObjectInfo = new HitObjectInfo var prevObjectInfo = new HitObjectInfo
@ -244,9 +240,6 @@ namespace osu.Game.Rulesets.Osu.Mods
private sealed class SeedControl : CompositeDrawable, IHasCurrentValue<int?> private sealed class SeedControl : CompositeDrawable, IHasCurrentValue<int?>
{ {
[Resolved]
private GameHost host { get; set; }
private readonly BindableWithCurrent<int?> current = new BindableWithCurrent<int?>(); private readonly BindableWithCurrent<int?> current = new BindableWithCurrent<int?>();
public Bindable<int?> Current public Bindable<int?> Current
@ -289,14 +282,6 @@ namespace osu.Game.Rulesets.Osu.Mods
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
CommitOnFocusLost = true CommitOnFocusLost = true
},
null,
new TriangleButton
{
RelativeSizeAxes = Axes.Both,
Height = 1,
Text = "Paste",
Action = () => seedNumberBox.Text = host.GetClipboard().GetText()
} }
} }
} }

View File

@ -13,6 +13,5 @@ namespace osu.Game.Rulesets.Mods
public override ModType Type => ModType.Conversion; public override ModType Type => ModType.Conversion;
public override IconUsage? Icon => OsuIcon.Dice; public override IconUsage? Icon => OsuIcon.Dice;
public override double ScoreMultiplier => 1; public override double ScoreMultiplier => 1;
public int? Seed { get; protected set; }
} }
} }

View File

@ -88,24 +88,6 @@ namespace osu.Game.Scoring
} }
} }
public bool ContainsModOfType<T>(out T mod)
{
if (mods != null)
{
foreach (var currentMod in mods)
{
if (!(currentMod is T modOfType))
continue;
mod = modOfType;
return true;
}
}
mod = default;
return false;
}
// Used for API serialisation/deserialisation. // Used for API serialisation/deserialisation.
[JsonProperty("mods")] [JsonProperty("mods")]
[NotMapped] [NotMapped]

View File

@ -7,13 +7,11 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Framework.Platform;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.HUD;
@ -57,9 +55,6 @@ namespace osu.Game.Screens.Ranking.Expanded
Padding = new MarginPadding(padding); Padding = new MarginPadding(padding);
} }
[Resolved]
private GameHost host { get; set; }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(BeatmapDifficultyCache beatmapDifficultyCache) private void load(BeatmapDifficultyCache beatmapDifficultyCache)
{ {
@ -229,49 +224,9 @@ namespace osu.Game.Screens.Ranking.Expanded
} }
} }
} }
}.With(t =>
{
if (!score.ContainsModOfType<ModRandom>(out var mod) || mod.Seed == null)
return;
t.Add(new GridContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Content = new[]
{
new Drawable[]
{
new OsuSpriteText
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Margin = new MarginPadding
{
Top = 3f,
Right = 5f
},
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Medium),
Text = $"Seed: {mod.Seed}"
},
new TriangleButton
{
RelativeSizeAxes = Axes.Both,
Height = 1.2f,
Width = 0.5f,
Text = "Copy",
Action = () => host.GetClipboard().SetText(mod.Seed.ToString())
} }
} }
}, },
RowDimensions = new[]
{
new Dimension(GridSizeMode.AutoSize),
}
});
})
}
},
new OsuSpriteText new OsuSpriteText
{ {
Anchor = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,

View File

@ -10,7 +10,6 @@ using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring; using osu.Game.Scoring;
using osu.Game.Screens.Ranking.Contracted; using osu.Game.Screens.Ranking.Contracted;
using osu.Game.Screens.Ranking.Expanded; using osu.Game.Screens.Ranking.Expanded;
@ -207,12 +206,7 @@ namespace osu.Game.Screens.Ranking
switch (state) switch (state)
{ {
case PanelState.Expanded: case PanelState.Expanded:
var height = expanded_height; Size = new Vector2(EXPANDED_WIDTH, expanded_height);
if (Score.ContainsModOfType<ModRandom>(out var mod) && mod.Seed != null)
height += 20f;
Size = new Vector2(EXPANDED_WIDTH, height);
topLayerBackground.FadeColour(expanded_top_layer_colour, resize_duration, Easing.OutQuint); topLayerBackground.FadeColour(expanded_top_layer_colour, resize_duration, Easing.OutQuint);
middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint); middleLayerBackground.FadeColour(expanded_middle_layer_colour, resize_duration, Easing.OutQuint);