1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 22:22:54 +08:00

Update editor workflow and make edit button works.

This commit is contained in:
Huo Yaoyuan 2017-03-14 22:18:40 +08:00
parent f068f7c4bd
commit b2dd9afcf3
4 changed files with 21 additions and 12 deletions

View File

@ -1,34 +1,38 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Generic;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Beatmaps;
using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Select;
namespace osu.Game.Screens.Edit namespace osu.Game.Screens.Edit
{ {
internal class Editor : ScreenWhiteBox internal class Editor : ScreenWhiteBox
{ {
private WorkingBeatmap beatmap; protected override IEnumerable<Type> PossibleChildren => new Type[] { typeof(EditSongSelect) };
public Editor(WorkingBeatmap workingBeatmap)
{
beatmap = workingBeatmap;
}
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4"); protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
protected override void OnResuming(Screen last)
{
Beatmap?.Track?.Stop();
base.OnResuming(last);
}
protected override void OnEntering(Screen last) protected override void OnEntering(Screen last)
{ {
base.OnEntering(last); base.OnEntering(last);
Background.Schedule(() => Background.FadeColour(Color4.DarkGray, 500)); Background.Schedule(() => Background.FadeColour(Color4.DarkGray, 500));
beatmap.Track?.Stop(); Beatmap?.Track?.Stop();
} }
protected override bool OnExiting(Screen next) protected override bool OnExiting(Screen next)
{ {
Background.Schedule(() => Background.FadeColour(Color4.White, 500)); Background.Schedule(() => Background.FadeColour(Color4.White, 500));
beatmap.Track?.Start(); Beatmap?.Track?.Start();
return base.OnExiting(next); return base.OnExiting(next);
} }
} }

View File

@ -10,6 +10,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Backgrounds;
using osu.Game.Screens.Charts; using osu.Game.Screens.Charts;
using osu.Game.Screens.Direct; using osu.Game.Screens.Direct;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Multiplayer; using osu.Game.Screens.Multiplayer;
using OpenTK; using OpenTK;
using osu.Game.Screens.Select; using osu.Game.Screens.Select;
@ -44,7 +45,7 @@ namespace osu.Game.Screens.Menu
{ {
OnChart = delegate { Push(new ChartListing()); }, OnChart = delegate { Push(new ChartListing()); },
OnDirect = delegate { Push(new OnlineListing()); }, OnDirect = delegate { Push(new OnlineListing()); },
OnEdit = delegate { Push(new EditSongSelect()); }, OnEdit = delegate { Push(new Editor()); },
OnSolo = delegate { Push(new PlaySongSelect()); }, OnSolo = delegate { Push(new PlaySongSelect()); },
OnMulti = delegate { Push(new Lobby()); }, OnMulti = delegate { Push(new Lobby()); },
OnTest = delegate { Push(new TestBrowser()); }, OnTest = delegate { Push(new TestBrowser()); },

View File

@ -2,13 +2,12 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Screens.Edit;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
{ {
internal class EditSongSelect : SongSelect internal class EditSongSelect : SongSelect
{ {
public EditSongSelect() : base(false) { } public EditSongSelect() : base(false) { }
protected override void OnSelected(WorkingBeatmap beatmap) => Push(new Editor(beatmap)); protected override void OnSelected(WorkingBeatmap beatmap) => Exit();
} }
} }

View File

@ -9,6 +9,7 @@ using osu.Framework.Screens;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Overlays.Mods; using osu.Game.Overlays.Mods;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
@ -36,7 +37,11 @@ namespace osu.Game.Screens.Select
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1);
BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2); BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2);
BeatmapOptions.AddButton(@"Edit", @"Beatmap", FontAwesome.fa_pencil, colours.Yellow, null, Key.Number3); BeatmapOptions.AddButton(@"Edit", @"Beatmap", FontAwesome.fa_pencil, colours.Yellow, () =>
{
ValidForResume = false;
Push(new Editor());
}, Key.Number3);
} }
protected override void OnBeatmapChanged(WorkingBeatmap beatmap) protected override void OnBeatmapChanged(WorkingBeatmap beatmap)