Class: GamePlay::Shortcut

Inherits:
BaseCleanUpdate::FrameBalanced show all
Includes:
Util::Item
Defined in:
scripts/01450 Systems/00207 Shortcut/00003 GamePlay/01000 Shortcut.rb

Overview

Scene responsive of showing the shortcut menu

Constant Summary collapse

SHORTCUT_KEYS =

List of shortcut key by index

%i[UP LEFT DOWN RIGHT]
AIU_KEY2METHOD =

List of key => method used by automatic_input_update

{ B: :action_b, Y: :action_b }
ACTIONS =

Actions on mouse ctrl

%i[action_b action_b action_b action_b]

Constants inherited from Base

Base::DEFAULT_TRANSITION, Base::DEFAULT_TRANSITION_PARAMETER

Constants included from Input

Input::ALIAS_KEYS, Input::AXIS_MAPPING, Input::AXIS_SENSITIVITY, Input::DEAD_ZONE, Input::Keyboard, Input::Keys, Input::NON_TRIGGER_ZONE, Input::REPEAT_COOLDOWN, Input::REPEAT_SPACE

Constants included from DisplayMessage

DisplayMessage::MESSAGE_ERROR, DisplayMessage::MESSAGE_PROCESS_ERROR

Instance Attribute Summary

Attributes inherited from Base

#__last_scene, #__result_process, #running, #viewport

Attributes included from DisplayMessage

#message_window

Instance Method Summary collapse

Methods included from Util::Item

#util_item_on_use_sequence, #util_item_open_party_sequence, #util_item_useitem

Methods inherited from BaseCleanUpdate::FrameBalanced

#update

Methods included from Graphics::FPSBalancer::Marker

#frame_balanced?

Methods inherited from BaseCleanUpdate

#automatic_input_update, #update

Methods inherited from Base

#add_disposable, #call_scene, #dispose, #find_parent, #main, #return_to_scene, #snap_to_bitmap, #update, #visible, #visible=

Methods included from Input

dir4, dir8, get_text, joy_axis_position, press?, register_events, released?, repeat?, swap_states, trigger?

Methods included from DisplayMessage

#can_display_message_be_called?, #close_message_window, #display_message, #display_message_and_wait, #message_class, #message_processing?, #message_visible, #message_visible=

Constructor Details

#initializeShortcut

Create the shortcut scene



12
13
14
15
# File 'scripts/01450 Systems/00207 Shortcut/00003 GamePlay/01000 Shortcut.rb', line 12

def initialize
  super
  @items = $bag.shortcuts
end

Instance Method Details

#update_inputs

Update the inputs of the scene



18
19
20
21
22
23
24
25
26
# File 'scripts/01450 Systems/00207 Shortcut/00003 GamePlay/01000 Shortcut.rb', line 18

def update_inputs
  return false unless automatic_input_update(AIU_KEY2METHOD)

  SHORTCUT_KEYS.each_with_index do |key, index|
    next unless Input.trigger?(key)

    break use(index)
  end
end

#update_mouse(moved)

Update the mouse interaction



29
30
31
32
33
34
35
36
# File 'scripts/01450 Systems/00207 Shortcut/00003 GamePlay/01000 Shortcut.rb', line 29

def update_mouse(moved)
  update_mouse_ctrl_buttons(@base_ui.ctrl, ACTIONS, true)
  if Mouse.trigger?(:LEFT)
    @shortcuts.each_with_index do |stack, index|
      use(index) if stack.simple_mouse_in?
    end
  end
end