dsiver144

Dark's Game Notes

Feb 27th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.40 KB | None | 0 0
  1. #===============================================================================
  2. # Script Name : Dark's Game Notes
  3. # Author      : Nhat Nguyen (Dark Sky)
  4. # Release Date: Feb 28 2016
  5. # Version     : 1.0
  6. # Infomation  : Provide a window for showing played time and current map name.
  7. # Facebook    : fb.com/princeloveless1999
  8. #-----------------------------------------------------------------------------
  9. # How to use:
  10. # Place this script below Materials and above Main.
  11. # To show the window: ( Script Call)
  12. # Show: darks_gamenotes_show
  13. # Hide: darks_gamenotes_hide
  14. #===============================================================================
  15.   module GameNotes
  16.    HUD_PICTURE      = "GameNotes" #Graphics/Pictures/...
  17.    HUD_NAME         = "Notes"
  18.    HUD_PLAYTIME_X   = 16
  19.    HUD_PLAYTIME_Y   = 364
  20.    HUD_MAPNAME_X    = 16
  21.    HUD_MAPNAME_Y    = 384
  22.    HUD_FONT_BOLD    = true
  23.    HUD_FONT_OUTLINE = false
  24.    HUD_FONT_SHADOW  = true
  25.   end
  26.  #==============================================================================
  27.  # Window_GameNotes
  28.  #==============================================================================
  29.   class Window_GameNotes < Window_Base
  30.     #--------------------------------------------------------------------------
  31.     # * Initialization
  32.     #--------------------------------------------------------------------------
  33.     def initialize(viewport)
  34.       super(0,0,544,416)
  35.       self.opacity = 0
  36.       self.back_opacity = 0
  37.       self.viewport = viewport
  38.       @sprite_hud = Sprite.new
  39.       @sprite_hud.bitmap = Cache.picture(GameNotes::HUD_PICTURE)
  40.       @sprite_hud.z = 100
  41.       @sprite_hud.visible = false
  42.       @sprite_hud.viewport = viewport
  43.       @hud_bitmap = Sprite.new
  44.       @hud_bitmap.bitmap = Bitmap.new(544,416)
  45.       @hud_bitmap.viewport = viewport
  46.       @hud_bitmap.z = 110
  47.       @hud_bitmap.visible = false
  48.       draw_info
  49.     end
  50.     #--------------------------------------------------------------------------
  51.     # * Draw Info
  52.     #--------------------------------------------------------------------------
  53.     def draw_info
  54.       @hud_bitmap.bitmap.clear
  55.       x1 = GameNotes::HUD_PLAYTIME_X
  56.       x2 = GameNotes::HUD_MAPNAME_X
  57.       y1 = GameNotes::HUD_PLAYTIME_Y
  58.       y2 = GameNotes::HUD_MAPNAME_Y
  59.       @hud_bitmap.bitmap.font.size = 18
  60.       @hud_bitmap.bitmap.font.bold = GameNotes::HUD_FONT_BOLD
  61.       @hud_bitmap.bitmap.font.outline = GameNotes::HUD_FONT_OUTLINE
  62.       @hud_bitmap.bitmap.font.shadow = GameNotes::HUD_FONT_SHADOW
  63.       @hud_bitmap.bitmap.draw_text(16, 344, 300, 32, GameNotes::HUD_NAME)
  64.       @hud_bitmap.bitmap.draw_text(x1,y1,300,32,$game_system.playtime_s)
  65.       @hud_bitmap.bitmap.draw_text(x2,y2,400,32,$game_map.display_name)
  66.     end
  67.     #--------------------------------------------------------------------------
  68.     # * Dispose Method
  69.     #--------------------------------------------------------------------------
  70.     def dispose
  71.       super
  72.       @sprite_hud.bitmap.dispose
  73.       @sprite_hud.dispose
  74.       @hud_bitmap.bitmap.dispose
  75.       @hud_bitmap.dispose
  76.     end
  77.     #--------------------------------------------------------------------------
  78.     # * Update Method
  79.     #--------------------------------------------------------------------------
  80.     def update
  81.       super
  82.       if !@sprite_hud.disposed?
  83.         draw_info
  84.         @sprite_hud.viewport = self.viewport
  85.         @hud_bitmap.viewport = self.viewport
  86.         @hud_bitmap.visible = @sprite_hud.visible = !$game_system.game_notes_disable
  87.       end
  88.     end
  89.   end
  90.  #==============================================================================
  91.  # Game_System
  92.  #==============================================================================
  93.   class Game_System
  94.     #--------------------------------------------------------------------------
  95.     # * Public Instance Variables
  96.     #--------------------------------------------------------------------------
  97.     attr_accessor :game_notes_disable          
  98.     #--------------------------------------------------------------------------
  99.     # * Object Initialization
  100.     #--------------------------------------------------------------------------
  101.     alias darkgamenotes_game_system_init_123 initialize
  102.     def initialize
  103.       @game_notes_disable = true
  104.       darkgamenotes_game_system_init_123
  105.     end
  106.   end
  107.   #==============================================================================
  108.   # ** Scene_Map
  109.   #------------------------------------------------------------------------------
  110.   #  This class performs the map screen processing.
  111.   #==============================================================================
  112.  
  113.   class Scene_Map < Scene_Base
  114.     #--------------------------------------------------------------------------
  115.     # * Create All Windows
  116.     #--------------------------------------------------------------------------
  117.     alias darkgamenotes_create_all_windows12 create_all_windows
  118.     def create_all_windows
  119.       darkgamenotes_create_all_windows12
  120.       create_gamenotes_window
  121.     end
  122.     #--------------------------------------------------------------------------
  123.     # * Create All Windows
  124.     #--------------------------------------------------------------------------
  125.     def create_gamenotes_window
  126.       @notes_window = Window_GameNotes.new(@viewport)
  127.     end
  128.     #--------------------------------------------------------------------------
  129.     # * Update
  130.     #--------------------------------------------------------------------------
  131.     alias dark_game_notes_scene_map_update_123 update
  132.     def update
  133.       dark_game_notes_scene_map_update_123
  134.       if scene_changing?
  135.         @notes_window.dispose
  136.       end
  137.     end
  138.   end
  139.  #==============================================================================
  140.  # Game_Interpreter
  141.  #==============================================================================  
  142.   class Game_Interpreter
  143.     #--------------------------------------------------------------------------
  144.     # * Turn on Game Notes
  145.     #--------------------------------------------------------------------------
  146.     def darks_gamenotes_show
  147.       $game_system.game_notes_disable = false
  148.     end
  149.     #--------------------------------------------------------------------------
  150.     # * Turn off Game Notes
  151.     #--------------------------------------------------------------------------
  152.     def darks_gamenotes_hide
  153.       $game_system.game_notes_disable = true
  154.     end
  155.   end
Advertisement
Add Comment
Please, Sign In to add comment