1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 11:28:00 +08:00

implement co-op mod

This commit is contained in:
ANDY840119-PC\andy840119 2018-01-14 21:35:35 +09:00
parent cf0d9e4d9b
commit 999386497a
3 changed files with 38 additions and 4 deletions

View File

@ -25,9 +25,9 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
/// Creates a new <see cref="ManiaBeatmap"/>.
/// </summary>
/// <param name="initialStage">The initial stage.</param>
public ManiaBeatmap(StageDefinition initialStage)
public ManiaBeatmap(List<StageDefinition> stages)
{
Stages.Add(initialStage);
Stages = stages;
}
}
}

View File

@ -26,6 +26,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
protected override IEnumerable<Type> ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) };
public int TargetColumns;
public List<StageDefinition> StageDefinitions;
public readonly bool IsForCurrentRuleset;
private Pattern lastPattern = new Pattern();
@ -66,7 +67,16 @@ namespace osu.Game.Rulesets.Mania.Beatmaps
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)
{

View File

@ -1,16 +1,40 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// 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;
namespace osu.Game.Rulesets.Mania.Mods
{
public class ManiaModKeyCoop : Mod
public class ManiaModKeyCoop : Mod, IApplicableToBeatmapConverter<ManiaHitObject>
{
public override string Name => "KeyCoop";
public override string ShortenedName => "2P";
public override string Description => @"Double the key amount, double the fun!";
public override double ScoreMultiplier => 1;
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;
}
}
}