Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 4.02 KB | None | 0 0
  1. #==============================================================================
  2. # * Window_SaveFile
  3. #==============================================================================
  4.  
  5. class Window_SaveFile < Window_Base
  6.   # Help!
  7.   WIDTH_OF_THE_SAVE_WINDOW = 416
  8.   #--------------------------------------------------------------------------
  9.   # * Overwrite: Initialize
  10.   #--------------------------------------------------------------------------
  11.   def initialize(file_index, filename)
  12.     super((Graphics.width - WIDTH_OF_THE_SAVE_WINDOW) / 2,
  13.           (((Graphics.height - 4 * (WLH)) / 2) + file_index * (WLH)) - 16,
  14.           WIDTH_OF_THE_SAVE_WINDOW, WLH+32)
  15.     self.opacity = 0
  16.     @file_index = file_index
  17.     @filename = filename
  18.     load_gamedata
  19.     refresh
  20.     @selected = false
  21.   end
  22.   #--------------------------------------------------------------------------
  23.   # Overwrite: Refresh
  24.   #--------------------------------------------------------------------------
  25.   def refresh
  26.     self.contents.clear
  27.     self.contents.font.color = normal_color
  28.     name = Vocab::File + " #{@file_index + 1}"
  29.     self.contents.draw_text(4, 0, 200, WLH, name)
  30.     @name_width = contents.text_size(name).width
  31.     if @file_exist
  32.       draw_chapter(80, 0, contents.width, 0)
  33.       draw_playtime(0, 0, contents.width - 4, 2)
  34.     end
  35.   end
  36. #~   def draw_chapter(x, y, width, align)
  37. #~     for i in 0...WLTR::CHAPTER_TELLER::CHAPTER_MAX
  38. #~       if @game_variables[WLTR::CHAPTER_TELLER::CHAPTER_VARIABLE] == i
  39. #~       words = WLTR::CHAPTER_TELLER::CHAPTER_WORDS[i] unless WLTR::CHAPTER_TELLER::CHAPTER_WORDS[i] == nil
  40. #~       end
  41. #~     end
  42. #~     self.contents.font.color = normal_color
  43. #~     self.contents.draw_text(x, y, width, WLH, words, align) unless words == nil
  44. #~     self.contents.draw_text(x, y, width, WLH, "Chapter Name", align)
  45. #~   end
  46. end
  47.  
  48. #==============================================================================
  49. # ** Scene_File
  50. #==============================================================================
  51.  
  52. class Scene_File < Scene_Base
  53.   #--------------------------------------------------------------------------
  54.   # Overwrite: Start
  55.   #--------------------------------------------------------------------------
  56.   def start
  57.     super
  58.     create_menu_background
  59.     create_savefile_windows
  60.     @help_window = Window_Base.new(0, (@savefile_windows[@item_max - 1].y +
  61.                                     @savefile_windows[@item_max - 1].height) - 16,
  62.                                     Graphics.width, 56)
  63.     @help_window.opacity = 0
  64.     @help_window.contents.font.color = @help_window.system_color
  65.     if @saving
  66.       @index = $game_temp.last_file_index
  67.       @help_window.contents.draw_text(0, 0, @help_window.width,
  68.                                       24, Vocab::SaveMessage, 1)
  69.     else
  70.       @index = self.latest_file_index
  71.             @help_window.contents.draw_text(0, 0, @help_window.width,
  72.                                       24, Vocab::LoadMessage, 1)
  73.  
  74.     end
  75.     @savefile_windows[@index].selected = true
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # Overwrite: Terminate
  79.   #--------------------------------------------------------------------------
  80.   def terminate
  81.     super
  82.     @help_window.dispose
  83.     dispose_menu_background
  84.     dispose_item_windows
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # Overwrite: Update
  88.   #--------------------------------------------------------------------------
  89.   def update
  90.     super
  91.     update_menu_background
  92.     update_savefile_windows
  93.     update_savefile_selection
  94.   end
  95.   #--------------------------------------------------------------------------
  96.   # Overwrite: Create Savefile Windows
  97.   #--------------------------------------------------------------------------
  98.   def create_savefile_windows
  99.     @savefile_windows = []
  100.     for i in 0..3
  101.       @savefile_windows.push(Window_SaveFile.new(i, make_filename(i)))
  102.     end
  103.     @item_max = 4
  104.   end
  105. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement