Project1

标题: 新人求教,菜单选项怎么添加图标? [打印本页]

作者: 元泱の蛮吉    时间: 2017-9-5 13:20
标题: 新人求教,菜单选项怎么添加图标?
https://rpg.blue/forum.php?mod=attachment&aid=MzMzNTQ5fGY5MjIxNzJhZmU2NTZiZmI2ZTBiM2MxZDk0NGNkMTI1fDE3MzE4MTU4Njg%3D&request=yes&_f=.png
在这个菜单里,给个选项前面或者后面加一个图标!

QQ图片20170905131941.png (27.93 KB, 下载次数: 27)

QQ图片20170905131941.png

作者: asftuhtygj    时间: 2017-9-5 17:33
我也不知道啊
作者: 午睡的风铃    时间: 2017-9-5 20:10
  1. #==============================================================================
  2. # ▼ Yanfly Engine Ace - Command Window Icons v1.00
  3. # -- Last Updated: 2011.12.11
  4. # -- Level: Normal
  5. # -- Requires: n/a
  6. #==============================================================================
  7. $imported = {} if $imported.nil?
  8. $imported["YEA-CommandWindowIcons"] = true
  9. #==============================================================================
  10. # ▼ Updates
  11. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  12. # 2011.12.11 - Started Script and Finished.
  13. #==============================================================================
  14. # ▼ Introduction
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # Here's a script that allows you to allocate icons to each of your commands
  17. # provided that the text for the command matches the icon in the script. There
  18. # are, however, some scripts that this won't be compatible with and it's due
  19. # to them using unique way of drawing out their commands. This script does not
  20. # maintain compatibility for those specific scripts.
  21. #==============================================================================
  22. # ▼ Instructions
  23. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  24. # To install this script, open up your script editor and copy/paste this script
  25. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  26. #
  27. # Go to the module and match the text under ICON_HASH with a proper Icon ID.
  28. # You can find an icon's ID by opening up the icon select window in the RPG
  29. # Maker VX Ace database and look in the lower left corner.
  30. #==============================================================================
  31. # ▼ Compatibility
  32. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  33. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  34. # it will run with RPG Maker VX without adjusting.
  35. #==============================================================================
  36. module YEA
  37.   module COMMAND_WINDOW_ICONS
  38.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  39.     # - Icon Hash -
  40.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  41.     # This hash controls all of the icon data for what's used with each text
  42.     # item. Any text items without icons won't display icons. The text has to
  43.     # match with the hash (case sensitive) to display icons.
  44.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  45.     ICON_HASH ={
  46.     # Matching Text   => Icon ID,
  47.       "开始"      => 224,    # Title scene.
  48.       "继续"      => 230,    # Title scene.
  49.       "退出"      => 368,    # Title scene. Game End scene.
  50.       "消除"      => 265,    # Title scene. Game End scene.
  51.       "周目"      => 243,    # Title scene. Game End scene.
  52.       
  53.       "战斗"         => 386,    # Battle scene.
  54.       "撤退"        => 328,    # Battle scene.
  55.       "特技"         => 128,    # Skill scene. Battle scene.
  56.       "魔法"         => 136,    # Skill scene. Battle scene.
  57.       
  58.       
  59.       "武器"         => 386,    # Item scene.
  60.       "防具"        => 436,    # Item scene.
  61.       "贵重物品"     => 243,    # Item scene.
  62.       
  63.       "再次挑战"      => 172,    # Title scene. Game End scene.
  64.       "回到标题"      => 224,    # Game End scene.
  65.       "取消"        => 119,    # Game End scene.
  66.     } # Do not remove this.
  67.    
  68.   end # COMMAND_WINDOW_ICONS
  69. end # YEA
  70. #==============================================================================
  71. # ■ Window_Command
  72. #==============================================================================
  73. class Window_Command < Window_Selectable
  74.   #--------------------------------------------------------------------------
  75.   # new method: use_icon?
  76.   #--------------------------------------------------------------------------
  77.   def use_icon?(text)
  78.     return YEA::COMMAND_WINDOW_ICONS::ICON_HASH.include?(text)
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # new method: command_icon
  82.   #--------------------------------------------------------------------------
  83.   def command_icon(text)
  84.     return YEA::COMMAND_WINDOW_ICONS::ICON_HASH[text]
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # overwrite method: draw_item
  88.   #--------------------------------------------------------------------------
  89.   def draw_item(index)
  90.     enabled = command_enabled?(index)
  91.     change_color(normal_color, enabled)
  92.     rect = item_rect_for_text(index)
  93.     text = command_name(index)
  94.     if use_icon?(text)
  95.       draw_icon_text(rect.clone, text, alignment, enabled)
  96.     else
  97.       draw_text(rect, text, alignment)
  98.     end
  99.   end
  100.   #--------------------------------------------------------------------------
  101.   # new method: draw_icon_text
  102.   #--------------------------------------------------------------------------
  103.   def draw_icon_text(rect, text, alignment, enabled)
  104.     cw = text_size(text).width
  105.     icon = command_icon(text)
  106.     draw_icon(icon, rect.x, rect.y, enabled)
  107.     rect.x += 24
  108.     rect.width -= 24
  109.     draw_text(rect, text, alignment)
  110.   end
  111. end
复制代码

作者: 大魔术师    时间: 2018-2-28 00:01
马克一下





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