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

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?, #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



1166
1167
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1166

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

Instance Attribute Details

#colors ⇒ Array<Integer>

Array of choice colors

Returns:

  • (Array<Integer>)


1150
1151
1152
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1150

def colors
  @colors
end

#index ⇒ Integer

Current choix (0~choice_max-1)

Returns:

  • (Integer)


1153
1154
1155
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1153

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:



1245
1246
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1245

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



1217
1218
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1217

def add_choice_text(text, i)
end

#build_window

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



1208
1209
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1208

def build_window
end

#current_layout ⇒ Configs::Project::Texts::ChoiceConfig

Retrieve the current layout configuration



1170
1171
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1170

def current_layout
end

#current_window_builder ⇒ Array

Retrieve the current window_builder

Returns:

  • (Array)


1240
1241
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1240

def current_window_builder
end

#current_windowskin ⇒ String

Retrieve the current windowskin

Returns:



1236
1237
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1236

def current_windowskin
end

#default_color ⇒ Integer Also known as: get_default_color

Return the default text color

Returns:

  • (Integer)


1186
1187
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1186

def default_color
end

#default_horizontal_margin ⇒ Integer

Return the default horizontal margin

Returns:

  • (Integer)


1228
1229
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1228

def default_horizontal_margin
end

#default_line_height ⇒ Integer

Return the default height of a text line

Returns:

  • (Integer)


1182
1183
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1182

def default_line_height
end

#default_vertical_margin ⇒ Integer

Return the default vertical margin

Returns:

  • (Integer)


1232
1233
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1232

def default_vertical_margin
end

#define_cursor_rect

Define the cursor rect



1220
1221
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1220

def define_cursor_rect
end

#disable_color ⇒ Integer Also known as: get_disable_color

Return the disable text color

Returns:

  • (Integer)


1191
1192
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1191

def disable_color
end

#refresh

Draw the options



1211
1212
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1211

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



1178
1179
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1178

def translate_color(color)
end

#update

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



1173
1174
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1173

def update
end

#update_cursor_down

Update the choice display when player hit DOWN



1201
1202
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1201

def update_cursor_down
end

#update_cursor_up

Update the choice display when player hit UP



1198
1199
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1198

def update_cursor_up
end

#update_mouse

Update the mouse action



1195
1196
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1195

def update_mouse
end

#validated? ⇒ Boolean

Tells the choice is done

Returns:

  • (Boolean)


1224
1225
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1224

def validated?
end

#window_builder=(builder)

Change the window builder and rebuild the window

Parameters:

  • builder (Array) —

    The new window builder



1205
1206
# File 'docs/4_Systems_000_General_4_UI_Generics.rb', line 1205

def window_builder=(builder)
end