Project1

标题: 求一个自定义图标脚本 [打印本页]

作者: szcszc156    时间: 2015-4-8 10:01
标题: 求一个自定义图标脚本
图标脚本最好可以自定义大小,我现在是在用平行幻想曲的脚本
作者: 负零    时间: 2015-4-8 11:26
你说的图标是指所有的图标还是某一部分的图标,所有的图标可以通过默认脚本参数来修改。自己新系统或新绘制的内容举一反三。
作者: szcszc156    时间: 2015-4-9 20:39
负零 发表于 2015-4-8 11:26
你说的图标是指所有的图标还是某一部分的图标,所有的图标可以通过默认脚本参数来修改。自己新系统或新绘制 ...

我是说一部分,尽量不要太长。不然游戏太卡了
作者: 黄濑凉太    时间: 2015-4-9 20:47
本帖最后由 黄濑凉太 于 2015-4-9 16:48 编辑
szcszc156 发表于 2015-4-9 16:39
我是说一部分,尽量不要太长。不然游戏太卡了
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Command Window Icons v1.00
  4. # -- Last Updated: 2011.12.11
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-CommandWindowIcons"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2011.12.11 - Started Script and Finished.
  17. #
  18. #==============================================================================
  19. # ▼ Introduction
  20. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  21. # Here's a script that allows you to allocate icons to each of your commands
  22. # provided that the text for the command matches the icon in the script. There
  23. # are, however, some scripts that this won't be compatible with and it's due
  24. # to them using unique way of drawing out their commands. This script does not
  25. # maintain compatibility for those specific scripts.
  26. #
  27. #==============================================================================
  28. # ▼ Instructions
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # To install this script, open up your script editor and copy/paste this script
  31. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  32. #
  33. # Go to the module and match the text under ICON_HASH with a proper Icon ID.
  34. # You can find an icon's ID by opening up the icon select window in the RPG
  35. # Maker VX Ace database and look in the lower left corner.
  36. #
  37. #==============================================================================
  38. # ▼ Compatibility
  39. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  40. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  41. # it will run with RPG Maker VX without adjusting.
  42. #
  43. #==============================================================================
  44.  
  45. module YEA
  46.   module COMMAND_WINDOW_ICONS
  47.  
  48.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  49.     # - Icon Hash -
  50.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  51.     # This hash controls all of the icon data for what's used with each text
  52.     # item. Any text items without icons won't display icons. The text has to
  53.     # match with the hash (case sensitive) to display icons.
  54.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  55.     ICON_HASH ={
  56.     # Matching Text   => Icon ID,
  57.     "道具"      => 2723,    # Title scene.
  58.     "技能"      => 2736,
  59.     "装备"      => 2718,
  60.     "状态"      => 2737,
  61.     "手册"      => 2715,
  62.     "系统"      => 2739
  63.     } # Do not remove this.
  64.  
  65.   end # COMMAND_WINDOW_ICONS
  66. end # YEA
  67.  
  68. #==============================================================================
  69. # ▼ Editting anything past this point may potentially result in causing
  70. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  71. # halitosis so edit at your own risk.
  72. #==============================================================================
  73.  
  74. #==============================================================================
  75. # ■ Window_Command
  76. #==============================================================================
  77.  
  78. class Window_Command < Window_Selectable
  79.  
  80.   #--------------------------------------------------------------------------
  81.   # new method: use_icon?
  82.   #--------------------------------------------------------------------------
  83.   def use_icon?(text)
  84.     return YEA::COMMAND_WINDOW_ICONS::ICON_HASH.include?(text)
  85.   end
  86.  
  87.   #--------------------------------------------------------------------------
  88.   # new method: command_icon
  89.   #--------------------------------------------------------------------------
  90.   def command_icon(text)
  91.     return YEA::COMMAND_WINDOW_ICONS::ICON_HASH[text]
  92.   end
  93.  
  94.   #--------------------------------------------------------------------------
  95.   # overwrite method: draw_item
  96.   #--------------------------------------------------------------------------
  97.   def draw_item(index)
  98.     enabled = command_enabled?(index)
  99.     change_color(normal_color, enabled)
  100.     rect = item_rect_for_text(index)
  101.     text = command_name(index)
  102.     if use_icon?(text)
  103.       draw_icon_text(rect.clone, text, alignment, enabled)
  104.     else
  105.       draw_text(rect, text, alignment)
  106.     end
  107.   end
  108.  
  109.   #--------------------------------------------------------------------------
  110.   # new method: draw_icon_text
  111.   #--------------------------------------------------------------------------
  112.   def draw_icon_text(rect, text, alignment, enabled)
  113.     cw = text_size(text).width
  114.     icon = command_icon(text)
  115.     draw_icon(icon, rect.x, rect.y, enabled)
  116.     rect.x += 24
  117.     rect.width -= 24
  118.     draw_text(rect, text, alignment)
  119.   end
  120.  
  121. end # Window_Command
  122.  
  123. #==============================================================================
  124. #
  125. # ▼ End of File
  126. #
  127. #==============================================================================

大约55行可以定义图标,很简单
作者: szcszc156    时间: 2015-4-9 20:55
黄濑凉太 发表于 2015-4-9 20:47
#==============================================================================
#
# ▼ Yanfly Engin ...

谢谢了哦




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1