mirror of
https://github.com/ppy/osu.git
synced 2024-09-21 13:27:25 +08:00
Make list of breaks bindable
This commit is contained in:
parent
f88f05717a
commit
6a6ccbc09f
@ -74,7 +74,7 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
|
|||||||
StartTime = 5000,
|
StartTime = 5000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(2000, 4000),
|
new BreakPeriod(2000, 4000),
|
||||||
}
|
}
|
||||||
|
@ -133,7 +133,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
|
|||||||
Autoplay = false,
|
Autoplay = false,
|
||||||
Beatmap = new Beatmap
|
Beatmap = new Beatmap
|
||||||
{
|
{
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(500, 2000),
|
new BreakPeriod(500, 2000),
|
||||||
},
|
},
|
||||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
|
|||||||
StartTime = 5000,
|
StartTime = 5000,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(2000, 4000),
|
new BreakPeriod(2000, 4000),
|
||||||
}
|
}
|
||||||
|
@ -132,7 +132,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
|
|||||||
Autoplay = false,
|
Autoplay = false,
|
||||||
Beatmap = new Beatmap
|
Beatmap = new Beatmap
|
||||||
{
|
{
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(500, 2000),
|
new BreakPeriod(500, 2000),
|
||||||
},
|
},
|
||||||
|
@ -177,7 +177,7 @@ namespace osu.Game.Rulesets.Taiko.Tests.Mods
|
|||||||
Autoplay = false,
|
Autoplay = false,
|
||||||
Beatmap = new Beatmap
|
Beatmap = new Beatmap
|
||||||
{
|
{
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(100, 1600),
|
new BreakPeriod(100, 1600),
|
||||||
},
|
},
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// 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.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
@ -29,7 +28,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
{
|
{
|
||||||
var beatmap = new Beatmap<HitObject>
|
var beatmap = new Beatmap<HitObject>
|
||||||
{
|
{
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(0, 649)
|
new BreakPeriod(0, 649)
|
||||||
}
|
}
|
||||||
@ -52,7 +51,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 0 },
|
new HitCircle { StartTime = 0 },
|
||||||
new HitCircle { StartTime = 1_200 }
|
new HitCircle { StartTime = 1_200 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(100, 751)
|
new BreakPeriod(100, 751)
|
||||||
}
|
}
|
||||||
@ -75,7 +74,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 0 },
|
new HitCircle { StartTime = 0 },
|
||||||
new HitCircle { StartTime = 1_298 }
|
new HitCircle { StartTime = 1_298 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(200, 850)
|
new BreakPeriod(200, 850)
|
||||||
}
|
}
|
||||||
@ -98,7 +97,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 0 },
|
new HitCircle { StartTime = 0 },
|
||||||
new HitCircle { StartTime = 1200 }
|
new HitCircle { StartTime = 1200 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(1398, 2300)
|
new BreakPeriod(1398, 2300)
|
||||||
}
|
}
|
||||||
@ -121,7 +120,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 1100 },
|
new HitCircle { StartTime = 1100 },
|
||||||
new HitCircle { StartTime = 1500 }
|
new HitCircle { StartTime = 1500 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(0, 652)
|
new BreakPeriod(0, 652)
|
||||||
}
|
}
|
||||||
@ -145,7 +144,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 1_297 },
|
new HitCircle { StartTime = 1_297 },
|
||||||
new HitCircle { StartTime = 1_298 }
|
new HitCircle { StartTime = 1_298 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(200, 850)
|
new BreakPeriod(200, 850)
|
||||||
}
|
}
|
||||||
@ -168,7 +167,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 0 },
|
new HitCircle { StartTime = 0 },
|
||||||
new HitCircle { StartTime = 1_300 }
|
new HitCircle { StartTime = 1_300 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(200, 850)
|
new BreakPeriod(200, 850)
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ namespace osu.Game.Tests.Editing.Checks
|
|||||||
new HitCircle { StartTime = 0 },
|
new HitCircle { StartTime = 0 },
|
||||||
new HitCircle { StartTime = 40_000 }
|
new HitCircle { StartTime = 40_000 }
|
||||||
},
|
},
|
||||||
Breaks = new List<BreakPeriod>
|
Breaks =
|
||||||
{
|
{
|
||||||
new BreakPeriod(10_000, 21_000)
|
new BreakPeriod(10_000, 21_000)
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.IO.Serialization.Converters;
|
using osu.Game.IO.Serialization.Converters;
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
@ -61,7 +62,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public ControlPointInfo ControlPointInfo { get; set; } = new ControlPointInfo();
|
public ControlPointInfo ControlPointInfo { get; set; } = new ControlPointInfo();
|
||||||
|
|
||||||
public List<BreakPeriod> Breaks { get; set; } = new List<BreakPeriod>();
|
public BindableList<BreakPeriod> Breaks { get; set; } = new BindableList<BreakPeriod>();
|
||||||
|
|
||||||
public List<string> UnhandledEventLines { get; set; } = new List<string>();
|
public List<string> UnhandledEventLines { get; set; } = new List<string>();
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
using osu.Game.Beatmaps.Timing;
|
using osu.Game.Beatmaps.Timing;
|
||||||
using osu.Game.Rulesets.Objects;
|
using osu.Game.Rulesets.Objects;
|
||||||
@ -40,7 +41,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The breaks in this beatmap.
|
/// The breaks in this beatmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
List<BreakPeriod> Breaks { get; }
|
BindableList<BreakPeriod> Breaks { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// All lines from the [Events] section which aren't handled in the encoding process yet.
|
/// All lines from the [Events] section which aren't handled in the encoding process yet.
|
||||||
|
@ -9,6 +9,7 @@ using System.Linq;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Beatmaps.ControlPoints;
|
using osu.Game.Beatmaps.ControlPoints;
|
||||||
@ -329,7 +330,7 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
set => baseBeatmap.Difficulty = value;
|
set => baseBeatmap.Difficulty = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BreakPeriod> Breaks => baseBeatmap.Breaks;
|
public BindableList<BreakPeriod> Breaks => baseBeatmap.Breaks;
|
||||||
public List<string> UnhandledEventLines => baseBeatmap.UnhandledEventLines;
|
public List<string> UnhandledEventLines => baseBeatmap.UnhandledEventLines;
|
||||||
|
|
||||||
public double TotalBreakTime => baseBeatmap.TotalBreakTime;
|
public double TotalBreakTime => baseBeatmap.TotalBreakTime;
|
||||||
|
@ -27,8 +27,9 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline
|
|||||||
{
|
{
|
||||||
base.LoadBeatmap(beatmap);
|
base.LoadBeatmap(beatmap);
|
||||||
|
|
||||||
// TODO: this will have to be mutable soon enough
|
breaks.UnbindAll();
|
||||||
breaks.AddRange(beatmap.Breaks);
|
breaks.BindTo(beatmap.Breaks);
|
||||||
|
breaks.BindCollectionChanged((_, _) => breakCache.Invalidate());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -172,7 +172,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
set => PlayableBeatmap.ControlPointInfo = value;
|
set => PlayableBeatmap.ControlPointInfo = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<BreakPeriod> Breaks => PlayableBeatmap.Breaks;
|
public BindableList<BreakPeriod> Breaks => PlayableBeatmap.Breaks;
|
||||||
|
|
||||||
public List<string> UnhandledEventLines => PlayableBeatmap.UnhandledEventLines;
|
public List<string> UnhandledEventLines => PlayableBeatmap.UnhandledEventLines;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user