mirror of
https://github.com/ppy/osu.git
synced 2025-01-14 23:22:55 +08:00
Suggested changes
This commit is contained in:
parent
e1e4eb78e3
commit
d9c26f98c7
@ -20,24 +20,6 @@ namespace osu.Game.Rulesets.Catch
|
||||
{
|
||||
public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new CatchRulesetContainer(this, beatmap, isForCurrentRuleset);
|
||||
|
||||
public override IEnumerable<Mod> GetAllMods() => new Mod[]
|
||||
{
|
||||
new CatchModEasy(),
|
||||
new CatchModNoFail(),
|
||||
new CatchModHalfTime(),
|
||||
new CatchModDaycore(),
|
||||
new CatchModHardRock(),
|
||||
new CatchModSuddenDeath(),
|
||||
new CatchModPerfect(),
|
||||
new CatchModDoubleTime(),
|
||||
new CatchModNightcore(),
|
||||
new CatchModHidden(),
|
||||
new CatchModFlashlight(),
|
||||
new CatchModRelax(),
|
||||
new ModAutoplay(),
|
||||
new ModCinema()
|
||||
};
|
||||
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type)
|
||||
{
|
||||
switch (type)
|
||||
|
@ -19,36 +19,6 @@ namespace osu.Game.Rulesets.Mania
|
||||
{
|
||||
public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new ManiaRulesetContainer(this, beatmap, isForCurrentRuleset);
|
||||
|
||||
public override IEnumerable<Mod> GetAllMods() => new Mod[]
|
||||
{
|
||||
new ManiaModEasy(),
|
||||
new ManiaModNoFail(),
|
||||
new ManiaModHalfTime(),
|
||||
new ManiaModDaycore(),
|
||||
new ManiaModHardRock(),
|
||||
new ManiaModSuddenDeath(),
|
||||
new ManiaModPerfect(),
|
||||
new ManiaModDoubleTime(),
|
||||
new ManiaModNightcore(),
|
||||
new ManiaModFadeIn(),
|
||||
new ManiaModHidden(),
|
||||
new ManiaModFlashlight(),
|
||||
new ManiaModKey4(),
|
||||
new ManiaModKey5(),
|
||||
new ManiaModKey6(),
|
||||
new ManiaModKey7(),
|
||||
new ManiaModKey8(),
|
||||
new ManiaModKey9(),
|
||||
new ManiaModKey1(),
|
||||
new ManiaModKey2(),
|
||||
new ManiaModKey3(),
|
||||
new ManiaModRandom(),
|
||||
new ManiaModKeyCoop(),
|
||||
new ModAutoplay(),
|
||||
new ModCinema(),
|
||||
new ManiaModGravity()
|
||||
};
|
||||
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type)
|
||||
{
|
||||
switch (type)
|
||||
|
@ -24,27 +24,6 @@ namespace osu.Game.Rulesets.Osu
|
||||
{
|
||||
public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new OsuRulesetContainer(this, beatmap, isForCurrentRuleset);
|
||||
|
||||
public override IEnumerable<Mod> GetAllMods() => new Mod[]
|
||||
{
|
||||
new OsuModEasy(),
|
||||
new OsuModNoFail(),
|
||||
new OsuModHalfTime(),
|
||||
new OsuModDaycore(),
|
||||
new OsuModHardRock(),
|
||||
new OsuModSuddenDeath(),
|
||||
new OsuModPerfect(),
|
||||
new OsuModDoubleTime(),
|
||||
new OsuModNightcore(),
|
||||
new OsuModHidden(),
|
||||
new OsuModFlashlight(),
|
||||
new OsuModRelax(),
|
||||
new OsuModAutopilot(),
|
||||
new OsuModSpunOut(),
|
||||
new OsuModAutoplay(),
|
||||
new ModCinema(),
|
||||
new OsuModTarget(),
|
||||
};
|
||||
|
||||
public override IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new[]
|
||||
{
|
||||
new BeatmapStatistic
|
||||
|
@ -20,24 +20,6 @@ namespace osu.Game.Rulesets.Taiko
|
||||
{
|
||||
public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap, bool isForCurrentRuleset) => new TaikoRulesetContainer(this, beatmap, isForCurrentRuleset);
|
||||
|
||||
public override IEnumerable<Mod> GetAllMods() => new Mod[]
|
||||
{
|
||||
new TaikoModEasy(),
|
||||
new TaikoModNoFail(),
|
||||
new TaikoModHalfTime(),
|
||||
new TaikoModDaycore(),
|
||||
new TaikoModHardRock(),
|
||||
new TaikoModSuddenDeath(),
|
||||
new TaikoModPerfect(),
|
||||
new TaikoModDoubleTime(),
|
||||
new TaikoModNightcore(),
|
||||
new TaikoModHidden(),
|
||||
new TaikoModFlashlight(),
|
||||
new TaikoModRelax(),
|
||||
new TaikoModAutoplay(),
|
||||
new ModCinema()
|
||||
};
|
||||
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type)
|
||||
{
|
||||
switch (type)
|
||||
|
@ -58,8 +58,6 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
private class DummyRuleset : Ruleset
|
||||
{
|
||||
public override IEnumerable<Mod> GetAllMods() => new Mod[] { };
|
||||
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[] { };
|
||||
|
||||
public override Mod GetAutoplayMod() => new ModAutoplay();
|
||||
|
@ -1,6 +1,8 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
@ -19,19 +21,29 @@ namespace osu.Game.Rulesets
|
||||
|
||||
public virtual IEnumerable<BeatmapStatistic> GetBeatmapStatistics(WorkingBeatmap beatmap) => new BeatmapStatistic[] { };
|
||||
|
||||
public abstract IEnumerable<Mod> GetAllMods();
|
||||
public IEnumerable<Mod> GetAllMods()
|
||||
{
|
||||
List<Mod> modList = new List<Mod>();
|
||||
|
||||
foreach (ModType type in Enum.GetValues(typeof(ModType)))
|
||||
modList.AddRange(GetModsFor(type).SelectMany(mod =>
|
||||
{
|
||||
var multiMod = mod as MultiMod;
|
||||
|
||||
if (multiMod != null)
|
||||
return multiMod.Mods;
|
||||
|
||||
return new Mod[] { mod };
|
||||
}));
|
||||
|
||||
return modList.ToArray();
|
||||
}
|
||||
|
||||
public abstract IEnumerable<Mod> GetModsFor(ModType type);
|
||||
|
||||
public Mod GetModByShortenedName(string shortenedName)
|
||||
{
|
||||
foreach(Mod mod in GetAllMods())
|
||||
{
|
||||
if (string.Equals(mod.ShortenedName, shortenedName))
|
||||
return mod;
|
||||
}
|
||||
|
||||
return null;
|
||||
return GetAllMods().First(mod => mod.ShortenedName == shortenedName);
|
||||
}
|
||||
|
||||
public abstract Mod GetAutoplayMod();
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -104,14 +105,7 @@ namespace osu.Game.Rulesets.Scoring
|
||||
|
||||
private void handleModString()
|
||||
{
|
||||
List<Mod> modList = new List<Mod>();
|
||||
|
||||
Ruleset rulesetInstance = Ruleset.CreateInstance();
|
||||
|
||||
foreach (string modShortenedName in modStrings)
|
||||
modList.Add(rulesetInstance.GetModByShortenedName(modShortenedName));
|
||||
|
||||
Mods = modList.ToArray();
|
||||
Mods = Ruleset.CreateInstance().GetAllMods().Where(mod => modStrings.Contains(mod.ShortenedName)).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.UI
|
||||
private readonly SpriteIcon modIcon;
|
||||
private readonly SpriteIcon background;
|
||||
|
||||
private const float icon_size = 80;
|
||||
private const float background_size = 80;
|
||||
|
||||
public FontAwesome Icon
|
||||
{
|
||||
@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Size = new Vector2(icon_size),
|
||||
Size = new Vector2(background_size),
|
||||
Icon = FontAwesome.fa_osu_mod_bg,
|
||||
Shadow = true,
|
||||
},
|
||||
@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.UI
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Colour = OsuColour.Gray(84),
|
||||
Size = new Vector2(icon_size - 35),
|
||||
Size = new Vector2(background_size - 35),
|
||||
Y = 25,
|
||||
Icon = mod.Icon
|
||||
},
|
||||
|
@ -3,17 +3,18 @@
|
||||
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
@ -38,7 +39,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
private readonly ScoreComponentLabel maxCombo;
|
||||
private readonly ScoreComponentLabel accuracy;
|
||||
private readonly Container flagBadgeContainer;
|
||||
private readonly FillFlowContainer<ScoreModIcon> modsContainer;
|
||||
private readonly FillFlowContainer<ModIcon> modsContainer;
|
||||
|
||||
private Visibility state;
|
||||
public Visibility State
|
||||
@ -239,7 +240,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
},
|
||||
},
|
||||
},
|
||||
modsContainer = new FillFlowContainer<ScoreModIcon>
|
||||
modsContainer = new FillFlowContainer<ModIcon>
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight,
|
||||
@ -256,23 +257,11 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
foreach (Mod mod in Score.Mods)
|
||||
{
|
||||
Color4 modColor;
|
||||
|
||||
switch (mod.Type)
|
||||
modsContainer.Add(new ModIcon(mod)
|
||||
{
|
||||
default:
|
||||
case ModType.DifficultyIncrease:
|
||||
modColor = OsuColour.FromHex(@"ffcc22");
|
||||
break;
|
||||
case ModType.DifficultyReduction:
|
||||
modColor = OsuColour.FromHex(@"88b300");
|
||||
break;
|
||||
case ModType.Special:
|
||||
modColor = OsuColour.FromHex(@"66ccff");
|
||||
break;
|
||||
}
|
||||
|
||||
modsContainer.Add(new ScoreModIcon(mod.Icon, modColor));
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Scale = new Vector2(0.375f)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -341,36 +330,6 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
}
|
||||
}
|
||||
|
||||
private class ScoreModIcon : Container
|
||||
{
|
||||
public ScoreModIcon(FontAwesome icon, Color4 colour)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Children = new[]
|
||||
{
|
||||
new SpriteIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Icon = FontAwesome.fa_osu_mod_bg,
|
||||
Colour = colour,
|
||||
Shadow = true,
|
||||
Size = new Vector2(30),
|
||||
},
|
||||
new SpriteIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
Icon = icon,
|
||||
Colour = OsuColour.Gray(84),
|
||||
Size = new Vector2(18),
|
||||
Position = new Vector2(0f, 2f),
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private class ScoreComponentLabel : Container
|
||||
{
|
||||
public ScoreComponentLabel(FontAwesome icon, string value)
|
||||
|
Loading…
Reference in New Issue
Block a user