Module: GamePlay::DisplayMessage
- Included in:
- Base
- Defined in:
- scripts/01450 Systems/00004 Message/00003 GamePlay/00001 DisplayMessage.rb
Overview
Module responsive of adding the display message functionality to a class
Constant Summary collapse
- MESSAGE_ERROR =
Message the displays when a GamePlay scene has been initialized without message processing and try to display a message
'This interface has no MessageWindow, you cannot call display_message'
- MESSAGE_PROCESS_ERROR =
Error message when display_message is called from “itself”
'display_message was called inside display_message. Please fix your scene update.'
Instance Attribute Summary collapse
-
#message_window ⇒ UI::Message::Window?
readonly
The message window.
Instance Method Summary collapse
-
#can_display_message_be_called? ⇒ Boolean
Tell if the display_message function can be called.
-
#close_message_window { ... }
Force the message window to “close” (but does not update scene).
-
#display_message(message, start = 1, *choices, &block) ⇒ Integer?
Display a message with choice or not.
-
#display_message_and_wait(message, start = 1, *choices, &block) ⇒ Integer?
Display a message with choice or not.
-
#message_class ⇒ Class<UI::Message::Window>
Return the message class used.
-
#message_processing? ⇒ Boolean
Prevent the update to process if the message are still processing.
-
#message_visible ⇒ Boolean
Get the visibility of message.
-
#message_visible=(visible)
Set the visibility of message.
Instance Attribute Details
#message_window ⇒ UI::Message::Window? (readonly)
The message window
10 11 12 |
# File 'scripts/01450 Systems/00004 Message/00003 GamePlay/00001 DisplayMessage.rb', line 10 def @message_window end |
Instance Method Details
#can_display_message_be_called? ⇒ Boolean
Tell if the display_message function can be called
20 21 22 |
# File 'scripts/01450 Systems/00004 Message/00003 GamePlay/00001 DisplayMessage.rb', line 20 def !@still_in_display_message end |
#close_message_window { ... }
Force the message window to “close” (but does not update scene)
26 27 28 29 30 31 32 33 34 |
# File 'scripts/01450 Systems/00004 Message/00003 GamePlay/00001 DisplayMessage.rb', line 26 def return unless @message_window while Graphics.update yield if block_given? @message_window.update end end |
#display_message(message, start = 1, *choices, &block) ⇒ Integer?
Display a message with choice or not
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'scripts/01450 Systems/00004 Message/00003 GamePlay/00001 DisplayMessage.rb', line 64 def (, start = 1, *choices, &block) raise ScriptError, MESSAGE_ERROR unless @message_window raise ScriptError, MESSAGE_PROCESS_ERROR unless @message_done_processing && block ||= @__display_message_proc (, start, choices) # Message update until @message_done_processing block&.call end Graphics.update return @message_choice ensure @still_in_display_message = false end |
#display_message_and_wait(message, start = 1, *choices, &block) ⇒ Integer?
Display a message with choice or not. This method will wait the message window to disappear
87 88 89 90 91 92 93 94 95 |
# File 'scripts/01450 Systems/00004 Message/00003 GamePlay/00001 DisplayMessage.rb', line 87 def (, start = 1, *choices, &block) block ||= @__display_message_proc choice = (, start, *choices, &block) @still_in_display_message = true (&block) return choice ensure @still_in_display_message = false end |
#message_class ⇒ Class<UI::Message::Window>
Return the message class used
38 39 40 |
# File 'scripts/01450 Systems/00004 Message/00003 GamePlay/00001 DisplayMessage.rb', line 38 def UI::Message::Window end |
#message_processing? ⇒ Boolean
Prevent the update to process if the message are still processing
14 15 16 |
# File 'scripts/01450 Systems/00004 Message/00003 GamePlay/00001 DisplayMessage.rb', line 14 def @message_window&. end |
#message_visible ⇒ Boolean
Get the visibility of message
52 53 54 55 56 |
# File 'scripts/01450 Systems/00004 Message/00003 GamePlay/00001 DisplayMessage.rb', line 52 def return false unless @message_window @message_window..visible end |
#message_visible=(visible)
Set the visibility of message
44 45 46 47 48 |
# File 'scripts/01450 Systems/00004 Message/00003 GamePlay/00001 DisplayMessage.rb', line 44 def (visible) return unless @message_window @message_window..visible = visible end |