Skip to content

Commit

Permalink
Merge pull request #635 from LumpBloom7/Remove-button-mode
Browse files Browse the repository at this point in the history
Remove button input mode
  • Loading branch information
LumpBloom7 authored Nov 15, 2024
2 parents c1f5fd6 + bb6491e commit 9d85d2d
Show file tree
Hide file tree
Showing 8 changed files with 4 additions and 59 deletions.
14 changes: 0 additions & 14 deletions osu.Game.Rulesets.Sentakki/Configuration/LaneInputMode.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ protected override void InitialiseDefaults()
SetDefault(SentakkiRulesetSettings.ShowNoteStartIndicators, false);
SetDefault(SentakkiRulesetSettings.RingColor, ColorOption.Default);
SetDefault(SentakkiRulesetSettings.RingOpacity, 1f, 0f, 1f, 0.01f);
SetDefault(SentakkiRulesetSettings.LaneInputMode, LaneInputMode.Button);
SetDefault(SentakkiRulesetSettings.SnakingSlideBody, true);
SetDefault(SentakkiRulesetSettings.DetailedJudgements, false);
}
Expand All @@ -46,7 +45,6 @@ public enum SentakkiRulesetSettings
ShowNoteStartIndicators,
RingColor,
TouchAnimationSpeed,
LaneInputMode,
SnakingSlideBody,
DetailedJudgements,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public SentakkiFramedReplayInputHandler(Replay replay)
}

protected override bool IsImportant(SentakkiReplayFrame frame) => true;
public bool UsingSensorMode => CurrentFrame?.UsingSensorMode ?? false;

protected Vector2 Position
{
Expand Down
7 changes: 1 addition & 6 deletions osu.Game.Rulesets.Sentakki/Replays/SentakkiReplayFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@ public class SentakkiReplayFrame : ReplayFrame, IConvertibleReplayFrame
{
public Vector2 Position;
public List<SentakkiAction> Actions = new List<SentakkiAction>();
public bool UsingSensorMode;

public SentakkiReplayFrame()
{
}

public SentakkiReplayFrame(double time, Vector2 position, bool usingSensorMode, IEnumerable<SentakkiAction> actions)
public SentakkiReplayFrame(double time, Vector2 position, IEnumerable<SentakkiAction> actions)
: base(time)
{
Position = position;
Actions.AddRange(actions);
UsingSensorMode = usingSensorMode;
}

public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayFrame? lastFrame = null)
Expand All @@ -32,8 +30,6 @@ public void FromLegacy(LegacyReplayFrame currentFrame, IBeatmap beatmap, ReplayF

if (currentFrame.MouseLeft) Actions.Add(SentakkiAction.Button1);
if (currentFrame.MouseRight) Actions.Add(SentakkiAction.Button2);

UsingSensorMode = currentFrame.ButtonState.HasFlag(ReplayButtonState.Smoke);
}

public LegacyReplayFrame ToLegacy(IBeatmap beatmap)
Expand All @@ -42,7 +38,6 @@ public LegacyReplayFrame ToLegacy(IBeatmap beatmap)

if (Actions.Contains(SentakkiAction.Button1)) state |= ReplayButtonState.Left1;
if (Actions.Contains(SentakkiAction.Button2)) state |= ReplayButtonState.Right1;
if (UsingSensorMode) state |= ReplayButtonState.Smoke;

return new LegacyReplayFrame(Time, Position.X, Position.Y, state);
}
Expand Down
7 changes: 0 additions & 7 deletions osu.Game.Rulesets.Sentakki/UI/DrawableSentakkiRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnl
[BackgroundDependencyLoader]
private void load()
{
Config.BindWith(SentakkiRulesetSettings.LaneInputMode, laneInputMode);

FrameStableComponents.Add(slideFanChevronsTextures);

Config.BindWith(SentakkiRulesetSettings.AnimationSpeed, configEntrySpeed);
Expand Down Expand Up @@ -140,13 +138,8 @@ public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e) { }

protected new SentakkiRulesetConfigManager Config => (SentakkiRulesetConfigManager)base.Config;

// Input specifics (sensor/button) for replay and gameplay
private readonly Bindable<LaneInputMode> laneInputMode = new Bindable<LaneInputMode>();

private SentakkiFramedReplayInputHandler? sentakkiFramedReplayInput => (SentakkiFramedReplayInputHandler?)((SentakkiInputManager)KeyBindingInputManager).ReplayInputHandler;

public bool UseSensorMode => sentakkiFramedReplayInput is not null ? sentakkiFramedReplayInput.UsingSensorMode : laneInputMode.Value == LaneInputMode.Sensor;

// Default stuff
protected override Playfield CreatePlayfield() => new SentakkiPlayfield();

Expand Down
25 changes: 2 additions & 23 deletions osu.Game.Rulesets.Sentakki/UI/Lane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

namespace osu.Game.Rulesets.Sentakki.UI
{
public partial class Lane : Playfield, IKeyBindingHandler<SentakkiAction>
public partial class Lane : Playfield
{
public int LaneNumber { get; set; }

Expand Down Expand Up @@ -91,8 +91,6 @@ public override bool ReceivePositionalInputAt(Vector2 screenSpacePos)

private readonly BindableInt currentKeys = new BindableInt();

private bool usingSensor => drawableSentakkiRuleset.UseSensorMode;

private readonly Dictionary<SentakkiAction, bool> buttonTriggerState = new Dictionary<SentakkiAction, bool>();

private void updateInputState()
Expand All @@ -114,7 +112,7 @@ private void updateInputState()
}

// We don't attempt to check mouse input if touch input is used
if (count == 0 && IsHovered && usingSensor)
if (count == 0 && IsHovered)
{
foreach (var a in SentakkiActionInputManager.PressedActions)
{
Expand All @@ -141,25 +139,6 @@ private void handleKeyPress(ValueChangedEvent<int> keys)
}
}

public bool OnPressed(KeyBindingPressEvent<SentakkiAction> e)
{
if (usingSensor) return false;

if (e.Action >= SentakkiAction.Key1 || !IsHovered) return false;

buttonTriggerState[e.Action] = true;
return false;
}

public void OnReleased(KeyBindingReleaseEvent<SentakkiAction> e)
{
if (usingSensor) return;

if (e.Action >= SentakkiAction.Key1) return;

buttonTriggerState[e.Action] = false;
}

#endregion
}
}
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Sentakki/UI/SentakkiReplayRecorder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public SentakkiReplayRecorder(Score score, DrawableSentakkiRuleset ruleset)
}

protected override ReplayFrame HandleFrame(Vector2 mousePosition, List<SentakkiAction> actions, ReplayFrame previousFrame)
=> new SentakkiReplayFrame(Time.Current, mousePosition, drawableRuleset.UseSensorMode, actions);
=> new SentakkiReplayFrame(Time.Current, mousePosition, actions);
}
}
5 changes: 0 additions & 5 deletions osu.Game.Rulesets.Sentakki/UI/SentakkiSettingsSubsection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,6 @@ private void load()
KeyboardStep = 0.01f,
DisplayAsPercentage = true
},
new SettingsEnumDropdown<LaneInputMode>
{
LabelText = SentakkiSettingsSubsectionStrings.LaneInputMode,
Current = config.GetBindable<LaneInputMode>(SentakkiRulesetSettings.LaneInputMode)
},
};
}

Expand Down

0 comments on commit 9d85d2d

Please sign in to comment.