查看: 7843|回复: 10

[已经解决] 关于XP对话框显示头像问题

[复制链接]
梦石
0
星屑
1166
在线时间
127 小时
注册时间
2013-2-16
回帖
368
发表于 2013-2-26 18:55:19 | 显示全部楼层 |阅读模式

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

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

×
  伸手党来也!!!
  想用一个不麻烦的东西来显示对话框中的头像,记住,不要对我说“Fuki对话框”脚本,太麻烦了!
梦石
0
星屑
63
在线时间
246 小时
注册时间
2012-4-4
回帖
198
发表于 2013-2-26 18:58:55 | 显示全部楼层
好像主站上有。。。
6R,好久不见。
回复

使用道具 举报

梦石
0
星屑
1166
在线时间
127 小时
注册时间
2013-2-16
回帖
368
 楼主| 发表于 2013-2-26 19:33:44 | 显示全部楼层
水终结者 发表于 2013-2-26 18:58
好像主站上有。。。

找了很长事件都没找到,你截个图!
回复

使用道具 举报

万兽

梦石
0
星屑
602
在线时间
2271 小时
注册时间
2006-11-4
回帖
4701

贵宾

发表于 2013-2-26 22:01:35 | 显示全部楼层
直接显示图片不就好了。
回复

使用道具 举报

梦石
0
星屑
920
在线时间
194 小时
注册时间
2012-6-1
回帖
681
发表于 2013-2-27 02:52:21 | 显示全部楼层
LZ是伸手党
鉴定完毕
LZ可以试试66对话加强
死亡
回复

使用道具 举报

梦石
0
星屑
3181
在线时间
1439 小时
注册时间
2009-7-27
回帖
1187
发表于 2013-2-27 05:54:43 | 显示全部楼层
太麻烦?直接公共事件显示各个人物的头像就好了。连脚本都不用了呢

博客:我的博客
回复

使用道具 举报

梦石
0
星屑
63
在线时间
246 小时
注册时间
2012-4-4
回帖
198
发表于 2013-3-1 18:12:54 | 显示全部楼层
1715063941 发表于 2013-2-27 02:52
LZ是伸手党
鉴定完毕
LZ可以试试66对话加强

加强好像没这个功能
6R,好久不见。
回复

使用道具 举报

梦石
0
星屑
63
在线时间
246 小时
注册时间
2012-4-4
回帖
198
发表于 2013-3-1 18:20:34 | 显示全部楼层
本帖最后由 水终结者 于 2013-3-1 18:21 编辑


用这个:
  1. #——说明

  2. #默认为一个字一个字的方式,如果需要一次全部显示,
  3. #请在游戏中使用脚本:$game_system.typing = true
  4.       
  5. #默认对话字没有声音,如果需要声音,
  6. #请在游戏中使用脚本:$game_system.soundname_on_speak = "这里输入文件名"
  7.   #我唯一一个见过“胡乱配音”的游戏是天使帝国2代,该游戏说话的时候每个字符随机发一个外星语音

  8. # 其他在对话中可以使用的功能:
  9.   
  10. # \n[1]:显示1号角色的姓名

  11. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名

  12. # \p[1]:对话框出现在1号事件的上方
  13. # \p[0]:主人公上方出现对话框
  14. #——————————————————使用\p功能后可以自动调整对话框大小

  15. # \\:显示""这个符号

  16. # \c[1-8]:更改颜色

  17. # \g:显示金钱窗口

  18. # \a[SE文件名]:对话的时候播放SE

  19. # \s[1-19]:更改弹字的速度

  20. # \.   :停顿一刹那(1、2帧)
  21. # \|   :停顿片刻(20帧)

  22. # \>   :文字不用打字方式
  23. # \<   :文字使用打字方式

  24. # \!   :等待玩家按回车再继续
  25. # \~   :文字直接消失

  26. # \I   :下一行从这个位置开始

  27. # \o[123]:文字透明度改为123,模拟将死之人(汗)

  28. # \h[12]:改用12号字

  29. # \b[50]:空50象素

  30. # \K[今天天气不错]:在出现“今天天气不错”这几个字的时候播放$game_system.soundname_on_speak设置的音效

  31. # \L[001]:在左边显示图片“Graphics/battlers/001.png”
  32. # \R[001]:在右边显示图片“Graphics/battlers/001.png”

  33. # \Lk:清除左边的图像
  34. # \Rk:清除右边的图像

  35. class Game_System
  36.   attr_accessor :typing
  37.   attr_accessor :soundname_on_speak
  38.   alias carol3_ini initialize
  39.   def initialize
  40.     carol3_ini
  41.     @typing = true
  42.     @soundname_on_speak = nil
  43.   end   
  44. end

  45. #==============================================================================
  46. # ■ Window_Message
  47. #------------------------------------------------------------------------------
  48. class Window_Message < Window_Selectable
  49.   #--------------------------------------------------------------------------
  50.   # ● 初始化状态
  51.   #--------------------------------------------------------------------------
  52.   def initialize
  53.     super(80, 304, 480, 160)
  54.     self.contents = Bitmap.new(width - 32, height - 32)
  55.     self.visible = false
  56.     self.z = 9998
  57.     @fade_in = false
  58.     @fade_out = false
  59.     @contents_showing = false
  60.     @cursor_width = 0
  61.     self.active = false
  62.     self.index = -1
  63.     if $game_system.soundname_on_speak == nil then
  64.       $game_system.soundname_on_speak = ""
  65.     end
  66.     @opacity_text_buf = Bitmap.new(32, 32)
  67.   end
  68.   #--------------------------------------------------------------------------
  69.   # ● 释放
  70.   #--------------------------------------------------------------------------
  71.   def dispose
  72.     terminate_message
  73.     $game_temp.message_window_showing = false
  74.     if @input_number_window != nil
  75.       @input_number_window.dispose
  76.     end
  77.     super
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 处理信息结束
  81.   #--------------------------------------------------------------------------
  82.   def terminate_message
  83.     self.active = false
  84.     self.pause = false
  85.     self.index = -1
  86.     self.contents.clear
  87.     # 清除显示中标志
  88.     @contents_showing = false
  89.     # 呼叫信息调用
  90.     if $game_temp.message_proc != nil
  91.       $game_temp.message_proc.call
  92.     end
  93.     # 清除文章、选择项、输入数值的相关变量
  94.     $game_temp.message_text = nil
  95.     $game_temp.message_proc = nil
  96.     $game_temp.choice_start = 99
  97.     $game_temp.choice_max = 0
  98.     $game_temp.choice_cancel_type = 0
  99.     $game_temp.choice_proc = nil
  100.     $game_temp.num_input_start = 99
  101.     $game_temp.num_input_variable_id = 0
  102.     $game_temp.num_input_digits_max = 0
  103.     # 开放金钱窗口
  104.     if @gold_window != nil
  105.       @gold_window.dispose
  106.       @gold_window = nil
  107.     end
  108.     if @name_window_frame != nil
  109.       @name_window_frame.dispose
  110.       @name_window_frame = nil
  111.     end
  112.     if @name_window_text != nil
  113.       @name_window_text.dispose
  114.       @name_window_text = nil
  115.     end
  116.     if @right_picture != nil and @right_keep == true
  117.       @right_picture.dispose
  118.     end   
  119.     if @left_picture != nil and @left_keep == true
  120.       @left_picture.dispose
  121.     end
  122.   end
  123.   def refresh
  124.     # 初期化
  125.     self.contents.clear
  126.     self.contents.font.color = normal_color
  127.     self.contents.font.size = Font.default_size
  128.     @x = @y = @max_x = @max_y = @indent = @lines = 0
  129.     @left_keep = @right_keep = false
  130.     @face_indent = 0
  131.     @opacity = 255
  132.     @cursor_width = 0
  133.     @write_speed = 0
  134.     @write_wait = 0
  135.     @mid_stop = false
  136.     @face_file = nil
  137.     @popchar = -2
  138.     if $game_temp.choice_start == 0
  139.       @x = 8
  140.     end
  141.     if $game_temp.message_text != nil
  142.       @now_text = $game_temp.message_text
  143.       #——头像设置
  144.       if (/\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
  145.         @face_file = $1 + ".png"
  146.         @x = @face_indent = 128
  147.         if FileTest.exist?("Graphics/Pictures/" + $1 + ".png")
  148.           self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  149.         end
  150.         @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
  151.       end
  152.       #——左半身像设置
  153.       if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  154.         [url=home.php?mod=space&uid=84331]@face[/url] = $1 + ".png"
  155.         if $加密 == true
  156.           if @left_picture != nil
  157.             @left_picture.dispose
  158.           end
  159.           @left_picture = Sprite.new
  160.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  161.           @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  162.           @left_picture.x = 0
  163.           @left_picture.mirror = true
  164.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  165.         else         
  166.           if FileTest.exist?("Graphics/battlers/#{@face}")
  167.             if @left_picture != nil
  168.               @left_picture.dispose
  169.             end
  170.             @left_picture = Sprite.new
  171.             @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  172.             @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  173.             @left_picture.x = 0
  174.             @left_picture.mirror = true
  175.             @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  176.           end
  177.         end        
  178.       end
  179.       #——右半身像设置
  180.       if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  181.         @face =  $1 + ".png"
  182.         if $加密 == true
  183.           if @right_picture != nil
  184.             @right_picture.dispose
  185.           end
  186.           @right_picture = Sprite.new
  187.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  188.           @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  189.           @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  190.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  191.         else
  192.           if FileTest.exist?("Graphics/battlers/#{@face}")
  193.             if @right_picture != nil
  194.               @right_picture.dispose
  195.             end
  196.             @right_picture = Sprite.new
  197.             @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  198.             @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  199.             @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  200.             @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  201.           end
  202.         end
  203.       end
  204.       if (/\\[Rr]k/.match(@now_text)) != nil
  205.         @right_keep = true
  206.         @now_text.sub!(/\\[Rr]k/) { "" }
  207.       end
  208.       if (/\\[Ll]k/.match(@now_text)) != nil
  209.         @left_keep = true
  210.         @now_text.sub!(/\\[Ll]k/) { "" }
  211.       end
  212.       # 显示人物姓名
  213.       name_window_set = false
  214.       if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
  215.         name_window_set = true
  216.         name_text = $1
  217.         @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  218.       end
  219.       
  220.       # 文字位置的判定
  221.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  222.         @popchar = $1.to_i
  223.         if @popchar == -1
  224.           @x = @indent = 48
  225.           @y = 4
  226.         end
  227.         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  228.       end
  229.       
  230.       # 开始
  231.       begin
  232.         last_text = @now_text.clone
  233.         @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  234.       end until @now_text == last_text
  235.       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  236.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  237.     end
  238.     @now_text.gsub!(/\\\\/) { "\000" }
  239.     @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  240.     @now_text.gsub!(/\\[Gg]/) { "\002" }
  241.     @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  242.     @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  243.     @now_text.gsub!(/\\[.]/) { "\005" }
  244.     @now_text.gsub!(/\\[|]/) { "\006" }

  245.     @now_text.gsub!(/\\[>]/) { "\016" }
  246.     @now_text.gsub!(/\\[<]/) { "\017" }
  247.     @now_text.gsub!(/\\[!]/) { "\020" }
  248.     @now_text.gsub!(/\\[~]/) { "\021" }
  249.    
  250.     @now_text.gsub!(/\\[Ii]/) { "\023" }
  251.     @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  252.     @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  253.     @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  254.     @now_text.gsub!(/\\[Kk]\[(.*?)\]/) { "\027[#{$1}]" }
  255.     if @popchar >= 0
  256.       @text_save = @now_text.clone
  257.       @max_x = 0
  258.       @max_y = 4
  259.       for i in 0..3
  260.         line = @now_text.split(/\n/)[3-i]
  261.         @max_y -= 1 if line == nil and @max_y <= 4-i
  262.         next if line == nil
  263.         cx = contents.text_size(line).width
  264.         @max_x = cx if cx > @max_x
  265.       end
  266.       self.width = @max_x + 48 + @face_indent
  267.       self.height = (@max_y - 1) * 32 + 64
  268.     else
  269.       @max_x = self.width - 32 - @face_indent
  270.     end
  271.     reset_window
  272.       if name_window_set
  273.         off_x = 0
  274.         off_y = -40
  275.         space = 2
  276.         x = self.x + off_x - space / 2
  277.         y = self.y + off_y - space / 2
  278.         w = self.contents.text_size(name_text).width + 26 + space
  279.         h = 40 + space
  280.         @name_window_frame = Window_Frame.new(x, y, w, h)
  281.         @name_window_frame.z = self.z + 1
  282.         x = self.x + off_x + 4
  283.         y = self.y + off_y
  284.         @name_window_text = Air_Text.new(x+4, y+6, name_text)
  285.         @name_window_text.z = self.z + 2
  286.       end
  287.     end
  288.     reset_window
  289.     if $game_temp.choice_max > 0
  290.       @item_max = $game_temp.choice_max
  291.       self.active = true
  292.       self.index = 0
  293.     end
  294.     if $game_temp.num_input_variable_id > 0
  295.       digits_max = $game_temp.num_input_digits_max
  296.       number = $game_variables[$game_temp.num_input_variable_id]
  297.       @input_number_window = Window_InputNumber.new(digits_max)
  298.       @input_number_window.number = number
  299.       @input_number_window.x = self.x + 8
  300.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  301.     end
  302.   end
  303.   #--------------------------------------------------------------------------
  304.   # ● 更新
  305.   #--------------------------------------------------------------------------
  306.   def update
  307.     super
  308.     if @fade_in
  309.       self.contents_opacity += 24
  310.       if @input_number_window != nil
  311.         @input_number_window.contents_opacity += 24
  312.       end
  313.       if self.contents_opacity == 255
  314.         @fade_in = false
  315.       end
  316.       return
  317.     end
  318.     @now_text = nil if @now_text == ""
  319.    
  320.     if @now_text != nil and @mid_stop == false
  321.       if @write_wait > 0
  322.         @write_wait -= 1
  323.         return
  324.       end
  325.       text_not_skip = $game_system.typing
  326.       while true
  327.         @max_x = @x if @max_x < @x
  328.         @max_y = @y if @max_y < @y
  329.         if (c = @now_text.slice!(/./m)) != nil
  330.           if c == "\000"
  331.             c = "\"
  332.           end
  333.           if c == "\001"
  334.             @now_text.sub!(/\[([0-9]+)\]/, "")
  335.             color = $1.to_i
  336.             if color >= 0 and color <= 7
  337.               self.contents.font.color = text_color(color)
  338.             end
  339.             c = ""
  340.           end
  341.           if c == "\002"
  342.             if @gold_window == nil and @popchar <= 0
  343.               @gold_window = Window_Gold.new
  344.               @gold_window.x = 560 - @gold_window.width
  345.               if $game_temp.in_battle
  346.                 @gold_window.y = 192
  347.               else
  348.                 @gold_window.y = self.y >= 128 ? 32 : 384
  349.               end
  350.               @gold_window.opacity = self.opacity
  351.               @gold_window.back_opacity = self.back_opacity
  352.             end
  353.             c = ""
  354.           end
  355.           if c == "\003"
  356.             @now_text.sub!(/\[([0-9]+)\]/, "")
  357.             speed = $1.to_i
  358.             if speed >= 0 and speed <= 19
  359.               @write_speed = speed
  360.             end
  361.             c = ""
  362.           end
  363.           if c == "\004"
  364.             @now_text.sub!(/\[(.*?)\]/, "")
  365.             buftxt = $1.dup.to_s
  366.             if buftxt.match(/\//) == nil and buftxt != "" then
  367.               $game_system.soundname_on_speak = "Audio/SE/" + buftxt
  368.             else
  369.               $game_system.soundname_on_speak = buftxt.dup
  370.             end
  371.             c = ""
  372.           elsif c == "\004"
  373.             c = ""
  374.           end
  375.           if c == "\005"
  376.             @write_wait += 5
  377.             c = ""
  378.           end
  379.           if c == "\006"
  380.             @write_wait += 20
  381.             c = ""
  382.           end
  383.           if c == "\016"
  384.             text_not_skip = false
  385.             c = ""
  386.           end
  387.           if c == "\017"
  388.             text_not_skip = true
  389.             c = ""
  390.           end
  391.           if c == "\020"
  392.             @mid_stop = true
  393.             c = ""
  394.           end
  395.           if c == "\021"
  396.             terminate_message
  397.             return
  398.           end
  399.           if c == "\023"
  400.             @indent = @x
  401.             c = ""
  402.           end
  403.           if c == "\024"
  404.             @now_text.sub!(/\[([0-9]+)\]/, "")
  405.             @opacity = $1.to_i
  406.             c = ""
  407.           end
  408.           if c == "\025"
  409.             @now_text.sub!(/\[([0-9]+)\]/, "")
  410.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  411.             c = ""
  412.           end
  413.           if c == "\026"
  414.             @now_text.sub!(/\[([0-9]+)\]/, "")
  415.             @x += $1.to_i
  416.             c = ""
  417.           end
  418.           if c == "\027"
  419.             @now_text.sub!(/\[(.*?)\]/, "")
  420.             @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  421.             if $game_system.soundname_on_speak != ""
  422.               Audio.se_play($game_system.soundname_on_speak)
  423.             end
  424.             c = ""
  425.           end
  426.           if c == "\030"
  427.             @now_text.sub!(/\[(.*?)\]/, "")
  428.             self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  429.            if $game_system.soundname_on_speak != ""
  430.               Audio.se_play($game_system.soundname_on_speak)
  431.             end
  432.             @x += 24
  433.             c = ""
  434.           end
  435.           if c == "\n"
  436.             if @lines >= $game_temp.choice_start
  437.               @cursor_width = [@cursor_width, @max_x - @face_indent].max
  438.             end
  439.             @lines += 1
  440.             @y += 1
  441.             @x = 0 + @indent + @face_indent
  442.             if @lines >= $game_temp.choice_start
  443.               @x = 8 + @indent + @face_indent
  444.             end
  445.             c = ""
  446.           end
  447.           if c != ""
  448.             # 文字描画
  449.             @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  450.             if $game_system.soundname_on_speak != "" then
  451.             Audio.se_play($game_system.soundname_on_speak)
  452.             end
  453.           end
  454.           if Input.press?(Input::B)
  455.             text_not_skip = false
  456.           end
  457.         else
  458.           text_not_skip = true
  459.           break
  460.         end
  461.         # 終了判定
  462.         if text_not_skip
  463.           break
  464.         end
  465.       end
  466.       @write_wait += @write_speed
  467.       return
  468.     end
  469.     if @input_number_window != nil
  470.       @input_number_window.update
  471.       # 決定
  472.       if Input.trigger?(Input::C)
  473.         $game_system.se_play($data_system.decision_se)
  474.         $game_variables[$game_temp.num_input_variable_id] =
  475.         @input_number_window.number
  476.         $game_map.need_refresh = true
  477.         @input_number_window.dispose
  478.         @input_number_window = nil
  479.         terminate_message
  480.       end
  481.       return
  482.     end
  483.     if @contents_showing
  484.       if $game_temp.choice_max == 0
  485.         self.pause = true
  486.       end
  487.       # 取消
  488.       if Input.trigger?(Input::B)
  489.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  490.           $game_system.se_play($data_system.cancel_se)
  491.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  492.           terminate_message
  493.         end
  494.       end
  495.       # 決定
  496.       if Input.trigger?(Input::C)
  497.         if $game_temp.choice_max > 0
  498.           $game_system.se_play($data_system.decision_se)
  499.           $game_temp.choice_proc.call(self.index)
  500.         end
  501.         if @mid_stop
  502.           @mid_stop = false
  503.           return
  504.         else
  505.           terminate_message
  506.         end
  507.       end
  508.       return
  509.     end
  510.     if @fade_out == false and $game_temp.message_text != nil
  511.       @contents_showing = true
  512.       $game_temp.message_window_showing = true
  513.       refresh
  514.       Graphics.frame_reset
  515.       self.visible = true
  516.       self.contents_opacity = 0
  517.     if @input_number_window != nil
  518.       @input_number_window.contents_opacity = 0
  519.     end
  520.       @fade_in = true
  521.       return
  522.     end
  523.     if self.visible
  524.       @fade_out = true
  525.       self.opacity -= 48
  526.       if self.opacity == 0
  527.         self.visible = false
  528.         @fade_out = false
  529.         $game_temp.message_window_showing = false
  530.       end
  531.       return
  532.     end
  533.   end
  534.   #--------------------------------------------------------------------------
  535.   # ● 获得字符
  536.   #--------------------------------------------------------------------------
  537.   def get_character(parameter)
  538.     case parameter
  539.     when 0
  540.       return $game_player
  541.     else
  542.       events = $game_map.events
  543.       return events == nil ? nil : events[parameter]
  544.     end
  545.   end
  546.   #--------------------------------------------------------------------------
  547.   # ● ウィンドウの位置と不透明度の設定
  548.   #--------------------------------------------------------------------------
  549.   def reset_window
  550.     # 判定
  551.     if @popchar >= 0
  552.       events = $game_map.events
  553.       if events != nil
  554.         character = get_character(@popchar)
  555.         x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  556.         y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  557.         self.x = x
  558.         self.y = y
  559.       end
  560.     elsif @popchar == -1
  561.       self.x = -4
  562.       self.y = -4
  563.       self.width = 648
  564.       self.height = 488
  565.     else
  566.       if $game_temp.in_battle
  567.         self.y = 16
  568.       else
  569.         case $game_system.message_position
  570.         when 0 # 上
  571.           self.y = 16
  572.         when 1 # 中
  573.           self.y = 160
  574.         when 2 # 下
  575.           self.y = 304
  576.         end
  577.         self.x = 80
  578.         if @face_file == nil
  579.           self.width = 480
  580.         else
  581.           self.width = 600
  582.           self.x -= 60
  583.         end
  584.         self.height = 160
  585.       end
  586.     end
  587.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  588.     if @face_file != nil
  589.       self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  590.     end
  591.     if @popchar == -1
  592.       self.opacity = 255
  593.       self.back_opacity = 0
  594.     elsif $game_system.message_frame == 0
  595.       self.opacity = 255
  596.       self.back_opacity = 200
  597.     else
  598.       self.opacity = 0
  599.       self.back_opacity = 200
  600.     end
  601.   end
  602.   #--------------------------------------------------------------------------
  603.   # ● line_height
  604.   #--------------------------------------------------------------------------
  605.   # 返回値:行高
  606.   #--------------------------------------------------------------------------
  607.   def line_height
  608.     return 32
  609.     if self.contents.font.size >= 20 and self.contents.font.size <= 24
  610.       return 32
  611.     else
  612.       return self.contents.font.size * 15 / 10
  613.     end
  614.   end
  615.   #--------------------------------------------------------------------------
  616.   # ● 透過文字描画
  617.   #--------------------------------------------------------------------------
  618.   # target :描画対象。Bitmapクラスを指定。
  619.   # x :x座標
  620.   # y :y座標
  621.   # str  :描画文字列
  622.   # opacity:透過率(0~255)
  623.   # 返回値 :文字幅(@x増加値)。
  624.   #--------------------------------------------------------------------------
  625.   def opacity_draw_text(target, x, y, str,opacity)
  626.     height = target.font.size
  627.     width = target.text_size(str).width
  628.     opacity = [[opacity, 0].max, 255].min
  629.     if opacity == 255
  630.       target.draw_text(x, y, width, height, str)
  631.       return width
  632.     else
  633.       if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  634.         @opacity_text_buf.dispose
  635.         @opacity_text_buf = Bitmap.new(width, height)
  636.       else
  637.         @opacity_text_buf.clear
  638.       end
  639.       @opacity_text_buf.font.size = target.font.size
  640.       @opacity_text_buf.draw_text(0, 0, width, height, str)
  641.       target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  642.     return width
  643.     end
  644.   end
  645.   def ruby_draw_text(target, x, y, str,opacity)
  646.     sizeback = target.font.size
  647.     target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  648.     rubysize = [rubysize, 6].max
  649.    
  650.     opacity = [[opacity, 0].max, 255].min
  651.     split_s = str.split(/,/)
  652.    
  653.     split_s[0] == nil ? split_s[0] = "" : nil
  654.     split_s[1] == nil ? split_s[1] = "" : nil
  655.    
  656.     height = sizeback + rubysize
  657.     width = target.text_size(split_s[0]).width
  658.    
  659.     target.font.size = rubysize
  660.     ruby_width = target.text_size(split_s[1]).width
  661.     target.font.size = sizeback
  662.    
  663.     buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  664.    
  665.     width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  666.    
  667.     if opacity == 255
  668.       target.font.size = rubysize
  669.       target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  670.       target.font.size = sizeback
  671.       target.draw_text(x, y, width, target.font.size, split_s[0])
  672.       return width
  673.     else
  674.       if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  675.         @opacity_text_buf.dispose
  676.         @opacity_text_buf = Bitmap.new(buf_width, height)
  677.       else
  678.         @opacity_text_buf.clear
  679.       end
  680.       @opacity_text_buf.font.size = rubysize
  681.       @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  682.       @opacity_text_buf.font.size = sizeback
  683.       @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  684.       if sub_x >= 0
  685.         target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  686.       else
  687.         target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  688.       end
  689.       return width
  690.     end
  691.   end
  692.   #--------------------------------------------------------------------------
  693.   # ● \V 变换
  694.   #--------------------------------------------------------------------------
  695.   def convart_value(option, index)
  696.     option == nil ? option = "" : nil
  697.     option.downcase!
  698.     case option
  699.       when "i"
  700.         unless $data_items[index].name == nil
  701.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  702.         end
  703.       when "w"
  704.         unless $data_weapons[index].name == nil
  705.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  706.         end
  707.       when "a"
  708.         unless $data_armors[index].name == nil
  709.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  710.         end
  711.       when "s"
  712.         unless $data_skills[index].name == nil
  713.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  714.         end
  715.       else
  716.       r = $game_variables[index]
  717.     end
  718.     r == nil ? r = "" : nil
  719.     return r
  720.   end
  721.   #--------------------------------------------------------------------------
  722.   # ● 解放
  723.   #--------------------------------------------------------------------------
  724.   def dispose
  725.     terminate_message
  726.     if @gaiji_cache != nil
  727.       unless @gaiji_cache.disposed?
  728.         @gaiji_cache.dispose
  729.       end
  730.     end
  731.     unless @opacity_text_buf.disposed?
  732.       @opacity_text_buf.dispose
  733.     end
  734.     $game_temp.message_window_showing = false
  735.     if @input_number_window != nil
  736.       @input_number_window.dispose
  737.     end
  738.     super
  739.   end
  740.   #--------------------------------------------------------------------------
  741.   # ● 矩形更新
  742.   #--------------------------------------------------------------------------
  743.   def update_cursor_rect
  744.     if @index >= 0
  745.       n = $game_temp.choice_start + @index
  746.       self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  747.     else
  748.       self.cursor_rect.empty
  749.     end
  750.   end
  751. end
  752. #==============================================================================
  753. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  754. #==============================================================================
  755. class Window_Frame < Window_Base
  756.   #--------------------------------------------------------------------------
  757.   # ● オブジェクト初期化
  758.   #--------------------------------------------------------------------------
  759.   def initialize(x, y, width, height)
  760.     super(x, y, width, height)
  761.     self.contents = nil
  762.     self.back_opacity = 200
  763.   end
  764.   #--------------------------------------------------------------------------
  765.   # ● 解放
  766.   #--------------------------------------------------------------------------
  767.   def dispose
  768.     super
  769.     end
  770.   end
  771. #==============================================================================
  772. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  773. #==============================================================================
  774. class Air_Text < Window_Base
  775.   #--------------------------------------------------------------------------
  776.   # ● オブジェクト初期化
  777.   #--------------------------------------------------------------------------
  778.   def initialize(x, y, designate_text)
  779.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  780.     self.opacity = 0
  781.     self.back_opacity = 0
  782.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  783.     w = self.contents.width
  784.     h = self.contents.height
  785.     self.contents.draw_text(0, 0, w, h, designate_text)
  786.   end
  787.   #--------------------------------------------------------------------------
  788.   # ● 解放
  789.   #--------------------------------------------------------------------------
  790.   def dispose
  791.     self.contents.clear
  792.     super
  793.   end
  794. end
复制代码

点评

这事啥玩意呀?你确定有用,我看此脚本的标题和我说的不一样呀! 还有很麻烦!这事我最不想要的!  发表于 2013-3-1 22:24

评分

参与人数 1星屑 +66 收起 理由
hcm + 66 认可答案

查看全部评分

6R,好久不见。
回复

使用道具 举报

梦石
0
星屑
63
在线时间
246 小时
注册时间
2012-4-4
回帖
198
发表于 2013-3-2 18:16:35 | 显示全部楼层
这已经是最简单的了,只要在显示文章上输入就可以了,不会在对话中显示出来,如果还觉得麻烦就直接用显示图片事件好了。

点评

图片的位置很难弄,而且很麻烦  发表于 2013-3-2 18:20
6R,好久不见。
回复

使用道具 举报

梦石
0
星屑
49
在线时间
423 小时
注册时间
2011-3-11
回帖
277
发表于 2013-3-2 18:28:46 | 显示全部楼层
同学,如果你连显示图片坐标位置都懒得自己去调,我建议你放弃XP。VX和VA有自带显示头像。楼上给出的是最简单有效的对话框脚本,六楼给出的是最简单有效的显示头像的方法。是最适用于新手的。如果它们无法入你法眼,那么我觉得XP无法满足你。
回复

使用道具 举报

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

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部