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

Project1

 找回密码
 注册会员
搜索

用了对话显示人名脚本后,左上角出现奇怪的方框

查看数: 1490 | 评论数: 3 | 收藏 0
关灯 | 提示:支持键盘翻页<-左 右->
    组图打开中,请稍候......
发布时间: 2013-8-7 19:12

正文摘要:

使用了对话显示人名脚本后 和有人名的npc对话后处理商店, 这个是使用的脚本 RUBY 代码复制=begin吹きだしウィンドウVXAce 2011.12.25 tamura改造2012年02月28日  ...

回复

喵呜喵5 发表于 2013-8-7 20:50:50
咦?531行开始怎么少了几个字符……又是论坛的BUG!?

请自己去原地址复制脚本:
http://tamurarpgvx.blog137.fc2.com/blog-entry-148.html
(大陆地区需要翻……编码需要转换成日文…………)
喵呜喵5 发表于 2013-8-7 19:56:21
替换掉你原来的脚本即可,如果你脚本有做过什么修改的话,请在新脚本里重新修改……
  1. =begin
  2. 吹きだしウィンドウVXAce

  3. 2011.12.25 tamura改造
  4. 2013年06月20日 改訂

  5. ※このスクリプトは、ちいさな本屋様(http://xrxs.at-ninja.jp/)
  6. が製作されたものをtamuraがACE用に改造した物です。

  7. 原版:
  8. ▽▽▽ XRXSv2. メッセージ表示フルグレードアップVX ▽▽▽
  9. publish 2010/ 3/ 2
  10. update  - 11/ 1/10a


  11. ※※警告※※
  12. THINK_TAIL や SYSTEM_LINE の機能を使わない場合は、
  13. これらに使用していないスイッチを割り当てておいてください。


  14. 「立ち絵機能」をONにしている時に、立ち絵を表示せずに、ウィンドウ位置を
  15. 右か左に変更した時、テールのY座標がずれるようです。
  16. 原因は調査中です。立ち絵を表示しない時は、イベントコマンド「注釈」で、
  17. 「立ち絵表示 off」と記述して立ち絵機能をOFFにしておいてください。

  18. ●機能一覧
  19. ・イベントコマンド「スクリプト」で、$win_x $win_yに値を入力すると、
  20.  ($win_x 、$win_y)の位置にウィンドウを表示する。画面左上が(0,0)。

  21. ・キーボードのQ(装備画面で前のキャラに戻るボタン)を押すと、
  22.  ウィンドウが消える。Qか決定、キャンセルキーで元に戻る。

  23. ・イベントコマンド「スクリプト」で、
  24. $name_right = true
  25. と入力すれば、ネームウィンドウがウィンドウの右に移ります。
  26. 元に戻すには、イベントコマンド「スクリプト」で
  27. $name_right = false
  28. と入力すれば、左側に戻ります。


  29. ・SYSTEM_LINEに指定したスイッチをON/OFFにすると、
  30. 文章の1行目を表示しない/表示する を切り替えることができます。


  31. ・文章のどこでもいいので、以下の表記を行う。
  32. ・ \name[] : []の中の文字を、ウィンドウ左上に小さく表示する。
  33.  表示させる名前には、制御文字 \V、\P、\N、\G が使用可能。

  34. \h[-1] : プレーヤーの上にウィンドウをポップ。
  35. \h[0] : 現在アクティブのイベントの上にウィンドウをポップ。
  36. \h[1] : IDが1番のイベントの上にウィンドウをポップする。
  37. hは大文字でもOK。

  38. ポップアップを行うとき、
  39. 「メッセージの表示」の設定で、ウィンドウの「表示位置」によって、
  40. ウィンドウがイベントの上に出るか下に出るかを設定できます。

  41. ウィンドウは通常の大きさのまま、テールだけ表示したい場合は、
  42. \t[-2] : ウィンドウが上下に表示される時は、X座標をMINAS_TWE_X_POSで固定。
  43.            $win_x で左右に表示される時は、Y座標がウィンドウの中心やや下で固定。
  44. \t[-3] : ウィンドウが上下に表示される時は、X座標をMINAS_THREE_X_POSで固定。
  45.            $win_x で左右に表示される時は、Y座標がウィンドウの中心やや下で固定。
  46. \t[-1] : プレーヤーの上に向かってテール表示。
  47. \t[0] : 現在アクティブのイベントに向かってテール表示。
  48. \t[1] : IDが1番のイベントの上に向かってテール表示。

  49. その他
  50. \O[128] : 文字を透明にする。128はalphaの値で、0で透明、255で通常。
  51. \D : 文字に影をつける
  52. \hold : メッセージ表示の、最後の文章に限定。
  53.      メッセージが終わっても、ウィンドウを閉じずに残します。
  54.      他のメッセージが表示されて次へ送られる時に消えます。
  55.      なお、ホールドされているウィンドウは、Qボタンで消せません。

  56. \skin[skin01] : ウィンドウスキンを、skin01.png に変更します。
  57.     VXACEのデフォルトに戻したい場合は \skin[Window] です。
  58.     スキンのファイルは必ず Graphics\System フォルダに入れておいてください。

  59. \tone[-34,0,68,0] : ウィンドウの色を変更します。
  60.   この例だとVXACEのデフォルトです。
  61.   データベースのシステムタブで、色を調べられます。
  62.   4つ目の値はgrayと呼ばれ、通常は0です。
  63.     




  64. ●その他
  65. ・ACEに標準装備されている機能は通常通り使用できます。
  66. ・A1殿(http://a1tktk.web.fc2.com/)の立ち絵スクリプトに対応しています。
  67.  このスクリプトの上に「RGSS3用A1共通処理」
  68.  このスクリプトの下に「空メッセージでウィンドウを開かない」「立ち絵表示」を
  69.  配置して下さい。
  70.  残念ながら、「ネームウィンドウ」は使えません。上記\nameをお使いください。
  71. ※立ち絵を表示しない時は、注釈で「立ち絵表示 off」とした方が無難です。
  72. ・イベントの下から話しかけたら上へポップ、上から話しかけたら下へポップするという
  73.  機能を追加。カスタマイズポイントで POP_DIRECTION = ture と変更のこと。


  74. ●廃止機能 
  75. ・\Iがすでに使われているので、イタリック文字変換を廃止。
  76. ・スピード変更、改行、最後に入手したアイテムの表示を、ACE化にともない廃止。


  77. 【改訂履歴】
  78. 2012.01.10  ・ウィンドウを消したまま次のウィンドウを自動で表示すると、
  79.               ネームウィンドウが表示されるのを修正。
  80. 2012.01.11  ・ネームウィンドウが出しっぱなしになるのを修正。
  81. 2012.01.12  ・メニューを出してから決定ボタンを押すとネームウィンドウがでる不具合の修正。
  82. 2012.02.01 ・ネームウィンドウのオープン&クローズのタイミングを変更。
  83.       ・hold機能を追加。
  84. 2012.02.10 ・キャラポップした時、一行ずつしか表示されない不具合を修正。
  85. 2012.02.14 ・アイテム名などの文字数が正常に取得できなかったのを修正。
  86. 2012.02.21 ・話しかけられた方向によって、ポップ方向を変えられるようにした。
  87. 2012.02.25 ・すべてのシーン遷移の際はテールを破棄(イベント中でショップ起動など)
  88. 2012.02.28 ・エスケープ文字の処理が上手くいかない問題について暫定対策。
  89. 2012.03.05 ・微妙にウィンドウ幅が足りない時があったので、僅かにウィンドウ幅追加。
  90. 2012.03.14 ・ポップアップ時の顔グラ表示に対応。
  91. 2012.04.20 ・吹きだしが大型になると選択肢が入りきらない不具合の修正。
  92.             ・ネームウィンドウが残ったままシーン遷移があると、ネームウィンドウが
  93.              閉じない不具合の修正。
  94. 2012.05.02  ・名前には、制御文字 \V、\P、\N、\G が使用可能。
  95.             ・\V については、2段階の入れ子が使用可能。
  96.             ・ウィンドウ消去機能を、「背景を暗くする」に対応。
  97. 2012.05.09 ・通常の上表示のとき、ネームウィンドウが見切れるので少し下にずらす。
  98. 2012.05.12 ・ネームウィンドウの幅と高さを変更可能にした。
  99.             ・ネームウィンドウの高さを変えると、どんどん下に伸びるのを修正。
  100. 2012.07.15 ・イベントコマンドで、$name_right = true と入力すると、
  101.        名前ウィンドウが右に移ります。
  102. 2012.08.26 ・思案型テールへの変更機能追加。
  103.             ・文章の1行目を表示しない機能は、スイッチを使えるようにした。
  104.              (セーブ&ロードに対応していないため)
  105.              なお、従来の$system_line も使用可能。
  106. 2012.10.08 ・ウィンドウスキンおよびウィンドウの色を変更可能にした。
  107. 2012.10.16 ・立ち絵の指定がない時にエラーが起こるのを修正。
  108. 2012.10.17 ・A1殿の立ち絵スクリプトの最新版に対応。
  109. 2013.06.20 ・上記の説明が間違っている個所があったので修正。

  110. =end

  111. #==============================================================================
  112. # カスタマイズポイント
  113. #==============================================================================
  114. #=begin
  115. class Window_Message < Window_Base
  116.   #
  117.   # 基本行数
  118.   #
  119.   MAX_LINE = 4
  120.   #
  121.   # \p[] - キャラポップの高さ
  122.   #
  123.   CHARPOP_HEIGHT = 40
  124.   #
  125.   #
  126.   #\name[]で表示されるウィンドウのX座標、Y座標、幅、高さ の変更値。
  127.   #座標は、メッセージウィンドウの左上端が原点。名前はウィンドウ中央に表示。
  128.   NAME_WINDOW_OFFSET_X =   0
  129.   NAME_WINDOW_OFFSET_Y = -24
  130.   NAME_WINDOW_OFFSET_WIDTH = 0
  131.   NAME_WINDOW_OFFSET_HIGHT = 5
  132.   
  133.   #
  134.   #
  135.   MINAS_TWE_X_POS = 100 # $t[-2]のときの、テールのX座標。
  136.   MINAS_THREE_X_POS = 444 # $t[-3]のときの、テールのX座標。
  137.   
  138.   POP_DIRECTION = false #イベントの方向を考慮。
  139.   
  140.   THINK_TAIL = 101 #この番号のゲームスイッチがONの時、思案型テールになります。
  141.   SYSTEM_LINE = 102 #この番号のゲームスイッチがONの時、最初の1行を表示しません。
  142.   
  143. end

  144. #(メモ)上表示で、ネームウィンドウのために少し下にずらす機能は、
  145. #再定義したupdate_placement_positionのところ。

  146. #==============================================================================
  147. # 参照機能
  148. #==============================================================================
  149. class Game_Temp
  150.   attr_accessor :last_gain_material
  151.   attr_accessor :last_gain_holder
  152. end

  153. class Window_Message < Window_Base
  154.   #--------------------------------------------------------------------------
  155.   # ● 改ページ処理
  156.   #--------------------------------------------------------------------------
  157.   def new_page(text, pos)
  158.     contents.clear
  159.     draw_face($game_message.face_name, $game_message.face_index, 0, 0)
  160.     reset_font_settings
  161.     pos[:x] = new_line_x
  162.    
  163.     #変更部分。システム用の一行目を表示しない。
  164.     if $system_line != true and $game_switches[SYSTEM_LINE] != true
  165.       pos[:y] = 0
  166.     else
  167.       if $game_party.in_battle
  168.         pos[:y] = 0
  169.       else
  170.         pos[:y] = 0 - line_height #最初の一行を表示しない。
  171.       end
  172.     end

  173.     pos[:new_x] = new_line_x
  174.     pos[:height] = calc_line_height(text)
  175.     clear_flags
  176.   end
  177. end

  178. #==============================================================================
  179. # フルグレードアップベース - 制御文字・基本機能
  180. #==============================================================================
  181. class Window_Message < Window_Base
  182.   attr_accessor :tail
  183.   #--------------------------------------------------------------------------
  184.   # ● 特殊文字の変換 + 準備
  185.   #     変換・消去してもいい部分を処理、フラグのセット。
  186.   #--------------------------------------------------------------------------
  187.   alias xrxsv2_convert_escape_characters convert_escape_characters
  188.   def convert_escape_characters(text)
  189.     #@textsが使いずらいので、ここで別変数に保管。
  190.     @all_texts = []
  191.     str = text.gsub(/\\/) { "\e" }
  192.     @all_texts = str.split("\n")
  193.    
  194.     #この段階で、変数・アクター名を変換してしまう。
  195.     #ネームウィンドウ内の文字を変換するため。
  196.     text = convert_escape_characters_easy(text)
  197.    
  198.     # 初期化
  199.     contents.font.size   = Font.default_size
  200.     contents.font.bold   = Font.default_italic
  201.     contents.font.italic = Font.default_bold
  202.     contents.font.shadow = Font.default_shadow
  203.     @type_wait = 0
  204.     @line_widths = []
  205.     @line_aligns = []
  206.     self.pop_character = nil
  207.     # ウィンドウ保持指定\holdがあるか?
  208.     @window_hold = (text.gsub!(/\\hold/) { "" } != nil)
  209.     # \info
  210.     @info_mode = (text.gsub!(/\\info/) { "" } != nil)
  211.     # 改行削除指定\_があるか?
  212.     if (/\\_(.*?)\x00/.match(@text)) != nil
  213.       $game_message.choice_start -= 1
  214.       text.gsub!(/\\_(.*?)\x00/) { $1.to_s }
  215.     end
  216.     # \name 判定
  217.     if text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  218.       name = $1
  219.       bitmap = @name_sprite.bitmap
  220.       w = [bitmap.text_size(name).width, 1].max + NAME_WINDOW_OFFSET_WIDTH
  221.       bitmap.dispose
  222.       @name_sprite.bitmap = Bitmap.new(w, 32)
  223.       bitmap = @name_sprite.bitmap
  224.       bitmap.draw_text(0, 0, bitmap.width, bitmap.height, name)
  225.       @name_window.width = w + 16
  226.       @name_window.height = bitmap.height + NAME_WINDOW_OFFSET_HIGHT
  227.       @name_window.create_contents
  228.       @name_window.open if @name_window.openness == 0
  229.       if self.visible #名前だけ表示されるのを防止。
  230.         @name_window.visible = true
  231.         @name_sprite.visible = true
  232.       else
  233.         @name_window.visible = false
  234.         @name_sprite.visible = false
  235.       end
  236.     else
  237.       @name_window.visible = false
  238.       @name_sprite.visible = false
  239.       @name_sprite.bitmap.dispose
  240.       @name_sprite.bitmap = Bitmap.new(32,32)
  241.     end
  242.     $name = $1 #あれこれで使うので、ネームウィンドウに表示予定の名前を取得。
  243.     #スキン変更
  244.     if text.sub!(/\\[Ss]kin\[(.*?)\]/) { "" }
  245.       skin = $1
  246.       self.windowskin = Cache.system(skin)
  247.       @name_window.windowskin = Cache.system(skin)
  248.     end
  249.     #ウィンドウトーン変更
  250.     if text.sub!(/\\[Tt]one\[(\-?\d+),(\-?\d+),(\-?\d+),(\-?\d+)\]/) { "" }
  251.       $game_system.window_tone.red = $1.to_f
  252.       $game_system.window_tone.green = $2.to_f
  253.       $game_system.window_tone.blue = $3.to_f
  254.       $game_system.window_tone.gray = $4.to_f
  255.     end
  256.     # キャラボップモード
  257.     if text.gsub!(/\\[Hh]\[-1\]/) { "" }
  258.       self.pop_character = -1
  259.     elsif text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "" }
  260.       self.pop_character = $1.to_i
  261.     elsif text.gsub!(/\\[Hh]/) { "" }
  262.       self.pop_character = 0
  263.     #テール表示モード
  264.     elsif text.gsub!(/\\[Tt]\[-1\]/) { "" }
  265.       self.tail_character = -1
  266.     elsif text.gsub!(/\\[Tt]\[-2\]/) { "" }
  267.       self.tail_character = -2
  268.     elsif text.gsub!(/\\[Tt]\[-3\]/) { "" }
  269.       self.tail_character = -3
  270.     elsif text.gsub!(/\\[Tt]\[([0-9]+)\]/) { "" }
  271.       self.tail_character = $1.to_i
  272.     elsif text.gsub!(/\\[Tt]/) { "" }
  273.       self.tail_character = 0
  274.     else
  275.       self.pop_character = nil
  276.     end
  277.    
  278.     # 制御文字処理
  279.     text = xrxsv2_convert_escape_characters(text)
  280.     text.gsub!(/\\[Ss]\[([0-9]+)\]/i) { "\eS[#{$1}]" }
  281.     text.gsub!(/\\[Oo]\[([0-9]+)\]/i) { "\eO[#{$1}]" }
  282.     text.gsub!(/\\last_holder/i) { "\e18" }
  283.     text.gsub!(/\\last_material/i) { "\e19" }
  284.     text.gsub!(/\\B/) { "\eB" }
  285.     text.gsub!(/\\D/) { "\eD" }
  286.     #text.gsub!(/\\n/) { "\n" }
  287.     #
  288.     # ライン情報の取得
  289.     rxs = ["\x01","\x02","\x03","\x04","\x05","\x06","\x07","\x08",
  290.       /\[([0-9]+)\]/,
  291.       "\x11","\x12","\x13","\x14", "\x15", "\x16", "\x17", "\x18","\x19"]
  292.     lines = text.split("\x00")
  293.     @lines_max = lines.size
  294.     for i in 0...@lines_max
  295.       line = lines[i]
  296.       for rx in rxs
  297.         line.gsub!(rx) {""}
  298.       end
  299.       @line_aligns[i] =
  300.         line.sub!(/\\center/) {""} ? CENTER :
  301.         line.sub!(/\\right/)  {""} ? RIGHT :
  302.                                      AUTO
  303.       # 行の横幅の取得と設定
  304.       cx = text_width_no_escape(line,text) #test
  305.       #cx = contents.text_size(line,text).width
  306.       @line_widths[i] = cx
  307.     end
  308.     # 位置揃え制御文字の削除
  309.     text.gsub!(/\\center/) {""}
  310.     text.gsub!(/\\right/) {""}
  311.     # キャラポップ時のウィンドウリサイズ
  312.     reszie_window_for_pop
  313.    
  314.     del_tail # if @tail != nil
  315.     # $mes_id が空のときと戦闘中はふきだしを表示しない
  316.     if defined?($game_system.show_stand_picture) #立ち絵に対応。
  317.       $mes_id = -1 if $game_system.show_stand_picture == true
  318.     end
  319.     if $mes_id != nil and not $game_party.in_battle
  320.       # ふきだしのテールを描画
  321.       skin = "Window"
  322.       if @background == 0
  323.         #画像の準備
  324.         @tail = Sprite.new
  325.         @tail.visible = false
  326.         # 位置を取得
  327.         tale_pos = get_tale_pos
  328.         if $win_x != nil
  329.           if $win_x > 0
  330.             @tail.bitmap = Cache.system(skin + "-right")
  331.             @tail.x = tale_pos[0]
  332.             @tail.y = tale_pos[1]
  333.             @tail.z = self.z + 1
  334.           elsif  $win_x < 0
  335.             @tail.bitmap = Cache.system(skin + "-left")
  336.             @tail.x = tale_pos[0]
  337.             @tail.y = tale_pos[1]
  338.             @tail.z = self.z + 1
  339.           else
  340.             create_tail_up_under
  341.           end
  342.         else
  343.           create_tail_up_under
  344.         end
  345.         # エクストラスプライトに登録
  346.         @extra_sprites = [] if @extra_sprites.nil?
  347.         @extra_sprites.push(@tail) if @tail != nil
  348.         # 更新
  349.         update_tail
  350.       end
  351.     end

  352.     open_and_wait #リサイズが終わった時点でウィンドウオープン。
  353.    
  354.     return text
  355.   end
  356.   #--------------------------------------------------------------------------
  357.   # ● 制御文字の変換。
  358.   #    変数・パーティ名・アクター名・所持金のみ変換する。
  359.   #    文字「\」はエスケープ文字(\e)に変換。
  360.   #--------------------------------------------------------------------------
  361.   def convert_escape_characters_easy(text)
  362.     result = text.to_s.clone
  363.     result.gsub!(/\\[vV]\[/)          { "\eV\[" }
  364.     result.gsub!(/\\[nN]\[/)          { "\eN\[" }
  365.     result.gsub!(/\\[pP]\[/)          { "\eP\[" }
  366.     result.gsub!(/\\[gG]/)          { "\eG" }
  367.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  368.     result.gsub!(/\eV\[(\d+)\]/i) { $game_variables[$1.to_i] }
  369.     result.gsub!(/\eN\[(\d+)\]/i) { actor_name($1.to_i) }
  370.     result.gsub!(/\eP\[(\d+)\]/i) { party_member_name($1.to_i) }
  371.     result.gsub!(/\eG/i)          { Vocab::currency_unit }
  372.     result
  373.   end
  374.   #--------------------------------------------------------------------------
  375.   # ● 文字の長さを取得する。エスケープ文字は含まない。
  376.   # line : 表示しようとしている全ての文字列。
  377.   # text : その列の文字。
  378.   #--------------------------------------------------------------------------
  379.   def text_width_no_escape(line , text_o)
  380.     add = 5 #微妙に足りないので水増し。
  381.     text = Marshal.load(Marshal.dump(text_o))
  382.     text.gsub!(/\ehold/) { "" }
  383.     text.gsub!(/\einfo/) { "" }
  384.     # 改行削除指定\_があるか?
  385.     if (/\\_(.*?)\x00/.match(@text)) != nil
  386.       $game_message.choice_start -= 1
  387.       text.gsub!(/\\_(.*?)\x00/) { "" }
  388.     end
  389.     # \name 判定
  390.     text.sub!(/\e[Nn]ame\[(.*?)\]/) { "" }
  391.     text.gsub!(/\e[Hh]\[-1\]/) { "" }
  392.     text.gsub!(/\e[Hh]\[([0-9]+)\]/) { "" }
  393.     text.gsub!(/\e[Hh]/) { "" }
  394.     text.gsub!(/\e[Tt]\[-1\]/) { "" }
  395.     text.gsub!(/\e[Tt]\[-2\]/) { "" }
  396.     text.gsub!(/\e[Tt]\[-3\]/) { "" }
  397.     text.gsub!(/\e[Tt]\[([0-9]+)\]/) { "" }
  398.     text.gsub!(/\e[Tt]/) { "" }
  399.     # 制御文字処理
  400.     text.gsub!(/\e[Ss]\[([0-9]+)\]/i) { "" }
  401.     text.gsub!(/\e[Oo]\[([0-9]+)\]/i) { "" }
  402.     text.gsub!(/\elast_holder/i) { "" }
  403.     text.gsub!(/\elast_material/i) { "" }
  404.     #text.gsub!(/\eV/) { "" } #変数に置き換える。
  405.     #text.gsub!(/\eN/) { "" } #名前へ置き換える。
  406.     #text.gsub!(/\eP/) { "" } #名前へ置き換える。
  407.     #text.gsub!(/\eG/) { "" } #金額へ置き換える。
  408.     #text.gsub!(/\eC/) { "" }
  409.     text.gsub!(/\eB/) { "" }
  410.     text.gsub!(/\eD/) { "" }
  411.     if text =~ /\eI/
  412.       loop do
  413.         if str = text.sub!(/\eI\[(\d+)\]/){ "" }
  414.           add += 24
  415.         else
  416.           break
  417.         end
  418.       end
  419.     end
  420.     #text.gsub!(/\\n/) { "\n" }
  421.     text.sub!(/\ecenter/) {""}
  422.     text.sub!(/\eright/)  {""}
  423.     text.gsub!(/\ecenter/) {""}
  424.     text.gsub!(/\eright/) {""}
  425.    
  426.     text = xrxsv2_convert_escape_characters(text)
  427.     basic_width = text_size(text).width + add
  428.     esc = text.scan(/\e(\S)/)
  429.     return ( basic_width - esc.size * (contents.font.size - 4) ) #\eの幅は20?
  430.   end
  431.   #--------------------------------------------------------------------------
  432.   # ● 最も長い列の長さを調べる。エスケープ文字は含まない。
  433.   #--------------------------------------------------------------------------
  434.   def max_width
  435.     text_size = []
  436.     for i in 0 ... @all_texts.size
  437.       text_size.push text_width_no_escape(@all_texts[i],@all_texts[i]) + 20
  438.     end
  439.     return text_size.max
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # ● 吹きだしテールが上か下の場合の画像を準備。
  443.   #--------------------------------------------------------------------------
  444.   def create_tail_up_under
  445.     skin = "Window"
  446.     tale_pos = get_tale_pos
  447.     case @position
  448.     when 0  # 上
  449.       @tail.bitmap = Cache.system(skin + "-top")
  450.       @tail.x = tale_pos[0]
  451.       @tail.y = tale_pos[1]
  452.       @tail.z = self.z + 1
  453.     when 1  # 中
  454.       @tail.dispose
  455.       @tail = nil
  456.     when 2  # 下
  457.       @tail.bitmap = Cache.system(skin + "-under")
  458.       @tail.x = tale_pos[0]
  459.       @tail.y = tale_pos[1]
  460.       @tail.z = self.z + 1
  461.     end
  462.   end
  463.   #--------------------------------------------------------------------------
  464.   # ● 全テキストの処理
  465.   #--------------------------------------------------------------------------
  466.   def process_all_text
  467.     #open_and_wait #リサイズがあるので、すぐにウィンドウをオープンしない。
  468.     text = convert_escape_characters($game_message.all_text)
  469.     pos = {}
  470.     new_page(text, pos)
  471.     process_character(text.slice!(0, 1), text, pos) until text.empty?
  472.   end
  473.   #--------------------------------------------------------------------------
  474.   # ● メッセージの更新 *
  475.   #--------------------------------------------------------------------------
  476.   def update_message
  477.     @wait_count = @type_wait
  478.     loop do
  479.       c = @text.slice!(/./m)
  480.       case update_message_type(c)
  481.       when 1
  482.         break
  483.       when 2
  484.         next
  485.       end
  486.       break unless @show_fast or @line_show_fast
  487.     end
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # 一文字の描画 (返り値 1:break, 2:next)
  491.   #--------------------------------------------------------------------------
  492. #=begin
  493.   def process_escape_character(code, text, pos)
  494.     case code.upcase
  495.     when '
  496.       @gold_window.open
  497.     when '.'
  498.       wait(15)
  499.     when '|'
  500.       wait(60)
  501.     when '!'
  502.       input_pause
  503.     when '>'
  504.       @line_show_fast = true
  505.     when '<'
  506.       @line_show_fast = false
  507.     when '^'
  508.       @pause_skip = true
  509.     #when 'n'                      # 改行
  510.     #  new_line
  511.     #  max = MAX_LINE
  512.     #  max = 14 if self.pop_character != nil
  513.     #  if @line_count >= max      # 行数が最大のとき
  514.     #    unless @text.empty?           # さらに続きがあるなら
  515.     #      self.pause = true           # 入力待ちを入れる
  516.           #return 1
  517.     #    end
  518.     #  end
  519.     #when 'S'                       # \S[n]  (スピード変更)
  520.     #  text.sub!(/\[([0-9]+)\]/, "")
  521.     #  @type_wait = $1.to_i
  522.     #  return 2
  523.     when 'O'                       # \O 文字を透明にする。
  524.       text.sub!(/\[([0-9]+)\]/, "")
  525.       contents.font.color.alpha = $1.to_i
  526.       #return 2
  527.     when 'D' #\D 文字に影をつける
  528.       contents.font.shadow ^= true
  529.     #when '18'
  530.     #  name = ($game_temp.last_gain_holder.name rescue "")
  531.     #  update_message_type_draw_at(name)
  532.     #when '19'
  533.     #  item = ($game_temp.last_gain_material.item rescue nil)
  534.     #  draw_item_name(item, @contents_x, @contents_y)
  535.     #  @contents_x += 196
  536.     else
  537.       super
  538.     end
  539.         
  540.   end
  541. #=end
  542.   #--------------------------------------------------------------------------
  543.   # ● 改ページ処理
  544.   #--------------------------------------------------------------------------
  545.   alias xrxsv2_new_page new_page
  546.   def new_page(text, pos)
  547.     xrxsv2_new_page(text, pos)
  548.     update_charpop_window
  549.   end
  550.   #--------------------------------------------------------------------------
  551.   # ● 改行位置の取得
  552.   #--------------------------------------------------------------------------
  553.   #def new_line_x
  554.   #  $game_message.face_name.empty? ? 0 : 112
  555.   #end
  556.   #--------------------------------------------------------------------------
  557.   # ● 改行処理
  558.   #--------------------------------------------------------------------------
  559.   alias xrxsv2_new_line_x new_line_x
  560.   def new_line
  561.     xrxsv2_new_line
  562.     set_align
  563.   end
  564.   #--------------------------------------------------------------------------
  565.   # 位置揃え
  566.   #--------------------------------------------------------------------------
  567.   def set_align
  568.     w = @line_widths[@line_count].to_i
  569.     a = @line_aligns[@line_count]
  570.     case a
  571.     when CENTER
  572.       @contents_x = @contents_x + ((contents.width - @contents_x) - w) / 2
  573.     when RIGHT
  574.       @contents_x = contents.width - w
  575.     end
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # ● ファイバーのメイン処理 ☆再定義
  579.   #--------------------------------------------------------------------------
  580.   def fiber_main
  581.     $game_message.visible = true
  582.     update_background
  583.     update_placement
  584.     loop do
  585.       process_all_text if $game_message.has_text?
  586.       process_input
  587.       $game_message.clear
  588.       @gold_window.close
  589.       process_hold #ホールドウィンドウの処理。
  590.       Fiber.yield
  591.       break unless text_continue?
  592.     end
  593.     close_and_wait
  594.     $game_message.visible = false
  595.     @fiber = nil
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # 定数
  599.   #--------------------------------------------------------------------------
  600.   AUTO   = 0
  601.   LEFT   = 1
  602.   CENTER = 2
  603.   RIGHT  = 3
  604. end
  605. #==============================================================================
  606. # アクティブイベント取得
  607. #==============================================================================
  608. class Game_Interpreter
  609.   attr_reader   :event_id
  610. end


  611. #==============================================================================
  612. # 各種機能の追加 - キャラポップ/ネーム/ホールド
  613. #==============================================================================
  614. class Window_Message < Window_Base
  615.   #--------------------------------------------------------------------------
  616.   # ● カーソルの更新 *
  617.   #--------------------------------------------------------------------------
  618.   def update_cursor
  619.     if [url=home.php?mod=space&uid=370741]@Index[/url] >= 0
  620.       x = ($game_message.face_name.empty? ? 0 : 112)
  621.       y = ($game_message.choice_start + @index) * WLH - 1
  622.       w = contents.width - x
  623.       if self.pop_character != nil
  624.         x += 28
  625.         w -= 20
  626.       end
  627.       self.cursor_rect.set(x, y, w, WLH)
  628.     else
  629.       self.cursor_rect.empty
  630.     end
  631.   end
  632.   #--------------------------------------------------------------------------
  633.   # キャラクターの取得
  634.   #   parameter : パラメータ
  635.   #--------------------------------------------------------------------------
  636.   def get_character(parameter)
  637.     # パラメータで分岐
  638.     case parameter
  639.     when -1  # プレイヤー
  640.       return $game_player
  641.     when 0  # 現在アクティブなイベント
  642.       id = $game_map.interpreter.event_id
  643.       events = $game_map.events
  644.       return events == nil ? nil : events[id]
  645.     else  # 特定のイベント
  646.       events = $game_map.events
  647.       return events == nil ? nil : events[parameter]
  648.     end
  649.   end
  650.   #--------------------------------------------------------------------------
  651.   # (メッセージ終了時)ホールドの処理
  652.   #--------------------------------------------------------------------------
  653.   def process_hold
  654.     if @window_hold
  655.       @held_windows.push(Window_Copy.new(self))
  656.       @held_windows.push(Window_Copy.new(@name_window))
  657.       @held_windows.push(Sprite_Copy.new(@name_sprite))
  658.       @held_windows.push(Sprite_Copy.new(@back_sprite))
  659.       for sprite in @extra_sprites
  660.         next if sprite.disposed?
  661.         @held_windows.push(Sprite_Copy.new(sprite))
  662.       end
  663.       @extra_sprites.clear
  664.       self.openness = 0
  665.       #@name_window.openness = 0
  666.       @back_sprite.visible = false
  667.     else
  668.       @held_windows.each {|object| object.dispose}
  669.       @held_windows.clear
  670.     end
  671.     #@name_window.close
  672.     #@name_sprite.visible = false
  673.   end
  674.   #--------------------------------------------------------------------------
  675.   # キャラポップ位置の設定と取得
  676.   #--------------------------------------------------------------------------
  677.   def pop_character=(character_id)
  678.     @pop_character = character_id
  679.   end
  680.   def pop_character
  681.     return @pop_character
  682.   end
  683.   #--------------------------------------------------------------------------
  684.   # キャラポップ時のウィンドウリサイズ
  685.   #--------------------------------------------------------------------------
  686.   def reszie_window_for_pop
  687.     #キャラポップ
  688.     if self.pop_character != nil
  689.       #max_x = @line_widths.max.to_i
  690.       #n  = max_x + 32
  691.       n = 0
  692.       n += $game_message.face_name.empty? ? 0 : 122
  693.       m  = $game_message.face_name.empty? ? 0 : 96
  694.       w  = @name_sprite.bitmap.width
  695.       self.width  = max_width + n
  696.       self.height = [@all_texts.size * line_height, m].max + 32
  697.       
  698.       #システム用の一行目を表示しない。
  699.       if $system_line or $game_switches[SYSTEM_LINE]
  700.         self.height -= line_height if $game_party.in_battle == false #戦闘中にあらず
  701.       end
  702.       
  703.       create_contents
  704.       update_charpop_window
  705.     elsif @info_mode
  706.       @line_aligns[0] = CENTER
  707.       self.x = - 8
  708.       self.width = Graphics.width + 16
  709.       self.height = 56
  710.       create_contents
  711.     else
  712.       self.x = 0
  713.       self.width  = Graphics.width
  714.       self.height = MAX_LINE * line_height + 32
  715.       update_placement #位置情報修正。
  716.       create_contents
  717.     end
  718.   end
  719.   #--------------------------------------------------------------------------
  720.   # ● 背景スプライトの作成
  721.   #--------------------------------------------------------------------------
  722.   alias xrxsv2_create_back_sprite create_back_sprite
  723.   def create_back_sprite
  724.     xrxsv2_create_back_sprite
  725.     @back_sprite.zoom_x = 1.0 * Graphics.width / @back_sprite.bitmap.width
  726.     @name_window = Window_Base.new(0,0,112,36)
  727.     @name_window.visible = false
  728.     @name_sprite = Sprite.new
  729.     @name_sprite.bitmap = Bitmap.new(32,32)
  730.     @name_sprite.visible = false
  731.     self.x = self.x
  732.     self.y = self.y
  733.     self.z = self.z
  734.     @held_windows = []
  735.     @extra_sprites = []
  736.   end
  737.   #--------------------------------------------------------------------------
  738.   # ● 背景スプライトの解放
  739.   #--------------------------------------------------------------------------
  740.   alias xrxsv2_dispose_back_sprite dispose_back_sprite
  741.   def dispose_back_sprite
  742.     xrxsv2_dispose_back_sprite
  743.     @name_window.dispose if @name_window != nil #メニュー画面を出そうとするとエラー?
  744.     @name_sprite.dispose if @name_sprite != nil
  745.     for window in @held_windows
  746.       window.dispose
  747.     end
  748.   end
  749.   #--------------------------------------------------------------------------
  750.   # ● 背景スプライトの更新
  751.   #--------------------------------------------------------------------------
  752.   alias xrxsv2_update_back_sprite update_back_sprite
  753.   def update_back_sprite
  754.     @name_window.update
  755.     xrxsv2_update_back_sprite
  756.     update_charpop_window
  757.   end
  758.   #--------------------------------------------------------------------------
  759.   # ウィンドウの位置と不透明度の設定 (キャラポップ)
  760.   #--------------------------------------------------------------------------
  761.   def update_charpop_window
  762.     if self.pop_character
  763.       character = get_character(self.pop_character)
  764.       return if character == nil
  765.       # [X座標]
  766.       n = self.width / 2
  767.       n = [n, @name_skin.width + 16].max if @current_name != nil
  768.       w = @name_sprite.bitmap.width
  769.       x = character.screen_x - [[n, w].max, self.width - 32].min
  770.       # [Y座標]
  771.       if self.pop_character == 0 and POP_DIRECTION #イベントの方向を考慮。
  772.         if character.direction == 2 #下向き
  773.           @position = 0 #上にポップ
  774.         elsif character.direction == 8 #上向き
  775.           @position = 2 #下にポップ
  776.         end
  777.       end
  778.       case @position
  779.       when 0
  780.         y = character.screen_y - CHARPOP_HEIGHT - self.height
  781.       else
  782.         y = character.screen_y + 16
  783.       end
  784.       x_max = Graphics.width - 4 - self.width
  785.       x_min = 4
  786.       y_max = Graphics.height - self.height
  787.       y_min = 4
  788.       self.x = [[x, x_max].min, x_min].max
  789.       self.y = [[y, y_max].min, y_min].max
  790.     end
  791.   end
  792.   #--------------------------------------------------------------------------
  793.   # 位置の連動
  794.   #--------------------------------------------------------------------------
  795.   def x=(n)
  796.     super
  797.     if @name_window
  798.       if $name_right
  799.         @name_window.x = n + self.width - @name_window.width - NAME_WINDOW_OFFSET_X
  800.         @name_sprite.x = @name_window.x + 8 + NAME_WINDOW_OFFSET_WIDTH / 2
  801.       else
  802.         @name_window.x = n + NAME_WINDOW_OFFSET_X
  803.         @name_sprite.x = @name_window.x + 8 + NAME_WINDOW_OFFSET_WIDTH / 2
  804.       end
  805.     end
  806.   end
  807.   def y=(n)
  808.     super
  809.     if @name_window
  810.       @name_window.y = n + NAME_WINDOW_OFFSET_Y
  811.       @name_sprite.y = n + NAME_WINDOW_OFFSET_Y + 2 + NAME_WINDOW_OFFSET_HIGHT / 2
  812.     end
  813.   end
  814.   def z=(n)
  815.     super
  816.     if @name_window
  817.       @name_window.z = n + 11#1 テールの上に表示されるので、Zを水増しする。
  818.       @name_sprite.z = n + 12#2
  819.     end
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # ● ファイバーのメイン処理
  823.   #--------------------------------------------------------------------------
  824.   def fiber_main_namewin
  825.     fiber_main_namewin_default
  826.     @name_window.openness = 0
  827.     @name_sprite.bitmap.clear
  828.     $name = ""
  829.   end
  830.   alias :fiber_main_namewin_default :fiber_main
  831.   alias :fiber_main :fiber_main_namewin
  832. end
  833. #==============================================================================
  834. # 伸縮対応
  835. #==============================================================================
  836. class Window_Message < Window_Base
  837.   #--------------------------------------------------------------------------
  838.   # ● ウィンドウの背景と位置の設定 [再定義]
  839.   #--------------------------------------------------------------------------
  840.   def reset_window
  841.     @background = $game_message.background
  842.     @position = $game_message.position
  843.     if @background == 0   # 通常ウィンドウ
  844.       self.opacity = 255
  845.     else                  # 背景を暗くする、透明にする
  846.       self.opacity = 0
  847.     end
  848.     case @position
  849.     when 0  # 上
  850.       self.y = 0
  851.       @gold_window.y = 360
  852.     when 1  # 中
  853.       self.y = (Graphics.height - self.height) / 2
  854.       @gold_window.y = 0
  855.     when 2  # 下
  856.       self.y = Graphics.height - self.height
  857.       @gold_window.y = 0
  858.     end
  859.   end
  860. end
  861. #==============================================================================
  862. # □ Window_Copy
  863. #------------------------------------------------------------------------------
  864. #   指定のウィンドウのコピーを作成します。
  865. #==============================================================================
  866. class Window_Copy < Window_Base
  867.   #--------------------------------------------------------------------------
  868.   # ○ オブジェクト初期化
  869.   #--------------------------------------------------------------------------
  870.   def initialize(window)
  871.     super(window.x, window.y, window.width, window.height)
  872.     self.contents = window.contents.dup unless window.contents.nil?
  873.     self.opacity = window.opacity
  874.     self.back_opacity = window.back_opacity
  875.     self.z = window.z - 3
  876.     self.visible = window.visible
  877.   end
  878. end
  879. #==============================================================================
  880. # □ Sprite_Copy
  881. #------------------------------------------------------------------------------
  882. #   指定のスプライトのコピーを作成します。
  883. #==============================================================================
  884. class Sprite_Copy < Sprite
  885.   #--------------------------------------------------------------------------
  886.   # ○ オブジェクト初期化
  887.   #--------------------------------------------------------------------------
  888.   def initialize(sprite)
  889.     super()
  890.     self.bitmap = sprite.bitmap.dup unless sprite.bitmap.nil?
  891.     self.opacity = sprite.opacity
  892.     self.x = sprite.x
  893.     self.y = sprite.y
  894.     self.z = sprite.z - 3
  895.     self.ox = sprite.ox
  896.     self.oy = sprite.oy
  897.     self.zoom_x = sprite.zoom_x
  898.     self.visible = sprite.visible
  899.   end
  900. end



  901. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  902. #■吹きだしテールの表示ルーチン。
  903. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  904. #==============================================================================
  905. # +++ 「+ふきだし表示」VX +++
  906. # by パラ犬  http://2d6.parasite.jp/
  907. #      ×
  908. #    row       http://xms.rdy.jp/
  909. #
  910. # publish 2010/ 3/ 2
  911. # update  -
  912. #
  913. #------------------------------------------------------------------------------
  914. #    ほぼどんなメッセージウィンドウに対しても後付け可能な「ふきだし表示」です。
  915. #  また、テール部分のみの自動追尾機能を持ちます。
  916. #   ふきだし表示をするには、
  917. #  テール用画像「Window-top」「Window-under」を
  918. #  「Graphics/System」フォルダにインポートしておく必要があります。
  919. #==============================================================================
  920. # ■ Window_Message
  921. #==============================================================================
  922. class Window_Message < Window_Base
  923.   #--------------------------------------------------------------------------
  924.   # ● メッセージの開始
  925.   #--------------------------------------------------------------------------
  926.   alias parashelf_update_all_windows update_all_windows
  927.   def update_all_windows
  928.     parashelf_update_all_windows
  929.     update_tail
  930.   end
  931.   #--------------------------------------------------------------------------
  932.   # クローズ [オーバーライド]
  933.   #--------------------------------------------------------------------------
  934.   def close
  935.     super
  936.     del_tail
  937.     @name_window.close if @name_window != nil #ネームウィンドウのクローズ動作。
  938.   end
  939.   #--------------------------------------------------------------------------
  940.   # ● 背景スプライトの更新
  941.   #--------------------------------------------------------------------------
  942.   alias parashelf_update_back_sprite update_back_sprite
  943.   def update_back_sprite
  944.     parashelf_update_back_sprite
  945.     update_tail
  946.   end
  947.   #--------------------------------------------------------------------------
  948.   # ○ フレーム更新 (ふきだしテールの更新)
  949.   #--------------------------------------------------------------------------
  950.   def update_tail
  951.     # ふきだしモードではイベントの動きに追従
  952.     if $mes_id != nil and @tail != nil
  953.       tale_pos = get_tale_pos
  954.       @tail.x = tale_pos[0]
  955.       @tail.y = tale_pos[1]
  956.       update_tail_bitmap
  957.     end
  958.   end
  959.   ##--------------------------------------------------------------------------
  960.   # ○ ふきだしテールの画像を更新。
  961.   #--------------------------------------------------------------------------
  962.   def update_tail_bitmap
  963.     skin = "Window"
  964.     skin = "Think" if $game_switches[THINK_TAIL]
  965.     if $win_x != nil
  966.       if $win_x > 0
  967.         @tail.bitmap = Cache.system(skin + "-right")
  968.       elsif  $win_x < 0
  969.         @tail.bitmap = Cache.system(skin + "-left")
  970.       else
  971.         case @position
  972.         when 0  # 上
  973.           @tail.bitmap = Cache.system(skin + "-top")
  974.         when 2  # 下
  975.           @tail.bitmap = Cache.system(skin + "-under")
  976.         end
  977.       end
  978.     else
  979.       case @position
  980.       when 0  # 上
  981.         @tail.bitmap = Cache.system(skin + "-top")
  982.       when 2  # 下
  983.         @tail.bitmap = Cache.system(skin + "-under")
  984.       end
  985.     end
  986.     # 可視状態
  987.     if self.visible == true
  988.       @tail.visible = self.openness == 255
  989.     else
  990.       @tail.visible = false
  991.     end
  992.   end
  993.   #--------------------------------------------------------------------------
  994.   # ○ テールの位置を計算
  995.   #--------------------------------------------------------------------------
  996.   def get_tale_pos
  997.     if defined?($game_system.show_stand_picture) #A1立ち絵スクリプトを入れている。
  998.       if $game_system.show_stand_picture #立ち絵on
  999.         pos = get_tale_pos_stand_pic
  1000.       else
  1001.         pos = get_tale_pos_normal
  1002.       end
  1003.     else
  1004.       pos = get_tale_pos_normal
  1005.     end
  1006.     return pos
  1007.   end
  1008.   #--------------------------------------------------------------------------
  1009.   # ○ テールの位置を計算/立ち絵使用時。※NAME_CHANGEの編集必須。
  1010.   #--------------------------------------------------------------------------
  1011.   def get_tale_pos_stand_pic
  1012.     if $game_message.face_name != ""  and @tail != nil
  1013.       target_name = $game_message.face_name + "_" + $game_message.face_index.to_s
  1014.       name = A1_System::StandPicture::NAME_CHANGE[target_name]
  1015.       chara = name[0] if name != nil
  1016.       if @stand_pic[chara] != nil #立ち絵無しの場合通常通り。
  1017.         x = @stand_pic[chara].pic_sprite.x + @stand_pic[chara].pic_sprite.width / 2
  1018.         y = get_tale_pos_normal_updown
  1019.         update_tail_bitmap
  1020.       else
  1021.         return get_tale_pos_normal #立ち絵が見つからない場合は通常通り。
  1022.       end
  1023.     else
  1024.       return get_tale_pos_normal #立ち絵が見つからない場合は通常通り。
  1025.     end
  1026.     return [x,y]
  1027.   end
  1028.   #--------------------------------------------------------------------------
  1029.   # ○ テールの位置を計算/立ち絵未使用時。
  1030.   #--------------------------------------------------------------------------
  1031.   def get_tale_pos_normal
  1032.     if $mes_id == (-2) #左右の場合は高さはウィンドウ中心。上下ならやや左に配置。
  1033.       if $win_x != nil
  1034.         if $win_x > 0
  1035.           x = $win_x - @tail.width / 2
  1036.           y = self.y + self.height / 2 - @tail.height / 2
  1037.         elsif $win_x < 0
  1038.           x = self.width - @tail.width / 2
  1039.           y = self.y + self.height / 2 - @tail.height / 2
  1040.         else
  1041.           x = MINAS_TWE_X_POS
  1042.           y = get_tale_pos_normal_updown
  1043.         end
  1044.       else
  1045.         x = MINAS_TWE_X_POS
  1046.         y = get_tale_pos_normal_updown
  1047.       end
  1048.     elsif $mes_id <= (-3) #左右の場合は高さはウィンドウ中心。上下ならやや左に配置。
  1049.       if $win_x != nil
  1050.         if $win_x > 0
  1051.           x = $win_x - @tail.width / 2
  1052.           y = self.y + self.height / 2
  1053.         elsif $win_x < 0
  1054.           x = self.width - @tail.width / 2
  1055.           y = self.y + self.height / 2
  1056.         else
  1057.           x = MINAS_THREE_X_POS
  1058.           y = get_tale_pos_normal_updown
  1059.         end
  1060.       else
  1061.         x = MINAS_THREE_X_POS
  1062.         y = get_tale_pos_normal_updown
  1063.       end
  1064.     else
  1065.       character = get_character($mes_id)
  1066.       x = [[character.screen_x - 16, self.x].max, self.x + self.width - 32].min
  1067.       if $win_x != nil
  1068.         if $win_x > 0
  1069.           x = $win_x - @tail.width / 2
  1070.           y = character.screen_y
  1071.         elsif $win_x < 0
  1072.           x = self.width
  1073.           y = character.screen_y
  1074.         else
  1075.           y = get_tale_pos_normal_updown
  1076.         end
  1077.       else
  1078.         y = get_tale_pos_normal_updown
  1079.       end
  1080.     end
  1081.     return [x, y]
  1082.   end
  1083.   #--------------------------------------------------------------------------
  1084.   # ○ テールが上下の時、かつ[-2][-3]でない時のy座標の取得。
  1085.   #--------------------------------------------------------------------------
  1086.   def get_tale_pos_normal_updown
  1087.     case @position
  1088.     when 0
  1089.       y = self.y + self.height - @tail.height / 2
  1090.     else
  1091.       y = self.y - @tail.height / 2
  1092.     end
  1093.     return y
  1094.   end
  1095.   #--------------------------------------------------------------------------
  1096.   # ○ ふきだしを破棄
  1097.   #--------------------------------------------------------------------------
  1098.   def del_tail
  1099.     if @tail != nil
  1100.       @tail.dispose
  1101.       @tail = nil
  1102.     end
  1103.   end
  1104. end
  1105. #
  1106. # ▼▲▼ XRXS 9拡張CO-X. ふきだし自動設定 ▼▲▼
  1107. #==============================================================================
  1108. # ■ Window_Message
  1109. #==============================================================================
  1110. class Window_Message < Window_Base
  1111.   #--------------------------------------------------------------------------
  1112.   # ○ ポップキャラクターの設定
  1113.   #--------------------------------------------------------------------------
  1114.   def pop_character=(character_id)
  1115.     @pop_character = character_id
  1116.     $mes_id = character_id
  1117.   end
  1118.   #--------------------------------------------------------------------------
  1119.   # ○ テールキャラクターの設定
  1120.   #--------------------------------------------------------------------------
  1121.   def tail_character=(character_id)
  1122.     #@pop_character = character_id
  1123.     $mes_id = character_id
  1124.   end
  1125. end


  1126. #==============================================================================
  1127. # ■ Window_ChoiceList
  1128. #------------------------------------------------------------------------------
  1129. #  イベントコマンド[選択肢の表示]で、Y座標を修正します。
  1130. #==============================================================================
  1131. class Window_ChoiceList < Window_Command
  1132.   #--------------------------------------------------------------------------
  1133.   # ● ウィンドウ位置の更新
  1134.   #--------------------------------------------------------------------------
  1135.   def update_placement_hukidasi
  1136.     #self.width = [max_choice_width + 12, 96].max + padding * 2
  1137.     #self.width = [width, Graphics.width].min
  1138.     #self.height = fitting_height($game_message.choices.size)
  1139.     #self.x = Graphics.width - width
  1140.     #if @message_window.y >= Graphics.height / 2
  1141.     #  self.y = @message_window.y - height
  1142.     #else
  1143.     #  self.y = @message_window.y + @message_window.height
  1144.     #end
  1145.     update_placement_hukidasi_default
  1146.     if self.y + self.height > Graphics.height
  1147.       self.y -= ( ( self.height + self.y ) - Graphics.height)
  1148.       self.z += 100
  1149.     end
  1150.   end
  1151.   alias :update_placement_hukidasi_default :update_placement
  1152.   alias :update_placement :update_placement_hukidasi
  1153. end

  1154. #==============================================================================
  1155. # ■ Scene_Menu
  1156. #------------------------------------------------------------------------------
  1157. #  メニューを開いてからウィンドウが出るとネームウィンドウが表示される不具合修正。
  1158. #==============================================================================
  1159. #class Scene_Menu < Scene_MenuBase
  1160. #  def terminate_hukidasi_menyu
  1161. #    @name_window.openness = 0 if @name_window != nil
  1162. #    terminate_hukidasi_menyu_default
  1163. #  end
  1164. #  alias :terminate_hukidasi_menyu_default :terminate
  1165. #  alias :terminate :terminate_hukidasi_menyu
  1166. #end

  1167. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1168. #■ウィンドウ非表示ルーチン
  1169. #■吹きだしテールとネームウィンドウに対応。
  1170. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1171. #==============================================================================
  1172. # L(キーボードのQ)を押すと、メッセージウィンドウを表示・非表示
  1173. #==============================================================================
  1174. class Window_Message < Window_Base
  1175.   def update_winoff
  1176.     unless $game_party.in_battle #バトル中は無効。
  1177.       if Input.trigger?(Input::L)
  1178.         if self.visible == true
  1179.           self.visible = false
  1180.           @background = 777 if @back_sprite != nil and @background == 1 #「背景を暗くする」
  1181.           @tail.visible = false if @tail != nil
  1182.         else
  1183.           self.visible = true
  1184.           @background = 1 if @back_sprite != nil and @background == 777 #「背景を暗くする」
  1185.         end
  1186.         if @name_window != nil
  1187.           if @name_window.visible == false and $name != nil and $name != ""
  1188.             @name_window.visible = true
  1189.             @name_sprite.visible = true
  1190.           else
  1191.             @name_window.visible = false
  1192.             @name_sprite.visible = false
  1193.           end
  1194.         end
  1195.       elsif Input.trigger?(Input::C) or Input.trigger?(Input::B)
  1196.         if self.visible == false
  1197.           self.visible = true
  1198.           @back_sprite.visible = true unless @back_sprite
  1199.         end
  1200.         @tail.visible = true if @tail != nil and @tail.visible == false
  1201.         if @name_window != nil and $name != nil
  1202.           if $name != ""
  1203.             @name_window.visible = true
  1204.             @name_sprite.visible = true
  1205.           end
  1206.         end
  1207.       end
  1208.     end
  1209.     update_winoff_default
  1210.   end
  1211.   alias :update_winoff_default :update
  1212.   alias :update :update_winoff
  1213. end


  1214. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1215. #■ウィンドウ表示位置指定ルーチン
  1216. #■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□■□
  1217. #===========================================================================
  1218. #イベントコマンド「スクリプト」を使い、
  1219. #$win_x=100 
  1220. #$win_y=100
  1221. #と入力すれば、ウィンドウを(100、100)の位置に表示します。
  1222. #使わない時は
  1223. #$win_x=nil
  1224. #などとnilを入力しておいてください。
  1225. #===========================================================================
  1226. class Window_Message < Window_Base
  1227.   #--------------------------------------------------------------------------
  1228.   # ● ウィンドウの背景と位置の設定 [再定義]
  1229.   #--------------------------------------------------------------------------
  1230.   def update_placement_position
  1231.     update_placement_position_default
  1232.     if $win_x != nil
  1233.       if $win_x > 0
  1234.         self.x = $win_x
  1235.         self.width -= $win_x
  1236.       else
  1237.         self.x = 0
  1238.         self.width += $win_x
  1239.       end
  1240.     end
  1241.     if $win_y != nil
  1242.       self.y = $win_y
  1243.     end
  1244.     #上表示の時、ネームウィンドウが見切れるので少し下にずらす。
  1245.     if self.y == 0 and @position == 0 and @name_window != nil and $name != nil
  1246.       self.y += (-NAME_WINDOW_OFFSET_Y)
  1247.     end
  1248.   end
  1249.   alias_method :update_placement_position_default, :update_placement
  1250.   alias_method :update_placement, :update_placement_position
  1251. end


  1252. #==============================================================================
  1253. # ■ SceneManager
  1254. #------------------------------------------------------------------------------
  1255. #  シーン遷移のさい、テールを破棄。ネームウィンドウのデータをクリア。
  1256. #==============================================================================
  1257. module SceneManager
  1258.   #--------------------------------------------------------------------------
  1259.   # ● 呼び出し
  1260.   #--------------------------------------------------------------------------
  1261.   def self.call_sceman_hukidasi(scene_class)
  1262.     if defined?(self.scene.message_window)
  1263.       self.scene.message_window.del_tail if self.scene.message_window.tail != nil
  1264.       $name = ""
  1265.     end
  1266.     @stack.push(@scene)
  1267.     @scene = scene_class.new
  1268.   end
  1269.   #--------------------------------------------------------------------------
  1270.   # ● クラスメソッドのエイリアス
  1271.   #--------------------------------------------------------------------------
  1272.   class << self
  1273.     alias :call_sceman_hukidasi_default :call
  1274.     alias :call :call_sceman_hukidasi
  1275.   end
  1276. end

  1277. #==============================================================================
  1278. # ■ Scene_Map
  1279. #------------------------------------------------------------------------------
  1280. #  戦闘トランジションのさい、テールを破棄。
  1281. #==============================================================================
  1282. class Scene_Map < Scene_Base
  1283.   attr_accessor :message_window
  1284.   #--------------------------------------------------------------------------
  1285.   # ● 戦闘前トランジション実行
  1286.   #--------------------------------------------------------------------------
  1287.   def perform_battle_transition_hukidasi
  1288.     @message_window.del_tail #テールの破棄
  1289.     perform_battle_transition_hukidasi_default
  1290.   end
  1291.   alias_method :perform_battle_transition_hukidasi_default, :perform_battle_transition
  1292.   alias_method :perform_battle_transition, :perform_battle_transition_hukidasi
  1293. end
复制代码

点评

526行、657行的url请自行手动删除,改成 @index  发表于 2013-8-7 19:57

评分

参与人数 1梦石 +1 收起 理由
迷糊的安安 + 1 认可答案 附赠精美好人卡一张~~.

查看全部评分

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

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

GMT+8, 2025-7-19 12:13

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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