mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge branch 'master' into master
This commit is contained in:
46
osu.Game/Screens/Select/BeatmapDeleteDialog.cs
Normal file
46
osu.Game/Screens/Select/BeatmapDeleteDialog.cs
Normal file
@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
|
||||
namespace osu.Game
|
||||
{
|
||||
public class BeatmapDeleteDialog : PopupDialog
|
||||
{
|
||||
private BeatmapDatabase database;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapDatabase beatmapDatabase)
|
||||
{
|
||||
database = beatmapDatabase;
|
||||
}
|
||||
|
||||
public BeatmapDeleteDialog(WorkingBeatmap beatmap)
|
||||
{
|
||||
Icon = FontAwesome.fa_trash_o;
|
||||
HeaderText = @"Confirm deletion of";
|
||||
BodyText = $@"{beatmap?.Beatmap?.Metadata?.Artist} - {beatmap?.Beatmap?.Metadata?.Title}";
|
||||
Buttons = new PopupDialogButton[]
|
||||
{
|
||||
new PopupDialogOkButton
|
||||
{
|
||||
Text = @"Yes. Totally. Delete it.",
|
||||
Action = () =>
|
||||
{
|
||||
beatmap.Dispose();
|
||||
database.Delete(beatmap.BeatmapSetInfo);
|
||||
},
|
||||
},
|
||||
new PopupDialogCancelButton
|
||||
{
|
||||
Text = @"Firetruck, I didn't mean to!",
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0);
|
||||
|
||||
private Container beatmapInfoContainer;
|
||||
private BufferedContainer beatmapInfoContainer;
|
||||
|
||||
private OsuGameBase game;
|
||||
|
||||
@ -61,8 +61,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
float newDepth = lastContainer?.Depth + 1 ?? 0;
|
||||
|
||||
BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo;
|
||||
BeatmapInfo beatmapInfo = beatmap.BeatmapInfo;
|
||||
BeatmapMetadata metadata = beatmap.BeatmapInfo?.Metadata ?? beatmap.BeatmapSetInfo?.Metadata ?? new BeatmapMetadata();
|
||||
|
||||
List<InfoLabel> labels = new List<InfoLabel>();
|
||||
|
||||
@ -121,11 +121,11 @@ namespace osu.Game.Screens.Select
|
||||
},
|
||||
},
|
||||
// Text for beatmap info
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 20 },
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
@ -133,7 +133,7 @@ namespace osu.Game.Screens.Select
|
||||
new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-MediumItalic",
|
||||
Text = beatmapSetInfo.Metadata.Artist + " -- " + beatmapSetInfo.Metadata.Title,
|
||||
Text = metadata.Artist + " -- " + metadata.Title,
|
||||
TextSize = 28,
|
||||
Shadow = true,
|
||||
},
|
||||
@ -144,10 +144,10 @@ namespace osu.Game.Screens.Select
|
||||
TextSize = 17,
|
||||
Shadow = true,
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Margin = new MarginPadding { Top = 10 },
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new []
|
||||
{
|
||||
@ -161,16 +161,16 @@ namespace osu.Game.Screens.Select
|
||||
new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-Bold",
|
||||
Text = beatmapSetInfo.Metadata.Author,
|
||||
Text = metadata.Author,
|
||||
TextSize = 15,
|
||||
Shadow = true,
|
||||
},
|
||||
}
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Margin = new MarginPadding { Top = 20 },
|
||||
Spacing = new Vector2(40,0),
|
||||
Spacing = new Vector2(40, 0),
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = labels
|
||||
},
|
||||
|
@ -47,7 +47,7 @@ namespace osu.Game.Screens.Select
|
||||
Alpha = 0.8f,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Padding = new MarginPadding(20),
|
||||
AutoSizeAxes = Axes.Y,
|
||||
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Width = 0.4f, // TODO: InnerWidth property or something
|
||||
Direction = FlowDirections.Vertical,
|
||||
Direction = FillDirection.Down,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
searchTextBox = new SearchTextBox {
|
||||
@ -185,10 +185,10 @@ namespace osu.Game.Screens.Select
|
||||
Origin = Anchor.BottomLeft,
|
||||
Anchor = Anchor.BottomLeft,
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
Spacing = new Vector2(10, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -217,10 +217,10 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
Spacing = new Vector2(10, 0),
|
||||
Origin = Anchor.TopRight,
|
||||
Anchor = Anchor.TopRight,
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Screens.Select
|
||||
public Action OnBack;
|
||||
public Action OnStart;
|
||||
|
||||
private FlowContainer buttons;
|
||||
private FillFlowContainer buttons;
|
||||
|
||||
public OsuLogo StartButton;
|
||||
|
||||
@ -91,21 +91,20 @@ namespace osu.Game.Screens.Select
|
||||
Origin = Anchor.BottomLeft,
|
||||
Action = () => OnBack?.Invoke(),
|
||||
},
|
||||
new FlowContainer
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.BottomLeft,
|
||||
Origin = Anchor.BottomLeft,
|
||||
Position = new Vector2(BackButton.SIZE_EXTENDED.X + padding, 0),
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
Spacing = new Vector2(padding, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
||||
buttons = new FlowContainer
|
||||
buttons = new FillFlowContainer
|
||||
{
|
||||
Direction = FlowDirections.Horizontal,
|
||||
Direction = FillDirection.Right,
|
||||
Spacing = new Vector2(0.2f, 0),
|
||||
AutoSizeAxes = Axes.Both,
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Overlays;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -38,6 +39,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private CarouselContainer carousel;
|
||||
private TrackManager trackManager;
|
||||
private DialogOverlay dialogOverlay;
|
||||
|
||||
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225);
|
||||
private BeatmapInfoWedge beatmapInfoWedge;
|
||||
@ -72,7 +74,7 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(BeatmapDatabase beatmaps, AudioManager audio, Framework.Game game,
|
||||
private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, Framework.Game game,
|
||||
OsuGame osuGame, OsuColour colours)
|
||||
{
|
||||
const float carousel_width = 640;
|
||||
@ -137,7 +139,7 @@ namespace osu.Game.Screens.Select
|
||||
PreferredPlayMode = playMode.Value
|
||||
})).LoadAsync(Game, l => Push(player));
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
footer.AddButton(@"mods", colours.Yellow, null);
|
||||
@ -157,6 +159,7 @@ namespace osu.Game.Screens.Select
|
||||
database.BeatmapSetRemoved += onBeatmapSetRemoved;
|
||||
|
||||
trackManager = audio.Track;
|
||||
dialogOverlay = dialog;
|
||||
|
||||
sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
|
||||
sampleChangeBeatmap = audio.Sample.Get(@"SongSelect/select-expand");
|
||||
@ -399,12 +402,14 @@ namespace osu.Game.Screens.Select
|
||||
footer.StartButton.TriggerClick();
|
||||
return true;
|
||||
case Key.Delete:
|
||||
if (Beatmap != null)
|
||||
if (state.Keyboard.ShiftPressed)
|
||||
{
|
||||
Beatmap.Dispose();
|
||||
database.Delete(Beatmap.BeatmapSetInfo);
|
||||
if (Beatmap != null)
|
||||
dialogOverlay?.Push(new BeatmapDeleteDialog(Beatmap));
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
|
Reference in New Issue
Block a user