Advertisement
nio_kasgami

Luna title screen v.0.3(alpha)

Jan 16th, 2015
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 11.04 KB | None | 0 0
  1. #==============================================================================
  2. # ■ Titlescreen Luna
  3. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  4. # Basic title screen who permit to have some luna cuztomisation
  5. # Ceated by Nio Kasgami.
  6. # Data : 2015/01/12
  7. # Version : 0.2 (Alpha)
  8. #==============================================================================
  9.  
  10.  
  11. module Nio_luna
  12.     module Title_screen
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14.         SYSTEM ={
  15.         #set the time you this will take for fadein the screen.
  16.             :transition_time => 100,
  17.         #set to true if you want to use the Lunatic Background script. 
  18.             :lunatic_background => false
  19.            
  20.         } #end SYSTEM
  21.        
  22. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  23.         SPLASH_SCREEN ={
  24.            
  25.         #set to true for create a splash screen before the titlescreen.
  26.             :splash_screen_enable => true,
  27.         #~ #set the time your splash screen will play.
  28.             #~ :splash_screen_duration => 20,
  29.         #~ #the name of your logos filename.
  30.             #~ :logo_bitmap => "",
  31.       #~ # Logo background filename.
  32.             #~ :logo_layers_bitmap => "Layer_",
  33.         #~ # Permit to create layer in your background with mutliple effect.
  34.             #~ # "number" => [ "A","B","C"]
  35.             #~ # A = value z axis.
  36.             #~ # B = value speed movement x.
  37.             #~ # C = value speed movement y.
  38.             #~ :logo_backgrounds_layers => {   
  39.                 #~ 1 =>[0,1,2] 
  40.             #~ },
  41.         #~ #permit to have a ME who play while the splash screen is on.
  42.             #~ :logo_me => "Inn",
  43.         #~ # this here you settle some special lunatic command.
  44.         #~ # E.g : animated character.
  45.         #~ :lunatic => {
  46.         #~ }
  47.         } #end SPLASH_SCREEN
  48.        
  49. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  50.         BACKGROUND ={  
  51.      #position x of the first background
  52.             :back_x => Graphics.width / 2,
  53.          #position y of the first background
  54.             :back_y => Graphics.height / 2,
  55.          #position x of the second background
  56.             :back2_x => Graphics.width / 2,
  57.        #position y of the second background
  58.             :back2_y => Graphics.height / 2
  59.         }   #end BACKGROUND
  60.        
  61. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=    
  62.         TITLE ={
  63.             # the filename of the title graphics
  64.             # left it empty if you want to use a font for the title.
  65.             :bitmap => "",
  66.             # the x coordinate position in the screen.
  67.             # set to 0 for center to the screen (text only)
  68.             :x => 0,
  69.             # the y coordinate position in the screen.
  70.             # set to 0 for center to the screen (text only)
  71.             :y => 0,
  72.             # the z axis more high the value and more is the priority.
  73.             :z => 100,
  74.            
  75.            
  76.             #Title font setting (only if :bitmap == "" )
  77.             :font => ["Arial","" ],
  78.             #Title font size
  79.             :size => 40,
  80.             #set the font on bold
  81.             :bold => true,
  82.             #set the font on italic
  83.             :italic => false,
  84.             #set the font on outline
  85.             :outline => false
  86.            
  87.         }
  88. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=        
  89.         COMMANDS ={
  90.       # the type of command you want
  91.          #"default" = the default command
  92.          #"hori" = horizontal style command
  93.          #"clockwise" = a circular style of command
  94.         #please notice the clockwise command don't work with the default window
  95.             :command_type => "", # not enable for the moment
  96.         #set the position x of the window
  97.             :x => 100,
  98.         #set the position y of the window
  99.             :y => 230,
  100.         #set the opacity of the window
  101.             :opacity => 0
  102.         }  
  103. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  104.     end # Title_Screen
  105. end # Nio_Luna
  106. ###############################################################################
  107. # END OF CUSTOMIZATION!
  108. ###############################################################################
  109.  
  110.  
  111. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  112. # Scene_Title
  113. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  114. class Scene_Title < Scene_Base
  115.     include Nio_luna::Title_screen
  116.    
  117.    
  118.     #--------------------------------------------------------------------------
  119.   # ● overwrite method: start
  120.   #--------------------------------------------------------------------------
  121.   def start
  122.         super
  123.     SceneManager.clear
  124.     Graphics.freeze
  125.         execute_base
  126.       execute_splash_screen if SPLASH_SCREEN[:splash_screen_enable]
  127.         create_graphics
  128.     play_title_music
  129.     end
  130.     #--------------------------------------------------------------------------
  131.   # ● overwrite method: transition_speed
  132.   #--------------------------------------------------------------------------
  133.     def transition_speed
  134.         return SYSTEM[:transition_time]
  135.     end
  136.     #----------------------------------------------------------------------------
  137.   # ○ new method:execute_splash_screen
  138.   #----------------------------------------------------------------------------
  139.     def execute_splash_screen
  140.   # still in working
  141.     end
  142.   #----------------------------------------------------------------------------
  143.   # ○ new method: create_graphics
  144.   #----------------------------------------------------------------------------
  145.     def create_graphics
  146.     #condition if Lunatic backgroud is present
  147.       if $imported["YEL-MenuLuna-Background"]  
  148.             create_background if SYSTEM[:lunatic_background]
  149.         end
  150.             create_non_luna_background if !SYSTEM[:lunatic_background]
  151.        
  152.         create_title
  153.         create_command_window
  154.     #condition if luna particles is present
  155.         create_particles if $imported["NK-LunaParticles"]
  156.     end  
  157.     #----------------------------------------------------------------------------
  158.   # ○ new method: create_non_luna_background
  159.   #----------------------------------------------------------------------------
  160.   def create_non_luna_background
  161.     # background   
  162.         @background = Sprite.new
  163.       @background.bitmap = Cache.title1($data_system.title1_name)
  164.         @background.x = BACKGROUND[:back_x]
  165.         @background.y = BACKGROUND[:back_y]
  166.     @background.ox = @background.bitmap.width / 2
  167.     @background.oy = @background.bitmap.height / 2
  168.    # background 2
  169.     @background2 = Sprite.new
  170.         @background2.bitmap = Cache.title2($data_system.title2_name)
  171.         @background2.x = BACKGROUND[:back2_x]
  172.         @background2.y = BACKGROUND[:back2_y]
  173.     @background2.ox = @background2.bitmap.width / 2
  174.     @background2.oy = @background2.bitmap.height / 2
  175.     end
  176.     #----------------------------------------------------------------------------
  177.   # ○ new method: create_title
  178.   #----------------------------------------------------------------------------
  179.     def create_title
  180.     #loading filename
  181.         title_bitmap = Cache.title2(TITLE[:bitmap])
  182.     #creating sprite
  183.         @title = Sprite.new
  184.     #setting sprite filename
  185.         @title.bitmap = title_bitmap
  186.     # getting condition if :bitmap == ""
  187.         if TITLE[:bitmap] == ""
  188.             draw_text_title
  189.         else
  190.             draw_sprite_title
  191.         end
  192.     end
  193.    
  194.    
  195.     def draw_text_title
  196.         @text = Sprite.new
  197.         @text.z = 100
  198.         @text.bitmap = Bitmap.new(Graphics.width, Graphics.height)
  199.         @text.bitmap.font.size = TITLE[:size]
  200.         @text.bitmap.font.name = TITLE[:font]
  201.         @text.bitmap.font.italic = TITLE[:italic]
  202.         @text.bitmap.font.bold = TITLE[:bold]
  203.         @text.bitmap.font.outline = TITLE[:outline]
  204.         @text.x = TITLE[:x]
  205.         @text.y = TITLE[:y]
  206.         rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
  207.          @text.bitmap.draw_text(rect, $data_system.game_title, 1)
  208.         end
  209.     #----------------------------------------------------------------------------
  210.   # ○ new method: draw_sprite_title
  211.   #----------------------------------------------------------------------------
  212.     def draw_sprite_title
  213.     #setting sprite configuration
  214.         @title.x = TITLE[:x]
  215.         @title.y = TITLE[:y]
  216.         @title.z = TITLE[:z]
  217.         #@title.wave_amp
  218.        
  219.     end
  220.     #--------------------------------------------------------------------------
  221.   # ● overwrite method: create_command_window
  222.   #--------------------------------------------------------------------------
  223.     #~ def create_command_window
  224.         #~ case COMMANDS[:command_type]
  225.         #~ when :default
  226.             #~ create_default_window_command
  227.         #~ when :horizontal
  228.             #~ create_horizontal_command
  229.         #~ when :clockwise
  230.             #~ create_clockwise_command
  231.         #~ when !:default,:horizontal, :clockwise
  232.             #~ msgbox_p("Nil error : Please enter a valid
  233.       #~ command option.")
  234.             #~ SceneManager.exit
  235.         #~ end
  236.     #~ end
  237.    
  238.            
  239.            
  240.            
  241.        
  242.   #--------------------------------------------------------------------------
  243.   # ● overwrite method: terminate
  244.   #--------------------------------------------------------------------------
  245.   def terminate
  246.     super
  247.     SceneManager.snapshot_for_background
  248.     dispose_background if SYSTEM[:lunatic_background]
  249.         dispose_non_luna_background
  250.         dispose_text_title if TITLE[:bitmap] == ""
  251.     dispose_sprite_title
  252.     end
  253.    
  254.     def dispose_text_title
  255.         @text.dispose
  256.         @text.bitmap.dispose
  257.         end
  258.     #----------------------------------------------------------------------------
  259.   # ○ new method: dispose_non_luna_background
  260.   #----------------------------------------------------------------------------
  261.     def dispose_non_luna_background
  262.         @background.dispose
  263.         @background.bitmap.dispose
  264.         @background2.dispose
  265.         @background2.bitmap.dispose
  266.     end
  267.     #----------------------------------------------------------------------------
  268.   # ○ new method: dispose_sprite_title
  269.   #----------------------------------------------------------------------------
  270.   def dispose_sprite_title
  271.   @title.dispose
  272.   @title.bitmap.dispose
  273.   end
  274. #==============================================================================
  275.     def execute_base
  276.         if $imported["YEL-MenuLuna"] or $imported["YEL-BattleLuna"]
  277.             @check = true
  278.         else
  279.             @check = false
  280.         end
  281.         consequence
  282.     end
  283.    
  284.     def consequence
  285.         case @check
  286.         when false
  287.             RPG::SE.new("buzzer1",100,100).play
  288.             msgbox_p("ERROR : Please install Menu luna or Battle Luna script in your script editor")
  289.             exit
  290.         end
  291.     end
  292. #==============================================================================
  293.     end # end Scene_title
  294. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  295. # Scene_Title
  296. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  297. class Window_TitleCommand < Window_Command
  298.     include Nio_luna::Title_screen
  299.    
  300.  #--------------------------------------------------------------------------
  301.  # ● overwrite method: initialize
  302.  #--------------------------------------------------------------------------
  303.     def initialize
  304.          super(0, 0)
  305.     update_placement
  306.     select_symbol(:continue) if continue_enabled
  307.     self.openness = 0
  308.         check_opacity
  309.     open
  310.     end
  311.  #----------------------------------------------------------------------------
  312.  # ○ new method: check_opacity
  313.  #----------------------------------------------------------------------------
  314.     def check_opacity
  315.         self.opacity = COMMANDS[:opacity]
  316.     end
  317.  #--------------------------------------------------------------------------
  318.  # ● overwrite method: update_placement
  319.  #--------------------------------------------------------------------------   
  320.     def update_placement
  321.     self.x = COMMANDS[:x]
  322.     self.y = COMMANDS[:y]
  323.   end
  324.    
  325.  
  326.    
  327.            
  328. end #end Window_TitleCommand
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement