Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. =begin
  2.  ╔=════════════════════════════════════════════════════════════════════════=╗
  3.  ║                      Script: Create Window Easy                          ║
  4.  ╚══════════════════════════════════════════════════════════════════════════╝
  5.                 ╔══════════════╗        ╔════════════════════╗
  6.                 ║ Crédit: Dany ║        ║  Version: 1.0.0    ║
  7.                 ╚══════════════╝        ╚════════════════════╝
  8.  
  9. Description:
  10.   Ce script, permet de créer une fenêtre simple avec l'ajout d'un texte.
  11.  
  12. Appel de script utilisable en Jeu/Script:
  13.   touch_wc                    Lance la condition de la touche
  14.   wc_launch                   Lance la fenêtre.
  15.   edit_all(x,y,l,h,t,tx,ty,o) Edite tout les données, sauf les sons.
  16.   edit_xy(x,y)                Edite les données X/Y.
  17.   edit_lh(l,h)                Edite les données L/H.
  18.   edit_t(t)                   Edite les données T.
  19.   edit_txy(tx,ty)             Edite les données TX/TY.
  20.   edit_op(o)                  Edite les données O.
  21.   edit_touch(touch)           Edite la touche pour fermer le menu.
  22.   edit_son(f,v,p,f2,v2,p2)    Edite le son d'ouverture/fermeture.
  23.  
  24.   x = position x de la fenêtre.
  25.   y = position y de la fenêtre.
  26.   l = largeur de la fenêtre.
  27.   h = hauteur de la fenêtre.
  28.   t = texte avec les guillemets, ex: "Je suis là".
  29.       Vous pouvez utiliser les CODES des messages.
  30.   tx = position x du texte.
  31.   ty = position y du texte.
  32.   o = opacité 255 pour affiché la fenêtre 0 pour l'enlever.
  33.   touch = touche pour ouvrir le menu ex :C
  34.   f = nom du son d'ouverture, exemple: "Audio/SE/Open1"
  35.   v = volume du son d'ouverture.
  36.   p = pitch du son d'ouverture.
  37.   f2 = nom du son fermetue, exemple: "Audio/SE/Open1"
  38.   v2 = volume du son fermeture.
  39.   p2 = pitch du son fermeture.
  40.  
  41. BUG & MAJ:
  42.   -Création du script.
  43. =end
  44.  
  45. #================================Game_Party================================#
  46. # Stockage des données dans le Game_Party, afin de les sauvegarders.       #
  47. #==========================================================================#
  48. class Game_Party
  49.   attr_accessor :wc_touche
  50.   attr_accessor :wc_x
  51.   attr_accessor :wc_y
  52.   attr_accessor :wc_l
  53.   attr_accessor :wc_h
  54.   attr_accessor :wc_o
  55.   attr_accessor :wc_t
  56.   attr_accessor :wc_tx
  57.   attr_accessor :wc_ty
  58.   attr_accessor :wc_sono
  59.   attr_accessor :wc_sonov
  60.   attr_accessor :wc_sonop
  61.   attr_accessor :wc_sonc
  62.   attr_accessor :wc_soncv
  63.   attr_accessor :wc_soncp
  64.  
  65.   alias ex_initialize initialize
  66.   def initialize(*arg)
  67.     ex_initialize(*arg)
  68.     @wc_touche = :A
  69.     @wc_x = 0
  70.     @wc_y = 0
  71.     @wc_l = Graphics.width
  72.     @wc_h = Graphics.height
  73.     @wc_o = 0
  74.     @wc_t = ""
  75.     @wc_tx = 0
  76.     @wc_ty = 0
  77.     @wc_sono = "Audio/SE/Open1"
  78.     @wc_sonov = 100
  79.     @wc_sonop = 50
  80.     @wc_sonc = "Audio/SE/Cancel2"
  81.     @wc_soncv = 100
  82.     @wc_soncp = 50
  83.   end
  84. end
  85.  
  86. #==================================Create==================================#
  87. # Création des appels de script pour faciliter l'utilisateur.              #
  88. #==========================================================================#
  89. module Create
  90.   def touch_wc
  91.     @audio_open         = $game_party.wc_sono.to_s
  92.     @audio_open_vol     = $game_party.wc_sonov.to_i
  93.     @audio_open_pitch   = $game_party.wc_sonop.to_i
  94.     @audio_close        = $game_party.wc_sonc.to_s
  95.     @audio_close_vol    = $game_party.wc_soncv.to_i
  96.     @audio_close_pitch  = $game_party.wc_soncp.to_i
  97.     @touche             = $game_party.wc_touche
  98.     if Input.trigger?(@touche)
  99.       if @window_wc.open?
  100.         Audio.se_play(@audio_open, @audio_open_vol, @audio_open_pitch)
  101.         @window_wc.close
  102.       elsif @window_wc.close?
  103.         Audio.se_play(@audio_close, @audio_close_vol, @audio_close_pitch)
  104.         @window_wc.open
  105.       end
  106.     end
  107.   end
  108.   def wc_launch
  109.     @x  = $game_party.wc_x
  110.     @y  = $game_party.wc_y
  111.     @l  = $game_party.wc_l
  112.     @h  = $game_party.wc_h
  113.     @o  = $game_party.wc_o
  114.     @t  = $game_party.wc_t
  115.     @tx = $game_party.wc_tx
  116.     @ty = $game_party.wc_ty
  117.     @window_wc = Window_Create.new(@x, @y, @l, @h, @t, @tx, @ty)
  118.     @window_wc.z = 2000
  119.     @window_wc.openness = 0
  120.     @window_wc.close
  121.   end
  122.   def edit_all(x, y, l, h, t, tx, ty, o)
  123.     $game_party.wc_x  = x
  124.     $game_party.wc_y  = y
  125.     $game_party.wc_l  = l
  126.     $game_party.wc_h  = h
  127.     $game_party.wc_t  = t
  128.     $game_party.wc_tx = tx
  129.     $game_party.wc_ty = ty
  130.     $game_party.wc_o  = o
  131.   end
  132.   def edit_xy(x, y)
  133.     $game_party.wc_x = x
  134.     $game_party.wc_y = y
  135.   end
  136.   def edit_lh(l, h)
  137.     $game_party.wc_l = l
  138.     $game_party.wc_h = h
  139.   end
  140.   def edit_t(t)
  141.     $game_party.wc_t = t
  142.   end
  143.   def edit_txy(tx, ty)
  144.     $game_party.wc_tx = tx
  145.     $game_party.wc_ty = ty
  146.   end
  147.   def edit_op(o)
  148.     $game_party.wc_o = o
  149.   end
  150.   def edit_touch(touch)
  151.     $game_party.touche = touch
  152.   end
  153.   def edit_song(f,v,p,f2,v2,p2)
  154.     $game_party.sono  = f if f != nil
  155.     $game_party.sonov = v if v != nil
  156.     $game_party.sonop = p if p != nil
  157.     $game_party.sonc  = f2 if f2 != nil
  158.     $game_party.soncv = v2 if v2 != nil
  159.     $game_party.soncp = p2 if p2 != nil
  160.   end
  161. end
  162.  
  163. #=============================Game_Interpreter=============================#
  164. #                                (En Jeu)                                  #
  165. # Implante le module dans le Game_Interpreter pour l'utilisation du code.  #
  166. #==========================================================================#
  167. class Game_Interpreter
  168.   include Create
  169. end
  170.  
  171. #============================Scene_MenuBase================================#
  172. #                              (En Script)                                 #
  173. # Implante le module dans le Scene_MenuBase pour l'utilisation du code.    #                                                             #
  174. #==========================================================================#
  175. class Scene_MenuBase
  176.   include Create
  177. end
  178.  
  179. #===============================Window_Create==============================#
  180. # Création de la fenêtre avec l'affichage du texte.                        #
  181. #==========================================================================#
  182. class Window_Create < Window_Base
  183.   def initialize(x, y, l, h, t, tx, ty)
  184.     super(x, y, l, h)
  185.     @text = t
  186.     @text_x = tx
  187.     @text_y = ty
  188.     create_text
  189.   end
  190.   def create_text
  191.     self.contents.clear
  192.     draw_text_ex(@text_x.to_i, @text_y.to_i, @text.to_s)
  193.   end
  194. end
  195.  
  196. #===============================Scene_Create===============================#
  197. # Création de la scene pour appeler la fenêtre.                            #
  198. #      SceneManager.call(Scene_Create)                                     #
  199. #==========================================================================#
  200. class Scene_Create < Scene_MenuBase
  201.   def start
  202.     super
  203.     @touch = $game_party.touche
  204.     create_window
  205.   end
  206.   def update
  207.     super
  208.     name = $game_party.wc_son.to_s
  209.     volume = $game_party.wc_sonv.to_i
  210.     pitch = $game_party.wc_sonp.to_i
  211.     return_scene if Input.trigger?(@touch)
  212.     if Input.trigger?(@touch)
  213.       Audio.se_play(name, volume, pitch)
  214.     end
  215.   end
  216.   def create_window
  217.     @x  = $game_party.wc_x
  218.     @y  = $game_party.wc_y
  219.     @l  = $game_party.wc_l
  220.     @h  = $game_party.wc_h
  221.     @o  = $game_party.wc_o
  222.     @t  = $game_party.wc_t
  223.     @tx = $game_party.wc_tx
  224.     @ty = $game_party.wc_ty
  225.     @window = Window_Create.new(@x, @y, @l, @h, @t, @tx, @ty)
  226.     @window.opacity = @o
  227.     @window.z = 2000
  228.     @window.openness = 0
  229.   end
  230. end