mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 15:12:57 +08:00
Fix TestSceneReplayRecorder
not using score provided by gameplay state
This commit is contained in:
parent
e0266b0d81
commit
fa9daa6899
@ -3,10 +3,10 @@
|
|||||||
|
|
||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -40,8 +40,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private TestReplayRecorder recorder;
|
private TestReplayRecorder recorder;
|
||||||
|
|
||||||
[Cached]
|
private GameplayState gameplayState;
|
||||||
private GameplayState gameplayState = TestGameplayState.Create(new OsuRuleset());
|
|
||||||
|
|
||||||
[SetUpSteps]
|
[SetUpSteps]
|
||||||
public void SetUpSteps()
|
public void SetUpSteps()
|
||||||
@ -52,81 +51,15 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
{
|
{
|
||||||
replay = new Replay();
|
replay = new Replay();
|
||||||
|
|
||||||
Add(new GridContainer
|
gameplayState = TestGameplayState.Create(new OsuRuleset());
|
||||||
|
gameplayState.Score.Replay = replay;
|
||||||
|
|
||||||
|
Child = new DependencyProvidingContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Content = new[]
|
CachedDependencies = new (Type, object)[] { (typeof(GameplayState), gameplayState) },
|
||||||
{
|
Child = createContent(),
|
||||||
new Drawable[]
|
};
|
||||||
{
|
|
||||||
recordingManager = new TestRulesetInputManager(TestCustomisableModRuleset.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
|
|
||||||
{
|
|
||||||
Recorder = recorder = new TestReplayRecorder(new Score
|
|
||||||
{
|
|
||||||
Replay = replay,
|
|
||||||
ScoreInfo =
|
|
||||||
{
|
|
||||||
BeatmapInfo = gameplayState.Beatmap.BeatmapInfo,
|
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
|
||||||
}
|
|
||||||
})
|
|
||||||
{
|
|
||||||
ScreenSpaceToGamefield = pos => recordingManager.ToLocalSpace(pos),
|
|
||||||
},
|
|
||||||
Child = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Colour = Color4.Brown,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Text = "Recording",
|
|
||||||
Scale = new Vector2(3),
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
},
|
|
||||||
new TestInputConsumer()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
new Drawable[]
|
|
||||||
{
|
|
||||||
playbackManager = new TestRulesetInputManager(TestCustomisableModRuleset.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
|
|
||||||
{
|
|
||||||
ReplayInputHandler = new TestFramedReplayInputHandler(replay)
|
|
||||||
{
|
|
||||||
GamefieldToScreenSpace = pos => playbackManager.ToScreenSpace(pos),
|
|
||||||
},
|
|
||||||
Child = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
Colour = Color4.DarkBlue,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Text = "Playback",
|
|
||||||
Scale = new Vector2(3),
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
},
|
|
||||||
new TestInputConsumer()
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,6 +136,74 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
recorder = null;
|
recorder = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Drawable createContent() => new GridContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Content = new[]
|
||||||
|
{
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
recordingManager = new TestRulesetInputManager(TestCustomisableModRuleset.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
|
||||||
|
{
|
||||||
|
Recorder = recorder = new TestReplayRecorder(gameplayState.Score)
|
||||||
|
{
|
||||||
|
ScreenSpaceToGamefield = pos => recordingManager.ToLocalSpace(pos),
|
||||||
|
},
|
||||||
|
Child = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.Brown,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = "Recording",
|
||||||
|
Scale = new Vector2(3),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
new TestInputConsumer()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
playbackManager = new TestRulesetInputManager(TestCustomisableModRuleset.CreateTestRulesetInfo(), 0, SimultaneousBindingMode.Unique)
|
||||||
|
{
|
||||||
|
ReplayInputHandler = new TestFramedReplayInputHandler(replay)
|
||||||
|
{
|
||||||
|
GamefieldToScreenSpace = pos => playbackManager.ToScreenSpace(pos),
|
||||||
|
},
|
||||||
|
Child = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
Colour = Color4.DarkBlue,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = "Playback",
|
||||||
|
Scale = new Vector2(3),
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
},
|
||||||
|
new TestInputConsumer()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
public class TestFramedReplayInputHandler : FramedReplayInputHandler<TestReplayFrame>
|
public class TestFramedReplayInputHandler : FramedReplayInputHandler<TestReplayFrame>
|
||||||
{
|
{
|
||||||
public TestFramedReplayInputHandler(Replay replay)
|
public TestFramedReplayInputHandler(Replay replay)
|
||||||
|
@ -70,6 +70,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
ScoreInfo =
|
ScoreInfo =
|
||||||
{
|
{
|
||||||
|
BeatmapInfo = beatmap.BeatmapInfo,
|
||||||
Ruleset = ruleset.RulesetInfo
|
Ruleset = ruleset.RulesetInfo
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user