Sign in to follow this  
Followers 0
xXDarkDragonXx

[RMVX] M?ltiples WindowSkins

1 post in this topic

[center]Múltiples WindowSkins[/center]
[center]VERSION: 1.0[/center]

INTRODUCCION

Permite que cada ventana creada via scripts tengan su propia WindowSkin.

CARACTERISTICAS
  • Cada ventana puede tener su propia WindowSkin
SCREENSHOT

user posted image

DEMO

Meh... Da vagancia. Si acaso luego.

SCRIPT

[spoiler]
CODE

#==============================================================================
# ■ DeadlyDan_WindowSkin, by DeadlyDan
#------------------------------------------------------------------------------
#  Allows to specify a custom windowskin when creating windows.
#==============================================================================
# Usage:
=begin
 
 When creating your window, you need to specify a windowskin name, by default it chooses "Window"
 For example:
 
 --------------------------------------------------------------------------
 --------------------------------------------------------------------------
 class Window_Test < Window_Base
   
   def initialize ( x, y, w, h )
     super ( x, y, w, h, "Window2" )
   end
   
 end
 $window = Window_Test.new ( 0, 0, 320, 240 )
 --------------------------------------------------------------------------
 --------------------------------------------------------------------------
 
 You can create this window normally and it will set the skin accordingly.
 
 (NOTE)
 When using this with non Window_Base inherited classes, because the limitations of ruby you must specify
 all default parameters before setting the window skin. For example:
 
 Using it with a Window_Selectable inherited class you must call it like so:
 
 --------------------------------------------------------------------------
 --------------------------------------------------------------------------
 class Window_Test < Window_Selectable
   
   def initialize ( x, y, w, h )
     super ( x, y, w, h, 32, "Window2" )
   end
   
 end
 
 $window = Window_Test.new ( 0, 0, 320, 240 )
 --------------------------------------------------------------------------
 --------------------------------------------------------------------------
 
 Notice the "32" parameter, this is the spacing parameter of Window_Selectable. This rule of putting all
 parameters applies for any Window_* class you want to use a different windowskin with.
 
=end

class Window_Base < Window
 
 def initialize ( x, y, width, height, skin = "Window" )
   super ( )
   self.windowskin = Cache.system ( skin )
   self.x = x
   self.y = y
   self.width = width
   self.height = height
   self.z = 100
   self.back_opacity = 200
   self.openness = 255
   create_contents
   @opening = false
   @closing = false    
 end
 
end

class Window_Selectable < Window_Base

 def initialize ( x, y, width, height, spacing = 32, skin = "Window" )
   @item_max = 1
   @column_max = 1
   @index = -1
   @spacing = spacing.to_i
   super ( x, y, width, height, skin )
 end
 
end

class Window_Command < Window_Selectable

 def initialize ( width, commands, column_max = 1, row_max = 0, spacing = 32, skin = "Window" )
   if ( row_max == 0 )
     row_max = ( commands.size + column_max - 1 )  / column_max
   end
   super ( 0, 0, width, row_max * WLH + 32, spacing, skin )
   @commands = commands
   @item_max = commands.size
   @column_max = column_max
   refresh
   self.index = 0
 end
 
end

class Window_Message < Window_Selectable

 def initialize ( skin = "Window" )
   super ( 0, 288, 544, 128, 32, skin )
   self.z = 200
   self.active = false
   self.index = -1
   self.openness = 0
   @opening = false
   @closing = false
   @text = nil
   @contents_x = 0
   @contents_y = 0
   @line_count = 0
   @wait_count = 0
   @background = 0
   @position = 2
   @show_fast = false
   @line_show_fast = false
   @pause_skip = false
   create_gold_window
   create_number_input_window
   create_back_sprite
 end
 
end

class Window_Item < Window_Selectable

 def initialize ( x, y, width, height, skin = "Window" )
   super ( x, y, width, height, skin )
   @column_max = 2
   self.index = 0
   refresh
 end
 
end
[/spoiler]

INSTRUCCIONES

Coloca el script arriba de Main. Ahora, cuando vayas a crear una ventana, cualquiera que sea, has lo siguiente:

CODE
 class Window_Test < Window_Base
   
   def initialize ( x, y, w, h )
     super ( x, y, w, h, "Window2" )
   end
   
 end
 $window = Window_Test.new ( 0, 0, 320, 240 )


¿Ven el "Window2"? Deben agregar como último parámetro en el 'super' el nombre de la WindowSkin que la ventana va a utilizar.

Un ejemplo de unas ventanas que vienen por defecto:

CODE
class Window_MenuStatus < Window_Selectable

 def initialize ( x, y )
   super ( x, y, 384, 416, 32, "Window2" )
   refresh
   self.active = false
   self.index = -1
 end
 
end

class Window_Gold < Window_Base

 def initialize ( x, y )
   super ( x, y, 160, WLH + 32, "Window3" )
   refresh
 end
 
end


CREDITOS

DeadlyDan
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0