mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
implement co-op mod
This commit is contained in:
@ -25,9 +25,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
/// Creates a new <see cref="ManiaBeatmap"/>.
|
/// Creates a new <see cref="ManiaBeatmap"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="initialStage">The initial stage.</param>
|
/// <param name="initialStage">The initial stage.</param>
|
||||||
public ManiaBeatmap(StageDefinition initialStage)
|
public ManiaBeatmap(List<StageDefinition> stages)
|
||||||
{
|
{
|
||||||
Stages.Add(initialStage);
|
Stages = stages;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) };
|
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) };
|
||||||
|
|
||||||
public int TargetColumns;
|
public int TargetColumns;
|
||||||
|
public List<StageDefinition> StageDefinitions;
|
||||||
public readonly bool IsForCurrentRuleset;
|
public readonly bool IsForCurrentRuleset;
|
||||||
|
|
||||||
private Pattern lastPattern = new Pattern();
|
private Pattern lastPattern = new Pattern();
|
||||||
@ -66,7 +67,16 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
|
|||||||
return base.ConvertBeatmap(original);
|
return base.ConvertBeatmap(original);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Beatmap<ManiaHitObject> CreateBeatmap() => beatmap = new ManiaBeatmap(new StageDefinition { Columns = TargetColumns });
|
protected override Beatmap<ManiaHitObject> CreateBeatmap()
|
||||||
|
{
|
||||||
|
if(StageDefinitions==null)
|
||||||
|
StageDefinitions=new List<StageDefinition>()
|
||||||
|
{
|
||||||
|
new StageDefinition { Columns = TargetColumns }
|
||||||
|
};
|
||||||
|
|
||||||
|
return beatmap = new ManiaBeatmap(StageDefinitions);
|
||||||
|
}
|
||||||
|
|
||||||
protected override IEnumerable<ManiaHitObject> ConvertHitObject(HitObject original, Beatmap beatmap)
|
protected override IEnumerable<ManiaHitObject> ConvertHitObject(HitObject original, Beatmap beatmap)
|
||||||
{
|
{
|
||||||
|
@ -1,16 +1,40 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mania.Beatmaps;
|
||||||
|
using osu.Game.Rulesets.Mania.Objects;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Mania.Mods
|
namespace osu.Game.Rulesets.Mania.Mods
|
||||||
{
|
{
|
||||||
public class ManiaModKeyCoop : Mod
|
public class ManiaModKeyCoop : Mod, IApplicableToBeatmapConverter<ManiaHitObject>
|
||||||
{
|
{
|
||||||
public override string Name => "KeyCoop";
|
public override string Name => "KeyCoop";
|
||||||
public override string ShortenedName => "2P";
|
public override string ShortenedName => "2P";
|
||||||
public override string Description => @"Double the key amount, double the fun!";
|
public override string Description => @"Double the key amount, double the fun!";
|
||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
|
|
||||||
|
public void ApplyToBeatmapConverter(BeatmapConverter<ManiaHitObject> beatmapConverter)
|
||||||
|
{
|
||||||
|
var mbc = (ManiaBeatmapConverter)beatmapConverter;
|
||||||
|
|
||||||
|
// Although this can work, for now let's not allow keymods for mania-specific beatmaps
|
||||||
|
if (mbc.IsForCurrentRuleset)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int originTargetColumns = mbc.TargetColumns;
|
||||||
|
|
||||||
|
var newStages = new List<StageDefinition>()
|
||||||
|
{
|
||||||
|
new StageDefinition() { Columns = originTargetColumns },
|
||||||
|
new StageDefinition() { Columns = originTargetColumns },
|
||||||
|
};
|
||||||
|
|
||||||
|
mbc.StageDefinitions = newStages;
|
||||||
|
mbc.TargetColumns = originTargetColumns * 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user