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

Project1

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

[已经解决] 噢漏,求解该fuki对话框为何使用文字直接消失会出错

[复制链接]

Lv3.寻梦者 (版主)

梦石
0
星屑
2305
在线时间
5538 小时
注册时间
2011-1-10
帖子
6619

青铜编剧史诗剧作家剧作品鉴家

跳转到指定楼层
1
发表于 2015-2-12 17:36:08 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我已经完全无解了,这出错忒奇怪了。

首先fuki基本原封不动,只是取消了“左方显示头像”的图像水平反转。然后根据注释,显示文章内输入\~会让对话框直接消失,但是实际运行会NoMethodError,如果在\~之前加上\!(等待玩家按下C键)的话就不会出错,但这明显毛用都没有啊……最后如果不使用\name[]和\p[]的话,也不会出错。问题是我是要将对话框显示在NPC头上的啊……

嗯,最后@正太君

脚本我实在没能力改了,只能拜托各位了

Project1.7z (224.02 KB, 下载次数: 33)

评分

参与人数 1星屑 +35 收起 理由
RyanBern + 35 手动认可奖励

查看全部评分

Lv4.逐梦者 (版主)

聪仔

梦石
0
星屑
6182
在线时间
3077 小时
注册时间
2013-12-26
帖子
3145
2
发表于 2015-2-12 21:13:22 | 只看该作者
本帖最后由 正太君 于 2015-2-12 21:14 编辑

Project1.rar (242.1 KB, 下载次数: 37)
凡是改过的地方都有# 聪聪 标识...
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. #——说明
  6.  
  7. #默认为一个字一个字的方式,如果需要一次全部显示,
  8. #请在游戏中使用脚本:$game_system.typing = true
  9.  
  10. #默认对话字没有声音,如果需要声音,
  11. #请在游戏中使用脚本:$game_system.soundname_on_speak = "这里输入文件名"
  12.   #我唯一一个见过“胡乱配音”的游戏是天使帝国2代,该游戏说话的时候每个字符随机发一个外星语音
  13.  
  14. # 其他在对话中可以使用的功能:
  15.  
  16. # \n[1]:显示1号角色的姓名
  17.  
  18. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  19.  
  20. # \p[1]:对话框出现在1号事件的上方
  21. # \p[0]:主人公上方出现对话框
  22. #——————————————————使用\p功能后可以自动调整对话框大小
  23.  
  24. # \\:显示"\"这个符号
  25.  
  26. # \v[1] :显示变量1
  27.  
  28. # \v[a1] :显示防具1
  29.  
  30. # \v[w1] :显示武器1
  31.  
  32. # \v[i1] :显示物品1
  33.  
  34. # \v[s1] :显示特技1
  35.  
  36. # \c[1-8]:更改颜色
  37.  
  38. # \g:显示金钱窗口
  39.  
  40. # \a[SE文件名]:对话的时候播放SE
  41.  
  42. # \s[1-19]:更改弹字的速度
  43.  
  44. # \.   :停顿一刹那(1、2帧)
  45. # \|   :停顿片刻(20帧)
  46.  
  47. # \>   :文字不用打字方式
  48. # \<   :文字使用打字方式
  49.  
  50. # \!   :等待玩家按回车再继续
  51. # \~   :文字直接消失
  52.  
  53. # \I   :下一行从这个位置开始
  54.  
  55. # \o[123]:文字透明度改为123,模拟将死之人(汗)
  56.  
  57. # \h[12]:改用12号字
  58.  
  59. # \b[50]:空50象素
  60.  
  61. # \K[今天天气不错]:在出现“今天天气不错”这几个字的时候播放$game_system.soundname_on_speak设置的音效
  62.  
  63. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  64. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  65.  
  66. # \Lk:清除左边的图像
  67. # \Rk:清除右边的图像
  68.  
  69.  
  70. #==============================================================================
  71. # ■ Game_System
  72. #------------------------------------------------------------------------------
  73. #  处理系统附属数据的类。也可执行诸如 BGM 管理之类的功能。本类的实例请参考
  74. # $game_system 。
  75. #==============================================================================
  76.  
  77. class Game_System
  78.   attr_accessor :typing
  79.   attr_accessor :soundname_on_speak
  80.   alias carol3_ini initialize
  81.   def initialize
  82.     carol3_ini
  83.     @typing = true
  84.     @soundname_on_speak = nil
  85.   end
  86. end
  87. $加密 = true
  88. $refresh = {}
  89. #==============================================================================
  90. # ■ Window_Message
  91. #------------------------------------------------------------------------------
  92. class Window_Message < Window_Selectable
  93.   Player_Name = 'pn' # 代表主角名字的字符
  94.   Size = 18
  95.   #--------------------------------------------------------------------------
  96.   # ● 初始化状态
  97.   #--------------------------------------------------------------------------
  98.   def initialize
  99.     super(80, 304, 480, 160)
  100.     self.contents = Bitmap.new(width - 32, height - 32)
  101.     self.visible = false
  102.     self.z = 9998
  103.     @fade_in = false
  104.     @fade_out = false
  105.     @contents_showing = false
  106.     @cursor_width = 0
  107.     self.active = false
  108.     self.index = -1
  109.     if $game_system.soundname_on_speak == nil then
  110.       $game_system.soundname_on_speak = ""
  111.     end
  112.     @opacity_text_buf = Bitmap.new(32, 32)
  113.   end
  114.   #--------------------------------------------------------------------------
  115.   # ● 释放
  116.   #--------------------------------------------------------------------------
  117.   def dispose
  118.     terminate_message
  119.     $game_temp.message_window_showing = false
  120.     if @input_number_window != nil
  121.       @input_number_window.dispose
  122.     end
  123.     super
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # ● 处理信息结束
  127.   #--------------------------------------------------------------------------
  128.   def terminate_message
  129.     $refresh["mess"] = false
  130.     self.active = false
  131.     self.pause = false
  132.     self.index = -1
  133.     self.contents.clear
  134.     # 清除显示中标志
  135.     @contents_showing = false
  136.     # 呼叫信息调用
  137.     if $game_temp.message_proc != nil
  138.       $game_temp.message_proc.call
  139.     end
  140.     # 清除文章、选择项、输入数值的相关变量
  141.     $game_temp.message_text = nil
  142.     $game_temp.message_proc = nil
  143.     $game_temp.choice_start = 99
  144.     $game_temp.choice_max = 0
  145.     $game_temp.choice_cancel_type = 0
  146.     $game_temp.choice_proc = nil
  147.     $game_temp.num_input_start = 99
  148.     $game_temp.num_input_variable_id = 0
  149.     $game_temp.num_input_digits_max = 0
  150.     # 开放金钱窗口
  151.     if @gold_window != nil
  152.       @gold_window.dispose
  153.       @gold_window = nil
  154.     end
  155.     if @name_window_text != nil
  156.       @name_window_text.dispose
  157.       @name_window_text = nil
  158.     end
  159.     if @right_picture != nil and @right_keep == true
  160.       @right_picture.dispose
  161.     end   
  162.     if @left_picture != nil and @left_keep == true
  163.       @left_picture.dispose
  164.     end
  165.     if @bar != nil
  166.       @bar.dispose
  167.     end
  168.     @k_tale.bitmap.dispose if @k_tale.bitmap if @k_tale # 聪聪
  169.     @k_tale.dispose if @k_tale # 聪聪
  170.   end
  171.   def refresh
  172.     $refresh["mess"] = true
  173.     # 初期化
  174.     self.contents.clear
  175.     self.contents.font.color = normal_color
  176.     self.contents.font.size = Size#Font.default_size
  177.     @x = @y = @max_x = @max_y = @indent = @lines = 0
  178.     @left_keep = @right_keep = false
  179.     @face_indent = 0
  180.     @opacity = 255
  181.     @cursor_width = 0
  182.     @write_speed = 0
  183.     @write_wait = 0
  184.     @mid_stop = false
  185.     @face_file = nil
  186.     @popchar = -2
  187.     if $game_temp.choice_start == 0
  188.       @x = 8
  189.     end
  190.     if $game_temp.message_text != nil
  191.       @now_text = $game_temp.message_text
  192.       #——头像设置
  193.       if (/\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
  194.         @face_file = $1 + ".png"
  195.         @x = @face_indent = 128
  196.         if FileTest.exist?("Graphics/Pictures/" + $1 + ".png")
  197.           self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  198.         end
  199.         @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
  200.       end
  201.       #——左半身像设置
  202.       if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  203.         @face = $1
  204.         if $加密 == true
  205.           if @left_picture != nil
  206.             @left_picture.dispose
  207.           end
  208.           @left_picture = Sprite.new
  209.           @left_picture.bitmap = Bitmap.new("Graphics/Faces/#{@face}")
  210.           @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  211.           @left_picture.x = 0
  212.           #@left_picture.mirror = true
  213.           @x = @face_indent = @left_picture.bitmap.width
  214.           @left_keep = true
  215.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  216.         else         
  217.           if FileTest.exist?("Graphics/Faces/#{@face}")
  218.             if @left_picture != nil
  219.               @left_picture.dispose
  220.             end
  221.             @left_picture = Sprite.new
  222.             @left_picture.bitmap = Bitmap.new("Graphics/Faces/#{@face}")
  223.             @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  224.             @left_picture.x = 0
  225.             #@left_picture.mirror = true
  226.             @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  227.           end
  228.         end        
  229.       end
  230.       #——右半身像设置
  231.       if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  232.         @face = $1
  233.         if $加密 == true
  234.           if @right_picture != nil
  235.             @right_picture.dispose
  236.           end
  237.           @right_picture = Sprite.new
  238.           @right_picture.bitmap = Bitmap.new("Graphics/Faces/#{@face}")
  239.           @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  240.           @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  241.           @right_keep = true
  242.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  243.         else
  244.           if FileTest.exist?("Graphics/Faces/#{@face}")
  245.             if @right_picture != nil
  246.               @right_picture.dispose
  247.             end
  248.             @right_picture = Sprite.new
  249.             @right_picture.bitmap = Bitmap.new("Graphics/Faces/#{@face}")
  250.             @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  251.             @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  252.             @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  253.           end
  254.         end
  255.       end
  256.       if (/\\[Rr]k/.match(@now_text)) != nil
  257.         @right_keep = true
  258.         @now_text.sub!(/\\[Rr]k/) { "" }
  259.       end
  260.       if (/\\[Ll]k/.match(@now_text)) != nil
  261.         @left_keep = true
  262.         @now_text.sub!(/\\[Ll]k/) { "" }
  263.       end
  264.       # 显示人物姓名
  265.       name_window_set = false
  266.       if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
  267.         name_window_set = true
  268.         name_text = $1
  269.         @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  270.       end
  271.  
  272.       # 文字位置的判定
  273.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  274.         @popchar = $1.to_i
  275.         if @popchar == -1
  276.           @x = @indent = 48
  277.           @y = 4
  278.         end
  279.         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  280.       end
  281.  
  282.       # 开始
  283.       begin
  284.         last_text = @now_text.clone
  285.         @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  286.       end until @now_text == last_text
  287.       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  288.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  289.     end
  290.     @now_text.gsub!(/\\\\/) { "\000" }
  291.     @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  292.     @now_text.gsub!(/\\[Gg]/) { "\002" }
  293.     @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  294.     @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  295.     @now_text.gsub!(/\\[.]/) { "\005" }
  296.     @now_text.gsub!(/\\[|]/) { "\006" }
  297.  
  298.     @now_text.gsub!(/\\[>]/) { "\016" }
  299.     @now_text.gsub!(/\\[<]/) { "\017" }
  300.     @now_text.gsub!(/\\[!]/) { "\020" }
  301.     @now_text.gsub!(/\\[~]/) { "\021" }
  302.  
  303.     @now_text.gsub!(/\\[Ii]/) { "\023" }
  304.     @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  305.     @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  306.     @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  307.     @now_text.gsub!(/\\[Kk]\[(.*?)\]/) { "\027[#{$1}]" }
  308.  
  309.  
  310.  
  311.     if @popchar >= 0
  312.       @text_save = @now_text.clone
  313.       @max_x = 0
  314.       @max_y = 4
  315.       for i in 0..3
  316.         line = @now_text.split(/\n/)[3-i]
  317.         @max_y -= 1 if line == nil and @max_y <= 4-i
  318.         next if line == nil
  319.         contents.font.size = Size
  320.         cx = contents.text_size(line).width
  321.         @max_x = cx if cx > @max_x
  322.       end
  323.       if @right_picture != nil and !@right_picture.disposed?
  324.         self.width = @max_x + 48 + @face_indent + @right_picture.bitmap.width
  325.       else
  326.         self.width = @max_x + 48 + @face_indent
  327.       end
  328.       if $game_temp.num_input_variable_id > 0
  329.         self.height = (@max_y - 1) * 20 + 96 + 8
  330.       else
  331.         self.height = (@max_y - 1) * 20 + 64
  332.       end
  333.     else
  334.       @max_x = self.width - 32 - @face_indent
  335.     end
  336.     reset_window
  337.       if name_window_set
  338.         off_x = 0
  339.         off_y = -40
  340.         space = 2
  341.         x = self.x + off_x - space / 2
  342.         y = self.y + off_y - space / 2
  343.         w = self.contents.text_size(name_text).width + 26 + space
  344.         h = 40 + space
  345.         x = self.x + off_x + 4
  346.         y = self.y + off_y
  347.         if name_text == Player_Name
  348.           name_text = $game_actors[1].name
  349.         end
  350.         @name_window_text = Air_Text.new(self.x + @face_indent+4+8, self.y+16, name_text)
  351.         @name_window_text.z = self.z + 2
  352.         @bar = Sprite.new
  353.         @bar.bitmap = Bitmap.new(self.width,self.height)
  354.         @bar.x = self.x
  355.         @bar.y = self.y
  356.         @bar.z = self.z + 2
  357.         @bar.bitmap.fill_rect(8,16,self.width-16,24,Color.new(120,180,250,80))
  358.       end
  359.     end
  360.     reset_window
  361.     if $game_temp.choice_max > 0
  362.       @item_max = $game_temp.choice_max
  363.       self.active = true
  364.       self.index = 0
  365.     end
  366.     if $game_temp.num_input_variable_id > 0
  367.       digits_max = $game_temp.num_input_digits_max
  368.       number = $game_variables[$game_temp.num_input_variable_id]
  369.       @input_number_window = Window_InputNumber.new(digits_max)
  370.       @input_number_window.number = number
  371.       @input_number_window.x = self.x + @face_indent
  372.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  373.     end
  374.   end
  375.   #--------------------------------------------------------------------------
  376.   # ● 更新
  377.   #--------------------------------------------------------------------------
  378.   def update
  379.     super
  380.  
  381.       if @k_tale != nil
  382.         character = get_character(@popchar)
  383.         x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  384.         y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  385.         self.x = x
  386.         self.y = y
  387.        #kk
  388.         @k_tale.x = ( character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16 unless @k_tale.disposed? # 聪聪
  389.         @k_tale.y = self.y + self.height - 16 unless @k_tale.disposed? # 聪聪
  390.         if @left_picture != nil and !@left_picture.disposed?
  391.           @left_picture.x = x+8
  392.           @left_picture.y = y - @left_picture.bitmap.height + self.height - 8
  393.         end
  394.         if @right_picture != nil and !@right_picture.disposed?
  395.           @right_picture.x = x+[email]self.width-@right_picture.bitmap.width[/email]-8
  396.           @right_picture.y = y - @right_picture.bitmap.height + self.height - 8
  397.         end
  398.         @name_window_text.x = self.x + @face_indent -4 if @name_window_text # 聪聪
  399.         @name_window_text.y = self.y if @name_window_text # 聪聪
  400.         @bar.x = self.x unless @bar.disposed? # 聪聪
  401.         @bar.y = self.y unless @bar.disposed? # 聪聪
  402.     end
  403.  
  404.     if @fade_in
  405.       self.contents_opacity += 24
  406.       if @input_number_window != nil
  407.         @input_number_window.contents_opacity += 24
  408.       end
  409.       if self.contents_opacity == 255
  410.         @fade_in = false
  411.       end
  412.       return
  413.     end
  414.     @now_text = nil if @now_text == ""
  415.     if @now_text != nil and @mid_stop == false
  416.       if @write_wait > 0
  417.         @write_wait -= 1
  418.         return
  419.       end
  420.       text_not_skip = $game_system.typing
  421.       while true
  422.         @max_x = @x if @max_x < @x
  423.         @max_y = @y if @max_y < @y
  424.         if (c = @now_text.slice!(/./m)) != nil
  425.           if c == "\000"
  426.             c = "\\"
  427.           end
  428.           if c == "\001"
  429.             @now_text.sub!(/\[([0-9]+)\]/, "")
  430.             color = $1.to_i
  431.             if color >= 0 and color <= 7
  432.               self.contents.font.color = text_color(color)
  433.             end
  434.             c = ""
  435.           end
  436.           if c == "\002"
  437.             if @gold_window == nil and @popchar <= 0
  438.               @gold_window = Window_Gold.new
  439.               @gold_window.x = 560 - @gold_window.width
  440.               if $game_temp.in_battle
  441.                 @gold_window.y = 192
  442.               else
  443.                 @gold_window.y = self.y >= 128 ? 32 : 384
  444.               end
  445.               @gold_window.opacity = self.opacity
  446.               @gold_window.back_opacity = self.back_opacity
  447.             end
  448.             c = ""
  449.           end
  450.           if c == "\003"
  451.             @now_text.sub!(/\[([0-9]+)\]/, "")
  452.             speed = $1.to_i
  453.             if speed >= 0 and speed <= 19
  454.               @write_speed = speed
  455.             end
  456.             c = ""
  457.           end
  458.           if c == "\004"
  459.             @now_text.sub!(/\[(.*?)\]/, "")
  460.             buftxt = $1.dup.to_s
  461.             if buftxt.match(/\//) == nil and buftxt != "" then
  462.               $game_system.soundname_on_speak = "Audio/SE/" + buftxt
  463.             else
  464.               $game_system.soundname_on_speak = buftxt.dup
  465.             end
  466.             c = ""
  467.           elsif c == "\004"
  468.             c = ""
  469.           end
  470.           if c == "\005"
  471.             @write_wait += 5
  472.             c = ""
  473.           end
  474.           if c == "\006"
  475.             @write_wait += 20
  476.             c = ""
  477.           end
  478.           if c == "\016"
  479.             text_not_skip = false
  480.             c = ""
  481.           end
  482.           if c == "\017"
  483.             text_not_skip = true
  484.             c = ""
  485.           end
  486.           if c == "\020"
  487.             @mid_stop = true
  488.             c = ""
  489.           end
  490.           if c == "\021"
  491.             terminate_message
  492.             return
  493.           end
  494.           if c == "\023"
  495.             @indent = @x
  496.             c = ""
  497.           end
  498.           if c == "\024"
  499.             @now_text.sub!(/\[([0-9]+)\]/, "")
  500.             @opacity = $1.to_i
  501.             c = ""
  502.           end
  503.           if c == "\025"
  504.             @now_text.sub!(/\[([0-9]+)\]/, "")
  505.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  506.             c = ""
  507.           end
  508.           if c == "\026"
  509.             @now_text.sub!(/\[([0-9]+)\]/, "")
  510.             @x += $1.to_i
  511.             c = ""
  512.           end
  513.           if c == "\027"
  514.             @now_text.sub!(/\[(.*?)\]/, "")
  515.             @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  516.             if $game_system.soundname_on_speak != ""
  517.               Audio.se_play($game_system.soundname_on_speak)
  518.             end
  519.             c = ""
  520.           end
  521.           if c == "\030"
  522.             @now_text.sub!(/\[(.*?)\]/, "")
  523.             self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  524.            if $game_system.soundname_on_speak != ""
  525.               Audio.se_play($game_system.soundname_on_speak)
  526.             end
  527.             @x += 24
  528.             c = ""
  529.           end
  530.           if c == "\n"
  531.             if @lines >= $game_temp.choice_start
  532.               @cursor_width = [@cursor_width, @max_x - @face_indent].max
  533.             end
  534.             @lines += 1
  535.             @y += 1
  536.             @x = 0 + @indent + @face_indent
  537.             if @lines >= $game_temp.choice_start
  538.               @x = 8 + @indent + @face_indent
  539.             end
  540.             c = ""
  541.           end
  542.           if c != ""
  543.             # 文字描画
  544.             self.contents.font.size = Size
  545.             @x += opacity_draw_text(self.contents, @x, 8+@y * line_height + (line_height - self.contents.font.size), c, @opacity)
  546.             if $game_system.soundname_on_speak != "" then
  547.             Audio.se_play($game_system.soundname_on_speak)
  548.             end
  549.           end
  550.           if Input.press?(Input::B)
  551.             text_not_skip = false
  552.           end
  553.         else
  554.           text_not_skip = true
  555.           break
  556.         end
  557.         # 終了判定
  558.         if text_not_skip
  559.           break
  560.         end
  561.       end
  562.       @write_wait += @write_speed
  563.       return
  564.     end
  565.     if @input_number_window != nil
  566.       @input_number_window.update
  567.       # 決定
  568.       if Input.trigger?(Input::C)
  569.         $game_system.se_play($data_system.decision_se)
  570.         $game_variables[$game_temp.num_input_variable_id] =
  571.         @input_number_window.number
  572.         $game_map.need_refresh = true
  573.         @input_number_window.dispose
  574.         @input_number_window = nil
  575.         terminate_message
  576.       end
  577.       return
  578.     end
  579.     if @contents_showing
  580.       if $game_temp.choice_max == 0
  581.         self.pause = true
  582.       end
  583.       # 取消
  584.       if Input.trigger?(Input::B)
  585.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  586.           $game_system.se_play($data_system.cancel_se)
  587.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  588.           terminate_message
  589.         end
  590.       end
  591.       # 決定
  592.       if Input.trigger?(Input::C)
  593.          if @k_tale != nil  
  594.           @k_tale.dispose
  595.           @k_tale = nil
  596.          end
  597.         if $game_temp.choice_max > 0
  598.           $game_system.se_play($data_system.decision_se)
  599.           $game_temp.choice_proc.call(self.index)
  600.         end
  601.         if @mid_stop
  602.           @mid_stop = false
  603.           return
  604.         else
  605.           terminate_message
  606.         end
  607.       end
  608.       return
  609.     end
  610.     if @fade_out == false and $game_temp.message_text != nil
  611.       @contents_showing = true
  612.       $game_temp.message_window_showing = true
  613.       refresh
  614.       Graphics.frame_reset
  615.       self.visible = true
  616.       self.contents_opacity = 0
  617.     if @input_number_window != nil
  618.       @input_number_window.contents_opacity = 0
  619.     end
  620.       @fade_in = true
  621.       return
  622.     end
  623.     if self.visible
  624.       @fade_out = true
  625.       self.opacity -= 48
  626.       if self.opacity == 0
  627.         self.visible = false
  628.         @fade_out = false
  629.         $game_temp.message_window_showing = false
  630.       end
  631.       return
  632.     end
  633.   end
  634.   #--------------------------------------------------------------------------
  635.   # ● 获得字符
  636.   #--------------------------------------------------------------------------
  637.   def get_character(parameter)
  638.     case parameter
  639.     when 0
  640.       return $game_player
  641.     else
  642.       events = $game_map.events
  643.       return events == nil ? nil : events[parameter]
  644.     end
  645.   end
  646.   #--------------------------------------------------------------------------
  647.   # ● ウィンドウの位置と不透明度の設定
  648.   #--------------------------------------------------------------------------
  649.   def reset_window
  650.     # 判定
  651.     if @k_tale != nil  
  652.       @k_tale.dispose
  653.       @k_tale = nil
  654.     end
  655.     if @popchar >= 0
  656.       events = $game_map.events
  657.       if events != nil
  658.         character = get_character(@popchar)
  659.         x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  660.         y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  661.         self.x = x
  662.         self.y = y
  663.        #kk
  664.         @k_tale = Sprite.new
  665.         @k_tale.bitmap = RPG::Cache.windowskin("001-Blue01-top")
  666.         @k_tale.x = ( character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 16
  667.         @k_tale.y = self.y + self.height - 16
  668.         @k_tale.z = 9999
  669.         if @left_picture != nil and !@left_picture.disposed?
  670.           @left_picture.x = x+8
  671.           @left_picture.y = y - @left_picture.bitmap.height + self.height - 8
  672.           @left_picture.z += self.z
  673.         end
  674.         if @right_picture != nil and !@right_picture.disposed?
  675.           @right_picture.x = x+[email]self.width-@right_picture.bitmap.width[/email]-8
  676.           @right_picture.y = y - @right_picture.bitmap.height + self.height - 8
  677.           @right_picture.z += self.z
  678.         end
  679.       end
  680.     elsif @popchar == -1
  681.       self.x = -4
  682.       self.y = -4
  683.       self.width = 648
  684.       self.height = 488
  685.     else
  686.       if $game_temp.in_battle
  687.         self.y = 16
  688.       else
  689.         case $game_system.message_position
  690.         when 0 # 上
  691.           self.y = 16
  692.         when 1 # 中
  693.           self.y = 160
  694.         when 2 # 下
  695.           self.y = 304
  696.         end
  697.         self.x = 320-self.width/2#80
  698.         if @face_file == nil
  699.           self.width = 480*0.8
  700.         else
  701.           self.width = 600
  702.           self.x -= 60
  703.         end
  704.         self.height = 160*0.8
  705.       end
  706.     end
  707.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  708.     if @face_file != nil
  709.       self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  710.     end
  711.     if @popchar == -1
  712.       self.opacity = 255
  713.       self.back_opacity = 0
  714.     elsif $game_system.message_frame == 0
  715.       self.opacity = 255
  716.       self.back_opacity = 200
  717.     else
  718.       self.opacity = 0
  719.       self.back_opacity = 200
  720.     end
  721.   end
  722.   #--------------------------------------------------------------------------
  723.   # ● line_height
  724.   #--------------------------------------------------------------------------
  725.   # 返回値:行高
  726.   #--------------------------------------------------------------------------
  727.   def line_height
  728.     return 20
  729.     if self.contents.font.size >= 20 and self.contents.font.size <= 24
  730.       return 20
  731.     else
  732.       return self.contents.font.size * 15 / 10
  733.     end
  734.   end
  735.   #--------------------------------------------------------------------------
  736.   # ● 透過文字描画
  737.   #--------------------------------------------------------------------------
  738.   # target :描画対象。Bitmapクラスを指定。
  739.   # x :x座標
  740.   # y :y座標
  741.   # str  :描画文字列
  742.   # opacity:透過率(0~255)
  743.   # 返回値 :文字幅(@x増加値)。
  744.   #--------------------------------------------------------------------------
  745.   def opacity_draw_text(target, x, y, str,opacity)
  746.     height = target.font.size
  747.     width = target.text_size(str).width
  748.     opacity = [[opacity, 0].max, 255].min
  749.     if opacity == 255
  750.       target.draw_text(x, y, width, height, str)
  751.       return width
  752.     else
  753.       if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  754.         @opacity_text_buf.dispose
  755.         @opacity_text_buf = Bitmap.new(width, height)
  756.       else
  757.         @opacity_text_buf.clear
  758.       end
  759.       @opacity_text_buf.font.size = target.font.size
  760.       @opacity_text_buf.draw_text(0, 0, width, height, str)
  761.       target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  762.     return width
  763.     end
  764.   end
  765.   def ruby_draw_text(target, x, y, str,opacity)
  766.     sizeback = target.font.size
  767.     target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  768.     rubysize = [rubysize, 6].max
  769.  
  770.     opacity = [[opacity, 0].max, 255].min
  771.     split_s = str.split(/,/)
  772.  
  773.     split_s[0] == nil ? split_s[0] = "" : nil
  774.     split_s[1] == nil ? split_s[1] = "" : nil
  775.  
  776.     height = sizeback + rubysize
  777.     width = target.text_size(split_s[0]).width
  778.  
  779.     target.font.size = rubysize
  780.     ruby_width = target.text_size(split_s[1]).width
  781.     target.font.size = sizeback
  782.  
  783.     buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  784.  
  785.     width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  786.  
  787.     if opacity == 255
  788.       target.font.size = rubysize
  789.       target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  790.       target.font.size = sizeback
  791.       target.draw_text(x, y, width, target.font.size, split_s[0])
  792.       return width
  793.     else
  794.       if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  795.         @opacity_text_buf.dispose
  796.         @opacity_text_buf = Bitmap.new(buf_width, height)
  797.       else
  798.         @opacity_text_buf.clear
  799.       end
  800.       @opacity_text_buf.font.size = rubysize
  801.       @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  802.       @opacity_text_buf.font.size = sizeback
  803.       @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  804.       if sub_x >= 0
  805.         target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  806.       else
  807.         target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  808.       end
  809.       return width
  810.     end
  811.   end
  812.   #--------------------------------------------------------------------------
  813.   # ● \V 变换
  814.   #--------------------------------------------------------------------------
  815.   def convart_value(option, index)
  816.     option == nil ? option = "" : nil
  817.     option.downcase!
  818.     case option
  819.       when "i"
  820.         unless $data_items[index].name == nil
  821.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  822.         end
  823.       when "w"
  824.         unless $data_weapons[index].name == nil
  825.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  826.         end
  827.       when "a"
  828.         unless $data_armors[index].name == nil
  829.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  830.         end
  831.       when "s"
  832.         unless $data_skills[index].name == nil
  833.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  834.         end
  835.       else
  836.       r = $game_variables[index]
  837.     end
  838.     r == nil ? r = "" : nil
  839.     return r
  840.   end
  841.   #--------------------------------------------------------------------------
  842.   # ● 解放
  843.   #--------------------------------------------------------------------------
  844.   def dispose
  845.     terminate_message
  846.     if @gaiji_cache != nil
  847.       unless @gaiji_cache.disposed?
  848.         @gaiji_cache.dispose
  849.       end
  850.     end
  851.     unless @opacity_text_buf.disposed?
  852.       @opacity_text_buf.dispose
  853.     end
  854.     $game_temp.message_window_showing = false
  855.     if @input_number_window != nil
  856.       @input_number_window.dispose
  857.     end
  858.     super
  859.   end
  860.   #--------------------------------------------------------------------------
  861.   # ● 矩形更新
  862.   #--------------------------------------------------------------------------
  863.   def update_cursor_rect
  864.     if @index >= 0
  865.       n = $game_temp.choice_start + @index
  866.       self.cursor_rect.set(4 + @indent + @face_indent, n * 20 + 10, @cursor_width, 20)
  867.     else
  868.       self.cursor_rect.empty
  869.     end
  870.   end
  871. end
  872. #==============================================================================
  873. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  874. #==============================================================================
  875. class Window_Frame < Window_Base
  876.   #--------------------------------------------------------------------------
  877.   # ● オブジェクト初期化
  878.   #--------------------------------------------------------------------------
  879.   def initialize(x, y, width, height)
  880.     super(x, y, width, height)
  881.     self.contents = nil
  882.     self.back_opacity = 200
  883.   end
  884.   #--------------------------------------------------------------------------
  885.   # ● 解放
  886.   #--------------------------------------------------------------------------
  887.   def dispose
  888.     super
  889.     end
  890.   end
  891. #==============================================================================
  892. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  893. #==============================================================================
  894. class Air_Text < Window_Base
  895.   #--------------------------------------------------------------------------
  896.   # ● オブジェクト初期化
  897.   #--------------------------------------------------------------------------
  898.   def initialize(x, y, designate_text)
  899.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  900.     self.opacity = 0
  901.     self.back_opacity = 0
  902.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  903.     self.contents.font.size = 20
  904.     w = self.contents.width
  905.     h = self.contents.height
  906.     self.contents.draw_text(0, 0, w, h, designate_text)
  907.   end
  908.   #--------------------------------------------------------------------------
  909.   # ● 解放
  910.   #--------------------------------------------------------------------------
  911.   def dispose
  912.     self.contents.clear
  913.     super
  914.   end
  915. end
  916.  
  917. #==============================================================================
  918. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  919. #==============================================================================

点评

虽然脚本会报错,但经过我二次修改终于成功了,谢谢聪聪啦∑(っ °▽ °)っ  发表于 2015-2-12 22:29
果然出错的那几个位置基本被我猜中了,但是没能力改_:(´ཀ`」 ∠):_我先下来看看  发表于 2015-2-12 22:20

评分

参与人数 2星屑 +67 梦石 +1 收起 理由
RyanBern + 1 认可答案
H·H·Y + 67 只剩这么多了……

查看全部评分

聪聪全国第三帅...
他们都叫我【人赢聪】
我的RM能力雷达图:

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-1 12:31

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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