mirror of
https://github.com/ppy/osu.git
synced 2025-02-22 05:13:21 +08:00
Rolled back the bad earlier implementation
This commit is contained in:
parent
e3232dd754
commit
43c270ea49
@ -16,8 +16,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private const double second_hit_window = 30;
|
private const double second_hit_window = 30;
|
||||||
|
|
||||||
protected override bool PlaysSamples => true;
|
|
||||||
|
|
||||||
private double firstHitTime;
|
private double firstHitTime;
|
||||||
private bool firstKeyHeld;
|
private bool firstKeyHeld;
|
||||||
private TaikoAction firstHitAction;
|
private TaikoAction firstHitAction;
|
||||||
@ -55,15 +53,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
return base.OnReleased(action);
|
return base.OnReleased(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
if (Samples.Count > 1)
|
|
||||||
// Removes the "normal" hitsound, leaving only the hitfinish one
|
|
||||||
Samples.RemoveAt(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool OnPressed(TaikoAction action)
|
public override bool OnPressed(TaikoAction action)
|
||||||
{
|
{
|
||||||
if (AllJudged)
|
if (AllJudged)
|
||||||
|
@ -14,8 +14,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
|
|||||||
{
|
{
|
||||||
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2);
|
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2);
|
||||||
|
|
||||||
protected override bool PlaysSamples => false;
|
|
||||||
|
|
||||||
protected readonly Vector2 BaseSize;
|
protected readonly Vector2 BaseSize;
|
||||||
|
|
||||||
protected readonly TaikoPiece MainPiece;
|
protected readonly TaikoPiece MainPiece;
|
||||||
|
@ -2,11 +2,8 @@
|
|||||||
// 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 osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Input.Bindings;
|
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Input;
|
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using osu.Game.Rulesets.Objects.Types;
|
using osu.Game.Rulesets.Objects.Types;
|
||||||
using osu.Game.Rulesets.Replays;
|
using osu.Game.Rulesets.Replays;
|
||||||
@ -18,45 +15,21 @@ using osu.Game.Rulesets.Taiko.Scoring;
|
|||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Rulesets.Taiko.Replays;
|
using osu.Game.Rulesets.Taiko.Replays;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Input;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.Taiko.UI
|
namespace osu.Game.Rulesets.Taiko.UI
|
||||||
{
|
{
|
||||||
public class TaikoRulesetContainer : ScrollingRulesetContainer<TaikoPlayfield, TaikoHitObject>
|
public class TaikoRulesetContainer : ScrollingRulesetContainer<TaikoPlayfield, TaikoHitObject>
|
||||||
{
|
{
|
||||||
private readonly HashSet<Key> centreKeys = new HashSet<Key>();
|
|
||||||
private readonly HashSet<Key> rimKeys = new HashSet<Key>();
|
|
||||||
private AudioManager audio;
|
|
||||||
private IEnumerable<KeyBinding> keyBindings;
|
|
||||||
|
|
||||||
public TaikoRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
public TaikoRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||||
: base(ruleset, beatmap, isForCurrentRuleset)
|
: base(ruleset, beatmap, isForCurrentRuleset)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, KeyBindingStore store)
|
private void load()
|
||||||
{
|
{
|
||||||
keyBindings = store.Query(Ruleset.RulesetInfo.ID, Ruleset.AvailableVariants?.First() ?? 0).Cast<KeyBinding>();
|
|
||||||
if (keyBindings.Count() == 0)
|
|
||||||
keyBindings = Ruleset.GetDefaultKeyBindings();
|
|
||||||
|
|
||||||
foreach (var kb in keyBindings)
|
|
||||||
{
|
|
||||||
var key = (Key)(kb.KeyCombination.Keys as InputKey[]).First();
|
|
||||||
var action = kb.GetAction<TaikoAction>();
|
|
||||||
|
|
||||||
if (action == TaikoAction.LeftCentre || action == TaikoAction.RightCentre)
|
|
||||||
centreKeys.Add(key);
|
|
||||||
|
|
||||||
if (action == TaikoAction.LeftRim || action == TaikoAction.RightRim)
|
|
||||||
rimKeys.Add(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.audio = audio;
|
|
||||||
loadBarLines();
|
loadBarLines();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,25 +77,6 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
|
||||||
{
|
|
||||||
if (!args.Repeat)
|
|
||||||
{
|
|
||||||
var sampleBank = Beatmap.ControlPointInfo.SoundPointAt(WorkingBeatmap.Track.CurrentTime).SampleBank ?? "normal";
|
|
||||||
string sampleName = "";
|
|
||||||
|
|
||||||
if (centreKeys.Contains(args.Key))
|
|
||||||
sampleName = "hitnormal";
|
|
||||||
|
|
||||||
else if (rimKeys.Contains(args.Key))
|
|
||||||
sampleName = "hitclap";
|
|
||||||
|
|
||||||
audio.Sample.Get($"Gameplay/{sampleBank}-{sampleName}")?.Play();
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnKeyDown(state, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Vector2 GetPlayfieldAspectAdjust()
|
protected override Vector2 GetPlayfieldAspectAdjust()
|
||||||
{
|
{
|
||||||
const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;
|
const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;
|
||||||
|
@ -59,8 +59,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
private readonly List<Judgement> judgements = new List<Judgement>();
|
private readonly List<Judgement> judgements = new List<Judgement>();
|
||||||
public IReadOnlyList<Judgement> Judgements => judgements;
|
public IReadOnlyList<Judgement> Judgements => judgements;
|
||||||
|
|
||||||
// Override in inheriting classes to prevent from playing samples on hit
|
|
||||||
protected virtual bool PlaysSamples => true;
|
|
||||||
|
|
||||||
protected List<SampleChannel> Samples = new List<SampleChannel>();
|
protected List<SampleChannel> Samples = new List<SampleChannel>();
|
||||||
|
|
||||||
@ -95,7 +93,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
|||||||
{
|
{
|
||||||
UpdateState(state);
|
UpdateState(state);
|
||||||
|
|
||||||
if (State == ArmedState.Hit && PlaysSamples)
|
if (State == ArmedState.Hit)
|
||||||
PlaySamples();
|
PlaySamples();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user