Advertisement
roninator2

Syvkal Ring Menu Addon - Game End

Dec 5th, 2024
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.80 KB | None | 0 0
  1. # ╔═════════════════════════════════════╦════════════════════╗
  2. # ║ Title: Syvkal Game End Ring         ║  Version: 1.00     ║
  3. # ║ Author: Roninator2                  ║                    ║
  4. # ╠═════════════════════════════════════╬════════════════════╣
  5. # ║ Function:                           ║   Date Created     ║
  6. # ║    Add ring menu to game end menu   ╠════════════════════╣
  7. # ║                                     ║    02 Jan 2021     ║
  8. # ╚═════════════════════════════════════╩════════════════════╝
  9. # ╔══════════════════════════════════════════════════════════╗
  10. # ║ Using code from Syvkal's Ring Menu                       ║
  11. # ║ I created the game end screen menu                       ║
  12. # ║                                                          ║
  13. # ║ If other options are added, it will require changes.     ║
  14. # ║ Icons must be in the format of ''choice' + space + icon' ║
  15. # ║ example                                                  ║
  16. # ║ 'yes icon'.png or 'no icon'.png  - without quotes        ║
  17. # ╚══════════════════════════════════════════════════════════╝
  18. # ╔══════════════════════════════════════════════════════════╗
  19. # ║ Updates:                                                 ║
  20. # ║ 1.00 - 02 Jan 2021 - Initial publish                     ║
  21. # ╚══════════════════════════════════════════════════════════╝
  22. # ╔═════════════════════════════════════╗
  23. # ║ Terms of use:                       ║
  24. # ║ Follow the Original Authors terms   ║
  25. # ╚═════════════════════════════════════╝
  26. #==============================================================================
  27. # ** Window_GameEnd
  28. #------------------------------------------------------------------------------
  29. #  This window is for selecting Go to Title/Shut Down on the game over screen.
  30. #==============================================================================
  31. class Window_GameEnd < Window_Command
  32.   #--------------------------------------------------------------------------
  33.   # * Includes The Ring_Menu Module
  34.   #--------------------------------------------------------------------------
  35.   include Ring_Menu
  36.   #--------------------------------------------------------------------------
  37.   # * Object Initialization
  38.   #--------------------------------------------------------------------------
  39.   def initialize
  40.     super(0, 0)
  41.     @cx = $game_player.screen_x - 16
  42.     @cy = $game_player.screen_y - 28
  43.     @icons = []
  44.     @endcom = []
  45.     @list.clear
  46.     make_command_list
  47.     make_game_end_icons
  48.     select(0)
  49.     self.opacity = 0
  50.     @mode = :start
  51.     open
  52.     activate
  53.     refresh
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # * Update Cursor
  57.   #--------------------------------------------------------------------------
  58.   def update_cursor
  59.   end
  60.   #--------------------------------------------------------------------------
  61.   # * Refresh
  62.   #--------------------------------------------------------------------------
  63.   def refresh
  64.     super
  65.     @cx = $game_player.screen_x - 16
  66.     @cy = $game_player.screen_y - 28
  67.     rect = Rect.new(@cx - 254, @cy - 20, self.contents.width, line_height)
  68.     draw_text(rect, choice_name(index), 1)
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # * Determines if is moving
  72.   #--------------------------------------------------------------------------
  73.   def animation?
  74.     return @mode != :wait
  75.   end
  76.   #--------------------------------------------------------------------------
  77.   # * make_title_icons
  78.   #--------------------------------------------------------------------------
  79.   def make_game_end_icons
  80.     @endcom.each_with_index do |command, i|
  81.       @icons.push(Cache::picture(command + ' Icon'))
  82.       rect = Rect.new(self.x, self.y, @icons[i].width / 2, @icons[i].height / 2)
  83.       draw_item(x, y, i)
  84.     end
  85.   end
  86.   #--------------------------------------------------------------------------
  87.   # * Get Window Width
  88.   #--------------------------------------------------------------------------
  89.   def window_width
  90.     return Graphics.width
  91.   end
  92.   #--------------------------------------------------------------------------
  93.   # * Get Window Height
  94.   #--------------------------------------------------------------------------
  95.   def window_height
  96.     return Graphics.height
  97.   end
  98.   #--------------------------------------------------------------------------
  99.   # * Create Command List
  100.   #--------------------------------------------------------------------------
  101.   def make_command_list
  102.     @endcom = []
  103.     add_command(Vocab::to_title, :to_title)
  104.     add_command(Vocab::shutdown, :shutdown)
  105.     add_command(Vocab::cancel,   :cancel)
  106.     @endcom.push(Vocab::to_title)
  107.     @endcom.push(Vocab::shutdown)
  108.     @endcom.push(Vocab::cancel)
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # * Get Command Name
  112.   #--------------------------------------------------------------------------
  113.   def choice_name(index)
  114.     return if @endcom == nil
  115.     @endcom[index]
  116.   end
  117.   #--------------------------------------------------------------------------
  118.   # * Draw Item
  119.   #     x     : draw spot x-coordinate
  120.   #     y     : draw spot y-coordinate
  121.   #     i     : item number
  122.   #--------------------------------------------------------------------------
  123.   def draw_item(x, y, i)
  124.     return if @icons.nil?
  125.     rect = Rect.new(0, 0, @icons[i].width, @icons[i].height)
  126.     if i == index
  127.       self.contents.blt(x - rect.width/2, y - rect.height/2, @icons[i], rect )
  128.       unless command_enabled?(index)
  129.         self.contents.blt(x - rect.width/2, y - rect.height/2, ICON_DISABLE, rect )
  130.       end
  131.     else
  132.       self.contents.blt(x - rect.width/2, y - rect.height/2, @icons[i], rect, 128 )
  133.     end
  134.   end
  135. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement