mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 18:27:26 +08:00
Merge branch 'master' into extend-modoverlay
This commit is contained in:
commit
9cdaefb64b
@ -86,5 +86,19 @@ namespace osu.Game.Tests.Beatmaps.Formats
|
||||
Assert.AreEqual(78993, animation.StartTime);
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDecodeVariableWithSuffix()
|
||||
{
|
||||
var decoder = new LegacyStoryboardDecoder();
|
||||
using (var resStream = Resource.OpenResource("variable-with-suffix.osb"))
|
||||
using (var stream = new StreamReader(resStream))
|
||||
{
|
||||
var storyboard = decoder.Decode(stream);
|
||||
|
||||
StoryboardLayer background = storyboard.Layers.Single(l => l.Depth == 3);
|
||||
Assert.AreEqual(123456, ((StoryboardSprite)background.Elements.Single()).InitialPosition.X);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
5
osu.Game.Tests/Resources/variable-with-suffix.osb
Normal file
5
osu.Game.Tests/Resources/variable-with-suffix.osb
Normal file
@ -0,0 +1,5 @@
|
||||
[Variables]
|
||||
$var=1234
|
||||
|
||||
[Events]
|
||||
Sprite,Background,TopCentre,"img.jpg",$var56,240
|
@ -289,15 +289,10 @@ namespace osu.Game.Beatmaps.Formats
|
||||
while (line.IndexOf('$') >= 0)
|
||||
{
|
||||
string origLine = line;
|
||||
string[] split = line.Split(',');
|
||||
for (int i = 0; i < split.Length; i++)
|
||||
{
|
||||
var item = split[i];
|
||||
if (item.StartsWith("$") && variables.ContainsKey(item))
|
||||
split[i] = variables[item];
|
||||
}
|
||||
|
||||
line = string.Join(",", split);
|
||||
foreach (var v in variables)
|
||||
line = line.Replace(v.Key, v.Value);
|
||||
|
||||
if (line == origLine)
|
||||
break;
|
||||
}
|
||||
|
@ -147,17 +147,15 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
/// </summary>
|
||||
public void PlaySamples() => Samples?.Play();
|
||||
|
||||
private double lastUpdateTime;
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (Result != null && lastUpdateTime > Time.Current)
|
||||
if (Result != null && Result.HasResult)
|
||||
{
|
||||
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;
|
||||
|
||||
if (Result.TimeOffset + endTime < Time.Current)
|
||||
if (Result.TimeOffset + endTime > Time.Current)
|
||||
{
|
||||
OnRevertResult?.Invoke(this, Result);
|
||||
|
||||
@ -165,8 +163,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
State.Value = ArmedState.Idle;
|
||||
}
|
||||
}
|
||||
|
||||
lastUpdateTime = Time.Current;
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
|
Loading…
Reference in New Issue
Block a user