Class: BattleUI::GenericChoice

Inherits:
UI::SpriteStack show all
Includes:
GoingInOut, HideShow, UI
Defined in:
docs/5_Battle_01_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, #font_id, #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:



1438
1439
# File 'docs/5_Battle_01_Scene.rb', line 1438

def initialize(viewport, scene)
end

Instance Attribute Details

#animation_handler ⇒ Yuki::Animation::Handler{ Symbol => Yuki::AnimationMixin} (readonly)

Get the animation handler



1431
1432
1433
# File 'docs/5_Battle_01_Scene.rb', line 1431

def animation_handler
  @animation_handler
end

#scene ⇒ Battle::Scene (readonly)

Get the scene

Returns:



1434
1435
1436
# File 'docs/5_Battle_01_Scene.rb', line 1434

def scene
  @scene
end

Instance Method Details

#done? ⇒ Boolean

Tell if all animations are done

Returns:

  • (Boolean)


1445
1446
# File 'docs/5_Battle_01_Scene.rb', line 1445

def done?
end

#reset

Reset the choice



1448
1449
# File 'docs/5_Battle_01_Scene.rb', line 1448

def reset
end

#update

Update the Window cursor



1441
1442
# File 'docs/5_Battle_01_Scene.rb', line 1441

def update
end