1
0
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:
Dean Herbert 2018-08-15 09:23:44 +09:00 committed by GitHub
commit 9cdaefb64b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 14 deletions

View File

@ -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);
}
}
}
}

View File

@ -0,0 +1,5 @@
[Variables]
$var=1234
[Events]
Sprite,Background,TopCentre,"img.jpg",$var56,240

View File

@ -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;
}

View File

@ -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()