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

Project1

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

[已经解决] 对话框问题

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
10 小时
注册时间
2009-4-23
帖子
36
跳转到指定楼层
1
发表于 2009-10-8 11:38:48 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我想显示人物头像在左边 右边显示对话
但怎么样才能让人物头像显示在对话框前面呢

Lv1.梦旅人

~琉璃の雪~<

梦石
0
星屑
49
在线时间
36 小时
注册时间
2008-11-6
帖子
3678
2
发表于 2009-10-8 11:56:42 | 只看该作者
方法自己调用。
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================

  4. #——说明

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

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

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

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

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

  19. # \v[1] :显示变量1

  20. # \v[a1] :显示防具1

  21. # \v[w1] :显示武器1

  22. # \v[i1] :显示物品1

  23. # \v[s1] :显示特技1

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

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

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

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

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

  30. # \>   :文字不用打字方式
  31. # \<   :文字使用打字方式

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

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

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

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

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

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

  39. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  40. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”

  41. # \Lk:清除左边的图像
  42. # \Rk:清除右边的图像


  43. #==============================================================================
  44. # ■ Game_System
  45. #------------------------------------------------------------------------------
  46. #  处理系统附属数据的类。也可执行诸如 BGM 管理之类的功能。本类的实例请参考
  47. # $game_system 。
  48. #==============================================================================

  49. class Game_System
  50.   attr_accessor :typing
  51.   attr_accessor :soundname_on_speak
  52.   alias carol3_ini initialize
  53.   def initialize
  54.     carol3_ini
  55.     @typing = true
  56.     @soundname_on_speak = nil
  57.   end
  58. end
  59. $加密 = true
  60. $refresh = {}
  61. #==============================================================================
  62. # ■ Window_Message
  63. #------------------------------------------------------------------------------
  64. class Window_Message < Window_Selectable
  65.   Player_Name = '1' # 代表主角名字的字符
  66.   Player_Name_2 = '2' # 代表主角名字的字符
  67.   Player_Name_3 = '3' # 代表主角名字的字符

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

  270.     @now_text.gsub!(/\\[>]/) { "\016" }
  271.     @now_text.gsub!(/\\[<]/) { "\017" }
  272.     @now_text.gsub!(/\\[!]/) { "\020" }
  273.     @now_text.gsub!(/\\[~]/) { "\021" }
  274.    
  275.     @now_text.gsub!(/\\[Ii]/) { "\023" }
  276.     @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  277.     @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  278.     @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  279.     @now_text.gsub!(/\\[Kk]\[(.*?)\]/) { "\027[#{$1}]" }

  280.     if @now_text.slice!(/\\[Ww]\[(\d+)\]/)
  281.       @auto_fade_count = $1.to_i
  282.     end

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

  909. #==============================================================================
  910. # 本脚本来自www.66RPG.com,使用和转载请保留此信息

  911. #参考链接:http://rpg.blue/viewthread.php?tid=124333&highlight=
  912. #          http://rpg.blue/viewthread.php?tid=122891&highlight=
  913. #==============================================================================
复制代码
~现在开始自绘头像~
回复 支持 反对

使用道具 举报

Lv1.梦旅人

草莓君

梦石
0
星屑
79
在线时间
418 小时
注册时间
2008-6-12
帖子
1902
3
发表于 2009-10-8 11:59:26 | 只看该作者
同LS
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2009-8-23
帖子
99
4
发表于 2009-10-9 01:04:18 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-6 20:11

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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