Advertisement
roninator2

Yanfly Menu Cursor Addon - Windows

Dec 8th, 2024
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.31 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Menu Cursor Addon v1.00
  4. # -- Last Updated: 2023.12.10
  5. # -- Level: Easy
  6. # -- Requires: YEA Menu Cursor
  7. # -- by Roninator2
  8. #==============================================================================
  9. #==============================================================================
  10. # ▼ Updates
  11. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  12. # 2023.12.10 - Started Script and Finished.
  13. #
  14. #==============================================================================
  15. # ▼ Introduction
  16. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  17. # This is an addon to Yanfly's Menu Cursor script for Window Message
  18. # choice list, number input and select key item
  19. #
  20. #==============================================================================
  21.  
  22. class Window_Message < Window_Base
  23.   #--------------------------------------------------------------------------
  24.   # * Create All Windows
  25.   #--------------------------------------------------------------------------
  26.   alias r2_create_curosr_all_windows    create_all_windows
  27.   def create_all_windows
  28.     r2_create_curosr_all_windows
  29.     create_menu_cursors
  30.   end
  31.   #--------------------------------------------------------------------------
  32.   # * Free All Windows
  33.   #--------------------------------------------------------------------------
  34.   alias r2_dispose_cursor_all_windows   dispose_all_windows
  35.   def dispose_all_windows
  36.     dispose_menu_cursors
  37.     r2_dispose_cursor_all_windows
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # * Update All Windows
  41.   #--------------------------------------------------------------------------
  42.   alias r2_update_cursor_all_windows    update_all_windows
  43.   def update_all_windows
  44.     r2_update_cursor_all_windows
  45.     update_menu_cursors
  46.   end
  47.   #--------------------------------------------------------------------------
  48.   # new method: create_menu_cursors
  49.   #--------------------------------------------------------------------------
  50.   def create_menu_cursors
  51.     @menu_cursors ||= []
  52.     instance_variables.each do |varname|
  53.       ivar = instance_variable_get(varname)
  54.       create_cursor_sprite(ivar) if ivar.is_a?(Window_ChoiceList)
  55.       create_cursor_sprite(ivar) if ivar.is_a?(Window_NumberInput)
  56.       create_cursor_sprite(ivar) if ivar.is_a?(Window_KeyItem)
  57.     end
  58.   end
  59.   #--------------------------------------------------------------------------
  60.   # new method: create_cursor_sprite
  61.   #--------------------------------------------------------------------------
  62.   def create_cursor_sprite(window)
  63.     @menu_cursors.push(Sprite_MenuCursor.new(window))
  64.   end
  65.   #--------------------------------------------------------------------------
  66.   # new method: dispose_menu_cursors
  67.   #--------------------------------------------------------------------------
  68.   def dispose_menu_cursors
  69.     @menu_cursors.each { |cursor| cursor.dispose }
  70.   end
  71.   #--------------------------------------------------------------------------
  72.   # new method: update_menu_cursors
  73.   #--------------------------------------------------------------------------
  74.   def update_menu_cursors
  75.     @menu_cursors.each { |cursor| cursor.update }
  76.   end
  77. end
  78.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement