| 
 
| 赞 | 0 |  
| VIP | 0 |  
| 好人卡 | 2 |  
| 积分 | 1 |  
| 经验 | 2993 |  
| 最后登录 | 2016-1-16 |  
| 在线时间 | 130 小时 |  
 Lv1.梦旅人 
	梦石0 星屑50 在线时间130 小时注册时间2011-3-10帖子65 | 
| 本帖最后由 s20810 于 2011-12-19 03:14 编辑 
 因為腳本使用上跟橫版戰鬥有稍微衝突
 雖然不影響遊戲 但還是希望完美點= ="
 不過本人是個腳本"全盲"...真的一點法子都想不出來
 看看板上有沒有高手能幫我在這兩個腳本中添加"開關" 以及在戰鬥中無效果
 感恩~
 
 VX對話框加強版
 复制代码#==============================================================================
# ■ [VX] 對話框加強版
#    [VX] Window_message Plus
#----------------------------------------------------------------------------
# 此腳本可代替官方 Window_Message 全腳本
#----------------------------------------------------------------------------
# 使用說明:
#
#   ⑴ 對話框第一行輸入引號內文字"名稱:",腳本會把名稱提取出來美化顯示
#      例如"張三:",顯示為"【張三】" ,美化符可在參數設定中修改
#
#   ⑵ 默認頭像在左邊顯示
#      當您需要右邊顯示時,在第一行輸入的名稱時加"\r"(大小寫不限)
#      例: "拉爾夫\r:"
#          請注意此時頭像將進行左右翻轉顯示
#
#   ⑶ 在對話中更改字體的方法:
#       \f[sX]:更改字號為X
#       \f[nX]:更改字體名稱為"預設字體庫"第X號字體(預設字體庫請看參數設定)
#              更改字體名稱失敗(無指定字體或字體損壞)時,啟用遊戲默認字體
#       \f[cX]:更改字色為第X號顏色 (text_color中的定義)
#       \f[c#FF0000]:使用16進制指定字體顏色,如本句表示紅色
#       \f[aX]:更改字體附加效果為第X號效果
#       附加樣式列表:
#         X=0 :無附加; X=1 :陰影字; X=2 :粗體字;
#         X=4 :斜體字; X=8 :描邊字; X=16:發光字
#              疊加效果即數字相加,示例: 3:陰影+粗體  14:粗體+斜體+描邊
#              注意!此三種效果互斥: 陰影/描邊/發光
#
#   ⑷ 在對話中顯示(技能 物品 武器 防具)圖標和名稱的方法:
#       \s[X]: 顯示第X號技能圖標和名稱
#       \i[X]: 顯示第X號物品圖標和名稱
#       \w[X]: 顯示第X號武器圖標和名稱
#       \a[X]: 顯示第X號防具圖標和名稱
#
#   ⑸ 在對話中更改文字不透明度的方法:
#       \o[X]: 把文字不透明度更改為X (取值範圍在0~255)
#
#   ⑹ 指定時間後自動關閉對話框的方法:
#       \x[X]: 對話框將在X幀後自動關閉
#       \x:    省略參數時,將於AutoClose幀後自動關閉(AutoClose值在參數設定中)
#
#   ⑺ 調整文字顯示速度的方法:
#       \p[X]: 文字在X幀後顯示
#
#   ⑻ 對話中更換對話框皮膚(或直接使用圖片)的方法:
#       \b[X]: 更改字體名稱為"預設樣式庫"第X號樣式 (預設樣式庫請看參數設定)
#              注: vx對話框可使用Window皮膚或直接使用圖片,請配合事件頁設定
#
#      素材格式和命名規則:
#       在對應的Window皮膚或對話框圖片的文件名後+"_pause",做為自定義暫停標記
#       的名稱,並和對應皮膚或圖片文件放在一起.
#
#   ⑼ 啟用頭像動態顯示的方法:
#       \e[X]: 設定頭像動態顯示的值為X
#       X=0 :關閉動態效果; X=1 :水平趨中; X=2 :漸顯
#
#   ⑽ 在對話中更換頭像:
#       \@[X]: 設定頭像索引號為X X值範圍0-7
#              可更改的僅是索引號,頭像文件名稱不可改 主要用於對話中換表情
#
#   ⑾ 輸入文章時設定凍結字符和注釋字符:
#       #[XX]: 字符串XX被凍結,不受轉義等影響直接顯示
#       #<XX>: 字符串XX被當作注釋,顯示文章時不出現
#------------------------------------------------------------------------------
# 素材要求:
#
#   ① 採用vx默認頭像素材(Graphics\Faces)的格式
#      即每個素材文件由2行4列共8格頭像組成
#
#   ② 要求所有頭像朝向一致(默認是正面偏右)
#
#   ③ 自定義暫停標記的素材採用橫向多幀格式,每幀圖片大小一致
#      注意: 幀數在腳本參數中設定.
#      在對應的Window皮膚或對話框圖片的文件名後+"_pause",做為自定義暫停標記
#      的名稱,並和對應皮膚或圖片文件放在一起.
#------------------------------------------------------------------------------
# 合併功能附加說明:
#
#   ① 對話框合併
#      頭像、背景、位置等相同的上下兩段對話都會被合併成一段對話;
#      如果要打斷合併,請在兩段對話之間加個非對話框的執行項,比如空注釋.
#
#   ② 選擇項合併
#      當前選項組滿4項,且取消設定不為"分歧",且下一個執行項也是選擇組,就合併;
#      取消鍵的規定: 如果有"分歧",必須設定在最後一個選項組,其它不限.
#                    合併後最多只有一個取消設定,多個設定時,僅最後一個有效.
#----------------------------------------------------------------------------
#    更新作者: 沉影不器
#    許可協議: FSL
#    項目版本: 1.09.1031
#    引用網址: http://rpg.blue/thread-158161-1-1.html
#----------------------------------------------------------------------------
#    - *1.09.1031* (2010-10-31) By 沉影不器
#      *新增 指定被凍結的字符串
#      *新增 允許字符串做為注釋
#
#    - *1.08.1030* (2010-10-30) By 沉影不器
#      *新增 對話中更改頭像
#      *新增 允許指定16進制顏色為字色
#      *修改 取消對話中切換[是否獨立顯示選項窗體]的開關
#
#    - *1.07.1029* (2010-10-29) By 沉影不器
#      *優化 重寫合併選擇項的功能,大幅降低衝突
#
#    - *1.06.1026* (2010-10-26) By 沉影不器
#      *修改 頭像在右的控制符改為"\r"(大小寫不限)
#      *優化 改變字體失敗時使用默認字體
#      *新增 允許獨立顯示選項窗體
#      *新增 合併多個事件頁選項(突破4選項上限)
#
#    - *1.05.1007* (2010-10-07) By 沉影不器
#      *修復 冒號被腳本占用而無法顯示
#      *優化 預處理部分數據
#      *新增 自定義暫停標記
#      *新增 全局和局部字速調整
#      *新增 支持滾動顯示多行對話內容
#      *新增 顯示動畫功能(數據庫動畫/心情動畫)
#
#    - *1.04.0207* (2009-02-07) By 沉影不器
#      *新增 字體附加效果:發光字
#      *新增 更換對話皮膚功能
#      *新增 頭像動態顯現功能
#
#    - *1.03.1107* (2008-11-07) By 沉影不器
#      *優化 字體附加效果的疊加方法
#      *新增 字體附加效果:斜體字
#
#    - *1.02.1023* (2008-10-23) By 沉影不器
#      *修復 自動關閉對話框時可能存在的關閉延後生效
#      *新增 字體附加效果:無效果、陰影字、粗體字、描邊字
#      *新增 更改字體無效時,使用遊戲默認字體
#
#    - *1.01.0911* (2008-09-11) By 沉影不器
#      *新增 更改字體功能
#      *新增 顯示(技能 物品 武器 防具)圖標和名稱
#      *新增 更改文字不透明度
#      *新增 自動關閉對話框
#
#    - *1.00.0831* (2008-08-31) By 沉影不器
#      *初版
#==============================================================================
$fscript = {} if $fscript == nil
$fscript["Window_message_Plus"] = "1.09.1031"
#----------------------------------------------------------------------------
# ▼ 通用配置模塊
#----------------------------------------------------------------------------
module FSL
  module Window_message_Plus
    ## 對話框的預設樣式庫(其中"Window"和"MessageBack"是vx默認樣式)
    Msg_StyleLib = {0=>["Window","Sinicism"],   ## Window皮膚
                    1=>["MessageBack","Black"]} ## 圖片皮膚
    ## 字體參數
    Font_Lib = ["微軟正黑體"]  ## 預設字體庫
    Font_Space = 4                              ## 字間距
    EdgeColor = 15                              ## 描邊顏色
    GlowColor = 1                              ## 發光顏色
    
    ## 名稱條參數
    Name_Symbol = "**"         ## 為名稱添加的修飾符(一對)
    Name_SpaceX = 6              ## 名稱條寬度縮進值
    Name_SpaceY = 6              ## 名稱與對話內容之間的附加距離
    Name_FontIndex = 0           ## 名稱文字字體在預設字體庫中的序號
    Name_FontSize = 20           ## 名稱文字字號
    Name_FontColor = 10          ## 名稱文字顏色
    Name_FontAdj = 10             ## 名稱文字附加效果
    NameBar_Color = 0            ## 名稱背景條顏色
    NameBar_Opacity = 64         ## 名稱背景條透明度
    
    ## 頭像參數
    Face_Enter = 0               ## 頭像顯示模式
    Face_EnterRate = 12          ## 頭像進入畫面的時間    
    Face_AdjX = 6                ## 頭像橫坐標微調
    Face_AdjY = -6               ## 頭像縱坐標微調
    Face_Align = 2               ## 頭像垂直對齊方式
                                 ## 0:頂端對齊; 1:居中對齊; 2:底端對齊
 
    ## 對話框參數
    Msg_FontName = 1             ## 對話文字字體在預設字體庫中的序號
    Msg_FontSize = 20            ## 對話文字字號
    Msg_FontColor = 0            ## 對話文字顏色
    Msg_FontPlus = 18             ## 對話文字附加效果
    
    ## 全局功能參數
    FastShow = true              ## 確定鍵快速顯示文字
    AutoClose = 80               ## 默認自動關閉時間(以幀計時)
    GlobalSpeed = 0              ## 改變全局文字延時(以幀計時)
    
    ## 自定義暫停標記
    Pause_Custom = 3    ## 位置(0:不使用 1:底邊居中 2:右下角 3:跟隨文字)
    Pause_AdjX = -2     ## X坐標微調
    Pause_AdjY = -2     ## Y坐標微調
    Pause_AniCyc = 6    ## 動畫週期
    Pause_AniFrm = 4    ## 動畫幀數
    
    ## 對話和選擇項合併
    MultiLinesWait = 30 ## 滾動顯示對話的等待時間(0表示禁止合併多段對話)
    Choice_Strip = true ## 是否單獨顯示選項窗體
                        ## 注: 選擇項合併功能僅在單獨顯示的選項窗體生效
    Choice_MaxLines = 4 ## 選項窗體的最大行數(0表示禁止合併多段選擇項)
                        ## 注: 本參數僅在單獨顯示選項窗體時生效
  end
end
#==============================================================================
# ■ Window_Message
#==============================================================================
class Window_Message < Window_Selectable
  include FSL::Window_message_Plus
  #--------------------------------------------------------------------------
  # ● 常量
  #--------------------------------------------------------------------------
  MAX_LINE = 4                            # 最大行數
  #--------------------------------------------------------------------------
  # ◎ 初始化對象
  #--------------------------------------------------------------------------
  def initialize
    h = [Name_FontSize,Msg_FontSize].max + Name_SpaceY +
         (Msg_FontSize+Font_Space)*(MAX_LINE-1) + 34
    y = Graphics.height - h
    super(0, y, Graphics.width, h)
    self.z = 200
    self.active = false
    self.index = -1
    self.openness = 0
    @opening = false            # 窗體正在打開的標誌
    @closing = false            # 窗體正在關閉的標誌
    @text = nil                 # 已經沒有可顯示的文章
    @contents_x = 0             # 下一條文字描繪的 X 坐標
    @contents_y = 0             # 下一條文字描繪的 Y 坐標
    @line_count = 0             # 現在描繪的行數
    @wait_count = 0             # 等待計數
    @background = 0             # 背景類型
    @position = 2               # 顯示位置
    @show_fast = false          # 快速顯示標誌
    @line_show_fast = false     # 以行為單位快速顯示
    @pause_skip = false         # 省略等待輸入標誌
    ## 凍結字符池
    @frozen_char = []
    ## 顯示名稱
    @show_name = false
    ## 自定義暫停標記
    @custom_pause = false if Pause_Custom > 0
    ## 多行對話框標記
    @multi_lines = false
    ## 字體附加效果
    @font_adj = Msg_FontPlus
    create_gold_window
    create_number_input_window
    create_back_sprite
    ## 頭像左右判斷
    @show_right = false
    ## 頭像寬度
    @face_width = 0
    ## 生成自定義暫停標記
    create_custom_pause
    ## 生成名稱背景條
    create_namebar_sprite
    ## 生成頭像
    create_face_sprite
    ## 修改默認字體
    contents.font = default_font
  end
  #--------------------------------------------------------------------------
  # ● 釋放
  #--------------------------------------------------------------------------
  def dispose
    super
    dispose_gold_window
    dispose_number_input_window
    dispose_back_sprite
  end
  #--------------------------------------------------------------------------
  # ◎ 更新畫面
  #--------------------------------------------------------------------------
  def update
    super
    update_gold_window
    update_number_input_window
    update_back_sprite
    update_show_fast
    ## 更新自定義暫停標記
    update_custom_pause
    unless @opening or @closing             # 除窗體關閉以外
      if @wait_count > 0                    # 文章內等待中
        @wait_count -= 1
      elsif @multi_lines
        scroll_line
      elsif custom_pause                    # 等待文章翻頁待機中
        input_pause
      elsif self.active || @choice         ## 正在輸入選擇項
        input_choice
      elsif @number_input_window.visible    # 正在輸入數值
        input_number
      elsif @text != nil                    # 還有剩餘的文章
        update_message                        # 更新消息
      elsif continue?                       # 繼續的情況
        start_message                         # 開始消息
        open                                  # 打開窗體
        $game_message.visible = true
      else                                  # 不繼續的情況
        close                                 # 關閉窗體
        $game_message.visible = @closing
      end
    end
    ## 頭像動態顯現
    if @face_sprite.visible
      ## 水平趨中
      result =  @face_x <=> @face_sprite.x
      x_enter = [(@face_x - @face_sprite.x).abs,Face_EnterRate].min
      @face_sprite.x += x_enter if result > 0
      @face_sprite.x -= x_enter if result < 0
      ## 漸顯
      @face_sprite.opacity += Face_EnterRate if @face_sprite.opacity < 255
    end
    ## 自動關閉對話框
    if @auto_close != nil
      if @auto_close > 0
        @auto_close -= 1
      else
        terminate_message
      end
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 生成所持金窗體
  #--------------------------------------------------------------------------
  def create_gold_window
    @gold_window = Window_Gold.new(384, 0)
    @gold_window.openness = 0
    ## 統一字體
    @gold_window.contents.font = default_font
  end
  #--------------------------------------------------------------------------
  # ◎ 生成數值輸入窗體
  #--------------------------------------------------------------------------
  def create_number_input_window
    @number_input_window = Window_NumberInput.new
    @number_input_window.visible = false
    ## 統一字體
    @number_input_window.contents.font = default_font
  end
  #--------------------------------------------------------------------------
  # ● 生成背景活動塊
  #--------------------------------------------------------------------------
  def create_back_sprite
    @back_sprite = Sprite.new
    @back_sprite.bitmap = Cache.system("MessageBack")
    @back_sprite.visible = (@background == 1)
    @back_sprite.z = 190
  end
  #--------------------------------------------------------------------------
  # ● 釋放所持金窗體
  #--------------------------------------------------------------------------
  def dispose_gold_window
    @gold_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 釋放數值輸入窗體
  #--------------------------------------------------------------------------
  def dispose_number_input_window
    @number_input_window.dispose
  end
  #--------------------------------------------------------------------------
  # ● 釋放背景活動塊
  #--------------------------------------------------------------------------
  def dispose_back_sprite
    @back_sprite.dispose
  end
  #--------------------------------------------------------------------------
  # ● 更新所持金窗體
  #--------------------------------------------------------------------------
  def update_gold_window
    @gold_window.update
  end
  #--------------------------------------------------------------------------
  # ● 更新數值輸入窗體
  #--------------------------------------------------------------------------
  def update_number_input_window
    @number_input_window.update
  end
  #--------------------------------------------------------------------------
  # ● 更新背景活動塊
  #--------------------------------------------------------------------------
  def update_back_sprite
    @back_sprite.visible = (@background == 1)
    @back_sprite.y = y - 16
    @back_sprite.opacity = openness
    @back_sprite.update
  end
  #--------------------------------------------------------------------------
  # ◎ 更新快速顯示標誌
  #--------------------------------------------------------------------------
  def update_show_fast
    if custom_pause or self.openness < 255
      @show_fast = false
    elsif Input.trigger?(Input::C)
      if FastShow ## 快速顯示文字
        @show_fast = true
        @wait_count = 0
      end
    elsif not Input.press?(Input::C)
      @show_fast = false
    end
    if @show_fast and @wait_count > 0
      @wait_count -= 1
    end
  end
  #--------------------------------------------------------------------------
  # ● 判斷下一消息繼續顯示
  #--------------------------------------------------------------------------
  def continue?
    return true if $game_message.num_input_variable_id > 0
    return false if $game_message.texts.empty?
    if self.openness > 0 and not $game_temp.in_battle
      return false if @background != $game_message.background
      return false if @position != $game_message.position
    end
    return true
  end
  #--------------------------------------------------------------------------
  # ◎ 開始顯示消息
  #--------------------------------------------------------------------------
  def start_message
    ## 重設窗體背景與位置
    reset_window
    ## 還原頭像左右判斷
    @show_right = false
    ## 暫存消息
    temp_texts = []
    $game_message.texts.each do |text|
      tmp = text.clone
      ## 判斷對話框皮膚
      if tmp.sub!(/\\B\[(\d+)\]/i) { "" }
        filename = Msg_StyleLib[@background][$1.to_i]
        if @background == 0
          self.windowskin = Cache.system(filename)
          if Pause_Custom>0 && !@pause_sprite.nil? && !@pause_sprite.disposed?
            @pause_sprite.bitmap = Cache.system(filename + "_pause")
          end
        else
          @back_sprite.bitmap = Cache.system(filename)
          if Pause_Custom>0 && !@pause_sprite.nil? && !@pause_sprite.disposed?
            @pause_sprite.bitmap = Cache.system(filename + "_pause")
          end
        end
        ## 開始自定義暫停標記動畫
        @pause_aniindex = -1
      end
      ## 判斷頭像顯現
      @face_enter = $1.to_i if tmp.sub!(/\\E\[(\d+)\]/i) { "" }
      temp_texts.push(tmp)
    end
    ## 判斷頭像方向
    if !temp_texts[0].nil? and temp_texts[0].sub!(/\\R/i){ "" }
      @show_right = true
    end
    ## 判斷名稱
    if temp_texts[0] != nil and temp_texts[0] =~ /[::]/
      if temp_texts[0] =~ /\\[::]/
        ## 忽略名稱的處理
        temp_texts[0].sub!(/\\:/)  { ":" }
        temp_texts[0].sub!(/\\:/) { ":" }
      else
        ## 去冒號加修飾符(可選)
        unless Name_Symbol.empty?
          temp_texts[0].sub!(/[::]/) { "" }
          temp_texts[0] = Name_Symbol[0,Name_Symbol.size/2] +
          temp_texts[0] + Name_Symbol[Name_Symbol.size/2,Name_Symbol.size/2]
        end
        ## 設定文字顏色
        temp_texts[0] = "\\C[#{Name_FontColor}]" +
        temp_texts[0] + "\\C[#{Msg_FontColor}]"
        ## 設定文字字體
        temp_texts[0] = "\\F[N#{Name_FontIndex}]" +
        temp_texts[0] + "\\F[N#{Msg_FontName}]"
        ## 設定文字大小
        temp_texts[0] = "\\F[S#{Name_FontSize}]" +
        temp_texts[0] + "\\F[S#{Msg_FontSize}]"
        ## 設定文字附加效果
        temp_texts[0] = "\\F[A#{Name_FontAdj}]" +
        temp_texts[0] + "\\F[A#{Msg_FontPlus}]"
        ## 顯示名稱背景條
        show_namebar_sprite
      end
    end
    @text = ""
    for i in 0...temp_texts.size
      @text += "  " if i >= $game_message.choice_start
      @text += temp_texts[i].clone + "\x00"
    end
    @item_max = $game_message.choice_max
    convert_special_characters
    new_page
  end
  #--------------------------------------------------------------------------
  # ◎ 更換頁面處理
  #--------------------------------------------------------------------------
  def new_page
    contents.clear
    ## 初始化文字描繪起點
    @contents_x = 0
    ## 除名稱外文字右移1字符
    @contents_x += Msg_FontSize+Font_Space unless @show_name
    if $game_message.face_name.empty?
      @face_sprite.bitmap.clear
    else
      name = $game_message.face_name
      index = $game_message.face_index
      ## 獲取頭像寬度
      set_face_width(name)
      ## 計算文字橫坐標起始
      @contents_x += @face_width-16 unless @show_right
      draw_msg_face(name, index)
      ## 頭像進入畫面
      face_in
    end
    @contents_y = 0
    @line_count = 0
    @show_fast = false
    @line_show_fast = false
    @pause_skip = false
    contents.font.color = text_color(0)
  end
  #--------------------------------------------------------------------------
  # ◎ 換行處理
  #--------------------------------------------------------------------------
  def new_line
    ## 提前處理自定義暫停標記
    set_custom_pause_pos
    @contents_x = 0
    unless $game_message.face_name.empty?
      ## 頭像顯示在左時
      @contents_x = @face_width-16 unless @show_right
    end
    ## 除名稱外文字右移1字符
    @contents_x += (Msg_FontSize+Font_Space)
    ## 顯示名稱之後,對話內容下移 Name_SpaceY
    @contents_y += Name_SpaceY if @line_count == 0 and @show_name
    ## 以字號為新間距
    @contents_y += (Msg_FontSize+Font_Space)
    @line_count += 1
    @line_show_fast = false
  end
  #--------------------------------------------------------------------------
  # ◎ 特殊文字變換
  #--------------------------------------------------------------------------
  def convert_special_characters
    ## 特定字符處理
    @text.gsub!(/#\[(.*?)\]/)    {@frozen_char.push($1); "\xff"}
    @text.gsub!(/#\<(.*?)\>/)    {""}
    ## 默認控制符
    @text.gsub!(/\\V\[(\d+)\]/i) {$game_variables[$1.to_i]}
    @text.gsub!(/\\V\[(\d+)\]/i) {$game_variables[$1.to_i]}
    @text.gsub!(/\\N\[(\d+)\]/i) {$game_actors[$1.to_i].name}
    @text.gsub!(/\\C\[(\d+)\]/i) {"\x01[#{$1}]"}
    @text.gsub!(/\\G/)           {"\x02"}
    @text.gsub!(/\\\./)          {"\x03"}
    @text.gsub!(/\\\|/)          {"\x04"}
    @text.gsub!(/\\!/)           {"\x05"}
    @text.gsub!(/\\>/)           {"\x06"}
    @text.gsub!(/\\</)           {"\x07"}
    @text.gsub!(/\\\^/)          {"\x08"}
    @text.gsub!(/\\\\/)          {"\\"}
    ## 更改不透明度
    @text.gsub!(/\\O\[(\d+)\]/i) {"\x09[#{$1}]"}
    ## 顯示數據庫元素
    @text.gsub!(/\\S\[(\d+)\]/i) {"\x0a[#{$1}]" + $data_skills[$1.to_i].name}
    @text.gsub!(/\\I\[(\d+)\]/i) {"\x0b[#{$1}]" + $data_items[$1.to_i].name}
    @text.gsub!(/\\W\[(\d+)\]/i) {"\x0c[#{$1}]" + $data_weapons[$1.to_i].name}
    @text.gsub!(/\\A\[(\d+)\]/i) {"\x0d[#{$1}]" + $data_armors[$1.to_i].name}
    ## 更改字體
    @text.gsub!(/\\F\[S(\d+)\]/i){"\x0e[#{$1}]"}
    @text.gsub!(/\\F\[N(\d+)\]/i){"\x0f[#{$1}]"}
    @text.gsub!(/\\F\[C(\d+)\]/i){"\x01[#{$1}]"}
    ## 16進制顏色
    @text.gsub!(/\\F\[C\#([a-f0-9]+)\]/i) {"\x10[#{$1}]"}
    ## 字體附加效果
    @text.gsub!(/\\F\[A(\d+)\]/i){"\x11[#{$1}]"}
    ## 自動關閉
    @text.gsub!(/\\X\[(\d+)\]/i) {"\x12[#{$1}]"}
    @text.gsub!(/\\X/i)          {"\x13"}
    ## 字速控制
    @text.gsub!(/\\P\[(\d+)\]/i) {"\x14[#{$1}]"}
    ## 提取動畫對象和 ID
    @text.gsub!(/\\A\[(\S+)\,(\d+)\]/i) {"\x15[#{$1},#{$2}]"}
    @text.gsub!(/\\B\[(\S+)\,(\d+)\]/i) {"\x16[#{$1},#{$2}]"}
    ## 切換頭像index
    @text.gsub!(/\\@\[(\d+)\]/)  {"\x17[#{$1}]"}
  end
  #--------------------------------------------------------------------------
  # ◎ 設置窗體背景與位置
  #--------------------------------------------------------------------------
  def reset_window
    @background = $game_message.background
    @position = $game_message.position
    if @background == 0   # 普通窗體
      self.opacity = 255
    else                  # 背景變暗、透明
      self.opacity = 0
    end
    case @position
    when 0  # 上
      fh = get_face_height($game_message.face_name)
      self.y = fh - self.height - Face_AdjY
      self.y = 0 if self.y < 0
      @gold_window.y = 360
    when 1  # 中
      self.y = (Graphics.height-self.height)/2
      @gold_window.y = 0
    when 2  # 下
      self.y = Graphics.height-self.height
      @gold_window.y = 0
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 消息結束
  #--------------------------------------------------------------------------
  def terminate_message
    ## 選項窗體
    Choice_Strip ? @choice = false : self.active = false
    self.custom_pause = false
    self.index = -1
    @gold_window.close
    @number_input_window.active = false
    @number_input_window.visible = false
    $game_message.main_proc.call if $game_message.main_proc != nil
    $game_message.clear
    ## 還原自動關閉
    @auto_close = nil
    ## 處理名稱背景條和頭像
    @show_name = false
    @namebar_sprite.visible = false
    @face_sprite.visible = false
    @face_sprite.bitmap.clear
  end
  #--------------------------------------------------------------------------
  # ◎ 更新消息
  #--------------------------------------------------------------------------
  def update_message
    loop do
      c = @text.slice!(/./m)            # 獲取下一條文字
      case c
      when nil                          # 沒有可以顯示的文字
        finish_message                  # 更新結束
        break
      when "\x00"                       # 換行
        new_line
        if @line_count >= MAX_LINE      # 行數為最大時
          unless @text.empty?           # 如果還有增加則繼續
            ## 等待滾動
            @wait_count = MultiLinesWait
            @multi_lines = true
            break
          end
        end
      when "\x01"                       # \C[n]  (更改文字色)
        @text.sub!(/\[([0-9]+)\]/, "")
        contents.font.color = text_color($1.to_i)
        next
      when "\x02"                       # \G  (顯示所持金)
        @gold_window.refresh
        @gold_window.open
      when "\x03"                       # \.  (等待 1/4 秒)
        @wait_count = 15
        break
      when "\x04"                       # \|  (等待 1 秒)
        @wait_count = 60
        break
      when "\x05"                       # \!  (等待輸入)
        self.custom_pause = true
        break
      when "\x06"                       # \>  (瞬間顯示 ON)
        @line_show_fast = true
      when "\x07"                       # \<  (瞬間顯示 OFF)
        @line_show_fast = false
      when "\x08"                       # \^  (不等待輸入)
        @pause_skip = true
      ## 更改不透明度的情況下
      when "\x09"
        @text.sub!(/\[(\d+)\]/, "")
        contents.font.color.alpha = $1.to_i
      ## 顯示技能情況下
      when "\x0a"
        @text.sub!(/\[(\d+)\]/, "")
        draw_icon($data_skills[$1.to_i].icon_index, @contents_x, @contents_y)
        ## 橫坐標增加圖標寬度
        @contents_x += 24
      ## 顯示物品情況下
      when "\x0b"
        @text.sub!(/\[(\d+)\]/, "")
        draw_icon($data_items[$1.to_i].icon_index, @contents_x, @contents_y)
        ## 橫坐標增加圖標寬度
        @contents_x += 24
      ## 顯示武器情況下
      when "\x0c"
        @text.sub!(/\[(\d+)\]/, "")
        draw_icon($data_weapons[$1.to_i].icon_index, @contents_x, @contents_y)
        ## 橫坐標增加圖標寬度
        @contents_x += 24
      ## 顯示防具情況下
      when "\x0d"
        @text.sub!(/\[(\d+)\]/, "")
        draw_icon($data_armors[$1.to_i].icon_index, @contents_x, @contents_y)
        ## 橫坐標增加圖標寬度
        @contents_x += 24
      ## 更改字體的情況下
      when "\x0e"
        @text.sub!(/\[(\d+)\]/, "")
        contents.font.size = $1.to_i
      when "\x0f"
        @text.sub!(/\[(\d+)\]/, "")
        name = Font_Lib[$1.to_i]
        contents.font.name = Font.exist?(name) ? name : Font.default_name
      ## 16進制顏色
      when "\x10"
        @text.sub!(/\[(\w+)\]/, "")
        r,g,b = $1.scan(/../)
        contents.font.color = Color.new(r.hex, g.hex, b.hex)
      ## 字體附加效果
      when "\x11"
        @text.sub!(/\[(\d+)\]/, "")
        ## 獲取字體附加效果
        @font_adj = $1.to_i
      ## 自動關閉對話框的情況下
      when "\x12"
        @text.sub!(/\[(\d+)\]/, "")
        @auto_close = $1.to_i
      when "\x13"
        @auto_close = AutoClose
      ## \P[n] (字速)
      when "\x14"
        @text.sub!(/\[(\d+)\]/, "")
        ## 獲取字體顯示速度
        @speed = $1.to_i
      ## 顯示角色動畫
      when "\x15"
        @text.sub!(/\[(\S+)\,(\d+)\]/, "")
        character = interpreter.get_character($1.to_i)
        character.animation_id = $2.to_i unless character.nil?
        next
      ## 顯示心情動畫
      when "\x16"
        @text.sub!(/\[(\S+)\,(\d+)\]/, "")
        character = interpreter.get_character($1.to_i)
        character.balloon_id = $2.to_i unless character.nil?
        next
      ## 換頭像
      when "\x17"
        @text.sub!(/\[(\d+)\]/, "")
        name  = $game_message.face_name
        index = $game_message.face_index = $1.to_i
        draw_msg_face(name, index)
      ## 選擇項
      when "\x18"
        finish_message
        break
      ## 特定字符處理
      when "\xff"
        @text.insert(0, @frozen_char.shift)
      else
        ## 字速控制
        @wait_count = GlobalSpeed
        @wait_count = @speed if @speed != nil
        h = contents.font.size + Font_Space
        ## 字體附加效果
        if @font_adj & 1 != 0
          contents.font.shadow = true 
        else
          contents.font.shadow = false
        end
        if @font_adj & 2 != 0
          contents.font.bold = true
        else
          contents.font.bold = false
        end
        if @font_adj & 4 != 0
          contents.font.italic = true
        else
          contents.font.italic = false
        end
        if @font_adj & 8 != 0     ## 描邊字
          color = text_color(EdgeColor)
          contents.draw_edge_text(@contents_x,@contents_y,h,h,c,0,color)
        elsif @font_adj & 16 != 0 ## 發光字
          color = text_color(GlowColor)
          contents.draw_glow_text(@contents_x,@contents_y,h,h,c,0,color)
        else                      ## 普通字
          contents.draw_text(@contents_x, @contents_y, h, h, c)
        end
        c_width = contents.text_size(c).width
        @contents_x += c_width
      end
      break unless @show_fast or @line_show_fast
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 消息更新結束
  #--------------------------------------------------------------------------
  def finish_message
    if $game_message.choice_max > 0
      start_choice
    elsif $game_message.num_input_variable_id > 0
      start_number_input
    elsif @pause_skip
      terminate_message
    else
      self.custom_pause = true
    end
    @wait_count = 10
    @text = nil
    ## 臨時字速還原
    @speed = nil
  end
  #--------------------------------------------------------------------------
  # ◎ 開始選擇項
  #--------------------------------------------------------------------------
  def start_choice
    if Choice_Strip
      @choice = true
      width = 0
      commands = []
      for i in $game_message.choice_start+1 ...$game_message.texts.size
        commands.push $game_message.texts[i]
        iw = contents.text_size($game_message.texts[i]).width
        width = iw if width < iw
      end
      ## 計算高度
      if commands.size > Choice_MaxLines
        row_max = Choice_MaxLines
      else
        row_max = commands.size
      end
      @choice_window = Window_Command.new(width+42, commands, 1, row_max)
      @choice_window.contents.font = default_font
      @choice_window.refresh
      ## 計算坐標
      if @show_right
        @choice_window.x = self.x
      else
        @choice_window.x = self.x + self.width - @choice_window.width
      end
      if @position == 0
        @choice_window.y = self.y + self.height
      else
        @choice_window.y = self.y - @choice_window.height
      end
    else
      self.active = true
      self.index = 0
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 開始輸入數值
  #--------------------------------------------------------------------------
  def start_number_input
    digits_max = $game_message.num_input_digits_max
    number = $game_variables[$game_message.num_input_variable_id]
    @number_input_window.digits_max = digits_max
    @number_input_window.number = number
    if $game_message.face_name.empty?
      @number_input_window.x = x
    else
      ## 代入頭像寬度
      @number_input_window.x = @show_right ? x : x + @face_width
    end
    @number_input_window.y = y + @contents_y
    @number_input_window.active = true
    @number_input_window.visible = true
    @number_input_window.update
  end
  #--------------------------------------------------------------------------
  # ◎ 更新光標 ###可能仍須增加判斷
  #--------------------------------------------------------------------------
  def update_cursor
    if @index >= 0
      if $game_message.face_name.empty?
        x = 0
        y = ($game_message.choice_start+@index)*(Msg_FontSize+Font_Space)
        width = contents.width
      else
        x = @show_right ? 0 : @face_width
        y = ($game_message.choice_start+@index)*(Msg_FontSize+Font_Space) +
             Name_SpaceY
        width = contents.width - @face_width
      end
      self.cursor_rect.set(x, y, width, (Msg_FontSize+Font_Space))
    else
      self.cursor_rect.empty
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 文章顯示輸入處理
  #--------------------------------------------------------------------------
  def input_pause
    if Input.trigger?(Input::C) or Input.trigger?(Input::B)
      ## 還原自定義暫停標記
      self.custom_pause = false
      if @text != nil and not @text.empty?
        new_page if @line_count >= MAX_LINE
      else
        terminate_message
      end
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 選擇項輸入處理
  #--------------------------------------------------------------------------
  def input_choice
    if Input.trigger?(Input::B)
      if $game_message.choice_cancel_type > 0
        Sound.play_cancel
        $game_message.choice_proc.call($game_message.choice_cancel_type - 1)
        terminate_message
      end
    elsif Input.trigger?(Input::C)
      Sound.play_decision
      ## 獲取相應index
      index = Choice_Strip ? @choice_window.index : self.index
      $game_message.choice_proc.call(index)
      terminate_message
    end
    ## 刷新選項窗體
    return unless Choice_Strip
    if @choice
      @choice_window.update
    else
      @choice_window.dispose
      @choice_window = nil
    end
  end
  #--------------------------------------------------------------------------
  # ● 數值輸入處理
  #--------------------------------------------------------------------------
  def input_number
    if Input.trigger?(Input::C)
      Sound.play_decision
      $game_variables[$game_message.num_input_variable_id] =
        @number_input_window.number
      $game_map.need_refresh = true
      terminate_message
    end
  end
  #--------------------------------------------------------------------------
  # ○ 生成名稱背景條
  #--------------------------------------------------------------------------
  def create_namebar_sprite
    @namebar_sprite = Sprite.new
    @namebar_sprite.bitmap = Bitmap.new(width-Name_SpaceX, Name_FontSize+4)
    ## 可視性
    @namebar_sprite.visible = false
    ## 準備參數
    rect = Rect.new(Name_SpaceX,0,@namebar_sprite.width,@namebar_sprite.height)
    color1 = text_color(NameBar_Color)
    color2 = text_color(NameBar_Color)
    color1.alpha = NameBar_Opacity
    color2.alpha = 0
    ## 描繪漸變條
    @namebar_sprite.bitmap.gradient_fill_rect(rect, color1, color2)
  end
  #--------------------------------------------------------------------------
  # ○ 顯示名稱背景條
  #--------------------------------------------------------------------------
  def show_namebar_sprite
    @show_name = true
    return if @background == 1
    ## 坐標跟隨
    @namebar_sprite.x = self.x
    @namebar_sprite.y = self.y + 16 - 1
    @namebar_sprite.z = self.z + 1
    ## 可視性
    @namebar_sprite.visible = true
  end
  #--------------------------------------------------------------------------
  # ○ 生成頭像
  #--------------------------------------------------------------------------
  def create_face_sprite
    @face_sprite = Sprite.new
    @face_sprite.bitmap = Bitmap.new(1,1)
    @face_sprite.z = self.z + 2
    @face_sprite.visible = false
    @old_name = ""                        # 判斷頭像是否改變
    @old_index = 0                        # 判斷頭像是否改變
    @face_enter = Face_Enter              # 頭像顯示模式
  end
  #--------------------------------------------------------------------------
  # ○ 描繪頭像
  #     face_name  : 頭像圖像文件名
  #     face_index : 頭像圖像索引
  #--------------------------------------------------------------------------
  def draw_msg_face(face_name, face_index)
    bitmap = Cache.face(face_name)
    width = bitmap.width / 4
    height = bitmap.height / 2
    rect = Rect.new(0, 0, 0, 0)
    rect.x = face_index % 4 * width
    rect.y = face_index / 4 * height
    rect.width = width
    rect.height = height
    @face_sprite.bitmap = Bitmap.new(width, height)
    @face_sprite.bitmap.blt(0, 0, bitmap, rect)
    @face_sprite.mirror = @show_right 
  end
  #--------------------------------------------------------------------------
  # ○ 設定頭像寬度
  #     face_name  : 頭像圖像文件名
  #--------------------------------------------------------------------------
  def set_face_width(face_name)
    bitmap = Cache.face(face_name)
    @face_width = bitmap.width / 4
  end
  #--------------------------------------------------------------------------
  # ○ 獲取頭像高度
  #     face_name  : 頭像圖像文件名
  #--------------------------------------------------------------------------
  def get_face_height(face_name)
    bitmap = Cache.face(face_name)
    return bitmap.height / 2
  end
  #--------------------------------------------------------------------------
  # ○ 頭像進入畫面
  #--------------------------------------------------------------------------
  def face_in
    fw = @face_sprite.width
    fh = @face_sprite.height
    ## 水平坐標
    if @show_right
      @face_x = self.width - fw - Face_AdjX
    else
      @face_x = self.x + Face_AdjX
    end
    @face_sprite.x = @face_x
    ## 垂直坐標
    case Face_Align
    when 0
      @face_sprite.y = self.y + Face_AdjY
    when 1
      @face_sprite.y = self.y + (self.height - fh) / 2
    when 2
      @face_sprite.y = self.y + (self.height - fh) + Face_AdjY
    end
    case @face_enter
    when 1 ## 水平趨中時
      @face_sprite.x += (@show_right ? fw : -fw)
    when 2 ## 漸顯時
      @face_sprite.opacity = 0
    end
    ## 可視性
    @face_sprite.visible = true
  end
  #--------------------------------------------------------------------------
  # ○ 生成自定義暫停標記
  #--------------------------------------------------------------------------
  def create_custom_pause
    return if Pause_Custom == 0
    @pause_sprite = Sprite.new
    @pause_sprite.visible = false
    @pause_sprite.z = self.z + 3
    @pause_sprite.bitmap = Cache.system("Window_pause")
    @pause_aniindex = -1
    @pause_anispeed = 0
  end
  #--------------------------------------------------------------------------
  # ○ 獲取暫停標記
  #--------------------------------------------------------------------------
  def custom_pause
    return @custom_pause
  end
  #--------------------------------------------------------------------------
  # ○ 更改暫停標記
  #--------------------------------------------------------------------------
  def custom_pause=(val)
    @custom_pause = val
    self.pause = val if Pause_Custom == 0
  end
  #--------------------------------------------------------------------------
  # ○ 更新暫停標記
  #--------------------------------------------------------------------------
  def update_custom_pause
    return if Pause_Custom == 0
    @pause_sprite.visible = @custom_pause
    @pause_sprite.visible = false if @pause_aniindex == -1
    return if !@custom_pause
    if @pause_anispeed > 0
      @pause_anispeed -= 1
    else
      @pause_aniindex = (@pause_aniindex + 1) % Pause_AniFrm
      pw = @pause_sprite.bitmap.width / Pause_AniFrm
      ph = @pause_sprite.bitmap.height
      @pause_sprite.src_rect.set(@pause_aniindex*pw, 0, pw, ph)
      @pause_anispeed = Pause_AniCyc
    end
  end
  #--------------------------------------------------------------------------
  # ○ 設定暫停標記坐標
  #--------------------------------------------------------------------------
  def set_custom_pause_pos
    return if Pause_Custom == 0
    pw = @pause_sprite.bitmap.width / Pause_AniFrm
    ph = @pause_sprite.bitmap.height
    case Pause_Custom
    when 1 ## 底邊居中
      @pause_sprite.x = self.x + (self.width - pw)/2
      @pause_sprite.y = self.y + self.height - ph
    when 2 ## 右下角
      @pause_sprite.x = self.x + self.width - pw
      @pause_sprite.y = self.y + self.height - ph
      @pause_sprite.x -= @face_width if @show_right
    when 3 ## 文字後
      @pause_sprite.x = self.x + @contents_x + Msg_FontSize + Font_Space
      @pause_sprite.y = self.y + @contents_y + Msg_FontSize + Font_Space
    end
    @pause_sprite.x += Pause_AdjX
    @pause_sprite.y += Pause_AdjY
  end
  #--------------------------------------------------------------------------
  # ○ 滾動換行
  #--------------------------------------------------------------------------
  def scroll_line
    w = self.width - 32
    hm = Msg_FontSize + Font_Space
    if @show_name
      l = MAX_LINE - 2
      hn = Name_FontSize + Font_Space + Name_SpaceY
      rect = Rect.new(0, hn+hm, w, hm*l)
    else
      l = MAX_LINE - 1
      hn = 0
      rect = Rect.new(0, hm, w, hm*l)
    end
    ## 複製位圖
    buff = Bitmap.new(w, hm*l)
    buff.blt(0, 0, contents, rect)
    ## 描繪位圖
    contents.clear_rect Rect.new(0, hn, w, hm*l+hm)
    contents.blt 0, hn, buff, Rect.new(0, 0, w, hm*l)
    buff.dispose
    @contents_y -= Msg_FontSize + Font_Space
    @multi_lines = false
  end
  #--------------------------------------------------------------------------
  # ○ 默認字體
  #--------------------------------------------------------------------------
  def default_font
    font = Font.new(Font.default_name, Msg_FontSize)
    font.shadow = Font.default_shadow
    font.italic = Font.default_italic 
    font.color = text_color(Msg_FontColor)
    font.bold = Font.default_bold 
    return font
  end
  #--------------------------------------------------------------------------
  # ○ 當前解釋器
  #--------------------------------------------------------------------------
  def interpreter
    if $game_temp.in_battle
      return $game_troop.interpreter
    else
      return $game_map.interpreter
    end
  end
end
#==============================================================================
# ■ Window_Command
#==============================================================================
class Window_Command < Window_Selectable
  #--------------------------------------------------------------------------
  # ◎ 初始化
  #     width      : 窗口寬
  #     commands   : 命令字符串列表
  #     column_max : 列數 (2 以上橫向選擇)
  #     row_max    : 行數 (0:與命令數一致)
  #     spacing    : 項目橫向的空白空間
  #--------------------------------------------------------------------------
  def initialize(width, commands, column_max = 1, row_max = 0, spacing = 32)
    line_max = (commands.size + column_max - 1) / column_max
    row_max = line_max if row_max == 0
    super(0, 0, width, [line_max,row_max].max * WLH + 32, spacing)
    @commands = commands
    @item_max = commands.size
    @column_max = column_max
    refresh
    self.index = 0
    self.height = row_max * WLH + 32
  end
end
#==============================================================================
# ■ Game_Interpreter
#==============================================================================
class Game_Interpreter
  #--------------------------------------------------------------------------
  # ◎ 設置事件
  #     list     : 執行內容
  #     event_id : 事件 ID
  #--------------------------------------------------------------------------
  alias msg_plus_setup setup
  def setup(list, event_id = 0)
    msg_plus_setup(list, event_id)
    ## 獲取執行列表
    @list = Marshal.load(Marshal.dump list)
  end
  #--------------------------------------------------------------------------
  # ◎ 顯示文章
  #--------------------------------------------------------------------------
  def command_101
    unless $game_message.busy
      $game_message.face_name = @params[0]
      $game_message.face_index = @params[1]
      $game_message.background = @params[2]
      $game_message.position = @params[3]
      @index += 1
      loop do
        case @list[@index].code
        when 101 ## 對話設定
          multi_lines? ? @index += 1 : break
        when 401 ## 對話數據
          $game_message.texts.push(@list[@index].parameters[0])
          @index += 1
        else
          break
        end
      end
      if @list[@index].code == 102          # 顯示選擇項
        setup_choices(@list[@index].parameters)
      elsif @list[@index].code == 103       # 處理數值輸入
        setup_num_input(@list[@index].parameters)
      end
      set_message_waiting                   # 消息待機狀態
    end
    return false
  end
  #--------------------------------------------------------------------------
  # ◎ 設置選擇項
  #--------------------------------------------------------------------------
  def setup_choices(params)
    if FSL::Window_message_Plus::Choice_Strip && 
       FSL::Window_message_Plus::Choice_MaxLines > 0
      ## 備重建
      @modify = []
      @delete = []
      @cancel = 0
      ## 獲取合併後的command
      command = @list[@index].clone
      command.parameters = connect_choice(@index), @cancel
      ## 消息參數
      $game_message.choice_start = $game_message.texts.size
      $game_message.choice_max = command.parameters[0].size
      $game_message.texts.push "\x18"
      command.parameters[0].each{|s| $game_message.texts.push(s)}
      ## 重建數據
      @modify.each_index do |i|
        key,value = @modify[i].is_a?(Array) ? @modify[i] : [@modify[i],i]
        @list[key].parameters[0] = value
      end
      @delete.reverse.each{|i| @list[i,1] = nil}
      @list.insert(@index, command)
      $game_message.choice_cancel_type = @cancel
      $game_message.choice_proc = Proc.new { |n| @branch[@indent] = n }
      ## 推進
      @index += 1
    else
      ## 默認情況
      if $game_message.texts.size <= 4 - params[0].size
        $game_message.choice_start = $game_message.texts.size
        $game_message.choice_max = params[0].size
        for s in params[0]
          $game_message.texts.push(s)
        end
        $game_message.choice_cancel_type = params[1]
        $game_message.choice_proc = Proc.new { |n| @branch[@indent] = n }
        @index += 1
      end
    end
  end
  #--------------------------------------------------------------------------
  # ◎ 取消的情況下
  #--------------------------------------------------------------------------
  alias msg_plus_command_403 command_403
  def command_403
    ## 合併選項時
    if !@params[0].nil? && @branch[@indent] == @params[0] - 1
      @branch.delete(@indent)
      return true
    end
    msg_plus_command_403
  end
  #--------------------------------------------------------------------------
  # ## 合併選項
  #--------------------------------------------------------------------------
  def connect_choice(index, result=[])
    params = @list[index].parameters
    indent = @list[index].indent
    ## 取消項
    @cancel = result.size + params[1] if params[1] > 0
    params[0].each{|s| result.push(s)}
    @delete.push(index) ## 102
    index = next_choice(index)
    ## 判斷合併的條件 選項:滿4項;取消:非分歧
    if index && params[0].size == 4 && params[1] < 5
      @delete.push(index-1) ## 404
      connect_choice(index, result)
    else
      return result
    end
  end
  #--------------------------------------------------------------------------
  # ## 下個選項
  #--------------------------------------------------------------------------
  def next_choice(index)
    params = @list[index].parameters
    indent = @list[index].indent
    until @list[index+1].nil?
      index += 1
      if indent == @list[index].indent
        case @list[index].code
        when 402 
          @modify.push(index)
        when 403
          @modify.push([index,@cancel])
        when 404
          ## 判斷合併的條件 下一個同級執行項102
          return @list[index+1].code == 102 ? index+1 : nil
        end
      end
    end
  end
  #--------------------------------------------------------------------------
  # ○ 多行模式?
  #--------------------------------------------------------------------------
  def multi_lines?
    return false if FSL::Window_message_Plus::MultiLinesWait <= 0
    return false if $game_message.face_name != @list[@index].parameters[0]
    return false if $game_message.face_index != @list[@index].parameters[1]
    return false if $game_message.background != @list[@index].parameters[2]
    return false if $game_message.position != @list[@index].parameters[3]
    return true
  end
  #--------------------------------------------------------------------------
  # ○ 心情圖標擴展
  #     character_id: 角色 ID (-1 為角色、0 為本事件、除此之外為事件 ID)
  #     balloon_id  : 心情動畫 ID (從1開始)
  #--------------------------------------------------------------------------
  def balloon_extend(character_id, balloon_id)
    character = get_character(character_id)
    if character != nil
      character.balloon_id = balloon_id
    end
    return true
  end
end
#==============================================================================
# ■ Bitmap
#==============================================================================
class Bitmap
  #--------------------------------------------------------------------------
  # ○ 描邊字
  #--------------------------------------------------------------------------
  def draw_edge_text(x, y, width, height, str, align = 0, color = nil)
    font_backup = self.font.clone
    self.font.color.set(color.red,color.green,color.blue) if color
    self.font.shadow = false
    # 描繪邊緣
    self.draw_text(x-1, y-1, width, height, str, align)
    self.draw_text(x-1, y+1, width, height, str, align)
    self.draw_text(x+1, y-1, width, height, str, align)
    self.draw_text(x+1, y+1, width, height, str, align)
    self.draw_text(x, y-1, width, height, str, align)
    self.draw_text(x, y+1, width, height, str, align)
    self.draw_text(x-1, y, width, height, str, align)
    self.draw_text(x+1, y, width, height, str, align)
    # 描繪主文字
    self.font.color = font_backup.color
    self.draw_text(x, y, width, height, str, align)
    # 還原默認字體
    self.font = font_backup
  end
  #--------------------------------------------------------------------------
  # ○ 發光字
  #--------------------------------------------------------------------------
  def draw_glow_text(x, y, width, height, str, align = 0, color = nil)
    buff = Bitmap.new(width, height)
    buff.font = self.font.clone
    buff.font.shadow = false
    buff.font.color.set(color.red,color.green,color.blue) if color
    # 描繪邊緣
    buff.draw_text(-1, -1, width, height, str, align)
    buff.draw_text(-1, 1, width, height, str, align)
    buff.draw_text(1, -1, width, height, str, align)
    buff.draw_text(1, 1, width, height, str, align)
    buff.draw_text(0, -1, width, height, str, align)
    buff.draw_text(0, 1, width, height, str, align)
    buff.draw_text(0-1, 0, width, height, str, align)
    buff.draw_text(1, 0, width, height, str, align)
    buff.blur
    # 描繪主文字
    buff.font.color = self.font.color
    buff.draw_text(0, 0, width, height, str, align)
    self.blt(x, y, buff, Rect.new(0, 0, width, height))
    buff.dispose
  end
  #--------------------------------------------------------------------------
  # ○ 多層字
  #--------------------------------------------------------------------------
  def draw_sedimentary_text(x, y, width, height, str, align = 0, *color)
    color.unshift font.color
    sheet = (font.size.to_f / color.size).ceil
    buff = Bitmap.new(width, sheet)
    buff.font = font.clone
    max = (height - font.size)/2 > 0 ? (height - font.size)/2 : 0
    min = buff.font.size < height ? buff.font.size : height
    color.each_index do |i|
      buff.clear
      buff.font.color = color[i]
      buff.draw_text(0, -i*sheet, width, min, str, align)
      blt(x, y+i*sheet+max, buff, Rect.new(0, 0, width, sheet))
      break if i*sheet >= height
    end
  end
end
 | 
 评分
查看全部评分
 |