1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-16 01:03:21 +08:00

Merge pull request #1177 from smoogipooo/hardrock-flipping

Hardrock flipping
This commit is contained in:
Dean Herbert 2017-08-23 17:09:15 +09:00 committed by GitHub
commit 6b6306218e
3 changed files with 26 additions and 3 deletions

View File

@ -7,8 +7,13 @@ using osu.Game.Rulesets.Osu.Replays;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Objects;
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using OpenTK;
namespace osu.Game.Rulesets.Osu.Mods
{
@ -28,10 +33,23 @@ namespace osu.Game.Rulesets.Osu.Mods
public override double ScoreMultiplier => 1.06;
}
public class OsuModHardRock : ModHardRock
public class OsuModHardRock : ModHardRock, IApplicableMod<OsuHitObject>
{
public override double ScoreMultiplier => 1.06;
public override bool Ranked => true;
public void ApplyToRulesetContainer(RulesetContainer<OsuHitObject> rulesetContainer)
{
rulesetContainer.Objects.OfType<OsuHitObject>().ForEach(h => h.Position = new Vector2(h.Position.X, OsuPlayfield.BASE_SIZE.Y - h.Y));
rulesetContainer.Objects.OfType<Slider>().ForEach(s =>
{
var newControlPoints = new List<Vector2>();
s.ControlPoints.ForEach(c => newControlPoints.Add(new Vector2(c.X, OsuPlayfield.BASE_SIZE.Y - c.Y)));
s.ControlPoints = newControlPoints;
s.Curve?.Calculate(); // Recalculate the slider curve
});
}
}
public class OsuModSuddenDeath : ModSuddenDeath

View File

@ -137,7 +137,7 @@ namespace osu.Game.Rulesets.Scoring
frames.Add(new ReplayFrame(
lastTime,
float.Parse(split[1]),
384 - float.Parse(split[2]),
float.Parse(split[2]),
(ReplayButtonState)int.Parse(split[3])
));
}

View File

@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.UI
/// Sets a replay to be used, overriding local input.
/// </summary>
/// <param name="replay">The replay, null for local input.</param>
public void SetReplay(Replay replay)
public virtual void SetReplay(Replay replay)
{
Replay = replay;
InputManager.ReplayInputHandler = replay != null ? CreateReplayInputHandler(replay) : null;
@ -277,6 +277,11 @@ namespace osu.Game.Rulesets.UI
KeyBindingInputManager.Add(Playfield = CreatePlayfield());
loadObjects();
}
public override void SetReplay(Replay replay)
{
base.SetReplay(replay);
if (InputManager?.ReplayInputHandler != null)
InputManager.ReplayInputHandler.ToScreenSpace = Playfield.ScaledContent.ToScreenSpace;