Class: BattleUI::GenericChoice

Inherits:
UI::SpriteStack show all
Includes:
GoingInOut, HideShow, UI
Defined in:
scripts/01600 Alpha 25 Battle Engine/00001 Battle_Scene/00001 BattleUI/00107 GenericChoice.rb

Overview

Class that allow a choice do be made

The object tells the player validated on #validated? and the result is stored inside #result

The object should be updated through #update otherwise no validation is possible

When result was taken, the scene should call #reset to undo the validated state

The goal of this class is to provide the cursor handling. You have to define the buttons! Here's the list of methods you should define

- create_buttons
- create_sub_choice (add the subchoice as a stack item! & store it in @sub_choice)
- validate (set the result to the proper value)
- update_key_index

To allow flexibility (sub actions) this generic choice allow you to define a “sub generic” choice that only needs to responds to #update, #reset and #done? in @sub_choice

Direct Known Subclasses

PlayerChoice, SkillChoice

Constant Summary collapse

CURSOR_OFFSET_X =

Offset X of the cursor compared to the element it shows

-10
# Offset Y of the cursor compared to the element it shows
CURSOR_OFFSET_Y =

Offset Y of the cursor compared to the element it shows

6

Constants inherited from UI::SpriteStack

UI::SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary collapse

Attributes inherited from UI::SpriteStack

#animated, #data, #moving, #stack, #viewport, #x, #y

Instance Method Summary collapse

Methods included from GoingInOut

#go_in, #go_out, #in?, #out?

Methods included from HideShow

#hide, #show

Methods included from Repository

#declare, extended, #find

Methods inherited from UI::SpriteStack

#[], #add_background, #add_line, #add_text, #anime, #anime_delta_set, #dispose, #each, #execute_anime, #move, #move_to, #opacity, #opacity=, #push, #push_sprite, #set_origin, #set_position, #simple_mouse_in?, #size, #stop_animation, #translate_mouse_coords, #update_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport, scene) ⇒ GenericChoice

Create a new GenericChoice

Parameters:

Instance Attribute Details

#animation_handlerYuki::Animation::Handler{ Symbol => Yuki::Animation::TimedAnimation} (readonly)

Get the animation handler

#sceneBattle::Scene (readonly)

Get the scene

Returns:

Instance Method Details

#done?Boolean

Tell if all animations are done

Returns:

  • (Boolean)

#reset

Reset the choice

#update

Update the Window cursor