Class: Window_ShopBuy
- Inherits:
-
Window_Selectable
- Object
- Window
- Window_Base
- Window_Selectable
- Window_ShopBuy
- Defined in:
- lib/rgss3_default_scripts/Window_ShopBuy.rb
Overview
** Window_ShopBuy
This window displays a list of buyable goods on the shop screen.
Instance Attribute Summary collapse
-
#status_window ⇒ Object
————————————————————————– * Public Instance Variables ————————————————————————–.
Attributes inherited from Window_Selectable
#cursor_all, #cursor_fix, #help_window, #index
Instance Method Summary collapse
-
#current_item_enabled? ⇒ Boolean
————————————————————————– * Get Activation State of Selection Item ————————————————————————–.
-
#draw_item(index) ⇒ Object
————————————————————————– * Draw Item ————————————————————————–.
-
#enable?(item) ⇒ Boolean
————————————————————————– * Display in Enabled State? ————————————————————————–.
-
#initialize(x, y, height, shop_goods) ⇒ Window_ShopBuy
constructor
————————————————————————– * Object Initialization ————————————————————————–.
-
#item ⇒ Object
————————————————————————– * Get Item ————————————————————————–.
-
#item_max ⇒ Object
————————————————————————– * Get Number of Items ————————————————————————–.
-
#make_item_list ⇒ Object
————————————————————————– * Create Item List ————————————————————————–.
-
#money=(money) ⇒ Object
————————————————————————– * Set Party Gold ————————————————————————–.
-
#price(item) ⇒ Object
————————————————————————– * Get Price of Item ————————————————————————–.
-
#refresh ⇒ Object
————————————————————————– * Refresh ————————————————————————–.
-
#update_help ⇒ Object
————————————————————————– * Update Help Text ————————————————————————–.
-
#window_width ⇒ Object
————————————————————————– * Get Window Width ————————————————————————–.
Methods inherited from Window_Selectable
#active=, #bottom_row, #bottom_row=, #call_cancel_handler, #call_handler, #call_ok_handler, #call_update_help, #cancel_enabled?, #clear_item, #col_max, #contents_height, #cursor_down, #cursor_left, #cursor_movable?, #cursor_pagedown, #cursor_pageup, #cursor_right, #cursor_up, #draw_all_items, #ensure_cursor_visible, #handle?, #height=, #horizontal?, #item_height, #item_rect, #item_rect_for_text, #item_width, #ok_enabled?, #page_item_max, #page_row_max, #process_cancel, #process_cursor_move, #process_handling, #process_ok, #process_pagedown, #process_pageup, #redraw_current_item, #redraw_item, #row, #row_max, #select, #set_handler, #spacing, #top_row, #top_row=, #unselect, #update, #update_cursor, #update_padding, #update_padding_bottom
Methods inherited from Window_Base
#activate, #actor_name, #calc_line_height, #change_color, #close, #contents_height, #contents_width, #convert_escape_characters, #create_contents, #crisis_color, #deactivate, #dispose, #draw_actor_class, #draw_actor_face, #draw_actor_graphic, #draw_actor_hp, #draw_actor_icons, #draw_actor_level, #draw_actor_mp, #draw_actor_name, #draw_actor_nickname, #draw_actor_param, #draw_actor_simple_status, #draw_actor_tp, #draw_character, #draw_currency_value, #draw_current_and_max_values, #draw_face, #draw_gauge, #draw_icon, #draw_item_name, #draw_text, #draw_text_ex, #fitting_height, #gauge_back_color, #hide, #hp_color, #hp_gauge_color1, #hp_gauge_color2, #knockout_color, #line_height, #make_font_bigger, #make_font_smaller, #mp_color, #mp_cost_color, #mp_gauge_color1, #mp_gauge_color2, #normal_color, #obtain_escape_code, #obtain_escape_param, #open, #param_change_color, #party_member_name, #pending_color, #power_down_color, #power_up_color, #process_character, #process_draw_icon, #process_escape_character, #process_new_line, #process_new_page, #process_normal_character, #reset_font_settings, #show, #standard_padding, #system_color, #text_color, #text_size, #tp_color, #tp_cost_color, #tp_gauge_color1, #tp_gauge_color2, #translucent_alpha, #update, #update_close, #update_open, #update_padding, #update_tone
Constructor Details
#initialize(x, y, height, shop_goods) ⇒ Window_ShopBuy
-
Object Initialization
15 16 17 18 19 20 21 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 15 def initialize(x, y, height, shop_goods) super(x, y, window_width, height) @shop_goods = shop_goods @money = 0 refresh select(0) end |
Instance Attribute Details
#status_window ⇒ Object
-
Public Instance Variables
11 12 13 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 11 def status_window @status_window end |
Instance Method Details
#current_item_enabled? ⇒ Boolean
-
Get Activation State of Selection Item
50 51 52 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 50 def current_item_enabled? enable?(@data[index]) end |
#draw_item(index) ⇒ Object
-
Draw Item
94 95 96 97 98 99 100 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 94 def draw_item(index) item = @data[index] rect = item_rect(index) draw_item_name(item, rect.x, rect.y, enable?(item)) rect.width -= 4 draw_text(rect, price(item), 2) end |
#enable?(item) ⇒ Boolean
-
Display in Enabled State?
62 63 64 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 62 def enable?(item) item && price(item) <= @money && !$game_party.item_max?(item) end |
#item ⇒ Object
-
Get Item
37 38 39 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 37 def item @data[index] end |
#item_max ⇒ Object
-
Get Number of Items
31 32 33 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 31 def item_max @data ? @data.size : 1 end |
#make_item_list ⇒ Object
-
Create Item List
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 76 def make_item_list @data = [] @price = {} @shop_goods.each do |goods| case goods[0] when 0; item = $data_items[goods[1]] when 1; item = $data_weapons[goods[1]] when 2; item = $data_armors[goods[1]] end if item @data.push(item) @price[item] = goods[2] == 0 ? item.price : goods[3] end end end |
#money=(money) ⇒ Object
-
Set Party Gold
43 44 45 46 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 43 def money=(money) @money = money refresh end |
#price(item) ⇒ Object
-
Get Price of Item
56 57 58 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 56 def price(item) @price[item] end |
#refresh ⇒ Object
-
Refresh
68 69 70 71 72 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 68 def refresh make_item_list create_contents draw_all_items end |
#update_help ⇒ Object
-
Update Help Text
111 112 113 114 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 111 def update_help @help_window.set_item(item) if @help_window @status_window.item = item if @status_window end |
#window_width ⇒ Object
-
Get Window Width
25 26 27 |
# File 'lib/rgss3_default_scripts/Window_ShopBuy.rb', line 25 def window_width return 304 end |