Sha256: 496eb1340bf39ef18159e1f7fb4f98d534dbbeafef95641326aaa17379031179

Contents?: true

Size: 701 Bytes

Versions: 2

Compression:

Stored size: 701 Bytes

Contents

module ProconBypassMan::Procon::LayerChangeable
  def next_layer_key
    case
    when pressed_up?
      :up
    when pressed_right?
      :right
    when pressed_left?
      :left
    when pressed_down?
      :down
    else
      ProconBypassMan.logger.warn("next_layer_key is unknown")
      :up
    end
  end

  def change_layer?
    if ProconBypassMan::ButtonsSettingConfiguration.instance.prefix_keys.empty?
      raise "prefix_keysが未設定です"
    end
    ProconBypassMan::ButtonsSettingConfiguration.instance.prefix_keys.map { |b| pressed_button?(b) }.all?
  end

  def pressed_next_layer?
    change_layer? && (pressed_up? || pressed_right? || pressed_left? || pressed_down?)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
procon_bypass_man-0.1.11 lib/procon_bypass_man/procon/layer_changeable.rb
procon_bypass_man-0.1.10 lib/procon_bypass_man/procon/layer_changeable.rb