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

Project1

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

[已经解决] 请教一下关于对话框显示行数和pop message的问题>.<

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1290
在线时间
52 小时
注册时间
2017-2-2
帖子
36
跳转到指定楼层
1
发表于 2018-10-6 17:16:02 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这里是脚本的小白,只会稍微改一点数值什么的……因为游戏嫌对话框太占地方了,所以把对话框修改了高度,只显示一行



但是这样的话和别人对话的效果就不太理想了


如果只显示一行感觉调查物品不会显得空太多位置显得很累赘>.<
但是对话的话既不太容易看出谁在和谁说话,又一次显示内容太少,所以打算改成用气泡对话框的样子,
但是用了pop message之后似乎又重新把对话框大小定义了,调查之后普通对话框又变回原来的样子了,但是这里并不知道应该怎么修改


这里是pop message的脚本,请教一下各位,应该怎么修改这个脚本,或者用别的什么办法,能让普通对话框依然是48的宽度,但是用气泡对话框时不受限制吗!
RUBY 代码复制
  1. #==============================================================================
  2. #
  3. # ▼ Yami Engine Ace - 气泡对话框
  4. # -- 最后更新: 2012.06.07
  5. # -- 使用难度: Normal
  6. # -- 需要脚本: 无
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YSE-PopMessage"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.06.07 - Fixed Compatible: YEA - Ace Message System.
  17. # 2012.05.11 - Fixed Message Position.
  18. #            - Remove Requirement: YSE - Fix Events Order.
  19. # 2012.05.07 - Fixed Face position.
  20. #            - Added Requirement: YSE - Fix Events Order.
  21. # 2012.04.06 - You can change Bubble Tag filename.
  22. # 2012.03.28 - Fixed Default Message Position and Sizes.
  23. # 2012.03.27 - Fixed Default Message.
  24. # 2012.03.27 - Added Bubble Tag.
  25. # 2012.03.25 - Fixed Escape Message.
  26. # 2012.03.24 - Fixed Battle Message.
  27. # 2012.03.24 - Rewrote script.
  28. #
  29. #==============================================================================
  30. # ▼ 介绍
  31. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  32. # 本脚本可以将对话框改变为气泡对话框,使用"BubbleTag"作为气泡标志图片,放在:
  33. # \Graphics\System 文件夹中.
  34. # 需要配合脚本:Yami Engine Ace - Bug修复: 事件ID顺序 一起使用.
  35. #==============================================================================
  36. # ▼ 安装方式
  37. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  38. # 打开脚本编辑器,将本脚本拷贝/复制到一个在▼ 插件脚本之下▼ Main之上的新
  39. # 脚本页/槽中.记得保存你的工程以使脚本生效.
  40. #
  41. # -----------------------------------------------------------------------------
  42. # 文本代码 - 可以在文字窗口中使用的代码.
  43. # -----------------------------------------------------------------------------
  44. #     代码:    效果:
  45. #    \bm[x]    - 在x号事件处显示气泡对话框. *注释
  46. #    \cbm      - 关闭气泡对话框效果.
  47. #
  48. #              *注释: 设定为 0 则会在角色处显示.
  49. #
  50. #==============================================================================
  51. # ▼ 兼容性
  52. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  53. # 本脚本仅为RPG Maker VX Ace编写.极不可能在无任何修改的情况下运行于RPG Maker VX.
  54. #
  55. #==============================================================================
  56.  
  57. module YSE
  58.   module POP_MESSAGE
  59.  
  60.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  61.     # - 视觉效果设置 -
  62.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  63.     LIMIT = { # 开始.
  64.       :limit_width    =>  0,  # 宽度限制,设定为0则无限制.
  65.       :limit_line     =>  2,  # 行数限制,设定为0则无限制.
  66.     } # 结束.
  67.  
  68.     POSITION = { # 开始.
  69.       :x_buffer       =>  0,   #调整气泡对话框的x坐标
  70.       :y_buffer       =>  -36, #调整气泡对话框的y坐标
  71.       :face_x_buffer  =>  -10,   #调整角色肖像图的x坐标
  72.       :face_y_buffer  =>  33,  #调整角色肖像图的y坐标
  73.       :tag_y_buffer   =>  -6,  #调整角色肖像图的y坐标
  74.       :name_x_buffer  =>  0, #调整名称窗口的x坐标,需要脚本 YEA - 文本系统.
  75.     } # 结束.
  76.  
  77.     EFFECT = { # 开始.
  78.       :fade_face       =>  true, #是否显示角色肖像图淡入效果
  79.       :move_face       =>  true, #是否显示角色肖像图移动效果
  80.       :use_bubble_tag  =>  true, #是否显示气泡标志图片
  81.       :bubble_tag_name => "BubbleTag",#气泡标志图片的文件名
  82.     } # 结束.
  83.  
  84.   end
  85. end
  86.  
  87. #==============================================================================
  88. # ▼ 编辑以下内容可能会出现电脑损坏、死机,电脑主人脑袋爆炸、昏迷、死亡或口臭
  89. # 所以编辑了后果自负。
  90. #==============================================================================
  91.  
  92. #==============================================================================
  93. # ■ Spriteset_Map
  94. #==============================================================================
  95.  
  96. class Spriteset_Map
  97.  
  98.   #--------------------------------------------------------------------------
  99.   # public instance variables
  100.   #--------------------------------------------------------------------------
  101.   attr_accessor :character_sprites
  102.  
  103. end # Spriteset_Map
  104.  
  105. #==============================================================================
  106. # ■ Window_Message_Face
  107. #==============================================================================
  108.  
  109. class Window_Message_Face < Window_Base
  110.  
  111.   #--------------------------------------------------------------------------
  112.   # initialize
  113.   #--------------------------------------------------------------------------
  114.   def initialize
  115.     super(0, 0, 120, 120)
  116.     self.opacity = 0
  117.     @face_name = ""
  118.     @face_index = 0
  119.     @move_x = 0
  120.     close
  121.   end
  122.  
  123.   #--------------------------------------------------------------------------
  124.   # message_window=
  125.   #--------------------------------------------------------------------------
  126.   def message_window=(window)
  127.     @message_window = window
  128.   end
  129.  
  130.   #--------------------------------------------------------------------------
  131.   # set_face
  132.   #--------------------------------------------------------------------------
  133.   def set_face
  134.     contents.clear
  135.     return unless @message_window
  136.     if !$game_message.face_name.empty?
  137.       draw_face($game_message.face_name, $game_message.face_index, 0, 0)
  138.       set_position
  139.       show_face
  140.     else
  141.       hide_face
  142.     end
  143.   end
  144.  
  145.   #--------------------------------------------------------------------------
  146.   # set_position
  147.   #--------------------------------------------------------------------------
  148.   def set_position
  149.     return unless @message_window
  150.     self.x = @message_window.x
  151.     self.y = @message_window.y - 96
  152.     self.x += YSE::POP_MESSAGE::POSITION[:face_x_buffer]
  153.     self.y += YSE::POP_MESSAGE::POSITION[:face_y_buffer]
  154.     self.y += (@message_window.real_lines - 1) * 24
  155.     self.z = @message_window.z + 1
  156.     if (@face_name != $game_message.face_name || @face_index != $game_message.face_index)
  157.       if YSE::POP_MESSAGE::EFFECT[:move_face]
  158.         @move_x = 30
  159.         self.x -= 30
  160.       end
  161.       @face_name = $game_message.face_name
  162.       @face_index = $game_message.face_index
  163.       self.contents_opacity = 0 if YSE::POP_MESSAGE::EFFECT[:fade_face]
  164.     end
  165.   end
  166.  
  167.   #--------------------------------------------------------------------------
  168.   # show_face
  169.   #--------------------------------------------------------------------------
  170.   def show_face
  171.     open
  172.   end
  173.  
  174.   #--------------------------------------------------------------------------
  175.   # hide_face
  176.   #--------------------------------------------------------------------------
  177.   def hide_face
  178.     contents.clear
  179.     close
  180.   end
  181.  
  182.   #--------------------------------------------------------------------------
  183.   # update
  184.   #--------------------------------------------------------------------------
  185.   def update
  186.     super
  187.     self.contents_opacity += 15 if self.contents_opacity < 255
  188.     unless @move_x <= 0
  189.       self.x += 2
  190.       @move_x -= 2
  191.     end
  192.   end
  193.  
  194. end # Sprite_Message_Face
  195.  
  196. #==============================================================================
  197. # ■ Window_Message
  198. #==============================================================================
  199.  
  200. class Window_Message < Window_Base
  201.  
  202.   #--------------------------------------------------------------------------
  203.   # new method: face_window=
  204.   #--------------------------------------------------------------------------
  205.   def face_window=(window)
  206.     @face_window = window
  207.   end
  208.  
  209.   #--------------------------------------------------------------------------
  210.   # new method: bubble_tag=
  211.   #--------------------------------------------------------------------------
  212.   def bubble_tag=(sprite)
  213.     @bubble_tag = sprite
  214.   end
  215.  
  216.   #--------------------------------------------------------------------------
  217.   # new method: message_escape_characters_pop_message
  218.   #--------------------------------------------------------------------------
  219.   def message_escape_characters_pop_message(result)
  220.     result.gsub!(/\eBM\[(\d+)\]/i) { event_pop_message_setup($1.to_i, false) }
  221.     result.gsub!(/\eBMF\[(\d+)\]/i) { event_pop_message_setup($1.to_i, true) }
  222.     result.gsub!(/\eCBM/i) { event_pop_message_setup(nil, false) }
  223.     result
  224.   end
  225.  
  226.   #--------------------------------------------------------------------------
  227.   # alias method: convert_escape_characters
  228.   #--------------------------------------------------------------------------
  229.   alias yse_convert_escape_characters_pm convert_escape_characters
  230.   def convert_escape_characters(text)
  231.     result = yse_convert_escape_characters_pm(text)
  232.     result = message_escape_characters_pop_message(result)
  233.     result
  234.   end
  235.  
  236.   #--------------------------------------------------------------------------
  237.   # new method: event_pop_message_setup
  238.   #--------------------------------------------------------------------------
  239.   def event_pop_message_setup(event_id, follower = false)
  240.     if follower && $game_player.followers[event_id].nil?
  241.       @event_pop_id = nil
  242.       @event_pop_follower = false
  243.       return ""
  244.     end
  245.     @event_pop_follower = follower
  246.     @event_pop_id = event_id
  247.     return ""
  248.   end
  249.  
  250.   #--------------------------------------------------------------------------
  251.   # new method: set_face_position
  252.   #--------------------------------------------------------------------------
  253.   def set_face_position
  254.     return unless SceneManager.scene_is?(Scene_Map)
  255.     return unless @event_pop_id
  256.     return unless @face_window
  257.     contents.clear
  258.     @face_window.set_face
  259.     return unless $imported["YEA-MessageSystem"]
  260.     return if @face_window.close?
  261.     #@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)
  262.   end
  263.  
  264.   #--------------------------------------------------------------------------
  265.   # alias method: new_page
  266.   #--------------------------------------------------------------------------
  267.   alias window_message_new_page_pm_yse new_page
  268.   def new_page(text, pos)
  269.     window_message_new_page_pm_yse(text, pos)
  270.     set_face_position
  271.   end
  272.  
  273.   #--------------------------------------------------------------------------
  274.   # alias method: close
  275.   #--------------------------------------------------------------------------
  276.   alias pop_message_close close
  277.   def close
  278.     pop_message_close
  279.     return unless SceneManager.scene_is?(Scene_Map)
  280.     return unless @event_pop_id
  281.     @event_pop_id = nil
  282.     @event_pop_follower = false
  283.     @face_window.hide_face
  284.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  285.     @bubble_tag.visible = false if @bubble_tag
  286.   end
  287.  
  288.   #--------------------------------------------------------------------------
  289.   # alias method: open_and_wait
  290.   #--------------------------------------------------------------------------
  291.   alias pop_message_open_and_wait open_and_wait
  292.   def open_and_wait
  293.     pop_message_open_and_wait
  294.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  295.     @bubble_tag.visible = true if @event_pop_id && @bubble_tag
  296.   end
  297.  
  298.   #--------------------------------------------------------------------------
  299.   # alias method: process_all_text
  300.   #--------------------------------------------------------------------------
  301.   alias pop_message_process_all_text process_all_text
  302.   def process_all_text
  303.     @event_pop_id = nil
  304.     convert_escape_characters($game_message.all_text)
  305.     update_placement
  306.     adjust_pop_message($game_message.all_text)
  307.     pop_message_process_all_text
  308.   end
  309.  
  310.   #--------------------------------------------------------------------------
  311.   # alias method: update_placement
  312.   #--------------------------------------------------------------------------
  313.   alias event_pop_message_update_placement update_placement
  314.   def update_placement
  315.     if SceneManager.scene_is?(Scene_Map)
  316.       if @event_pop_id.nil?
  317.         fix_default_message
  318.         event_pop_message_update_placement
  319.       elsif @event_pop_id == 0
  320.         character = $game_player
  321.         self.y = character.screen_y - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
  322.         self.x = character.screen_x - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
  323.         fix_position_bubble(character)
  324.         set_bubble_tag(character)
  325.       elsif @event_pop_id > 0
  326.         hash = @event_pop_follower ? $game_player.followers : $game_map.events
  327.         character = hash[@event_pop_id]
  328.         self.y = character.screen_y - self.height + YSE::POP_MESSAGE::POSITION[:y_buffer]
  329.         self.x = character.screen_x - self.width / 2 + YSE::POP_MESSAGE::POSITION[:x_buffer]
  330.         fix_position_bubble(character)
  331.         set_bubble_tag(character)
  332.       end
  333.     else
  334.       event_pop_message_update_placement
  335.     end
  336.   end
  337.  
  338.   #--------------------------------------------------------------------------
  339.   # new method: fix_default_message
  340.   #--------------------------------------------------------------------------
  341.   def fix_default_message
  342.     self.width = window_width
  343.     self.height = window_height
  344.     self.x = 0
  345.     @face_window.hide_face if @face_window
  346.     create_contents
  347.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  348.     @bubble_tag.visible = false if @bubble_tag
  349.   end
  350.  
  351.   #--------------------------------------------------------------------------
  352.   # new method: fix_position_bubble
  353.   #--------------------------------------------------------------------------
  354.   def fix_position_bubble(character)
  355.     end_x = self.x + self.width
  356.     end_y = self.y + self.height
  357.     self.x = 0 if self.x < 0
  358.     self.y = character.screen_y if self.y < 0
  359.     self.x = Graphics.width - self.width if end_x > Graphics.width
  360.     self.y = Graphics.height - self.height if end_y > Graphics.height
  361.   end
  362.  
  363.   #--------------------------------------------------------------------------
  364.   # new method: set_bubble_tag
  365.   #--------------------------------------------------------------------------
  366.   def set_bubble_tag(character)
  367.     return unless YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  368.     return unless @bubble_tag
  369.     up = self.y == character.screen_y
  370.     self.y += up ? @bubble_tag.height / 2 : -@bubble_tag.height / 2
  371.     @bubble_tag.x = character.screen_x - @bubble_tag.width / 2
  372.     if up
  373.       @bubble_tag.src_rect.set(0, @bubble_tag.height, @bubble_tag.width, @bubble_tag.height)
  374.       @bubble_tag.y = self.y - @bubble_tag.height - YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
  375.     else
  376.       @bubble_tag.src_rect.set(0, 0, @bubble_tag.width, @bubble_tag.height)
  377.       @bubble_tag.y = self.y + self.height + YSE::POP_MESSAGE::POSITION[:tag_y_buffer]
  378.     end
  379.   end
  380.  
  381.   #--------------------------------------------------------------------------
  382.   # new method: cal_number_line
  383.   #--------------------------------------------------------------------------
  384.   def cal_number_line(text)
  385.     result = 0
  386.     text.each_line { result += 1 }
  387.     return result
  388.   end
  389.  
  390.   #--------------------------------------------------------------------------
  391.   # new method: cal_width_line
  392.   #--------------------------------------------------------------------------
  393.   def cal_width_line(text)
  394.     result = 0
  395.     text.each_line { |line|
  396.       result = text_size(line).width if result < text_size(line).width
  397.     }
  398.     return result
  399.   end
  400.  
  401.   #--------------------------------------------------------------------------
  402.   # alias method: adjust_message_window_size
  403.   #--------------------------------------------------------------------------
  404.   if $imported["YEA-MessageSystem"]
  405.   alias yse_pop_message_adjust_message_window_size adjust_message_window_size
  406.   def adjust_message_window_size
  407.     start_name_window if @event_pop_id
  408.     return if @event_pop_id
  409.     yse_pop_message_adjust_message_window_size
  410.   end
  411.   end
  412.  
  413.   #--------------------------------------------------------------------------
  414.   # new method: adjust_pop_message
  415.   #--------------------------------------------------------------------------
  416.   def adjust_pop_message(text = " ")
  417.     return unless SceneManager.scene_is?(Scene_Map)
  418.     unless @event_pop_id
  419.       if $imported["YEA-MessageSystem"]
  420.         #adjust_message_window_size
  421.       end
  422.       return
  423.     end
  424.     n_line = cal_number_line(text)
  425.     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]
  426.     @real_lines = n_line
  427.     self.height = fitting_height(n_line)
  428.     self.width = cal_width_line(text) - 24
  429.     self.width += new_line_x
  430.     if self.width > YSE::POP_MESSAGE::LIMIT[:limit_width] && YSE::POP_MESSAGE::LIMIT[:limit_width] > 0
  431.       self.width = YSE::POP_MESSAGE::LIMIT[:limit_width]
  432.     end
  433.     create_contents
  434.     update_placement
  435.   end
  436.  
  437.   #--------------------------------------------------------------------------
  438.   # overwrite method: new_line_x
  439.   #--------------------------------------------------------------------------
  440.   def new_line_x
  441.     if $game_message.face_name.empty?
  442.       return 0
  443.     else
  444.       result = YSE::POP_MESSAGE::POSITION[:face_x_buffer]
  445.       p_x = $imported["YEA-MessageSystem"] ? YEA::MESSAGE::FACE_INDENT_X : 112
  446.       result += p_x
  447.       return result
  448.     end
  449.   end
  450.  
  451.   #--------------------------------------------------------------------------
  452.   # new method: real_lines
  453.   #--------------------------------------------------------------------------
  454.   def real_lines
  455.     @real_lines
  456.   end
  457.  
  458. end # Window_Message
  459.  
  460. #==============================================================================
  461. # ■ Scene_Map
  462. #==============================================================================
  463.  
  464. class Scene_Map < Scene_Base
  465.  
  466.   #--------------------------------------------------------------------------
  467.   # alias method: create_message_window
  468.   #--------------------------------------------------------------------------
  469.   alias yse_pm_create_message_window create_message_window
  470.   def create_message_window
  471.     yse_pm_create_message_window
  472.     @face_window = Window_Message_Face.new
  473.     @face_window.message_window = @message_window
  474.     if YSE::POP_MESSAGE::EFFECT[:use_bubble_tag]
  475.       @bubble_tag_sprite = Sprite.new
  476.       @bubble_tag_sprite.visible = false
  477.       @bubble_tag_sprite.bitmap = Cache.system(YSE::POP_MESSAGE::EFFECT[:bubble_tag_name])
  478.       @bubble_tag_sprite.src_rect.set(0, 0, @bubble_tag_sprite.width, @bubble_tag_sprite.height / 2)
  479.       @message_window.bubble_tag = @bubble_tag_sprite
  480.     end
  481.     @message_window.face_window = @face_window
  482.   end
  483.  
  484.   #--------------------------------------------------------------------------
  485.   # alias method: dispose_spriteset
  486.   #--------------------------------------------------------------------------
  487.   alias pop_message_dispose_spriteset dispose_spriteset
  488.   def dispose_spriteset
  489.     pop_message_dispose_spriteset
  490.     return unless @bubble_tag_sprite
  491.     @bubble_tag_sprite.dispose
  492.   end
  493.  
  494. end # Scene_Map
  495.  
  496. #==============================================================================
  497. #
  498. # ▼ End of File
  499. #
  500. #==============================================================================

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
21631
在线时间
9415 小时
注册时间
2012-6-19
帖子
7118

开拓者短篇九导演组冠军

2
发表于 2018-10-6 17:24:42 | 只看该作者
class Window_Message
  def visible_line_number
    return 1
  end
end

点评

超感谢!!  发表于 2018-10-6 17:29

评分

参与人数 1星屑 +100 收起 理由
VIPArcher + 100 我很赞同

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-11-17 02:51

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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