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

Project1

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

[已经解决] 对话框高度更改问题(Yanfly的姓名框脚本)

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
135 小时
注册时间
2012-6-14
帖子
43
跳转到指定楼层
1
发表于 2014-1-13 19:00:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 kkwo 于 2014-1-14 18:58 编辑

因为解析度的关係所以希望对话框可以高一点...
然后先是去改了Window_Message中的数值
可是发现好像没什麽用...
后来发现可能是我用了Yanfly的姓名框脚本
(Yanfly Engine Ace - Ace Message System v1.05)
其中234行数字就是高度的样子...

但是有个问题...
一改以后他会把下一句话同时显示出来
而且就算下句话改用不同位置视窗或是不同头像
通通都不会改变...

所以想请问...是我改错了还是有其他地方要改呢?
(因为我要的高度刚刚好再高一倍就是4变8...还是说是我要改这样的数字改错了?@@)
附上腳本
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Message System v1.05
  4. # -- Last Updated: 2012.01.13
  5. # -- Level: Normal
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-MessageSystem"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.07.21 - Fixed REGEXP error at line 824
  17. # 2012.01.13 - Bug Fixed: Negative tags didn't display other party members.
  18. # 2012.01.12 - Compatibility Update: Message Actor Codes
  19. # 2012.01.10 - Added Feature: \pic[x] text code.
  20. # 2012.01.04 - Bug Fixed: \ic tag was \ii. No longer the case.
  21. #            - Added: Scroll Text window now uses message window font.
  22. # 2011.12.31 - Started Script and Finished.
  23. #
  24. #==============================================================================
  25. # ▼ Introduction
  26. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  27. # While RPG Maker VX Ace certainly improved the message system a whole lot, it
  28. # wouldn't hurt to add in a few more features, such as name windows, converting
  29. # textcodes to write out the icons and/or names of items, weapons, armours, and
  30. # more in quicker fashion. This script also gives the developer the ability to
  31. # adjust the size of the message window during the game, give it a separate
  32. # font, and to give the player a text fast-forward feature.
  33. #
  34. #==============================================================================
  35. # ▼ Instructions
  36. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  37. # To install this script, open up your script editor and copy/paste this script
  38. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  39. #
  40. # -----------------------------------------------------------------------------
  41. # Message Window text Codes - These go inside of your message window.
  42. # -----------------------------------------------------------------------------
  43. #  Default:    Effect:
  44. #    \v[x]     - Writes variable x's value.
  45. #    \n[x]     - Writes actor x's name.
  46. #    \p[x]     - Writes party member x's name.
  47. #    \g        - Writes gold currency name.
  48. #    \c[x]     - Changes the colour of the text to x.
  49. #    \i[x]     - Draws icon x at position of the text.
  50. #    \{        - Makes text bigger by 8 points.
  51. #    \}        - Makes text smaller by 8 points.
  52. #    \$        - Opens gold window.
  53. #    \.        - Waits 15 frames (quarter second).
  54. #    \|        - Waits 60 frames (a full second).
  55. #    \!        - Waits until key is pressed.
  56. #    \>        - Following text is instant.
  57. #    \<        - Following text is no longer instant.
  58. #    \^        - Skips to the next message.
  59. #    \\        - Writes a "\" in the window.
  60. #
  61. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  62. #
  63. #  Wait:       Effect:
  64. #    \w[x]     - Waits x frames (60 frames = 1 second). Message window only.
  65. #
  66. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  67. #
  68. #  NameWindow: Effect:
  69. #    \n<x>     - Creates a name box with x string. Left side. *Note
  70. #    \nc<x>    - Creates a name box with x string. Centered. *Note
  71. #    \nr<x>    - Creates a name box with x string. Right side. *Note
  72. #
  73. #              *Note: Works for message window only.
  74. #
  75. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  76. #
  77. #  Position:   Effect:
  78. #    \px[x]    - Sets x position of text to x.
  79. #    \py[x]    - Sets y position of text to y.
  80. #
  81. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  82. #
  83. #  Picture:    Effect:
  84. #    \pic[x]   - Draws picture x from the Graphics\Pictures folder.
  85. #
  86. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  87. #
  88. #  Outline:    Effect:
  89. #    \oc[x]    - Sets outline colour to x.
  90. #    \oo[x]    - Sets outline opacity to x.
  91. #
  92. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  93. #
  94. #  Font:       Effect:
  95. #    \fr       - Resets all font changes.
  96. #    \fz[x]    - Changes font size to x.
  97. #    \fn[x]    - Changes font name to x.
  98. #    \fb       - Toggles font boldness.
  99. #    \fi       - Toggles font italic.
  100. #    \fo       - Toggles font outline.
  101. #    \fs       - Toggles font shadow.
  102. #
  103. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  104. #
  105. #  Actor:      Effect:
  106. #    \af[x]    - Shows face of actor x. *Note
  107. #    \ac[x]    - Writes out actor's class name. *Note
  108. #    \as[x]    - Writes out actor's subclass name. Req: Class System. *Note
  109. #    \an[x]    - Writes out actor's nickname. *Note
  110. #
  111. #              *Note: If x is 0 or negative, it will show the respective
  112. #               party member's face instead.
  113. #                   0 - Party Leader
  114. #                  -1 - 1st non-leader member.
  115. #                  -2 - 2nd non-leader member. So on.
  116. #
  117. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  118. #
  119. #  Names:      Effect:
  120. #    \nc[x]    - Writes out class x's name.
  121. #    \ni[x]    - Writes out item x's name.
  122. #    \nw[x]    - Writes out weapon x's name.
  123. #    \na[x]    - Writes out armour x's name.
  124. #    \ns[x]    - Writes out skill x's name.
  125. #    \nt[x]    - Writes out state x's name.
  126. #
  127. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  128. #
  129. #  Icon Names: Effect:
  130. #    \ic[x]    - Writes out class x's name including icon. *
  131. #    \ii[x]    - Writes out item x's name including icon.
  132. #    \iw[x]    - Writes out weapon x's name including icon.
  133. #    \ia[x]    - Writes out armour x's name including icon.
  134. #    \is[x]    - Writes out skill x's name including icon.
  135. #    \it[x]    - Writes out state x's name including icon.
  136. #
  137. #              *Note: Requires YEA - Class System
  138. #
  139. # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  140. #
  141. # And those are the text codes added with this script. Keep in mind that some
  142. # of these text codes only work for the Message Window. Otherwise, they'll work
  143. # for help descriptions, actor biographies, and others.
  144. #
  145. #==============================================================================
  146. # ▼ Compatibility
  147. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  148. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  149. # it will run with RPG Maker VX without adjusting.
  150. #
  151. #==============================================================================
  152.  
  153. module YEA
  154.   module MESSAGE
  155.  
  156.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  157.     # - General Message Settings -
  158.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  159.     # The following below will adjust the basic settings and that will affect
  160.     # the majority of the script. Adjust them as you see fit.
  161.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  162.     # This button is the button used to make message windows instantly skip
  163.     # forward. Hold down for the effect. Note that when held down, this will
  164.     # speed up the messages, but still wait for the pauses. However, it will
  165.     # automatically go to the next page when prompted.
  166.     TEXT_SKIP = :A     # Input::A is the shift button on keyboard.
  167.  
  168.     # This variable adjusts the number of visible rows shown in the message
  169.     # window. If you do not wish to use this feature, set this constant to 0.
  170.     # If the row value is 0 or below, it will automatically default to 4 rows.
  171.     VARIABLE_ROWS  = 21
  172.  
  173.     # This variable adjusts the width of the message window shown. If you do
  174.     # not wish to use this feature, set this constant to 0. If the width value
  175.     # is 0 or below, it will automatically default to the screen width.
  176.     VARIABLE_WIDTH = 22
  177.  
  178.     # This is the amount of space that the message window will indent whenever
  179.     # a face is used. Default: 112
  180.     FACE_INDENT_X = 112
  181.  
  182.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  183.     # - Name Window Settings -
  184.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  185.     # The name window is a window that appears outside of the main message
  186.     # window box to display whatever text is placed inside of it like a name.
  187.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  188.     NAME_WINDOW_X_BUFFER = -20     # Buffer x position of the name window.
  189.     NAME_WINDOW_Y_BUFFER = 0       # Buffer y position of the name window.
  190.     NAME_WINDOW_PADDING  = 20      # Padding added to the horizontal position.
  191.     NAME_WINDOW_OPACITY  = 255     # Opacity of the name window.
  192.     NAME_WINDOW_COLOUR   = 6       # Text colour used by default for names.
  193.  
  194.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  195.     # - Message Font Settings -
  196.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  197.     # Ace Message System separates the in-game system font form the message
  198.     # font. Adjust the settings here for your fonts.
  199.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  200.     # This array constant determines the fonts used. If the first font does not
  201.     # exist on the player's computer, the next font in question will be used
  202.     # in place instead and so on.
  203.     MESSAGE_WINDOW_FONT_NAME = ["Verdana", "Arial", "Courier New"]
  204.  
  205.     # These adjust the other settings regarding the way the game font appears
  206.     # including the font size, whether or not the font is bolded by default,
  207.     # italic by default, etc.
  208.     MESSAGE_WINDOW_FONT_SIZE    = 24       # Font size.
  209.     MESSAGE_WINDOW_FONT_BOLD    = false    # Default bold?
  210.     MESSAGE_WINDOW_FONT_ITALIC  = false    # Default italic?
  211.     MESSAGE_WINDOW_FONT_OUTLINE = true     # Default outline?
  212.     MESSAGE_WINDOW_FONT_SHADOW  = false    # Default shadow?
  213.  
  214.   end # MESSAGE
  215. end # YEA
  216.  
  217. #==============================================================================
  218. # ▼ Editting anything past this point may potentially result in causing
  219. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  220. # halitosis so edit at your own risk.
  221. #==============================================================================
  222.  
  223. #==============================================================================
  224. # ■ Variable
  225. #==============================================================================
  226.  
  227. module Variable
  228.  
  229.   #--------------------------------------------------------------------------
  230.   # self.message_rows
  231.   #--------------------------------------------------------------------------
  232.   def self.message_rows
  233.     return 4 if YEA::MESSAGE::VARIABLE_ROWS <= 0
  234.     return 4 if $game_variables[YEA::MESSAGE::VARIABLE_ROWS] <= 0
  235.  
  236.     return $game_variables[YEA::MESSAGE::VARIABLE_ROWS]
  237.   end
  238.  
  239.   #--------------------------------------------------------------------------
  240.   # self.message_width
  241.   #--------------------------------------------------------------------------
  242.   def self.message_width
  243.     return Graphics.width if YEA::MESSAGE::VARIABLE_WIDTH <= 0
  244.     return Graphics.width if $game_variables[YEA::MESSAGE::VARIABLE_WIDTH] <= 0
  245.     return $game_variables[YEA::MESSAGE::VARIABLE_WIDTH]
  246.   end
  247.  
  248. end # Variable
  249.  
  250. #==============================================================================
  251. # ■ Game_Interpreter
  252. #==============================================================================
  253.  
  254. class Game_Interpreter
  255.  
  256.   #--------------------------------------------------------------------------
  257.   # overwrite method: command_101
  258.   #--------------------------------------------------------------------------
  259.   def command_101
  260.     wait_for_message
  261.     $game_message.face_name = @params[0]
  262.     $game_message.face_index = @params[1]
  263.     $game_message.background = @params[2]
  264.     $game_message.position = @params[3]
  265.     while continue_message_string?
  266.       [url=home.php?mod=space&uid=370741]@Index[/url] += 1
  267.       if @list[@index].code == 401
  268.         $game_message.add(@list[@index].parameters[0])
  269.       end
  270.       break if $game_message.texts.size >= Variable.message_rows
  271.     end
  272.     case next_event_code
  273.     when 102
  274.       [url=home.php?mod=space&uid=370741]@Index[/url] += 1
  275.       setup_choices(@list[@index].parameters)
  276.     when 103
  277.       @index += 1
  278.       setup_num_input(@list[@index].parameters)
  279.     when 104
  280.       @index += 1
  281.       setup_item_choice(@list[@index].parameters)
  282.     end
  283.     wait_for_message
  284.   end
  285.  
  286.   #--------------------------------------------------------------------------
  287.   # new method: continue_message_string?
  288.   #--------------------------------------------------------------------------
  289.   def continue_message_string?
  290.     return true if next_event_code == 101 && Variable.message_rows > 4
  291.     return next_event_code == 401
  292.   end
  293.  
  294. end # Game_Interpreter
  295.  
  296. #==============================================================================
  297. # ■ Window_Base
  298. #==============================================================================
  299.  
  300. class Window_Base < Window
  301.  
  302.   #--------------------------------------------------------------------------
  303.   # new method: setup_message_font
  304.   #--------------------------------------------------------------------------
  305.   def setup_message_font
  306.     @message_font = true
  307.     change_color(normal_color)
  308.     contents.font.out_color = Font.default_out_color
  309.     contents.font.name = YEA::MESSAGE::MESSAGE_WINDOW_FONT_NAME
  310.     contents.font.size = YEA::MESSAGE::MESSAGE_WINDOW_FONT_SIZE
  311.     contents.font.bold = YEA::MESSAGE::MESSAGE_WINDOW_FONT_BOLD
  312.     contents.font.italic = YEA::MESSAGE::MESSAGE_WINDOW_FONT_ITALIC
  313.     contents.font.outline = YEA::MESSAGE::MESSAGE_WINDOW_FONT_OUTLINE
  314.     contents.font.shadow = YEA::MESSAGE::MESSAGE_WINDOW_FONT_SHADOW
  315.   end
  316.  
  317.   #--------------------------------------------------------------------------
  318.   # alias method: reset_font_settings
  319.   #--------------------------------------------------------------------------
  320.   alias window_base_reset_font_settings_ams reset_font_settings
  321.   def reset_font_settings
  322.     if @message_font
  323.       setup_message_font
  324.     else
  325.       window_base_reset_font_settings_ams
  326.       contents.font.out_color = Font.default_out_color
  327.       contents.font.outline = Font.default_outline
  328.       contents.font.shadow = Font.default_shadow
  329.     end
  330.   end
  331.  
  332.   #--------------------------------------------------------------------------
  333.   # alias method: convert_escape_characters
  334.   #--------------------------------------------------------------------------
  335.   alias window_base_convert_escape_characters_ams convert_escape_characters
  336.   def convert_escape_characters(text)
  337.     result = window_base_convert_escape_characters_ams(text)
  338.     result = convert_ace_message_system_new_escape_characters(result)
  339.     return result
  340.   end
  341.  
  342.   #--------------------------------------------------------------------------
  343.   # new method: convert_ace_message_system_new_escape_characters
  344.   #--------------------------------------------------------------------------
  345.   def convert_ace_message_system_new_escape_characters(result)
  346.     #---
  347.     result.gsub!(/\eFR/i) { "\eAMSF[0]" }
  348.     result.gsub!(/\eFB/i) { "\eAMSF[1]" }
  349.     result.gsub!(/\eFI/i) { "\eAMSF[2]" }
  350.     result.gsub!(/\eFO/i) { "\eAMSF[3]" }
  351.     result.gsub!(/\eFS/i) { "\eAMSF[4]" }
  352.     #---
  353.     result.gsub!(/\eAC\[([-+]?\d+)\]/i) { escape_actor_class_name($1.to_i) }
  354.     result.gsub!(/\eAS\[([-+]?\d+)\]/i) { escape_actor_subclass_name($1.to_i) }
  355.     result.gsub!(/\eAN\[([-+]?\d+)\]/i) { escape_actor_nickname($1.to_i) }
  356.     #---
  357.     result.gsub!(/\eNC\[(\d+)\]/i) { $data_classes[$1.to_i].name }
  358.     result.gsub!(/\eNI\[(\d+)\]/i) { $data_items[$1.to_i].name }
  359.     result.gsub!(/\eNW\[(\d+)\]/i) { $data_weapons[$1.to_i].name }
  360.     result.gsub!(/\eNA\[(\d+)\]/i) { $data_armors[$1.to_i].name }
  361.     result.gsub!(/\eNS\[(\d+)\]/i) { $data_skills[$1.to_i].name }
  362.     result.gsub!(/\eNT\[(\d+)\]/i) { $data_states[$1.to_i].name }
  363.     #---
  364.     result.gsub!(/\eIC\[(\d+)\]/i) { escape_icon_item($1.to_i, :class) }
  365.     result.gsub!(/\eII\[(\d+)\]/i) { escape_icon_item($1.to_i, :item) }
  366.     result.gsub!(/\eIW\[(\d+)\]/i) { escape_icon_item($1.to_i, :weapon) }
  367.     result.gsub!(/\eIA\[(\d+)\]/i) { escape_icon_item($1.to_i, :armour) }
  368.     result.gsub!(/\eIS\[(\d+)\]/i) { escape_icon_item($1.to_i, :skill) }
  369.     result.gsub!(/\eIT\[(\d+)\]/i) { escape_icon_item($1.to_i, :state) }
  370.     #---
  371.     return result
  372.   end
  373.  
  374.   #--------------------------------------------------------------------------
  375.   # new method: escape_actor_class_name
  376.   #--------------------------------------------------------------------------
  377.   def escape_actor_class_name(actor_id)
  378.     actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  379.     actor = $game_actors[actor_id]
  380.     return "" if actor.nil?
  381.     return actor.class.name
  382.   end
  383.  
  384.   #--------------------------------------------------------------------------
  385.   # new method: actor_subclass_name
  386.   #--------------------------------------------------------------------------
  387.   def escape_actor_subclass_name(actor_id)
  388.     return "" unless $imported["YEA-ClassSystem"]
  389.     actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  390.     actor = $game_actors[actor_id]
  391.     return "" if actor.nil?
  392.     return "" if actor.subclass.nil?
  393.     return actor.subclass.name
  394.   end
  395.  
  396.   #--------------------------------------------------------------------------
  397.   # new method: escape_actor_nickname
  398.   #--------------------------------------------------------------------------
  399.   def escape_actor_nickname(actor_id)
  400.     actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  401.     actor = $game_actors[actor_id]
  402.     return "" if actor.nil?
  403.     return actor.nickname
  404.   end
  405.  
  406.   #--------------------------------------------------------------------------
  407.   # new method: escape_icon_item
  408.   #--------------------------------------------------------------------------
  409.   def escape_icon_item(data_id, type)
  410.     case type
  411.     when :class
  412.       return "" unless $imported["YEA-ClassSystem"]
  413.       icon = $data_classes[data_id].icon_index
  414.       name = $data_items[data_id].name
  415.     when :item
  416.       icon = $data_items[data_id].icon_index
  417.       name = $data_items[data_id].name
  418.     when :weapon
  419.       icon = $data_weapons[data_id].icon_index
  420.       name = $data_weapons[data_id].name
  421.     when :armour
  422.       icon = $data_armors[data_id].icon_index
  423.       name = $data_armors[data_id].name
  424.     when :skill
  425.       icon = $data_skills[data_id].icon_index
  426.       name = $data_skills[data_id].name
  427.     when :state
  428.       icon = $data_states[data_id].icon_index
  429.       name = $data_states[data_id].name
  430.     else; return ""
  431.     end
  432.     text = "\eI[#{icon}]" + name
  433.     return text
  434.   end
  435.  
  436.   #--------------------------------------------------------------------------
  437.   # alias method: process_escape_character
  438.   #--------------------------------------------------------------------------
  439.   alias window_base_process_escape_character_ams process_escape_character
  440.   def process_escape_character(code, text, pos)
  441.     case code.upcase
  442.     #---
  443.     when 'FZ'
  444.       contents.font.size = obtain_escape_param(text)
  445.     when 'FN'
  446.       text.sub!(/\[(.*?)\]/, "")
  447.       font_name = $1.to_s
  448.       font_name = Font.default_name if font_name.nil?
  449.       contents.font.name = font_name.to_s
  450.     #---
  451.     when 'OC'
  452.       colour = text_color(obtain_escape_param(text))
  453.       contents.font.out_color = colour
  454.     when 'OO'
  455.       contents.font.out_color.alpha = obtain_escape_param(text)
  456.     #---
  457.     when 'AMSF'
  458.       case obtain_escape_param(text)
  459.       when 0; reset_font_settings
  460.       when 1; contents.font.bold = !contents.font.bold
  461.       when 2; contents.font.italic = !contents.font.italic
  462.       when 3; contents.font.outline = !contents.font.outline
  463.       when 4; contents.font.shadow = !contents.font.shadow
  464.       end
  465.     #---
  466.     when 'PX'
  467.       pos[:x] = obtain_escape_param(text)
  468.     when 'PY'
  469.       pos[:y] = obtain_escape_param(text)
  470.     #---
  471.     when 'PIC'
  472.       text.sub!(/\[(.*?)\]/, "")
  473.       bmp = Cache.picture($1.to_s)
  474.       rect = Rect.new(0, 0, bmp.width, bmp.height)
  475.       contents.blt(pos[:x], pos[:y], bmp, rect)
  476.     #---
  477.     else
  478.       window_base_process_escape_character_ams(code, text, pos)
  479.     end
  480.   end
  481.  
  482. end # Window_Base
  483.  
  484. #==============================================================================
  485. # ■ Window_ChoiceList
  486. #==============================================================================
  487.  
  488. class Window_ChoiceList < Window_Command
  489.  
  490.   #--------------------------------------------------------------------------
  491.   # alias method: initialize
  492.   #--------------------------------------------------------------------------
  493.   alias window_choicelist_initialize_ams initialize
  494.   def initialize(message_window)
  495.     window_choicelist_initialize_ams(message_window)
  496.     setup_message_font
  497.   end
  498.  
  499. end # Window_ChoiceList
  500.  
  501. #==============================================================================
  502. # ■ Window_ScrollText
  503. #==============================================================================
  504.  
  505. class Window_ScrollText < Window_Base
  506.  
  507.   #--------------------------------------------------------------------------
  508.   # alias method: initialize
  509.   #--------------------------------------------------------------------------
  510.   alias window_scrolltext_initialize_ams initialize
  511.   def initialize
  512.     window_scrolltext_initialize_ams
  513.     setup_message_font
  514.   end
  515.  
  516. end # Window_ScrollText
  517.  
  518. #==============================================================================
  519. # ■ Window_NameMessage
  520. #==============================================================================
  521.  
  522. class Window_NameMessage < Window_Base
  523.  
  524.   #--------------------------------------------------------------------------
  525.   # initialize
  526.   #--------------------------------------------------------------------------
  527.   def initialize(message_window)
  528.     @message_window = message_window
  529.     super(0, 0, Graphics.width, fitting_height(1))
  530.     self.opacity = YEA::MESSAGE::NAME_WINDOW_OPACITY
  531.     self.z = @message_window.z + 1
  532.     self.openness = 0
  533.     setup_message_font
  534.     @close_counter = 0
  535.     deactivate
  536.   end
  537.  
  538.   #--------------------------------------------------------------------------
  539.   # update
  540.   #--------------------------------------------------------------------------
  541.   def update
  542.     super
  543.     return if self.active
  544.     return if self.openness == 0
  545.     return if @closing
  546.     @close_counter -= 1
  547.     return if @close_counter > 0
  548.     close
  549.   end
  550.  
  551.   #--------------------------------------------------------------------------
  552.   # start_close
  553.   #--------------------------------------------------------------------------
  554.   def start_close
  555.     @close_counter = 4
  556.     deactivate
  557.   end
  558.  
  559.   #--------------------------------------------------------------------------
  560.   # force_close
  561.   #--------------------------------------------------------------------------
  562.   def force_close
  563.     @close_counter = 0
  564.     deactivate
  565.     close
  566.   end
  567.  
  568.   #--------------------------------------------------------------------------
  569.   # start
  570.   #--------------------------------------------------------------------------
  571.   def start(text, x_position)
  572.     @text = text.clone
  573.     set_width
  574.     create_contents
  575.     set_x_position(x_position)
  576.     set_y_position
  577.     refresh
  578.     activate
  579.     open
  580.   end
  581.  
  582.   #--------------------------------------------------------------------------
  583.   # set_width
  584.   #--------------------------------------------------------------------------
  585.   def set_width
  586.     text = @text.clone
  587.     dw = standard_padding * 2 + text_size(text).width
  588.     dw += YEA::MESSAGE::NAME_WINDOW_PADDING * 2
  589.     dw += calculate_size(text.slice!(0, 1), text) until text.empty?
  590.     self.width = dw
  591.   end
  592.  
  593.   #--------------------------------------------------------------------------
  594.   # calculate_size
  595.   #--------------------------------------------------------------------------
  596.   def calculate_size(code, text)
  597.     case code
  598.     when "\e"
  599.       return calculate_escape_code_width(obtain_escape_code(text), text)
  600.     else
  601.       return 0
  602.     end
  603.   end
  604.  
  605.   #--------------------------------------------------------------------------
  606.   # calculate_escape_code_width
  607.   #--------------------------------------------------------------------------
  608.   def calculate_escape_code_width(code, text)
  609.     dw = -text_size("\e").width - text_size(code).width
  610.     case code.upcase
  611.     when 'C', 'OC', 'OO'
  612.       dw += -text_size("[" + obtain_escape_param(text).to_s + "]").width
  613.       return dw
  614.     when 'I'
  615.       dw += -text_size("[" + obtain_escape_param(text).to_s + "]").width
  616.       dw += 24
  617.       return dw
  618.     when '{'
  619.       make_font_bigger
  620.     when '}'
  621.       make_font_smaller
  622.     when 'FZ'
  623.       contents.font.size = obtain_escape_param(text)
  624.     when 'FN'
  625.       text.sub!(/\[(.*?)\]/, "")
  626.       font_name = $1.to_s
  627.       font_name = Font.default_name if font_name.nil?
  628.       contents.font.name = font_name.to_s
  629.     when 'AMSF'
  630.       case obtain_escape_param(text)
  631.       when 0; reset_font_settings
  632.       when 1; contents.font.bold = !contents.font.bold
  633.       when 2; contents.font.italic = !contents.font.italic
  634.       when 3; contents.font.outline = !contents.font.outline
  635.       when 4; contents.font.shadow = !contents.font.shadow
  636.       end
  637.     else
  638.       return dw
  639.     end
  640.   end
  641.  
  642.   #--------------------------------------------------------------------------
  643.   # set_y_position
  644.   #--------------------------------------------------------------------------
  645.   def set_x_position(x_position)
  646.     case x_position
  647.     when 1 # Left
  648.       self.x = @message_window.x
  649.       self.x += YEA::MESSAGE::NAME_WINDOW_X_BUFFER
  650.     when 2 # 3/10
  651.       self.x = @message_window.x
  652.       self.x += @message_window.width * 3 / 10
  653.       self.x -= self.width / 2
  654.     when 3 # Center
  655.       self.x = @message_window.x
  656.       self.x += @message_window.width / 2
  657.       self.x -= self.width / 2
  658.     when 4 # 7/10
  659.       self.x = @message_window.x
  660.       self.x += @message_window.width * 7 / 10
  661.       self.x -= self.width / 2
  662.     when 5 # Right
  663.       self.x = @message_window.x + @message_window.width
  664.       self.x -= self.width
  665.       self.x -= YEA::MESSAGE::NAME_WINDOW_X_BUFFER
  666.     end
  667.     self.x = [[self.x, Graphics.width - self.width].min, 0].max
  668.   end
  669.  
  670.   #--------------------------------------------------------------------------
  671.   # set_y_position
  672.   #--------------------------------------------------------------------------
  673.   def set_y_position
  674.     case $game_message.position
  675.     when 0
  676.       self.y = @message_window.height
  677.       self.y -= YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
  678.     else
  679.       self.y = @message_window.y - self.height
  680.       self.y += YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
  681.     end
  682.   end
  683.  
  684.   #--------------------------------------------------------------------------
  685.   # refresh
  686.   #--------------------------------------------------------------------------
  687.   def refresh
  688.     contents.clear
  689.     reset_font_settings
  690.     @text = sprintf("\eC[%d]%s", YEA::MESSAGE::NAME_WINDOW_COLOUR, @text)
  691.     draw_text_ex(YEA::MESSAGE::NAME_WINDOW_PADDING, 0, @text)
  692.   end
  693.  
  694. end # Window_NameMessage
  695.  
  696. #==============================================================================
  697. # ■ Window_Message
  698. #==============================================================================
  699.  
  700. class Window_Message < Window_Base
  701.  
  702.   #--------------------------------------------------------------------------
  703.   # alias method: initialize
  704.   #--------------------------------------------------------------------------
  705.   alias window_message_initialize_ams initialize
  706.   def initialize
  707.     window_message_initialize_ams
  708.     setup_message_font
  709.   end
  710.  
  711.   #--------------------------------------------------------------------------
  712.   # overwrite method: window_width
  713.   #--------------------------------------------------------------------------
  714.   def window_width
  715.     return Variable.message_width
  716.   end
  717.  
  718.   #--------------------------------------------------------------------------
  719.   # overwrite method: window_height
  720.   #--------------------------------------------------------------------------
  721.   def window_height
  722.     return fitting_height(Variable.message_rows)
  723.   end
  724.  
  725.   #--------------------------------------------------------------------------
  726.   # alias method: create_all_windows
  727.   #--------------------------------------------------------------------------
  728.   alias window_message_create_all_windows_ams create_all_windows
  729.   def create_all_windows
  730.     window_message_create_all_windows_ams
  731.     @name_window = Window_NameMessage.new(self)
  732.   end
  733.  
  734.   #--------------------------------------------------------------------------
  735.   # overwrite method: create_back_bitmap
  736.   #--------------------------------------------------------------------------
  737.   def create_back_bitmap
  738.     @back_bitmap = Bitmap.new(width, height)
  739.     rect1 = Rect.new(0, 0, Graphics.width, 12)
  740.     rect2 = Rect.new(0, 12, Graphics.width, fitting_height(4) - 24)
  741.     rect3 = Rect.new(0, fitting_height(4) - 12, Graphics.width, 12)
  742.     @back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
  743.     @back_bitmap.fill_rect(rect2, back_color1)
  744.     @back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
  745.   end
  746.  
  747.   #--------------------------------------------------------------------------
  748.   # alias method: dispose_all_windows
  749.   #--------------------------------------------------------------------------
  750.   alias window_message_dispose_all_windows_ams dispose_all_windows
  751.   def dispose_all_windows
  752.     window_message_dispose_all_windows_ams
  753.     @name_window.dispose
  754.   end
  755.  
  756.   #--------------------------------------------------------------------------
  757.   # alias method: update_all_windows
  758.   #--------------------------------------------------------------------------
  759.   alias window_message_update_all_windows_ams update_all_windows
  760.   def update_all_windows
  761.     window_message_update_all_windows_ams
  762.     @name_window.update
  763.     @name_window.back_opacity = self.back_opacity
  764.     @name_window.opacity = self.opacity
  765.   end
  766.  
  767.   #--------------------------------------------------------------------------
  768.   # alias method: update_show_fast
  769.   #--------------------------------------------------------------------------
  770.   alias window_message_update_show_fast_ams update_show_fast
  771.   def update_show_fast
  772.     @show_fast = true if Input.press?(YEA::MESSAGE::TEXT_SKIP)
  773.     window_message_update_show_fast_ams
  774.   end
  775.  
  776.   #--------------------------------------------------------------------------
  777.   # overwrite method: input_pause
  778.   #--------------------------------------------------------------------------
  779.   def input_pause
  780.     self.pause = true
  781.     wait(10)
  782.     Fiber.yield until Input.trigger?(:B) || Input.trigger?(:C) ||
  783.       Input.press?(YEA::MESSAGE::TEXT_SKIP)
  784.     Input.update
  785.     self.pause = false
  786.   end
  787.  
  788.   #--------------------------------------------------------------------------
  789.   # overwrite method: convert_escape_characters
  790.   #--------------------------------------------------------------------------
  791.   def convert_escape_characters(text)
  792.     result = super(text.to_s.clone)
  793.     result = namebox_escape_characters(result)
  794.     result = message_escape_characters(result)
  795.     return result
  796.   end
  797.  
  798.   #--------------------------------------------------------------------------
  799.   # new method: namebox_escape_characters
  800.   #--------------------------------------------------------------------------
  801.   def namebox_escape_characters(result)
  802.     result.gsub!(/\eN\<(.+?)\>/i)  { namewindow($1, 1) }
  803.     result.gsub!(/\eN1\<(.+?)\>/i) { namewindow($1, 1) }
  804.     result.gsub!(/\eN2\<(.+?)\>/i) { namewindow($1, 2) }
  805.     result.gsub!(/\eNC\<(.+?)\>/i) { namewindow($1, 3) }
  806.     result.gsub!(/\eN3\<(.+?)\>/i) { namewindow($1, 3) }
  807.     result.gsub!(/\eN4\<(.+?)\>/i) { namewindow($1, 4) }
  808.     result.gsub!(/\eN5\<(.+?)\>/i) { namewindow($1, 5) }
  809.     result.gsub!(/\eNR\<(.+?)\>/i) { namewindow($1, 5) }
  810.     return result
  811.   end
  812.  
  813.   #--------------------------------------------------------------------------
  814.   # new method: namebox
  815.   #--------------------------------------------------------------------------
  816.   def namewindow(text, position)
  817.     @name_text = text
  818.     @name_position = position
  819.     return ""
  820.   end
  821.  
  822.   #--------------------------------------------------------------------------
  823.   # new method: message_escape_characters
  824.   #--------------------------------------------------------------------------
  825.   def message_escape_characters(result)
  826.     result.gsub!(/\eAF\[(-?\d+)]/i) { change_face($1.to_i) }
  827.     return result
  828.   end
  829.  
  830.   #--------------------------------------------------------------------------
  831.   # new method: change_face
  832.   #--------------------------------------------------------------------------
  833.   def change_face(actor_id)
  834.     actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  835.     actor = $game_actors[actor_id]
  836.     return "" if actor.nil?
  837.     $game_message.face_name = actor.face_name
  838.     $game_message.face_index = actor.face_index
  839.     return ""
  840.   end
  841.  
  842.   #--------------------------------------------------------------------------
  843.   # alias method: new_page
  844.   #--------------------------------------------------------------------------
  845.   alias window_message_new_page_ams new_page
  846.   def new_page(text, pos)
  847.     adjust_message_window_size
  848.     window_message_new_page_ams(text, pos)
  849.   end
  850.  
  851.   #--------------------------------------------------------------------------
  852.   # overwrite method: new_line_x
  853.   #--------------------------------------------------------------------------
  854.   def new_line_x
  855.     return $game_message.face_name.empty? ? 0 : YEA::MESSAGE::FACE_INDENT_X
  856.   end
  857.  
  858.   #--------------------------------------------------------------------------
  859.   # new method: adjust_message_window_size
  860.   #--------------------------------------------------------------------------
  861.   def adjust_message_window_size
  862.     self.height = window_height
  863.     self.width = window_width
  864.     create_contents
  865.     update_placement
  866.     self.x = (Graphics.width - self.width) / 2
  867.     start_name_window
  868.   end
  869.  
  870.   #--------------------------------------------------------------------------
  871.   # new method: clear_name_window
  872.   #--------------------------------------------------------------------------
  873.   def clear_name_window
  874.     @name_text = ""
  875.     @name_position = 0
  876.   end
  877.  
  878.   #--------------------------------------------------------------------------
  879.   # new method: start_name_window
  880.   #--------------------------------------------------------------------------
  881.   def start_name_window
  882.     return if @name_text == ""
  883.     @name_window.start(@name_text, @name_position)
  884.   end
  885.  
  886.   #--------------------------------------------------------------------------
  887.   # overwrite method: fiber_main
  888.   #--------------------------------------------------------------------------
  889.   def fiber_main
  890.     $game_message.visible = true
  891.     update_background
  892.     update_placement
  893.     loop do
  894.       process_all_text if $game_message.has_text?
  895.       process_input
  896.       $game_message.clear
  897.       @gold_window.close
  898.       @name_window.start_close
  899.       Fiber.yield
  900.       break unless text_continue?
  901.     end
  902.     close_and_wait
  903.     $game_message.visible = false
  904.     @fiber = nil
  905.   end
  906.  
  907.   #--------------------------------------------------------------------------
  908.   # alias method: open_and_wait
  909.   #--------------------------------------------------------------------------
  910.   alias window_message_open_and_wait_ams open_and_wait
  911.   def open_and_wait
  912.     clear_name_window
  913.     adjust_message_window_size
  914.     window_message_open_and_wait_ams
  915.   end
  916.  
  917.   #--------------------------------------------------------------------------
  918.   # alias method: close_and_wait
  919.   #--------------------------------------------------------------------------
  920.   alias window_message_close_and_wait_ams close_and_wait
  921.   def close_and_wait
  922.     @name_window.force_close
  923.     window_message_close_and_wait_ams
  924.   end
  925.  
  926.   #--------------------------------------------------------------------------
  927.   # alias method: all_close?
  928.   #--------------------------------------------------------------------------
  929.   alias window_message_all_close_ams all_close?
  930.   def all_close?
  931.     return window_message_all_close_ams && @name_window.close?
  932.   end
  933.  
  934.   #--------------------------------------------------------------------------
  935.   # alias method: process_escape_character
  936.   #--------------------------------------------------------------------------
  937.   alias window_message_process_escape_character_ams process_escape_character
  938.   def process_escape_character(code, text, pos)
  939.     case code.upcase
  940.     when 'W' # Wait
  941.       wait(obtain_escape_param(text))
  942.     else
  943.       window_message_process_escape_character_ams(code, text, pos)
  944.     end
  945.   end
  946.  
  947. end # Window_Message
  948.  
  949. #==============================================================================
  950. #
  951. # ▼ End of File
  952. #
  953. #==============================================================================
  

Lv1.梦旅人

梦石
0
星屑
50
在线时间
135 小时
注册时间
2012-6-14
帖子
43
2
 楼主| 发表于 2014-1-14 18:57:38 | 只看该作者
哈哈找到答案了
290行數字一起改掉就OK了
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-12 19:43

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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