mirror of
https://github.com/ppy/osu.git
synced 2024-11-15 05:17:25 +08:00
81 lines
2.7 KiB
C#
81 lines
2.7 KiB
C#
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|||
|
// See the LICENCE file in the repository root for full licence text.
|
|||
|
|
|||
|
using System.Collections.Generic;
|
|||
|
using osu.Framework.Graphics;
|
|||
|
using osu.Framework.Graphics.Containers;
|
|||
|
using osu.Framework.Graphics.Shapes;
|
|||
|
using osu.Framework.Graphics.Sprites;
|
|||
|
using osu.Framework.Input.Bindings;
|
|||
|
using osu.Game.Beatmaps;
|
|||
|
using osu.Game.Graphics;
|
|||
|
using osu.Game.Rulesets.Difficulty;
|
|||
|
using osu.Game.Rulesets.EmptyFreeform.Beatmaps;
|
|||
|
using osu.Game.Rulesets.EmptyFreeform.Mods;
|
|||
|
using osu.Game.Rulesets.EmptyFreeform.UI;
|
|||
|
using osu.Game.Rulesets.Mods;
|
|||
|
using osu.Game.Rulesets.UI;
|
|||
|
using osuTK;
|
|||
|
using osuTK.Graphics;
|
|||
|
|
|||
|
namespace osu.Game.Rulesets.EmptyFreeform
|
|||
|
{
|
|||
|
public class EmptyFreeformRuleset : Ruleset
|
|||
|
{
|
|||
|
public override string Description => "a very emptyfreeformruleset ruleset";
|
|||
|
|
|||
|
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) =>
|
|||
|
new DrawableEmptyFreeformRuleset(this, beatmap, mods);
|
|||
|
|
|||
|
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) =>
|
|||
|
new EmptyFreeformBeatmapConverter(beatmap, this);
|
|||
|
|
|||
|
public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) =>
|
|||
|
new EmptyFreeformDifficultyCalculator(this, beatmap);
|
|||
|
|
|||
|
public override IEnumerable<Mod> GetModsFor(ModType type)
|
|||
|
{
|
|||
|
switch (type)
|
|||
|
{
|
|||
|
case ModType.Automation:
|
|||
|
return new[] { new EmptyFreeformModAutoplay() };
|
|||
|
|
|||
|
default:
|
|||
|
return new Mod[] { null };
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public override string ShortName => "emptyfreeformruleset";
|
|||
|
|
|||
|
public override IEnumerable<KeyBinding> GetDefaultKeyBindings(int variant = 0) => new[]
|
|||
|
{
|
|||
|
new KeyBinding(InputKey.Z, EmptyFreeformAction.Button1),
|
|||
|
new KeyBinding(InputKey.X, EmptyFreeformAction.Button2),
|
|||
|
};
|
|||
|
|
|||
|
public override Drawable CreateIcon() => new Icon(ShortName[0]);
|
|||
|
|
|||
|
public class Icon : CompositeDrawable
|
|||
|
{
|
|||
|
public Icon(char c)
|
|||
|
{
|
|||
|
InternalChildren = new Drawable[]
|
|||
|
{
|
|||
|
new Circle
|
|||
|
{
|
|||
|
Size = new Vector2(20),
|
|||
|
Colour = Color4.White,
|
|||
|
},
|
|||
|
new SpriteText
|
|||
|
{
|
|||
|
Anchor = Anchor.Centre,
|
|||
|
Origin = Anchor.Centre,
|
|||
|
Text = c.ToString(),
|
|||
|
Font = OsuFont.Default.With(size: 18)
|
|||
|
}
|
|||
|
};
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|