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

Rolled back the bad earlier implementation

This commit is contained in:
FreezyLemon 2017-12-07 21:18:51 +01:00
parent e3232dd754
commit 43c270ea49
4 changed files with 2 additions and 63 deletions

View File

@ -16,8 +16,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
/// </summary>
private const double second_hit_window = 30;
protected override bool PlaysSamples => true;
private double firstHitTime;
private bool firstKeyHeld;
private TaikoAction firstHitAction;
@ -55,15 +53,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
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)
{
if (AllJudged)

View File

@ -14,8 +14,6 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
public override Vector2 OriginPosition => new Vector2(DrawHeight / 2);
protected override bool PlaysSamples => false;
protected readonly Vector2 BaseSize;
protected readonly TaikoPiece MainPiece;

View File

@ -2,11 +2,8 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Graphics;
using osu.Framework.Input.Bindings;
using osu.Game.Beatmaps;
using osu.Game.Input;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types;
using osu.Game.Rulesets.Replays;
@ -18,45 +15,21 @@ using osu.Game.Rulesets.Taiko.Scoring;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.Taiko.Replays;
using OpenTK;
using OpenTK.Input;
using System.Linq;
using osu.Framework.Input;
using System.Collections.Generic;
namespace osu.Game.Rulesets.Taiko.UI
{
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)
: base(ruleset, beatmap, isForCurrentRuleset)
{
}
[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();
}
@ -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()
{
const float default_relative_height = TaikoPlayfield.DEFAULT_HEIGHT / 768;

View File

@ -59,8 +59,6 @@ namespace osu.Game.Rulesets.Objects.Drawables
private readonly List<Judgement> judgements = new List<Judgement>();
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>();
@ -95,7 +93,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
{
UpdateState(state);
if (State == ArmedState.Hit && PlaysSamples)
if (State == ArmedState.Hit)
PlaySamples();
};