Sha256: 0bfcbb3b573abb659e155cb8498c58ea361d7328ea2df9a13051fe9a7a0820f4

Contents?: true

Size: 673 Bytes

Versions: 8

Compression:

Stored size: 673 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::Configuration.instance.prefix_keys.empty?
      raise "prefix_keysが未設定です"
    end
    ProconBypassMan::Configuration.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

8 entries across 8 versions & 1 rubygems

Version Path
procon_bypass_man-0.1.9 lib/procon_bypass_man/procon/layer_changeable.rb
procon_bypass_man-0.1.8 lib/procon_bypass_man/procon/layer_changeable.rb
procon_bypass_man-0.1.7 lib/procon_bypass_man/procon/layer_changeable.rb
procon_bypass_man-0.1.6 lib/procon_bypass_man/procon/layer_changeable.rb
procon_bypass_man-0.1.5 lib/procon_bypass_man/procon/layer_changeable.rb
procon_bypass_man-0.1.4 lib/procon_bypass_man/procon/layer_changeable.rb
procon_bypass_man-0.1.3 lib/procon_bypass_man/procon/layer_changeable.rb
procon_bypass_man-0.1.2 lib/procon_bypass_man/procon/layer_changeable.rb