Advertisement
LiTTleDRAgo

[RGSS/2/3] Scene Pause

Nov 6th, 2011
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.66 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  2. # [Xp/Vx-VxA] Scene Pause
  3. # Version: 1.22
  4. # Author : LiTTleDRAgo
  5. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  6. #==============================================================================
  7. # ○ Config Start
  8. #==============================================================================
  9.  
  10. module PAUSE
  11.   VX = defined?(Window_ActorCommand)
  12.   VXA = defined?(Window_BattleActor)
  13.   #--------------------------------------------------------------------------
  14.   # ○ Button Input
  15.   #--------------------------------------------------------------------------
  16.   BUTTON = Input::F8
  17.   #--------------------------------------------------------------------------
  18.   # ○ Map Tone
  19.   #--------------------------------------------------------------------------
  20.   RGB   = [-23, -23, -23]
  21.   #--------------------------------------------------------------------------
  22.   # ○ Position
  23.   #--------------------------------------------------------------------------
  24.   XY     = VX ? [220,158] : [270,208]
  25.   WIDTH  = 100
  26.   HEIGHT = 64
  27.   #--------------------------------------------------------------------------
  28.   # ○ Graphic Related
  29.   #--------------------------------------------------------------------------
  30.   OPACITY  = 160
  31.   TEXT     = "     PAUSE     "
  32.   START_SE = "007-System07"
  33.   END_SE   = "008-System08"
  34. end
  35. #==============================================================================
  36. # ○ Config End
  37. #==============================================================================
  38.  
  39.  
  40.  
  41. #==============================================================================
  42. # ■ Scene_Map
  43. #==============================================================================
  44. class Scene_Map
  45.   #--------------------------------------------------------------------------
  46.   # ○ Initialize
  47.   #--------------------------------------------------------------------------
  48.   alias drg77_init initialize unless method_defined?(:drg77_init)
  49.   def initialize
  50.     drg77_init
  51.     $game_screen = Game_Screen.new if $game_screen.nil?
  52.     $game_screen.start_tone_change(Tone.new($game_system.scene_pause[0],
  53.                  $game_system.scene_pause[1], $game_system.scene_pause[2]), 0)
  54.   end
  55.   #--------------------------------------------------------------------------
  56.   # ● Frem Updet
  57.   #--------------------------------------------------------------------------
  58.   alias drg77_update update unless method_defined?(:drg77_update)
  59.   def update
  60.     if Input.trigger?(PAUSE::BUTTON)
  61.       unless (!$game_system.map_interpreter.nil? &&
  62.              $game_system.map_interpreter.running?) or
  63.              $game_system.menu_disabled
  64.         $game_player.straighten
  65.         PAUSE::VXA ? SceneManager.call(Scene_Pause) : $scene = Scene_Pause.new
  66.         Audio.se_play("Audio/SE/" + PAUSE::START_SE) rescue nil
  67.         $game_system.scene_pause[0] = $game_screen.tone.red
  68.         $game_system.scene_pause[1] = $game_screen.tone.green
  69.         $game_system.scene_pause[2] = $game_screen.tone.blue
  70.         $game_screen.start_tone_change(Tone.new(PAUSE::RGB[0],
  71.            PAUSE::RGB[1], PAUSE::RGB[2]), 0)
  72.         return
  73.       end
  74.     end
  75.     drg77_update
  76.   end
  77. end
  78.  
  79. #==============================================================================
  80. # □ Window_Pause
  81. #==============================================================================
  82. class Window_Pause < Window_Base
  83.   #--------------------------------------------------------------------------
  84.   # ○ Initialize
  85.   #--------------------------------------------------------------------------
  86.   def initialize
  87.     super(PAUSE::XY[0], PAUSE::XY[1], PAUSE::WIDTH, PAUSE::HEIGHT)
  88.     self.contents   = Bitmap.new(width - 32, height - 32)
  89.     self.contents.font.name = 'Calibri'
  90.     self.contents.font.size = 18
  91.     self.opacity    = 160
  92.     refresh
  93.   end
  94.   #--------------------------------------------------------------------------
  95.   # ○ Refresh
  96.   #--------------------------------------------------------------------------
  97.   def refresh
  98.     self.contents.clear
  99.     self.contents.draw_text(0, 0, PAUSE::XY[0], 32, PAUSE::TEXT,0)
  100.   end
  101. end
  102.  
  103. #==============================================================================
  104. # □ Scene_Pause
  105. #==============================================================================
  106. class Scene_Pause
  107.   #--------------------------------------------------------------------------
  108.   # ○ main
  109.   #--------------------------------------------------------------------------
  110.   def main
  111.     start
  112.     Graphics.transition
  113.     while scene == self
  114.       [Graphics,Input].each {|i| i.update }
  115.       update
  116.     end
  117.     Graphics.freeze
  118.     terminate
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ○ scene
  122.   #--------------------------------------------------------------------------
  123.   def scene() PAUSE::VXA ? SceneManager.scene : $scene end
  124.   #--------------------------------------------------------------------------
  125.   # ○ start
  126.   #--------------------------------------------------------------------------
  127.   def start
  128.     @text      = Window_Pause.new
  129.     @spriteset = Spriteset_Map.new
  130.     @temp      = Graphics.frame_count
  131.   end
  132.   #--------------------------------------------------------------------------
  133.   # ○ frem updet
  134.   #--------------------------------------------------------------------------
  135.   def update
  136.     if Input.trigger?(PAUSE::BUTTON)
  137.       PAUSE::VXA ? SceneManager.call(Scene_Map) : $scene = Scene_Map.new
  138.       Audio.se_play("Audio/SE/" + PAUSE::END_SE) rescue nil
  139.     end
  140.   end
  141.   #--------------------------------------------------------------------------
  142.   # ○ termination
  143.   #--------------------------------------------------------------------------
  144.   def terminate
  145.     @spriteset.dispose
  146.     @text.dispose
  147.     Graphics.frame_count = @temp
  148.   end
  149. end
  150. #==============================================================================
  151. # ■ Game_System
  152. #==============================================================================
  153. class Game_System
  154.   #--------------------------------------------------------------------------
  155.   # ● Public Instance Variables
  156.   #--------------------------------------------------------------------------
  157.   attr_reader :map_interpreter
  158.   attr_accessor :scene_pause
  159.   #--------------------------------------------------------------------------
  160.   # ● Initialize
  161.   #--------------------------------------------------------------------------
  162.   alias drg77_init initialize unless method_defined?(:drg77_init)
  163.   def initialize
  164.     drg77_init
  165.     @scene_pause = [0.0, 0.0, 0.0]
  166.   end
  167. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement