Class: UI::Casino::BandDisplay
- Inherits:
-
Sprite
- Object
- LiteRGSS::Disposable
- LiteRGSS::Drawable
- LiteRGSS::Sprite
- LiteRGSS::ShaderedSprite
- Sprite
- UI::Casino::BandDisplay
- Defined in:
- scripts/01450 Systems/09000 Games/00001 Slot Machines/00002 UI/00002 BandDisplay.rb
Overview
Object showing image that should be aligned
Constant Summary collapse
- FILES =
List of files that shows the images of the band
%w[casino/v1 casino/v2 casino/v3 casino/v4 casino/v5 casino/v6 casino/v7]
- @@loaded_images =
List of loaded image for shorter processing
[]
Instance Attribute Summary collapse
-
#animation_speed ⇒ Integer
Animation speed of the band.
-
#band ⇒ Array<Integer>
readonly
Band information.
-
#locked ⇒ Boolean
Tell if the band is locked or not.
Attributes inherited from LiteRGSS::ShaderedSprite
Attributes inherited from LiteRGSS::Sprite
#__index__, #angle, #bitmap, #height, #mirror, #opacity, #ox, #oy, #src_rect, #viewport, #visible, #width, #x, #y, #z, #zoom, #zoom_x, #zoom_y
Class Method Summary collapse
-
.dispose_images
Dispose all the loaded images.
Instance Method Summary collapse
-
#done? ⇒ Boolean
Tell if the animation is done.
-
#initialize(viewport, x, y, band, speed) ⇒ BandDisplay
constructor
Create a new BandDisplay.
-
#update
Update the animation.
-
#value(row = 1) ⇒ Integer
Get the current value of the image shown by the band.
Methods inherited from Sprite
#load, #mouse_in?, #set_origin_div, #set_rect, #set_rect_div, #set_z, #simple_mouse_in?, #translate_mouse_coords
Methods inherited from LiteRGSS::Sprite
new, #set_origin, #set_position
Methods inherited from LiteRGSS::Disposable
Constructor Details
#initialize(viewport, x, y, band, speed) ⇒ BandDisplay
Create a new BandDisplay
27 28 29 30 31 32 33 34 35 |
# File 'scripts/01450 Systems/09000 Games/00001 Slot Machines/00002 UI/00002 BandDisplay.rb', line 27 def initialize(, x, y, band, speed) super() @band = band make_band set_position(x, y) self.opacity = 224 @animation_speed = speed @locked = true end |
Instance Attribute Details
#animation_speed ⇒ Integer
Animation speed of the band
16 17 18 |
# File 'scripts/01450 Systems/09000 Games/00001 Slot Machines/00002 UI/00002 BandDisplay.rb', line 16 def animation_speed @animation_speed end |
#band ⇒ Array<Integer> (readonly)
Band information
13 14 15 |
# File 'scripts/01450 Systems/09000 Games/00001 Slot Machines/00002 UI/00002 BandDisplay.rb', line 13 def band @band end |
#locked ⇒ Boolean
Tell if the band is locked or not
19 20 21 |
# File 'scripts/01450 Systems/09000 Games/00001 Slot Machines/00002 UI/00002 BandDisplay.rb', line 19 def locked @locked end |
Class Method Details
.dispose_images
Dispose all the loaded images
101 102 103 104 |
# File 'scripts/01450 Systems/09000 Games/00001 Slot Machines/00002 UI/00002 BandDisplay.rb', line 101 def dispose_images @@loaded_images.each(&:dispose) @@loaded_images.clear end |
Instance Method Details
#done? ⇒ Boolean
Tell if the animation is done
52 53 54 |
# File 'scripts/01450 Systems/09000 Games/00001 Slot Machines/00002 UI/00002 BandDisplay.rb', line 52 def done? return (src_rect.y % cell_height) == 0 && @locked end |
#update
Update the animation
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'scripts/01450 Systems/09000 Games/00001 Slot Machines/00002 UI/00002 BandDisplay.rb', line 38 def update return if done? if @locked @animation_speed.times do src_rect.y -= 1 break if done? end else src_rect.y -= @animation_speed end src_rect.y = src_rect.y % (7 * cell_height) end |
#value(row = 1) ⇒ Integer
Get the current value of the image shown by the band
59 60 61 62 |
# File 'scripts/01450 Systems/09000 Games/00001 Slot Machines/00002 UI/00002 BandDisplay.rb', line 59 def value(row = 1) value_index = src_rect.y / cell_height + row return @band[value_index % @band.size] end |