Guest User

Untitled

a guest
Jun 18th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.12 KB | None | 0 0
  1. #==============================================================================
  2. # ** Scene_Menu
  3. #------------------------------------------------------------------------------
  4. # This class performs the menu screen processing.
  5. #==============================================================================
  6.  
  7. class Scene_Menu < Scene_Base
  8. #--------------------------------------------------------------------------
  9. # * Object Initialization
  10. # menu_index : command cursor's initial position
  11. #--------------------------------------------------------------------------
  12. def initialize(menu_index = 0)
  13. @menu_index = menu_index
  14. end
  15. #--------------------------------------------------------------------------
  16. # * Start processing
  17. #--------------------------------------------------------------------------
  18. def start
  19. super
  20. create_menu_background
  21. create_command_window
  22. @gold_window = Window_Gold.new(0, 360)
  23. @status_window = Window_MenuStatus.new(160, 0)
  24. end
  25. #--------------------------------------------------------------------------
  26. # * Termination Processing
  27. #--------------------------------------------------------------------------
  28. def terminate
  29. super
  30. dispose_menu_background
  31. @command_window.dispose
  32. @gold_window.dispose
  33. @status_window.dispose
  34. end
  35. #--------------------------------------------------------------------------
  36. # * Frame Update
  37. #--------------------------------------------------------------------------
  38. def update
  39. super
  40. update_menu_background
  41. @command_window.update
  42. @gold_window.update
  43. @status_window.update
  44. if @command_window.active
  45. update_command_selection
  46. elsif @status_window.active
  47. update_actor_selection
  48. end
  49. end
  50. #--------------------------------------------------------------------------
  51. # * Create Command Window
  52. #--------------------------------------------------------------------------
  53. def create_command_window
  54. s1 = Vocab::item
  55. s2 = Vocab::skill
  56. s3 = Vocab::equip
  57. s4 = Vocab::status
  58. s5 = Vocab::save
  59. s6 = Vocab::game_end
  60. @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6])
  61. @command_window.index = @menu_index
  62. if $game_party.members.size == 0 # If number of party members is 0
  63. @command_window.draw_item(0, false) # Disable item
  64. @command_window.draw_item(1, false) # Disable skill
  65. @command_window.draw_item(2, false) # Disable equipment
  66. @command_window.draw_item(3, false) # Disable status
  67. end
  68. if $game_system.save_disabled # If save is forbidden
  69. @command_window.draw_item(4, false) # Disable save
  70. end
  71. end
  72. #--------------------------------------------------------------------------
  73. # * Update Command Selection
  74. #--------------------------------------------------------------------------
  75. def update_command_selection
  76. if Input.trigger?(Input::B)
  77. Sound.play_cancel
  78. $scene = Scene_Map.new
  79. elsif Input.trigger?(Input::C)
  80. if $game_party.members.size == 0 and @command_window.index < 4
  81. Sound.play_buzzer
  82. return
  83. elsif $game_system.save_disabled and @command_window.index == 4
  84. Sound.play_buzzer
  85. return
  86. end
  87. Sound.play_decision
  88. case @command_window.index
  89. when 0 # Item
  90. $scene = Scene_Item.new
  91. when 1,2,3 # Skill, equipment, status
  92. start_actor_selection
  93. when 4 # Save
  94. $scene = Scene_File.new(true, false, false)
  95. when 5 # End Game
  96. $scene = Scene_End.new
  97. end
  98. end
  99. end
  100. #--------------------------------------------------------------------------
  101. # * Start Actor Selection
  102. #--------------------------------------------------------------------------
  103. def start_actor_selection
  104. @command_window.active = false
  105. @status_window.active = true
  106. if $game_party.last_actor_index < @status_window.item_max
  107. @status_window.index = $game_party.last_actor_index
  108. else
  109. @status_window.index = 0
  110. end
  111. end
  112. #--------------------------------------------------------------------------
  113. # * End Actor Selection
  114. #--------------------------------------------------------------------------
  115. def end_actor_selection
  116. @command_window.active = true
  117. @status_window.active = false
  118. @status_window.index = -1
  119. end
  120. #--------------------------------------------------------------------------
  121. # * Update Actor Selection
  122. #--------------------------------------------------------------------------
  123. def update_actor_selection
  124. if Input.trigger?(Input::B)
  125. Sound.play_cancel
  126. end_actor_selection
  127. elsif Input.trigger?(Input::C)
  128. $game_party.last_actor_index = @status_window.index
  129. Sound.play_decision
  130. case @command_window.index
  131. when 1 # skill
  132. $scene = Scene_Skill.new(@status_window.index)
  133. when 2 # equipment
  134. $scene = Scene_Equip.new(@status_window.index)
  135. when 3 # status
  136. $scene = Scene_Status.new(@status_window.index)
  137. end
  138. end
  139. end
  140. end
Add Comment
Please, Sign In to add comment