IceDragon200

FRV-SkillMenu

Jun 4th, 2011
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.65 KB | None | 0 0
  1. # // Last Modified :06/08/2011
  2. #==============================================================================#
  3. # Window_FaceTab
  4. #==============================================================================#
  5. class Window_FaceTab < IRS::Sprite_FaceTab
  6.   #--------------------------------------------------------------------------#
  7.   # * super method :draw_background
  8.   #--------------------------------------------------------------------------#  
  9.   def draw_background()
  10.     super() # // Comment out to remove black background
  11.   end  
  12.  
  13. end
  14.  
  15. #==============================================================================#
  16. # Window_FaceTabs
  17. #==============================================================================#
  18. class Window_FaceTabs < FRV::Container_Base # // Container
  19.  
  20.   attr_accessor :active_index
  21.   #--------------------------------------------------------------------------#
  22.   # * super method :initialize
  23.   #--------------------------------------------------------------------------#  
  24.   def initialize( x, y, active_index )
  25.     super( x, y )
  26.     @active_index = active_index
  27.     @tabs = []
  28.     @spacing = 116
  29.     for i in 0...$game_party.members.size
  30.       mem = $game_party.members[i]
  31.       @tabs << Window_FaceTab.new( mem, 0, 0, 112, 32 )
  32.     end  
  33.     @width = @x+(@tabs.size*@spacing)
  34.     update()
  35.   end
  36.  
  37.   #--------------------------------------------------------------------------#
  38.   # * super method :x=
  39.   #--------------------------------------------------------------------------#  
  40.   def x=( new_x )
  41.     super( new_x )
  42.     for i in 0...@tabs.size()
  43.       tab = @tabs[i]
  44.       tab.x = @x+(i*@spacing)
  45.     end
  46.   end
  47.  
  48.   #--------------------------------------------------------------------------#
  49.   # * super method :y=
  50.   #--------------------------------------------------------------------------#    
  51.   def y=( new_y )
  52.     super( new_y )
  53.     for i in 0...@tabs.size()
  54.       tab = @tabs[i]
  55.       tab.y = @y
  56.     end
  57.   end
  58.  
  59.   #--------------------------------------------------------------------------#
  60.   # * super method :z=
  61.   #--------------------------------------------------------------------------#    
  62.   def z=( new_z )
  63.     super( new_z )
  64.     for i in 0...@tabs.size()
  65.       tab = @tabs[i]
  66.       tab.z = @z
  67.     end
  68.   end
  69.  
  70.   #--------------------------------------------------------------------------#
  71.   # * new method :dispose
  72.   #--------------------------------------------------------------------------#    
  73.   def dispose()
  74.     @tabs.each { |tab| tab.dispose }
  75.     @tabs.clear()
  76.   end
  77.  
  78.   #--------------------------------------------------------------------------#
  79.   # * new method :update
  80.   #--------------------------------------------------------------------------#    
  81.   def update()
  82.     for i in 0...@tabs.size()
  83.       tab = @tabs[i]
  84.       tab.x = @x+(i*@spacing)
  85.       tab.y = @y
  86.       tab.z = @z
  87.       tab.opacity = @active_index == i ? 255 : 128
  88.     end  
  89.     @width = @x+(@tabs.size*@spacing)
  90.   end
  91.  
  92. end  
  93.  
  94. #==============================================================================#
  95. # Window_SkillHelp
  96. #==============================================================================#
  97. class Window_SkillHelp < IRS::Sprite_Help ; end
  98.  
  99. #==============================================================================#
  100. # Scene_Skill
  101. #==============================================================================#
  102. class Scene_Skill < Scene_Base
  103.  
  104.   #--------------------------------------------------------------------------#
  105.   # * overwrite method :start
  106.   #--------------------------------------------------------------------------#
  107.   def start()
  108.     super()
  109.     create_menu_background()
  110.     @actor         = $game_party.members[@actor_index]
  111.     @viewport      = Viewport.new( 0, 0, Graphics.width, Graphics.height )
  112.     @help_window   = Window_SkillHelp.new( 0, 0, Graphics.width, 32 )
  113.     @help_window.viewport = @viewport
  114.     @status_window = Window_SkillStatus.new( 0, @help_window.height, @actor )
  115.     @status_window.viewport = @viewport
  116.     @skill_window  = Window_Skill.new( 0, @help_window.height + @status_window.height,
  117.      Graphics.width, Graphics.height - (@help_window.height + @status_window.height + 32)-32,
  118.      @actor )
  119.     @skill_window.viewport = @viewport
  120.     @skill_window.help_window = @help_window
  121.     @target_window = Window_MenuStatus.new( 0, 0 )
  122.     @inputhelp_window = Window_SkillHelp.new( 0, Graphics.height-32, Graphics.width, 32 )
  123.     @inputhelp_window.align = 1
  124.     @inputhelp_window.set_text("Use A and S to switch Characters")
  125.     @face_tabs_window = Window_FaceTabs.new( 0, @inputhelp_window.y - 32, @actor_index )
  126.     @face_tabs_window.x = (Graphics.width - @face_tabs_window.width) / 2
  127.     hide_target_window()
  128.     # // ----------------------------------------------------------------- // #
  129.     @menuback_sprite.bitmap = Cache.system( "Menu_background" )
  130.     @menuback_sprite.opacity= 255
  131.   end
  132.  
  133.   #--------------------------------------------------------------------------#
  134.   # * overwrite method :terminate
  135.   #--------------------------------------------------------------------------#
  136.   def terminate()
  137.     super()
  138.     dispose_menu_background()
  139.     @help_window.dispose()
  140.     @status_window.dispose()
  141.     @skill_window.dispose()
  142.     @target_window.dispose()
  143.     @inputhelp_window.dispose()
  144.     @face_tabs_window.dispose()
  145.   end
  146.  
  147.   #--------------------------------------------------------------------------#
  148.   # * alias method :update
  149.   #--------------------------------------------------------------------------#
  150.   alias :frv_skill_scn_update :update unless $@
  151.   def update()
  152.     @face_tabs_window.update()
  153.     frv_skill_scn_update()
  154.   end
  155.  
  156.   #--------------------------------------------------------------------------#
  157.   # * overwrite method :update_skill_selection
  158.   #--------------------------------------------------------------------------#
  159.   def update_skill_selection()
  160.     if Input.trigger?(Input::B)
  161.       Sound.play_cancel()
  162.       return_scene()
  163.     elsif Input.trigger?(Input::Y)
  164.       Sound.play_cursor()
  165.       next_actor()
  166.     elsif Input.trigger?(Input::X)
  167.       Sound.play_cursor()
  168.       prev_actor()
  169.     elsif Input.trigger?(Input::C)
  170.       @skill = @skill_window.skill()
  171.       if @skill != nil
  172.         @actor.last_skill_id = @skill.id
  173.       end
  174.       if @actor.skill_can_use?(@skill)
  175.         Sound.play_decision()
  176.         determine_skill()
  177.       else
  178.         Sound.play_buzzer()
  179.       end
  180.     end
  181.   end
  182.  
  183. end  
  184.  
  185. #=*==========================================================================*=#
  186. # ** END OF FILE
  187. #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment