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

Project1

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

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

[复制链接]

Lv1.梦旅人

梦石
0
星屑
164
在线时间
415 小时
注册时间
2020-1-11
帖子
256
跳转到指定楼层
1
发表于 2020-10-16 14:34:14 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 alianlord 于 2020-10-16 14:37 编辑

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

Lv2.观梦者 (禁止发言)

梦石
0
星屑
600
在线时间
899 小时
注册时间
2010-11-13
帖子
1023
2
发表于 2020-10-16 23:55:40 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 0 反对 1

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-7 14:53

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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