pigu_6

Yanfly| Command Window Icons

Nov 24th, 2012
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.10 KB | None | 0 0
  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. "New Game" => 224, # Title scene.
  58. "Continue" => 230, # Title scene.
  59. "Shutdown" => 368, # Title scene. Game End scene.
  60.  
  61. "Fight" => 386, # Battle scene.
  62. "Escape" => 328, # Battle scene.
  63. "Attack" => 116, # Battle scene.
  64. "Defend" => 506, # Battle scene.
  65.  
  66. "Special Skill" => 128, # Skill scene. Battle scene.
  67. "Magic" => 136, # Skill scene. Battle scene.
  68.  
  69. "Items" => 260, # Menu scene. Item scene. Battle scene.
  70. "Skills" => 143, # Menu scene.
  71. "Equipment" => 436, # Menu scene.
  72. "Status" => 121, # Menu scene.
  73. "Formation" => 12, # Menu scene.
  74. "Save" => 286, # Menu scene.
  75. "Game End" => 368, # Menu scene.
  76.  
  77. "Weapons" => 386, # Item scene.
  78. "Armors" => 436, # Item scene.
  79. "Key Items" => 243, # Item scene.
  80.  
  81. "To Title" => 224, # Game End scene.
  82. "Cancel" => 119, # Game End scene.
  83. } # Do not remove this.
  84.  
  85. end # COMMAND_WINDOW_ICONS
  86. end # YEA
  87.  
  88. #==============================================================================
  89. # ▼ Editting anything past this point may potentially result in causing
  90. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  91. # halitosis so edit at your own risk.
  92. #==============================================================================
  93.  
  94. #==============================================================================
  95. # ■ Window_Command
  96. #==============================================================================
  97.  
  98. class Window_Command < Window_Selectable
  99.  
  100. #--------------------------------------------------------------------------
  101. # new method: use_icon?
  102. #--------------------------------------------------------------------------
  103. def use_icon?(text)
  104. return YEA::COMMAND_WINDOW_ICONS::ICON_HASH.include?(text)
  105. end
  106.  
  107. #--------------------------------------------------------------------------
  108. # new method: command_icon
  109. #--------------------------------------------------------------------------
  110. def command_icon(text)
  111. return YEA::COMMAND_WINDOW_ICONS::ICON_HASH[text]
  112. end
  113.  
  114. #--------------------------------------------------------------------------
  115. # overwrite method: draw_item
  116. #--------------------------------------------------------------------------
  117. def draw_item(index)
  118. enabled = command_enabled?(index)
  119. change_color(normal_color, enabled)
  120. rect = item_rect_for_text(index)
  121. text = command_name(index)
  122. if use_icon?(text)
  123. draw_icon_text(rect.clone, text, alignment, enabled)
  124. else
  125. draw_text(rect, text, alignment)
  126. end
  127. end
  128.  
  129. #--------------------------------------------------------------------------
  130. # new method: draw_icon_text
  131. #--------------------------------------------------------------------------
  132. def draw_icon_text(rect, text, alignment, enabled)
  133. cw = text_size(text).width
  134. icon = command_icon(text)
  135. draw_icon(icon, rect.x, rect.y, enabled)
  136. rect.x += 24
  137. rect.width -= 24
  138. draw_text(rect, text, alignment)
  139. end
  140.  
  141. end # Window_Command
  142.  
  143. #==============================================================================
  144. #
  145. # ▼ End of File
  146. #
  147. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment