Advertisement
Guest User

scrpit

a guest
Dec 28th, 2015
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.20 KB | None | 0 0
  1. #_____________________________Menu item đơn giản_____________________________
  2. #
  3. #Nếu không biết thì không nên sửa script
  4. #Không được dùng cho dự án thương mại
  5. #Nhớ credit "Boss_RPG"
  6. #Chúc vui vẻ =))
  7.  
  8. class Window_ItemCategory < Window_HorzCommand
  9. #--------------------------------------------------------------------------
  10. # * Chiều ngang
  11. #--------------------------------------------------------------------------
  12. def window_width
  13. Graphics.width/2
  14. end
  15. #--------------------------------------------------------------------------
  16. # * số ô chứa các loại item (phía trên cửa sổ item)
  17. #--------------------------------------------------------------------------
  18. def col_max
  19. return 2
  20. end
  21. #--------------------------------------------------------------------------
  22. # * Các loại item (Ở đây chỉ có item và key item)
  23. # * Nếu thêm cần phải cho thêm ô để chứa (sửa ở phần script trên)
  24. #--------------------------------------------------------------------------
  25. def make_command_list
  26. add_command(Vocab::item, :item)
  27. add_command(Vocab::key_item, :key_item)
  28.  
  29. end
  30. end
  31.  
  32. class Window_ItemList < Window_Selectable
  33. #--------------------------------------------------------------------------
  34. # * Số cột của danh sách hiển thị item
  35. #--------------------------------------------------------------------------
  36. def col_max
  37. return 1
  38. end
  39. #--------------------------------------------------------------------------
  40. # * Hiển thị những gì trong danh sách item(lược bỏ phần weapon và armor)
  41. #--------------------------------------------------------------------------
  42. def include?(item)
  43. case @category
  44. when :item
  45. item.is_a?(RPG::Item) && !item.key_item?
  46. when :key_item
  47. item.is_a?(RPG::Item) && item.key_item?
  48. else
  49. false
  50. end
  51. end
  52. #--------------------------------------------------------------------------
  53. # * Hiển thị item (gồm icon và tên)
  54. #--------------------------------------------------------------------------
  55. def draw_item(index)
  56. item = @data[index]
  57. rect = item_rect(index)
  58. rect.width -= 4
  59. draw_item_name(item, rect.x, rect.y, enable?(item))
  60. if item.is_a?(RPG::Item) && !item.key_item?
  61. draw_item_number(rect, item)
  62. else
  63. false
  64. end
  65. end
  66. #--------------------------------------------------------------------------
  67. # * Hiển thị số lượng item
  68. #--------------------------------------------------------------------------
  69. def draw_item_number(rect, item)
  70. draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
  71. end
  72. end
  73.  
  74. class Scene_Item < Scene_ItemBase
  75. #--------------------------------------------------------------------------
  76. # * Bỏ phần miêu tả item đi
  77. #--------------------------------------------------------------------------
  78. def start
  79. super
  80. create_category_window
  81. create_item_window
  82. end
  83. #--------------------------------------------------------------------------
  84. # * Tạo cửa sổ hiển thị loại item (tức item và key item)
  85. #--------------------------------------------------------------------------
  86. def create_category_window
  87. @category_window = Window_ItemCategory.new
  88. @category_window.viewport = @viewport
  89. @category_window.y = 60
  90. @category_window.x = 135
  91. @category_window.set_handler(:ok, method(:on_category_ok))
  92. @category_window.set_handler(:cancel, method(:return_scene))
  93. end
  94. #--------------------------------------------------------------------------
  95. # * Tạo cửa sổ hiển thị danh sách item
  96. #--------------------------------------------------------------------------
  97. def create_item_window
  98. wy = @category_window.y + @category_window.height
  99. wh = Graphics.height - 200
  100. ww = Graphics.width
  101. @item_window = Window_ItemList.new(0, wy, ww/2, wh)
  102. @item_window.x = 135
  103. @item_window.viewport = @viewport
  104. @item_window.set_handler(:ok, method(:on_item_ok))
  105. @item_window.set_handler(:cancel, method(:on_item_cancel))
  106. @category_window.item_window = @item_window
  107. end
  108. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement