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

Project1

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

[已经解决] 请问Quack的Yami气泡对话框有办法使用另外一套窗口皮肤吗

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1957
在线时间
410 小时
注册时间
2018-9-25
帖子
38
跳转到指定楼层
1
发表于 2020-2-9 16:21:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
因为我自己用的窗口皮肤不是默认的window,和气泡对话不是很搭,想正常用一个窗口皮肤,气泡对话的时候就用RTP的窗口皮肤
我自己在脚本的class window_message里面加了一句self.windowskin = Cache.system("Window1"),但是连带着把正常对话的时候的对话框也改了请问应该要怎么改才好
  1. #==============================================================================
  2. #
  3. # ▼ Yami Engine Ace - 气泡对话框
  4. # -- 最后更新: 2012.06.07
  5. # -- 使用难度: Normal
  6. # -- 需要脚本: 无
  7. #
  8. #==============================================================================

  9. $imported = {} if $imported.nil?
  10. $imported["YSE-PopMessage"] = true

  11. #==============================================================================
  12. # ▼ Updates
  13. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  14. # 2012.06.07 - Fixed Compatible: YEA - Ace Message System.
  15. # 2012.05.11 - Fixed Message Position.
  16. #            - Remove Requirement: YSE - Fix Events Order.
  17. # 2012.05.07 - Fixed Face position.
  18. #            - Added Requirement: YSE - Fix Events Order.
  19. # 2012.04.06 - You can change Bubble Tag filename.
  20. # 2012.03.28 - Fixed Default Message Position and Sizes.
  21. # 2012.03.27 - Fixed Default Message.
  22. # 2012.03.27 - Added Bubble Tag.
  23. # 2012.03.25 - Fixed Escape Message.
  24. # 2012.03.24 - Fixed Battle Message.
  25. # 2012.03.24 - Rewrote script.
  26. #
  27. #==============================================================================
  28. # ▼ 介绍
  29. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  30. # 本脚本可以将对话框改变为气泡对话框,使用"BubbleTag"作为气泡标志图片,放在:
  31. # \Graphics\System 文件夹中.
  32. # 需要配合脚本:Yami Engine Ace - Bug修复: 事件ID顺序 一起使用.
  33. #==============================================================================
  34. # ▼ 安装方式
  35. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  36. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  37. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  38. #
  39. # -----------------------------------------------------------------------------
  40. # 文本代码 - 可以在文字窗口中使用的代码.
  41. # -----------------------------------------------------------------------------
  42. #     代码:    效果:
  43. #    \bm[x]    - 在x号事件处显示气泡对话框. *注释
  44. #    \cbm      - 关闭气泡对话框效果.
  45. #
  46. #              *注释: 设定为 0 则会在角色处显示.
  47. #
  48. #==============================================================================
  49. # ▼ 兼容性
  50. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  51. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  52. #
  53. #==============================================================================

  54. module YSE
  55.   module POP_MESSAGE
  56.    
  57.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  58.     # - 视觉效果设置 -
  59.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  60.     LIMIT = { # 开始.
  61.       :limit_width    =>  0,  # 宽度限制,设定为0则无限制.
  62.       :limit_line     =>  6,  # 行数限制,设定为0则无限制.
  63.     } # 结束.
  64.    
  65.     POSITION = { # 开始.
  66.       :x_buffer       =>  0,   #调整气泡对话框的x坐标
  67.       :y_buffer       =>  -36, #调整气泡对话框的y坐标
  68.       :face_x_buffer  =>  8,   #调整角色肖像图的x坐标
  69.       :face_y_buffer  =>  24,  #调整角色肖像图的y坐标
  70.       :tag_y_buffer   =>  -6,  #调整角色肖像图的y坐标
  71.       :name_x_buffer  =>  112, #调整名称窗口的x坐标,需要脚本 YEA - 文本系统.
  72.     } # 结束.
  73.    
  74.     EFFECT = { # 开始.
  75.       :fade_face       =>  true, #是否显示角色肖像图淡入效果
  76.       :move_face       =>  true, #是否显示角色肖像图移动效果
  77.       :use_bubble_tag  =>  true, #是否显示气泡标志图片
  78.       :bubble_tag_name => "BubbleTag",#气泡标志图片的文件名
  79.     } # 结束.
  80.    
  81.   end
  82. end

  83. #==============================================================================
  84. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  85. # 所以编辑了后果自负。
  86. #==============================================================================

  87. #==============================================================================
  88. # ■ Spriteset_Map
  89. #==============================================================================

  90. class Spriteset_Map
  91.   
  92.   #--------------------------------------------------------------------------
  93.   # public instance variables
  94.   #--------------------------------------------------------------------------
  95.   attr_accessor :character_sprites
  96.   
  97. end # Spriteset_Map

  98. #==============================================================================
  99. # ■ Window_Message_Face
  100. #==============================================================================

  101. class Window_Message_Face < Window_Base
  102.   
  103.   #--------------------------------------------------------------------------
  104.   # initialize
  105.   #--------------------------------------------------------------------------
  106.   def initialize
  107.     super(0, 0, 120, 120)
  108.     self.opacity = 0
  109.     @face_name = ""
  110.     @face_index = 0
  111.     @move_x = 0
  112.     close
  113.   end
  114.   
  115.   #--------------------------------------------------------------------------
  116.   # message_window=
  117.   #--------------------------------------------------------------------------
  118.   def message_window=(window)
  119.     @message_window = window
  120.   end
  121.   
  122.   #--------------------------------------------------------------------------
  123.   # set_face
  124.   #--------------------------------------------------------------------------
  125.   def set_face
  126.     contents.clear
  127.     return unless @message_window
  128.     if !$game_message.face_name.empty?
  129.       draw_face($game_message.face_name, $game_message.face_index, 0, 0)
  130.       set_position
  131.       show_face
  132.     else
  133.       hide_face
  134.     end
  135.   end
  136.   
  137.   #--------------------------------------------------------------------------
  138.   # set_position
  139.   #--------------------------------------------------------------------------
  140.   def set_position
  141.     return unless @message_window
  142.     self.x = @message_window.x
  143.     self.y = @message_window.y - 96
  144.     self.x += YSE::POP_MESSAGE::POSITION[:face_x_buffer]
  145.     self.y += YSE::POP_MESSAGE::POSITION[:face_y_buffer]
  146.     self.y += (@message_window.real_lines - 1) * 24
  147.     self.z = @message_window.z + 1
  148.     if (@face_name != $game_message.face_name || @face_index != $game_message.face_index)
  149.       if YSE::POP_MESSAGE::EFFECT[:move_face]
  150.         @move_x = 30
  151.         self.x -= 30
  152.       end
  153.       @face_name = $game_message.face_name
  154.       @face_index = $game_message.face_index
  155.       self.contents_opacity = 0 if YSE::POP_MESSAGE::EFFECT[:fade_face]
  156.     end
  157.   end
  158.   
  159.   #--------------------------------------------------------------------------
  160.   # show_face
  161.   #--------------------------------------------------------------------------
  162.   def show_face
  163.     open
  164.   end
  165.   
  166.   #--------------------------------------------------------------------------
  167.   # hide_face
  168.   #--------------------------------------------------------------------------
  169.   def hide_face
  170.     contents.clear
  171.     close
  172.   end
  173.   
  174.   #--------------------------------------------------------------------------
  175.   # update
  176.   #--------------------------------------------------------------------------
  177.   def update
  178.     super
  179.     self.contents_opacity += 15 if self.contents_opacity < 255
  180.     unless @move_x <= 0
  181.       self.x += 2
  182.       @move_x -= 2
  183.     end
  184.   end
  185.   
  186. end # Sprite_Message_Face

  187. #==============================================================================
  188. # ■ Window_Message
  189. #==============================================================================

  190. class Window_Message < Window_Base
  191.   
  192.   #--------------------------------------------------------------------------
  193.   # new method: face_window=
  194.   #--------------------------------------------------------------------------
  195.   def face_window=(window)
  196.     @face_window = window
  197.   end
  198.   
  199.   #--------------------------------------------------------------------------
  200.   # new method: bubble_tag=
  201.   #--------------------------------------------------------------------------
  202.   def bubble_tag=(sprite)
  203.     @bubble_tag = sprite
  204.   end
  205.   
  206.   #--------------------------------------------------------------------------
  207.   # new method: message_escape_characters_pop_message
  208.   #--------------------------------------------------------------------------
  209.   def message_escape_characters_pop_message(result)
  210.     result.gsub!(/\eBM\[(\d+)\]/i) { event_pop_message_setup($1.to_i, false) }
  211.     result.gsub!(/\eBMF\[(\d+)\]/i) { event_pop_message_setup($1.to_i, true) }
  212.     result.gsub!(/\eCBM/i) { event_pop_message_setup(nil, false) }
  213.     result
  214.   end
  215.   
  216.   #--------------------------------------------------------------------------
  217.   # alias method: convert_escape_characters
  218.   #--------------------------------------------------------------------------
  219.   alias yse_convert_escape_characters_pm convert_escape_characters
  220.   def convert_escape_characters(text)
  221.     result = yse_convert_escape_characters_pm(text)
  222.     result = message_escape_characters_pop_message(result)
  223.     result
  224.   end
  225.   
  226.   #--------------------------------------------------------------------------
  227.   # new method: event_pop_message_setup
  228.   #--------------------------------------------------------------------------
  229.   def event_pop_message_setup(event_id, follower = false)
  230.     if follower && $game_player.followers[event_id].nil?
  231.       @event_pop_id = nil
  232.       @event_pop_follower = false
  233.       return ""
  234.     end
  235.     @event_pop_follower = follower
  236.     @event_pop_id = event_id
  237.     return ""
  238.   end
  239.   
  240.   #--------------------------------------------------------------------------
  241.   # new method: set_face_position
  242.   #--------------------------------------------------------------------------
  243.   def set_face_position
  244.     return unless SceneManager.scene_is?(Scene_Map)
  245.     return unless @event_pop_id
  246.     return unless @face_window
  247.     contents.clear
  248.     @face_window.set_face
  249.     return unless $imported["YEA-MessageSystem"]
  250.     return if @face_window.close?
  251.     #@name_window.x = self.x + YSE::POP_MESSAGE::POSITION[:face_x_buffer] + YSE::POP_MESSAGE::POSITION[:name_x_buffer] if (@name_position == 1 || @name_position == 2)
  252.   end
  253.   
  254.   #--------------------------------------------------------------------------
  255.   # alias method: new_page
  256.   #--------------------------------------------------------------------------
  257.   alias window_message_new_page_pm_yse new_page
  258.   def new_page(text, pos)
  259.     window_message_new_page_pm_yse(text, pos)
  260.     set_face_position
  261.   end
  262.   
  263.   #--------------------------------------------------------------------------
  264.   # alias method: close
  265.   #--------------------------------------------------------------------------
  266.   alias pop_message_close close
  267.   def close
  268.     pop_message_close
  269.     return unless SceneManager.scene_is?(Scene_Map)
  270.     return unless @event_pop_id
  271.     @event_pop_id = nil
  272.     @event_pop_follower = false
  273.     @face_window.hide_face
  274.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  275.     @bubble_tag.visible = false if @bubble_tag
  276.   end
  277.   
  278.   #--------------------------------------------------------------------------
  279.   # alias method: open_and_wait
  280.   #--------------------------------------------------------------------------
  281.   alias pop_message_open_and_wait open_and_wait
  282.   def open_and_wait
  283.     pop_message_open_and_wait
  284.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  285.     @bubble_tag.visible = true if @event_pop_id && @bubble_tag
  286.   end
  287.   
  288.   #--------------------------------------------------------------------------
  289.   # alias method: process_all_text
  290.   #--------------------------------------------------------------------------
  291.   alias pop_message_process_all_text process_all_text
  292.   def process_all_text
  293.     @event_pop_id = nil
  294.     convert_escape_characters($game_message.all_text)
  295.     update_placement
  296.     adjust_pop_message($game_message.all_text)
  297.     pop_message_process_all_text
  298.   end

  299.   #--------------------------------------------------------------------------
  300.   # alias method: update_placement
  301.   #--------------------------------------------------------------------------
  302.   alias event_pop_message_update_placement update_placement
  303.   def update_placement
  304.     if SceneManager.scene_is?(Scene_Map)
  305.       if @event_pop_id.nil?
  306.         fix_default_message
  307.         event_pop_message_update_placement
  308.       elsif @event_pop_id == 0
  309.         character = $game_player
  310.         self.y = character.screen_y - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
  311.         self.x = character.screen_x - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
  312.         fix_position_bubble(character)
  313.         set_bubble_tag(character)
  314.       elsif @event_pop_id > 0
  315.         hash = @event_pop_follower ? $game_player.followers : $game_map.events
  316.         character = hash[@event_pop_id]
  317.         self.y = character.screen_y - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
  318.         self.x = character.screen_x - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
  319.         fix_position_bubble(character)
  320.         set_bubble_tag(character)
  321.       end
  322.     else
  323.       event_pop_message_update_placement
  324.     end
  325.   end
  326.   
  327.   #--------------------------------------------------------------------------
  328.   # new method: fix_default_message
  329.   #--------------------------------------------------------------------------
  330.   def fix_default_message
  331.     self.width = window_width
  332.     self.height = window_height
  333.     self.x = 0
  334.     @face_window.hide_face if @face_window
  335.     create_contents
  336.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  337.     @bubble_tag.visible = false if @bubble_tag
  338.   end
  339.   
  340.   #--------------------------------------------------------------------------
  341.   # new method: fix_position_bubble
  342.   #--------------------------------------------------------------------------
  343.   def fix_position_bubble(character)
  344.     end_x = self.x + self.width
  345.     end_y = self.y + self.height
  346.     self.x = 0 if self.x < 0
  347.     self.y = character.screen_y if self.y < 0
  348.     self.x = Graphics.width - self.width if end_x > Graphics.width
  349.     self.y = Graphics.height - self.height if end_y > Graphics.height
  350.   end
  351.   
  352.   #--------------------------------------------------------------------------
  353.   # new method: set_bubble_tag
  354.   #--------------------------------------------------------------------------
  355.   def set_bubble_tag(character)
  356.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  357.     return unless @bubble_tag
  358.     up = self.y == character.screen_y
  359.     self.y += up ? @bubble_tag.height / 2 : -@bubble_tag.height / 2
  360.     @bubble_tag.x = character.screen_x - @bubble_tag.width / 2
  361.     if up
  362.       @bubble_tag.src_rect.set(0, @bubble_tag.height, @bubble_tag.width, @bubble_tag.height)
  363.       @bubble_tag.y = self.y - @bubble_tag.height - YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
  364.     else
  365.       @bubble_tag.src_rect.set(0, 0, @bubble_tag.width, @bubble_tag.height)
  366.       @bubble_tag.y = self.y + self.height + YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
  367.     end
  368.   end
  369.   
  370.   #--------------------------------------------------------------------------
  371.   # new method: cal_number_line
  372.   #--------------------------------------------------------------------------
  373.   def cal_number_line(text)
  374.     result = 0
  375.     text.each_line { result += 1 }
  376.     return result
  377.   end
  378.   
  379.   #--------------------------------------------------------------------------
  380.   # new method: cal_width_line
  381.   #--------------------------------------------------------------------------
  382.   def cal_width_line(text)
  383.     result = 0
  384.     text.each_line { |line|
  385.       result = text_size(line).width if result < text_size(line).width
  386.     }
  387.     return result
  388.   end

  389.   #--------------------------------------------------------------------------
  390.   # alias method: adjust_message_window_size
  391.   #--------------------------------------------------------------------------
  392.   if $imported["YEA-MessageSystem"]
  393.   alias yse_pop_message_adjust_message_window_size adjust_message_window_size
  394.   def adjust_message_window_size
  395.     start_name_window if @event_pop_id
  396.     return if @event_pop_id
  397.     yse_pop_message_adjust_message_window_size
  398.   end
  399.   end
  400.   
  401.   #--------------------------------------------------------------------------
  402.   # new method: adjust_pop_message
  403.   #--------------------------------------------------------------------------
  404.   def adjust_pop_message(text = " ")
  405.     return unless SceneManager.scene_is?(Scene_Map)
  406.     unless @event_pop_id
  407.       if $imported["YEA-MessageSystem"]
  408.         #adjust_message_window_size
  409.       end
  410.       return
  411.     end
  412.     n_line = cal_number_line(text)
  413.     n_line = YSE::POP_MESSAGE::LIMIT[:limit_line] if YSE::POP_MESSAGE::LIMIT[:limit_line] > 0 && cal_number_line(text) > YSE::POP_MESSAGE::LIMIT[:limit_line]
  414.     @real_lines = n_line
  415.     self.height = fitting_height(n_line)
  416.     self.width = cal_width_line(text) + 24
  417.     self.width += new_line_x
  418.     if self.width > YSE::POP_MESSAGE::LIMIT[:limit_width] && YSE::POP_MESSAGE::LIMIT[:limit_width] > 0
  419.       self.width = YSE::POP_MESSAGE::LIMIT[:limit_width]
  420.     end
  421.     create_contents
  422.     update_placement
  423.   end
  424.   
  425.   #--------------------------------------------------------------------------
  426.   # overwrite method: new_line_x
  427.   #--------------------------------------------------------------------------
  428.   def new_line_x
  429.     if $game_message.face_name.empty?
  430.       return 0
  431.     else
  432.       result = YSE::POP_MESSAGE::POSITION[:face_x_buffer]
  433.       p_x = $imported["YEA-MessageSystem"] ? YEA::MESSAGE::FACE_INDENT_X : 112
  434.       result += p_x
  435.       return result
  436.     end
  437.   end
  438.   
  439.   #--------------------------------------------------------------------------
  440.   # new method: real_lines
  441.   #--------------------------------------------------------------------------
  442.   def real_lines
  443.     @real_lines
  444.   end
  445.   
  446. end # Window_Message

  447. #==============================================================================
  448. # ■ Scene_Map
  449. #==============================================================================

  450. class Scene_Map < Scene_Base
  451.   
  452.   #--------------------------------------------------------------------------
  453.   # alias method: create_message_window
  454.   #--------------------------------------------------------------------------
  455.   alias yse_pm_create_message_window create_message_window
  456.   def create_message_window
  457.     yse_pm_create_message_window
  458.     @face_window = Window_Message_Face.new
  459.     @face_window.message_window = @message_window
  460.     if YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  461.       @bubble_tag_sprite = Sprite.new
  462.       @bubble_tag_sprite.visible = false
  463.       @bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT[:bubble_tag_name])
  464.       @bubble_tag_sprite.src_rect.set(0, 0, @bubble_tag_sprite.width, @bubble_tag_sprite.height / 2)
  465.       @message_window.bubble_tag = @bubble_tag_sprite
  466.     end
  467.     @message_window.face_window = @face_window
  468.   end
  469.   
  470.   #--------------------------------------------------------------------------
  471.   # alias method: dispose_spriteset
  472.   #--------------------------------------------------------------------------
  473.   alias pop_message_dispose_spriteset dispose_spriteset
  474.   def dispose_spriteset
  475.     pop_message_dispose_spriteset
  476.     return unless @bubble_tag_sprite
  477.     @bubble_tag_sprite.dispose
  478.   end
  479.   
  480. end # Scene_Map

  481. #==============================================================================
  482. #
  483. # ▼ End of File
  484. #
  485. #==============================================================================
复制代码
  1. =begin
  2. #==============================================================================
  3. * 闲谈对话框 (Yami 气泡对话框 的插件) - v1.3c
  4.   作者: Quack
  5.   翻译:nil2018(○┰○)
  6. #==============================================================================
  7. 效果:
  8. 1-允许你使用"闲谈对话框。和默认对话框区别为,闲谈对话框不会暂停游戏,也不会因为
  9.   玩家按下任何按键而关闭,取而代之的是为对话框设定一个计时器,时间到了会自动将
  10.   其关闭。还有一个特点是:可以同时显示多个闲谈对话框(有最大显示数量限制,默认
  11.   为7,你可以在下面的"MAX_MSGS"中调整最大数)
  12.   
  13.   将普通对话框“变成”闲谈对话框的方法为:在对话框中填入标志:'<cm:X>'
  14.   其中X为显示的时间,单位为秒(注意:这个标志必须放在对话框的第一行!!)
  15.   将X设定为负值时,对话框就不会消失了。你可以使用脚本来关闭所有闲谈对话框:
  16.   clear_chatter
  17.   
  18. 2-说话的气泡标志(bubble message)和原来一样,都是: \bm[x]
  19.   新添加了思考(bubble message thought)的气泡标志:  \bmt[x]
  20.   
  21. 3-气泡对话框可以在战斗中使用了。可以使用 \bm[x] 或 \bmt[x] 来显示气泡对话框。
  22.   如果你要在敌人头上显示气泡对话框,请将x替换为负值.
  23.   在战斗中:    \bm[1] 显示在1号敌人头上
  24.                 \bm[-1] 显示在1号角色头上
  25.   对于1号敌人,使用 \bm[1] ,4号敌人则使用 \bm[4]
  26.   同时,对于角色: 1号角色 = \bm[-1]
  27.   
  28.   然而,要想在战斗中在角色头上显示气泡对话框,需要你使用“显示角色战斗图”的
  29.   脚本。我不能保证我的脚本适用于所有该功能的脚本。但我可以保证和Jet's sideview
  30.   battlers 相兼容。
  31.   
  32.   有一个问题是,当战斗图的大小过大或过小时,对话框窗口会有些移位。
  33.   使用以下标志来调整对话框的位置:
  34.   \ox[X] - 调整气泡对话框的x坐标
  35.   \oy[X] - 调整气泡对话框的y坐标
  36.   
  37.   有一点需要注意的是,如果你还使用了Yanfly的核心脚本&Yanfly的文本系统,你需要将
  38.   核心脚本中的 FONT_NAME 和文本系统的i MESSAGE_WINDOW_FONT_NAME 设定相匹配(两
  39.   个地方都要设定相同的字体)否则两个脚本的设定结合起来,有时会使文本的宽度计算
  40.   错误。这个问题不大,可是在气泡对话框中,会改变气泡对话框的窗口宽度,这就是个
  41.   大问题了(yanfly两个脚本中,关于字体的其他设定例如是否加粗是否斜体等,也最好
  42.   设定得一模一样)
  43.   
  44. 版本 1.1 更新功能:

  45. 1-添加文本打字音效,你可以在 TEXT_SOUNDS 的哈希表中设定(在下面查看更多地介绍)
  46.   使用标志:
  47.   <ts:x>   文章打字音x,x为存在于 TEXT_SOUNDS 哈希表中的打字音效名字.
  48.   
  49. 2-添加对话框背景色调的功能。你可以在 WINDOW_TONES 哈希表中预设色调种类
  50.   使用标志: <bc:x> ,其中x为存在于 WINDOW_TONES 哈希表中的色调名字.

  51. 3-有时,你需要在同一个对话框中显示不同的字体,可能会使对话框变得过大或过小。Sometimes you might want to change font size in your message, multiple times,
  52.   使用标志: <pms:x,y> 可以调整气泡对话框的大小.x为宽度变化,y为高度变化
  53.   例如,你使用了标志<pms:20,-10> ,则对话框的宽度会增加20,高度会减少10.
  54.   
  55. 4-如果你和我一样,被记忆事件id、书写一大堆标志而困扰,以下功能会帮到你。
  56.   
  57.   仅使用一个标志<bt:x> (对于谈话气泡) 或 <btt:x> (对于思考气泡)
  58.   就可以让该事件使用你设定的背景颜色和文本打字音效。
  59.   
  60.   那原理是什么?
  61.   举个例子,我有一个作为队伍角色的事件,她叫Emil.在事件名中填入了标志: <emil>.
  62.   然后,当我使用了标志: <bt:emil> 或 <btt:emil> 气泡对话框会自动显示到该事件的
  63.   头上(如果有多个事件名为<emil>的事件,也会只显示一个对话框),且使用
  64.   WINDOW_TONES 中的'emil'作为窗口色调,使用TEXT_SOUNDS中的'emil'作为文本打字音效
  65.   但不能用于btt,因为思考中还会有打字音效不是太奇怪了吗?
  66.   
  67.   
  68.   这也会在你检查事件时,更清楚地明白哪个事件是'emil',而不是去找哪个事件是某某id
  69.   
  70.   如果你想指定用于角色(player) 的话,使用标志'pl',例如:
  71.   <bt:pl>
  72.   这样就可以使设定窗口色调和打字音效的"打包"设定同时应用于角色了。
  73.   或许在队员变化大的情况下不怎么实用,但是我仍然添加了此功能。
  74.   
  75.   如果你很好奇为什么我新添加的标志和以前的不一样...因为!Consistence is overrated
  76.   anyway, who needs it?  (0.0)
  77.   
  78.   使用标志(<bt:x> & <btt:x>) 需要你安装脚本 Qonvenience (你也许会叫它做
  79.   我的'核心' 脚本,类似其他人的 (Yanfly,
  80.   Victor, Yami, etc).
  81.   你可以在下面的'使用条件'部分找到下载地址.
  82.   
  83. 版本 1.2 更新功能:

  84. - 显示选项时,会根据你使用的是气泡对话框还是普通的对话框而显示不同的样子。
  85.   使用默认对话框时,选项的外貌不变。使用气泡对话框时选项会变得更大,且显示在对
  86.   话框窗口中.
  87.   
  88. 版本 1.3更新功能:

  89. - 修复了一些肖像图和名称窗口的问题。问题并没有完全解决,因为我自己的工程里并
  90. 没有使用名称窗口或肖像图,所以本人并不是很感兴趣去花时间到这些地方。
  91.   
  92. -和窗口色调、打字音效一样,你现在可以使用标志来显示名称窗口了。
  93.   
  94. ==============================================================================
  95. 安装注释:
  96. 需要脚本 Yami气泡对话框.
  97. 将本脚本放在其之下.

  98. ==============================================================================
  99. 使用条件:
  100. 需要Yami气泡对话框脚本,你可以在这里下载:
  101. ​https://github.com/suppayami/rmvxa-collection/blob/master/yami-script-ace/10%20-%20Pop%20Message.txt
  102. 同时还需要我的 Qonvenience脚本 ,如果你想使用:<bt:x> 和 <btt:x>的话
  103. 在这里下载:
  104. http://pastebin.com/J6haUy5T

  105. ==============================================================================
  106. Credits:
  107. Yami 为 气泡对话框的作者.

  108. ==============================================================================
  109. 使用条款:
  110. 随意使用(没错,包括商业游戏),只要你不声明这个脚本是你自己写的。
  111. 同时我也希望你能在使用此脚本时,属名我为脚本的作者。
  112. 请记住本脚本必须和Yami的气泡对话框同时使用,其也有自己的使用条款.

  113. ==============================================================================
  114. Bugs:
  115. 不懂

  116. ==============================================================================
  117. History:
  118. 11/10/2016 - Fixed some problems added some minor feature.
  119. 19/01/2016 - Fixed some bugs, changes to choices when a pop message is used.
  120. 14/01/2016 - Chatter messages now last forever if you set the duration to a
  121.              negative number. Also added method for clearing all chatter
  122.              to use in script calls. Also squashed some bugs.
  123. 13/01/2016 - Pretty big update. Added more functionality.
  124. 10/01/2016 - Proper release since Absurdiness found the original script so I
  125.              could separate the addon from the original.
  126. 08/01/2016 - Initial release

  127. =end

  128. $imported = {} if $imported.nil?
  129. $imported["Chatter_Messages"] = true

  130. #==============================================================================
  131. # * 设定
  132. #==============================================================================

  133. module YSE
  134.   module POP_MESSAGE
  135.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  136.     # - 视觉设定 -
  137.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  138.    
  139.     EFFECT2 = { # 开始.
  140.       :bubble_tag_name => "BubbleTag_Speech",
  141.       :thought_bubble_tag_name => "BubbleTag_Thought",
  142.     } # 结束.
  143.   end
  144. end

  145. module QUACK
  146.   module MSG
  147.    
  148.     # 闲谈窗口同时显示的最大数量。
  149.     # 太少会限制了你的选择,太多会使画面杂乱。
  150.     MAX_MSGS = 7
  151.    
  152.     # 在这里设定窗口颜色。
  153.     # 格式:
  154.     # '名称' => Tone.new(红,绿,蓝,灰度)
  155.     # 名称为字符,红绿蓝为数字,范围是 -255~255
  156.     # 灰度的范围是 0 到 255. 灰度为可选值,不一定非要写。
  157.     WINDOW_TONES = {
  158.       #在下面手动添加设定
  159.       '偏红' => Tone.new(85,44,51),
  160.       '杰克' => Tone.new(-34,85,102),
  161.       '狂人' => Tone.new(68,68,68,10),
  162.       '普尔' => Tone.new(102,34,-34),
  163.       '爱丽丝' => Tone.new(102,34,51),
  164.       # 自己设定更多的
  165.     }
  166.    
  167.     # 在这里设定文本打字音效
  168.     # 格式:
  169.     # '名称' => ["文件名",音量, 最低音调, 最高音调],
  170.     # 名称为字符,文件名为音效文件名
  171.     # 音量音调为数字,范围是 0-100.
  172.     TEXT_SOUNDS = {
  173.       #在下面手动添加设定
  174.       '0' => nil, # 无任何打字音效的默认值!
  175.       '1' => ["Cursor1", 80, 70, 100],
  176.       '2' => ["Cursor1", 80, 90, 120],
  177.       '3' => ["Knock", 80, 50, 75],
  178.       '杰克' => ["Cursor1", 80, 90, 120],
  179.       '狂人' => ["Cursor1", 80, 45, 70],
  180.       '普尔' => ["Cursor1", 80, 70, 100],
  181.       '爱丽丝' => ["Cursor1", 70, 110, 140],
  182.       # And above this line
  183.     }
  184.    
  185.     NAMES = {
  186.       # 设定名称
  187.       '1' => "冒险家杰克",
  188.       '2' => "疯狂实验员"
  189.     }
  190.    
  191.     # 每X个字符播放一次打字音效.
  192.     SOUND_PLAY_FREQUENCY = 3
  193.    
  194.     # 气泡对话框是否在使用选项时随着文本显示而逐渐增大,还是立刻显示为最大尺寸
  195.     POP_CHOICE_GROW = true
  196.    
  197.   end
  198. end

  199. #==============================================================================
  200. # * SCRIPT START
  201. #==============================================================================

  202. #==============================================================================
  203. # ?! DataManager
  204. #==============================================================================
  205. module DataManager
  206.   class << self
  207.     alias quack_msg_create_game_objects create_game_objects
  208.     def create_game_objects
  209.       quack_msg_create_game_objects
  210.       if !$imported["YSE-PopMessage"]
  211.         msgbox(sprintf("This script(Chatter Messages) requires Yami's Pop Messages to function", "ChatterMessages", 1))
  212.         exit
  213.       end
  214.       $game_message.quack_msg_make
  215.     end
  216.   end
  217. end

  218. #==============================================================================
  219. # ?! Game_Message
  220. #==============================================================================
  221. class Game_Message
  222.   attr_accessor :quack_msgs
  223.   attr_accessor :ev_id
  224.   
  225.   # new
  226.   def quack_msg_make
  227.     @quack_msgs = []
  228.     QUACK::MSG::MAX_MSGS.times {@quack_msgs.push(Game_Message.new)}
  229.     @quack_msg_ttl = 0
  230.     @c_msg = 0
  231.   end
  232.   # new
  233.   def set_ttl(ttl)
  234.     @quack_msg_ttl = ttl
  235.   end
  236.   # new
  237.   def ttl_sub
  238.     @quack_msg_ttl -= 1 if @quack_msg_ttl > 0
  239.   end
  240.   # new
  241.   def expire?
  242.     return false if @quack_msg_ttl < 0
  243.     @quack_msg_ttl == 0
  244.   end
  245.   # new
  246.   def prepare_msg(duration)
  247.     @quack_msg_ttl = (duration * 60).to_i
  248.   end
  249.   # new
  250.   def fin_msg
  251.     @quack_msg_ttl = 0
  252.     @c_msg = (@c_msg + 1) % QUACK::MSG::MAX_MSGS
  253.   end
  254.   # new
  255.   def add_chatter(text)
  256.     m = @quack_msgs[@c_msg]
  257.     m.add(text)
  258.     m.face_name = face_name
  259.     m.face_index = face_index
  260.     m.set_ttl(@quack_msg_ttl)
  261.   end
  262.   # new
  263.   def clear_chatter
  264.     @quack_msgs.each {|m| m.set_ttl(0) }
  265.   end
  266.   
  267.   # new
  268.   def clear_chatter_event(e)
  269.     # Find any chatter attached to certain event id and close the chatter
  270.     @quack_msgs.each {|m| m.set_ttl(0) if m.ev_id == e }
  271.   end
  272. end

  273. #==============================================================================
  274. # ?! Window_Message
  275. #==============================================================================

  276. class Window_Message < Window_Base
  277.   
  278.   # new
  279.   def chatter?
  280.     false
  281.   end
  282.   # new
  283.   def source
  284.     $game_message
  285.   end
  286.   # overwrite
  287.   def standard_padding
  288.     return 8
  289.   end
  290.   # alias
  291.   alias quack_chatter_init initialize
  292.   def initialize
  293.     @msg_tone = $game_system.window_tone
  294.     @snd_f = 0
  295.     #@name_text = ""
  296.     quack_chatter_init
  297.   end
  298.   # new
  299.   def speech_bubble_tag=(sprite)
  300.     @speech_bubble_tag = sprite
  301.   end
  302.   # new
  303.   def thought_bubble_tag=(sprite)
  304.     @thought_bubble_tag = sprite
  305.   end
  306.   # new
  307.   def set_offset_x(x)
  308.     @ox = x
  309.     return ""
  310.   end
  311.   # new
  312.   def set_offset_y(y)
  313.     @oy = y
  314.     return ""
  315.   end
  316.   # overwrite
  317.   def cal_width_line(text)
  318.     result = 0
  319.     text.each_line { |line|
  320.       result = text_size(line).width if result < text_size(line).width
  321.     }
  322.     return result
  323.   end
  324.   # alias
  325.   alias quack_chatter_process_character process_character
  326.   def process_character(c, text, pos)
  327.     if @snd_f == 0 && !@show_fast && !@text_sound.nil?
  328.       Audio.se_play("Audio/SE/"+@text_sound[0],@text_sound[1],@text_sound[2]+rand(@text_sound[3]-@text_sound[2]))
  329.     end
  330.     @snd_f += 1
  331.     @snd_f = 0 if @snd_f == QUACK::MSG::SOUND_PLAY_FREQUENCY
  332.     quack_chatter_process_character(c,text,pos)
  333.   end
  334.   # overwrite
  335.   def update_tone
  336.     self.tone.set(@msg_tone)
  337.   end
  338.   # overwrite
  339.   def message_escape_characters_pop_message(result)
  340.     @msg_tone = $game_system.window_tone
  341.     @event_pop_id = nil
  342.     set_offset_x(0)
  343.     set_offset_y(0)
  344.     @text_sound = QUACK::MSG::TEXT_SOUNDS['0']
  345.     @msg_size_x = 0
  346.     @msg_size_y = 0
  347.     reset_font_settings
  348.    
  349.     result.gsub!(/<BT:([^<>]*)>/i) { event_pop_message_setup2($1, false) }
  350.     result.gsub!(/<BTT:([^<>]*)>/i) { event_pop_message_setup2($1, true) }
  351.     result.gsub!(/\eOX\[([-+]?\d+)\]/i) { set_offset_x($1.to_i) }
  352.     result.gsub!(/\eOY\[([-+]?\d+)\]/i) { set_offset_y($1.to_i) }
  353.     result.gsub!(/\eBM\[([-+]?\d+)\]/i) { event_pop_message_setup($1.to_i, false) }
  354.     result.gsub!(/\eBMT\[([-+]?\d+)\]/i) { event_pop_message_setup($1.to_i, true) }
  355.     result.gsub!(/\eBMF\[(\d+)\]/i) { event_pop_message_setup($1.to_i, false, true) }
  356.     result.gsub!(/\eCBM/i) { event_pop_message_setup(nil, false) }
  357.     result.gsub!(/<BC:([^<>]*)>/i) { @msg_tone = QUACK::MSG::WINDOW_TONES[$1] ;""}
  358.     result.gsub!(/<TS:([^<>]*)>/i) { @text_sound = QUACK::MSG::TEXT_SOUNDS[$1]; ""}
  359.     result.gsub!(/<PMS:([-+]?\d+),([-+]?\d+)>/i) { @msg_size_x = $1.to_i ;@msg_size_y = $2.to_i; ""}
  360.     result
  361.   end
  362.   # new
  363.   def event_pop_message_setup2(tag, thought = false)
  364.     if SceneManager.scene_is?(Scene_Battle)
  365.       if tag.include?('act')
  366.         ev_id = tag[3].to_i
  367.         ev_id = (1+$game_party.members.index($game_actors[ev_id])) * -1
  368.         @msg_tone = QUACK::MSG::WINDOW_TONES[tag] if QUACK::MSG::WINDOW_TONES.has_key?(tag)
  369.         @text_sound = QUACK::MSG::TEXT_SOUNDS[tag] if !thought && QUACK::MSG::TEXT_SOUNDS.has_key?(tag)
  370.       else
  371.         msgbox(sprintf("无任何事件使用标志: '" + tag + "'.","Chatter Messages",1))
  372.       end
  373.       return event_pop_message_setup(ev_id, thought)
  374.     end
  375.     msgbox(sprintf("使用此标志需要你安装Qonvenience.","Chatter Messages",1)) if !$imported["Qonvenience"]
  376.     if tag == 'pl'
  377.       ev_id = 0
  378.     else
  379.       ev_id = $game_map.first_event_tag(tag).id
  380.       msgbox(sprintf("无任何事件使用标志: '" + tag + "'.","Chatter Messages",1)) if ev_id.nil?
  381.     end
  382.     @msg_tone = QUACK::MSG::WINDOW_TONES[tag] if QUACK::MSG::WINDOW_TONES.has_key?(tag)
  383.     @text_sound = QUACK::MSG::TEXT_SOUNDS[tag] if !thought && QUACK::MSG::TEXT_SOUNDS.has_key?(tag)
  384.     namewindow(QUACK::MSG::NAMES[tag], 1) if $imported["YEA-MessageSystem"] && QUACK::MSG::NAMES.has_key?(tag) && @name_text == ""
  385.     return event_pop_message_setup(ev_id, thought)
  386.   end
  387.   # overwrite
  388.   def event_pop_message_setup(event_id, thought = false, follower = false)
  389.     start_name_window if $imported["YEA-MessageSystem"]
  390.     if follower && $game_player.followers[event_id].nil?
  391.       @event_pop_id = nil
  392.       @event_pop_follower = false
  393.       return ""
  394.     end
  395.     if thought # THOUGHT
  396.       @speech_bubble_tag.visible = false
  397.       @bubble_tag = @thought_bubble_tag
  398.     else # SPEECH
  399.       @thought_bubble_tag.visible = false
  400.       @bubble_tag = @speech_bubble_tag
  401.     end
  402.     @event_pop_follower = follower
  403.     @event_pop_id = event_id
  404.     # close any chatter message currently attached to this event
  405.     $game_message.clear_chatter_event(event_id)
  406.     source.ev_id = event_id
  407.     return ""
  408.   end
  409.   # overwrite
  410.   def set_face_position
  411.     #return unless SceneManager.scene_is?(Scene_Map)
  412.     return unless @event_pop_id
  413.     return unless @face_window
  414.     contents.clear
  415.     @face_window.set_face
  416.     return unless $imported["YEA-MessageSystem"]
  417.     return if @face_window.close?
  418.     #@name_window.x = self.x + YSE::POP_MESSAGE::POSITION[:face_x_buffer] + YSE::POP_MESSAGE::POSITION[:name_x_buffer] if (@name_position == 1 || @name_position == 2)
  419.   end
  420.   # overwrite
  421.   def close
  422.     pop_message_close
  423.     #return unless SceneManager.scene_is?(Scene_Map)
  424.     return unless @event_pop_id
  425.     @event_pop_follower = false
  426.     @face_window.hide_face
  427.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  428.     @speech_bubble_tag.visible = false if @speech_bubble_tag
  429.     @thought_bubble_tag.visible = false if @thought_bubble_tag
  430.     source.ev_id = nil
  431.   end
  432.   # overwrite
  433.   def process_all_text
  434.     @event_pop_id = nil
  435.     @name_text = ""
  436.     txt = convert_escape_characters($game_message.all_text)
  437.     update_placement
  438.     adjust_pop_message(txt)#$game_message.all_text)
  439.     pop_message_process_all_text
  440.   end
  441.   # overwrite
  442.   def update_placement
  443.     if SceneManager.scene_is?(Scene_Map)
  444.       if @event_pop_id.nil?
  445.         fix_default_message
  446.         event_pop_message_update_placement
  447.       elsif @event_pop_id == 0
  448.         character = $game_player
  449.         self.y = character.screen_y + @oy - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
  450.         self.x = character.screen_x + @ox - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
  451.         fix_position_bubble(character)
  452.         set_bubble_tag(character)
  453.         @name_window.update_pos if $imported["YEA-MessageSystem"] && @name_window.open?
  454.         @face_window.set_position if !chatter? && @face_window.open?
  455.       elsif @event_pop_id > 0
  456.         hash = @event_pop_follower ? $game_player.followers : $game_map.events
  457.         character = hash[@event_pop_id]
  458.         self.y = character.screen_y + @oy - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
  459.         self.x = character.screen_x + @ox - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
  460.         fix_position_bubble(character)
  461.         set_bubble_tag(character)
  462.         @name_window.update_pos if $imported["YEA-MessageSystem"] && @name_window.open?
  463.         @face_window.set_position if !chatter? && @face_window.open?
  464.       end
  465.     else
  466.       # IF IN BATTLE
  467.       #event_pop_message_update_placement
  468.       if @event_pop_id.nil?
  469.         fix_default_message
  470.         event_pop_message_update_placement
  471.       elsif @event_pop_id < 0
  472.         battler = $game_party.members[(@event_pop_id * -1)-1]
  473.         self.y = battler.screen_y + @oy - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
  474.         self.x = battler.screen_x + @ox - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
  475.         fix_position_bubble(battler)
  476.         set_bubble_tag(battler)
  477.         @name_window.update_pos if $imported["YEA-MessageSystem"] && @name_window.open?
  478.         @face_window.set_position if !chatter? && @face_window.open?
  479.       elsif @event_pop_id > 0
  480.         battler = $game_troop.members[@event_pop_id-1]
  481.         self.y = battler.screen_y + @oy - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
  482.         self.x = battler.screen_x + @ox - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
  483.         fix_position_bubble(battler)
  484.         set_bubble_tag(battler)
  485.         @name_window.update_pos if $imported["YEA-MessageSystem"] && @name_window.open?
  486.         @face_window.set_position if !chatter? && @face_window.open?
  487.       end
  488.     end
  489.   end
  490.   # overwrite
  491.   def fix_default_message
  492.     self.width = window_width
  493.     self.height = window_height
  494.     self.x = 0
  495.     @face_window.hide_face if @face_window
  496.     #create_contents
  497.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  498.     @speech_bubble_tag.visible = false if @speech_bubble_tag
  499.     @thought_bubble_tag.visible = false if @thought_bubble_tag
  500.   end
  501.   # overwrite
  502.   def fix_position_bubble(character)
  503.     end_x = self.x + self.width
  504.     end_y = self.y + self.height
  505.     self.x = 0 if self.x < 0
  506.     self.y = character.screen_y + @oy if self.y < 0
  507.     self.y = -99 if self.y < 0
  508.     self.x = Graphics.width - self.width if end_x > Graphics.width
  509.     self.y = Graphics.height - self.height if end_y > Graphics.height
  510.   end
  511.   # overwrite
  512.   def set_bubble_tag(character)
  513.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  514.     return unless @bubble_tag
  515.     up = self.y == character.screen_y + @oy
  516.     if self.y == -99
  517.       self.y = 0
  518.       up = true
  519.     end
  520.     self.y += up ? @bubble_tag.height / 2 : -@bubble_tag.height / 2
  521.     @bubble_tag.x = character.screen_x + @ox - @bubble_tag.width / 2
  522.     if up
  523.       @bubble_tag.src_rect.set(0, @bubble_tag.height, @bubble_tag.width, @bubble_tag.height)
  524.       @bubble_tag.y = self.y - @bubble_tag.height - YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
  525.     else
  526.       @bubble_tag.src_rect.set(0, 0, @bubble_tag.width, @bubble_tag.height)
  527.       @bubble_tag.y = self.y + self.height + YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
  528.     end
  529.     @bubble_tag.z = self.z + 1000
  530.   end
  531.   # overwrite
  532.   def adjust_pop_message(text = " ")
  533.     #return unless SceneManager.scene_is?(Scene_Map)
  534.     unless @event_pop_id
  535.       if $imported["YEA-MessageSystem"]
  536.         #adjust_message_window_size
  537.       end
  538.       return
  539.     end
  540.     n_line = cal_number_line(text)
  541.     n_line = YSE::POP_MESSAGE::LIMIT[:limit_line] if YSE::POP_MESSAGE::LIMIT[:limit_line] > 0 && cal_number_line(text) > YSE::POP_MESSAGE::LIMIT[:limit_line]
  542.     @real_lines = n_line
  543.     self.height = fitting_height(n_line)
  544.     self.height += @msg_size_y
  545.     self.width = cal_width_line(text) + 10
  546.     self.width += @msg_size_x
  547.     self.width += new_line_x
  548.     if self.width > YSE::POP_MESSAGE::LIMIT[:limit_width] && YSE::POP_MESSAGE::LIMIT[:limit_width] > 0
  549.       self.width = YSE::POP_MESSAGE::LIMIT[:limit_width]
  550.     end
  551.     if $game_message.choice? && !QUACK::MSG::POP_CHOICE_GROW
  552.       dy = fitting_height($game_message.choices.size) - 16
  553.       self.y -= dy - 16
  554.       self.height += dy - 16
  555.       @face_window.y -= dy - 16
  556.       @name_window.y -= dy - 16 if $imported["YEA-MessageSystem"]
  557.     end
  558.     # If a chatter message with face graphic, force height to be at least big enough to show the face.
  559.     if chatter? && !source.face_name.empty?
  560.       self.height = [self.height, 86].max
  561.     end
  562.    
  563.     create_contents
  564.     update_placement
  565.   end
  566.   # alias
  567.   alias yse_pop_dispose dispose
  568.   def dispose
  569.     @speech_bubble_tag.visible = false if @speech_bubble_tag
  570.     @thought_bubble_tag.visible = false if @thought_bubble_tag
  571.     yse_pop_dispose
  572.   end
  573.   # alias
  574.   alias chatter_msg_input_choice input_choice
  575.   def input_choice
  576.     if !close? && pop_message? && QUACK::MSG::POP_CHOICE_GROW
  577.       f = Fiber.new { add_room_for_choices }
  578.       @choice_window.visible = false
  579.       @choice_window.set_fiber(f)
  580.       f.resume
  581.     end
  582.     chatter_msg_input_choice
  583.   end
  584.   # new
  585.   def add_room_for_choices
  586.     q = fitting_height($game_message.choices.size) - 16
  587.     i = 0
  588.     while true
  589.       i += 4
  590.       self.y -= 4
  591.       self.height += 4
  592.       @face_window.y -= 4
  593.       @name_window.y -= 4 if $imported["YEA-MessageSystem"]
  594.       break if i >= q
  595.       Fiber.yield
  596.     end
  597.     @choice_window.visible = true
  598.     @choice_window.set_fiber(nil)
  599.   end
  600.   # new
  601.   def pop_message?
  602.     @event_pop_id
  603.   end
  604. end

  605. #==============================================================================
  606. # ?! Window_ChoiceList
  607. #==============================================================================
  608. class Window_ChoiceList < Window_Command
  609.   # alias
  610.   alias chatter_msg_init initialize
  611.   def initialize(message_window)
  612.     chatter_msg_init(message_window)
  613.     self.opacity = 0
  614.     self.z = 20070
  615.   end
  616.   # new
  617.   def set_fiber(fiber)
  618.     @fiber = fiber
  619.   end
  620.   # alias
  621.   alias chatter_msg_update update
  622.   def update
  623.     chatter_msg_update
  624.     @fiber.resume if @fiber
  625.   end
  626.   # alias
  627.   alias chatter_msg_update_placement update_placement
  628.   def update_placement
  629.     if @message_window.pop_message?
  630.       self.opacity = 0
  631.       self.width = @message_window.width-26 + padding * 2
  632.       self.width = [width, Graphics.width].min
  633.       self.height = fitting_height($game_message.choices.size)
  634.       self.x = @message_window.x
  635.       self.y = @message_window.y+@message_window.height-self.height+6
  636.     else
  637.       self.opacity = 255
  638.       chatter_msg_update_placement
  639.     end
  640.   end
  641. end

  642. class Window_NameMessage < Window_Base
  643.   #def hide_me
  644.   #  self.x = 99999
  645.   #  self.y = 99999
  646.   #end
  647. end

  648. #==============================================================================
  649. # ■ Window_NameMessage
  650. #==============================================================================
  651. class Window_NameMessage < Window_Base
  652.   # alias
  653.   alias quack_msg_name_init initialize
  654.   def initialize(message_window)
  655.     quack_msg_name_init(message_window)
  656.     self.z += 2
  657.   end
  658.   # new
  659.   def update_pos
  660.     set_x_position(1)
  661.     #set_y_position
  662.     self.y = @message_window.y - self.height / 1.25
  663.     self.y = 0 if self.y < 0
  664.   end
  665.   # overwrite
  666.       #  self.y = @message_window.height
  667.       #  self.y -= YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
  668.       #else
  669.       #  self.y = @message_window.y - self.height / 1.25
  670.       #  self.y += YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
  671.       #end
  672. end
  673.   
  674. #==============================================================================
  675. # ¡ Window_Message_Face
  676. #==============================================================================

  677. class Window_Message_Face < Window_Base
  678.   alias quack_msg_face_pos set_position
  679.   def set_position
  680.     quack_msg_face_pos
  681.     self.y -= 4
  682.   end
  683. end

  684. #==============================================================================
  685. # ?! Window_Quack_Message
  686. #==============================================================================
  687. class Window_Quack_Message < Window_Message
  688.   attr_accessor :active
  689.   
  690.   # overwrite
  691.   def initialize(msg_source, zz)
  692.     super()
  693.     self.z = zz
  694.     @quack_msg_source = msg_source
  695.     @active = false
  696.     @background = 0
  697.     self.opacity = 255
  698.     self.visible = false
  699.     clear_name_window if $imported["YEA-MessageSystem"]
  700.   end
  701.   # overwrite
  702.   def chatter?
  703.     true
  704.   end
  705.   # overwrite
  706.   def source
  707.     @quack_msg_source
  708.   end
  709.   # overwrite
  710.   def update
  711.     if @quack_msg_source.busy?
  712.       if @quack_msg_source.expire?
  713.         close
  714.       else
  715.         self.visible = true if !self.visible
  716.         @quack_msg_source.ttl_sub
  717.       end
  718.     end
  719.     self.visible = false if self.visible && close?
  720.     super
  721.   end
  722.   # overwrite
  723.   def update_placement
  724.     return if @closing
  725.     super
  726.   end
  727.   # overwrite
  728.   def update_show_fast
  729.     return false
  730.   end
  731.   # overwrite
  732.   def process_all_text
  733.     @event_pop_id = nil
  734.     text = convert_escape_characters(@quack_msg_source.all_text)
  735.     update_placement
  736.     adjust_pop_message(text)
  737.     open_and_wait
  738.     #text = convert_escape_characters(@quack_msg_source.all_text)
  739.     pos = {}
  740.     new_page(text, pos)
  741.     process_character(text.slice!(0, 1), text, pos) until text.empty? || close?
  742.   end
  743.   # overwrite
  744.   def close
  745.     pop_message_close #super
  746.     return unless @event_pop_id
  747.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  748.     @speech_bubble_tag.visible = false if @speech_bubble_tag
  749.     @thought_bubble_tag.visible = false if @thought_bubble_tag
  750.     source.ev_id = nil
  751.     @name_text = ""
  752.   end
  753.   # overwrite
  754.   def input_pause
  755.     self.pause = true
  756.     wait(10)
  757.     Fiber.yield until close?
  758.     self.pause = false
  759.   end
  760.   # overwrite
  761.   def update_fiber
  762.     if @fiber
  763.       @fiber.resume
  764.     elsif @quack_msg_source.busy?
  765.       @fiber = Fiber.new { fiber_main }
  766.       @fiber.resume
  767.     else
  768.       @quack_msg_source.visible = false
  769.     end
  770.   end
  771.   def fiber_main
  772.     @quack_msg_source.visible = true
  773.     #update_background
  774.     update_placement
  775.     loop do
  776.       process_all_text if @quack_msg_source.has_text?
  777.       process_input
  778.       @quack_msg_source.clear
  779.       @name_window.start_close if $imported["YEA-MessageSystem"]
  780.       Fiber.yield
  781.       break unless text_continue?
  782.     end
  783.     close_and_wait
  784.     @quack_msg_source.visible = false
  785.     @fiber = nil
  786.   end
  787.   #def update_background
  788.   #  @background = @quack_msg_source.background
  789.   #  self.opacity = @background == 0 ? 255 : 0
  790.   #end
  791.   def process_input
  792.     input_pause unless @pause_skip
  793.   end
  794.   def text_continue?
  795.     @quack_msg_source.has_text?# && !settings_changed?
  796.   end
  797.   def settings_changed?
  798.     #@background != $game_message.background ||
  799.     #@position != @quack_msg_source.position
  800.     false
  801.   end
  802.   def new_page(text, pos)
  803.     contents.clear
  804.     draw_face(@quack_msg_source.face_name, @quack_msg_source.face_index, 0, 0)
  805.     reset_font_settings
  806.     pos[:x] = new_line_x
  807.     pos[:y] = 0
  808.     pos[:new_x] = new_line_x
  809.     pos[:height] = calc_line_height(text)
  810.     clear_flags
  811.   end
  812.   def new_line_x
  813.     @quack_msg_source.face_name.empty? ? 0 : 112
  814.   end
  815.   # overwrite
  816.   def input_pause
  817.     #self.pause = true
  818.     wait(10)
  819.     Fiber.yield until @quack_msg_source.expire? #Input.trigger?(:B) || Input.trigger?(:C)
  820.     #Input.update
  821.     #self.pause = false
  822.   end
  823.   
  824.   # overwrite
  825.   def create_all_windows
  826.     @name_window = Window_NameMessage.new(self) if $imported["YEA-MessageSystem"]
  827.   end
  828.   # overwrite
  829.   def dispose_all_windows
  830.     @name_window.dispose if $imported["YEA-MessageSystem"]
  831.   end
  832.   # overwrite
  833.   def update_all_windows
  834.     if $imported["YEA-MessageSystem"]
  835.       @name_window.update
  836.       @name_window.back_opacity = self.back_opacity
  837.       @name_window.opacity = self.opacity
  838.     end
  839.   end
  840.   # overwrite
  841.   def event_pop_message_update_placement
  842.   end
  843.   # overwrite
  844.   def all_close?
  845.     close? && (!$imported["YEA-MessageSystem"] || @name_window.close?)
  846.   end
  847.   
  848.   if $imported["YEA-MessageSystem"]
  849.     def close_and_wait
  850.       @name_window.force_close
  851.       window_message_close_and_wait_ams
  852.     end
  853.   end
  854. end

  855. #==============================================================================
  856. # ?! Scene_Map
  857. #==============================================================================

  858. class Scene_Map < Scene_Base
  859.   # alias
  860.   alias quack_msg_update update
  861.   def update
  862.     @quack_msgs.each {|m|
  863.       m.update
  864.       if m.open?
  865.         m.update_placement
  866.       end
  867.     }
  868.     @message_window.update_placement if @message_window.open?
  869.     quack_msg_update
  870.   end
  871.   # overwrite
  872.   def create_message_window
  873.     yse_pm_create_message_window
  874.     @face_window = Window_Message_Face.new
  875.     @face_window.message_window = @message_window
  876.     if @bubble_tag_sprite || @thought_bubble_tag_sprite
  877.     @bubble_tag_sprite.dispose
  878.     @thought_bubble_tag_sprite.dispose
  879.     end
  880.     if YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  881.       @bubble_tag_sprite = Sprite.new
  882.       @bubble_tag_sprite.visible = false
  883.       @bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
  884.       @bubble_tag_sprite.src_rect.set(0, 0, @bubble_tag_sprite.width, @bubble_tag_sprite.height / 2)
  885.       @message_window.speech_bubble_tag = @bubble_tag_sprite
  886.       
  887.       @thought_bubble_tag_sprite = Sprite.new
  888.       @thought_bubble_tag_sprite.visible = false
  889.       @thought_bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:thought_bubble_tag_name])
  890.       @thought_bubble_tag_sprite.src_rect.set(0, 0, @thought_bubble_tag_sprite.width, @thought_bubble_tag_sprite.height / 2)
  891.       @message_window.thought_bubble_tag = @thought_bubble_tag_sprite
  892.     end
  893.     @message_window.face_window = @face_window
  894.    
  895.     quack_msg_create_msg
  896.   end
  897.   # new
  898.   def quack_msg_create_msg
  899.     unless @quack_msgs.nil?
  900.       @quack_msgs.each {|m| m.dispose}
  901.       @quack_msg_speech_bubble_sprites.each {|s| s.dispose}
  902.       @quack_msg_thought_bubble_sprites.each {|s| s.dispose}
  903.     end
  904.     @quack_msgs = []
  905.     @quack_faces = []
  906.     @quack_msg_speech_bubble_sprites = []
  907.     @quack_msg_thought_bubble_sprites = []
  908.     QUACK::MSG::MAX_MSGS.times do |i|
  909.       qm = Window_Quack_Message.new($game_message.quack_msgs[i], 200-QUACK::MSG::MAX_MSGS+i)
  910.       @quack_msgs.push(qm)
  911.       ss = Sprite.new
  912.       ss.visible = false
  913.       ss.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
  914.       ss.src_rect.set(0, 0, ss.width, ss.height / 2)
  915.       qm.speech_bubble_tag = ss
  916.       ts = Sprite.new
  917.       ts.visible = false
  918.       ts.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:thought_bubble_tag_name])
  919.       ts.src_rect.set(0, 0, ts.width, ts.height / 2)
  920.       qm.thought_bubble_tag = ts
  921.     end
  922.   end
  923.   # overwrite
  924.   def dispose_spriteset
  925.     pop_message_dispose_spriteset
  926.     #@quack_msg_speech_bubble_sprites.each {|s| s.dispose}
  927.     #@quack_msg_thought_bubble_sprites.each {|s| s.dispose}
  928.     #return unless @bubble_tag_sprite || @thought_bubble_tag_sprite
  929.     #@bubble_tag_sprite.dispose
  930.     #@thought_bubble_tag_sprite.dispose
  931.   end
  932.   # alias
  933.   #alias quack_msg_dispose_all_windows dispose_all_windows
  934.   #def dispose_all_windows
  935.   #  @quack_msgs.each {|m| m.dispose}
  936.   #  quack_msg_dispose_all_windows
  937.   #end
  938. end

  939. #==============================================================================
  940. # ?! Scene_Battle
  941. #==============================================================================
  942. class Scene_Battle
  943.   alias quack_update_basic update_basic
  944.   def update_basic
  945.     quack_update_basic
  946.     @quack_msgs.each {|m|
  947.       m.update
  948.       if m.open?
  949.         m.update_placement
  950.       end
  951.     }
  952.   end
  953.   
  954.   alias yse_pop_create_message_window create_message_window
  955.   def create_message_window
  956.     yse_pop_create_message_window
  957.     @face_window = Window_Message_Face.new
  958.     @face_window.message_window = @message_window
  959.     if YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  960.       @bubble_tag_sprite = Sprite.new
  961.       @bubble_tag_sprite.visible = false
  962.       @bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
  963.       @bubble_tag_sprite.src_rect.set(0, 0, @bubble_tag_sprite.width, @bubble_tag_sprite.height / 2)
  964.       @message_window.speech_bubble_tag = @bubble_tag_sprite
  965.       
  966.       @thought_bubble_tag_sprite = Sprite.new
  967.       @thought_bubble_tag_sprite.visible = false
  968.       @thought_bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:thought_bubble_tag_name])
  969.       @thought_bubble_tag_sprite.src_rect.set(0, 0, @thought_bubble_tag_sprite.width, @thought_bubble_tag_sprite.height / 2)
  970.       @message_window.thought_bubble_tag = @thought_bubble_tag_sprite

  971.     end
  972.     @message_window.face_window = @face_window
  973.    
  974.     quack_create_message_window
  975.   end
  976.   
  977.   def quack_create_message_window
  978.     @quack_msgs = []
  979.     @quack_msg_speech_bubble_sprites = []
  980.     @quack_msg_thought_bubble_sprites = []
  981.     QUACK::MSG::MAX_MSGS.times do |i|
  982.       qm = Window_Quack_Message.new($game_message.quack_msgs[i], 200-QUACK::MSG::MAX_MSGS+i)
  983.       @quack_msgs.push(qm)
  984.       ss = Sprite.new
  985.       ss.visible = false
  986.       ss.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
  987.       ss.src_rect.set(0, 0, ss.width, ss.height / 2)
  988.       qm.speech_bubble_tag = ss
  989.       ts = Sprite.new
  990.       ts.visible = false
  991.       ts.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:thought_bubble_tag_name])
  992.       ts.src_rect.set(0, 0, ts.width, ts.height / 2)
  993.       qm.thought_bubble_tag = ts
  994.     end
  995.   end
  996.   
  997.   alias yse_pop_dispose_spriteset dispose_spriteset
  998.   def dispose_spriteset
  999.     yse_pop_dispose_spriteset
  1000.     @quack_msg_speech_bubble_sprites.each {|s| s.dispose}
  1001.     @quack_msg_thought_bubble_sprites.each {|s| s.dispose}
  1002.     return unless @bubble_tag_sprite || @thought_bubble_tag_sprite
  1003.     @bubble_tag_sprite.dispose
  1004.     @thought_bubble_tag_sprite.dispose
  1005.   end
  1006.   
  1007.   alias quack_msg_dispose_all_windows dispose_all_windows
  1008.   def dispose_all_windows
  1009.     @quack_msgs.each {|m| m.dispose}
  1010.     quack_msg_dispose_all_windows
  1011.   end
  1012. end

  1013. #==============================================================================
  1014. # ?! Game_Interpreter
  1015. #==============================================================================
  1016. class Game_Interpreter
  1017.   def command_101
  1018.     item = $data_items[20]
  1019.     if $imported["YEA-MessageSystem"]
  1020.       wait_for_message
  1021.       $game_message.face_name = @params[0]
  1022.       $game_message.face_index = @params[1]
  1023.       $game_message.background = @params[2]
  1024.       $game_message.position = @params[3]
  1025.       
  1026.       startindex = @index+1
  1027.       textline = @list[startindex].parameters[0].dup
  1028.       chatdur = 0
  1029.       textline.gsub!(/<cm:([^<>]*)>/i) { chatdur = $1.to_i;"" }
  1030.       $game_message.prepare_msg(chatdur) if chatdur != 0
  1031.       while continue_message_string?
  1032.         @index += 1
  1033.         if @list[@index].code == 401
  1034.           textline = @list[@index].parameters[0] unless @index == startindex
  1035.           if chatdur != 0; $game_message.add_chatter(textline)
  1036.           else; $game_message.add(textline)
  1037.           end
  1038.         end
  1039.         break if $game_message.texts.size >= Variable.message_rows
  1040.       end
  1041.       case next_event_code
  1042.       when 102
  1043.         @index += 1
  1044.         setup_choices(@list[@index].parameters)
  1045.       when 103
  1046.         @index += 1
  1047.         setup_num_input(@list[@index].parameters)
  1048.       when 104
  1049.         @index += 1
  1050.         setup_item_choice(@list[@index].parameters)
  1051.       end
  1052.       $game_message.fin_msg if chatdur != 0
  1053.       wait_for_message
  1054.     else
  1055.       wait_for_message
  1056.       $game_message.face_name = @params[0]
  1057.       $game_message.face_index = @params[1]
  1058.       $game_message.background = @params[2]
  1059.       $game_message.position = @params[3]
  1060.       
  1061.       startindex = @index+1
  1062.       textline = @list[startindex].parameters[0].dup
  1063.       chatdur = 0
  1064.       textline.gsub!(/<cm:([^<>]*)>/i) { chatdur = $1.to_i;"" }
  1065.       $game_message.prepare_msg(chatdur) if chatdur != 0
  1066.       
  1067.       while next_event_code == 401       # Text data
  1068.         @index += 1
  1069.         textline = @list[@index].parameters[0] unless @index == startindex
  1070.         if chatdur != 0; $game_message.add_chatter(textline)
  1071.         else; $game_message.add(textline)
  1072.         end
  1073.       end
  1074.       case next_event_code
  1075.       when 102  # Show Choices
  1076.         @index += 1
  1077.         setup_choices(@list[@index].parameters)
  1078.       when 103  # Input Number
  1079.         @index += 1
  1080.         setup_num_input(@list[@index].parameters)
  1081.       when 104  # Select Item
  1082.         @index += 1
  1083.         setup_item_choice(@list[@index].parameters)
  1084.       end
  1085.       $game_message.fin_msg if chatdur != 0
  1086.       wait_for_message
  1087.     end
  1088.   end
  1089.   # new
  1090.   def clear_chatter
  1091.     $game_message.clear_chatter
  1092.   end
  1093. end

  1094. #==============================================================================
  1095. #
  1096. # ?\ End of File
  1097. #
  1098. #==============================================================================
复制代码



头像被屏蔽

Lv4.逐梦者 (禁止发言)

梦石
0
星屑
5701
在线时间
922 小时
注册时间
2013-8-29
帖子
1468
2
发表于 2020-2-9 16:55:58 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9617
在线时间
566 小时
注册时间
2017-9-28
帖子
208
3
发表于 2020-2-9 17:17:42 | 只看该作者
修改你贴出来的这段脚本的 event_pop_message_setup 和 event_pop_message_setup2 方法(382 行左右),在合适的位置插入 self.windowskin = Cache.system("Window1")。简单地说,如果【这次是显示气泡】那么【改变窗口皮肤为你想要的皮肤】。【这次是显示气泡】的判定方式大概是存在 @bubble_tag

点评

改了以后可以了,谢谢大佬  发表于 2020-2-9 17:35

评分

参与人数 1星屑 +10 +1 收起 理由
寂静的夜里 + 10 + 1 认可答案

查看全部评分

喵喵喵
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1957
在线时间
410 小时
注册时间
2018-9-25
帖子
38
4
 楼主| 发表于 2020-2-9 17:23:54 | 只看该作者
本帖最后由 adahs 于 2020-2-9 17:34 编辑
chanszeman1018 发表于 2020-2-9 16:55
你那句是加到那行去了?


我在class Window_Message下面补了一个def initialize然后加的那句,结果把正常的对话窗口也改了,
我用楼上的方法已经解决了,谢谢大佬。
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-25 04:04

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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