Advertisement
Demonicskyers

Edytowane Scene_Menu

Jul 13th, 2013
509
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.08 KB | None | 0 0
  1. #------------------------------------------------------------------------------
  2. #  EDYTOWANE SCENE_MENU
  3. #------------------------------------------------------------------------------
  4. # Wklejaj ten skrypt tylko z Dodatkowym Scene_Menu i jeżeli nie masz innych
  5. # skryptów na CMS.
  6. #==============================================================================
  7. # ** Scene_Menu
  8. #------------------------------------------------------------------------------
  9. #  This class performs menu screen processing.
  10. #==============================================================================
  11.  
  12. class Scene_Menu
  13.   #--------------------------------------------------------------------------
  14.   # * Object Initialization
  15.   #     menu_index : command cursor's initial position
  16.   #--------------------------------------------------------------------------
  17.   def initialize(menu_index = 0)
  18.     @menu_index = menu_index
  19.   end
  20.   #--------------------------------------------------------------------------
  21.   # * Main Processing
  22.   #--------------------------------------------------------------------------
  23.   def main
  24.     # Make command window
  25.     s1 = $data_system.words.item
  26.     s2 = $data_system.words.skill
  27.     s3 = $data_system.words.equip
  28.     s4 = "Status"
  29.     s5 = "Save"
  30.     s6 = "End Game"
  31.     @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6, s7])
  32.     @command_window.index = @menu_index
  33.     # If number of party members is 0
  34.     if $game_party.actors.size == 0
  35.       # Disable items, skills, equipment, and status
  36.       @command_window.disable_item(0)
  37.       @command_window.disable_item(1)
  38.       @command_window.disable_item(2)
  39.       @command_window.disable_item(3)
  40.     end
  41.     # If save is forbidden
  42.     if $game_system.save_disabled
  43.       # Disable save
  44.       @command_window.disable_item(4)
  45.     end
  46.     # Make play time window
  47.     @playtime_window = Window_PlayTime.new
  48.     @playtime_window.x = 0
  49.     @playtime_window.y = 315
  50.     # Make steps window
  51.     # Make gold window
  52.     @gold_window = Window_Gold.new
  53.     @gold_window.x = 0
  54.     @gold_window.y = 416
  55.     # Make status window
  56.     @status_window = Window_MenuStatus.new
  57.     @status_window.x = 160
  58.     @status_window.y = 0
  59.     # Execute transition
  60.     Graphics.transition
  61.     # Main loop
  62.     loop do
  63.       # Update game screen
  64.       Graphics.update
  65.       # Update input information
  66.       Input.update
  67.       # Frame update
  68.       update
  69.       # Abort loop if screen is changed
  70.       if $scene != self
  71.         break
  72.       end
  73.     end
  74.     # Prepare for transition
  75.     Graphics.freeze
  76.     # Dispose of windows
  77.     @command_window.dispose
  78.     @playtime_window.dispose
  79.    
  80.     @gold_window.dispose
  81.     @status_window.dispose
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # * Frame Update
  85.   #--------------------------------------------------------------------------
  86.   def update
  87.     # Update windows
  88.     @command_window.update
  89.     @playtime_window.update
  90.     @gold_window.update
  91.     @status_window.update
  92.     # If command window is active: call update_command
  93.     if @command_window.active
  94.       update_command
  95.       return
  96.     end
  97.     # If status window is active: call update_status
  98.     if @status_window.active
  99.       update_status
  100.       return
  101.     end
  102.   end
  103.   #--------------------------------------------------------------------------
  104.   # * Frame Update (when command window is active)
  105.   #--------------------------------------------------------------------------
  106.   def update_command
  107.     # If B button was pressed
  108.     if Input.trigger?(Input::B)
  109.       # Play cancel SE
  110.       $game_system.se_play($data_system.cancel_se)
  111.       # Switch to map screen
  112.       $scene = Scene_Map.new
  113.       return
  114.     end
  115.     # If C button was pressed
  116.     if Input.trigger?(Input::C)
  117.       # If command other than save or end game, and party members = 0
  118.       if $game_party.actors.size == 0 and @command_window.index < 4
  119.         # Play buzzer SE
  120.         $game_system.se_play($data_system.buzzer_se)
  121.         return
  122.       end
  123.       # Branch by command window cursor position
  124.       case @command_window.index
  125.       when 0  # item
  126.         # Play decision SE
  127.         $game_system.se_play($data_system.decision_se)
  128.         # Switch to item screen
  129.         $scene = Scene_Item.new
  130.       when 1  # skill
  131.         # Play decision SE
  132.         $game_system.se_play($data_system.decision_se)
  133.         # Make status window active
  134.         @command_window.active = false
  135.         @status_window.active = true
  136.         @status_window.index = 0
  137.       when 2  # equipment
  138.         # Play decision SE
  139.         $game_system.se_play($data_system.decision_se)
  140.         # Make status window active
  141.         @command_window.active = false
  142.         @status_window.active = true
  143.         @status_window.index = 0
  144.       when 3  # status
  145.         # Play decision SE
  146.         $game_system.se_play($data_system.decision_se)
  147.         # Make status window active
  148.         @command_window.active = false
  149.         @status_window.active = true
  150.         @status_window.index = 0
  151.       when 4  # save
  152.         $game_system.se_play($data_system.decision_se)
  153.         $game_temp.quest_menu_calling = true
  154.         $scene = Scene_Quests.new
  155.         # Play decision SE
  156.         $game_system.se_play($data_system.decision_se)
  157.         # Switch to save screen
  158.         $scene = Scene_Save.new
  159.       when 5  # end game
  160.         # Play decision SE
  161.         $game_system.se_play($data_system.decision_se)
  162.         # Switch to end game screen
  163.         $scene = Scene_End.new
  164.       end
  165.       return
  166.     end
  167.   end
  168.   #--------------------------------------------------------------------------
  169.   # * Frame Update (when status window is active)
  170.   #--------------------------------------------------------------------------
  171.   def update_status
  172.     # If B button was pressed
  173.     if Input.trigger?(Input::B)
  174.       # Play cancel SE
  175.       $game_system.se_play($data_system.cancel_se)
  176.       # Make command window active
  177.       @command_window.active = true
  178.       @status_window.active = false
  179.       @status_window.index = -1
  180.       return
  181.     end
  182.     # If C button was pressed
  183.     if Input.trigger?(Input::C)
  184.       # Branch by command window cursor position
  185.       case @command_window.index
  186.       when 1  # skill
  187.         # If this actor's action limit is 2 or more
  188.         if $game_party.actors[@status_window.index].restriction >= 2
  189.           # Play buzzer SE
  190.           $game_system.se_play($data_system.buzzer_se)
  191.           return
  192.         end
  193.         # Play decision SE
  194.         $game_system.se_play($data_system.decision_se)
  195.         # Switch to skill screen
  196.         $scene = Scene_Skill.new(@status_window.index)
  197.       when 2  # equipment
  198.         # Play decision SE
  199.         $game_system.se_play($data_system.decision_se)
  200.         # Switch to equipment screen
  201.         $scene = Scene_Equip.new(@status_window.index)
  202.       when 3  # status
  203.         # Play decision SE
  204.         $game_system.se_play($data_system.decision_se)
  205.         # Switch to status screen
  206.         $scene = Scene_Status.new(@status_window.index)
  207.       end
  208.       return
  209.     end
  210.   end
  211. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement