Class: Yuki::ChoiceWindow

Inherits:
Window show all
Defined in:
docs/4_Systems_000_General_4_UI_Generics.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



1046
1047
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1046

def initialize(width, choices, viewport = nil)
end

Instance Attribute Details

#colorsArray<Integer>

Array of choice colors

Returns:

  • (Array<Integer>)


1030
1031
1032
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1030

def colors
  @colors
end

#indexInteger

Current choix (0~choice_max-1)

Returns:

  • (Integer)


1033
1034
1035
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1033

def index
  @index
end

Class Method Details

.generate_for_message(window) ⇒ ChoiceWindow

Function that creates a new ChoiceWindow for the message system

Parameters:

  • window (Window)

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

Returns:



1125
1126
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1125

def self.generate_for_message(window)
end

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:

  • text (String)
  • i (Integer)

    index in the loop

Returns:

  • (Integer)

    the real width of the text



1097
1098
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1097

def add_choice_text(text, i)
end

#build_window

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



1088
1089
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1088

def build_window
end

#current_layoutConfigs::Project::Texts::ChoiceConfig

Retrieve the current layout configuration



1050
1051
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1050

def current_layout
end

#current_window_builderArray

Retrieve the current window_builder

Returns:

  • (Array)


1120
1121
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1120

def current_window_builder
end

#current_windowskinString

Retrieve the current windowskin

Returns:



1116
1117
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1116

def current_windowskin
end

#default_colorInteger Also known as: get_default_color

Return the default text color

Returns:

  • (Integer)


1066
1067
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1066

def default_color
end

#default_horizontal_marginInteger

Return the default horizontal margin

Returns:

  • (Integer)


1108
1109
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1108

def default_horizontal_margin
end

#default_line_heightInteger

Return the default height of a text line

Returns:

  • (Integer)


1062
1063
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1062

def default_line_height
end

#default_vertical_marginInteger

Return the default vertical margin

Returns:

  • (Integer)


1112
1113
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1112

def default_vertical_margin
end

#define_cursor_rect

Define the cursor rect



1100
1101
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1100

def define_cursor_rect
end

#disable_colorInteger Also known as: get_disable_color

Return the disable text color

Returns:

  • (Integer)


1071
1072
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1071

def disable_color
end

#refresh

Draw the options



1091
1092
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1091

def refresh
end

#translate_color(color) ⇒ Integer

Translate the color according to the layout configuration

Parameters:

  • color (Integer)

    color to translate

Returns:

  • (Integer)

    translated color



1058
1059
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1058

def translate_color(color)
end

#update

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



1053
1054
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1053

def update
end

#update_cursor_down

Update the choice display when player hit DOWN



1081
1082
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1081

def update_cursor_down
end

#update_cursor_up

Update the choice display when player hit UP



1078
1079
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1078

def update_cursor_up
end

#update_mouse

Update the mouse action



1075
1076
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1075

def update_mouse
end

#validated?Boolean

Tells the choice is done

Returns:

  • (Boolean)


1104
1105
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1104

def validated?
end

#window_builder=(builder)

Change the window builder and rebuild the window

Parameters:

  • builder (Array)

    The new window builder



1085
1086
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1085

def window_builder=(builder)
end