设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2321|回复: 0
打印 上一主题 下一主题

[已经过期] 有谁 知道 这个脚本 可以不可以 外链 单张图标

[复制链接]

Lv2.观梦者

梦石
0
星屑
575
在线时间
1752 小时
注册时间
2008-11-7
帖子
1431
跳转到指定楼层
1
发表于 2012-8-18 13:09:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
像XP 一样 一张图标一张图标 的外链
  1. #==============================================================================
  2. #   XaiL System - Icon Item
  3. #   Author: Nicke
  4. #   Created: 09/04/2012
  5. #   Edited: 06/05/2012
  6. #   Version: 1.0b
  7. #==============================================================================
  8. # 介绍
  9. # -----------------------------------------------------------------------------
  10. # To install this script, open up your script editor and copy/paste this script
  11. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  12. #
  13. # This script changes the item list to display icons as items instead.
  14. # There is also a category feature which allows you to change the background
  15. # color of each items/weapons/armour etc.
  16. #
  17. # Right now there is a setup of 6 categories one being the default one.
  18. # You can easily edit the draw_item_rect method to add new ones.
  19. #
  20. # To setup a category for a item use the following code in the note field of the
  21. # item:
  22. # <category health>  
  23. # or
  24. # <category mana>
  25. # The above will only work if you did not edit the category list.
  26. #
  27. # *** Only for RPG Maker VX Ace. ***
  28. #==============================================================================
  29. ($imported ||= {})["XAIL-ICON-SKILLS"] = true
  30. module XAIL
  31.   module ICON_ITEM
  32.   #--------------------------------------------------------------------------#
  33.   # * 设置
  34.   #--------------------------------------------------------------------------#
  35.   # 字体 = [名称, 尺寸, 颜色, bold, 阴影]  
  36.     FONT = [["Anklada™", "Verdana"], 16, Color.new(255,225,255), true, true]

  37.   # 显示/隐藏选项的项目现场。
  38.   # DISPLAY = [show_显示_图标, 显示_名称, 显示_描述, 显示_耗材, 显示_数量]
  39.     DISPLAY = [true, true, true, true, true]

  40.     # If this is false every item will have the same default black color.
  41.   # NO_分类 = true/false
  42.     NO_CATEGORIES = true

  43.   end
  44. end
  45. # *** 不要修改下面的除非你知道你在做什么. ***
  46. #==============================================================================#
  47. # ** 窗口_帮助
  48. #==============================================================================#
  49. class Window_Help < Window_Base

  50.   def set_item_help(item)
  51.     # // 设置项目窗口帮助.
  52.     contents.font.name = XAIL::ICON_ITEM::FONT[0]
  53.     contents.font.bold = XAIL::ICON_ITEM::FONT[3]
  54.     contents.font.shadow = XAIL::ICON_ITEM::FONT[4]
  55.     contents.font.out_color = Color.new(0,0,0,255)
  56.     if item
  57.       icon = XAIL::ICON_ITEM::DISPLAY[0] ? '\i[' + item.icon_index.to_s + ']' : ""
  58.       name = XAIL::ICON_ITEM::DISPLAY[1] ? '\c[2] »» ' + item.name + '\c[0]' : ""
  59.       weight = $imported["XAIL-INVENTORY-WEIGHT"] ? weight = " - Weight #{item.weight}." : ""
  60.       if item.is_a?(RPG::Item) and XAIL::ICON_ITEM::DISPLAY[2]
  61.         consumable = item.consumable ? " (消耗)" : " (不消耗)"
  62.       else
  63.         consumable = ""
  64.       end
  65.       desc = XAIL::ICON_ITEM::DISPLAY[3] ? item.description : ""
  66.       new_line = "\n"
  67.       item_text = icon + name + consumable + weight + new_line + desc
  68.     else
  69.       item_text = ""
  70.     end
  71.     set_text(item_text)
  72.   end

  73. end
  74. #==============================================================================#
  75. # ** 窗口_项目表_图标
  76. #==============================================================================#
  77. class Window_ItemList_Icon < Window_ItemList

  78.   def col_max
  79.     # // 方法 to get col_max.
  80.     return 14
  81.   end

  82.   def spacing
  83.     # // 图标格的距离.
  84.     return 14
  85.   end

  86.   def item_width
  87.     # // 图标格的宽度.
  88.     return 32
  89.   end

  90.   def item_height
  91.     # // 图标格的高度.
  92.     return 32
  93.   end  

  94.   def row_max
  95.     # // 方法 to get row_max.
  96.     return item_max
  97.   end

  98.   def update_help
  99.     # // 更新的帮助信息.
  100.     @help_window.set_item_help(item)
  101.   end

  102.   def item_rect(index)
  103.     # // 绘制项目矩形.
  104.     rect = Rect.new
  105.     rect.width = item_width
  106.     rect.height = item_height
  107.     rect.x = index % col_max * (item_width + spacing)
  108.     rect.y = index / col_max * (item_height + 3)
  109.     rect
  110.   end

  111.   def page_row_max
  112.     # // 来确定页面行最大.
  113.     return 1
  114.   end

  115.   def scan_items(item)
  116.     # // 扫描注释的项目.
  117.     item.note.scan(/<category[:]*\s*(.+)>/i)
  118.     return $1 if !$1.nil?
  119.   end

  120.   def draw_item(index)
  121.     # // 重写绘制项目.
  122.     item = @data[index]
  123.     if item
  124.       rect = item_rect(index)
  125.       draw_item_rect(index, item, rect, rect.x, rect.y)
  126.       draw_item_number(rect, item) if $game_party.item_number(item) > 1 and XAIL::ICON_ITEM::DISPLAY[3]
  127.     end
  128.   end

  129.   def draw_item_icon(icon_index, x, y, enabled = true)
  130.     # // 绘制图标.
  131.     bitmap = Cache.system("Iconset")
  132.     rect = Rect.new(icon_index % 16 * 32, icon_index / 16 * 32, 32, 32) #24 图标大小
  133.     contents.blt(x, y, bitmap, rect, enabled ? 255 : 75)
  134.   end

  135.   def draw_item_rect(index, item, rect, x, y)
  136.     # // 绘制矩形.
  137.     outline = rect.clone
  138.     outline.width = rect.width + 1
  139.     outline.height = rect.height + 1
  140.     contents.fill_rect(outline,Color.new(255,255,255,80))
  141.     if XAIL::ICON_ITEM::NO_CATEGORIES
  142.       case scan_items(item)
  143.       when "health"
  144.         color = Color.new(150,0,0,45)
  145.       when "mana"
  146.         color = Color.new(0,0,150,45)
  147.       when "cure"
  148.        color = Color.new(0,130,0,45)
  149.       when "elixir"
  150.         color = Color.new(250,250,0,45)
  151.       when "herbs"
  152.         color = Color.new(0,215,0,45)
  153.       when nil  
  154.         color = Color.new(0,0,0,128)
  155.       else
  156.        color = Color.new(0,0,0,128)  
  157.       end
  158.     else
  159.       color = Color.new(0,0,0,128)
  160.     end
  161.     color = enable?(item) ? color : Color.new(0,0,0,128)
  162.     contents.fill_rect(rect, color)
  163.     draw_item_icon(item.icon_index, x + 1, y, enable?(item))
  164.   end

  165.   def check_color(color, enabled = true)
  166.      # // Method to set the color and alpha.
  167.     contents.font.color.set(color)
  168.     contents.font.color.alpha = 95 unless enabled
  169.   end

  170.   def draw_item_number(rect, item)
  171.     # // 方法绘制项目编号.
  172.     rect.y += 8
  173.     if $game_party.item_number(item) < 10
  174.       rect.x -= 2
  175.     end
  176.     contents.font = Font.new(XAIL::ICON_ITEM::FONT[0], XAIL::ICON_ITEM::FONT[1])
  177.     check_color(XAIL::ICON_ITEM::FONT[2], enable?(item))
  178.     contents.font.bold = XAIL::ICON_ITEM::FONT[3]
  179.     contents.font.shadow = XAIL::ICON_ITEM::FONT[4]
  180.     contents.font.out_color = Color.new(0,0,0,255)
  181.     draw_text(rect, sprintf("%2d", $game_party.item_number(item)), 1)
  182.     reset_font_settings
  183.   end

  184. end
  185. #==============================================================================#
  186. # ** 场景_项目
  187. #==============================================================================#
  188. class Scene_Item < Scene_ItemBase

  189.   def create_item_window
  190.     # // 方法重写创建项目列表窗口.
  191.     wy = @category_window.y + @category_window.height
  192.     wh = Graphics.height - wy
  193.     @item_window = Window_ItemList_Icon.new(0, wy, Graphics.width, wh)
  194.     @item_window.viewport = @viewport
  195.     @item_window.help_window = @help_window
  196.     @item_window.set_handler(:ok,     method(:on_item_ok))
  197.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  198.     @category_window.item_window = @item_window
  199.   end

  200. end # END OF FILE

  201. #=*==========================================================================*=#
  202. # ** END OF FILE
  203. #=*==========================================================================*=#
复制代码
RPG魔塔:http://rpg.blue/thread-254429-1-1.html
魔塔2:http://rpg.blue/thread-303601-1-1.html
魔塔3: 制作中...MV
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-28 15:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表