Class: Window_SaveFile

Inherits:
Window_Base show all
Defined in:
Window_SaveFile.rb

Overview

** Window_SaveFile


This window displays save files on the save and load screens.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

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

- (Window_SaveFile) initialize(height, index)


  • Object Initialization

    index : index of save files



16
17
18
19
20
21
# File 'Window_SaveFile.rb', line 16

def initialize(height, index)
  super(0, index * height, Graphics.width, height)
  @file_index = index
  refresh
  @selected = false
end

Instance Attribute Details

- (Object) selected


  • Public Instance Variables




11
12
13
# File 'Window_SaveFile.rb', line 11

def selected
  @selected
end

Instance Method Details

- (Object) draw_party_characters(x, y)


  • Draw Party Characters




37
38
39
40
41
42
43
# File 'Window_SaveFile.rb', line 37

def draw_party_characters(x, y)
  header = DataManager.load_header(@file_index)
  return unless header
  header[:characters].each_with_index do |data, i|
    draw_character(data[0], data[1], x + i * 48, y)
  end
end

- (Object) draw_playtime(x, y, width, align)


  • Draw Play Time




47
48
49
50
51
# File 'Window_SaveFile.rb', line 47

def draw_playtime(x, y, width, align)
  header = DataManager.load_header(@file_index)
  return unless header
  draw_text(x, y, width, line_height, header[:playtime_s], 2)
end

- (Object) refresh


  • Refresh




25
26
27
28
29
30
31
32
33
# File 'Window_SaveFile.rb', line 25

def refresh
  contents.clear
  change_color(normal_color)
  name = Vocab::File + " #{@file_index + 1}"
  draw_text(4, 0, 200, line_height, name)
  @name_width = text_size(name).width
  draw_party_characters(152, 58)
  draw_playtime(0, contents.height - line_height, contents.width - 4, 2)
end

- (Object) update_cursor


  • Update Cursor




62
63
64
65
66
67
68
# File 'Window_SaveFile.rb', line 62

def update_cursor
  if @selected
    cursor_rect.set(0, 0, @name_width + 8, line_height)
  else
    cursor_rect.empty
  end
end