赞 | 2 |
VIP | 0 |
好人卡 | 0 |
积分 | 20 |
经验 | 0 |
最后登录 | 2021-6-24 |
在线时间 | 410 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1957
- 在线时间
- 410 小时
- 注册时间
- 2018-9-25
- 帖子
- 38
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
因为我自己用的窗口皮肤不是默认的window,和气泡对话不是很搭,想正常用一个窗口皮肤,气泡对话的时候就用RTP的窗口皮肤
我自己在脚本的class window_message里面加了一句self.windowskin = Cache.system("Window1"),但是连带着把正常对话的时候的对话框也改了请问应该要怎么改才好
- #==============================================================================
- #
- # ▼ Yami Engine Ace - 气泡对话框
- # -- 最后更新: 2012.06.07
- # -- 使用难度: Normal
- # -- 需要脚本: 无
- #
- #==============================================================================
- $imported = {} if $imported.nil?
- $imported["YSE-PopMessage"] = true
- #==============================================================================
- # ▼ Updates
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 2012.06.07 - Fixed Compatible: YEA - Ace Message System.
- # 2012.05.11 - Fixed Message Position.
- # - Remove Requirement: YSE - Fix Events Order.
- # 2012.05.07 - Fixed Face position.
- # - Added Requirement: YSE - Fix Events Order.
- # 2012.04.06 - You can change Bubble Tag filename.
- # 2012.03.28 - Fixed Default Message Position and Sizes.
- # 2012.03.27 - Fixed Default Message.
- # 2012.03.27 - Added Bubble Tag.
- # 2012.03.25 - Fixed Escape Message.
- # 2012.03.24 - Fixed Battle Message.
- # 2012.03.24 - Rewrote script.
- #
- #==============================================================================
- # ▼ 介绍
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 本脚本可以将对话框改变为气泡对话框,使用"BubbleTag"作为气泡标志图片,放在:
- # \Graphics\System 文件夹中.
- # 需要配合脚本:Yami Engine Ace - Bug修复: 事件ID顺序 一起使用.
- #==============================================================================
- # ▼ 安装方式
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
- # 脚本页/槽中.记得保存你的工程以使脚本生效.
- #
- # -----------------------------------------------------------------------------
- # 文本代码 - 可以在文字窗口中使用的代码.
- # -----------------------------------------------------------------------------
- # 代码: 效果:
- # \bm[x] - 在x号事件处显示气泡对话框. *注释
- # \cbm - 关闭气泡对话框效果.
- #
- # *注释: 设定为 0 则会在角色处显示.
- #
- #==============================================================================
- # ▼ 兼容性
- # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
- #
- #==============================================================================
- module YSE
- module POP_MESSAGE
-
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - 视觉效果设置 -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- LIMIT = { # 开始.
- :limit_width => 0, # 宽度限制,设定为0则无限制.
- :limit_line => 6, # 行数限制,设定为0则无限制.
- } # 结束.
-
- POSITION = { # 开始.
- :x_buffer => 0, #调整气泡对话框的x坐标
- :y_buffer => -36, #调整气泡对话框的y坐标
- :face_x_buffer => 8, #调整角色肖像图的x坐标
- :face_y_buffer => 24, #调整角色肖像图的y坐标
- :tag_y_buffer => -6, #调整角色肖像图的y坐标
- :name_x_buffer => 112, #调整名称窗口的x坐标,需要脚本 YEA - 文本系统.
- } # 结束.
-
- EFFECT = { # 开始.
- :fade_face => true, #是否显示角色肖像图淡入效果
- :move_face => true, #是否显示角色肖像图移动效果
- :use_bubble_tag => true, #是否显示气泡标志图片
- :bubble_tag_name => "BubbleTag",#气泡标志图片的文件名
- } # 结束.
-
- end
- end
- #==============================================================================
- # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
- # 所以编辑了后果自负。
- #==============================================================================
- #==============================================================================
- # ■ Spriteset_Map
- #==============================================================================
- class Spriteset_Map
-
- #--------------------------------------------------------------------------
- # public instance variables
- #--------------------------------------------------------------------------
- attr_accessor :character_sprites
-
- end # Spriteset_Map
- #==============================================================================
- # ■ Window_Message_Face
- #==============================================================================
- class Window_Message_Face < Window_Base
-
- #--------------------------------------------------------------------------
- # initialize
- #--------------------------------------------------------------------------
- def initialize
- super(0, 0, 120, 120)
- self.opacity = 0
- @face_name = ""
- @face_index = 0
- @move_x = 0
- close
- end
-
- #--------------------------------------------------------------------------
- # message_window=
- #--------------------------------------------------------------------------
- def message_window=(window)
- @message_window = window
- end
-
- #--------------------------------------------------------------------------
- # set_face
- #--------------------------------------------------------------------------
- def set_face
- contents.clear
- return unless @message_window
- if !$game_message.face_name.empty?
- draw_face($game_message.face_name, $game_message.face_index, 0, 0)
- set_position
- show_face
- else
- hide_face
- end
- end
-
- #--------------------------------------------------------------------------
- # set_position
- #--------------------------------------------------------------------------
- def set_position
- return unless @message_window
- self.x = @message_window.x
- self.y = @message_window.y - 96
- self.x += YSE::POP_MESSAGE::POSITION[:face_x_buffer]
- self.y += YSE::POP_MESSAGE::POSITION[:face_y_buffer]
- self.y += (@message_window.real_lines - 1) * 24
- self.z = @message_window.z + 1
- if (@face_name != $game_message.face_name || @face_index != $game_message.face_index)
- if YSE::POP_MESSAGE::EFFECT[:move_face]
- @move_x = 30
- self.x -= 30
- end
- @face_name = $game_message.face_name
- @face_index = $game_message.face_index
- self.contents_opacity = 0 if YSE::POP_MESSAGE::EFFECT[:fade_face]
- end
- end
-
- #--------------------------------------------------------------------------
- # show_face
- #--------------------------------------------------------------------------
- def show_face
- open
- end
-
- #--------------------------------------------------------------------------
- # hide_face
- #--------------------------------------------------------------------------
- def hide_face
- contents.clear
- close
- end
-
- #--------------------------------------------------------------------------
- # update
- #--------------------------------------------------------------------------
- def update
- super
- self.contents_opacity += 15 if self.contents_opacity < 255
- unless @move_x <= 0
- self.x += 2
- @move_x -= 2
- end
- end
-
- end # Sprite_Message_Face
- #==============================================================================
- # ■ Window_Message
- #==============================================================================
- class Window_Message < Window_Base
-
- #--------------------------------------------------------------------------
- # new method: face_window=
- #--------------------------------------------------------------------------
- def face_window=(window)
- @face_window = window
- end
-
- #--------------------------------------------------------------------------
- # new method: bubble_tag=
- #--------------------------------------------------------------------------
- def bubble_tag=(sprite)
- @bubble_tag = sprite
- end
-
- #--------------------------------------------------------------------------
- # new method: message_escape_characters_pop_message
- #--------------------------------------------------------------------------
- def message_escape_characters_pop_message(result)
- result.gsub!(/\eBM\[(\d+)\]/i) { event_pop_message_setup($1.to_i, false) }
- result.gsub!(/\eBMF\[(\d+)\]/i) { event_pop_message_setup($1.to_i, true) }
- result.gsub!(/\eCBM/i) { event_pop_message_setup(nil, false) }
- result
- end
-
- #--------------------------------------------------------------------------
- # alias method: convert_escape_characters
- #--------------------------------------------------------------------------
- alias yse_convert_escape_characters_pm convert_escape_characters
- def convert_escape_characters(text)
- result = yse_convert_escape_characters_pm(text)
- result = message_escape_characters_pop_message(result)
- result
- end
-
- #--------------------------------------------------------------------------
- # new method: event_pop_message_setup
- #--------------------------------------------------------------------------
- def event_pop_message_setup(event_id, follower = false)
- if follower && $game_player.followers[event_id].nil?
- @event_pop_id = nil
- @event_pop_follower = false
- return ""
- end
- @event_pop_follower = follower
- @event_pop_id = event_id
- return ""
- end
-
- #--------------------------------------------------------------------------
- # new method: set_face_position
- #--------------------------------------------------------------------------
- def set_face_position
- return unless SceneManager.scene_is?(Scene_Map)
- return unless @event_pop_id
- return unless @face_window
- contents.clear
- @face_window.set_face
- return unless $imported["YEA-MessageSystem"]
- return if @face_window.close?
- #@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)
- end
-
- #--------------------------------------------------------------------------
- # alias method: new_page
- #--------------------------------------------------------------------------
- alias window_message_new_page_pm_yse new_page
- def new_page(text, pos)
- window_message_new_page_pm_yse(text, pos)
- set_face_position
- end
-
- #--------------------------------------------------------------------------
- # alias method: close
- #--------------------------------------------------------------------------
- alias pop_message_close close
- def close
- pop_message_close
- return unless SceneManager.scene_is?(Scene_Map)
- return unless @event_pop_id
- @event_pop_id = nil
- @event_pop_follower = false
- @face_window.hide_face
- return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
- @bubble_tag.visible = false if @bubble_tag
- end
-
- #--------------------------------------------------------------------------
- # alias method: open_and_wait
- #--------------------------------------------------------------------------
- alias pop_message_open_and_wait open_and_wait
- def open_and_wait
- pop_message_open_and_wait
- return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
- @bubble_tag.visible = true if @event_pop_id && @bubble_tag
- end
-
- #--------------------------------------------------------------------------
- # alias method: process_all_text
- #--------------------------------------------------------------------------
- alias pop_message_process_all_text process_all_text
- def process_all_text
- @event_pop_id = nil
- convert_escape_characters($game_message.all_text)
- update_placement
- adjust_pop_message($game_message.all_text)
- pop_message_process_all_text
- end
- #--------------------------------------------------------------------------
- # alias method: update_placement
- #--------------------------------------------------------------------------
- alias event_pop_message_update_placement update_placement
- def update_placement
- if SceneManager.scene_is?(Scene_Map)
- if @event_pop_id.nil?
- fix_default_message
- event_pop_message_update_placement
- elsif @event_pop_id == 0
- character = $game_player
- self.y = character.screen_y - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
- self.x = character.screen_x - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
- fix_position_bubble(character)
- set_bubble_tag(character)
- elsif @event_pop_id > 0
- hash = @event_pop_follower ? $game_player.followers : $game_map.events
- character = hash[@event_pop_id]
- self.y = character.screen_y - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
- self.x = character.screen_x - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
- fix_position_bubble(character)
- set_bubble_tag(character)
- end
- else
- event_pop_message_update_placement
- end
- end
-
- #--------------------------------------------------------------------------
- # new method: fix_default_message
- #--------------------------------------------------------------------------
- def fix_default_message
- self.width = window_width
- self.height = window_height
- self.x = 0
- @face_window.hide_face if @face_window
- create_contents
- return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
- @bubble_tag.visible = false if @bubble_tag
- end
-
- #--------------------------------------------------------------------------
- # new method: fix_position_bubble
- #--------------------------------------------------------------------------
- def fix_position_bubble(character)
- end_x = self.x + self.width
- end_y = self.y + self.height
- self.x = 0 if self.x < 0
- self.y = character.screen_y if self.y < 0
- self.x = Graphics.width - self.width if end_x > Graphics.width
- self.y = Graphics.height - self.height if end_y > Graphics.height
- end
-
- #--------------------------------------------------------------------------
- # new method: set_bubble_tag
- #--------------------------------------------------------------------------
- def set_bubble_tag(character)
- return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
- return unless @bubble_tag
- up = self.y == character.screen_y
- self.y += up ? @bubble_tag.height / 2 : -@bubble_tag.height / 2
- @bubble_tag.x = character.screen_x - @bubble_tag.width / 2
- if up
- @bubble_tag.src_rect.set(0, @bubble_tag.height, @bubble_tag.width, @bubble_tag.height)
- @bubble_tag.y = self.y - @bubble_tag.height - YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
- else
- @bubble_tag.src_rect.set(0, 0, @bubble_tag.width, @bubble_tag.height)
- @bubble_tag.y = self.y + self.height + YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
- end
- end
-
- #--------------------------------------------------------------------------
- # new method: cal_number_line
- #--------------------------------------------------------------------------
- def cal_number_line(text)
- result = 0
- text.each_line { result += 1 }
- return result
- end
-
- #--------------------------------------------------------------------------
- # new method: cal_width_line
- #--------------------------------------------------------------------------
- def cal_width_line(text)
- result = 0
- text.each_line { |line|
- result = text_size(line).width if result < text_size(line).width
- }
- return result
- end
- #--------------------------------------------------------------------------
- # alias method: adjust_message_window_size
- #--------------------------------------------------------------------------
- if $imported["YEA-MessageSystem"]
- alias yse_pop_message_adjust_message_window_size adjust_message_window_size
- def adjust_message_window_size
- start_name_window if @event_pop_id
- return if @event_pop_id
- yse_pop_message_adjust_message_window_size
- end
- end
-
- #--------------------------------------------------------------------------
- # new method: adjust_pop_message
- #--------------------------------------------------------------------------
- def adjust_pop_message(text = " ")
- return unless SceneManager.scene_is?(Scene_Map)
- unless @event_pop_id
- if $imported["YEA-MessageSystem"]
- #adjust_message_window_size
- end
- return
- end
- n_line = cal_number_line(text)
- 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]
- @real_lines = n_line
- self.height = fitting_height(n_line)
- self.width = cal_width_line(text) + 24
- self.width += new_line_x
- if self.width > YSE::POP_MESSAGE::LIMIT[:limit_width] && YSE::POP_MESSAGE::LIMIT[:limit_width] > 0
- self.width = YSE::POP_MESSAGE::LIMIT[:limit_width]
- end
- create_contents
- update_placement
- end
-
- #--------------------------------------------------------------------------
- # overwrite method: new_line_x
- #--------------------------------------------------------------------------
- def new_line_x
- if $game_message.face_name.empty?
- return 0
- else
- result = YSE::POP_MESSAGE::POSITION[:face_x_buffer]
- p_x = $imported["YEA-MessageSystem"] ? YEA::MESSAGE::FACE_INDENT_X : 112
- result += p_x
- return result
- end
- end
-
- #--------------------------------------------------------------------------
- # new method: real_lines
- #--------------------------------------------------------------------------
- def real_lines
- @real_lines
- end
-
- end # Window_Message
- #==============================================================================
- # ■ Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
-
- #--------------------------------------------------------------------------
- # alias method: create_message_window
- #--------------------------------------------------------------------------
- alias yse_pm_create_message_window create_message_window
- def create_message_window
- yse_pm_create_message_window
- @face_window = Window_Message_Face.new
- @face_window.message_window = @message_window
- if YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
- @bubble_tag_sprite = Sprite.new
- @bubble_tag_sprite.visible = false
- @bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT[:bubble_tag_name])
- @bubble_tag_sprite.src_rect.set(0, 0, @bubble_tag_sprite.width, @bubble_tag_sprite.height / 2)
- @message_window.bubble_tag = @bubble_tag_sprite
- end
- @message_window.face_window = @face_window
- end
-
- #--------------------------------------------------------------------------
- # alias method: dispose_spriteset
- #--------------------------------------------------------------------------
- alias pop_message_dispose_spriteset dispose_spriteset
- def dispose_spriteset
- pop_message_dispose_spriteset
- return unless @bubble_tag_sprite
- @bubble_tag_sprite.dispose
- end
-
- end # Scene_Map
- #==============================================================================
- #
- # ▼ End of File
- #
- #==============================================================================
复制代码- =begin
- #==============================================================================
- * 闲谈对话框 (Yami 气泡对话框 的插件) - v1.3c
- 作者: Quack
- 翻译:nil2018(○┰○)
- #==============================================================================
- 效果:
- 1-允许你使用"闲谈对话框。和默认对话框区别为,闲谈对话框不会暂停游戏,也不会因为
- 玩家按下任何按键而关闭,取而代之的是为对话框设定一个计时器,时间到了会自动将
- 其关闭。还有一个特点是:可以同时显示多个闲谈对话框(有最大显示数量限制,默认
- 为7,你可以在下面的"MAX_MSGS"中调整最大数)
-
- 将普通对话框“变成”闲谈对话框的方法为:在对话框中填入标志:'<cm:X>'
- 其中X为显示的时间,单位为秒(注意:这个标志必须放在对话框的第一行!!)
- 将X设定为负值时,对话框就不会消失了。你可以使用脚本来关闭所有闲谈对话框:
- clear_chatter
-
- 2-说话的气泡标志(bubble message)和原来一样,都是: \bm[x]
- 新添加了思考(bubble message thought)的气泡标志: \bmt[x]
-
- 3-气泡对话框可以在战斗中使用了。可以使用 \bm[x] 或 \bmt[x] 来显示气泡对话框。
- 如果你要在敌人头上显示气泡对话框,请将x替换为负值.
- 在战斗中: \bm[1] 显示在1号敌人头上
- \bm[-1] 显示在1号角色头上
- 对于1号敌人,使用 \bm[1] ,4号敌人则使用 \bm[4]
- 同时,对于角色: 1号角色 = \bm[-1]
-
- 然而,要想在战斗中在角色头上显示气泡对话框,需要你使用“显示角色战斗图”的
- 脚本。我不能保证我的脚本适用于所有该功能的脚本。但我可以保证和Jet's sideview
- battlers 相兼容。
-
- 有一个问题是,当战斗图的大小过大或过小时,对话框窗口会有些移位。
- 使用以下标志来调整对话框的位置:
- \ox[X] - 调整气泡对话框的x坐标
- \oy[X] - 调整气泡对话框的y坐标
-
- 有一点需要注意的是,如果你还使用了Yanfly的核心脚本&Yanfly的文本系统,你需要将
- 核心脚本中的 FONT_NAME 和文本系统的i MESSAGE_WINDOW_FONT_NAME 设定相匹配(两
- 个地方都要设定相同的字体)否则两个脚本的设定结合起来,有时会使文本的宽度计算
- 错误。这个问题不大,可是在气泡对话框中,会改变气泡对话框的窗口宽度,这就是个
- 大问题了(yanfly两个脚本中,关于字体的其他设定例如是否加粗是否斜体等,也最好
- 设定得一模一样)
-
- 版本 1.1 更新功能:
- 1-添加文本打字音效,你可以在 TEXT_SOUNDS 的哈希表中设定(在下面查看更多地介绍)
- 使用标志:
- <ts:x> 文章打字音x,x为存在于 TEXT_SOUNDS 哈希表中的打字音效名字.
-
- 2-添加对话框背景色调的功能。你可以在 WINDOW_TONES 哈希表中预设色调种类
- 使用标志: <bc:x> ,其中x为存在于 WINDOW_TONES 哈希表中的色调名字.
-
- 3-有时,你需要在同一个对话框中显示不同的字体,可能会使对话框变得过大或过小。Sometimes you might want to change font size in your message, multiple times,
- 使用标志: <pms:x,y> 可以调整气泡对话框的大小.x为宽度变化,y为高度变化
- 例如,你使用了标志<pms:20,-10> ,则对话框的宽度会增加20,高度会减少10.
-
- 4-如果你和我一样,被记忆事件id、书写一大堆标志而困扰,以下功能会帮到你。
-
- 仅使用一个标志<bt:x> (对于谈话气泡) 或 <btt:x> (对于思考气泡)
- 就可以让该事件使用你设定的背景颜色和文本打字音效。
-
- 那原理是什么?
- 举个例子,我有一个作为队伍角色的事件,她叫Emil.在事件名中填入了标志: <emil>.
- 然后,当我使用了标志: <bt:emil> 或 <btt:emil> 气泡对话框会自动显示到该事件的
- 头上(如果有多个事件名为<emil>的事件,也会只显示一个对话框),且使用
- WINDOW_TONES 中的'emil'作为窗口色调,使用TEXT_SOUNDS中的'emil'作为文本打字音效
- 但不能用于btt,因为思考中还会有打字音效不是太奇怪了吗?
-
-
- 这也会在你检查事件时,更清楚地明白哪个事件是'emil',而不是去找哪个事件是某某id
-
- 如果你想指定用于角色(player) 的话,使用标志'pl',例如:
- <bt:pl>
- 这样就可以使设定窗口色调和打字音效的"打包"设定同时应用于角色了。
- 或许在队员变化大的情况下不怎么实用,但是我仍然添加了此功能。
-
- 如果你很好奇为什么我新添加的标志和以前的不一样...因为!Consistence is overrated
- anyway, who needs it? (0.0)
-
- 使用标志(<bt:x> & <btt:x>) 需要你安装脚本 Qonvenience (你也许会叫它做
- 我的'核心' 脚本,类似其他人的 (Yanfly,
- Victor, Yami, etc).
- 你可以在下面的'使用条件'部分找到下载地址.
-
- 版本 1.2 更新功能:
- - 显示选项时,会根据你使用的是气泡对话框还是普通的对话框而显示不同的样子。
- 使用默认对话框时,选项的外貌不变。使用气泡对话框时选项会变得更大,且显示在对
- 话框窗口中.
-
- 版本 1.3更新功能:
- - 修复了一些肖像图和名称窗口的问题。问题并没有完全解决,因为我自己的工程里并
- 没有使用名称窗口或肖像图,所以本人并不是很感兴趣去花时间到这些地方。
-
- -和窗口色调、打字音效一样,你现在可以使用标志来显示名称窗口了。
-
- ==============================================================================
- 安装注释:
- 需要脚本 Yami气泡对话框.
- 将本脚本放在其之下.
- ==============================================================================
- 使用条件:
- 需要Yami气泡对话框脚本,你可以在这里下载:
- https://github.com/suppayami/rmvxa-collection/blob/master/yami-script-ace/10%20-%20Pop%20Message.txt
- 同时还需要我的 Qonvenience脚本 ,如果你想使用:<bt:x> 和 <btt:x>的话
- 在这里下载:
- http://pastebin.com/J6haUy5T
- ==============================================================================
- Credits:
- Yami 为 气泡对话框的作者.
- ==============================================================================
- 使用条款:
- 随意使用(没错,包括商业游戏),只要你不声明这个脚本是你自己写的。
- 同时我也希望你能在使用此脚本时,属名我为脚本的作者。
- 请记住本脚本必须和Yami的气泡对话框同时使用,其也有自己的使用条款.
- ==============================================================================
- Bugs:
- 不懂
- ==============================================================================
- History:
- 11/10/2016 - Fixed some problems added some minor feature.
- 19/01/2016 - Fixed some bugs, changes to choices when a pop message is used.
- 14/01/2016 - Chatter messages now last forever if you set the duration to a
- negative number. Also added method for clearing all chatter
- to use in script calls. Also squashed some bugs.
- 13/01/2016 - Pretty big update. Added more functionality.
- 10/01/2016 - Proper release since Absurdiness found the original script so I
- could separate the addon from the original.
- 08/01/2016 - Initial release
- =end
- $imported = {} if $imported.nil?
- $imported["Chatter_Messages"] = true
- #==============================================================================
- # * 设定
- #==============================================================================
- module YSE
- module POP_MESSAGE
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
- # - 视觉设定 -
- #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-
- EFFECT2 = { # 开始.
- :bubble_tag_name => "BubbleTag_Speech",
- :thought_bubble_tag_name => "BubbleTag_Thought",
- } # 结束.
- end
- end
- module QUACK
- module MSG
-
- # 闲谈窗口同时显示的最大数量。
- # 太少会限制了你的选择,太多会使画面杂乱。
- MAX_MSGS = 7
-
- # 在这里设定窗口颜色。
- # 格式:
- # '名称' => Tone.new(红,绿,蓝,灰度)
- # 名称为字符,红绿蓝为数字,范围是 -255~255
- # 灰度的范围是 0 到 255. 灰度为可选值,不一定非要写。
- WINDOW_TONES = {
- #在下面手动添加设定
- '偏红' => Tone.new(85,44,51),
- '杰克' => Tone.new(-34,85,102),
- '狂人' => Tone.new(68,68,68,10),
- '普尔' => Tone.new(102,34,-34),
- '爱丽丝' => Tone.new(102,34,51),
- # 自己设定更多的
- }
-
- # 在这里设定文本打字音效
- # 格式:
- # '名称' => ["文件名",音量, 最低音调, 最高音调],
- # 名称为字符,文件名为音效文件名
- # 音量音调为数字,范围是 0-100.
- TEXT_SOUNDS = {
- #在下面手动添加设定
- '0' => nil, # 无任何打字音效的默认值!
- '1' => ["Cursor1", 80, 70, 100],
- '2' => ["Cursor1", 80, 90, 120],
- '3' => ["Knock", 80, 50, 75],
- '杰克' => ["Cursor1", 80, 90, 120],
- '狂人' => ["Cursor1", 80, 45, 70],
- '普尔' => ["Cursor1", 80, 70, 100],
- '爱丽丝' => ["Cursor1", 70, 110, 140],
- # And above this line
- }
-
- NAMES = {
- # 设定名称
- '1' => "冒险家杰克",
- '2' => "疯狂实验员"
- }
-
- # 每X个字符播放一次打字音效.
- SOUND_PLAY_FREQUENCY = 3
-
- # 气泡对话框是否在使用选项时随着文本显示而逐渐增大,还是立刻显示为最大尺寸
- POP_CHOICE_GROW = true
-
- end
- end
- #==============================================================================
- # * SCRIPT START
- #==============================================================================
- #==============================================================================
- # ?! DataManager
- #==============================================================================
- module DataManager
- class << self
- alias quack_msg_create_game_objects create_game_objects
- def create_game_objects
- quack_msg_create_game_objects
- if !$imported["YSE-PopMessage"]
- msgbox(sprintf("This script(Chatter Messages) requires Yami's Pop Messages to function", "ChatterMessages", 1))
- exit
- end
- $game_message.quack_msg_make
- end
- end
- end
- #==============================================================================
- # ?! Game_Message
- #==============================================================================
- class Game_Message
- attr_accessor :quack_msgs
- attr_accessor :ev_id
-
- # new
- def quack_msg_make
- @quack_msgs = []
- QUACK::MSG::MAX_MSGS.times {@quack_msgs.push(Game_Message.new)}
- @quack_msg_ttl = 0
- @c_msg = 0
- end
- # new
- def set_ttl(ttl)
- @quack_msg_ttl = ttl
- end
- # new
- def ttl_sub
- @quack_msg_ttl -= 1 if @quack_msg_ttl > 0
- end
- # new
- def expire?
- return false if @quack_msg_ttl < 0
- @quack_msg_ttl == 0
- end
- # new
- def prepare_msg(duration)
- @quack_msg_ttl = (duration * 60).to_i
- end
- # new
- def fin_msg
- @quack_msg_ttl = 0
- @c_msg = (@c_msg + 1) % QUACK::MSG::MAX_MSGS
- end
- # new
- def add_chatter(text)
- m = @quack_msgs[@c_msg]
- m.add(text)
- m.face_name = face_name
- m.face_index = face_index
- m.set_ttl(@quack_msg_ttl)
- end
- # new
- def clear_chatter
- @quack_msgs.each {|m| m.set_ttl(0) }
- end
-
- # new
- def clear_chatter_event(e)
- # Find any chatter attached to certain event id and close the chatter
- @quack_msgs.each {|m| m.set_ttl(0) if m.ev_id == e }
- end
- end
- #==============================================================================
- # ?! Window_Message
- #==============================================================================
- class Window_Message < Window_Base
-
- # new
- def chatter?
- false
- end
- # new
- def source
- $game_message
- end
- # overwrite
- def standard_padding
- return 8
- end
- # alias
- alias quack_chatter_init initialize
- def initialize
- @msg_tone = $game_system.window_tone
- @snd_f = 0
- #@name_text = ""
- quack_chatter_init
- end
- # new
- def speech_bubble_tag=(sprite)
- @speech_bubble_tag = sprite
- end
- # new
- def thought_bubble_tag=(sprite)
- @thought_bubble_tag = sprite
- end
- # new
- def set_offset_x(x)
- @ox = x
- return ""
- end
- # new
- def set_offset_y(y)
- @oy = y
- return ""
- end
- # overwrite
- def cal_width_line(text)
- result = 0
- text.each_line { |line|
- result = text_size(line).width if result < text_size(line).width
- }
- return result
- end
- # alias
- alias quack_chatter_process_character process_character
- def process_character(c, text, pos)
- if @snd_f == 0 && !@show_fast && !@text_sound.nil?
- Audio.se_play("Audio/SE/"+@text_sound[0],@text_sound[1],@text_sound[2]+rand(@text_sound[3]-@text_sound[2]))
- end
- @snd_f += 1
- @snd_f = 0 if @snd_f == QUACK::MSG::SOUND_PLAY_FREQUENCY
- quack_chatter_process_character(c,text,pos)
- end
- # overwrite
- def update_tone
- self.tone.set(@msg_tone)
- end
- # overwrite
- def message_escape_characters_pop_message(result)
- @msg_tone = $game_system.window_tone
- @event_pop_id = nil
- set_offset_x(0)
- set_offset_y(0)
- @text_sound = QUACK::MSG::TEXT_SOUNDS['0']
- @msg_size_x = 0
- @msg_size_y = 0
- reset_font_settings
-
- result.gsub!(/<BT:([^<>]*)>/i) { event_pop_message_setup2($1, false) }
- result.gsub!(/<BTT:([^<>]*)>/i) { event_pop_message_setup2($1, true) }
- result.gsub!(/\eOX\[([-+]?\d+)\]/i) { set_offset_x($1.to_i) }
- result.gsub!(/\eOY\[([-+]?\d+)\]/i) { set_offset_y($1.to_i) }
- result.gsub!(/\eBM\[([-+]?\d+)\]/i) { event_pop_message_setup($1.to_i, false) }
- result.gsub!(/\eBMT\[([-+]?\d+)\]/i) { event_pop_message_setup($1.to_i, true) }
- result.gsub!(/\eBMF\[(\d+)\]/i) { event_pop_message_setup($1.to_i, false, true) }
- result.gsub!(/\eCBM/i) { event_pop_message_setup(nil, false) }
- result.gsub!(/<BC:([^<>]*)>/i) { @msg_tone = QUACK::MSG::WINDOW_TONES[$1] ;""}
- result.gsub!(/<TS:([^<>]*)>/i) { @text_sound = QUACK::MSG::TEXT_SOUNDS[$1]; ""}
- result.gsub!(/<PMS:([-+]?\d+),([-+]?\d+)>/i) { @msg_size_x = $1.to_i ;@msg_size_y = $2.to_i; ""}
- result
- end
- # new
- def event_pop_message_setup2(tag, thought = false)
- if SceneManager.scene_is?(Scene_Battle)
- if tag.include?('act')
- ev_id = tag[3].to_i
- ev_id = (1+$game_party.members.index($game_actors[ev_id])) * -1
- @msg_tone = QUACK::MSG::WINDOW_TONES[tag] if QUACK::MSG::WINDOW_TONES.has_key?(tag)
- @text_sound = QUACK::MSG::TEXT_SOUNDS[tag] if !thought && QUACK::MSG::TEXT_SOUNDS.has_key?(tag)
- else
- msgbox(sprintf("无任何事件使用标志: '" + tag + "'.","Chatter Messages",1))
- end
- return event_pop_message_setup(ev_id, thought)
- end
- msgbox(sprintf("使用此标志需要你安装Qonvenience.","Chatter Messages",1)) if !$imported["Qonvenience"]
- if tag == 'pl'
- ev_id = 0
- else
- ev_id = $game_map.first_event_tag(tag).id
- msgbox(sprintf("无任何事件使用标志: '" + tag + "'.","Chatter Messages",1)) if ev_id.nil?
- end
- @msg_tone = QUACK::MSG::WINDOW_TONES[tag] if QUACK::MSG::WINDOW_TONES.has_key?(tag)
- @text_sound = QUACK::MSG::TEXT_SOUNDS[tag] if !thought && QUACK::MSG::TEXT_SOUNDS.has_key?(tag)
- namewindow(QUACK::MSG::NAMES[tag], 1) if $imported["YEA-MessageSystem"] && QUACK::MSG::NAMES.has_key?(tag) && @name_text == ""
- return event_pop_message_setup(ev_id, thought)
- end
- # overwrite
- def event_pop_message_setup(event_id, thought = false, follower = false)
- start_name_window if $imported["YEA-MessageSystem"]
- if follower && $game_player.followers[event_id].nil?
- @event_pop_id = nil
- @event_pop_follower = false
- return ""
- end
- if thought # THOUGHT
- @speech_bubble_tag.visible = false
- @bubble_tag = @thought_bubble_tag
- else # SPEECH
- @thought_bubble_tag.visible = false
- @bubble_tag = @speech_bubble_tag
- end
- @event_pop_follower = follower
- @event_pop_id = event_id
- # close any chatter message currently attached to this event
- $game_message.clear_chatter_event(event_id)
- source.ev_id = event_id
- return ""
- end
- # overwrite
- def set_face_position
- #return unless SceneManager.scene_is?(Scene_Map)
- return unless @event_pop_id
- return unless @face_window
- contents.clear
- @face_window.set_face
- return unless $imported["YEA-MessageSystem"]
- return if @face_window.close?
- #@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)
- end
- # overwrite
- def close
- pop_message_close
- #return unless SceneManager.scene_is?(Scene_Map)
- return unless @event_pop_id
- @event_pop_follower = false
- @face_window.hide_face
- return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
- @speech_bubble_tag.visible = false if @speech_bubble_tag
- @thought_bubble_tag.visible = false if @thought_bubble_tag
- source.ev_id = nil
- end
- # overwrite
- def process_all_text
- @event_pop_id = nil
- @name_text = ""
- txt = convert_escape_characters($game_message.all_text)
- update_placement
- adjust_pop_message(txt)#$game_message.all_text)
- pop_message_process_all_text
- end
- # overwrite
- def update_placement
- if SceneManager.scene_is?(Scene_Map)
- if @event_pop_id.nil?
- fix_default_message
- event_pop_message_update_placement
- elsif @event_pop_id == 0
- character = $game_player
- self.y = character.screen_y + @oy - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
- self.x = character.screen_x + @ox - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
- fix_position_bubble(character)
- set_bubble_tag(character)
- @name_window.update_pos if $imported["YEA-MessageSystem"] && @name_window.open?
- @face_window.set_position if !chatter? && @face_window.open?
- elsif @event_pop_id > 0
- hash = @event_pop_follower ? $game_player.followers : $game_map.events
- character = hash[@event_pop_id]
- self.y = character.screen_y + @oy - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
- self.x = character.screen_x + @ox - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
- fix_position_bubble(character)
- set_bubble_tag(character)
- @name_window.update_pos if $imported["YEA-MessageSystem"] && @name_window.open?
- @face_window.set_position if !chatter? && @face_window.open?
- end
- else
- # IF IN BATTLE
- #event_pop_message_update_placement
- if @event_pop_id.nil?
- fix_default_message
- event_pop_message_update_placement
- elsif @event_pop_id < 0
- battler = $game_party.members[(@event_pop_id * -1)-1]
- self.y = battler.screen_y + @oy - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
- self.x = battler.screen_x + @ox - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
- fix_position_bubble(battler)
- set_bubble_tag(battler)
- @name_window.update_pos if $imported["YEA-MessageSystem"] && @name_window.open?
- @face_window.set_position if !chatter? && @face_window.open?
- elsif @event_pop_id > 0
- battler = $game_troop.members[@event_pop_id-1]
- self.y = battler.screen_y + @oy - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
- self.x = battler.screen_x + @ox - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
- fix_position_bubble(battler)
- set_bubble_tag(battler)
- @name_window.update_pos if $imported["YEA-MessageSystem"] && @name_window.open?
- @face_window.set_position if !chatter? && @face_window.open?
- end
- end
- end
- # overwrite
- def fix_default_message
- self.width = window_width
- self.height = window_height
- self.x = 0
- @face_window.hide_face if @face_window
- #create_contents
- return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
- @speech_bubble_tag.visible = false if @speech_bubble_tag
- @thought_bubble_tag.visible = false if @thought_bubble_tag
- end
- # overwrite
- def fix_position_bubble(character)
- end_x = self.x + self.width
- end_y = self.y + self.height
- self.x = 0 if self.x < 0
- self.y = character.screen_y + @oy if self.y < 0
- self.y = -99 if self.y < 0
- self.x = Graphics.width - self.width if end_x > Graphics.width
- self.y = Graphics.height - self.height if end_y > Graphics.height
- end
- # overwrite
- def set_bubble_tag(character)
- return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
- return unless @bubble_tag
- up = self.y == character.screen_y + @oy
- if self.y == -99
- self.y = 0
- up = true
- end
- self.y += up ? @bubble_tag.height / 2 : -@bubble_tag.height / 2
- @bubble_tag.x = character.screen_x + @ox - @bubble_tag.width / 2
- if up
- @bubble_tag.src_rect.set(0, @bubble_tag.height, @bubble_tag.width, @bubble_tag.height)
- @bubble_tag.y = self.y - @bubble_tag.height - YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
- else
- @bubble_tag.src_rect.set(0, 0, @bubble_tag.width, @bubble_tag.height)
- @bubble_tag.y = self.y + self.height + YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
- end
- @bubble_tag.z = self.z + 1000
- end
- # overwrite
- def adjust_pop_message(text = " ")
- #return unless SceneManager.scene_is?(Scene_Map)
- unless @event_pop_id
- if $imported["YEA-MessageSystem"]
- #adjust_message_window_size
- end
- return
- end
- n_line = cal_number_line(text)
- 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]
- @real_lines = n_line
- self.height = fitting_height(n_line)
- self.height += @msg_size_y
- self.width = cal_width_line(text) + 10
- self.width += @msg_size_x
- self.width += new_line_x
- if self.width > YSE::POP_MESSAGE::LIMIT[:limit_width] && YSE::POP_MESSAGE::LIMIT[:limit_width] > 0
- self.width = YSE::POP_MESSAGE::LIMIT[:limit_width]
- end
- if $game_message.choice? && !QUACK::MSG::POP_CHOICE_GROW
- dy = fitting_height($game_message.choices.size) - 16
- self.y -= dy - 16
- self.height += dy - 16
- @face_window.y -= dy - 16
- @name_window.y -= dy - 16 if $imported["YEA-MessageSystem"]
- end
- # If a chatter message with face graphic, force height to be at least big enough to show the face.
- if chatter? && !source.face_name.empty?
- self.height = [self.height, 86].max
- end
-
- create_contents
- update_placement
- end
- # alias
- alias yse_pop_dispose dispose
- def dispose
- @speech_bubble_tag.visible = false if @speech_bubble_tag
- @thought_bubble_tag.visible = false if @thought_bubble_tag
- yse_pop_dispose
- end
- # alias
- alias chatter_msg_input_choice input_choice
- def input_choice
- if !close? && pop_message? && QUACK::MSG::POP_CHOICE_GROW
- f = Fiber.new { add_room_for_choices }
- @choice_window.visible = false
- @choice_window.set_fiber(f)
- f.resume
- end
- chatter_msg_input_choice
- end
- # new
- def add_room_for_choices
- q = fitting_height($game_message.choices.size) - 16
- i = 0
- while true
- i += 4
- self.y -= 4
- self.height += 4
- @face_window.y -= 4
- @name_window.y -= 4 if $imported["YEA-MessageSystem"]
- break if i >= q
- Fiber.yield
- end
- @choice_window.visible = true
- @choice_window.set_fiber(nil)
- end
- # new
- def pop_message?
- @event_pop_id
- end
- end
- #==============================================================================
- # ?! Window_ChoiceList
- #==============================================================================
- class Window_ChoiceList < Window_Command
- # alias
- alias chatter_msg_init initialize
- def initialize(message_window)
- chatter_msg_init(message_window)
- self.opacity = 0
- self.z = 20070
- end
- # new
- def set_fiber(fiber)
- @fiber = fiber
- end
- # alias
- alias chatter_msg_update update
- def update
- chatter_msg_update
- @fiber.resume if @fiber
- end
- # alias
- alias chatter_msg_update_placement update_placement
- def update_placement
- if @message_window.pop_message?
- self.opacity = 0
- self.width = @message_window.width-26 + padding * 2
- self.width = [width, Graphics.width].min
- self.height = fitting_height($game_message.choices.size)
- self.x = @message_window.x
- self.y = @message_window.y+@message_window.height-self.height+6
- else
- self.opacity = 255
- chatter_msg_update_placement
- end
- end
- end
- class Window_NameMessage < Window_Base
- #def hide_me
- # self.x = 99999
- # self.y = 99999
- #end
- end
- #==============================================================================
- # ■ Window_NameMessage
- #==============================================================================
- class Window_NameMessage < Window_Base
- # alias
- alias quack_msg_name_init initialize
- def initialize(message_window)
- quack_msg_name_init(message_window)
- self.z += 2
- end
- # new
- def update_pos
- set_x_position(1)
- #set_y_position
- self.y = @message_window.y - self.height / 1.25
- self.y = 0 if self.y < 0
- end
- # overwrite
- # self.y = @message_window.height
- # self.y -= YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
- #else
- # self.y = @message_window.y - self.height / 1.25
- # self.y += YEA::MESSAGE::NAME_WINDOW_Y_BUFFER
- #end
- end
-
- #==============================================================================
- # ¡ Window_Message_Face
- #==============================================================================
- class Window_Message_Face < Window_Base
- alias quack_msg_face_pos set_position
- def set_position
- quack_msg_face_pos
- self.y -= 4
- end
- end
- #==============================================================================
- # ?! Window_Quack_Message
- #==============================================================================
- class Window_Quack_Message < Window_Message
- attr_accessor :active
-
- # overwrite
- def initialize(msg_source, zz)
- super()
- self.z = zz
- @quack_msg_source = msg_source
- @active = false
- @background = 0
- self.opacity = 255
- self.visible = false
- clear_name_window if $imported["YEA-MessageSystem"]
- end
- # overwrite
- def chatter?
- true
- end
- # overwrite
- def source
- @quack_msg_source
- end
- # overwrite
- def update
- if @quack_msg_source.busy?
- if @quack_msg_source.expire?
- close
- else
- self.visible = true if !self.visible
- @quack_msg_source.ttl_sub
- end
- end
- self.visible = false if self.visible && close?
- super
- end
- # overwrite
- def update_placement
- return if @closing
- super
- end
- # overwrite
- def update_show_fast
- return false
- end
- # overwrite
- def process_all_text
- @event_pop_id = nil
- text = convert_escape_characters(@quack_msg_source.all_text)
- update_placement
- adjust_pop_message(text)
- open_and_wait
- #text = convert_escape_characters(@quack_msg_source.all_text)
- pos = {}
- new_page(text, pos)
- process_character(text.slice!(0, 1), text, pos) until text.empty? || close?
- end
- # overwrite
- def close
- pop_message_close #super
- return unless @event_pop_id
- return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
- @speech_bubble_tag.visible = false if @speech_bubble_tag
- @thought_bubble_tag.visible = false if @thought_bubble_tag
- source.ev_id = nil
- @name_text = ""
- end
- # overwrite
- def input_pause
- self.pause = true
- wait(10)
- Fiber.yield until close?
- self.pause = false
- end
- # overwrite
- def update_fiber
- if @fiber
- @fiber.resume
- elsif @quack_msg_source.busy?
- @fiber = Fiber.new { fiber_main }
- @fiber.resume
- else
- @quack_msg_source.visible = false
- end
- end
- def fiber_main
- @quack_msg_source.visible = true
- #update_background
- update_placement
- loop do
- process_all_text if @quack_msg_source.has_text?
- process_input
- @quack_msg_source.clear
- @name_window.start_close if $imported["YEA-MessageSystem"]
- Fiber.yield
- break unless text_continue?
- end
- close_and_wait
- @quack_msg_source.visible = false
- @fiber = nil
- end
- #def update_background
- # @background = @quack_msg_source.background
- # self.opacity = @background == 0 ? 255 : 0
- #end
- def process_input
- input_pause unless @pause_skip
- end
- def text_continue?
- @quack_msg_source.has_text?# && !settings_changed?
- end
- def settings_changed?
- #@background != $game_message.background ||
- #@position != @quack_msg_source.position
- false
- end
- def new_page(text, pos)
- contents.clear
- draw_face(@quack_msg_source.face_name, @quack_msg_source.face_index, 0, 0)
- reset_font_settings
- pos[:x] = new_line_x
- pos[:y] = 0
- pos[:new_x] = new_line_x
- pos[:height] = calc_line_height(text)
- clear_flags
- end
- def new_line_x
- @quack_msg_source.face_name.empty? ? 0 : 112
- end
- # overwrite
- def input_pause
- #self.pause = true
- wait(10)
- Fiber.yield until @quack_msg_source.expire? #Input.trigger?(:B) || Input.trigger?(:C)
- #Input.update
- #self.pause = false
- end
-
- # overwrite
- def create_all_windows
- @name_window = Window_NameMessage.new(self) if $imported["YEA-MessageSystem"]
- end
- # overwrite
- def dispose_all_windows
- @name_window.dispose if $imported["YEA-MessageSystem"]
- end
- # overwrite
- def update_all_windows
- if $imported["YEA-MessageSystem"]
- @name_window.update
- @name_window.back_opacity = self.back_opacity
- @name_window.opacity = self.opacity
- end
- end
- # overwrite
- def event_pop_message_update_placement
- end
- # overwrite
- def all_close?
- close? && (!$imported["YEA-MessageSystem"] || @name_window.close?)
- end
-
- if $imported["YEA-MessageSystem"]
- def close_and_wait
- @name_window.force_close
- window_message_close_and_wait_ams
- end
- end
- end
- #==============================================================================
- # ?! Scene_Map
- #==============================================================================
- class Scene_Map < Scene_Base
- # alias
- alias quack_msg_update update
- def update
- @quack_msgs.each {|m|
- m.update
- if m.open?
- m.update_placement
- end
- }
- @message_window.update_placement if @message_window.open?
- quack_msg_update
- end
- # overwrite
- def create_message_window
- yse_pm_create_message_window
- @face_window = Window_Message_Face.new
- @face_window.message_window = @message_window
- if @bubble_tag_sprite || @thought_bubble_tag_sprite
- @bubble_tag_sprite.dispose
- @thought_bubble_tag_sprite.dispose
- end
- if YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
- @bubble_tag_sprite = Sprite.new
- @bubble_tag_sprite.visible = false
- @bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
- @bubble_tag_sprite.src_rect.set(0, 0, @bubble_tag_sprite.width, @bubble_tag_sprite.height / 2)
- @message_window.speech_bubble_tag = @bubble_tag_sprite
-
- @thought_bubble_tag_sprite = Sprite.new
- @thought_bubble_tag_sprite.visible = false
- @thought_bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:thought_bubble_tag_name])
- @thought_bubble_tag_sprite.src_rect.set(0, 0, @thought_bubble_tag_sprite.width, @thought_bubble_tag_sprite.height / 2)
- @message_window.thought_bubble_tag = @thought_bubble_tag_sprite
- end
- @message_window.face_window = @face_window
-
- quack_msg_create_msg
- end
- # new
- def quack_msg_create_msg
- unless @quack_msgs.nil?
- @quack_msgs.each {|m| m.dispose}
- @quack_msg_speech_bubble_sprites.each {|s| s.dispose}
- @quack_msg_thought_bubble_sprites.each {|s| s.dispose}
- end
- @quack_msgs = []
- @quack_faces = []
- @quack_msg_speech_bubble_sprites = []
- @quack_msg_thought_bubble_sprites = []
- QUACK::MSG::MAX_MSGS.times do |i|
- qm = Window_Quack_Message.new($game_message.quack_msgs[i], 200-QUACK::MSG::MAX_MSGS+i)
- @quack_msgs.push(qm)
- ss = Sprite.new
- ss.visible = false
- ss.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
- ss.src_rect.set(0, 0, ss.width, ss.height / 2)
- qm.speech_bubble_tag = ss
- ts = Sprite.new
- ts.visible = false
- ts.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:thought_bubble_tag_name])
- ts.src_rect.set(0, 0, ts.width, ts.height / 2)
- qm.thought_bubble_tag = ts
- end
- end
- # overwrite
- def dispose_spriteset
- pop_message_dispose_spriteset
- #@quack_msg_speech_bubble_sprites.each {|s| s.dispose}
- #@quack_msg_thought_bubble_sprites.each {|s| s.dispose}
- #return unless @bubble_tag_sprite || @thought_bubble_tag_sprite
- #@bubble_tag_sprite.dispose
- #@thought_bubble_tag_sprite.dispose
- end
- # alias
- #alias quack_msg_dispose_all_windows dispose_all_windows
- #def dispose_all_windows
- # @quack_msgs.each {|m| m.dispose}
- # quack_msg_dispose_all_windows
- #end
- end
- #==============================================================================
- # ?! Scene_Battle
- #==============================================================================
- class Scene_Battle
- alias quack_update_basic update_basic
- def update_basic
- quack_update_basic
- @quack_msgs.each {|m|
- m.update
- if m.open?
- m.update_placement
- end
- }
- end
-
- alias yse_pop_create_message_window create_message_window
- def create_message_window
- yse_pop_create_message_window
- @face_window = Window_Message_Face.new
- @face_window.message_window = @message_window
- if YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
- @bubble_tag_sprite = Sprite.new
- @bubble_tag_sprite.visible = false
- @bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
- @bubble_tag_sprite.src_rect.set(0, 0, @bubble_tag_sprite.width, @bubble_tag_sprite.height / 2)
- @message_window.speech_bubble_tag = @bubble_tag_sprite
-
- @thought_bubble_tag_sprite = Sprite.new
- @thought_bubble_tag_sprite.visible = false
- @thought_bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:thought_bubble_tag_name])
- @thought_bubble_tag_sprite.src_rect.set(0, 0, @thought_bubble_tag_sprite.width, @thought_bubble_tag_sprite.height / 2)
- @message_window.thought_bubble_tag = @thought_bubble_tag_sprite
- end
- @message_window.face_window = @face_window
-
- quack_create_message_window
- end
-
- def quack_create_message_window
- @quack_msgs = []
- @quack_msg_speech_bubble_sprites = []
- @quack_msg_thought_bubble_sprites = []
- QUACK::MSG::MAX_MSGS.times do |i|
- qm = Window_Quack_Message.new($game_message.quack_msgs[i], 200-QUACK::MSG::MAX_MSGS+i)
- @quack_msgs.push(qm)
- ss = Sprite.new
- ss.visible = false
- ss.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:bubble_tag_name])
- ss.src_rect.set(0, 0, ss.width, ss.height / 2)
- qm.speech_bubble_tag = ss
- ts = Sprite.new
- ts.visible = false
- ts.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT2[:thought_bubble_tag_name])
- ts.src_rect.set(0, 0, ts.width, ts.height / 2)
- qm.thought_bubble_tag = ts
- end
- end
-
- alias yse_pop_dispose_spriteset dispose_spriteset
- def dispose_spriteset
- yse_pop_dispose_spriteset
- @quack_msg_speech_bubble_sprites.each {|s| s.dispose}
- @quack_msg_thought_bubble_sprites.each {|s| s.dispose}
- return unless @bubble_tag_sprite || @thought_bubble_tag_sprite
- @bubble_tag_sprite.dispose
- @thought_bubble_tag_sprite.dispose
- end
-
- alias quack_msg_dispose_all_windows dispose_all_windows
- def dispose_all_windows
- @quack_msgs.each {|m| m.dispose}
- quack_msg_dispose_all_windows
- end
- end
- #==============================================================================
- # ?! Game_Interpreter
- #==============================================================================
- class Game_Interpreter
- def command_101
- item = $data_items[20]
- if $imported["YEA-MessageSystem"]
- wait_for_message
- $game_message.face_name = @params[0]
- $game_message.face_index = @params[1]
- $game_message.background = @params[2]
- $game_message.position = @params[3]
-
- startindex = @index+1
- textline = @list[startindex].parameters[0].dup
- chatdur = 0
- textline.gsub!(/<cm:([^<>]*)>/i) { chatdur = $1.to_i;"" }
- $game_message.prepare_msg(chatdur) if chatdur != 0
- while continue_message_string?
- @index += 1
- if @list[@index].code == 401
- textline = @list[@index].parameters[0] unless @index == startindex
- if chatdur != 0; $game_message.add_chatter(textline)
- else; $game_message.add(textline)
- end
- end
- break if $game_message.texts.size >= Variable.message_rows
- end
- case next_event_code
- when 102
- @index += 1
- setup_choices(@list[@index].parameters)
- when 103
- @index += 1
- setup_num_input(@list[@index].parameters)
- when 104
- @index += 1
- setup_item_choice(@list[@index].parameters)
- end
- $game_message.fin_msg if chatdur != 0
- wait_for_message
- else
- wait_for_message
- $game_message.face_name = @params[0]
- $game_message.face_index = @params[1]
- $game_message.background = @params[2]
- $game_message.position = @params[3]
-
- startindex = @index+1
- textline = @list[startindex].parameters[0].dup
- chatdur = 0
- textline.gsub!(/<cm:([^<>]*)>/i) { chatdur = $1.to_i;"" }
- $game_message.prepare_msg(chatdur) if chatdur != 0
-
- while next_event_code == 401 # Text data
- @index += 1
- textline = @list[@index].parameters[0] unless @index == startindex
- if chatdur != 0; $game_message.add_chatter(textline)
- else; $game_message.add(textline)
- end
- end
- case next_event_code
- when 102 # Show Choices
- @index += 1
- setup_choices(@list[@index].parameters)
- when 103 # Input Number
- @index += 1
- setup_num_input(@list[@index].parameters)
- when 104 # Select Item
- @index += 1
- setup_item_choice(@list[@index].parameters)
- end
- $game_message.fin_msg if chatdur != 0
- wait_for_message
- end
- end
- # new
- def clear_chatter
- $game_message.clear_chatter
- end
- end
- #==============================================================================
- #
- # ?\ End of File
- #
- #==============================================================================
复制代码
|
|