Class: Yuki::ChoiceWindow

Inherits:
Window show all
Defined in:
scripts/01100 Yuki/02300 Yuki__ChoiceWindow.rb,
scripts/01100 Yuki/02301 Yuki__ChoiceWindow__But.rb

Overview

Display a choice Window

Author:

  • Nuri Yuri

Direct Known Subclasses

But

Defined Under Namespace

Classes: But

Constant Summary collapse

CursorSkin =

Name of the cursor in Graphics/Windowskins/

'Cursor'
WINDOW_SKIN =

Name of the windowskin in Graphics/Windowskins/

'Message'
MaxChoice =

Number of choice shown until a relative display is generated

9
DeltaChoice =

Index that tells the system to scroll up or down everychoice (relative display)

(MaxChoice / 2.0).round

Instance Attribute Summary collapse

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

Class Method Summary collapse

Instance Method Summary collapse

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

Methods inherited from LiteRGSS::Disposable

#dispose, #disposed?

Constructor Details

#initialize(width, choices, viewport = nil) ⇒ ChoiceWindow

Create a new ChoiceWindow with the right parameters

Parameters:

  • width (Integer, nil)

    width of the window; if nil => automatically calculated

  • choices (Array<String>)

    list of choices

  • viewport (Viewport, nil) (defaults to: nil)

    viewport in which the window is displayed

Instance Attribute Details

#colorsArray<Integer>

Array of choice colors

Returns:

#indexInteger

Current choix (0~choice_max-1)

Returns:

Class Method Details

.generate_for_message(window) ⇒ ChoiceWindow

Function that creates a new ChoiceWindow for Yuki::Message

Parameters:

  • window (Window)

    a window that has the right window_builder (to calculate the width)

Returns:

Instance Method Details

#add_choice_text(text, i) ⇒ Integer

Function that adds a choice text and manage various thing like getting the actual width of the text

Parameters:

Returns:

  • (Integer)

    the real width of the text

#build_window

Build the window : update the height of the window and draw the options

#current_layoutScriptLoader::PSDKConfig::LayoutConfig::Choice

Retrieve the current layout configuration

#current_window_builderArray

Retrieve the current window_builder

Returns:

  • (Array)

#current_windowskinString

Retrieve the current windowskin

Returns:

#default_colorInteger Also known as: get_default_color

Return the default text color

Returns:

#default_horizontal_marginInteger

Return the default horizontal margin

Returns:

#default_line_heightInteger

Return the default height of a text line

Returns:

#default_vertical_marginInteger

Return the default vertical margin

Returns:

#define_cursor_rect

Define the cursor rect

#disable_colorInteger Also known as: get_disable_color

Return the disable text color

Returns:

#refresh

Draw the options

#translate_color(color) ⇒ Integer

Translate the color according to the layout configuration

Parameters:

  • color (Integer)

    color to translate

Returns:

#update

Update the choice, if player hit up or down the choice index changes

#update_cursor_down

Update the choice display when player hit DOWN

#update_cursor_up

Update the choice display when player hit UP

#update_mouse

Update the mouse action

#validated?Boolean

Tells the choice is done

Returns:

  • (Boolean)

#window_builder=(builder)

Change the window builder and rebuild the window

Parameters:

  • builder (Array)

    The new window builder