[Script] [ACE] [RGSS3] Icon Item Menu - Keikuro

Quang TrầnQuang Trần Posts: 258Registered
[size=x-large]Giới thiệu :[/size]
[size=medium]- Là bản cải tiến lỗ[/size][size=medium]i[/size][size=medium] của Simple[/size][size=medium] Item Men[/size][size=medium]u [/size] :D


[size=x-large]ScreenShot :[/size]

[size=x-large]
[/size]
[size=medium]PYstIEM.jpg[/size]

[size=medium]CcJXEJ8.jpg[/size]

[size=medium]mOkbrPQ.jpg[/size]
[size=x-large]
[/size]


[size=x-large]Script :[/size]

[size=medium]-Pastebinhttps://pastebin.com/raw/YQL839Hq[/size]

[size=medium]-TTC Paste[/size] :
#==============================================================================

# ▼ Icon Item Menu
#--April 14, 2017
#--By Keikuro (tranxuanquang)
#--Cre: XaiL System - Icon Item - Nickie

#==============================================================================
#==============================================================================
module KeiKuro
  # Có thể thay đổi
  Font.default_name = ["VL Gothic"]
  Font.default_size = 20
end

class Window_Kei < Window_Base
  # Do nothing
end

#==============================================================================
  #==============================================================================
  # Chỉnh sửa nội dung Window Help
  #==============================================================================
class Window_Help < Window_Base
  def set_item_help(item)
    if item
      new_line = "\n"
      icon = '\i' 
      name = '\c[2] »» '+ item.name + '\c[0]' 
      desc = item.description
      item_text = icon+name+new_line+desc
    else
      item_text = ""
    end
    set_text(item_text)
  end
end


#==============================================================================

class Window_ItemCategory < Window_HorzCommand
  #==============================================================================
  # Chiều rộng của danh mục
  #==============================================================================
  def window_width
    return Graphics.width/2
  end
  
  #==============================================================================
  # Số cột tối đa trong cửa sổ danh mục
  #==============================================================================
  def col_max
    return 2
  end
  
  #==============================================================================
  # Tạo các danh mục
  #==============================================================================
  def make_command_list
    add_command(Vocab::item, :item)
    add_command(Vocab::key_item, :key_item)
    add_command("All", :all)
  end
end

#==============================================================================

class Window_ItemList_Icon < Window_ItemList
  #==============================================================================
  # Kiểm tra Item thuộc danh mục nào?
  #==============================================================================
  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?
    when :all
      item.is_a?(RPG::Item)
    end
  end
  
  def col_max
    # // Số ô trong túi đồ
    return 6
  end

  def spacing
    # // Khoảng cách giữa các ô
    return 14
  end
  
  def item_width
    # // Chiều dài của ô
    return 30
  end
  
  def item_height
    # // Chiều rộng của ô.
    return 30
  end 
  
  def row_max
    # // Lấy giá trị row_max.
    return item_max
  end  
  
  def update_help
    # // Cập nhật bản chỉnh sửa của Window Help.
    @help_window.set_item_help(item)
  end
  
  def item_rect(index)
    rect = Rect.new
    rect.width = item_width
    rect.height = item_height
    rect.x = index % col_max * (item_width + spacing)
    rect.y = index / col_max * (item_height + spacing/2)
    rect
  end
  
  def page_row_max
    return 6
  end

  def draw_item(index)
    item = @data[index]
    if item
      rect = item_rect(index)
      draw_item_rect(index, item, rect, rect.x, rect.y)
      draw_item_number(rect, item) if $game_party.item_number(item) > 1
    end
  end
  
  def draw_item_icon(icon_index, x, y, enabled = true)
    bitmap = Cache.system("Iconset")
    rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
    contents.blt(x+2, y+2, bitmap, rect, enabled ? 255 : 75)
  end
  
  def draw_item_rect(index, item, rect, x, y)
    outline = rect.clone
    outline.width = rect.width + 1
    outline.height = rect.height + 1
    contents.fill_rect(outline,Color.new(255,255,255,80))
    color = Color.new(0,0,0,128) 
    contents.fill_rect(rect, color)
    draw_item_icon(item.icon_index, x + 1, y, enable?(item))
  end
  
  def check_color(color, enabled = true)
    contents.font.color.set(color)
    contents.font.color.alpha = 95 unless enabled
  end

  def draw_item_number(rect, item)
    rect.y += 8
    if $game_party.item_number(item) < 10
      rect.x -= 2
    end
    contents.font = Font.new(["Anklada™", "Verdana"], 16)
    check_color(Color.new(255,225,255), enable?(item))
    contents.font.bold = true
    contents.font.shadow = true
    contents.font.out_color = Color.new(0,0,0,255)
    draw_text(rect, sprintf("%2d", $game_party.item_number(item)), 1)
    reset_font_settings
  end

end

#==============================================================================
# Tạo các cửa sổ
#==============================================================================

class Scene_Item < Scene_ItemBase
  def start
    super
    create_kei
    create_help_window
    create_category_window
    create_item_window
  end
  #==============================================================================
  # Tạo Tiêu đề cho menu
  #==============================================================================
  def create_kei
    Font.default_bold = true
    wdth = Graphics.width / 3
    @WindowKei = Window_Kei.new((Graphics.width-wdth)/2,10,wdth,38)
    @WindowKei.viewport = @viewport
    @WindowKei.draw_text_ex(36,-4,"ITEM MENU")
  end  
  #==============================================================================
  # Tạo Category Window ( Cửa sổ danh mục)
  #==============================================================================
  def create_category_window
    Font.default_bold = false
    @category_window = Window_ItemCategory.new()
    @category_window.z = 0
    @category_window.x = @category_window.width / 2
    @category_window.y = @WindowKei.y + @WindowKei.height
    @category_window.set_handler(:ok, method(:on_category_ok))
    @category_window.set_handler(:cancel, method(:return_scene))
  end
  #==============================================================================
  # Tạo Item Window và Help Window
  #==============================================================================
  def create_item_window
    wy = @category_window.y + @category_window.height
    wh = Graphics.height - @category_window.height - 127
    @item_window = Window_ItemList_Icon.new((544/2)/2,wy,Graphics.width/2,wh)
    @item_window.viewport = @viewport
    @item_window.help_window = @help_window
    @help_window.x = (544 - Graphics.width + 160) / 2
    @help_window.y = wy + wh
    @help_window.width = Graphics.width - 160
    @help_window.height = Graphics.height - @help_window.y - 10
    @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


[size=x-large]Điều khoản sử dụng :[/size] [size=medium]Xài thoải mái  :D [/size]

Comments

  • sanggameboysanggameboy Posts: 1,943Registered
    Thiết kế hơi nhức mắt. Các dấu mũi tên nhiều quá. Các menu quá sát nhau, chẳng có khoảng trống nào luôn.
Sign In or Register to comment.