查看: 2705|回复: 1

[转载发布] VXAce信息系统脚本中英对照版

[复制链接]
梦石
0
星屑
208
在线时间
420 小时
注册时间
2020-1-11
回帖
175
发表于 2020-10-16 14:34:14 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 alianlord 于 2020-10-16 14:37 编辑
  1. # \fn[fontname] - Change the font to fontname. If you put multiple fontnames
  2. #  { 【将字体改为fontname。如果你放了多个字体名 】  

  3. #     separated by commas, then it will take the first one the user has installed
  4.     #【用逗号分隔,那么它将使用用户安装的第一个】
  5.     #==============================================================================
  6.     #
  7.     # ▼ Yanfly Engine VXAce - VXAce Message System v1.05 【扬飞VXAce引擎-- VXAce信息系统】
  8.     # -- Last Updated: 2012.01.13                     【最后更新:2012.01.13】
  9.     # -- Level: Normal                                【等级:普通】
  10.     # -- Requires: n/a                                【要求:留白】
  11.     #
  12.     #==============================================================================
  13.      
  14.     $imported = {} if $imported.nil?
  15.     $imported["YEA-MessageSystem"] = true
  16.      
  17.     #==============================================================================
  18.     # ▼ Updates
  19.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  20.     # 2012.07.21 - Fixed REGEXP error at line 824
  21.     # 2012.01.13 - Bug Fixed: Negative tags didn't display other party members.
  22.     # 2012.01.12 - Compatibility Update: Message Actor Codes
  23.     # 2012.01.10 - Added Feature: \pic[x] text code.
  24.     # 2012.01.04 - Bug Fixed: \ic tag was \ii. No longer the case.
  25.     #            - Added: Scroll Text window now uses message window font.
  26.     # 2011.12.31 - Started Script and Finished.
  27.     #
  28.     #==============================================================================
  29.     # ▼ Introduction
  30.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31.     # While RPG Maker VX Ace certainly improved the message system a whole lot, it
  32.     # wouldn't hurt to add in a few more features, such as name windows, converting
  33.     # textcodes to write out the icons and/or names of items, weapons, armours, and
  34.     # more in quicker fashion. This script also gives the developer the ability to
  35.     # adjust the size of the message window during the game, give it a separate
  36.     # font, and to give the player a text fast-forward feature.
  37.     # 【 虽然RPG制造商VX Ace无疑对消息系统进行了很大改进,
  38.     #   但添加一些其他功能也不会有什么坏处,比如名称窗口、
  39.     #   转换文本代码以更快地写出物品、武器、防具的图标和/或名称等。
  40.     #   这个脚本还让开发人员能够在游戏中调整消息窗口的大小,给它一个单独的字体,
  41.     #   并给玩家一个文本快进功能。】
  42.     #==============================================================================
  43.     # ▼ Instructions 【说明书】
  44.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  45.     # To install this script, open up your script editor and copy/paste this script
  46.     #【 若要安装此脚本,请打开脚本编辑器并复制/粘贴此脚本 】
  47.     #
  48.     # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  49.     # 【 至▼材料/上方▼总管下方的开口槽。别忘做好备份的工作。】
  50.     # -----------------------------------------------------------------------------
  51.     # Message Window text Codes - These go inside of your message window.
  52.     # 消息窗口文本代码-这些代码位于消息窗口内部
  53.     # -----------------------------------------------------------------------------
  54.     #  Default:    Effect: 【默认:  效果:】
  55.     #    \v[x]     - Writes variable x's value.           【写入变量 x 的值。】
  56.     #    \n[x]     - Writes actor x's name.               【写入角色 X 的名字。】
  57.     #    \p[x]     - Writes party member x's name.        【写入队伍中第 X 人的名字。】
  58.     #    \g        - Writes gold currency name.           【写入队伍中当前执有金额。】
  59.     #    \c[x]     - Changes the colour of the text to x. 【将文本的颜色更改为x。】
  60.     #    \i[x]     - Draws icon x at position of the text.【在文本位置绘制图标x。】
  61.     #    \{        - Makes text bigger by 8 points.       【将字体的大小增加8像素。】
  62.     #    \}        - Makes text smaller by 8 points.      【将字体的大小减小8像素。】
  63.     #    \$        - Opens gold window.                   【打开所持金的窗口。】
  64.     #    \.        - Waits 15 frames (quarter second).    【暂停15帧。(四分之一秒)】
  65.     #    \|        - Waits 60 frames (a full second).     【暂停60帧。(一秒)】
  66.     #    \!        - Waits until key is pressed.          【一直等到按键才解除暂停】
  67.     #    \>        - Following text is instant.           【即时显示剩下来的文本。】
  68.     #    \<        - Following text is no longer instant. 【回归正常方式显示剩下来的文本。】
  69.     #    \^        - Skips to the next message.           【快进到下一条消息。】
  70.     #    \\        - Writes a "" in the window.          【在窗口中显示特殊符号""】
  71.     #
  72.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  73.     #
  74.     #  Wait:       Effect:
  75.     #    \w[x]     - Waits x frames (60 frames = 1 second). Message window only.
  76.     #              【暂停 x 秒】 (仅在信息窗口有用)
  77.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  78.     #
  79.     #  NameWindow: Effect:
  80.     #    \n<x>     - Creates a name box with x string. Left side. *Note
  81.     #              【创建一个带有 x 字符串的名称框。靠左。附注1】
  82.     #    \nc<x>    - Creates a name box with x string. Centered. *Note
  83.     #              【创建一个带有 x 字符串的名称框。置中。附注1】
  84.     #    \nr<x>    - Creates a name box with x string. Right side. *Note
  85.     #              【创建一个带有 x 字符串的名称框。靠右。附注1】
  86.     #            *Note: Works for message window only.
  87.     #            *附注1内容:(仅在信息窗口有用)
  88.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  89.     #
  90.     #  Position:   Effect:
  91.     #    \px[x]    - Sets x position of text to x.
  92.     #              【设置文本的位置的 x 坐标】
  93.     #    \py[x]    - Sets y position of text to y.
  94.     #              【设置文本的位置的 y 坐标】
  95.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  96.     #
  97.     #  Picture:    Effect:
  98.     #    \pic[x]   - Draws picture x from the Graphics\Pictures folder.
  99.     #              【描画一个图片 从Graphics\Pictures的文件夹。】
  100.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  101.     #
  102.     #  Outline:    Effect:
  103.     #    \oc[x]    - Sets outline colour to x.
  104.     #               【设置窗口的外框的颜色 x】
  105.     #    \oo[x]    - Sets outline opacity to x.
  106.     #               【设置窗口的外框的不透明度 x】
  107.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  108.     #
  109.     #  Font:       Effect:
  110.     #    \fr       - Resets all font changes.
  111.     #              【重置所有字体的设定】
  112.     #    \fz[x]    - Changes font size to x.
  113.     #              【转变字体的大小为 x】
  114.     #    \fn[x]    - Changes font name to x.
  115.     #              【转变字体的名称为 x】
  116.     #    \fb       - Toggles font boldness.
  117.     #              【转变字体为粗体】
  118.     #    \fi       - Toggles font italic.
  119.     #              【转变字体为斜体】
  120.     #    \fo       - Toggles font outline.
  121.     #               【转变字体为附带外轮廓】
  122.     #    \fs       - Toggles font shadow.
  123.     #               【转变字体为附带阴影】
  124.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  125.     #
  126.     #  Actor:      Effect:
  127.     #    \af[x]    - Shows face of actor x. *Note
  128.     #               【显示角色的脸图 x】 附注 2
  129.     #    \ac[x]    - Writes out actor's class name. *Note
  130.     #               【描写出角色的职业名称 x】 附注 2
  131.     #    \as[x]    - Writes out actor's subclass name. Req: Class System. *Note
  132.     #               【描写出角色的分支子职业 x】  要求:职业系统 附注 2
  133.     #    \an[x]    - Writes out actor's nickname. *Note
  134.     #               【描写出角色的别名 x】 附注 2
  135.     #
  136.     #            *Note: If x is 0 or negative, it will show the respective
  137.     #            *附注2内容: 如果 x为0 或 负数,它将有不同的显示
  138.     #               party member's face instead.           【小队成员的特殊调用值】
  139.     #                   0 - Party Leader                   【小队的领导】
  140.     #                  -1 - 1st non-leader member.         【非小队的领导的第一人】
  141.     #                  -2 - 2nd non-leader member. So on.  【非小队的领导的店二人等等】
  142.     #
  143.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  144.     #
  145.     #  Names:      Effect:
  146.     #    \nc[x]    - Writes out class x's name. 【描写出职业 x 的名称】
  147.     #    \ni[x]    - Writes out item x's name.  【描写出物品 x 的名称】
  148.     #    \nw[x]    - Writes out weapon x's name.【描写出武器 x 的名称】
  149.     #    \na[x]    - Writes out armour x's name.【描写出护具 x 的名称】
  150.     #    \ns[x]    - Writes out skill x's name. 【描写出特技 x 的名称】
  151.     #    \nt[x]    - Writes out state x's name. 【描写出状态 x 的名称】
  152.     #
  153.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  154.     #
  155.     #  Icon Names: Effect:
  156.     #    \ic[x]    - Writes out class x's name including icon. 【描写出职业 x 的图标】附注3
  157.     #    \ii[x]    - Writes out item x's name including icon.  【描写出物品 x 的图标】
  158.     #    \iw[x]    - Writes out weapon x's name including icon.【描写出武器 x 的图标】
  159.     #    \ia[x]    - Writes out armour x's name including icon.【描写出护具 x 的图标】
  160.     #    \is[x]    - Writes out skill x's name including icon. 【描写出特技 x 的图标】
  161.     #    \it[x]    - Writes out state x's name including icon. 【描写出状态 x 的图标】
  162.     #
  163.     #             *Note: Requires YEA - Class System
  164.     #             * 附注3 需要 YEA - Class System 的脚本
  165.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  166.     #
  167.     # And those are the text codes added with this script. Keep in mind that some
  168.     # of these text codes only work for the Message Window. Otherwise, they'll work
  169.     # for help descriptions, actor biographies, and others.
  170.     # 【这些是用这个脚本添加的文本代码。请记住,其中一些文本代码仅适用于消息窗口。
  171.     #  不在此限的,他们可用于 帮助描述,角色传记,和其他。】
  172.     #==============================================================================
  173.     # ▼ Compatibility 【兼容性】
  174.     # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  175.     # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  176.     # it will run with RPG Maker VX without adjusting.
  177.     # 这个脚本是严格为RPG Maker VX Ace编写的。
  178.     # 它不太可能在没有调整的情况下在RPG Maker VX Ace顺利运行?
  179.     #==============================================================================
  180.      
  181.     module YEA
  182.       module MESSAGE
  183.      
  184.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  185.         # - General Message Settings - 【常规消息设置】
  186.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  187.         # The following below will adjust the basic settings and that will affect
  188.         # the majority of the script. Adjust them as you see fit.
  189.         # 【下面将调整基本设置,这将影响脚本的大部分。根据需要调整它们。】
  190.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  191.         # This button is the button used to make message windows instantly skip
  192.         # forward. Hold down for the effect. Note that when held down, this will
  193.         # speed up the messages, but still wait for the pauses. However, it will
  194.         # automatically go to the next page when prompted.
  195.         #【此按钮用于使消息窗口立即向前跳转。按住以获得效果。请注意,当按下时,
  196.         #  这将加快消息的速度,但仍要等待暂停。但是,当提示时,它将自动转到下一页。】
  197.         TEXT_SKIP = :A     # Input::A is the shift button on keyboard.
  198.          ##【快进键的设定】#  Input::A 在键盘上是 shift 键
  199.      
  200.         # This variable adjusts the number of visible rows shown in the message
  201.         # window. If you do not wish to use this feature, set this constant to 0.
  202.         # If the row value is 0 or below, it will automatically default to 4 rows.
  203.         #【此变量调整消息窗口中显示的可见行数。如果不希望使用此功能,
  204.         #  请将此常量设置为0。如果行值为0或更低,它将自动默认为4行。】
  205.         VARIABLE_ROWS  = 0  ##【窗口的行数设定】
  206.      
  207.         # This variable adjusts the width of the message window shown. If you do
  208.         # not wish to use this feature, set this constant to 0. If the width value
  209.         # is 0 or below, it will automatically default to the screen width.
  210.         #【此变量调整显示的消息窗口的宽度。如果不希望使用此功能,
  211.         #  请将此常量设置为0。如果宽度值为0或更低,它将自动默认为屏幕宽度。】
  212.         VARIABLE_WIDTH = 0  ##【窗口的宽度设定】
  213.      
  214.         # This is the amount of space that the message window will indent whenever
  215.         # a face is used. Default: 112
  216.         #【信息窗口使用脸图时,文本缩进的距离。默认值:112】
  217.         FACE_INDENT_X = 112  ##【窗口的带脸图文本缩进量设定】
  218.      
  219.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  220.         # - Name Window Settings - 【名称窗口设置】
  221.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  222.         # The name window is a window that appears outside of the main message
  223.         # window box to display whatever text is placed inside of it like a name.
  224.         # 【“名称窗口”是一个出现在主消息窗口框外部的窗口,
  225.         #     用于显示放在其中的任何文本,就像名称一样。】
  226.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  227.         NAME_WINDOW_X_BUFFER = -20     # Buffer x position of the name window.
  228.                                        #【名称窗口的缓冲区x坐标偏移。】
  229.         NAME_WINDOW_Y_BUFFER = 0       # Buffer y position of the name window.
  230.                                        #【名称窗口的缓冲区y坐标偏移。】
  231.         NAME_WINDOW_PADDING  = 20      # Padding added to the horizontal position.
  232.                                        #【添加到水平位置的填充。】
  233.         NAME_WINDOW_OPACITY  = 255     # Opacity of the name window.
  234.                                        #【名称窗口的不透明度。】
  235.         NAME_WINDOW_COLOUR   = 6       # Text colour used by default for names.
  236.                                        # 【名称默认使用的文本颜色】
  237.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  238.         # - Message Font Settings - 【信息字体设置】
  239.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  240.         # Ace Message System separates the in-game system font form the message
  241.         # font. Adjust the settings here for your fonts.
  242.         #【Ace Message System将游戏中的系统字体与消息字体分开。在此处设定的字体参数。】
  243.         #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  244.         # This array constant determines the fonts used. If the first font does not
  245.         # exist on the player's computer, the next font in question will be used
  246.         # in place instead and so on.
  247.         #【此数组常量决定使用的字体。如果第一种字体在玩家的计算机上不存在,
  248.         #  数组常量下一个的字体将被使用,以此类推。】
  249.         MESSAGE_WINDOW_FONT_NAME = ["Microsoft YaHei"]  ##【窗口的使用角体的设定】
  250.      
  251.         # These adjust the other settings regarding the way the game font appears
  252.         # including the font size, whether or not the font is bolded by default,
  253.         # italic by default, etc.
  254.         #【这些设置会调整游戏字体显示方式的其他设置,
  255.         #  包括字体大小、字体是否默认为粗体、默认为斜体等。】
  256.         MESSAGE_WINDOW_FONT_SIZE    = 24       # Font size.        【字体大小】   
  257.         MESSAGE_WINDOW_FONT_BOLD    = false    # Default bold?     【字体粗体】
  258.         MESSAGE_WINDOW_FONT_ITALIC  = false    # Default italic?   【字体斜体】
  259.         MESSAGE_WINDOW_FONT_OUTLINE = true     # Default outline?  【字体外轮廓】
  260.         MESSAGE_WINDOW_FONT_SHADOW  = false    # Default shadow?   【字体阴影】
  261.      
  262.       end # MESSAGE
  263.     end # YEA
  264.      
  265.     #==============================================================================
  266.     # ▼ Editting anything past this point may potentially result in causing
  267.     # computer damage, incontinence, explosion of user's head, coma, death, and/or
  268.     # halitosis so edit at your own risk.
  269.     #【编辑任何超过此点的内容可能会导致计算机损坏、大小便失禁、用户头部爆炸、
  270.     #  昏迷、死亡和/或口臭,请自行承担编辑风险。】
  271.     #==============================================================================
  272.      
  273.     #==============================================================================
  274.     # ■ Variable
  275.     #==============================================================================
  276.      
  277.     module Variable
  278.      
  279.       #--------------------------------------------------------------------------
  280.       # self.message_rows
  281.       #--------------------------------------------------------------------------
  282.       def self.message_rows
  283.         return 4 if YEA::MESSAGE::VARIABLE_ROWS <= 0
  284.         return 4 if $game_variables[YEA::MESSAGE::VARIABLE_ROWS] <= 0
  285.         return $game_variables[YEA::MESSAGE::VARIABLE_ROWS]
  286.       end
  287.      
  288.       #--------------------------------------------------------------------------
  289.       # self.message_width
  290.       #--------------------------------------------------------------------------
  291.       def self.message_width
  292.         return Graphics.width if YEA::MESSAGE::VARIABLE_WIDTH <= 0
  293.         return Graphics.width if $game_variables[YEA::MESSAGE::VARIABLE_WIDTH] <= 0
  294.         return $game_variables[YEA::MESSAGE::VARIABLE_WIDTH]
  295.       end
  296.      
  297.     end # Variable
  298.      
  299.     #==============================================================================
  300.     # ■ Game_Interpreter
  301.     #==============================================================================
  302.      
  303.     class Game_Interpreter
  304.      
  305.       #--------------------------------------------------------------------------
  306.       # overwrite method: command_101
  307.       #--------------------------------------------------------------------------
  308.       def command_101
  309.         wait_for_message
  310.         $game_message.face_name = @params[0]
  311.         $game_message.face_index = @params[1]
  312.         $game_message.background = @params[2]
  313.         $game_message.position = @params[3]
  314.         while continue_message_string?
  315.           @index += 1
  316.           if @list[@index].code == 401
  317.             $game_message.add(@list[@index].parameters[0])
  318.           end
  319.           break if $game_message.texts.size >= Variable.message_rows
  320.         end
  321.         case next_event_code
  322.         when 102
  323.           @index += 1
  324.           setup_choices(@list[@index].parameters)
  325.         when 103
  326.           @index += 1
  327.           setup_num_input(@list[@index].parameters)
  328.         when 104
  329.           @index += 1
  330.           setup_item_choice(@list[@index].parameters)
  331.         end
  332.         wait_for_message
  333.       end
  334.      
  335.       #--------------------------------------------------------------------------
  336.       # new method: continue_message_string?
  337.       #--------------------------------------------------------------------------
  338.       def continue_message_string?
  339.         return true if next_event_code == 101 && Variable.message_rows > 4
  340.         return next_event_code == 401
  341.       end
  342.      
  343.     end # Game_Interpreter
  344.      
  345.     #==============================================================================
  346.     # ■ Window_Base
  347.     #==============================================================================
  348.      
  349.     class Window_Base < Window
  350.      
  351.       #--------------------------------------------------------------------------
  352.       # new method: setup_message_font
  353.       #--------------------------------------------------------------------------
  354.       def setup_message_font
  355.         @message_font = true
  356.         change_color(normal_color)
  357.         contents.font.out_color = Font.default_out_color
  358.         contents.font.name = YEA::MESSAGE::MESSAGE_WINDOW_FONT_NAME
  359.         contents.font.size = YEA::MESSAGE::MESSAGE_WINDOW_FONT_SIZE
  360.         contents.font.bold = YEA::MESSAGE::MESSAGE_WINDOW_FONT_BOLD
  361.         contents.font.italic = YEA::MESSAGE::MESSAGE_WINDOW_FONT_ITALIC
  362.         contents.font.outline = YEA::MESSAGE::MESSAGE_WINDOW_FONT_OUTLINE
  363.         contents.font.shadow = YEA::MESSAGE::MESSAGE_WINDOW_FONT_SHADOW
  364.       end
  365.      
  366.       #--------------------------------------------------------------------------
  367.       # alias method: reset_font_settings
  368.       #--------------------------------------------------------------------------
  369.       alias window_base_reset_font_settings_ams reset_font_settings
  370.       def reset_font_settings
  371.         if @message_font
  372.           setup_message_font
  373.         else
  374.           window_base_reset_font_settings_ams
  375.           contents.font.out_color = Font.default_out_color
  376.           contents.font.outline = Font.default_outline
  377.           contents.font.shadow = Font.default_shadow
  378.         end
  379.       end
  380.      
  381.       #--------------------------------------------------------------------------
  382.       # alias method: convert_escape_characters
  383.       #--------------------------------------------------------------------------
  384.       alias window_base_convert_escape_characters_ams convert_escape_characters
  385.       def convert_escape_characters(text)
  386.         result = window_base_convert_escape_characters_ams(text)
  387.         result = convert_ace_message_system_new_escape_characters(result)
  388.         return result
  389.       end
  390.      
  391.       #--------------------------------------------------------------------------
  392.       # new method: convert_ace_message_system_new_escape_characters
  393.       #--------------------------------------------------------------------------
  394.       def convert_ace_message_system_new_escape_characters(result)
  395.         #---
  396.         result.gsub!(/\eFR/i) { "\eAMSF[0]" }
  397.         result.gsub!(/\eFB/i) { "\eAMSF[1]" }
  398.         result.gsub!(/\eFI/i) { "\eAMSF[2]" }
  399.         result.gsub!(/\eFO/i) { "\eAMSF[3]" }
  400.         result.gsub!(/\eFS/i) { "\eAMSF[4]" }
  401.         #---
  402.         result.gsub!(/\eAC\[([-+]?\d+)\]/i) { escape_actor_class_name($1.to_i) }
  403.         result.gsub!(/\eAS\[([-+]?\d+)\]/i) { escape_actor_subclass_name($1.to_i) }
  404.         result.gsub!(/\eAN\[([-+]?\d+)\]/i) { escape_actor_nickname($1.to_i) }
  405.         #---
  406.         result.gsub!(/\eNC\[(\d+)\]/i) { $data_classes[$1.to_i].name }
  407.         result.gsub!(/\eNI\[(\d+)\]/i) { $data_items[$1.to_i].name }
  408.         result.gsub!(/\eNW\[(\d+)\]/i) { $data_weapons[$1.to_i].name }
  409.         result.gsub!(/\eNA\[(\d+)\]/i) { $data_armors[$1.to_i].name }
  410.         result.gsub!(/\eNS\[(\d+)\]/i) { $data_skills[$1.to_i].name }
  411.         result.gsub!(/\eNT\[(\d+)\]/i) { $data_states[$1.to_i].name }
  412.         #---
  413.         result.gsub!(/\eIC\[(\d+)\]/i) { escape_icon_item($1.to_i, :class) }
  414.         result.gsub!(/\eII\[(\d+)\]/i) { escape_icon_item($1.to_i, :item) }
  415.         result.gsub!(/\eIW\[(\d+)\]/i) { escape_icon_item($1.to_i, :weapon) }
  416.         result.gsub!(/\eIA\[(\d+)\]/i) { escape_icon_item($1.to_i, :armour) }
  417.         result.gsub!(/\eIS\[(\d+)\]/i) { escape_icon_item($1.to_i, :skill) }
  418.         result.gsub!(/\eIT\[(\d+)\]/i) { escape_icon_item($1.to_i, :state) }
  419.         #---
  420.         return result
  421.       end
  422.      
  423.       #--------------------------------------------------------------------------
  424.       # new method: escape_actor_class_name
  425.       #--------------------------------------------------------------------------
  426.       def escape_actor_class_name(actor_id)
  427.         actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  428.         actor = $game_actors[actor_id]
  429.         return "" if actor.nil?
  430.         return actor.class.name
  431.       end
  432.      
  433.       #--------------------------------------------------------------------------
  434.       # new method: actor_subclass_name
  435.       #--------------------------------------------------------------------------
  436.       def escape_actor_subclass_name(actor_id)
  437.         return "" unless $imported["YEA-ClassSystem"]
  438.         actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  439.         actor = $game_actors[actor_id]
  440.         return "" if actor.nil?
  441.         return "" if actor.subclass.nil?
  442.         return actor.subclass.name
  443.       end
  444.      
  445.       #--------------------------------------------------------------------------
  446.       # new method: escape_actor_nickname
  447.       #--------------------------------------------------------------------------
  448.       def escape_actor_nickname(actor_id)
  449.         actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  450.         actor = $game_actors[actor_id]
  451.         return "" if actor.nil?
  452.         return actor.nickname
  453.       end
  454.      
  455.       #--------------------------------------------------------------------------
  456.       # new method: escape_icon_item
  457.       #--------------------------------------------------------------------------
  458.       def escape_icon_item(data_id, type)
  459.         case type
  460.         when :class
  461.           return "" unless $imported["YEA-ClassSystem"]
  462.           icon = $data_classes[data_id].icon_index
  463.           name = $data_items[data_id].name
  464.         when :item
  465.           icon = $data_items[data_id].icon_index
  466.           name = $data_items[data_id].name
  467.         when :weapon
  468.           icon = $data_weapons[data_id].icon_index
  469.           name = $data_weapons[data_id].name
  470.         when :armour
  471.           icon = $data_armors[data_id].icon_index
  472.           name = $data_armors[data_id].name
  473.         when :skill
  474.           icon = $data_skills[data_id].icon_index
  475.           name = $data_skills[data_id].name
  476.         when :state
  477.           icon = $data_states[data_id].icon_index
  478.           name = $data_states[data_id].name
  479.         else; return ""
  480.         end
  481.         text = "\eI[#{icon}]" + name
  482.         return text
  483.       end
  484.      
  485.       #--------------------------------------------------------------------------
  486.       # alias method: process_escape_character
  487.       #--------------------------------------------------------------------------
  488.       alias window_base_process_escape_character_ams process_escape_character
  489.       def process_escape_character(code, text, pos)
  490.         case code.upcase
  491.         #---
  492.         when 'FZ'
  493.           contents.font.size = obtain_escape_param(text)
  494.         when 'FN'
  495.           text.sub!(/\[(.*?)\]/, "")
  496.           font_name = $1.to_s
  497.           font_name = Font.default_name if font_name.nil?
  498.           contents.font.name = font_name.to_s
  499.         #---
  500.         when 'OC'
  501.           colour = text_color(obtain_escape_param(text))
  502.           contents.font.out_color = colour
  503.         when 'OO'
  504.           contents.font.out_color.alpha = obtain_escape_param(text)
  505.         #---
  506.         when 'AMSF'
  507.           case obtain_escape_param(text)
  508.           when 0; reset_font_settings
  509.           when 1; contents.font.bold = !contents.font.bold
  510.           when 2; contents.font.italic = !contents.font.italic
  511.           when 3; contents.font.outline = !contents.font.outline
  512.           when 4; contents.font.shadow = !contents.font.shadow
  513.           end
  514.         #---
  515.         when 'PX'
  516.           pos[:x] = obtain_escape_param(text)
  517.         when 'PY'
  518.           pos[:y] = obtain_escape_param(text)
  519.         #---
  520.         when 'PIC'
  521.           text.sub!(/\[(.*?)\]/, "")
  522.           bmp = Cache.picture($1.to_s)
  523.           rect = Rect.new(0, 0, bmp.width, bmp.height)
  524.           contents.blt(pos[:x], pos[:y], bmp, rect)
  525.         #---
  526.         else
  527.           window_base_process_escape_character_ams(code, text, pos)
  528.         end
  529.       end
  530.      
  531.     end # Window_Base
  532.      
  533.     #==============================================================================
  534.     # ■ Window_ChoiceList
  535.     #==============================================================================
  536.      
  537.     class Window_ChoiceList < Window_Command
  538.      
  539.       #--------------------------------------------------------------------------
  540.       # alias method: initialize
  541.       #--------------------------------------------------------------------------
  542.       alias window_choicelist_initialize_ams initialize
  543.       def initialize(message_window)
  544.         window_choicelist_initialize_ams(message_window)
  545.         setup_message_font
  546.       end
  547.      
  548.     end # Window_ChoiceList
  549.      
  550.     #==============================================================================
  551.     # ■ Window_ScrollText
  552.     #==============================================================================
  553.      
  554.     class Window_ScrollText < Window_Base
  555.      
  556.       #--------------------------------------------------------------------------
  557.       # alias method: initialize
  558.       #--------------------------------------------------------------------------
  559.       alias window_scrolltext_initialize_ams initialize
  560.       def initialize
  561.         window_scrolltext_initialize_ams
  562.         setup_message_font
  563.       end
  564.      
  565.     end # Window_ScrollText
  566.      
  567.     #==============================================================================
  568.     # ■ Window_NameMessage
  569.     #==============================================================================
  570.      
  571.     class Window_NameMessage < Window_Base
  572.      
  573.       #--------------------------------------------------------------------------
  574.       # initialize
  575.       #--------------------------------------------------------------------------
  576.       def initialize(message_window)
  577.         @message_window = message_window
  578.         super(0, 0, Graphics.width, fitting_height(1))
  579.         self.opacity = YEA::MESSAGE::NAME_WINDOW_OPACITY
  580.         self.z = @message_window.z + 1
  581.         self.openness = 0
  582.         setup_message_font
  583.         @close_counter = 0
  584.         deactivate
  585.       end
  586.      
  587.       #--------------------------------------------------------------------------
  588.       # update
  589.       #--------------------------------------------------------------------------
  590.       def update
  591.         super
  592.         return if self.active
  593.         return if self.openness == 0
  594.         return if @closing
  595.         @close_counter -= 1
  596.         return if @close_counter > 0
  597.         close
  598.       end
  599.      
  600.       #--------------------------------------------------------------------------
  601.       # start_close
  602.       #--------------------------------------------------------------------------
  603.       def start_close
  604.         @close_counter = 4
  605.         deactivate
  606.       end
  607.      
  608.       #--------------------------------------------------------------------------
  609.       # force_close
  610.       #--------------------------------------------------------------------------
  611.       def force_close
  612.         @close_counter = 0
  613.         deactivate
  614.         close
  615.       end
  616.      
  617.       #--------------------------------------------------------------------------
  618.       # start
  619.       #--------------------------------------------------------------------------
  620.       def start(text, x_position)
  621.         @text = text.clone
  622.         set_width
  623.         create_contents
  624.         set_x_position(x_position)
  625.         set_y_position
  626.         refresh
  627.         activate
  628.         open
  629.       end
  630.      
  631.       #--------------------------------------------------------------------------
  632.       # set_width
  633.       #--------------------------------------------------------------------------
  634.       def set_width
  635.         text = @text.clone
  636.         dw = standard_padding * 2 + text_size(text).width
  637.         dw += YEA::MESSAGE::NAME_WINDOW_PADDING * 2
  638.         dw += calculate_size(text.slice!(0, 1), text) until text.empty?
  639.         self.width = dw
  640.       end
  641.      
  642.       #--------------------------------------------------------------------------
  643.       # calculate_size
  644.       #--------------------------------------------------------------------------
  645.       def calculate_size(code, text)
  646.         case code
  647.         when "\e"
  648.           return calculate_escape_code_width(obtain_escape_code(text), text)
  649.         else
  650.           return 0
  651.         end
  652.       end
  653.      
  654.       #--------------------------------------------------------------------------
  655.       # calculate_escape_code_width
  656.       #--------------------------------------------------------------------------
  657.       def calculate_escape_code_width(code, text)
  658.         dw = -text_size("\e").width - text_size(code).width
  659.         case code.upcase
  660.         when 'C', 'OC', 'OO'
  661.           dw += -text_size("[" + obtain_escape_param(text).to_s + "]").width
  662.           return dw
  663.         when 'I'
  664.           dw += -text_size("[" + obtain_escape_param(text).to_s + "]").width
  665.           dw += 24
  666.           return dw
  667.         when '{'
  668.           make_font_bigger
  669.         when '}'
  670.           make_font_smaller
  671.         when 'FZ'
  672.           contents.font.size = obtain_escape_param(text)
  673.         when 'FN'
  674.           text.sub!(/\[(.*?)\]/, "")
  675.           font_name = $1.to_s
  676.           font_name = Font.default_name if font_name.nil?
  677.           contents.font.name = font_name.to_s
  678.         when 'AMSF'
  679.           case obtain_escape_param(text)
  680.           when 0; reset_font_settings
  681.           when 1; contents.font.bold = !contents.font.bold
  682.           when 2; contents.font.italic = !contents.font.italic
  683.           when 3; contents.font.outline = !contents.font.outline
  684.           when 4; contents.font.shadow = !contents.font.shadow
  685.           end
  686.         else
  687.           return dw
  688.         end
  689.       end
  690.      
  691.       #--------------------------------------------------------------------------
  692.       # set_y_position
  693.       #--------------------------------------------------------------------------
  694.       def set_x_position(x_position)
  695.         case x_position
  696.         when 1 # Left
  697.           self.x = @message_window.x
  698.           self.x += YEA::MESSAGE::NAME_WINDOW_X_BUFFER
  699.         when 2 # 3/10
  700.           self.x = @message_window.x
  701.           self.x += @message_window.width * 3 / 10
  702.           self.x -= self.width / 2
  703.         when 3 # Center
  704.           self.x = @message_window.x
  705.           self.x += @message_window.width / 2
  706.           self.x -= self.width / 2
  707.         when 4 # 7/10
  708.           self.x = @message_window.x
  709.           self.x += @message_window.width * 7 / 10
  710.           self.x -= self.width / 2
  711.         when 5 # Right
  712.           self.x = @message_window.x + @message_window.width
  713.           self.x -= self.width
  714.           self.x -= YEA::MESSAGE::NAME_WINDOW_X_BUFFER
  715.         end
  716.         self.x = [[self.x, Graphics.width - self.width].min, 0].max
  717.       end
  718.      
  719.       #--------------------------------------------------------------------------
  720.       # set_y_position
  721.       #--------------------------------------------------------------------------
  722.       def set_y_position
  723.         case $game_message.position
  724.         when 0
  725.           self.y = @message_window.height
  726.           self.y -= YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
  727.         else
  728.           self.y = @message_window.y - self.height
  729.           self.y += YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
  730.         end
  731.       end
  732.      
  733.       #--------------------------------------------------------------------------
  734.       # refresh
  735.       #--------------------------------------------------------------------------
  736.       def refresh
  737.         contents.clear
  738.         reset_font_settings
  739.         @text = sprintf("\eC[%d]%s", YEA::MESSAGE::NAME_WINDOW_COLOUR, @text)
  740.         draw_text_ex(YEA::MESSAGE::NAME_WINDOW_PADDING, 0, @text)
  741.       end
  742.      
  743.     end # Window_NameMessage
  744.      
  745.     #==============================================================================
  746.     # ■ Window_Message
  747.     #==============================================================================
  748.      
  749.     class Window_Message < Window_Base
  750.      
  751.       #--------------------------------------------------------------------------
  752.       # alias method: initialize
  753.       #--------------------------------------------------------------------------
  754.       alias window_message_initialize_ams initialize
  755.       def initialize
  756.         window_message_initialize_ams
  757.         setup_message_font
  758.       end
  759.      
  760.       #--------------------------------------------------------------------------
  761.       # overwrite method: window_width
  762.       #--------------------------------------------------------------------------
  763.       def window_width
  764.         return Variable.message_width
  765.       end
  766.      
  767.       #--------------------------------------------------------------------------
  768.       # overwrite method: window_height
  769.       #--------------------------------------------------------------------------
  770.       def window_height
  771.         return fitting_height(Variable.message_rows)
  772.       end
  773.      
  774.       #--------------------------------------------------------------------------
  775.       # alias method: create_all_windows
  776.       #--------------------------------------------------------------------------
  777.       alias window_message_create_all_windows_ams create_all_windows
  778.       def create_all_windows
  779.         window_message_create_all_windows_ams
  780.         @name_window = Window_NameMessage.new(self)
  781.       end
  782.      
  783.       #--------------------------------------------------------------------------
  784.       # overwrite method: create_back_bitmap
  785.       #--------------------------------------------------------------------------
  786.       def create_back_bitmap
  787.         @back_bitmap = Bitmap.new(width, height)
  788.         rect1 = Rect.new(0, 0, Graphics.width, 12)
  789.         rect2 = Rect.new(0, 12, Graphics.width, fitting_height(4) - 24)
  790.         rect3 = Rect.new(0, fitting_height(4) - 12, Graphics.width, 12)
  791.         @back_bitmap.gradient_fill_rect(rect1, back_color2, back_color1, true)
  792.         @back_bitmap.fill_rect(rect2, back_color1)
  793.         @back_bitmap.gradient_fill_rect(rect3, back_color1, back_color2, true)
  794.       end
  795.      
  796.       #--------------------------------------------------------------------------
  797.       # alias method: dispose_all_windows
  798.       #--------------------------------------------------------------------------
  799.       alias window_message_dispose_all_windows_ams dispose_all_windows
  800.       def dispose_all_windows
  801.         window_message_dispose_all_windows_ams
  802.         @name_window.dispose
  803.       end
  804.      
  805.       #--------------------------------------------------------------------------
  806.       # alias method: update_all_windows
  807.       #--------------------------------------------------------------------------
  808.       alias window_message_update_all_windows_ams update_all_windows
  809.       def update_all_windows
  810.         window_message_update_all_windows_ams
  811.         @name_window.update
  812.         @name_window.back_opacity = self.back_opacity
  813.         @name_window.opacity = self.opacity
  814.       end
  815.      
  816.       #--------------------------------------------------------------------------
  817.       # alias method: update_show_fast
  818.       #--------------------------------------------------------------------------
  819.       alias window_message_update_show_fast_ams update_show_fast
  820.       def update_show_fast
  821.         @show_fast = true if Input.press?(YEA::MESSAGE::TEXT_SKIP)
  822.         window_message_update_show_fast_ams
  823.       end
  824.      
  825.       #--------------------------------------------------------------------------
  826.       # overwrite method: input_pause
  827.       #--------------------------------------------------------------------------
  828.       def input_pause
  829.         self.pause = true
  830.         wait(10)
  831.         Fiber.yield until Input.trigger?(:B) || Input.trigger?(:C) ||
  832.           Input.press?(YEA::MESSAGE::TEXT_SKIP)
  833.         Input.update
  834.         self.pause = false
  835.       end
  836.      
  837.       #--------------------------------------------------------------------------
  838.       # overwrite method: convert_escape_characters
  839.       #--------------------------------------------------------------------------
  840.       def convert_escape_characters(text)
  841.         result = super(text.to_s.clone)
  842.         result = namebox_escape_characters(result)
  843.         result = message_escape_characters(result)
  844.         return result
  845.       end
  846.      
  847.       #--------------------------------------------------------------------------
  848.       # new method: namebox_escape_characters
  849.       #--------------------------------------------------------------------------
  850.       def namebox_escape_characters(result)
  851.         result.gsub!(/\eN\<(.+?)\>/i)  { namewindow($1, 1) }
  852.         result.gsub!(/\eN1\<(.+?)\>/i) { namewindow($1, 1) }
  853.         result.gsub!(/\eN2\<(.+?)\>/i) { namewindow($1, 2) }
  854.         result.gsub!(/\eNC\<(.+?)\>/i) { namewindow($1, 3) }
  855.         result.gsub!(/\eN3\<(.+?)\>/i) { namewindow($1, 3) }
  856.         result.gsub!(/\eN4\<(.+?)\>/i) { namewindow($1, 4) }
  857.         result.gsub!(/\eN5\<(.+?)\>/i) { namewindow($1, 5) }
  858.         result.gsub!(/\eNR\<(.+?)\>/i) { namewindow($1, 5) }
  859.         return result
  860.       end
  861.      
  862.       #--------------------------------------------------------------------------
  863.       # new method: namebox
  864.       #--------------------------------------------------------------------------
  865.       def namewindow(text, position)
  866.         @name_text = text
  867.         @name_position = position
  868.         return ""
  869.       end
  870.      
  871.       #--------------------------------------------------------------------------
  872.       # new method: message_escape_characters
  873.       #--------------------------------------------------------------------------
  874.       def message_escape_characters(result)
  875.         result.gsub!(/\eAF\[(-?\d+)]/i) { change_face($1.to_i) }
  876.         return result
  877.       end
  878.      
  879.       #--------------------------------------------------------------------------
  880.       # new method: change_face
  881.       #--------------------------------------------------------------------------
  882.       def change_face(actor_id)
  883.         actor_id = $game_party.members[actor_id.abs].id if actor_id <= 0
  884.         actor = $game_actors[actor_id]
  885.         return "" if actor.nil?
  886.         $game_message.face_name = actor.face_name
  887.         $game_message.face_index = actor.face_index
  888.         return ""
  889.       end
  890.      
  891.       #--------------------------------------------------------------------------
  892.       # alias method: new_page
  893.       #--------------------------------------------------------------------------
  894.       alias window_message_new_page_ams new_page
  895.       def new_page(text, pos)
  896.         adjust_message_window_size
  897.         window_message_new_page_ams(text, pos)
  898.       end
  899.      
  900.       #--------------------------------------------------------------------------
  901.       # overwrite method: new_line_x
  902.       #--------------------------------------------------------------------------
  903.       def new_line_x
  904.         return $game_message.face_name.empty? ? 0 : YEA::MESSAGE::FACE_INDENT_X
  905.       end
  906.      
  907.       #--------------------------------------------------------------------------
  908.       # new method: adjust_message_window_size
  909.       #--------------------------------------------------------------------------
  910.       def adjust_message_window_size
  911.         self.height = window_height
  912.         self.width = window_width
  913.         create_contents
  914.         update_placement
  915.         self.x = (Graphics.width - self.width) / 2
  916.         start_name_window
  917.       end
  918.      
  919.       #--------------------------------------------------------------------------
  920.       # new method: clear_name_window
  921.       #--------------------------------------------------------------------------
  922.       def clear_name_window
  923.         @name_text = ""
  924.         @name_position = 0
  925.       end
  926.      
  927.       #--------------------------------------------------------------------------
  928.       # new method: start_name_window
  929.       #--------------------------------------------------------------------------
  930.       def start_name_window
  931.         @name_text ||= ""
  932.         return if @name_text == ""
  933.         @name_window.start(@name_text, @name_position)
  934.       end
  935.      
  936.       #--------------------------------------------------------------------------
  937.       # overwrite method: fiber_main
  938.       #--------------------------------------------------------------------------
  939.       def fiber_main
  940.         $game_message.visible = true
  941.         update_background
  942.         update_placement
  943.         loop do
  944.           process_all_text if $game_message.has_text?
  945.           process_input
  946.           $game_message.clear
  947.           @gold_window.close
  948.           @name_window.start_close
  949.           Fiber.yield
  950.           break unless text_continue?
  951.         end
  952.         close_and_wait
  953.         $game_message.visible = false
  954.         @fiber = nil
  955.       end
  956.      
  957.       #--------------------------------------------------------------------------
  958.       # alias method: open_and_wait
  959.       #--------------------------------------------------------------------------
  960.       alias window_message_open_and_wait_ams open_and_wait
  961.       def open_and_wait
  962.         clear_name_window
  963.         adjust_message_window_size
  964.         window_message_open_and_wait_ams
  965.       end
  966.      
  967.       #--------------------------------------------------------------------------
  968.       # alias method: close_and_wait
  969.       #--------------------------------------------------------------------------
  970.       alias window_message_close_and_wait_ams close_and_wait
  971.       def close_and_wait
  972.         @name_window.force_close
  973.         window_message_close_and_wait_ams
  974.       end
  975.      
  976.       #--------------------------------------------------------------------------
  977.       # alias method: all_close?
  978.       #--------------------------------------------------------------------------
  979.       alias window_message_all_close_ams all_close?
  980.       def all_close?
  981.         return window_message_all_close_ams && @name_window.close?
  982.       end
  983.      
  984.       #--------------------------------------------------------------------------
  985.       # alias method: process_escape_character
  986.       #--------------------------------------------------------------------------
  987.       alias window_message_process_escape_character_ams process_escape_character
  988.       def process_escape_character(code, text, pos)
  989.         case code.upcase
  990.         when 'W' # Wait
  991.           wait(obtain_escape_param(text))
  992.         else
  993.           window_message_process_escape_character_ams(code, text, pos)
  994.         end
  995.       end
  996.      
  997.     end # Window_Message
  998.      
  999.     #==============================================================================
  1000.     #
  1001.     # ▼ End of File
  1002.     #
  1003.     #==============================================================================
复制代码
头像被屏蔽
梦石
0
星屑
177
在线时间
936 小时
注册时间
2010-11-13
回帖
897
发表于 2020-10-16 23:55:40 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
回复 0 1

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部