mirror of
https://github.com/osukey/osukey.git
synced 2025-05-04 21:27:22 +09:00
commit
cd5ad5a05c
@ -1 +1 @@
|
|||||||
Subproject commit 13af08782cfb4de054b2fb11a2cf8311ff895949
|
Subproject commit dd9faf46095a761558abc6cb11ecd0e7498dba4e
|
@ -44,11 +44,14 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
time += 500;
|
time += 500;
|
||||||
}
|
}
|
||||||
|
|
||||||
Add(new Player()
|
Add(new Player
|
||||||
{
|
{
|
||||||
Beatmap = new Beatmap
|
Beatmap = new WorkingBeatmap
|
||||||
{
|
{
|
||||||
HitObjects = objects
|
Beatmap = new Beatmap
|
||||||
|
{
|
||||||
|
HitObjects = objects
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class OsuLegacyDecoderTest
|
public class OsuLegacyDecoderTest
|
||||||
{
|
{
|
||||||
[TestFixtureSetUp]
|
[OneTimeSetUpAttribute]
|
||||||
public void SetUp()
|
public void SetUp()
|
||||||
{
|
{
|
||||||
OsuLegacyDecoder.Register();
|
OsuLegacyDecoder.Register();
|
||||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Tests.Beatmaps.IO
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class OszArchiveReaderTest
|
public class OszArchiveReaderTest
|
||||||
{
|
{
|
||||||
[TestFixtureSetUp]
|
[OneTimeSetUpAttribute]
|
||||||
public void SetUp()
|
public void SetUp()
|
||||||
{
|
{
|
||||||
OszArchiveReader.Register();
|
OszArchiveReader.Register();
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="nunit.framework">
|
<Reference Include="nunit.framework">
|
||||||
<HintPath>$(SolutionDir)\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
|
<HintPath>$(SolutionDir)\packages\NUnit.3.5.0\lib\nunit.framework.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
<Reference Include="OpenTK, Version=2.0.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||||
<HintPath>$(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1339\lib\net45\OpenTK.dll</HintPath>
|
<HintPath>$(SolutionDir)\packages\ppy.OpenTK.2.0.50727.1339\lib\net45\OpenTK.dll</HintPath>
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 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 System.Collections.Generic;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Game.Beatmaps.Objects;
|
using osu.Game.Beatmaps.Objects;
|
||||||
@ -13,6 +12,7 @@ namespace osu.Game.Beatmaps
|
|||||||
public class Beatmap
|
public class Beatmap
|
||||||
{
|
{
|
||||||
public BeatmapInfo BeatmapInfo { get; set; }
|
public BeatmapInfo BeatmapInfo { get; set; }
|
||||||
|
public BeatmapMetadata Metadata => BeatmapInfo?.Metadata ?? BeatmapInfo?.BeatmapSet?.Metadata;
|
||||||
public List<HitObject> HitObjects { get; set; }
|
public List<HitObject> HitObjects { get; set; }
|
||||||
public List<ControlPoint> ControlPoints { get; set; }
|
public List<ControlPoint> ControlPoints { get; set; }
|
||||||
public List<Color4> ComboColors { get; set; }
|
public List<Color4> ComboColors { get; set; }
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
//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;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
@ -27,6 +28,8 @@ namespace osu.Game.Beatmaps.Drawable
|
|||||||
|
|
||||||
private BeatmapGroupState state;
|
private BeatmapGroupState state;
|
||||||
|
|
||||||
|
public List<BeatmapPanel> BeatmapPanels;
|
||||||
|
|
||||||
public BeatmapGroupState State
|
public BeatmapGroupState State
|
||||||
{
|
{
|
||||||
get { return state; }
|
get { return state; }
|
||||||
@ -40,9 +43,6 @@ namespace osu.Game.Beatmaps.Drawable
|
|||||||
difficulties.Show();
|
difficulties.Show();
|
||||||
|
|
||||||
header.State = PanelSelectedState.Selected;
|
header.State = PanelSelectedState.Selected;
|
||||||
|
|
||||||
if (SelectedPanel == null)
|
|
||||||
((BeatmapPanel)difficulties.Children.FirstOrDefault()).State = PanelSelectedState.Selected;
|
|
||||||
break;
|
break;
|
||||||
case BeatmapGroupState.Collapsed:
|
case BeatmapGroupState.Collapsed:
|
||||||
FadeTo(0.5f, 250);
|
FadeTo(0.5f, 250);
|
||||||
@ -62,6 +62,16 @@ namespace osu.Game.Beatmaps.Drawable
|
|||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
|
||||||
|
BeatmapPanels = beatmapSet.Beatmaps.Select(b =>
|
||||||
|
new BeatmapPanel(b)
|
||||||
|
{
|
||||||
|
GainedSelection = panelGainedSelection,
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
Children = new[]
|
Children = new[]
|
||||||
{
|
{
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
@ -87,15 +97,7 @@ namespace osu.Game.Beatmaps.Drawable
|
|||||||
Spacing = new Vector2(0, 5),
|
Spacing = new Vector2(0, 5),
|
||||||
Direction = FlowDirection.VerticalOnly,
|
Direction = FlowDirection.VerticalOnly,
|
||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
Children = this.beatmapSet.Beatmaps.Select(b =>
|
Children = BeatmapPanels
|
||||||
new BeatmapPanel(this.beatmapSet, b)
|
|
||||||
{
|
|
||||||
GainedSelection = panelGainedSelection,
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -112,17 +114,28 @@ namespace osu.Game.Beatmaps.Drawable
|
|||||||
{
|
{
|
||||||
State = BeatmapGroupState.Expanded;
|
State = BeatmapGroupState.Expanded;
|
||||||
|
|
||||||
SelectionChanged?.Invoke(this, SelectedPanel.Beatmap);
|
//we want to make sure one of our children is selected in the case none have been selected yet.
|
||||||
|
if (SelectedPanel == null)
|
||||||
|
BeatmapPanels.First().State = PanelSelectedState.Selected;
|
||||||
|
else
|
||||||
|
SelectionChanged?.Invoke(this, SelectedPanel.Beatmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void panelGainedSelection(BeatmapPanel panel)
|
private void panelGainedSelection(BeatmapPanel panel)
|
||||||
{
|
{
|
||||||
State = BeatmapGroupState.Expanded;
|
try
|
||||||
|
{
|
||||||
if (SelectedPanel != null) SelectedPanel.State = PanelSelectedState.NotSelected;
|
if (SelectedPanel == panel) return;
|
||||||
SelectedPanel = panel;
|
|
||||||
|
|
||||||
SelectionChanged?.Invoke(this, panel.Beatmap);
|
if (SelectedPanel != null)
|
||||||
|
SelectedPanel.State = PanelSelectedState.NotSelected;
|
||||||
|
SelectedPanel = panel;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
State = BeatmapGroupState.Expanded;
|
||||||
|
SelectionChanged?.Invoke(this, panel.Beatmap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Beatmaps.Drawable
|
|||||||
GainedSelection?.Invoke(this);
|
GainedSelection?.Invoke(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapPanel(BeatmapSetInfo set, BeatmapInfo beatmap)
|
public BeatmapPanel(BeatmapInfo beatmap)
|
||||||
{
|
{
|
||||||
Beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
Height *= 0.75f;
|
Height *= 0.75f;
|
||||||
@ -67,7 +67,7 @@ namespace osu.Game.Beatmaps.Drawable
|
|||||||
},
|
},
|
||||||
new SpriteText
|
new SpriteText
|
||||||
{
|
{
|
||||||
Text = $" mapped by {(beatmap.Metadata ?? set.Metadata).Author}",
|
Text = $" mapped by {(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author}",
|
||||||
TextSize = 16,
|
TextSize = 16,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ namespace osu.Game.Beatmaps.Drawable
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (state == value) return;
|
if (state == value) return;
|
||||||
|
|
||||||
state = value;
|
state = value;
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
|
@ -34,8 +34,8 @@ namespace osu.Game.Beatmaps.Objects.Catch.Drawable
|
|||||||
|
|
||||||
Texture = game.Textures.Get(@"Menu/logo");
|
Texture = game.Textures.Get(@"Menu/logo");
|
||||||
|
|
||||||
Transforms.Add(new TransformPosition(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) });
|
Transforms.Add(new TransformPosition { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = new Vector2(h.Position, -0.1f), EndValue = new Vector2(h.Position, 0.9f) });
|
||||||
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
|
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
|
||||||
Expire(true);
|
Expire(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ namespace osu.Game.Beatmaps.Objects.Mania.Drawable
|
|||||||
base.Load(game);
|
base.Load(game);
|
||||||
Texture = game.Textures.Get(@"Menu/logo");
|
Texture = game.Textures.Get(@"Menu/logo");
|
||||||
|
|
||||||
Transforms.Add(new TransformPositionY(Clock) { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f });
|
Transforms.Add(new TransformPositionY() { StartTime = note.StartTime - 200, EndTime = note.StartTime, StartValue = -0.1f, EndValue = 0.9f });
|
||||||
Transforms.Add(new TransformAlpha(Clock) { StartTime = note.StartTime + note.Duration + 200, EndTime = note.StartTime + note.Duration + 400, StartValue = 1, EndValue = 0 });
|
Transforms.Add(new TransformAlpha() { StartTime = note.StartTime + note.Duration + 200, EndTime = note.StartTime + note.Duration + 400, StartValue = 1, EndValue = 0 });
|
||||||
Expire(true);
|
Expire(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,36 +77,36 @@ namespace osu.Game.Beatmaps.Objects.Osu.Drawable
|
|||||||
|
|
||||||
Flush(); //move to DrawableHitObject
|
Flush(); //move to DrawableHitObject
|
||||||
|
|
||||||
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime - 1000, EndTime = h.StartTime - 800, StartValue = 0, EndValue = 1 });
|
Transforms.Add(new TransformAlpha { StartTime = h.StartTime - 1000, EndTime = h.StartTime - 800, StartValue = 0, EndValue = 1 });
|
||||||
|
|
||||||
approachCircle.Transforms.Add(new TransformScale(Clock) { StartTime = h.StartTime - 1000, EndTime = h.StartTime, StartValue = new Vector2(2f), EndValue = new Vector2(0.6f) });
|
approachCircle.Transforms.Add(new TransformScale { StartTime = h.StartTime - 1000, EndTime = h.StartTime, StartValue = new Vector2(2f), EndValue = new Vector2(0.6f) });
|
||||||
approachCircle.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime, EndTime = h.StartTime, StartValue = 1, EndValue = 0 });
|
approachCircle.Transforms.Add(new TransformAlpha { StartTime = h.StartTime, EndTime = h.StartTime, StartValue = 1, EndValue = 0 });
|
||||||
|
|
||||||
glow.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime, EndTime = h.StartTime + 400, StartValue = glow.Alpha, EndValue = 0 });
|
glow.Transforms.Add(new TransformAlpha { StartTime = h.StartTime, EndTime = h.StartTime + 400, StartValue = glow.Alpha, EndValue = 0 });
|
||||||
|
|
||||||
switch (state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ArmedState.Disarmed:
|
case ArmedState.Disarmed:
|
||||||
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
|
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
|
||||||
break;
|
break;
|
||||||
case ArmedState.Armed:
|
case ArmedState.Armed:
|
||||||
const float flashIn = 30;
|
const float flashIn = 30;
|
||||||
const float fadeOut = 800;
|
const float fadeOut = 800;
|
||||||
|
|
||||||
//Transforms.Add(new TransformScale(Clock) { StartTime = h.StartTime, EndTime = h.StartTime + 400, StartValue = Scale, EndValue = Scale * 1.1f });
|
//Transforms.Add(new TransformScale() { StartTime = h.StartTime, EndTime = h.StartTime + 400, StartValue = Scale, EndValue = Scale * 1.1f });
|
||||||
|
|
||||||
ring.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0 });
|
ring.Transforms.Add(new TransformAlpha { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0 });
|
||||||
circle.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0 });
|
circle.Transforms.Add(new TransformAlpha { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0 });
|
||||||
number.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0 });
|
number.Transforms.Add(new TransformAlpha { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0 });
|
||||||
|
|
||||||
flash.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0.8f });
|
flash.Transforms.Add(new TransformAlpha { StartTime = h.StartTime, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 0.8f });
|
||||||
flash.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn + 100, StartValue = 0.8f, EndValue = 0 });
|
flash.Transforms.Add(new TransformAlpha { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn + 100, StartValue = 0.8f, EndValue = 0 });
|
||||||
|
|
||||||
explode.Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 1 });
|
explode.Transforms.Add(new TransformAlpha { StartTime = h.StartTime, EndTime = h.StartTime + flashIn, StartValue = 0, EndValue = 1 });
|
||||||
|
|
||||||
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn + fadeOut, StartValue = 1, EndValue = 0 });
|
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + flashIn, EndTime = h.StartTime + flashIn + fadeOut, StartValue = 1, EndValue = 0 });
|
||||||
|
|
||||||
Transforms.Add(new TransformScale(Clock) { StartTime = h.StartTime + h.Duration, EndTime = h.StartTime + h.Duration + 400, StartValue = Scale, EndValue = Scale * 1.5f, Easing = EasingTypes.OutQuad });
|
Transforms.Add(new TransformScale { StartTime = h.StartTime + h.Duration, EndTime = h.StartTime + h.Duration + 400, StartValue = Scale, EndValue = Scale * 1.5f, Easing = EasingTypes.OutQuad });
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,8 @@ namespace osu.Game.Beatmaps.Objects.Taiko.Drawable
|
|||||||
|
|
||||||
Texture = game.Textures.Get(@"Menu/logo");
|
Texture = game.Textures.Get(@"Menu/logo");
|
||||||
|
|
||||||
Transforms.Add(new TransformPositionX(Clock) { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 1.1f, EndValue = 0.1f });
|
Transforms.Add(new TransformPositionX { StartTime = h.StartTime - 200, EndTime = h.StartTime, StartValue = 1.1f, EndValue = 0.1f });
|
||||||
Transforms.Add(new TransformAlpha(Clock) { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
|
Transforms.Add(new TransformAlpha { StartTime = h.StartTime + h.Duration + 200, EndTime = h.StartTime + h.Duration + 400, StartValue = 1, EndValue = 0 });
|
||||||
Expire(true);
|
Expire(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
87
osu.Game/Beatmaps/WorkingBeatmap.cs
Normal file
87
osu.Game/Beatmaps/WorkingBeatmap.cs
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Game.Beatmaps.Formats;
|
||||||
|
using osu.Game.Beatmaps.IO;
|
||||||
|
using osu.Game.Database;
|
||||||
|
|
||||||
|
namespace osu.Game.Beatmaps
|
||||||
|
{
|
||||||
|
public class WorkingBeatmap : IDisposable
|
||||||
|
{
|
||||||
|
public BeatmapInfo BeatmapInfo;
|
||||||
|
|
||||||
|
public readonly ArchiveReader Reader;
|
||||||
|
|
||||||
|
private Beatmap beatmap;
|
||||||
|
public Beatmap Beatmap
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (beatmap != null) return beatmap;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
using (var stream = new StreamReader(Reader.ReadFile(BeatmapInfo.Path)))
|
||||||
|
beatmap = BeatmapDecoder.GetDecoder(stream)?.Decode(stream);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return beatmap;
|
||||||
|
}
|
||||||
|
set { beatmap = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
private AudioTrack track;
|
||||||
|
public AudioTrack Track
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (track != null) return track;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var trackData = Reader.ReadFile(BeatmapInfo.Metadata.AudioFile);
|
||||||
|
if (trackData != null)
|
||||||
|
track = new AudioTrackBass(trackData);
|
||||||
|
}
|
||||||
|
catch { }
|
||||||
|
|
||||||
|
return track;
|
||||||
|
}
|
||||||
|
set { track = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public WorkingBeatmap(BeatmapInfo beatmapInfo = null, ArchiveReader reader = null)
|
||||||
|
{
|
||||||
|
this.BeatmapInfo = beatmapInfo;
|
||||||
|
Reader = reader;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool isDisposed;
|
||||||
|
|
||||||
|
protected virtual void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
if (!isDisposed)
|
||||||
|
{
|
||||||
|
track?.Dispose();
|
||||||
|
Reader?.Dispose();
|
||||||
|
isDisposed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
Dispose(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TransferTo(WorkingBeatmap working)
|
||||||
|
{
|
||||||
|
if (track != null && working.BeatmapInfo.Metadata.AudioFile == BeatmapInfo.Metadata.AudioFile && working.BeatmapInfo.BeatmapSet.Path == BeatmapInfo.BeatmapSet.Path)
|
||||||
|
working.track = track;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -130,43 +130,56 @@ namespace osu.Game.Database
|
|||||||
{
|
{
|
||||||
return ArchiveReader.GetReader(storage, beatmapSet.Path);
|
return ArchiveReader.GetReader(storage, beatmapSet.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapSetInfo GetBeatmapSet(int id)
|
public BeatmapSetInfo GetBeatmapSet(int id)
|
||||||
{
|
{
|
||||||
return Query<BeatmapSetInfo>().Where(s => s.BeatmapSetID == id).FirstOrDefault();
|
return Query<BeatmapSetInfo>().Where(s => s.BeatmapSetID == id).FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WorkingBeatmap GetWorkingBeatmap(BeatmapInfo beatmapInfo, WorkingBeatmap previous = null)
|
||||||
|
{
|
||||||
|
var beatmapSetInfo = Query<BeatmapSetInfo>().FirstOrDefault(s => s.BeatmapSetID == beatmapInfo.BeatmapSetID);
|
||||||
|
|
||||||
|
//we need metadata
|
||||||
|
GetChildren(beatmapSetInfo);
|
||||||
|
|
||||||
|
if (beatmapSetInfo == null)
|
||||||
|
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetID} is not in the local database.");
|
||||||
|
|
||||||
|
var reader = GetReader(beatmapSetInfo);
|
||||||
|
|
||||||
|
if (beatmapInfo.Metadata == null)
|
||||||
|
beatmapInfo.Metadata = beatmapSetInfo.Metadata;
|
||||||
|
|
||||||
|
var working = new WorkingBeatmap(beatmapInfo, reader);
|
||||||
|
|
||||||
|
previous?.TransferTo(working);
|
||||||
|
|
||||||
|
return working;
|
||||||
|
}
|
||||||
|
|
||||||
public Beatmap GetBeatmap(BeatmapInfo beatmapInfo)
|
public Beatmap GetBeatmap(BeatmapInfo beatmapInfo)
|
||||||
{
|
{
|
||||||
var beatmapSet = Query<BeatmapSetInfo>()
|
using (WorkingBeatmap data = GetWorkingBeatmap(beatmapInfo))
|
||||||
.Where(s => s.BeatmapSetID == beatmapInfo.BeatmapSetID).FirstOrDefault();
|
return data.Beatmap;
|
||||||
if (beatmapSet == null)
|
|
||||||
throw new InvalidOperationException(
|
|
||||||
$@"Beatmap set {beatmapInfo.BeatmapSetID} is not in the local database.");
|
|
||||||
using (var reader = GetReader(beatmapSet))
|
|
||||||
using (var stream = new StreamReader(reader.ReadFile(beatmapInfo.Path)))
|
|
||||||
{
|
|
||||||
var decoder = BeatmapDecoder.GetDecoder(stream);
|
|
||||||
return decoder.Decode(stream);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public TableQuery<T> Query<T>() where T : class
|
public TableQuery<T> Query<T>() where T : class
|
||||||
{
|
{
|
||||||
return connection.Table<T>();
|
return connection.Table<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetWithChildren<T>(object id) where T : class
|
public T GetWithChildren<T>(object id) where T : class
|
||||||
{
|
{
|
||||||
return connection.GetWithChildren<T>(id);
|
return connection.GetWithChildren<T>(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null,
|
public List<T> GetAllWithChildren<T>(Expression<Func<T, bool>> filter = null,
|
||||||
bool recursive = true) where T : class
|
bool recursive = true) where T : class
|
||||||
{
|
{
|
||||||
return connection.GetAllWithChildren<T>(filter, recursive);
|
return connection.GetAllWithChildren<T>(filter, recursive);
|
||||||
}
|
}
|
||||||
|
|
||||||
public T GetChildren<T>(T item, bool recursive = true)
|
public T GetChildren<T>(T item, bool recursive = true)
|
||||||
{
|
{
|
||||||
if (item == null) return default(T);
|
if (item == null) return default(T);
|
||||||
|
@ -7,7 +7,7 @@ using SQLiteNetExtensions.Attributes;
|
|||||||
|
|
||||||
namespace osu.Game.Database
|
namespace osu.Game.Database
|
||||||
{
|
{
|
||||||
public class BeatmapInfo
|
public class BeatmapInfo : IEquatable<BeatmapInfo>
|
||||||
{
|
{
|
||||||
[PrimaryKey]
|
[PrimaryKey]
|
||||||
public int BeatmapID { get; set; }
|
public int BeatmapID { get; set; }
|
||||||
@ -64,5 +64,10 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
// Metadata
|
// Metadata
|
||||||
public string Version { get; set; }
|
public string Version { get; set; }
|
||||||
|
|
||||||
|
public bool Equals(BeatmapInfo other)
|
||||||
|
{
|
||||||
|
return BeatmapID == other?.BeatmapID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -117,7 +117,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
icon.RotateTo(10, offset, EasingTypes.InOutSine);
|
icon.RotateTo(10, offset, EasingTypes.InOutSine);
|
||||||
icon.ScaleTo(new Vector2(1, 0.9f), offset, EasingTypes.Out);
|
icon.ScaleTo(new Vector2(1, 0.9f), offset, EasingTypes.Out);
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformRotation(Clock)
|
icon.Transforms.Add(new TransformRotation
|
||||||
{
|
{
|
||||||
StartValue = -10,
|
StartValue = -10,
|
||||||
EndValue = 10,
|
EndValue = 10,
|
||||||
@ -128,7 +128,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
LoopDelay = duration * 2
|
LoopDelay = duration * 2
|
||||||
});
|
});
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformPosition(Clock)
|
icon.Transforms.Add(new TransformPosition
|
||||||
{
|
{
|
||||||
StartValue = Vector2.Zero,
|
StartValue = Vector2.Zero,
|
||||||
EndValue = new Vector2(0, -10),
|
EndValue = new Vector2(0, -10),
|
||||||
@ -139,7 +139,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
LoopDelay = duration
|
LoopDelay = duration
|
||||||
});
|
});
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformScale(Clock)
|
icon.Transforms.Add(new TransformScale
|
||||||
{
|
{
|
||||||
StartValue = new Vector2(1, 0.9f),
|
StartValue = new Vector2(1, 0.9f),
|
||||||
EndValue = Vector2.One,
|
EndValue = Vector2.One,
|
||||||
@ -150,7 +150,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
LoopDelay = duration
|
LoopDelay = duration
|
||||||
});
|
});
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformPosition(Clock)
|
icon.Transforms.Add(new TransformPosition
|
||||||
{
|
{
|
||||||
StartValue = new Vector2(0, -10),
|
StartValue = new Vector2(0, -10),
|
||||||
EndValue = Vector2.Zero,
|
EndValue = Vector2.Zero,
|
||||||
@ -161,7 +161,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
LoopDelay = duration
|
LoopDelay = duration
|
||||||
});
|
});
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformScale(Clock)
|
icon.Transforms.Add(new TransformScale
|
||||||
{
|
{
|
||||||
StartValue = Vector2.One,
|
StartValue = Vector2.One,
|
||||||
EndValue = new Vector2(1, 0.9f),
|
EndValue = new Vector2(1, 0.9f),
|
||||||
@ -172,7 +172,7 @@ namespace osu.Game.GameModes.Menu
|
|||||||
LoopDelay = duration
|
LoopDelay = duration
|
||||||
});
|
});
|
||||||
|
|
||||||
icon.Transforms.Add(new TransformRotation(Clock)
|
icon.Transforms.Add(new TransformRotation
|
||||||
{
|
{
|
||||||
StartValue = 10,
|
StartValue = 10,
|
||||||
EndValue = -10,
|
EndValue = -10,
|
||||||
|
@ -10,6 +10,8 @@ using osu.Framework.Graphics.Transformations;
|
|||||||
using osu.Game.GameModes.Backgrounds;
|
using osu.Game.GameModes.Backgrounds;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Menu
|
namespace osu.Game.GameModes.Menu
|
||||||
{
|
{
|
||||||
|
@ -3,17 +3,20 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.GameModes;
|
using osu.Framework.GameModes;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Background;
|
using osu.Game.Graphics.Background;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.GameModes
|
namespace osu.Game.GameModes
|
||||||
{
|
{
|
||||||
public class OsuGameMode : GameMode
|
public abstract class OsuGameMode : GameMode
|
||||||
{
|
{
|
||||||
internal BackgroundMode Background { get; private set; }
|
internal BackgroundMode Background { get; private set; }
|
||||||
|
|
||||||
@ -23,6 +26,64 @@ namespace osu.Game.GameModes
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual BackgroundMode CreateBackground() => null;
|
protected virtual BackgroundMode CreateBackground() => null;
|
||||||
|
|
||||||
|
private bool boundToBeatmap;
|
||||||
|
private Bindable<WorkingBeatmap> beatmap;
|
||||||
|
|
||||||
|
public WorkingBeatmap Beatmap
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
bindBeatmap();
|
||||||
|
return beatmap.Value;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
bindBeatmap();
|
||||||
|
beatmap.Value = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bindBeatmap()
|
||||||
|
{
|
||||||
|
if (beatmap == null)
|
||||||
|
beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
|
if (!boundToBeatmap)
|
||||||
|
{
|
||||||
|
beatmap.ValueChanged += beatmap_ValueChanged;
|
||||||
|
boundToBeatmap = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
if (boundToBeatmap)
|
||||||
|
beatmap.ValueChanged -= beatmap_ValueChanged;
|
||||||
|
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void beatmap_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
OnBeatmapChanged(beatmap.Value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool Push(GameMode mode)
|
||||||
|
{
|
||||||
|
OsuGameMode nextOsu = mode as OsuGameMode;
|
||||||
|
if (nextOsu != null)
|
||||||
|
{
|
||||||
|
nextOsu.beatmap = beatmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.Push(mode);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void OnBeatmapChanged(WorkingBeatmap beatmap)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnEntering(GameMode last)
|
protected override void OnEntering(GameMode last)
|
||||||
{
|
{
|
||||||
OsuGameMode lastOsu = last as OsuGameMode;
|
OsuGameMode lastOsu = last as OsuGameMode;
|
||||||
|
@ -174,7 +174,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
protected virtual void OnCountRolling(ulong currentValue, ulong newValue)
|
protected virtual void OnCountRolling(ulong currentValue, ulong newValue)
|
||||||
{
|
{
|
||||||
transformRoll(new TransformComboRoll(Clock), currentValue, newValue);
|
transformRoll(new TransformComboRoll(), currentValue, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void OnCountIncrement(ulong currentValue, ulong newValue) {
|
protected virtual void OnCountIncrement(ulong currentValue, ulong newValue) {
|
||||||
@ -248,11 +248,11 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
protected class TransformComboRoll : Transform<ulong>
|
protected class TransformComboRoll : Transform<ulong>
|
||||||
{
|
{
|
||||||
public override ulong CurrentValue
|
protected override ulong CurrentValue
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
double time = Time;
|
double time = CurrentTime ?? 0;
|
||||||
if (time < StartTime) return StartValue;
|
if (time < StartTime) return StartValue;
|
||||||
if (time >= EndTime) return EndValue;
|
if (time >= EndTime) return EndValue;
|
||||||
|
|
||||||
@ -265,11 +265,6 @@ namespace osu.Game.GameModes.Play
|
|||||||
base.Apply(d);
|
base.Apply(d);
|
||||||
(d as ComboCounter).DisplayedCount = CurrentValue;
|
(d as ComboCounter).DisplayedCount = CurrentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransformComboRoll(IClock clock)
|
|
||||||
: base(clock)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,11 +41,11 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
protected class TransformComboResult : Transform<ulong>
|
protected class TransformComboResult : Transform<ulong>
|
||||||
{
|
{
|
||||||
public override ulong CurrentValue
|
protected override ulong CurrentValue
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
double time = Time;
|
double time = CurrentTime ?? 0;
|
||||||
if (time < StartTime) return StartValue;
|
if (time < StartTime) return StartValue;
|
||||||
if (time >= EndTime) return EndValue;
|
if (time >= EndTime) return EndValue;
|
||||||
|
|
||||||
@ -58,11 +58,6 @@ namespace osu.Game.GameModes.Play
|
|||||||
base.Apply(d);
|
base.Apply(d);
|
||||||
(d as ComboResultCounter).DisplayedCount = CurrentValue;
|
(d as ComboResultCounter).DisplayedCount = CurrentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransformComboResult(IClock clock)
|
|
||||||
: base(clock)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,8 +16,11 @@ using OpenTK;
|
|||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
using osu.Game.Beatmaps.Drawable;
|
using osu.Game.Beatmaps.Drawable;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Framework.GameModes;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -26,10 +29,12 @@ namespace osu.Game.GameModes.Play
|
|||||||
private Bindable<PlayMode> playMode;
|
private Bindable<PlayMode> playMode;
|
||||||
private BeatmapDatabase database;
|
private BeatmapDatabase database;
|
||||||
private BeatmapGroup selectedBeatmapGroup;
|
private BeatmapGroup selectedBeatmapGroup;
|
||||||
|
private BeatmapInfo selectedBeatmapInfo;
|
||||||
// TODO: use currently selected track as bg
|
// TODO: use currently selected track as bg
|
||||||
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
||||||
private ScrollContainer scrollContainer;
|
private ScrollContainer scrollContainer;
|
||||||
private FlowContainer setList;
|
private FlowContainer beatmapSetFlow;
|
||||||
|
private TrackManager trackManager;
|
||||||
|
|
||||||
/// <param name="database">Optionally provide a database to use instead of the OsuGame one.</param>
|
/// <param name="database">Optionally provide a database to use instead of the OsuGame one.</param>
|
||||||
public PlaySongSelect(BeatmapDatabase database = null)
|
public PlaySongSelect(BeatmapDatabase database = null)
|
||||||
@ -73,7 +78,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
Origin = Anchor.CentreRight,
|
Origin = Anchor.CentreRight,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
setList = new FlowContainer
|
beatmapSetFlow = new FlowContainer
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding { Left = 25, Top = 25, Bottom = 25 + bottomToolHeight },
|
Padding = new MarginPadding { Left = 25, Top = 25, Bottom = 25 + bottomToolHeight },
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -107,7 +112,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
Colour = new Color4(238, 51, 153, 255),
|
Colour = new Color4(238, 51, 153, 255),
|
||||||
Action = () => Push(new Player {
|
Action = () => Push(new Player {
|
||||||
BeatmapInfo = selectedBeatmapGroup.SelectedPanel.Beatmap,
|
BeatmapInfo = selectedBeatmapGroup.SelectedPanel.Beatmap,
|
||||||
PlayMode = playMode.Value
|
PreferredPlayMode = playMode.Value
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -123,7 +128,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
if (osuGame != null)
|
if (osuGame != null)
|
||||||
{
|
{
|
||||||
playMode = osuGame.PlayMode;
|
playMode = osuGame.PlayMode;
|
||||||
playMode.ValueChanged += PlayMode_ValueChanged;
|
playMode.ValueChanged += playMode_ValueChanged;
|
||||||
// Temporary:
|
// Temporary:
|
||||||
scrollContainer.Padding = new MarginPadding { Top = osuGame.Toolbar.Height };
|
scrollContainer.Padding = new MarginPadding { Top = osuGame.Toolbar.Height };
|
||||||
}
|
}
|
||||||
@ -133,22 +138,76 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
database.BeatmapSetAdded += s => Schedule(() => addBeatmapSet(s));
|
database.BeatmapSetAdded += s => Schedule(() => addBeatmapSet(s));
|
||||||
|
|
||||||
|
trackManager = game.Audio.Track;
|
||||||
|
|
||||||
Task.Factory.StartNew(addBeatmapSets);
|
Task.Factory.StartNew(addBeatmapSets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnEntering(GameMode last)
|
||||||
|
{
|
||||||
|
base.OnEntering(last);
|
||||||
|
ensurePlayingSelected();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnResuming(GameMode last)
|
||||||
|
{
|
||||||
|
ensurePlayingSelected();
|
||||||
|
base.OnResuming(last);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
if (playMode != null)
|
if (playMode != null)
|
||||||
playMode.ValueChanged -= PlayMode_ValueChanged;
|
playMode.ValueChanged -= playMode_ValueChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void PlayMode_ValueChanged(object sender, EventArgs e)
|
private void playMode_ValueChanged(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
private void selectBeatmap(BeatmapGroup group, BeatmapInfo beatmap)
|
/// <summary>
|
||||||
|
/// The global Beatmap was changed.
|
||||||
|
/// </summary>
|
||||||
|
protected override void OnBeatmapChanged(WorkingBeatmap beatmap)
|
||||||
{
|
{
|
||||||
|
base.OnBeatmapChanged(beatmap);
|
||||||
|
selectBeatmap(beatmap.BeatmapInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void selectBeatmap(BeatmapInfo beatmap)
|
||||||
|
{
|
||||||
|
if (beatmap.Equals(selectedBeatmapInfo))
|
||||||
|
return;
|
||||||
|
|
||||||
|
//this is VERY temporary logic.
|
||||||
|
beatmapSetFlow.Children.Cast<BeatmapGroup>().Any(b =>
|
||||||
|
{
|
||||||
|
var panel = b.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(beatmap));
|
||||||
|
if (panel != null)
|
||||||
|
{
|
||||||
|
panel.State = PanelSelectedState.Selected;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// selection has been changed as the result of interaction with the carousel.
|
||||||
|
/// </summary>
|
||||||
|
private void selectionChanged(BeatmapGroup group, BeatmapInfo beatmap)
|
||||||
|
{
|
||||||
|
selectedBeatmapInfo = beatmap;
|
||||||
|
|
||||||
|
if (!beatmap.Equals(Beatmap?.BeatmapInfo))
|
||||||
|
{
|
||||||
|
Beatmap = database.GetWorkingBeatmap(beatmap, Beatmap);
|
||||||
|
}
|
||||||
|
|
||||||
|
ensurePlayingSelected();
|
||||||
|
|
||||||
if (selectedBeatmapGroup == group)
|
if (selectedBeatmapGroup == group)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -158,6 +217,17 @@ namespace osu.Game.GameModes.Play
|
|||||||
selectedBeatmapGroup = group;
|
selectedBeatmapGroup = group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ensurePlayingSelected()
|
||||||
|
{
|
||||||
|
var track = Beatmap?.Track;
|
||||||
|
|
||||||
|
if (track != null)
|
||||||
|
{
|
||||||
|
trackManager.SetExclusive(track);
|
||||||
|
track.Start();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addBeatmapSet(BeatmapSetInfo beatmapSet)
|
private void addBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||||
{
|
{
|
||||||
beatmapSet = database.GetWithChildren<BeatmapSetInfo>(beatmapSet.BeatmapSetID);
|
beatmapSet = database.GetWithChildren<BeatmapSetInfo>(beatmapSet.BeatmapSetID);
|
||||||
@ -165,10 +235,22 @@ namespace osu.Game.GameModes.Play
|
|||||||
beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList();
|
beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList();
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
var group = new BeatmapGroup(beatmapSet) { SelectionChanged = selectBeatmap };
|
var group = new BeatmapGroup(beatmapSet) { SelectionChanged = selectionChanged };
|
||||||
setList.Add(group);
|
beatmapSetFlow.Add(group);
|
||||||
if (setList.Children.Count() == 1)
|
if (Beatmap == null)
|
||||||
group.State = BeatmapGroupState.Expanded;
|
{
|
||||||
|
if (beatmapSetFlow.Children.Count() == 1)
|
||||||
|
group.State = BeatmapGroupState.Expanded;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (selectedBeatmapInfo?.Equals(Beatmap.BeatmapInfo) != true)
|
||||||
|
{
|
||||||
|
var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(Beatmap.BeatmapInfo));
|
||||||
|
if (panel != null)
|
||||||
|
panel.State = PanelSelectedState.Selected;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 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.Collections.Generic;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.Objects;
|
using osu.Game.Beatmaps.Objects;
|
||||||
@ -12,6 +11,9 @@ using osu.Game.GameModes.Play.Osu;
|
|||||||
using osu.Game.GameModes.Play.Taiko;
|
using osu.Game.GameModes.Play.Taiko;
|
||||||
using osu.Framework;
|
using osu.Framework;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Framework.Timing;
|
||||||
|
using osu.Framework.GameModes;
|
||||||
|
using osu.Framework.Audio.Track;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Play
|
||||||
{
|
{
|
||||||
@ -20,9 +22,13 @@ namespace osu.Game.GameModes.Play
|
|||||||
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4");
|
||||||
|
|
||||||
public BeatmapInfo BeatmapInfo;
|
public BeatmapInfo BeatmapInfo;
|
||||||
public Beatmap Beatmap;
|
|
||||||
|
|
||||||
public PlayMode PlayMode;
|
public PlayMode PreferredPlayMode;
|
||||||
|
|
||||||
|
protected override IFrameBasedClock Clock => playerClock;
|
||||||
|
|
||||||
|
private InterpolatingFramedClock playerClock;
|
||||||
|
private IAdjustableClock sourceClock;
|
||||||
|
|
||||||
public override void Load(BaseGame game)
|
public override void Load(BaseGame game)
|
||||||
{
|
{
|
||||||
@ -31,7 +37,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (Beatmap == null)
|
if (Beatmap == null)
|
||||||
Beatmap = ((OsuGame)game).Beatmaps.GetBeatmap(BeatmapInfo);
|
Beatmap = ((OsuGame)game).Beatmaps.GetWorkingBeatmap(BeatmapInfo);
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
@ -40,17 +46,45 @@ namespace osu.Game.GameModes.Play
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AudioTrack track = Beatmap.Track;
|
||||||
|
|
||||||
|
if (track != null)
|
||||||
|
{
|
||||||
|
game.Audio.Track.SetExclusive(track);
|
||||||
|
sourceClock = track;
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceClock = (IAdjustableClock)track ?? new StopwatchClock();
|
||||||
|
playerClock = new InterpolatingFramedClock(sourceClock);
|
||||||
|
|
||||||
|
Schedule(() =>
|
||||||
|
{
|
||||||
|
sourceClock.Reset();
|
||||||
|
sourceClock.Start();
|
||||||
|
});
|
||||||
|
|
||||||
HitRenderer hitRenderer;
|
HitRenderer hitRenderer;
|
||||||
ScoreOverlay scoreOverlay;
|
ScoreOverlay scoreOverlay;
|
||||||
|
|
||||||
switch (PlayMode)
|
var beatmap = Beatmap.Beatmap;
|
||||||
|
|
||||||
|
if (beatmap.BeatmapInfo?.Mode > PlayMode.Osu)
|
||||||
|
{
|
||||||
|
//we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor.
|
||||||
|
Exit();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayMode usablePlayMode = beatmap.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode;
|
||||||
|
|
||||||
|
switch (usablePlayMode)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
scoreOverlay = new ScoreOverlayOsu();
|
scoreOverlay = new ScoreOverlayOsu();
|
||||||
|
|
||||||
hitRenderer = new OsuHitRenderer
|
hitRenderer = new OsuHitRenderer
|
||||||
{
|
{
|
||||||
Objects = Beatmap.HitObjects,
|
Objects = beatmap.HitObjects,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
};
|
};
|
||||||
@ -60,7 +94,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
hitRenderer = new TaikoHitRenderer
|
hitRenderer = new TaikoHitRenderer
|
||||||
{
|
{
|
||||||
Objects = Beatmap.HitObjects,
|
Objects = beatmap.HitObjects,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
};
|
};
|
||||||
@ -70,7 +104,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
hitRenderer = new CatchHitRenderer
|
hitRenderer = new CatchHitRenderer
|
||||||
{
|
{
|
||||||
Objects = Beatmap.HitObjects,
|
Objects = beatmap.HitObjects,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
};
|
};
|
||||||
@ -80,7 +114,7 @@ namespace osu.Game.GameModes.Play
|
|||||||
|
|
||||||
hitRenderer = new ManiaHitRenderer
|
hitRenderer = new ManiaHitRenderer
|
||||||
{
|
{
|
||||||
Objects = Beatmap.HitObjects,
|
Objects = beatmap.HitObjects,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
};
|
};
|
||||||
@ -96,5 +130,11 @@ namespace osu.Game.GameModes.Play
|
|||||||
scoreOverlay,
|
scoreOverlay,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
playerClock.ProcessFrame();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,16 +1,11 @@
|
|||||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
//Copyright (c) 2007-2016 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 System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using osu.Framework.GameModes;
|
using osu.Framework.GameModes;
|
||||||
using osu.Game.GameModes.Backgrounds;
|
using osu.Game.GameModes.Backgrounds;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.GameModes.Play
|
namespace osu.Game.GameModes.Ranking
|
||||||
{
|
{
|
||||||
class Results : GameModeWhiteBox
|
class Results : GameModeWhiteBox
|
||||||
{
|
{
|
@ -57,11 +57,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
base.Apply(d);
|
base.Apply(d);
|
||||||
(d as PercentageCounter).DisplayedCount = CurrentValue;
|
(d as PercentageCounter).DisplayedCount = CurrentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransformAccuracy(IClock clock)
|
|
||||||
: base(clock)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,14 +194,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// <seealso cref="TransformType"/>
|
/// <seealso cref="TransformType"/>
|
||||||
protected virtual void TransformCount(T currentValue, T newValue)
|
protected virtual void TransformCount(T currentValue, T newValue)
|
||||||
{
|
{
|
||||||
object[] parameters = { Clock };
|
|
||||||
|
|
||||||
Debug.Assert(
|
Debug.Assert(
|
||||||
TransformType.IsSubclassOf(typeof(Transform<T>)) || TransformType == typeof(Transform<T>),
|
TransformType.IsSubclassOf(typeof(Transform<T>)) || TransformType == typeof(Transform<T>),
|
||||||
@"transformType should be a subclass of Transform<T>."
|
@"transformType should be a subclass of Transform<T>."
|
||||||
);
|
);
|
||||||
|
|
||||||
TransformCount((Transform<T>)Activator.CreateInstance(TransformType, parameters), currentValue, newValue);
|
TransformCount((Transform<T>)Activator.CreateInstance(TransformType), currentValue, newValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -56,11 +56,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected class TransformScore : Transform<ulong>
|
protected class TransformScore : Transform<ulong>
|
||||||
{
|
{
|
||||||
public override ulong CurrentValue
|
protected override ulong CurrentValue
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
double time = Time;
|
double time = CurrentTime ?? 0;
|
||||||
if (time < StartTime) return StartValue;
|
if (time < StartTime) return StartValue;
|
||||||
if (time >= EndTime) return EndValue;
|
if (time >= EndTime) return EndValue;
|
||||||
|
|
||||||
@ -73,11 +73,6 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
base.Apply(d);
|
base.Apply(d);
|
||||||
(d as ScoreCounter).DisplayedCount = CurrentValue;
|
(d as ScoreCounter).DisplayedCount = CurrentValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public TransformScore(IClock clock)
|
|
||||||
: base(clock)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,10 @@ namespace osu.Game
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ActivateRequested = delegate { volume.Show(); }
|
ActivateRequested = delegate { volume.Show(); }
|
||||||
},
|
},
|
||||||
intro = new Intro(),
|
intro = new Intro
|
||||||
|
{
|
||||||
|
Beatmap = Beatmap
|
||||||
|
},
|
||||||
Toolbar = new Toolbar
|
Toolbar = new Toolbar
|
||||||
{
|
{
|
||||||
OnHome = delegate { MainMenu?.MakeCurrent(); },
|
OnHome = delegate { MainMenu?.MakeCurrent(); },
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
using osu.Framework;
|
using System;
|
||||||
|
using osu.Framework;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.GameModes;
|
using osu.Framework.GameModes;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.IO;
|
using osu.Game.Beatmaps.IO;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
@ -32,6 +35,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
public CursorContainer Cursor;
|
public CursorContainer Cursor;
|
||||||
|
|
||||||
|
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||||
|
|
||||||
public OsuGameBase()
|
public OsuGameBase()
|
||||||
{
|
{
|
||||||
AddInternal(ratioContainer = new RatioAdjust());
|
AddInternal(ratioContainer = new RatioAdjust());
|
||||||
@ -41,6 +46,13 @@ namespace osu.Game
|
|||||||
Options = new Options(),
|
Options = new Options(),
|
||||||
Cursor = new OsuCursorContainer()
|
Cursor = new OsuCursorContainer()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Beatmap.ValueChanged += Beatmap_ValueChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Beatmap_ValueChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Load(BaseGame game)
|
public override void Load(BaseGame game)
|
||||||
|
@ -64,6 +64,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Beatmaps\Beatmap.cs" />
|
<Compile Include="Beatmaps\Beatmap.cs" />
|
||||||
|
<Compile Include="Beatmaps\WorkingBeatmap.cs" />
|
||||||
<Compile Include="Beatmaps\Drawable\BeatmapSetHeader.cs" />
|
<Compile Include="Beatmaps\Drawable\BeatmapSetHeader.cs" />
|
||||||
<Compile Include="Beatmaps\Drawable\DifficultyIcon.cs" />
|
<Compile Include="Beatmaps\Drawable\DifficultyIcon.cs" />
|
||||||
<Compile Include="Beatmaps\Drawable\Panel.cs" />
|
<Compile Include="Beatmaps\Drawable\Panel.cs" />
|
||||||
@ -124,7 +125,7 @@
|
|||||||
<Compile Include="GameModes\Play\Player.cs" />
|
<Compile Include="GameModes\Play\Player.cs" />
|
||||||
<Compile Include="GameModes\Charts\ChartListing.cs" />
|
<Compile Include="GameModes\Charts\ChartListing.cs" />
|
||||||
<Compile Include="GameModes\Play\PlayMode.cs" />
|
<Compile Include="GameModes\Play\PlayMode.cs" />
|
||||||
<Compile Include="GameModes\Play\Results.cs" />
|
<Compile Include="GameModes\Ranking\Results.cs" />
|
||||||
<Compile Include="GameModes\Direct\OnlineListing.cs" />
|
<Compile Include="GameModes\Direct\OnlineListing.cs" />
|
||||||
<Compile Include="GameModes\Play\PlaySongSelect.cs" />
|
<Compile Include="GameModes\Play\PlaySongSelect.cs" />
|
||||||
<Compile Include="GameModes\Play\Catch\CatchHitRenderer.cs" />
|
<Compile Include="GameModes\Play\Catch\CatchHitRenderer.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user