Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #_____________________________Menu item đơn giản_____________________________
- #
- #Nếu không biết thì không nên sửa script
- #Không được dùng cho dự án thương mại
- #Nhớ credit "Boss_RPG"
- #Chúc vui vẻ =))
- class Window_ItemCategory < Window_HorzCommand
- #--------------------------------------------------------------------------
- # * Chiều ngang
- #--------------------------------------------------------------------------
- def window_width
- Graphics.width/2
- end
- #--------------------------------------------------------------------------
- # * số ô chứa các loại item (phía trên cửa sổ item)
- #--------------------------------------------------------------------------
- def col_max
- return 2
- end
- #--------------------------------------------------------------------------
- # * Các loại item (Ở đây chỉ có item và key item)
- # * Nếu thêm cần phải cho thêm ô để chứa (sửa ở phần script trên)
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(Vocab::item, :item)
- add_command(Vocab::key_item, :key_item)
- end
- end
- class Window_ItemList < Window_Selectable
- #--------------------------------------------------------------------------
- # * Số cột của danh sách hiển thị item
- #--------------------------------------------------------------------------
- def col_max
- return 1
- end
- #--------------------------------------------------------------------------
- # * Hiển thị những gì trong danh sách item(lược bỏ phần weapon và armor)
- #--------------------------------------------------------------------------
- def include?(item)
- case @category
- when :item
- item.is_a?(RPG::Item) && !item.key_item?
- when :key_item
- item.is_a?(RPG::Item) && item.key_item?
- else
- false
- end
- end
- #--------------------------------------------------------------------------
- # * Hiển thị item (gồm icon và tên)
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- rect = item_rect(index)
- rect.width -= 4
- draw_item_name(item, rect.x, rect.y, enable?(item))
- if item.is_a?(RPG::Item) && !item.key_item?
- draw_item_number(rect, item)
- else
- false
- end
- end
- #--------------------------------------------------------------------------
- # * Hiển thị số lượng item
- #--------------------------------------------------------------------------
- def draw_item_number(rect, item)
- draw_text(rect, sprintf(":%2d", $game_party.item_number(item)), 2)
- end
- end
- class Scene_Item < Scene_ItemBase
- #--------------------------------------------------------------------------
- # * Bỏ phần miêu tả item đi
- #--------------------------------------------------------------------------
- def start
- super
- create_category_window
- create_item_window
- end
- #--------------------------------------------------------------------------
- # * Tạo cửa sổ hiển thị loại item (tức item và key item)
- #--------------------------------------------------------------------------
- def create_category_window
- @category_window = Window_ItemCategory.new
- @category_window.viewport = @viewport
- @category_window.y = 60
- @category_window.x = 135
- @category_window.set_handler(:ok, method(:on_category_ok))
- @category_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # * Tạo cửa sổ hiển thị danh sách item
- #--------------------------------------------------------------------------
- def create_item_window
- wy = @category_window.y + @category_window.height
- wh = Graphics.height - 200
- ww = Graphics.width
- @item_window = Window_ItemList.new(0, wy, ww/2, wh)
- @item_window.x = 135
- @item_window.viewport = @viewport
- @item_window.set_handler(:ok, method(:on_item_ok))
- @item_window.set_handler(:cancel, method(:on_item_cancel))
- @category_window.item_window = @item_window
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement