Advertisement
roninator2

Item Name Text Scroll - Shop Scene

Dec 16th, 2024
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 28.45 KB | None | 0 0
  1. # ╔═══════════════════════════════════════════════╦════════════════════╗
  2. # ║ Title: Shop Item Name Scroll Text             ║  Version: 1.04     ║
  3. # ║ Author: Roninator2                            ║                    ║
  4. # ╠═══════════════════════════════════════════════╬════════════════════╣
  5. # ║ Function:                                     ║   Date Created     ║
  6. # ║                                               ╠════════════════════╣
  7. # ║ Scroll the text when too long to fit          ║    17 Sep 2023     ║
  8. # ╚═══════════════════════════════════════════════╩════════════════════╝
  9. # ╔════════════════════════════════════════════════════════════════════╗
  10. # ║ Requires: nil                                                      ║
  11. # ║   TsukiHime Instance Items                                         ║
  12. # ║   Intended to assist with Item Affixes                             ║
  13. # ║                                                                    ║
  14. # ╚════════════════════════════════════════════════════════════════════╝
  15. # ╔════════════════════════════════════════════════════════════════════╗
  16. # ║ Brief Description:                                                 ║
  17. # ║       Scroll Item names in Shop                                    ║
  18. # ╚════════════════════════════════════════════════════════════════════╝
  19. # ╔════════════════════════════════════════════════════════════════════╗
  20. # ║ Instructions:                                                      ║
  21. # ║                                                                    ║
  22. # ║  Plug and play                                                     ║
  23. # ║  Change the speed number if you like                               ║
  24. # ║                                                                    ║
  25. # ║  Designed for the default system and settings                      ║
  26. # ║  Modifications may need to be done if not using defaults           ║
  27. # ║                                                                    ║
  28. # ╚════════════════════════════════════════════════════════════════════╝
  29. # ╔════════════════════════════════════════════════════════════════════╗
  30. # ║ Updates:                                                           ║
  31. # ║ 1.04 - 17 Sep 2023 - Script finished                               ║
  32. # ║                                                                    ║
  33. # ╚════════════════════════════════════════════════════════════════════╝
  34. # ╔════════════════════════════════════════════════════════════════════╗
  35. # ║ Credits and Thanks:                                                ║
  36. # ║   RPG Maker Source                                                 ║
  37. # ║   Roninator2                                                       ║
  38. # ║                                                                    ║
  39. # ╚════════════════════════════════════════════════════════════════════╝
  40. # ╔════════════════════════════════════════════════════════════════════╗
  41. # ║ Terms of use:                                                      ║
  42. # ║  Follow the original Authors terms of use where applicable         ║
  43. # ║    - When not made by me (Roninator2)                              ║
  44. # ║  Free for all uses in RPG Maker except nudity                      ║
  45. # ║  Anyone using this script in their project before these terms      ║
  46. # ║  were changed are allowed to use this script even if it conflicts  ║
  47. # ║  with these new terms. New terms effective 03 Apr 2024             ║
  48. # ║  No part of this code can be used with AI programs or tools        ║
  49. # ║  Credit must be given                                              ║
  50. # ╚════════════════════════════════════════════════════════════════════╝
  51.  
  52. module R2_Shop_Scroll_Name
  53.   Shop_Speed = 0.8 # anything from 0.4 to 1.2 is ok
  54.   Shop_length = 16
  55. end
  56.  
  57. # ╔════════════════════════════════════════════════════════════════════╗
  58. # ║                      End of editable region                        ║
  59. # ╚════════════════════════════════════════════════════════════════════╝
  60.  
  61. #==============================================================================
  62. # ** Window_ShopBuy
  63. #==============================================================================
  64.  
  65. class Window_ShopBuy < Window_Selectable
  66.  
  67.   #--------------------------------------------------------------------------
  68.   # * Object Initialization
  69.   #--------------------------------------------------------------------------
  70.   alias r2_shopbuy_text_scroll_init   initialize
  71.   def initialize(x, y, height, shop_goods)
  72.     @r2_scrolling_shop_buy_text_line ||= {}
  73.     r2_shopbuy_text_scroll_init(x, y, height, shop_goods)
  74.   end
  75.   #--------------------------------------------------------------------------
  76.   # * Draw Item Name
  77.   #     enabled : Enabled flag. When false, draw semi-transparently.
  78.   #--------------------------------------------------------------------------
  79.   def draw_item_name(item, x, y, enabled = true, width = 175)
  80.     return unless item
  81.     draw_icon(item.icon_index, x, y, enabled)
  82.     change_color(normal_color, enabled)
  83.     cw = contents.text_size(item.name).width
  84.     if (cw < width)
  85.       draw_text(x + 24, y, width, line_height, item.name)
  86.     else
  87.       set_text(item.id, x, y, item.name, width, cw)
  88.     end
  89.   end
  90. #=============================================================================
  91.   #--------------------------------------------------------------------------
  92.   # * Update.                                                           [MOD]
  93.   #--------------------------------------------------------------------------
  94.   alias r2_update_equip_text_scroll   update
  95.   def update
  96.     # Original method.
  97.     r2_update_equip_text_scroll
  98.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  99.     # 4 - position {x,y}, 5 - text width, 6 - placement, 7 - direction <- ->
  100.     # 8 - viewport, 9 - type
  101.     dispose_shopbuy_list if !self.active
  102.     return if !self.active
  103.     buyitem = @data[@index].nil? ? -1 : @data[@index].id
  104.     @r2_scrolling_shop_buy_text_line.each do |id, data|
  105.       next if buyitem != id
  106.       data[3].visible = visible
  107.       # Advance the image position
  108.       # Change the offset X to scroll.
  109.       if (data[7] == 0)
  110.         data[6] += (1.0 * data[1]).to_f
  111.         data[3].ox = data[6]
  112.       elsif (data[7] == 1)
  113.         data[6] -= (1.0 * data[1]).to_f
  114.         data[3].ox = data[6]
  115.       end
  116.       if data[6] >= (data[5] - (data[2] / 5 * 3) - 30)
  117.         data[7] = 1
  118.       elsif data[6] <= 10
  119.         data[7] = 0
  120.       end
  121.     end
  122.   end
  123.   #--------------------------------------------------------------------------
  124.   # * Set Text.                                                         [REP]
  125.   #--------------------------------------------------------------------------
  126.   def set_text(id, x, y, text, width, cw)
  127.     # New text?
  128.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  129.     # 4 - position, 5 - text width, 6 - placement, 7 - direction,
  130.     # 8 - viewport
  131.     @r2_scrolling_shop_buy_text_line ||= {}
  132.     if @r2_scrolling_shop_buy_text_line.empty? || @r2_scrolling_shop_buy_text_line[id].nil? ||
  133.         text != @r2_scrolling_shop_buy_text_line[id][1]
  134.       # Dispose the Scrolling Help objects if needed.
  135.       r2_scrolling_text_dispose(id) if @r2_scrolling_shop_buy_text_line[id] != nil
  136.       speed = R2_Shop_Scroll_Name::Shop_Speed
  137.       x = x + self.x
  138.       if cw > width
  139.         # draw the line as a scrolling line.
  140.         @r2_scrolling_shop_buy_text_line[id] = [text, speed, width, nil, [x, y], cw,
  141.           x, 0, nil]
  142.         r2_shop_scrolling_text_create(id, x, y, text, width)
  143.       end
  144.     end
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # * Scrolling Help Create.                                            [NEW]
  148.   #--------------------------------------------------------------------------
  149.   def r2_shop_scrolling_text_create(id, x, y, text, width)
  150.     # draw normal text if not at index position
  151.     buyitem = @data[@index].nil? ? -1 : @data[@index].id
  152.     if buyitem != id
  153.       text = text[0..(R2_Shop_Scroll_Name::Shop_length - 1)] + "..."
  154.       draw_text(x + 24, y, width, line_height, text)
  155.       return
  156.     end
  157.     # Create a Bitmap instance to draw the text into it.
  158.     line_bitmap = Bitmap.new(@r2_scrolling_shop_buy_text_line[id][5] + 24, calc_line_height(text))
  159.     # Save current Window's Bitmap.
  160.     original_contents = contents
  161.     # Set the recently created Bitmap as the Window's Bitmap.
  162.     self.contents = line_bitmap
  163.     # Use the default method to draw the text into it.
  164.     draw_text_ex(24, 0, text)
  165.     # Reset back the Window's Bitmap to the original one.
  166.     self.contents = original_contents
  167.     # Viewport for the Scrolling Line.
  168.     @r2_scrolling_shop_buy_text_line[id][8] = Viewport.new(
  169.       x + standard_padding + 24,
  170.       self.y + (@index - self.top_row) * 24 + standard_padding,
  171.       width, line_bitmap.height )
  172.     # Put the recently created Viewport on top of this Window.
  173.     @r2_scrolling_shop_buy_text_line[id][8].z = viewport ? viewport.z + 1 : z + 1
  174.     # Create a Plane instance for the scrolling effect.
  175.     @r2_scrolling_shop_buy_text_line[id][3] = Plane.new(@r2_scrolling_shop_buy_text_line[id][8])
  176.     # Assign the recently created Bitmap (where the line is drawn) to it.
  177.     @r2_scrolling_shop_buy_text_line[id][3].bitmap = line_bitmap
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # * Scrolling Help Dispose.                                           [NEW]
  181.   #--------------------------------------------------------------------------
  182.   def r2_shop_scrolling_text_dispose(id)
  183.     # Disposes Bitmap, Plane and Viewport.
  184.     if !@r2_scrolling_shop_buy_text_line[id][3].nil?
  185.       @r2_scrolling_shop_buy_text_line[id][3].bitmap.dispose
  186.       @r2_scrolling_shop_buy_text_line[id][3].dispose
  187.     end
  188.     # Prevents executing this method when the Plane (or Viewport) is disposed.
  189.     @r2_scrolling_shop_buy_text_line[id][3] = nil
  190.   end
  191.   #--------------------------------------------------------------------------
  192.   # * Dispose All values.                                               [NEW]
  193.   #--------------------------------------------------------------------------
  194.   def dispose_shopbuy_list
  195.     if @r2_scrolling_shop_buy_text_line != {}
  196.       @r2_scrolling_shop_buy_text_line.each do |key, entry|
  197.         r2_shop_scrolling_text_dispose(key)
  198.       end
  199.     end
  200.     @r2_scrolling_shop_buy_text_line = {}
  201.   end
  202.   #--------------------------------------------------------------------------
  203.   # * Dispose.                                                          [MOD]
  204.   #--------------------------------------------------------------------------
  205.   def dispose
  206.     # Dispose Scrolling Help objects if needed.
  207.     if @r2_scrolling_shop_buy_text_line != {}
  208.       dispose_shopbuy_list
  209.     end
  210.     @r2_scrolling_shop_buy_text_line = {}
  211.     # Original method.
  212.     super
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # * Refresh
  216.   #--------------------------------------------------------------------------
  217.   alias r2_refresh_dispose_scroll_text  refresh
  218.   def refresh
  219.     if @r2_scrolling_shop_buy_text_line != {}
  220.       dispose_shopbuy_list
  221.     end
  222.     @r2_scrolling_shop_buy_text_line = {}
  223.     r2_refresh_dispose_scroll_text
  224.   end
  225.   #--------------------------------------------------------------------------
  226.   # * Cursor Movement Processing
  227.   #--------------------------------------------------------------------------
  228.   alias r2_cursor_index_move_refresh_draw process_cursor_move
  229.   def process_cursor_move
  230.     last_index = @index
  231.     r2_cursor_index_move_refresh_draw
  232.     refresh if @index != last_index
  233.   end
  234. end
  235.  
  236. #==============================================================================
  237. # ** Window_ShopNumber
  238. #==============================================================================
  239.  
  240. class Window_ShopNumber < Window_Selectable
  241.  
  242.   #--------------------------------------------------------------------------
  243.   # * Object Initialization
  244.   #--------------------------------------------------------------------------
  245.   alias r2_shopnumber_text_scroll_init   initialize
  246.   def initialize(x, y, height)
  247.     @r2_scrolling_shop_number_text_line ||= {}
  248.     r2_shopnumber_text_scroll_init(x, y, height)
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # * Draw Item Name
  252.   #     enabled : Enabled flag. When false, draw semi-transparently.
  253.   #--------------------------------------------------------------------------
  254.   def draw_item_name(item, x, y, enabled = true, width = 175)
  255.     return unless item
  256.     draw_icon(item.icon_index, x, y, enabled)
  257.     change_color(normal_color, enabled)
  258.     dispose_number_buy
  259.     cw = contents.text_size(item.name).width
  260.     if cw < width
  261.       draw_text(x + 24, y, width, line_height, item.name)
  262.     else
  263.       set_text(item.id, x, y, item.name, width)
  264.     end
  265.   end
  266. #=============================================================================
  267.   #--------------------------------------------------------------------------
  268.   # * Update.                                                           [MOD]
  269.   #--------------------------------------------------------------------------
  270.   alias r2_update_shopnumber_text_scroll   update
  271.   def update
  272.     # Original method.
  273.     r2_update_shopnumber_text_scroll
  274.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  275.     # 4 - position {x,y}, 5 - text width, 6 - placement, 7 - direction <- ->
  276.     # 8 - viewport, 9 - type
  277.     return if @r2_scrolling_shop_number_text_line == {}
  278.     @r2_scrolling_shop_number_text_line.each do |id, data|
  279.       next if data[3].nil?
  280.       data[3].visible = visible
  281.       # Advance the image position
  282.       # Change the offset X to scroll.
  283.       if (data[7] == 0)
  284.         data[6] += (1.0 * data[1]).to_f
  285.         data[3].ox = data[6]
  286.       elsif (data[7] == 1)
  287.         data[6] -= (1.0 * data[1]).to_f
  288.         data[3].ox = data[6]
  289.       end
  290.       if data[6] >= (data[5] - (data[2] / 5 * 3) - 30)
  291.         data[7] = 1
  292.       elsif data[6] <= 10
  293.         data[7] = 0
  294.       end
  295.     end
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   # * Set Text.                                                         [REP]
  299.   #--------------------------------------------------------------------------
  300.   def set_text(id, x, y, text, width)
  301.     # New text?
  302.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  303.     # 4 - position, 5 - text width, 6 - placement, 7 - direction,
  304.     # 8 - viewport
  305.     cw = contents.text_size(text).width
  306.     if @r2_scrolling_shop_number_text_line.empty? || @r2_scrolling_shop_number_text_line[id].nil? ||
  307.         text != @r2_scrolling_shop_buy_text_line[id][1]
  308.       # Dispose the Scrolling Help objects if needed.
  309.       r2_scrolling_text_dispose(id) if @r2_scrolling_shop_number_text_line[id] != nil
  310.       speed = R2_Shop_Scroll_Name::Shop_Speed
  311.       x = x + self.x
  312.       if cw > width
  313.         # draw the line as a scrolling line.
  314.         @r2_scrolling_shop_number_text_line[id] = [text, speed, width, nil, [x, y], cw,
  315.           x, 0, nil]
  316.         r2_scrolling_text_create(id, x, y, text, width)
  317.       end
  318.     end
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # * Scrolling Help Create.                                            [NEW]
  322.   #--------------------------------------------------------------------------
  323.   def r2_scrolling_text_create(id, x, y, text, width)
  324.     # Create a Bitmap instance to draw the text into it.
  325.     line_bitmap = Bitmap.new(@r2_scrolling_shop_number_text_line[id][5] + 24, calc_line_height(text))
  326.     # Save current Window's Bitmap.
  327.     original_contents = contents
  328.     # Set the recently created Bitmap as the Window's Bitmap.
  329.     self.contents = line_bitmap
  330.     # Use the default method to draw the text into it.
  331.     draw_text_ex(24, 0, text)
  332.     # Reset back the Window's Bitmap to the original one.
  333.     self.contents = original_contents
  334.     # Viewport for the Scrolling Line.
  335.     @r2_scrolling_shop_number_text_line[id][8] = Viewport.new(
  336.       x + standard_padding + 24,
  337.       self.y + y + standard_padding,
  338.       width,
  339.       line_bitmap.height
  340.     )
  341.     # Put the recently created Viewport on top of this Window.
  342.     @r2_scrolling_shop_number_text_line[id][8].z = viewport ? viewport.z + 1 : z + 1
  343.     # Create a Plane instance for the scrolling effect.
  344.     @r2_scrolling_shop_number_text_line[id][3] = Plane.new(@r2_scrolling_shop_number_text_line[id][8])
  345.     # Assign the recently created Bitmap (where the line is drawn) to it.
  346.     @r2_scrolling_shop_number_text_line[id][3].bitmap = line_bitmap
  347.     @r2_scrolling_shop_number_text_line[id][3].visible = !visible
  348.   end
  349.   #--------------------------------------------------------------------------
  350.   # * Dispose All values.                                               [NEW]
  351.   #--------------------------------------------------------------------------
  352.   def dispose_number_buy
  353.     if !@r2_scrolling_shop_number_text_line.empty?
  354.       @r2_scrolling_shop_number_text_line.each do |key, entry|
  355.         # Disposes Bitmap, Plane and Viewport.
  356.         @r2_scrolling_shop_number_text_line[key][3].bitmap.dispose
  357.         @r2_scrolling_shop_number_text_line[key][3].dispose
  358.         # Prevents executing this method when the Plane (or Viewport) is disposed.
  359.         @r2_scrolling_shop_number_text_line[key] = nil
  360.       end
  361.     end
  362.     @r2_scrolling_shop_number_text_line = {}
  363.   end
  364.   #--------------------------------------------------------------------------
  365.   # * Dispose.                                                          [MOD]
  366.   #--------------------------------------------------------------------------
  367.   def dispose
  368.     # Dispose Scrolling Help objects if needed.
  369.     dispose_number_buy
  370.     @r2_scrolling_shop_number_text_line = {}
  371.     # Original method.
  372.     super
  373.   end
  374. end
  375.  
  376. #==============================================================================
  377. # ** Window_ShopStatus
  378. #==============================================================================
  379.  
  380. class Window_ShopStatus < Window_Base
  381.   #--------------------------------------------------------------------------
  382.   # * Object Initialization
  383.   #--------------------------------------------------------------------------
  384.   alias r2_shop_status_text_scroll_init   initialize
  385.   def initialize(x, y, width, height)
  386.     @r2_scrolling_shop_status_text_line ||= {}
  387.     r2_shop_status_text_scroll_init(x, y, width, height)
  388.   end
  389.   #--------------------------------------------------------------------------
  390.   # * Draw Item Name
  391.   #     enabled : Enabled flag. When false, draw semi-transparently.
  392.   #--------------------------------------------------------------------------
  393.   def draw_item_name(item, x, y, enabled = true, width = 175)
  394.     return unless item
  395.     draw_icon(item.icon_index, x, y, enabled)
  396.     change_color(normal_color, enabled)
  397.     cw = contents.text_size(item.name).width
  398.     if cw < width
  399.       draw_text(x + 24, y, width, line_height, item.name)
  400.     else
  401.       if TH::Instance_Items::Enable_Armors
  402.         set_text(item.id, x, y, item.name, width)
  403.       else
  404.         id = @r2_scrolling_shop_status_text_line.size
  405.         set_text(id, x, y, item.name, width)
  406.       end
  407.     end
  408.   end
  409. #=============================================================================
  410.   #--------------------------------------------------------------------------
  411.   # * Update.                                                           [MOD]
  412.   #--------------------------------------------------------------------------
  413.   alias r2_update_shop_status_text_scroll   update
  414.   def update
  415.     # Original method.
  416.     r2_update_shop_status_text_scroll
  417.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  418.     # 4 - position {x,y}, 5 - text width, 6 - placement, 7 - direction <- ->
  419.     # 8 - viewport
  420.     return if @r2_scrolling_shop_status_text_line.nil? || @r2_scrolling_shop_status_text_line.empty?
  421.     @r2_scrolling_shop_status_text_line.each do |id, data|
  422.       data[3].visible = visible
  423.       # Advance the image position
  424.       # Change the offset X to scroll.
  425.       if (data[7] == 0)
  426.         data[6] += (1.0 * data[1]).to_f
  427.         data[3].ox = data[6] - data[2] - 25
  428.       elsif (data[7] == 1)
  429.         data[6] -= (1.0 * data[1]).to_f
  430.         data[3].ox = data[6] - data[2] - 25
  431.       end
  432.       if (data[6] >= (data[5] + (data[2] / 5 * 2) ))
  433.         data[7] = 1
  434.       elsif (data[6] <= (data[5] - (data[2] / 5 * 3) - 10))
  435.         data[7] = 0
  436.       end
  437.     end
  438.   end
  439.   #--------------------------------------------------------------------------
  440.   # * Set Text.                                                         [REP]
  441.   #--------------------------------------------------------------------------
  442.   def set_text(id, x, y, text, width)
  443.     # New text?
  444.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  445.     # 4 - position, 5 - text width, 6 - placement, 7 - direction,
  446.     # 8 - viewport
  447.     @r2_scrolling_shop_status_text_line ||= {}
  448.     cw = contents.text_size(text).width
  449.     if @r2_scrolling_shop_status_text_line.empty? || @r2_scrolling_shop_status_text_line[id].nil? ||
  450.         text != @r2_scrolling_shop_status_text_line[id][1]
  451.       # Dispose the Scrolling Help objects if needed.
  452.       r2_shop_status_text_dispose(id) if @r2_scrolling_shop_status_text_line[id] != nil
  453.       speed = R2_Shop_Scroll_Name::Shop_Speed
  454.       x = x + self.x
  455.       if cw > width
  456.         # draw the line as a scrolling line.
  457.         @r2_scrolling_shop_status_text_line[id] = [text, speed, width, nil, [x, y], cw,
  458.           x, 0, nil]
  459.         r2_shop_status_scrolling_text_create(id, x, y, text, width)
  460.       end
  461.     end
  462.   end
  463.   #--------------------------------------------------------------------------
  464.   # * Scrolling Help Create.                                            [NEW]
  465.   #--------------------------------------------------------------------------
  466.   def r2_shop_status_scrolling_text_create(id, x, y, text, width)
  467.     # Create a Bitmap instance to draw the text into it.
  468.     line_bitmap = Bitmap.new(@r2_scrolling_shop_status_text_line[id][5] + 24, calc_line_height(text))
  469.     # Save current Window's Bitmap.
  470.     original_contents = contents
  471.     # Set the recently created Bitmap as the Window's Bitmap.
  472.     self.contents = line_bitmap
  473.     # Use the default method to draw the text into it.
  474.     draw_text_ex(24, 0, text)
  475.     # Reset back the Window's Bitmap to the original one.
  476.     self.contents = original_contents
  477.     # Viewport for the Scrolling Line.
  478.     @r2_scrolling_shop_status_text_line[id][8] = Viewport.new(
  479.       x + standard_padding + 24,
  480.       self.y + y + standard_padding,
  481.       width,
  482.       line_bitmap.height
  483.     )
  484.     # Put the recently created Viewport on top of this Window.
  485.     @r2_scrolling_shop_status_text_line[id][8].z = viewport ? viewport.z + 1 : z + 1
  486.     # Create a Plane instance for the scrolling effect.
  487.     @r2_scrolling_shop_status_text_line[id][3] = Plane.new(@r2_scrolling_shop_status_text_line[id][8])
  488.     # Assign the recently created Bitmap (where the line is drawn) to it.
  489.     @r2_scrolling_shop_status_text_line[id][3].bitmap = line_bitmap
  490.     @r2_scrolling_shop_status_text_line[id][3].visible = !visible
  491.   end
  492.   #--------------------------------------------------------------------------
  493.   # * Dispose.                                                          [MOD]
  494.   #--------------------------------------------------------------------------
  495.   def dispose
  496.     # Dispose Scrolling Help objects if needed.
  497.     if @r2_scrolling_shop_status_text_line != {}
  498.       @r2_scrolling_shop_status_text_line.each do |key, entry|
  499.         # Disposes Bitmap, Plane and Viewport.
  500.         @r2_scrolling_shop_status_text_line[key][3].bitmap.dispose
  501.         @r2_scrolling_shop_status_text_line[key][3].dispose
  502.         # Prevents executing this method when the Plane (or Viewport) is disposed.
  503.         @r2_scrolling_shop_status_text_line[key][3] = nil
  504.       end
  505.     end
  506.     @r2_scrolling_shop_status_text_line = {}
  507.     # Original method.
  508.     super
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # * Scrolling Help Dispose.                                           [NEW]
  512.   #--------------------------------------------------------------------------
  513.   def r2_shop_status_text_dispose(id)
  514.     # Disposes Bitmap, Plane and Viewport.
  515.     if !@r2_scrolling_shop_status_text_line[id][3].nil?
  516.       @r2_scrolling_shop_status_text_line[id][3].bitmap.dispose
  517.       @r2_scrolling_shop_status_text_line[id][3].dispose
  518.     end
  519.     # Prevents executing this method when the Plane (or Viewport) is disposed.
  520.     @r2_scrolling_shop_status_text_line[id][3] = nil
  521.   end
  522.   #--------------------------------------------------------------------------
  523.   # * Dispose All values.                                               [NEW]
  524.   #--------------------------------------------------------------------------
  525.   def dispose_shopstatus_list
  526.     if @r2_scrolling_shop_status_text_line != {}
  527.       @r2_scrolling_shop_status_text_line.each do |key, entry|
  528.         r2_shop_status_text_dispose(key)
  529.       end
  530.     end
  531.     @r2_scrolling_shop_status_text_line = {}
  532.   end
  533.   #--------------------------------------------------------------------------
  534.   # * Refresh
  535.   #--------------------------------------------------------------------------
  536.   alias r2_refresh_dispose_scroll_text  refresh
  537.   def refresh
  538.     dispose_shopstatus_list
  539.     r2_refresh_dispose_scroll_text
  540.   end
  541. end
  542.  
  543. #==============================================================================
  544. # ** Scene_Shop
  545. #==============================================================================
  546.  
  547. class Scene_Shop < Scene_MenuBase
  548.   #--------------------------------------------------------------------------
  549.   # * Sell [Cancel]
  550.   #--------------------------------------------------------------------------
  551.   alias r2_shop_sell_refresh_cancel on_sell_cancel
  552.   def on_sell_cancel
  553.     r2_shop_sell_refresh_cancel
  554.     @sell_window.refresh
  555.   end
  556. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement