Module: PFM::Message::State
- Includes:
- Parser
- Included in:
- UI::Message::Layout, UI::Message::Window
- Defined in:
- scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb
Overview
Module responsive of helping the message window with states
In order to have everything working properly, the class including this module needs to define:
-
message_width : Returns an integer telling the width of the message window we want to process (can use @properties)
-
width_computer : Returns [PFM::Message::WidthComputer] object helping to compute the width of the words/texts
Instance Attribute Summary collapse
-
#auto_skip ⇒ Boolean
If the message doesn't wait the player to hit A to terminate.
-
#current_instruction
readonly
Returns the value of attribute current_instruction.
-
#instructions
readonly
Returns the value of attribute instructions.
-
#last_text ⇒ String?
readonly
The last unprocessed text the window has shown.
-
#properties
readonly
Returns the value of attribute properties.
-
#stay_visible ⇒ Boolean
If the window message doesn't fade out.
Instance Method Summary collapse
-
#at_end_of_line? ⇒ Boolean
Test if we're at the end of the line.
-
#done_drawing_message? ⇒ Boolean
Test if we're done drawing the message.
-
#initialize
Initialize the states.
-
#load_next_instruction
Load the next instruction.
-
#need_to_show_choice? ⇒ Boolean
Tell if the message window need to show a choice.
-
#need_to_show_message? ⇒ Boolean
Tell if the message window need to show a message.
-
#need_to_show_number_input? ⇒ Boolean
Tell if the message window need to show a number input.
-
#need_to_wait_user_input? ⇒ Boolean
Tell if the message window need to wait for user input.
-
#parse_and_show_new_message
Parse the new message and set the window into showing message state.
-
#showing_message? ⇒ Boolean
Tell if the message window is showing a message.
Methods included from Parser
#convert_text_to_properties, #make_instructions, register_marker
Instance Attribute Details
#auto_skip ⇒ Boolean
If the message doesn't wait the player to hit A to terminate
16 17 18 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 16 def auto_skip @auto_skip end |
#current_instruction (readonly)
Returns the value of attribute current_instruction.
25 26 27 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 25 def current_instruction @current_instruction end |
#instructions (readonly)
Returns the value of attribute instructions.
28 29 30 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 28 def instructions @instructions end |
#last_text ⇒ String? (readonly)
The last unprocessed text the window has shown
22 23 24 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 22 def last_text @last_text end |
#properties (readonly)
Returns the value of attribute properties.
31 32 33 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 31 def properties @properties end |
#stay_visible ⇒ Boolean
If the window message doesn't fade out
19 20 21 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 19 def stay_visible @stay_visible end |
Instance Method Details
#at_end_of_line? ⇒ Boolean
Test if we're at the end of the line
74 75 76 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 74 def at_end_of_line? return @current_instruction == Instructions::NewLine end |
#done_drawing_message? ⇒ Boolean
Test if we're done drawing the message
80 81 82 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 80 def return (@instructions&.done_processing? || !@instructions) && !current_instruction end |
#initialize
Initialize the states
34 35 36 37 38 39 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 34 def initialize(...) @auto_skip = false @stay_visible = false @last_text = nil super(...) # Forward any arguments to original super ;) end |
#load_next_instruction
Load the next instruction
68 69 70 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 68 def load_next_instruction @current_instruction = @instructions.get end |
#need_to_show_choice? ⇒ Boolean
Tell if the message window need to show a choice
92 93 94 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 92 def need_to_show_choice? return $game_temp.choice_max > 0 end |
#need_to_show_message? ⇒ Boolean
Tell if the message window need to show a message
43 44 45 46 47 48 49 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 43 def # If the window is showing a message and not done drawing it, no need to show the new message return false if && @instructions # The message text needs to be String object in order to show a new message return $game_temp..is_a?(String) end |
#need_to_show_number_input? ⇒ Boolean
Tell if the message window need to show a number input
98 99 100 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 98 def need_to_show_number_input? return $game_temp.num_input_digits_max > 0 end |
#need_to_wait_user_input? ⇒ Boolean
Tell if the message window need to wait for user input
53 54 55 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 53 def need_to_wait_user_input? return && && !$game_temp..nil? end |
#parse_and_show_new_message
Parse the new message and set the window into showing message state
58 59 60 61 62 63 64 65 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 58 def @last_text = $game_temp. @properties = convert_text_to_properties($game_temp.) @instructions = make_instructions(@properties, , width_computer) @instructions.start_processing @current_instruction = nil $game_temp. = true end |
#showing_message? ⇒ Boolean
Tell if the message window is showing a message
86 87 88 |
# File 'scripts/01450 Systems/00004 Message/00001 Logic/00090 State.rb', line 86 def return $game_temp. end |