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