Class: BattleUI::GenericChoice

Inherits:
UI::SpriteStack show all
Includes:
GoingInOut, HideShow, UI
Defined in:
docs/01600_Alpha_25_Battle_Engine_00001_Battle_Scene.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 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:



1145
1146
# File 'docs/01600_Alpha_25_Battle_Engine_00001_Battle_Scene.rb', line 1145

def initialize(viewport, scene)
end

Instance Attribute Details

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

Get the animation handler



1138
1139
1140
# File 'docs/01600_Alpha_25_Battle_Engine_00001_Battle_Scene.rb', line 1138

def animation_handler
  @animation_handler
end

#sceneBattle::Scene (readonly)

Get the scene

Returns:



1141
1142
1143
# File 'docs/01600_Alpha_25_Battle_Engine_00001_Battle_Scene.rb', line 1141

def scene
  @scene
end

Instance Method Details

#done?Boolean

Tell if all animations are done

Returns:

  • (Boolean)


1152
1153
# File 'docs/01600_Alpha_25_Battle_Engine_00001_Battle_Scene.rb', line 1152

def done?
end

#reset

Reset the choice



1155
1156
# File 'docs/01600_Alpha_25_Battle_Engine_00001_Battle_Scene.rb', line 1155

def reset
end

#update

Update the Window cursor



1148
1149
# File 'docs/01600_Alpha_25_Battle_Engine_00001_Battle_Scene.rb', line 1148

def update
end