Class: GamePlay::Options

Inherits:
BaseCleanUpdate::FrameBalanced show all
Includes:
OptionsMixin
Defined in:
scripts/01450 Systems/00105 Options/00003 GamePlay/00012 Options Scene.rb,
scripts/01450 Systems/00105 Options/00003 GamePlay/00011 Options_Helper.rb

Defined Under Namespace

Classes: Helper

Constant Summary collapse

ACTIONS =

List of action the mouse can perform with ctrl button

%i[save_options save_options save_options save_options]
MAX_BUTTON_SHOWN =

Maximum number of button shown in the UI for options (used to calculate arrow position)

4
VALID_OPTION_TYPE =

List of valid option type

%i[choice slider]
MESSAGE_FRAME =
'GameData::Windows::MESSAGE_FRAME'
MESSAGE_FRAME_NAMES =
'GameData::Windows::MESSAGE_FRAME_NAMES'
PREDEFINED_OPTIONS =
{
  message_speed: [:message_speed, :choice, [1, 2, 3], [[:text_get, 42, 4], [:text_get, 42, 5], [:text_get, 42, 6]], [:text_get, 42, 3], [:text_get, 42, 7], :message_speed],
  message_frame: [:message_frame, :choice, MESSAGE_FRAME, MESSAGE_FRAME_NAMES, [:ext_text, 9000, 165], [:ext_text, 9000, 166], :message_frame],
  volume: [:volume, :slider, { min: 0, max: 100, increment: 1 }, "%d%%", [:ext_text, 9000, 29], [:ext_text, 9000, 30], :master_volume],
  battle_animation: [:battle_animation, :choice, [true, false], [[:text_get, 42, 9], [:text_get, 42, 10]], [:text_get, 42, 8],[:text_get, 42, 11], :show_animation],
  battle_style: [:battle_style, :choice, [true, false], [[:text_get, 42, 13], [:text_get, 42, 14]], [:text_get, 42, 12], [:text_get, 42, 15], :battle_mode],
  screen_scale: [:screen_scale, :choice, [1, 2, 3, 4], [[:ext_text, 9008, 2], [:ext_text, 9008, 3], [:ext_text, 9008, 4], [:ext_text, 9008, 5]], [:ext_text, 9008, 1], [:ext_text, 9008, 0], :screen_scale],
  language: [:language, :choice, 'Configs#language#choosable_language_code', 'Configs#language#choosable_language_texts', [:ext_text, 9000, 167], [:ext_text, 9000, 168], :language]
}

Constants inherited from BaseCleanUpdate

BaseCleanUpdate::AIU_KEY2METHOD

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 included from OptionsMixin

#modified_options

Attributes inherited from Base

#__last_scene, #__result_process, #running, #viewport

Attributes included from DisplayMessage

#message_window

Instance Method Summary collapse

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

#initializeOptions

Create a new Options scene



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'scripts/01450 Systems/00105 Options/00003 GamePlay/00012 Options Scene.rb', line 10

def initialize
  super
  # @type [Hash{Symbol => Helper}]
  @options = {}
  @order = Configs.game_options.order
  @order.delete(:language) if Configs.language.choosable_language_code.none?
  @order.delete_if { |sym| !PREDEFINED_OPTIONS[sym] }
  load_options
  @modified_options = []
  @index = 0
  @max_index = 0
  @options_copy = $options.clone
end

Instance Method Details

#update_graphics



47
48
49
50
# File 'scripts/01450 Systems/00105 Options/00003 GamePlay/00012 Options Scene.rb', line 47

def update_graphics
  @base_ui&.update_background_animation
  @arrow&.update
end

#update_inputs



24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'scripts/01450 Systems/00105 Options/00003 GamePlay/00012 Options Scene.rb', line 24

def update_inputs
  if index_changed!(:@index, :UP, :DOWN, @max_index)
    play_cursor_se
    update_list
    @description.data = current_option
    return false
  end
  if Input.trigger?(:A) && @order[@index] == :message_frame
    display_message(@buttons[@index].value_text)
    return false
  end
  return save_options if Input.trigger?(:B)
  return update_input_option_value
end

#update_mouse(moved) ⇒ Boolean

Update the mouse interactions

Parameters:

  • moved (Boolean)

    if the mouse moved durring the frame

Returns:

  • (Boolean)

    if the thing after can update



42
43
44
45
# File 'scripts/01450 Systems/00105 Options/00003 GamePlay/00012 Options Scene.rb', line 42

def update_mouse(moved)
  update_mouse_ctrl_buttons(@base_ui.ctrl, ACTIONS, true)
  return false
end