设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2279|回复: 6
打印 上一主题 下一主题

[已经解决] 能否帮忙汉化一下这个脚本……

[复制链接]

Lv2.观梦者

花开堪折直须折

梦石
0
星屑
676
在线时间
943 小时
注册时间
2010-7-17
帖子
4963

贵宾

跳转到指定楼层
1
发表于 2010-9-26 12:34:35 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 冰舞蝶恋 于 2010-9-26 12:37 编辑
  1. #===============================================================================
  2. #
  3. # Yanfly Engine Melody - Custom Message Melody
  4. # Last Date Updated: 2010.05.22
  5. # Level: Easy, Normal, Hard, Lunatic
  6. #
  7. # The message system by itself is fine and easy to accept as it is. However, it
  8. # wouldn't hurt to have it do a few more features. This script will allow your
  9. # message boxes to perform extra functions such as drawing icons, using an
  10. # external choice window, and using Lunatic shortcuts.
  11. #
  12. # Custom Message Melody will also separate the in-game font from the message
  13. # window font. This way, fancier-looking fonts can be used for dialogue while
  14. # more systematically appropriate fonts can be used for in-game material.
  15. #
  16. # This is by no means a complex message system like Modern Algebra's ATS or
  17. # Woratana's Neo Message System. If you want a message system with a lot of
  18. # features, I highly recommend that you take a look at those. This message
  19. # system here will supply the most basic functions and needs without adding
  20. # too many extra features.
  21. #===============================================================================
  22. # Updates
  23. # -----------------------------------------------------------------------------
  24. # o 2010.05.22 - Converted to Yanfly Engine Melody.
  25. #===============================================================================
  26. # Instructions
  27. # -----------------------------------------------------------------------------
  28. # To install this script, open up your script editor and copy/paste this script
  29. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  30. #
  31. # -----------------------------------------------------------------------------
  32. # Message Window REGEXP Codes - These go inside of your message window.
  33. # -----------------------------------------------------------------------------
  34. #  Code:       Effect:
  35. #    \v[x]       Writes variable x's value.
  36. #    \n[x]       Writes actor x's name.
  37. #    \c[x]       Changes the colour of the text to x.
  38. #    \g          Displays the gold window.
  39. #    \.          Waits 15 frames (quarter second).
  40. #    \|          Waits 60 frames (a full second).
  41. #    \!          Waits until key is pressed.
  42. #    \>          Following text is instant.
  43. #    \<          Following text is no longer instant.
  44. #    \^          Skips to the next message.
  45. #    \\          Writes a "\" in the window.
  46. #
  47. #    \f[x]       Draws actor ID x's face in the window.
  48. #    \w[x]       Waits x frames (60 frames = 1 second).
  49. #
  50. #    \nb[x]      Creates a name window with x. Left side.
  51. #    \nbl[x]     Creates a name window with x. Locks the namebox. Left side.
  52. #    \nbu[x]     Creates a name window with x. Unlocks the namebox. Left side.
  53. #    \rnb[x]     Creates a name window with x. Right side.
  54. #    \rnbl[x]    Creates a name window with x. Locks the namebox. Right side.
  55. #    \rnbu[x]    Creates a name window with x. Unlocks the namebox. Right side.
  56. #    \nbu        Closes name window. Unlocks the namebox.
  57. #
  58. #    \fn[x]      Changes the font name to x. Set to 0 to reset font name.
  59. #    \fs[x]      Changes the font size to x. Set to 0 to reset font size.
  60. #    \fb         Changes the font to bold and back.
  61. #    \fi         Changes the font to italic
  62. #    \fh         Changes the font to shadowed and back.
  63. #
  64. #    \ac[x]      Writes actor x's class name.
  65. #    \as[x]      Writes actor x's subclass name. Requires JP Classes.
  66. #    \ax[x]      Writes actor x's combination class name. Requires JP Classes.
  67. #    \af[x]      Replaces face with actor x's face.
  68. #    \af[x:y]    Replaces face with actor x's face name but uses expression y.
  69. #
  70. #    \pn[x]      Writes ally's name in party slot x.
  71. #    \pc[x]      Writes ally's class name in party slot x.
  72. #    \ps[x]      Writes ally's subclass name in party slot x.
  73. #    \px[x]      Writes ally's combination class name in party slot x.
  74. #    \pf[x]      Replaces face with ally's face in party slot x.
  75. #    \pf[x:y]    Replaces face with ally's face name but uses expression y.
  76. #
  77. #    \nc[x]      Writes class ID x's name.
  78. #    \ni[x]      Writes item ID x's name.
  79. #    \nw[x]      Writes weapon ID x's name.
  80. #    \na[x]      Writes armour ID x's name.
  81. #    \ns[x]      Writes skill ID x's name.
  82. #    \nt[x]      Writes state ID x's name.
  83. #
  84. #    \i[x]       Draws icon ID x into the message window.
  85. #    \ii[x]      Writes item ID x's name with icon included.
  86. #    \iw[x]      Writes weapon ID x's name with icon included.
  87. #    \ia[x]      Writes armour ID x's name with icon included.
  88. #    \is[x]      Writes skill ID x's name with icon included.
  89. #    \it[x]      Writes state ID x's name with icon included.
  90. #
  91. #===============================================================================

  92. $imported = {} if $imported == nil
  93. $imported["CustomMessageMelody"] = true

  94. module YEM
  95.   module MESSAGE
  96.    
  97.     #===========================================================================
  98.     # Sectio I. Basic Settings
  99.     # --------------------------------------------------------------------------
  100.     # The following below will adjust the basic settings and that will affect
  101.     # the majority of the script.
  102.     #===========================================================================
  103.    
  104.     # This adjusts the pixel width given to your icons so they won't throw
  105.     # certain monospaced fonts out of alignment.
  106.     ICON_WIDTH = 24
  107.    
  108.     # This adjusts how many rows are shown on screen. If it's 0 or under, a
  109.     # maximum of 4 rows will be shown. If it's above, it will show that many
  110.     # rows and texts following it immediately after will also display that many
  111.     # extra rows.
  112.     ROW_VARIABLE = 82
  113.    
  114.     # This adjusts how wide the message window will be in pixels. The window
  115.     # will automatically center itself to the new width.
  116.     WIDTH_VARIABLE = 83
  117.    
  118.     # This button is the button used to make message windows instantly skip
  119.     # forward. Hold down for the effect. Note that when held down, this will
  120.     # speed up the messages, but still wait for the pauses. However, it will
  121.     # automatically go to the next page when prompted.
  122.     TEXT_SKIP = Input::A     # Input::A is the shift button on keyboard.
  123.    
  124.     #===========================================================================
  125.     # Section II. Name Window Settings
  126.     # --------------------------------------------------------------------------
  127.     # The name window is a window that appears outside of the main message
  128.     # window box to display whatever text is placed inside of it like a name.
  129.     #===========================================================================
  130.    
  131.     # This determines where you would like the namebox window to appear relative
  132.     # to the message window. Adjust the following accordingly.
  133.     NAME_WINDOW_X = -20      # Adjusts X position offset from Message Window.
  134.     NAME_WINDOW_Y = 40       # Adjusts Y position offset from Message Window.
  135.     NAME_WINDOW_W = 20       # Adjusts extra width added to the Name Window.
  136.     NAME_WINDOW_H = 40       # Adjusts the height of the Name Window.
  137.     NAME_COLOUR   = 6        # Default colour used for name box.
  138.    
  139.     # The following lets you adjust whether or not you would like to see the
  140.     # back of the name window.
  141.     NAME_WINDOW_SHOW_BACK = true
  142.    
  143.     #===========================================================================
  144.     # Section III. Choice Settings
  145.     # --------------------------------------------------------------------------
  146.     # There are now different ways to display choices now. One is the default
  147.     # method, another is through a choice window. Adjust the settings properly.
  148.     # To change the type of choice window shown, adjust the choice variable
  149.     # during the game.
  150.     # Var:    Type:
  151.     #  0       Normal
  152.     #  1       Outside window without a face. In the center of the screen.
  153.     #  2       Outside window without a face. Right side of the screen.
  154.     #  3       Outside window without a face. Left side of the screen.
  155.     #  4       Outside window with a face. In the center of the screen.
  156.     #  5       Outside window with a face. Right side of the screen.
  157.     #  6       Outside window with a face. Left side of the screen.
  158.     #===========================================================================
  159.    
  160.     # This is the indent used for choices when used through the regular method.
  161.     # Otherwise, inside of the choice window, there will be no indent.
  162.     CHOICE_INDENT = "\x06    \x07"
  163.    
  164.     # These variables adjust the type of choice window displayed and which
  165.     # actor's face graphic to be displayed inside of the choice variable.
  166.     CHOICE_VARIABLE = 84
  167.     FACE_VARIABLE   = 85
  168.    
  169.     CHOICE_WINDOW_X = 100  # The X offset for the choice window.
  170.     CHOICE_WINDOW_Y =   0  # The Y offset for the choice window.
  171.     CHOICE_WINDOW_W =  60  # Minimum size for the choice width.
  172.     CHOICE_WINDOW_E =  20  # Extra width added to each side of an option.
  173.    
  174.     #===========================================================================
  175.     # Section IV. Sound Settings
  176.     # --------------------------------------------------------------------------
  177.     # When text is being played out on the screen by a message. This can be
  178.     # changed in game through the following script calls:
  179.     #   $game_message.text_sound = "name"     Filename of sound to be played.
  180.     #   $game_message.text_volume = 60        Volume of sound to be played.
  181.     #   $game_message.text_pitch  = 100       Pitch of sound to be played.
  182.     #===========================================================================
  183.    
  184.     # This adjusts the default sound that's played when text appears. If you
  185.     # don't want to use this feature, just set this value to nil.
  186.     SOUND_DEFAULT = "Cursor"
  187.    
  188.     # The sound pitch varies each time it's played by this amount. This is so
  189.     # that the sound doesn't become monotonous and actually offers variability.
  190.     # Set this value to 0 if you don't want any changes.
  191.     SOUND_PITCH_OFFSET = 3
  192.    
  193.     #===========================================================================
  194.     # Section V. Message Window-Only Font
  195.     # --------------------------------------------------------------------------
  196.     # Custom Message Melody will also separate the in-game font from the message
  197.     # window font. This way, fancier-looking fonts can be used for dialogue
  198.     # while more systematically appropriate fonts can be used for game material.
  199.     #===========================================================================
  200.    
  201.     # This array constant determines the fonts used. If the first font does not
  202.     # exist on the player's computer, the next font in question will be used
  203.     # in place instead and so on.
  204.     MESSAGE_WINDOW_FONT = ["Verdana", "Arial", "Courier New"]
  205.    
  206.   end # MESSAGE
  207. end # YEM

  208. #===============================================================================
  209. # Lunatic Mode - Custom Message System
  210. #===============================================================================
  211. #
  212. # This portion is for those who know how to script and would like to use various
  213. # tags to produce easy Lunatic Mode shortcuts.
  214. #
  215. # \X[x] or \X[x:y] or \X[x:y:z]
  216. # These let you create your own custom tags. If you use the first tag, there is
  217. # one case for the "custom_convert" definition to return. If you use the second
  218. # tag, there will be two cases for you to select from. And likewise, if there's
  219. # three tags, then the z case will also be taken into account of.
  220. #
  221. #===============================================================================

  222. class Window_Message < Window_Selectable
  223.   
  224.   #--------------------------------------------------------------------------
  225.   # new method: self.custom_convert
  226.   #--------------------------------------------------------------------------
  227.   def self.custom_convert(x_case, y_case = 0, z_case = 0)
  228.     text = ""
  229.     case x_case
  230.     #----------------------------------------------------------------------
  231.     # Start editting here.
  232.     #----------------------------------------------------------------------
  233.     when 1 # Show the full name of the actor.
  234.       case y_case # This is the extra case for the actor.
  235.       when 1
  236.         text = "\\n[1] von Xiguel"
  237.       when 2
  238.         text = "Michelle \\n[2]"
  239.       when 3
  240.         text = "\\n[3] Manfred"
  241.       when 4
  242.         text = "\\n[4] Fernaeus"
  243.       end
  244.       
  245.     when 2 # Show how much gold the party has.
  246.       text = $game_party.gold
  247.       
  248.     when 3 # Show party's max level
  249.       text = $game_party.max_level
  250.       
  251.     #----------------------------------------------------------------------
  252.     # Stop editting past this point.
  253.     #----------------------------------------------------------------------
  254.     end
  255.     return text
  256.   end
  257.   
  258. end # Window_Message

  259. #===============================================================================
  260. # Editting anything past this point may potentially result in causing computer
  261. # damage, incontinence, explosion of user's head, coma, death, and/or halitosis.
  262. # Therefore, edit at your own risk.
  263. #===============================================================================

  264. #===============================================================================
  265. # Game_Message
  266. #===============================================================================

  267. class Game_Message
  268.   
  269.   #--------------------------------------------------------------------------
  270.   # public instance variables
  271.   #--------------------------------------------------------------------------
  272.   attr_accessor :text_sound
  273.   attr_accessor :text_volume
  274.   attr_accessor :text_pitch
  275.   attr_accessor :choice_text
  276.   
  277.   #--------------------------------------------------------------------------
  278.   # alias method: initialize
  279.   #--------------------------------------------------------------------------
  280.   alias initialize_cms initialize unless $@
  281.   def initialize
  282.     @text_sound  = YEM::MESSAGE::SOUND_DEFAULT
  283.     @text_volume = 60
  284.     @text_pitch  = 100
  285.     initialize_cms
  286.   end
  287.   
  288.   #--------------------------------------------------------------------------
  289.   # alias method: clear
  290.   #--------------------------------------------------------------------------
  291.   alias clear_cms clear unless $@
  292.   def clear
  293.     @choice_text = []
  294.     clear_cms
  295.   end
  296.   
  297. end # Game_Message

  298. #===============================================================================
  299. # Game_Interpreter
  300. #===============================================================================

  301. class Game_Interpreter
  302.   
  303.   #--------------------------------------------------------------------------
  304.   # overwrite method: command_101 (Show Text)
  305.   #--------------------------------------------------------------------------
  306.   def command_101
  307.     unless $game_message.busy
  308.       $game_message.face_name = @params[0]
  309.       $game_message.face_index = @params[1]
  310.       $game_message.background = @params[2]
  311.       $game_message.position = @params[3]
  312.       flow = true
  313.       loop {
  314.         if @list[@index].code == 101 and meet_stringing_conditions and flow
  315.           @index += 1
  316.         else
  317.           break
  318.         end
  319.         flow = @row_check
  320.         while @list[@index].code == 401 and meet_stringing_conditions
  321.           $game_message.texts.push(@list[@index].parameters[0])
  322.           @index += 1
  323.         end }
  324.       if @list[@index].code == 102 # Show choices
  325.         setup_choices(@list[@index].parameters)
  326.       elsif @list[@index].code == 103 # Number input processing
  327.         setup_num_input(@list[@index].parameters)
  328.       end
  329.       set_message_waiting # Set to message wait state
  330.     end
  331.     return false
  332.   end
  333.   
  334.   #--------------------------------------------------------------------------
  335.   # overwrite method: setup_choices
  336.   #--------------------------------------------------------------------------
  337.   def setup_choices(params)
  338.     var = $game_variables[YEM::MESSAGE::ROW_VARIABLE]
  339.     rows = (var <= 0) ? 4 : var
  340.     return unless $game_message.texts.size <= rows - params[0].size or
  341.       $game_variables[YEM::MESSAGE::CHOICE_VARIABLE] > 0
  342.     $game_message.choice_start = $game_message.texts.size
  343.     $game_message.choice_max = params[0].size
  344.     for s in params[0]
  345.       $game_message.texts.push(s)
  346.     end
  347.     $game_message.choice_cancel_type = params[1]
  348.     $game_message.choice_proc = Proc.new { |n| @branch[@indent] = n }
  349.     @index += 1
  350.   end
  351.   
  352.   #--------------------------------------------------------------------------
  353.   # new method: meet_stringing_conditions
  354.   #--------------------------------------------------------------------------
  355.   def meet_stringing_conditions
  356.     var = $game_variables[YEM::MESSAGE::ROW_VARIABLE]
  357.     rows = (var <= 0) ? 4 : var
  358.     @row_check = (rows > 4) ? true : false
  359.     return true if rows > $game_message.texts.size
  360.     return false
  361.   end
  362.   
  363. end # Game_Interpreter

  364. #===============================================================================
  365. # Window_Message
  366. #===============================================================================

  367. class Window_Message < Window_Selectable
  368.   
  369.   #--------------------------------------------------------------------------
  370.   # public instance variables
  371.   #--------------------------------------------------------------------------
  372.   attr_accessor :position
  373.   
  374.   #--------------------------------------------------------------------------
  375.   # alias method: initialize
  376.   #--------------------------------------------------------------------------
  377.   alias initialize_cms initialize unless $@
  378.   def initialize
  379.     initialize_cms
  380.     var = $game_variables[YEM::MESSAGE::ROW_VARIABLE]
  381.     @max_rows = (var <= 0) ? 4 : var
  382.     nheight = YEM::MESSAGE::NAME_WINDOW_H
  383.     @choice_window = Window_MessageChoice.new(self)
  384.     @name_window = Window_Base.new(YEM::MESSAGE::NAME_WINDOW_X, 0, 100, nheight)
  385.     @name_text = Window_Base.new(YEM::MESSAGE::NAME_WINDOW_X, 0, 100, 56)
  386.     @name_window.openness = 0
  387.     @name_text.openness = 0
  388.     @name_text.opacity = 0
  389.     @name_window.z = self.z + 1
  390.     @name_text.z = @name_window.z + 1
  391.     @name_window_lock = false
  392.   end
  393.   
  394.   #--------------------------------------------------------------------------
  395.   # alias method: dispose
  396.   #--------------------------------------------------------------------------
  397.   alias dispose_cms dispose unless $@
  398.   def dispose
  399.     dispose_cms
  400.     @name_window.dispose if @name_window != nil
  401.     @name_text.dispose if @name_text != nil
  402.     @choice_window.dispose if @choice_window != nil
  403.   end
  404.   
  405.   #--------------------------------------------------------------------------
  406.   # new method: close
  407.   #--------------------------------------------------------------------------
  408.   def close
  409.     super
  410.     @choice_window.close
  411.     @name_window.close
  412.     @name_text.close
  413.     @name_window_lock = false
  414.   end
  415.   
  416.   #--------------------------------------------------------------------------
  417.   # alias method: update
  418.   #--------------------------------------------------------------------------
  419.   alias update_cms update unless $@
  420.   def update
  421.     @name_window.update
  422.     @name_text.update
  423.     @choice_window.update
  424.     update_cms
  425.   end
  426.   
  427.   #--------------------------------------------------------------------------
  428.   # new method: refresh_size
  429.   #--------------------------------------------------------------------------
  430.   def refresh_size
  431.     var = $game_variables[YEM::MESSAGE::ROW_VARIABLE]
  432.     $game_variables[YEM::MESSAGE::ROW_VARIABLE] = 4 if var <= 0
  433.     @max_rows = (var <= 0) ? 4 : var
  434.     calc_height = @max_rows * 24 + 32
  435.     $game_variables[YEM::MESSAGE::WIDTH_VARIABLE] = Graphics.width if
  436.       $game_variables[YEM::MESSAGE::WIDTH_VARIABLE] <= 0
  437.     widthvar = [$game_variables[YEM::MESSAGE::WIDTH_VARIABLE], 32].max
  438.     $game_variables[YEM::MESSAGE::WIDTH_VARIABLE] = [widthvar, 32].max
  439.     if (self.height != calc_height) or (widthvar != self.width)
  440.       self.height = calc_height
  441.       self.width = [widthvar, Graphics.width].min
  442.       self.x = (Graphics.width - self.width) / 2
  443.       create_contents
  444.     end
  445.   end
  446.   
  447.   #--------------------------------------------------------------------------
  448.   # overwrite method: reset_window
  449.   #--------------------------------------------------------------------------
  450.   def reset_window
  451.     var = $game_variables[YEM::MESSAGE::ROW_VARIABLE]
  452.     wheight = var <= 0 ? 4 * 24 + 32 : var * 24 + 32
  453.     @background = $game_message.background
  454.     @position = $game_message.position
  455.     self.opacity = (@background == 0) ? 255 : 0
  456.     case @position
  457.     when 0  # Top
  458.       self.y = 0
  459.       @gold_window.y = 360
  460.     when 1  # Middle
  461.       self.y = (Graphics.height - wheight) / 2
  462.       @gold_window.y = 0
  463.     when 2  # Bottom
  464.       self.y = (Graphics.height - wheight)
  465.       @gold_window.y = 0
  466.     end
  467.   end
  468.   
  469.   #--------------------------------------------------------------------------
  470.   # overwrite method: input_pause
  471.   #--------------------------------------------------------------------------
  472.   def input_pause
  473.     if Input.trigger?(Input::B) or Input.trigger?(Input::C) or
  474.     Input.press?(YEM::MESSAGE::TEXT_SKIP)
  475.       self.pause = false
  476.       if @text != nil and not @text.empty?
  477.         new_page if @line_count >= MAX_LINE
  478.       else
  479.         terminate_message
  480.       end
  481.     end
  482.   end
  483.   
  484.   #--------------------------------------------------------------------------
  485.   # called method: actor_face_art
  486.   #--------------------------------------------------------------------------
  487.   def self.actor_face_art(value)
  488.     if value == 0 and $game_party.members[0] != nil
  489.       $game_message.face_name  = $game_party.members[0].face_name
  490.       $game_message.face_index = $game_party.members[0].face_index
  491.     elsif $game_actors[value] != nil
  492.       $game_message.face_name  = $game_actors[value].face_name
  493.       $game_message.face_index = $game_actors[value].face_index
  494.     end
  495.     return ""
  496.   end
  497.   
  498.   #--------------------------------------------------------------------------
  499.   # overwrite method: start_message
  500.   #--------------------------------------------------------------------------
  501.   def start_message
  502.     refresh_size
  503.     @text = ""
  504.     choice_type = $game_variables[YEM::MESSAGE::CHOICE_VARIABLE]
  505.     for i in 0...$game_message.texts.size
  506.       if choice_type > 0 and i >= $game_message.choice_start
  507.         $game_message.choice_text += [$game_message.texts[i].clone]
  508.       else
  509.         @text += YEM::MESSAGE::CHOICE_INDENT if i >= $game_message.choice_start
  510.         @text += $game_message.texts[i].clone + "\x00"
  511.       end
  512.     end
  513.     @item_max = $game_message.choice_max
  514.     convert_special_characters
  515.     reset_window
  516.     new_page
  517.   end
  518.   
  519.   #--------------------------------------------------------------------------
  520.   # alias method: new_page
  521.   #--------------------------------------------------------------------------
  522.   alias new_page_cms new_page unless $@
  523.   def new_page
  524.     new_page_cms
  525.     @name_window.update_windowskin if $imported["SystemGameOptions"]
  526.     self.contents.font.name = YEM::MESSAGE::MESSAGE_WINDOW_FONT
  527.     self.contents.font.size = Font.default_size
  528.     self.contents.font.bold = Font.default_bold
  529.     self.contents.font.italic = Font.default_italic
  530.     self.contents.font.shadow = Font.default_shadow
  531.   end
  532.   
  533.   #--------------------------------------------------------------------------
  534.   # combination_class
  535.   #--------------------------------------------------------------------------
  536.   def combination_class(actor)
  537.     return "" if actor == nil
  538.     class1 = actor.class.name
  539.     return class1 unless $imported["JobSystemClasses"]
  540.     return class1 if actor.subclass == nil
  541.     class2 = actor.subclass.name
  542.     text = sprintf("%s/%s", class1, class2)
  543.     text = YEM::JOB::COMBINATION_NAMES[text]
  544.     return text
  545.   end
  546.   
  547.   #--------------------------------------------------------------------------
  548.   # refresh_name_box
  549.   #--------------------------------------------------------------------------
  550.   def refresh_name_box(name, side = 0)
  551.     return if $game_temp.in_battle
  552.     font_colour = YEM::MESSAGE::NAME_COLOUR
  553.     font_name = Font.default_name
  554.     font_size = Font.default_size
  555.     font_bold = Font.default_bold
  556.     font_italic = Font.default_italic
  557.     font_shadow = Font.default_shadow
  558.     icon = 0
  559.     name_width = 0
  560.     #---Convert Special Characters
  561.     name = name.gsub(/\x01\{(\d+)\}/i) {
  562.       font_colour = $1.to_i; ""}
  563.     name = name.gsub(/\x09\{(\d+)\}/i) {""}
  564.     name = name.gsub(/\x10\{(\d+)\}/i) {
  565.       icon = $1.to_i; name_width += YEM::MESSAGE::ICON_WIDTH; ""}
  566.     name = name.gsub(/\x11\{(\d+)\}/i) {
  567.       font_size = $1.to_i; ""}
  568.     name = name.gsub(/\x12\{(.*?)\}/i) {
  569.       font_name = $1.to_s; ""}
  570.     name = name.gsub(/\x13/i) {
  571.       font_bold = true; ""}
  572.     name = name.gsub(/\x14/i) {
  573.       font_italic = true; ""}
  574.     name = name.gsub(/\x15/i) {
  575.       font_shadow = true; ""}
  576.     #---Convert Special Characters
  577.     @name_text.contents.font.name = YEM::MESSAGE::MESSAGE_WINDOW_FONT
  578.     @name_text.contents.font.size = font_size
  579.     @name_text.contents.font.bold = font_bold
  580.     @name_text.contents.font.italic = font_italic
  581.     @name_text.contents.font.shadow = font_shadow
  582.     name_width += @name_text.contents.text_size(name).width
  583.     name_width += YEM::MESSAGE::NAME_WINDOW_W
  584.     @name_window.width = [name_width + 40, Graphics.width].min
  585.     @name_text.width = @name_window.width
  586.     var = $game_variables[YEM::MESSAGE::ROW_VARIABLE]
  587.     wheight = var <= 0 ? 4 * 24 + 32 : var * 24 + 32
  588.     position = $game_message.position
  589.     case position
  590.     when 0
  591.       @name_window.y = self.height - YEM::MESSAGE::NAME_WINDOW_H
  592.       @name_window.y += YEM::MESSAGE::NAME_WINDOW_Y
  593.     when 1
  594.       @name_window.y = (Graphics.height - wheight) / 2
  595.       @name_window.y -= YEM::MESSAGE::NAME_WINDOW_Y
  596.     when 2
  597.       @name_window.y = (Graphics.height - wheight)
  598.       @name_window.y -= YEM::MESSAGE::NAME_WINDOW_Y
  599.     end
  600.     offset = (@name_text.height - @name_window.height) / 2
  601.     @name_text.y = @name_window.y - offset
  602.     if YEM::MESSAGE::NAME_WINDOW_SHOW_BACK and $game_message.background == 0
  603.       @name_window.opacity = 255
  604.     else
  605.       @name_window.opacity = 0
  606.     end
  607.     if side == 0
  608.       @name_window.x = [YEM::MESSAGE::NAME_WINDOW_X + self.x, 0].max
  609.     else
  610.       @name_window.x = self.x + self.width - @name_window.width
  611.       @name_window.x -= YEM::MESSAGE::NAME_WINDOW_X
  612.       @name_window.x = self.x + self.width - @name_window.width if
  613.         (@name_window.x + @name_window.width) > Graphics.width
  614.     end
  615.     @name_text.x = @name_window.x
  616.     @name_window.create_contents
  617.     @name_text.create_contents
  618.     txh = [font_size + (font_size / 5), WLH].max
  619.     @name_text.contents.font.color = text_color(font_colour)
  620.     @name_text.contents.font.name = YEM::MESSAGE::MESSAGE_WINDOW_FONT
  621.     @name_text.contents.font.size = font_size
  622.     @name_text.contents.font.bold = font_bold
  623.     @name_text.contents.font.italic = font_italic
  624.     @name_text.contents.font.shadow = font_shadow
  625.     if icon > 0
  626.       iw = YEM::MESSAGE::ICON_WIDTH
  627.       @name_text.draw_icon(icon, YEM::MESSAGE::NAME_WINDOW_W / 2, 0)
  628.       @name_text.contents.draw_text(iw, 0, name_width + 8 - iw, txh, name, 1)
  629.     else
  630.       @name_text.contents.draw_text(0, 0, name_width + 8, txh, name, 1)
  631.     end
  632.     @name_window.open
  633.     @name_text.open
  634.     @name_window_open = true
  635.   end
  636.   
  637.   #--------------------------------------------------------------------------
  638.   # alias method: start_choice
  639.   #--------------------------------------------------------------------------
  640.   alias start_choice_cms start_choice unless $@
  641.   def start_choice
  642.     self.active = true
  643.     if $game_variables[YEM::MESSAGE::CHOICE_VARIABLE] > 0
  644.       @choice_window.appear
  645.       self.index = -1
  646.     else
  647.       self.active = true
  648.       self.index = 0
  649.     end
  650.   end
  651.   
  652.   #--------------------------------------------------------------------------
  653.   # alias method: input_choice
  654.   #--------------------------------------------------------------------------
  655.   alias input_choice_cms input_choice unless $@
  656.   def input_choice
  657.     if Input.trigger?(Input::C) and @choice_window.active
  658.       Sound.play_decision
  659.       $game_message.choice_proc.call(@choice_window.index)
  660.       @choice_window.disappear
  661.       terminate_message
  662.     elsif Input.trigger?(Input::B) and @choice_window.active
  663.       if $game_message.choice_cancel_type > 0
  664.         Sound.play_cancel
  665.         $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
  666.         @choice_window.disappear
  667.         terminate_message
  668.       end
  669.     else
  670.       input_choice_cms
  671.     end
  672.   end
  673.   
  674.   #--------------------------------------------------------------------------
  675.   # new method: play_text_sound
  676.   #--------------------------------------------------------------------------
  677.   def play_text_sound
  678.     return if $game_message.text_sound == nil
  679.     return if @line_show_fast or @show_fast
  680.     name  = $game_message.text_sound
  681.     $game_message.text_volume = 60 if $game_message.text_volume == nil
  682.     vol   = $game_message.text_volume
  683.     $game_message.text_pitch = 100 if $game_message.text_pitch == nil
  684.     pitch = $game_message.text_pitch
  685.     pitch += rand(YEM::MESSAGE::SOUND_PITCH_OFFSET)
  686.     pitch -= rand(YEM::MESSAGE::SOUND_PITCH_OFFSET)
  687.     RPG::SE.new(name, vol, pitch).play
  688.   end
  689.   
  690.   #--------------------------------------------------------------------------
  691.   # overwrite method: convert_special_characters
  692.   #--------------------------------------------------------------------------
  693.   def convert_special_characters
  694.     @name_window_open = false
  695.     @text = Window_Message.convert_regexp(@text)
  696.     #-------------------------------------------------------------
  697.     # Name box REGEXP Conversions
  698.     #-------------------------------------------------------------
  699.     @text.gsub!(/\\NB\[(.*?)\]/i) {
  700.       if $1.to_s != nil
  701.         refresh_name_box($1.to_s)
  702.       end; "" }
  703.     @text.gsub!(/\\NBL\[(.*?)\]/i) {
  704.       if $1.to_s != nil
  705.         refresh_name_box($1.to_s)
  706.         @name_window_lock = true
  707.       end; "" }
  708.     @text.gsub!(/\\NBU\[(.*?)\]/i) {
  709.       if $1.to_s != nil
  710.         refresh_name_box($1.to_s)
  711.         @name_window_lock = false
  712.       end; "" }
  713.     @text.gsub!(/\\NBU/i) {
  714.       @name_window.close
  715.       @name_text.close
  716.       @name_window_lock = false
  717.       "" }
  718.     @text.gsub!(/\\RNB\[(.*?)\]/i) {
  719.       if $1.to_s != nil
  720.         refresh_name_box($1.to_s, 1)
  721.       end; "" }
  722.     @text.gsub!(/\\RNBL\[(.*?)\]/i) {
  723.       if $1.to_s != nil
  724.         refresh_name_box($1.to_s, 1)
  725.         @name_window_lock = true
  726.       end; "" }
  727.     @text.gsub!(/\\RNBU\[(.*?)\]/i) {
  728.       if $1.to_s != nil
  729.         refresh_name_box($1.to_s, 1)
  730.         @name_window_lock = false
  731.       end; "" }
  732.     # Close the Name Window
  733.     unless @name_window_lock
  734.       @name_window.close if !@name_window_open
  735.       @name_text.close if !@name_window_open
  736.     end
  737.   end
  738.   
  739. end # Window_Message

  740. #===============================================================================
  741. # Window_MessageChoice
  742. #===============================================================================

  743. class Window_MessageChoice < Window_Selectable
  744.   
  745.   #--------------------------------------------------------------------------
  746.   # initialize
  747.   #--------------------------------------------------------------------------
  748.   def initialize(parent_window)
  749.     @parent = parent_window
  750.     dx = @parent.x; dy = @parent.y; dw = @parent.width; dh = @parent.height
  751.     super(dx, dy-dh, dw, dh)
  752.     self.openness = 0
  753.     self.active = false
  754.     self.z = @parent.z + 1
  755.   end
  756.   
  757.   #--------------------------------------------------------------------------
  758.   # appear
  759.   #--------------------------------------------------------------------------
  760.   def appear
  761.     self.update_windowskin if $imported["SystemGameOptions"]
  762.     self.open
  763.     self.active = true
  764.     self.index = 0
  765.     refresh
  766.   end
  767.   
  768.   #--------------------------------------------------------------------------
  769.   # disappear
  770.   #--------------------------------------------------------------------------
  771.   def disappear
  772.     self.update_windowskin if $imported["SystemGameOptions"]
  773.     self.close
  774.     self.active = false
  775.     self.index = -1
  776.   end
  777.   
  778.   #--------------------------------------------------------------------------
  779.   # refresh
  780.   #--------------------------------------------------------------------------
  781.   def refresh
  782.     self.contents.clear
  783.     reset_content_settings
  784.     @data = []
  785.     for i in $game_message.choice_text
  786.       @text = Window_Message.convert_regexp(i)
  787.       @data += [@text]
  788.     end
  789.     @type = $game_variables[YEM::MESSAGE::CHOICE_VARIABLE]
  790.     self.width = [calc_width, Graphics.width].min
  791.     case @type
  792.     when 1, 4
  793.       centered_window
  794.     when 2, 5
  795.       self.x = @parent.width - self.width + @parent.x
  796.       self.x -= YEM::MESSAGE::CHOICE_WINDOW_X unless @type == 5
  797.       centered_window if Graphics.width - self.x - self.width > self.x
  798.     when 3, 6
  799.       self.width = calc_width
  800.       self.x = @parent.x
  801.       self.x += YEM::MESSAGE::CHOICE_WINDOW_X unless @type == 6
  802.       centered_window if self.x > Graphics.width - self.x - self.width
  803.     end
  804.     self.x = [self.x, 0].max
  805.     self.x = Graphics.width - self.width if self.x + self.width > Graphics.width
  806.     self.height = 32 + @data.size * WLH
  807.     case @parent.position
  808.     when 0, 1
  809.       self.y = @parent.height + @parent.y
  810.       self.y -= YEM::MESSAGE::CHOICE_WINDOW_Y
  811.     when 2
  812.       self.y = @parent.y - self.height
  813.       self.y += YEM::MESSAGE::CHOICE_WINDOW_Y
  814.     end
  815.     @item_max = @data.size
  816.     create_contents
  817.     draw_choice_face
  818.     for i in 0..(@item_max.size-1); draw_item(i); end
  819.   end
  820.    
  821.   #--------------------------------------------------------------------------
  822.   # centered_window
  823.   #--------------------------------------------------------------------------
  824.   def centered_window; self.x = (Graphics.width - self.width)/2; end
  825.   
  826.   #--------------------------------------------------------------------------
  827.   # face_types
  828.   #--------------------------------------------------------------------------
  829.   def face_types; return [4,5,6]; end
  830.   
  831.   #--------------------------------------------------------------------------
  832.   # reset_content_settings
  833.   #--------------------------------------------------------------------------
  834.   def reset_content_settings
  835.     self.contents.font.color = normal_color
  836.     self.contents.font.name = YEM::MESSAGE::MESSAGE_WINDOW_FONT
  837.     self.contents.font.size = Font.default_size
  838.     self.contents.font.bold = Font.default_bold
  839.     self.contents.font.italic = Font.default_italic
  840.     self.contents.font.shadow = Font.default_shadow
  841.   end
  842.   
  843.   #--------------------------------------------------------------------------
  844.   # calc_width
  845.   #--------------------------------------------------------------------------
  846.   def calc_width
  847.     max_size = YEM::MESSAGE::CHOICE_WINDOW_W
  848.     for text in @data
  849.       text_width = contents.text_size(text).width
  850.       text_width += 32
  851.       max_size = [text_width, max_size].max
  852.     end
  853.     max_size += YEM::MESSAGE::CHOICE_WINDOW_E
  854.     max_size += 112 if face_types.include?(@type)
  855.     return max_size
  856.   end
  857.   
  858.   #--------------------------------------------------------------------------
  859.   # draw_choice_face
  860.   #--------------------------------------------------------------------------
  861.   def draw_choice_face
  862.     return unless face_types.include?(@type)
  863.     if $game_variables[YEM::MESSAGE::FACE_VARIABLE] <= 0
  864.       index = -1 * $game_variables[YEM::MESSAGE::FACE_VARIABLE]
  865.       index = [$game_party.members.size-1, index].min
  866.       actor = $game_party.members[index]
  867.     else
  868.       actor = $game_actors[$game_variables[YEM::MESSAGE::FACE_VARIABLE]]
  869.       actor = $game_party.members[0] if actor == nil
  870.     end
  871.     draw_actor_face(actor, 0, 0)
  872.   end
  873.   
  874.   #--------------------------------------------------------------------------
  875.   # draw_item
  876.   #--------------------------------------------------------------------------
  877.   def draw_item(index)
  878.     rect = item_rect(index)
  879.     self.contents.clear_rect(rect)
  880.     reset_content_settings
  881.     text = @data[index]
  882.     return if text == nil
  883.     align = 0; icon = 0; rect.width -= 8; dx = rect.x
  884.     text.gsub!(/\x01\{(\d+)\}/i) {
  885.       self.contents.font.color = text_color($1.to_i); ""}
  886.     text.gsub!(/\x10\{(\d+)\}/i) {
  887.       icon = $1.to_i; dx += 24; ""}
  888.     text.gsub!(/\x11\{(\d+)\}/i) {
  889.       self.contents.font.size = $1.to_i; ""}
  890.     text.gsub!(/\x12\{(.*?)\}/i) {
  891.       self.contents.font.name = $1.to_s; ""}
  892.     text.gsub!(/\x13/i) {
  893.       self.contents.font.bold = !self.contents.font.bold; ""}
  894.     text.gsub!(/\x14/i) {
  895.       self.contents.font.italic = !self.contents.font.italic; ""}
  896.     text.gsub!(/\x15/i) {
  897.       self.contents.font.shadow = !self.contents.font.shadow; ""}
  898.     text.gsub!(/\x16\{(\d+)\}/i) {
  899.       align = $1.to_i; ""}
  900.     dx += 4 if icon == 0
  901.     draw_icon(icon, rect.x, rect.y)
  902.     self.contents.draw_text(dx, rect.y, rect.width, WLH, text, align)
  903.   end
  904.   
  905.   #--------------------------------------------------------------------------
  906.   # item_rect
  907.   #--------------------------------------------------------------------------
  908.   def item_rect(index)
  909.     if face_types.include?(@type)
  910.       rect = Rect.new(0, 0, 0, 0)
  911.       rect.width = (contents.width + @spacing) / @column_max - @spacing - 112
  912.       rect.height = WLH
  913.       rect.x = 112 + index % @column_max * (rect.width + @spacing)
  914.       rect.y = index / @column_max * WLH
  915.       return rect
  916.     else
  917.       return super(index)
  918.     end
  919.   end
  920.   
  921. end # Window_MessageChoice
复制代码

点评

太长了,分两次发  发表于 2010-9-26 12:38

Lv2.观梦者

花开堪折直须折

梦石
0
星屑
676
在线时间
943 小时
注册时间
2010-7-17
帖子
4963

贵宾

2
 楼主| 发表于 2010-9-26 12:38:03 | 只看该作者

  1. #===============================================================================
  2. # Window_MessageChoice
  3. #===============================================================================

  4. class Window_MessageChoice < Window_Selectable
  5.   
  6.   #--------------------------------------------------------------------------
  7.   # initialize
  8.   #--------------------------------------------------------------------------
  9.   def initialize(parent_window)
  10.     @parent = parent_window
  11.     dx = @parent.x; dy = @parent.y; dw = @parent.width; dh = @parent.height
  12.     super(dx, dy-dh, dw, dh)
  13.     self.openness = 0
  14.     self.active = false
  15.     self.z = @parent.z + 1
  16.   end
  17.   
  18.   #--------------------------------------------------------------------------
  19.   # appear
  20.   #--------------------------------------------------------------------------
  21.   def appear
  22.     self.update_windowskin if $imported["SystemGameOptions"]
  23.     self.open
  24.     self.active = true
  25.     self.index = 0
  26.     refresh
  27.   end
  28.   
  29.   #--------------------------------------------------------------------------
  30.   # disappear
  31.   #--------------------------------------------------------------------------
  32.   def disappear
  33.     self.update_windowskin if $imported["SystemGameOptions"]
  34.     self.close
  35.     self.active = false
  36.     self.index = -1
  37.   end
  38.   
  39.   #--------------------------------------------------------------------------
  40.   # refresh
  41.   #--------------------------------------------------------------------------
  42.   def refresh
  43.     self.contents.clear
  44.     reset_content_settings
  45.     @data = []
  46.     for i in $game_message.choice_text
  47.       @text = Window_Message.convert_regexp(i)
  48.       @data += [@text]
  49.     end
  50.     @type = $game_variables[YEM::MESSAGE::CHOICE_VARIABLE]
  51.     self.width = [calc_width, Graphics.width].min
  52.     case @type
  53.     when 1, 4
  54.       centered_window
  55.     when 2, 5
  56.       self.x = @parent.width - self.width + @parent.x
  57.       self.x -= YEM::MESSAGE::CHOICE_WINDOW_X unless @type == 5
  58.       centered_window if Graphics.width - self.x - self.width > self.x
  59.     when 3, 6
  60.       self.width = calc_width
  61.       self.x = @parent.x
  62.       self.x += YEM::MESSAGE::CHOICE_WINDOW_X unless @type == 6
  63.       centered_window if self.x > Graphics.width - self.x - self.width
  64.     end
  65.     self.x = [self.x, 0].max
  66.     self.x = Graphics.width - self.width if self.x + self.width > Graphics.width
  67.     self.height = 32 + @data.size * WLH
  68.     case @parent.position
  69.     when 0, 1
  70.       self.y = @parent.height + @parent.y
  71.       self.y -= YEM::MESSAGE::CHOICE_WINDOW_Y
  72.     when 2
  73.       self.y = @parent.y - self.height
  74.       self.y += YEM::MESSAGE::CHOICE_WINDOW_Y
  75.     end
  76.     @item_max = @data.size
  77.     create_contents
  78.     draw_choice_face
  79.     for i in 0..(@item_max.size-1); draw_item(i); end
  80.   end
  81.    
  82.   #--------------------------------------------------------------------------
  83.   # centered_window
  84.   #--------------------------------------------------------------------------
  85.   def centered_window; self.x = (Graphics.width - self.width)/2; end
  86.   
  87.   #--------------------------------------------------------------------------
  88.   # face_types
  89.   #--------------------------------------------------------------------------
  90.   def face_types; return [4,5,6]; end
  91.   
  92.   #--------------------------------------------------------------------------
  93.   # reset_content_settings
  94.   #--------------------------------------------------------------------------
  95.   def reset_content_settings
  96.     self.contents.font.color = normal_color
  97.     self.contents.font.name = YEM::MESSAGE::MESSAGE_WINDOW_FONT
  98.     self.contents.font.size = Font.default_size
  99.     self.contents.font.bold = Font.default_bold
  100.     self.contents.font.italic = Font.default_italic
  101.     self.contents.font.shadow = Font.default_shadow
  102.   end
  103.   
  104.   #--------------------------------------------------------------------------
  105.   # calc_width
  106.   #--------------------------------------------------------------------------
  107.   def calc_width
  108.     max_size = YEM::MESSAGE::CHOICE_WINDOW_W
  109.     for text in @data
  110.       text_width = contents.text_size(text).width
  111.       text_width += 32
  112.       max_size = [text_width, max_size].max
  113.     end
  114.     max_size += YEM::MESSAGE::CHOICE_WINDOW_E
  115.     max_size += 112 if face_types.include?(@type)
  116.     return max_size
  117.   end
  118.   
  119.   #--------------------------------------------------------------------------
  120.   # draw_choice_face
  121.   #--------------------------------------------------------------------------
  122.   def draw_choice_face
  123.     return unless face_types.include?(@type)
  124.     if $game_variables[YEM::MESSAGE::FACE_VARIABLE] <= 0
  125.       index = -1 * $game_variables[YEM::MESSAGE::FACE_VARIABLE]
  126.       index = [$game_party.members.size-1, index].min
  127.       actor = $game_party.members[index]
  128.     else
  129.       actor = $game_actors[$game_variables[YEM::MESSAGE::FACE_VARIABLE]]
  130.       actor = $game_party.members[0] if actor == nil
  131.     end
  132.     draw_actor_face(actor, 0, 0)
  133.   end
  134.   
  135.   #--------------------------------------------------------------------------
  136.   # draw_item
  137.   #--------------------------------------------------------------------------
  138.   def draw_item(index)
  139.     rect = item_rect(index)
  140.     self.contents.clear_rect(rect)
  141.     reset_content_settings
  142.     text = @data[index]
  143.     return if text == nil
  144.     align = 0; icon = 0; rect.width -= 8; dx = rect.x
  145.     text.gsub!(/\x01\{(\d+)\}/i) {
  146.       self.contents.font.color = text_color($1.to_i); ""}
  147.     text.gsub!(/\x10\{(\d+)\}/i) {
  148.       icon = $1.to_i; dx += 24; ""}
  149.     text.gsub!(/\x11\{(\d+)\}/i) {
  150.       self.contents.font.size = $1.to_i; ""}
  151.     text.gsub!(/\x12\{(.*?)\}/i) {
  152.       self.contents.font.name = $1.to_s; ""}
  153.     text.gsub!(/\x13/i) {
  154.       self.contents.font.bold = !self.contents.font.bold; ""}
  155.     text.gsub!(/\x14/i) {
  156.       self.contents.font.italic = !self.contents.font.italic; ""}
  157.     text.gsub!(/\x15/i) {
  158.       self.contents.font.shadow = !self.contents.font.shadow; ""}
  159.     text.gsub!(/\x16\{(\d+)\}/i) {
  160.       align = $1.to_i; ""}
  161.     dx += 4 if icon == 0
  162.     draw_icon(icon, rect.x, rect.y)
  163.     self.contents.draw_text(dx, rect.y, rect.width, WLH, text, align)
  164.   end
  165.   
  166.   #--------------------------------------------------------------------------
  167.   # item_rect
  168.   #--------------------------------------------------------------------------
  169.   def item_rect(index)
  170.     if face_types.include?(@type)
  171.       rect = Rect.new(0, 0, 0, 0)
  172.       rect.width = (contents.width + @spacing) / @column_max - @spacing - 112
  173.       rect.height = WLH
  174.       rect.x = 112 + index % @column_max * (rect.width + @spacing)
  175.       rect.y = index / @column_max * WLH
  176.       return rect
  177.     else
  178.       return super(index)
  179.     end
  180.   end
  181.   
  182. end # Window_MessageChoice

  183. #===============================================================================
  184. # --- Window_Message ---
  185. # This is another instance of Window_Message and placed down here for easier
  186. # future editting and adding of more tags.
  187. #===============================================================================

  188. class Window_Message < Window_Selectable
  189.   
  190.   #--------------------------------------------------------------------------
  191.   # called method: convert_regexp
  192.   #--------------------------------------------------------------------------
  193.   def self.convert_regexp(text)
  194.     @text = text
  195.     #-------------------------------------------------------------
  196.     # Default REGEXP Conversions
  197.     #-------------------------------------------------------------
  198.     @text.gsub!(/\\V\[(\d+)\]/i)    { $game_variables[$1.to_i] }
  199.     @text.gsub!(/\\V\[(\d+)\]/i)    { $game_variables[$1.to_i] }
  200.    
  201.     #-------------------------------------------------------------
  202.     # Lunatic REGEXP Conversions
  203.     #-------------------------------------------------------------
  204.     @text.gsub!(/\\X\[(\d+)\]/i) {
  205.       Window_Message.custom_convert($1.to_i) }
  206.     @text.gsub!(/\\X\[(\d+):(\d+)\]/i) {
  207.       Window_Message.custom_convert($1.to_i, $2.to_i) }
  208.     @text.gsub!(/\\X\[(\d+):(\d+):(\d+)\]/i) {
  209.       Window_Message.custom_convert($1.to_i, $2.to_i, $3.to_i) }
  210.    
  211.     #-------------------------------------------------------------
  212.     # Default REGEXP Conversions
  213.     #-------------------------------------------------------------
  214.     @text.gsub!(/\\N\[0\]/i)        { $game_party.members[0].name }
  215.     @text.gsub!(/\\F\[(\d+)\]/i)    { Window_Message.actor_face_art($1.to_i) }
  216.     @text.gsub!(/\\N\[(\d+)\]/i)    { $game_actors[$1.to_i].name }
  217.     @text.gsub!(/\\C\[(\d+)\]/i)    { "\x01{#{$1}}" }
  218.     @text.gsub!(/\\G/i)             { "\x02" }
  219.     @text.gsub!(/\\\./)             { "\x03" }
  220.     @text.gsub!(/\\\|/)             { "\x04" }
  221.     @text.gsub!(/\\!/)              { "\x05" }
  222.     @text.gsub!(/\\>/)              { "\x06" }
  223.     @text.gsub!(/\\</)              { "\x07" }
  224.     @text.gsub!(/\\\^/)             { "\x08" }
  225.     @text.gsub!(/\\\\/)             { "\\" }
  226.    
  227.     #-------------------------------------------------------------
  228.     # New REGEXP Conversions
  229.     #-------------------------------------------------------------
  230.     @text.gsub!(/\\W\[(\d+)\]/i)    { "\x09{#{$1}}" }
  231.     @text.gsub!(/\\I\[(\d+)\]/i)    { "\x10{#{$1}}" }
  232.     @text.gsub!(/\\FS\[(\d+)\]/i)   { "\x11{#{$1}}" }
  233.     @text.gsub!(/\\FN\[(.*?)\]/i)   { "\x12{#{$1}}" }
  234.     @text.gsub!(/\\FB/i)            { "\x13" }
  235.     @text.gsub!(/\\FI/i)            { "\x14" }
  236.     @text.gsub!(/\\FH/i)            { "\x15" }
  237.     @text.gsub!(/\\AL\[(\d+)\]/i)   { "\x16{#{$1}}" }
  238.    
  239.     #-------------------------------------------------------------
  240.     # Victory Aftermath Conversions
  241.     #-------------------------------------------------------------
  242.     if $imported["VictoryAftermath"]
  243.       @text.gsub!(/\\VF/i) { victory_face_art }
  244.       @text.gsub!(/\\VN/i) { victory_actor_name }
  245.     end
  246.    
  247.     #-------------------------------------------------------------
  248.     # Automatic Actor REGEXP Conversions
  249.     #-------------------------------------------------------------
  250.     @text.gsub!(/\\AN\[(\d+)\]/i) {
  251.       if $game_actors[$1.to_i] != nil
  252.         $game_actors[$1.to_i].name
  253.       else; ""; end }
  254.     @text.gsub!(/\\AC\[(\d+)\]/i) {
  255.       if $game_actors[$1.to_i] != nil
  256.         $game_actors[$1.to_i].class.name
  257.       else; ""; end }
  258.     @text.gsub!(/\\AS\[(\d+)\]/i) {
  259.       if $imported["JobSystemClasses"] and
  260.       $game_actors[$1.to_i] != nil and
  261.       $game_actors[$1.to_i].subclass != nil
  262.         $game_actors[$1.to_i].subclass.name
  263.       else; ""; end }
  264.     @text.gsub!(/\\AX\[(\d+)\]/i) {
  265.       combination_class($game_actors[$1.to_i]) }
  266.     @text.gsub!(/\\AF\[(\d+)\]/i) {
  267.       if $game_actors[$1.to_i] != nil
  268.         $game_message.face_name = $game_actors[$1.to_i].face_name
  269.         $game_message.face_index = $game_actors[$1.to_i].face_index
  270.       end; "" }
  271.     @text.gsub!(/\\AF\[(\d+):(\d+)\]/i) {
  272.       if $game_actors[$1.to_i] != nil
  273.         $game_message.face_name = $game_actors[$1.to_i].face_name
  274.         $game_message.face_index = $2.to_i
  275.       end; "" }
  276.    
  277.     #-------------------------------------------------------------
  278.     # Automatic Party REGEXP Conversions
  279.     #-------------------------------------------------------------
  280.     @text.gsub!(/\\PN\[(\d+)\]/i) {
  281.       if $game_party.members[$1.to_i] != nil
  282.         $game_party.members[$1.to_i].name
  283.       else; ""; end }
  284.     @text.gsub!(/\\PC\[(\d+)\]/i) {
  285.       if $game_party.members[$1.to_i] != nil
  286.         $game_party.members[$1.to_i].class.name
  287.       else; ""; end }
  288.     @text.gsub!(/\\PS\[(\d+)\]/i) {
  289.       if $imported["JobSystemClasses"] and
  290.       $game_party.members[$1.to_i] != nil and
  291.       $game_party.members[$1.to_i].subclass != nil
  292.         $game_party.members[$1.to_i].subclass.name
  293.       else; ""; end }
  294.     @text.gsub!(/\\PX\[(\d+)\]/i) {
  295.       combination_class($game_party.members[$1.to_i]) }
  296.     @text.gsub!(/\\PF\[(\d+)\]/i) {
  297.       if $game_party.members[$1.to_i] != nil
  298.         $game_message.face_name = $game_party.members[$1.to_i].face_name
  299.         $game_message.face_index = $game_party.members[$1.to_i].face_index
  300.       end; "" }
  301.     @text.gsub!(/\\PF\[(\d+):(\d+)\]/i) {
  302.       if $game_party.members[$1.to_i] != nil
  303.         $game_message.face_name = $game_party.members[$1.to_i].face_name
  304.         $game_message.face_index = $2.to_i
  305.       end; "" }
  306.    
  307.     #-------------------------------------------------------------
  308.     # Auto Class, Item, Weapon, and Armour REGEXP Conversions
  309.     #-------------------------------------------------------------
  310.     @text.gsub!(/\\NC\[(\d+)\]/i) {
  311.       $data_classes[$1.to_i].name }
  312.     @text.gsub!(/\\NI\[(\d+)\]/i) {
  313.       $data_items[$1.to_i].name }
  314.     @text.gsub!(/\\NW\[(\d+)\]/i) {
  315.       $data_weapons[$1.to_i].name }
  316.     @text.gsub!(/\\NA\[(\d+)\]/i) {
  317.       $data_armors[$1.to_i].name }
  318.     @text.gsub!(/\\NS\[(\d+)\]/i) {
  319.       $data_skills[$1.to_i].name }
  320.     @text.gsub!(/\\NT\[(\d+)\]/i) {
  321.       $data_states[$1.to_i].name }
  322.     @text.gsub!(/\\II\[(\d+)\]/i) {
  323.       "\x10{#{$data_items[$1.to_i].icon_index}}" +
  324.       "#{$data_items[$1.to_i].name}"}
  325.     @text.gsub!(/\\IW\[(\d+)\]/i) {
  326.       "\x10{#{$data_weapons[$1.to_i].icon_index}}" +
  327.       "#{$data_weapons[$1.to_i].name}"}
  328.     @text.gsub!(/\\IA\[(\d+)\]/i) {
  329.       "\x10{#{$data_armors[$1.to_i].icon_index}}" +
  330.       "#{$data_armors[$1.to_i].name}"}
  331.     @text.gsub!(/\\IS\[(\d+)\]/i) {
  332.       "\x10{#{$data_skills[$1.to_i].icon_index}}" +
  333.       "#{$data_skills[$1.to_i].name}"}
  334.     @text.gsub!(/\\IT\[(\d+)\]/i) {
  335.       "\x10{#{$data_states[$1.to_i].icon_index}}" +
  336.       "#{$data_states[$1.to_i].name}"}
  337.     @text.gsub!(/\\\?/)             { "\xff" }
  338.     return @text
  339.   end
  340.   
  341.   #--------------------------------------------------------------------------
  342.   # overwrite update_message
  343.   #--------------------------------------------------------------------------
  344.   def update_message
  345.     loop do
  346.       @line_show_fast = true if Input.press?(YEM::MESSAGE::TEXT_SKIP)
  347.       text_height = [contents.font.size + (contents.font.size / 5), WLH].max
  348.       c = @text.slice!(/./m)            # Get next text character
  349.       case c
  350.       #----------------------------------------------------------------------
  351.       # Default Cases
  352.       #----------------------------------------------------------------------
  353.       when nil    # There is no text that must be drawn
  354.         finish_message                  # Finish update
  355.         break
  356.       when "\x00" # New line
  357.         new_line
  358.         if @line_count >= @max_rows     # If line count is maximum
  359.           unless @text.empty?           # If there is more
  360.             self.pause = true           # Insert number input
  361.             break
  362.           end
  363.         end
  364.       when "\x01" # \C[n]  (text character color change)
  365.         @text.sub!(/\{(\d+)\}/, "")
  366.         self.contents.font.color = text_color($1.to_i)
  367.         next
  368.       when "\x02" # \G  (gold display)
  369.         @gold_window.refresh
  370.         @gold_window.open
  371.       when "\x03" # \.  (wait 1/4 second)
  372.         @wait_count = 15
  373.         break
  374.       when "\x04" # \|  (wait 1 second)
  375.         @wait_count = 60
  376.         break
  377.       when "\x05" # \!  (Wait for input)
  378.         self.pause = true
  379.         break
  380.       when "\x06" # \>  (Fast display ON)
  381.         @line_show_fast = true
  382.       when "\x07" # \<  (Fast display OFF)
  383.         @line_show_fast = false
  384.       when "\x08" # \^  (No wait for input)
  385.         @pause_skip = true
  386.         
  387.       #----------------------------------------------------------------------
  388.       # New Cases
  389.       #----------------------------------------------------------------------
  390.       when "\x09" # \|  Wait x frames
  391.         @text.sub!(/\{(\d+)\}/, "")
  392.         @wait_count = $1.to_i
  393.         break
  394.       when "\x10" # \i  Draws icon ID x
  395.         @text.sub!(/\{(\d+)\}/, "")
  396.         icon = $1.to_i
  397.         icon_width = (24 - YEM::MESSAGE::ICON_WIDTH) / 2
  398.         draw_icon(icon, @contents_x - icon_width, @contents_y)
  399.         @contents_x += YEM::MESSAGE::ICON_WIDTH
  400.       when "\x11" # \fs Font Size Change
  401.         @text.sub!(/\{(\d+)\}/, "")
  402.         size = $1.to_i
  403.         if size <= 0 # If 0, revert back to the default font size.
  404.           size = Font.default_size
  405.         end
  406.         self.contents.font.size = size
  407.         text_height = [size + (size / 5), WLH].max
  408.       when "\x12" # \fs Font Name Change
  409.         @text.sub!(/\{(.*?)\}/, "")
  410.         name = $1.to_s
  411.         if name == "0" # If 0, revert back to the default font.
  412.           name = Font.default_name
  413.         end
  414.         self.contents.font.name = name
  415.       when "\x13" # \fb Font bold
  416.         self.contents.font.bold = self.contents.font.bold ? false : true
  417.       when "\x14" # \fi Font italic
  418.         self.contents.font.italic = self.contents.font.italic ? false : true
  419.       when "\x15" # \fi Font shadowed
  420.         self.contents.font.shadow = self.contents.font.shadow ? false : true
  421.       when "\x16" # Alignment change, for special choice boxes only.
  422.         @text.sub!(/\{(\d+)\}/, "")
  423.       when "\xff"
  424.         # Do nothing
  425.         
  426.       #----------------------------------------------------------------------
  427.       # Finish Up
  428.       #----------------------------------------------------------------------
  429.       else # Normal text character
  430.         self.contents.draw_text(@contents_x, @contents_y, 40, text_height, c)
  431.         c_width = self.contents.text_size(c).width
  432.         @contents_x += c_width
  433.         play_text_sound unless c == " "
  434.       end
  435.       break unless @show_fast or @line_show_fast
  436.     end
  437.   end
  438.   
  439. end # Window_Message

  440. #===============================================================================
  441. #
  442. # END OF FILE
  443. #
  444. #===============================================================================
复制代码
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

129993099
永恒の梦制作组QQ群
回复 支持 反对

使用道具 举报

Lv2.观梦者

花开堪折直须折

梦石
0
星屑
676
在线时间
943 小时
注册时间
2010-7-17
帖子
4963

贵宾

3
 楼主| 发表于 2010-9-26 13:32:35 | 只看该作者
不行的话……给个能在对话框上加上一个姓名框的脚本吧~
大家好,我叫节操,有一天,我被吃了。
http://forever-dream.5d6d.com
永恒の梦制作组论坛

129993099
永恒の梦制作组QQ群
回复 支持 反对

使用道具 举报

Lv4.逐梦者

醉啸 长风万里

梦石
0
星屑
6162
在线时间
6593 小时
注册时间
2007-12-16
帖子
4501

贵宾

4
发表于 2010-9-26 13:36:30 | 只看该作者
功能不是很齐全的对话脚本,把注释里的控制符用翻译工具翻译一下吧

点评

能否替换掉呼出原本的那个姓名背景条……  发表于 2010-9-26 13:39

还在龟速填坑中
回复 支持 反对

使用道具 举报

Lv2.观梦者

花开堪折直须折

梦石
0
星屑
676
在线时间
943 小时
注册时间
2010-7-17
帖子
4963

贵宾

5
 楼主| 发表于 2010-9-26 13:37:54 | 只看该作者
回复 仲秋启明 的帖子

能否和呼出对话框整合呢……拜托啊~~
   
回复 支持 反对

使用道具 举报

Lv4.逐梦者

醉啸 长风万里

梦石
0
星屑
6162
在线时间
6593 小时
注册时间
2007-12-16
帖子
4501

贵宾

6
发表于 2010-9-26 13:42:14 | 只看该作者
本帖最后由 仲秋启明 于 2010-9-26 13:44 编辑

回复 冰舞蝶恋 的帖子


    最简单的方法,将呼出对话框的“class Window_Message < Window_Selectable”改成
  “class Window_FUKI_Message < Window_Selectable”然后在Scene_Map中的“@message_window = Window_Message.new”
   改为:
  1. case $game_switches[54]
  2.     when false
  3.       @message_window = Window_Message.new
  4.     when true
  5.       @message_window = Window_FUKI_Message.new
  6.     end
复制代码
我这里设置的是54号开关控制

背景条的话,需要改动脚本

还在龟速填坑中
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
518 小时
注册时间
2010-6-16
帖子
1073
7
发表于 2010-9-26 13:45:06 | 只看该作者
这个吗?外国的……

NMS3_Demo.rar

331.2 KB, 下载次数: 91

点评

啊 感谢。  发表于 2010-9-26 18:09
这个能调出姓名框,更改对话框背景, 对话框显示图标或图案(不限大小!!!)还有很多……   发表于 2010-9-26 13:49

评分

参与人数 1星屑 +800 收起 理由
夕阳武士 + 800 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-11-17 00:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表