khanhdu

CSCA_Game Info

Jun 4th, 2017
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 6.19 KB | None | 0 0
  1. =begin
  2. CSCA GameInfo
  3. version: 1.0.1(August 26, 2012)
  4. Created by: Casper Gaming (http://www.caspergaming.com/)
  5.  
  6. Compatibility:
  7. Made for RPGVXAce
  8. IMPORTANT: ALL CSCA Scripts should be compatible with each other unless
  9. otherwise noted.
  10.  
  11. UPDATE HISTORY:
  12. version 1.0
  13. -original script
  14.  
  15. version 1.0.1
  16. -Bugfix, gameinfo no longer appears above load window.
  17.  
  18. INTRODUCTION:
  19. This script draws some additional information on the title screen, as well as
  20. opening a file at game start/exit(commercial games may use this feature in
  21. demo's to prompt the player to buy the full version).
  22.  
  23. FEATURES:
  24. -Can draw a version number on title screen.
  25. -Can draw copyright info on the title screen.
  26. -Can open a file at game start and game exit.
  27.  
  28. SETUP
  29. Script requires set up below.
  30.  
  31. CREDIT:
  32. Free to use in noncommercial games if credit is given to:
  33. Casper Gaming (http://www.caspergaming.com/)
  34.  
  35. To use in a commercial game, please purchase a license here:
  36. http://www.caspergaming.com/licenses.html
  37.  
  38. TERMS:
  39. http://www.caspergaming.com/terms_of_use.html
  40. =end
  41. module CSCA
  42.   module GAMEINFO
  43.     # SETUP BEGIN #
  44.     #Text Setup
  45.     #If not using a text option, set it to ""
  46.     VERSION = "Version: " # Version text.
  47.     VERSION_ID = "1.0" # Version number, is using custom version.
  48.     COPYRIGHT = "©CasperGaming" # Copyright text. © ® ™
  49.     WEBSITE = "www.caspergaming.com" # Website text.
  50.    
  51.     #Popup Setup - set all to false if not using this feature.
  52.     FILE = "demoscreen.html" # File name (Same directory as Game.exe)
  53.     DEBUG = false # Open file even during game test?
  54.     STARTUP = true # Open file on game start?
  55.     GAMEEND = true # Open file on game end?
  56.    
  57.     #Misc Setup
  58.     FONT_SIZE = 20 # Size of the font.
  59.     ONE_STRING = true # Treat all text as one string? (Alignment difference)
  60.     SPACING = "     " # Spacing between texts. Only valid if ONE_STRING is true.
  61.     CUSTOM_VERSION = true # Use custom version number(true)
  62.                           # or use a generated version number(false)
  63.     # END SETUP #
  64.   end
  65. end
  66. $imported = {} if $imported.nil?
  67. $imported["CSCA-GameInfo"] = true
  68. #==============================================================================
  69. # ** SceneManager
  70. #------------------------------------------------------------------------------
  71. #  Opens a file on exit(optional).
  72. # Aliases: exit
  73. #==============================================================================
  74. module SceneManager
  75.   #--------------------------------------------------------------------------
  76.   # Alias Method
  77.   #--------------------------------------------------------------------------
  78.   class <<self; alias csca_gameinfo_exit exit; end
  79.   def self.exit
  80.     $game_system.csca_open_file(CSCA::GAMEINFO::FILE) if csca_openfile_on_exit?
  81.     csca_gameinfo_exit
  82.   end
  83.   #--------------------------------------------------------------------------
  84.   # Open file on exit?
  85.   #--------------------------------------------------------------------------
  86.   def self.csca_openfile_on_exit?
  87.     return false if $BTEST
  88.     CSCA::GAMEINFO::GAMEEND ? $TEST ? CSCA::GAMEINFO::DEBUG : true : false
  89.   end
  90. end # SceneManager
  91. #==============================================================================
  92. # ** Scene_Title
  93. #------------------------------------------------------------------------------
  94. #  Draws game info to title screen
  95. # Aliases: start, dispose foreground
  96. #==============================================================================
  97. class Scene_Title < Scene_Base
  98.   #--------------------------------------------------------------------------
  99.   # Alias Method
  100.   #--------------------------------------------------------------------------
  101.   alias :csca_gameinfo_start :start
  102.   def start
  103.     csca_gameinfo_start
  104.     csca_draw_game_info
  105.     $game_system.csca_open_file(CSCA::GAMEINFO::FILE) if csca_openfile_on_start?
  106.   end
  107.   #--------------------------------------------------------------------------
  108.   # Open file on start?
  109.   #--------------------------------------------------------------------------
  110.   def csca_openfile_on_start?
  111.     CSCA::GAMEINFO::STARTUP ? $TEST ? CSCA::GAMEINFO::DEBUG : true : false
  112.   end
  113.   #--------------------------------------------------------------------------
  114.   # Draw version and copyright info
  115.   #--------------------------------------------------------------------------
  116.   def csca_draw_game_info
  117.     @gameinfo_sprite = Sprite.new
  118.     @gameinfo_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  119.     @gameinfo_sprite.z = 100
  120.     @gameinfo_sprite.bitmap.font.size = CSCA::GAMEINFO::FONT_SIZE
  121.     rect = Rect.new(2,(Graphics.height/2)-10,Graphics.width,Graphics.height)
  122.     version_id = CSCA::GAMEINFO::CUSTOM_VERSION ? CSCA::GAMEINFO::VERSION_ID : $data_system.version_id.to_s
  123.     version = CSCA::GAMEINFO::VERSION+version_id
  124.     if CSCA::GAMEINFO::ONE_STRING
  125.       @gameinfo_sprite.bitmap.draw_text(rect,version+CSCA::GAMEINFO::SPACING+
  126.         CSCA::GAMEINFO::COPYRIGHT+CSCA::GAMEINFO::SPACING+CSCA::GAMEINFO::WEBSITE,1)
  127.     else
  128.       @gameinfo_sprite.bitmap.draw_text(rect,version)
  129.       @gameinfo_sprite.bitmap.draw_text(rect,CSCA::GAMEINFO::COPYRIGHT,1)
  130.       @gameinfo_sprite.bitmap.draw_text(rect,CSCA::GAMEINFO::WEBSITE,2)
  131.     end
  132.   end
  133.   #--------------------------------------------------------------------------
  134.   # Alias method
  135.   #--------------------------------------------------------------------------
  136.   alias :csca_dispose_gameinfo :dispose_foreground
  137.   def dispose_foreground
  138.     csca_dispose_gameinfo
  139.     @gameinfo_sprite.bitmap.dispose
  140.     @gameinfo_sprite.dispose
  141.   end
  142. end # Scene_Title
  143. #==============================================================================
  144. # ** Game_System
  145. #------------------------------------------------------------------------------
  146. #  Added ability to open a file.
  147. #==============================================================================
  148. class Game_System
  149.   #--------------------------------------------------------------------------
  150.   # * Open File
  151.   #--------------------------------------------------------------------------
  152.   def csca_open_file(filename)
  153.     shell = Win32API.new("shell32","ShellExecute",'LPPL','L')
  154.     shell.Call(0,"open",filename,0)
  155.   end
  156. end #Game_System
Advertisement
Add Comment
Please, Sign In to add comment