Class: UI::Bag::PocketList

Inherits:
SpriteStack show all
Defined in:
scripts/01300 UI/00300 Bag/00010 PocketList.rb

Overview

Utility showing the pocket list

Constant Summary collapse

ACTIVE_BASE_COORDINATES =

Base coordinate of the active items

[0, 192]
INACTIVE_BASE_COORDINATES =

Base coordinate of the inactive items

[0, 198]
OFFSET_X =

Offset between each sprites

20
POCKET_TRANSLATION =

Array translating real pocket id to sprite piece

[0, 0, 1, 3, 5, 4, 2, 6, 7]
ACTIVE_IMAGE =

Name of the active image

'bag/pockets_active'
INACTIVE_IMAGE =

Name of the inactive image

'bag/pockets_inactive'

Constants inherited from SpriteStack

SpriteStack::NO_INITIAL_IMAGE

Instance Attribute Summary collapse

Attributes inherited from SpriteStack

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

Instance Method Summary collapse

Methods inherited from 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, #update_animation, #update_position, #visible, #visible=, #with_cache, #with_font, #with_surface, #z, #z=

Constructor Details

#initialize(viewport, pocket_indexes) ⇒ PocketList

Create a new pocket list

Parameters:

  • viewport (Viewport)
  • pocket_indexes (Array<Integer>)

    each shown pocket by the UI



23
24
25
26
27
28
29
30
31
# File 'scripts/01300 UI/00300 Bag/00010 PocketList.rb', line 23

def initialize(viewport, pocket_indexes)
  super(viewport, *INACTIVE_BASE_COORDINATES)
  pocket_indexes.each do |pocket_id|
    add_pocket_sprite(pocket_id)
  end
  @last_sprite = @stack[0]
  @index = 0
  self.z = 1
end

Instance Attribute Details

#indexInteger

Returns index of the current selected pocket.

Returns:

  • (Integer)

    index of the current selected pocket



7
8
9
# File 'scripts/01300 UI/00300 Bag/00010 PocketList.rb', line 7

def index
  @index
end