Advertisement
Guest User

Untitled

a guest
Jul 24th, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.03 KB | None | 0 0
  1. module Animated_Menu
  2.   module Specs
  3.     #------------------------------------------------------------------------
  4.     # * Command Window Position & Size
  5.     #------------------------------------------------------------------------
  6.     Command_Window_X = 2
  7.     Command_Window_Y = 330
  8.     Command_Window_Z = 8
  9.     Command_Window_Height = 200
  10.     Command_Window_Width = 544
  11.  
  12.     #------------------------------------------------------------------------
  13.     # * Command Window Opacity & Back Opacity
  14.     #------------------------------------------------------------------------
  15.     Command_Window_Opacity = 0
  16.     Command_Window_Back_Opacity = 0
  17.  
  18.     #------------------------------------------------------------------------
  19.     # * Command Rect for Background
  20.     #------------------------------------------------------------------------
  21.     Command_Window_Rect_Width = 640
  22.     Command_Window_Rect_Height = 480
  23.     Command_Window_Spacing = 2
  24.  
  25.     #------------------------------------------------------------------------
  26.     # * Command Images
  27.     #------------------------------------------------------------------------
  28.  
  29.     Command_Window_Images = {
  30.    
  31.       "itemof" => { :ox => 0,  :oy => 0 },
  32.    
  33.       "saveof" => { :ox => 0, :oy => 0 },
  34.    
  35.       "outof" => { :ox => 0, :oy => 0 },
  36.      
  37.       "arataoff" => { :ox => 0, :oy => 0 }
  38.     }
  39.   end
  40. end
  41.  
  42. module U1G
  43. XPos      = 0         # The X Position of the Menu
  44. YPos      = 480       # The Y Position of the Menu
  45. Width     = 545       # The Width of the Menu
  46. Height    = 50         # The Height of the Menu
  47. ItemsComm = "Ite2134ms"   # The name of the Items Command
  48. SaveComm  = "Save"    # The name of the Save Command
  49. EquipComm = "Equip"   # The name of the Equip Command
  50. GEComm    = "Game End"# The name of the Game End Command
  51. end
  52.    
  53. #===============================================================================
  54. # END CUSTOMIZABLE SECTION
  55. #===============================================================================    
  56. class Window_U1G_Menu < Window_HorzCommand
  57.   include Animated_Menu::Specs
  58. #--------------------------------------------------------------------------
  59. # Loading Size Information
  60. #--------------------------------------------------------------------------
  61.   def initialize(x, y, width, height)
  62.    @window_width = width
  63.    @window_height = height
  64.    @command = {}
  65.    super(x, y)
  66. end
  67. #--------------------------------------------------------------------------
  68. # Loading Window Width
  69. #--------------------------------------------------------------------------
  70.   def window_width
  71.     @window_width
  72. end
  73. #--------------------------------------------------------------------------
  74. # Loading Window Height
  75. #--------------------------------------------------------------------------
  76. def window_height
  77.   @window_height
  78. end
  79.  
  80. #--------------------------------------------------------------------------
  81. # Making Command List
  82. #--------------------------------------------------------------------------
  83. def make_command_list
  84.   add_command(U1G::ItemsComm,  :item)
  85.   add_command(U1G::SaveComm,   :save)
  86.   add_command(U1G::EquipComm,  :equip)        
  87.   add_command(U1G::GEComm,     :game_end)
  88.     draw_command_images
  89. end
  90.  
  91.   def update
  92.     move_up
  93.     super
  94.   end
  95.  
  96.   def dispose
  97.     super
  98.     dispose_item_images if @command != nil
  99.   end
  100.  
  101.   def dispose_item_images
  102.     @command.each_key { |i|
  103.       @command[i].bitmap.dispose
  104.       @command[i].dispose
  105.     }
  106.   end
  107.     #--------------------------------------------------------------------------
  108.     # * Draw Command Image
  109.     #--------------------------------------------------------------------------
  110.   def draw_command_images
  111.     width = Command_Window_Rect_Width + Command_Window_Spacing
  112.     height = Command_Window_Rect_Height + Command_Window_Spacing
  113.     Command_Window_Images.each_key { |i|
  114.       @command[i] = Sprite.new
  115.       @command[i].bitmap = Cache.title1(i)
  116.       @command[i].ox = Command_Window_Images[i][:ox]
  117.       @command[i].oy = Command_Window_Images[i][:oy]
  118.     }
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # * Initialize Animation Method: Move Left for girl
  122.   #--------------------------------------------------------------------------
  123.  
  124.  
  125.   #--------------------------------------------------------------------------
  126.   # * Initialize Animation Method: Move Up
  127.   #--------------------------------------------------------------------------
  128.   def move_up
  129.     if self.y >= 40
  130.       case
  131.       when self.y > 40
  132.         self.y -= 3
  133.       end
  134.     end
  135.   end
  136. end
  137.  
  138.  
  139. class Scene_Map < Scene_Base
  140.  
  141. #--------------------------------------------------------------------------
  142. # "Initialazing" Menu
  143. #--------------------------------------------------------------------------
  144. alias :u1g_call_menu call_menu
  145.   def call_menu
  146.     u1g_call_menu
  147.     Sound.play_ok
  148.     SceneManager.call(Scene_U1G_Menu)
  149.     Window_MenuCommand::init_command_position
  150.   end  
  151. end
  152.      
  153. class Scene_U1G_Menu < Scene_MenuBase
  154. #--------------------------------------------------------------------------
  155. # Starting Menu
  156. #--------------------------------------------------------------------------
  157.   def start
  158.     super
  159.     create_command_window
  160.   end
  161. #--------------------------------------------------------------------------
  162. # Creating Commands
  163. #--------------------------------------------------------------------------
  164.   def create_command_window
  165.     @command_window = Window_U1G_Menu.new(U1G::XPos,U1G::YPos,U1G::Width,U1G::Height)
  166.     @command_window.set_handler(:item,      method(:command_item))
  167.     @command_window.set_handler(:save,      method(:command_save))
  168.     @command_window.set_handler(:equip,     method(:command_equip))
  169.     @command_window.set_handler(:game_end,  method(:command_game_end))
  170.     @command_window.set_handler(:cancel,    method(:return_scene))
  171.   end
  172. #--------------------------------------------------------------------------
  173. # Calling Items Scene
  174. #--------------------------------------------------------------------------
  175.   def command_item
  176.     SceneManager.call(Scene_Item)
  177. end
  178. #--------------------------------------------------------------------------
  179. # Calling Save Scene
  180. #--------------------------------------------------------------------------
  181.   def command_save
  182.     SceneManager.call(Scene_Save)
  183. end
  184. #---------------------------------------------------------------------------
  185. # Calling Equip Scene
  186. #--------------------------------------------------------------------------
  187.   def command_equip
  188.     SceneManager.call(Scene_Equip)
  189. end
  190. #--------------------------------------------------------------------------
  191. # Calling Game End Scene
  192. #--------------------------------------------------------------------------
  193.   def command_game_end
  194.     SceneManager.call(Scene_End)
  195. end
  196. #--------------------------------------------------------------------------
  197. # Continue Playing
  198. #--------------------------------------------------------------------------
  199.   def return_scene
  200.     SceneManager.call(Scene_Map)
  201.   end
  202. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement