Bigace360

Scene_Help [RMXP]

May 19th, 2012
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.52 KB | None | 0 0
  1. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  2. # ■ Scene_Help [RMXP]                                        
  3. # ■ Author: Bigace360  
  4. # ■ Version: 1.0
  5. # ■ Date: 5.19.2012
  6. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  7. #                                INTRODUCTION                                  #
  8. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  9. #    Creates a window that shows help information during game play anywhere.
  10. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  11. #                                  SECTIONS                                    #
  12. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  13. #  ■ Game_Objects
  14. # ** Module ACE::Help
  15. # ** Module Input
  16. #
  17. #  ■ Windows
  18. # ** Window_GameHelp
  19. #
  20. #  ■ Scenes
  21. # ** Scene_Help
  22. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  23. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  24. # ■ Module ACE::Help
  25. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  26. module ACE
  27.     module Help
  28.         #Window Opacity (1-255)
  29.         OPACITY = 255
  30.         #Titles of the help scene window
  31.         MAP_TITLE   = ' ■ Map Help'
  32.         MENU_TITLE  = ' ■ Menu Help'
  33.         # Map Window Text
  34.         MAP_WINDOW_TEXT = [
  35.             '● Open Menu:',
  36.             '● Interaction:',
  37.             '● Jump:',
  38.             '● Sprint:',
  39.             '● Minimap:'
  40.         ]
  41.         MAP_WINDOW_COMMANDS = [
  42.             'Press Esc or X',
  43.             'Press Enter or Space',
  44.             'Press A',
  45.             'Press S',
  46.             'Press D'
  47.         ]
  48.         # Menu Window Text
  49.         MENU_WINDOW_TEXT = [
  50.             '● Selection:',
  51.             '● Go Back:'
  52.         ]
  53.         MENU_WINDOW_COMMANDS = [
  54.             'Press Enter or Space',
  55.             'Press Esc or X'
  56.         ]      
  57.         #---------------------------------------------------------------------------
  58.         # Add scenes here that you want quick access blocked on. Example,
  59.         # Scene_Title, wouldn't want users to view achievements there. Kinda odd.
  60.         #---------------------------------------------------------------------------
  61.         Block_Scenes  = [Scene_Title]
  62.         #---------------------------------------------------------------------------
  63.         # If set to an Input key, it will open up a quick view window to view all
  64.         # achievements, can be opened up from anywhere, and doesn't interupt the
  65.         # current scene. Set to nil to turn it off.
  66.         #---------------------------------------------------------------------------
  67.         Quick_Access  = Input::A
  68.         #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  69.         # DO NOT TOUCH THESE LINES BELOW
  70.         #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
  71.         Keys_To_Scene = {  
  72.             Input::A => Scene_Map,
  73.             Input::B => Scene_Map  
  74.         }
  75.     end
  76. end
  77. #==============================================================================
  78. # ▼ WARNING!!!
  79. # Editting anything past this point may potentially result in causing computer
  80. # damage, incontinence, explosion of user's head, coma, death, and/or
  81. # halitosis so edit at your own risk.
  82. #==============================================================================
  83. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:#
  84. $ace_script = {} if $ace_script.nil?
  85. $ace_script['ACE Help Menu'] = true
  86. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:#
  87. module Input
  88.     include ACE::Help
  89.     class << self; alias ace_init_update update unless $@; end
  90.     def self.update_old; ace_init_update; end  
  91.     def self.check_blocked
  92.         Block_Scenes.each {|s| return true if $scene.is_a?(s)}
  93.         return false
  94.     end
  95.     def self.update
  96.         if Quick_Access != nil && Input.trigger?(Quick_Access) &&
  97.             @scene == nil && !self.check_blocked
  98.             $game_system.se_play($data_system.decision_se)
  99.             @scene = Scene_Help.new
  100.             @scene = nil
  101.         end
  102.         ace_init_update
  103.     end
  104. end
  105. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  106. # ■ Window_GameHelp
  107. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  108. class Window_GameHelp < Window_Base
  109.     include ACE::Help
  110.     def initialize
  111.         super(50, 50, contents_width, 380)
  112.         self.contents = Bitmap.new(width - 32, height - 32)
  113.         self.opacity, self.z = OPACITY, 10000
  114.         refresh
  115.     end
  116.     def refresh
  117.         self.contents.clear
  118.         self.contents.font.size = 28
  119.         $scene.is_a?(Scene_Map) ? scene_map : scene_menu
  120.         draw_horz_line(18)
  121.         draw_vert_line(125, 30)
  122.     end
  123.     def scene_map
  124.         title_text = MAP_TITLE
  125.         self.contents.draw_text(4, 0, contents_width, 32, title_text)
  126.         self.contents.font.size = 16
  127.         text    = MAP_WINDOW_TEXT
  128.         command = MAP_WINDOW_COMMANDS
  129.         self.contents.font.name, self.contents.font.bold = 'Verdana', true
  130.         subtitle
  131.         y = 10
  132.         text.each_index    {|i| self.contents.draw_text(0,   (40+y)+i*(y*2), contents_width, 20, text[i],0)}
  133.         self.contents.font.bold = false
  134.         command.each_index {|i| self.contents.draw_text(150, (40+y)+i*(y*2), contents_width, 20, command[i],0)}
  135.     end
  136.     def scene_menu
  137.         title_text = MENU_TITLE
  138.         self.contents.draw_text(4, 0, contents_width, 32, title_text)
  139.         self.contents.font.size = 16
  140.         text    = MENU_WINDOW_TEXT
  141.         command = MENU_WINDOW_COMMANDS
  142.         self.contents.font.name, self.contents.font.bold = 'Verdana', true
  143.         subtitle
  144.         y = 10
  145.         text.each_index    {|i| self.contents.draw_text(0,   (40+y)+i*(y*2), contents_width, 20, text[i],0)}
  146.         self.contents.font.bold = false
  147.         command.each_index {|i| self.contents.draw_text(150, (40+y)+i*(y*2), contents_width, 20, command[i],0)}
  148.     end
  149.     def subtitle
  150.         self.contents.draw_text(0, 32, contents_width, 24, '      Functions',0)
  151.         x2 = 120+contents.text_size('Function').width
  152.         self.contents.draw_text(x2, 32, contents_width, 24, 'Commands',0)
  153.     end
  154.     def contents_width; return 540; end
  155.     def draw_horz_line(y)
  156.         line_y = y + 24 / 2 - 1
  157.         self.contents.fill_rect(0, line_y, contents_width, 2, line_color)
  158.     end
  159.     def draw_vert_line(x,y)
  160.         line_y = y + 24 / 2 - 1
  161.         line_x = x + 24 / 2 - 1
  162.         self.contents.fill_rect(line_x, line_y, 2, 380, line_color)
  163.     end
  164.     def line_color
  165.         color = normal_color
  166.         color.alpha = 192
  167.         return color
  168.     end
  169. end
  170. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  171. # ■ Scene_Help
  172. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
  173. class Scene_Help
  174.     def initialize
  175.         @gamehelp_window = Window_GameHelp.new
  176.         loop do
  177.             Graphics.update
  178.             Input.update_old
  179.             update
  180.             if Input.trigger?(Input::B)
  181.                 $game_system.se_play($data_system.cancel_se)
  182.                 break
  183.             end
  184.         end
  185.         @gamehelp_window.dispose
  186.     end
  187.     def update; @gamehelp_window.update; end
  188. end
Advertisement
Add Comment
Please, Sign In to add comment