Class: Battle::Scene::Message

Inherits:
UI::Message::Window show all
Defined in:
scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb

Overview

Message Window of the Battle

Constant Summary collapse

MAX_WAIT =

Number of 60th of second to wait while message does not wait for user input

120
WINDOW_SKIN =

Default windowskin of the message

'message_box'

Constants included from UI::Message::Layout

UI::Message::Layout::NAME_SKIN, UI::Message::Layout::PAUSE_SKIN

Instance Attribute Summary collapse

Attributes included from PFM::Message::State

#auto_skip, #current_instruction, #instructions, #last_text, #properties, #stay_visible

Attributes included from UI::Message::Layout

#input_number_window, #sub_stack, #text_stack

Attributes included from UI::Message::TemporaryOverwrites

#line_number_overwrite, #nameskin_overwrite, #position_overwrite, #width_overwrite, #windowskin_overwrite

Attributes inherited from LiteRGSS::Window

#__index__, #active, #back_opacity, #contents_opacity, #cursor_rect, #cursorskin, #height, #opacity, #ox, #oy, #pause, #pause_x, #pause_y, #pauseskin, #stretch, #viewport, #visible, #width, #window_builder, #windowskin, #x, #y, #z

Instance Method Summary collapse

Methods inherited from UI::Message::Window

#update

Methods included from PFM::Message::State

#at_end_of_line?, #done_drawing_message?, #load_next_instruction, #need_to_show_choice?, #need_to_show_message?, #need_to_show_number_input?, #need_to_wait_user_input?, #parse_and_show_new_message, #showing_message?

Methods included from PFM::Message::Parser

#convert_text_to_properties, #make_instructions, register_marker

Methods included from UI::Message::Draw

#process_big_text_marker, #process_color_marker, #process_marker, #process_picture_marker, #process_speed_marker, #process_style_marker, #process_wait_marker

Methods included from UI::Message::Layout

#can_sub_window_be_updated?, #current_layout, #dispose, #face_speaker_y, #generate_choice_window, #generate_input_number_window, #load_sub_layout, #parse_speaker_position, #show_city_image, #show_face, #show_gold_window, #show_name_window

Methods included from UI::Message::TemporaryOverwrites

#reset_overwrites

Methods inherited from Window

#simple_mouse_in?, #translate_mouse_coords

Methods inherited from LiteRGSS::Window

#lock, #locked?, new, #set_origin, #set_position, #set_size, #unlock, #update

Methods inherited from LiteRGSS::Disposable

#dispose, #disposed?

Constructor Details

#initializeMessage

Create a new window



17
18
19
20
21
22
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 17

def initialize(...)
  super(...)
  @wait_input = false
  @blocking = false
  @skipper_wait_animation = nil
end

Instance Attribute Details

#blockingBoolean

If the message will wait user to validate the message forever

Returns:

  • (Boolean)


11
12
13
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 11

def blocking
  @blocking
end

#wait_inputBoolean

If the message wait for the user to press a key before skiping

Returns:

  • (Boolean)


14
15
16
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 14

def wait_input
  @wait_input
end

Instance Method Details

#create_skipper_wait_animation

Function that create the skipper wait animation



53
54
55
56
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 53

def create_skipper_wait_animation
  @skipper_wait_animation = Yuki::Animation.wait(MAX_WAIT / 60.0)
  @skipper_wait_animation.start
end

#current_positionSymbol, Array

Note:

Always return :bottom if the battler interpreter is not running

Retrieve the current window position

Returns:

  • (Symbol, Array)


61
62
63
64
65
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 61

def current_position
  return super if $game_system.battle_interpreter.running?

  return :bottom
end

#current_window_builderArray

Retrieve the current window_builder

Returns:

  • (Array)


75
76
77
78
79
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 75

def current_window_builder
  return [16, 10, 288, 30, 16, 10] if current_windowskin == WINDOW_SKIN

  return super
end

#current_windowskinString

Battle Windowskin

Returns:



69
70
71
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 69

def current_windowskin
  @windowskin_overwrite || WINDOW_SKIN
end

#default_horizontal_marginInteger

Return the default horizontal margin

Returns:



92
93
94
95
96
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 92

def default_horizontal_margin
  return 0 if current_windowskin == WINDOW_SKIN

  return super
end

#default_vertical_marginInteger

Return the default vertical margin

Returns:



100
101
102
103
104
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 100

def default_vertical_margin
  return 0 if current_windowskin == WINDOW_SKIN

  return super
end

#terminate_message

Terminate the message display



47
48
49
50
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 47

def terminate_message
  super
  @skipper_wait_animation = nil
end

#translate_color(color) ⇒ Integer

Translate the color according to the layout configuration

Parameters:

  • color (Integer)

    color to translate

Returns:



84
85
86
87
88
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 84

def translate_color(color)
  return current_layout.color_mapping[color] || 10 + color if current_windowskin == WINDOW_SKIN

  return super
end

#update_wait_input_auto_skipBoolean

Autoskip the wait input

Returns:

  • (Boolean)


42
43
44
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 42

def update_wait_input_auto_skip
  return super || (!$game_system.battle_interpreter.running? && @skipper_wait_animation&.done? && !@blocking)
end

#update_wait_input_skipBoolean

Skip the update of wait input

Returns:

  • (Boolean)

    if the update of wait input should be skipped



33
34
35
36
37
38
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 33

def update_wait_input_skip
  return super if @wait_input

  terminate_message
  return true
end

#wait_user_input

Process the wait user input phase



25
26
27
28
29
# File 'scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/01000 Message.rb', line 25

def wait_user_input
  create_skipper_wait_animation unless @skipper_wait_animation
  @skipper_wait_animation&.update
  super
end