Skip to content

Commit

Permalink
update osu submodule and fix pippidon
Browse files Browse the repository at this point in the history
  • Loading branch information
jorolf committed Sep 23, 2018
1 parent 67f0753 commit 618b53c
Show file tree
Hide file tree
Showing 16 changed files with 100 additions and 224 deletions.
2 changes: 1 addition & 1 deletion osu
Submodule osu updated 1342 files
13 changes: 9 additions & 4 deletions osu.Game.Rulesets.Pippidon/Beatmaps/PippidonBeatmapConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ namespace osu.Game.Rulesets.Pippidon.Beatmaps
{
public class PippidonBeatmapConverter : BeatmapConverter<PippidonObject>
{
protected override IEnumerable<Type> ValidConversionTypes => new[] { typeof(IHasXPosition) , typeof(IHasYPosition) };
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) };

private readonly Dictionary<Beatmap, FloatRange> floatRanges = new Dictionary<Beatmap, FloatRange>();
private readonly Dictionary<IBeatmap, FloatRange> floatRanges = new Dictionary<IBeatmap, FloatRange>();

protected override IEnumerable<PippidonObject> ConvertHitObject(HitObject original, Beatmap beatmap)
protected override IEnumerable<PippidonObject> ConvertHitObject(HitObject original, IBeatmap beatmap)
{
float pos = (original as IHasYPosition)?.Y ?? ((IHasXPosition)original).X;

Expand All @@ -29,7 +29,7 @@ protected override IEnumerable<PippidonObject> ConvertHitObject(HitObject origin
};
}

private void calcRange(Beatmap beatmap)
private void calcRange(IBeatmap beatmap)
{
List<float> positions = beatmap.HitObjects.OfType<IHasYPosition>().Select(hitObject => hitObject.Y).ToList();
if(!positions.Any())
Expand All @@ -47,5 +47,10 @@ private class FloatRange
public float Max, Min;
public float Range => Max - Min;
}

public PippidonBeatmapConverter(IBeatmap beatmap)
: base(beatmap)
{
}
}
}
8 changes: 0 additions & 8 deletions osu.Game.Rulesets.Pippidon/Judgements/PippidonJudgement.cs

This file was deleted.

33 changes: 5 additions & 28 deletions osu.Game.Rulesets.Pippidon/Objects/Drawables/Coin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
using osu.Game.Rulesets.Objects.Drawables;
using OpenTK;
using System;
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Pippidon.Judgements;
using OpenTK.Graphics;
using osu.Game.Rulesets.Scoring;

Expand All @@ -17,16 +15,14 @@ public class Coin : DrawableHitObject<PippidonObject>

private readonly Func<int, bool> touchingPippi;

private Judgement judgement;

public Coin(PippidonObject hitObject, TextureStore textures, Func<int, bool> touchingPippi) : base(hitObject)
{
Size = new Vector2(40);
Y = hitObject.Lane * 79;

this.touchingPippi = touchingPippi;

Add(new Sprite
AddInternal(new Sprite
{
RelativeSizeAxes = Axes.Both,
Texture = textures.Get("coin"),
Expand All @@ -38,40 +34,21 @@ protected override void Update()
base.Update();

if (Time.Current - HitObject.StartTime < -hit_window)
UpdateJudgement(true);
UpdateResult(true);
}

protected override void CheckForJudgements(bool userTriggered, double timeOffset)
protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (Math.Abs(timeOffset) < hit_window)
{
if (touchingPippi(HitObject.Lane))
{
if (judgement == null)
{
judgement = new PippidonJudgement
{
Result = HitResult.Perfect,
TimeOffset = timeOffset,
};
}
else if (timeOffset <= 0)
{
judgement.TimeOffset = 0;
}
}

if (judgement != null && timeOffset >= 0)
{
AddJudgement(judgement);
ApplyResult(r => r.Type = HitResult.Perfect);
}
}
else if (timeOffset > hit_window)
{
AddJudgement(new PippidonJudgement
{
Result = HitResult.Miss,
});
ApplyResult(r => r.Type = HitResult.Miss);
}
}

Expand Down
27 changes: 15 additions & 12 deletions osu.Game.Rulesets.Pippidon/Objects/PippidonObject.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
using osu.Game.Rulesets.Objects;

namespace osu.Game.Rulesets.Pippidon.Objects
{
public class PippidonObject : HitObject
{
/// <summary>
/// Range = [-1,1]
/// </summary>
public int Lane;
}
}
using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Objects;

namespace osu.Game.Rulesets.Pippidon.Objects
{
public class PippidonObject : HitObject
{
/// <summary>
/// Range = [-1,1]
/// </summary>
public int Lane;

public override Judgement CreateJudgement() => new Judgement();
}
}
14 changes: 10 additions & 4 deletions osu.Game.Rulesets.Pippidon/PippidonDifficultyCalculator.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
using System.Collections.Generic;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Mods;

namespace osu.Game.Rulesets.Pippidon
{
public class PippidonDifficultyCalculator : DifficultyCalculator
{
public override double Calculate(Dictionary<string, double> categoryDifficulty = null)
public PippidonDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
return 0;
}

protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate)
{
return new DifficultyAttributes(mods, 0);
}
}
}
16 changes: 10 additions & 6 deletions osu.Game.Rulesets.Pippidon/PippidonRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Pippidon.Beatmaps;
using osu.Game.Rulesets.Pippidon.Mods;

namespace osu.Game.Rulesets.Pippidon
Expand All @@ -19,28 +21,30 @@ public class PippidonRuleset : Ruleset

public PippidonRuleset(RulesetInfo rulesetInfo) : base(rulesetInfo)
{
ResourceStore = new NamespacedResourceStore<byte[]>(new DllResourceStore("osu.Game.Rulesets.Pippidon.dll"), "Resources");
TextureStore = new TextureStore(new RawTextureLoaderStore(new NamespacedResourceStore<byte[]>(ResourceStore, @"Textures")));
ResourceStore = new NamespacedResourceStore<byte[]>(new DllResourceStore("osu.Game.Rulesets.Pippidon.dll"), @"Resources");
TextureStore = new TextureStore(new TextureLoaderStore(new NamespacedResourceStore<byte[]>(ResourceStore, @"Textures")));
}

public override string Description => "pippipidoooooon";

public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new PippidonRulesetContainer(this, beatmap, isForCurrentRuleset);
public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap) => new PippidonRulesetContainer(this, beatmap);

public override DifficultyCalculator CreateDifficultyCalculator(Beatmap beatmap, Mod[] mods = null) => new PippidonDifficultyCalculator();
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new PippidonBeatmapConverter(beatmap);

public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new PippidonDifficultyCalculator(this, beatmap);

public override IEnumerable<Mod> GetModsFor(ModType type)
{
switch (type)
{
case ModType.Special:
case ModType.Automation:
return new[] { new PippidonModAutoplay() };
default:
return new Mod[] { null };
}
}

public override string ShortName => "pipidon";
public override string ShortName => "pippidon";

public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new[]
{
Expand Down
35 changes: 0 additions & 35 deletions osu.Game.Rulesets.Pippidon/Properties/AssemblyInfo.cs

This file was deleted.

12 changes: 10 additions & 2 deletions osu.Game.Rulesets.Pippidon/Replays/PippidonAutoGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public PippidonAutoGenerator(Beatmap<PippidonObject> beatmap) : base(beatmap)
public override Replay Generate()
{
int lastLane = 0;
Frames.Add(new PippidonReplayFrame());

foreach(PippidonObject hitObject in Beatmap.HitObjects)
{
if (lastLane == hitObject.Lane)
Expand All @@ -47,8 +49,14 @@ public override Replay Generate()
throw new Exception("Unknown lane");
}

Frames.Add(new PippidonReplayFrame(button));
Frames.Add(new PippidonReplayFrame()); //Release the keys as well
Frames.Add(new PippidonReplayFrame(button)
{
Time = hitObject.StartTime - KEY_UP_DELAY
});
Frames.Add(new PippidonReplayFrame
{
Time = hitObject.StartTime
}); //Release the keys as well
lastLane = hitObject.Lane;
}

Expand Down
12 changes: 6 additions & 6 deletions osu.Game.Rulesets.Pippidon/Replays/PippidonReplayInputHandler.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using osu.Game.Rulesets.Replays;
using System.Collections.Generic;
using System.Collections.Generic;
using osu.Game.Rulesets.Replays;
using System.Linq;
using osu.Framework.Input;
using osu.Framework.Input.StateChanges;

namespace osu.Game.Rulesets.Pippidon.Replays
{
Expand All @@ -13,13 +13,13 @@ public PippidonReplayInputHandler(Replay replay) : base(replay)

protected override bool IsImportant(PippidonReplayFrame frame) => frame.Actions.Any();

public override List<InputState> GetPendingStates()
public override List<IInput> GetPendingInputs()
{
return new List<InputState>
return new List<IInput>
{
new ReplayState<PippidonAction>
{
PressedActions = CurrentFrame.Actions
PressedActions = CurrentFrame.Actions,
}
};
}
Expand Down
12 changes: 1 addition & 11 deletions osu.Game.Rulesets.Pippidon/Scoring/PippidonScoreProcessor.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Pippidon.Judgements;
using osu.Game.Rulesets.Pippidon.Objects;
using osu.Game.Rulesets.Pippidon.Objects;
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;

Expand All @@ -16,14 +14,6 @@ public PippidonScoreProcessor(RulesetContainer<PippidonObject> ruleset) : base(r
{
}

protected override void SimulateAutoplay(Beatmap<PippidonObject> beatmap)
{
foreach (var unused in beatmap.HitObjects)
{
AddJudgement(new PippidonJudgement { Result = HitResult.Perfect });
}
}

protected override void Reset(bool storeResults)
{
base.Reset(storeResults);
Expand Down
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Pippidon/UI/PippidonPlayfield.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ public class PippidonPlayfield : ScrollingPlayfield
public int PippidonLane => pippidon.LanePosition;

public PippidonPlayfield(PippidonRuleset ruleset)
: base(ScrollingDirection.Left)
{
VisibleTimeRange.Value = 6000;
Direction.Value = ScrollingDirection.Left;

ScaledContent.AddRange(new Drawable[]
base.Content.AddRange(new Drawable[]
{
content = new Container
{
Expand Down
8 changes: 4 additions & 4 deletions osu.Game.Rulesets.Pippidon/UI/PippidonRulesetContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.Pippidon.Scoring;
using osu.Game.Rulesets.Pippidon.Beatmaps;
using osu.Framework.Input;
using osu.Framework.Graphics;
using osu.Game.Input.Handlers;
Expand All @@ -12,22 +11,21 @@
using osu.Game.Rulesets.Replays;
using osu.Game.Rulesets.Pippidon.Replays;
using osu.Game.Rulesets.UI.Scrolling;
using OpenTK;

namespace osu.Game.Rulesets.Pippidon.UI
{
public class PippidonRulesetContainer : ScrollingRulesetContainer<PippidonPlayfield, PippidonObject>
{
private readonly PippidonRuleset pippidonRuleset;

public PippidonRulesetContainer(PippidonRuleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset) : base(ruleset, beatmap, isForCurrentRuleset)
public PippidonRulesetContainer(PippidonRuleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap)
{
pippidonRuleset = ruleset;
}

public override ScoreProcessor CreateScoreProcessor() => new PippidonScoreProcessor(this);

protected override BeatmapConverter<PippidonObject> CreateBeatmapConverter() => new PippidonBeatmapConverter();

protected override Playfield CreatePlayfield() => new PippidonPlayfield(pippidonRuleset);

protected override DrawableHitObject<PippidonObject> GetVisualRepresentation(PippidonObject h)
Expand All @@ -42,5 +40,7 @@ protected override DrawableHitObject<PippidonObject> GetVisualRepresentation(Pip
protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new PippidonReplayInputHandler(replay);

public override PassThroughInputManager CreateInputManager() => new PippidonInputManager(Ruleset?.RulesetInfo);

protected override Vector2 PlayfieldArea => new Vector2(1);
}
}
Loading

0 comments on commit 618b53c

Please sign in to comment.