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

Project1

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

[推荐问答] 怎么出来对话框里的头像之类的啊?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2012-7-17
帖子
5
跳转到指定楼层
1
发表于 2012-7-17 09:44:03 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
因为不知道怎么弄。刚开始学。各位大大请教教我吧……

Lv1.梦旅人

梦石
0
星屑
69
在线时间
592 小时
注册时间
2010-10-31
帖子
194

开拓者

2
发表于 2012-7-17 09:55:56 | 只看该作者
增强型对话框
  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————
  4. #——说明
  5. #默认为一个字一个字的方式,如果需要一次全部显示,
  6. #请在游戏中使用脚本:$game_system.typing = true
  7. # 其他在对话中可以使用的功能:

  8. # \n[1]:显示1号角色的姓名
  9. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  10. # \name[\n[1]]:显示1号主角的姓名方框
  11. # \p[1]:对话框出现在1号事件的上方
  12. # \p[0]:主人公上方出现对话框
  13. #——————————————————使用\p功能后可以自动调整对话框大小
  14. # \>   :文字不用打字方式
  15. # \<   :文字使用打字方式
  16. # \\:显示"\"这个符号
  17. # \c[1-8]:更改颜色
  18. # \g:显示金钱窗口
  19. # \t: 显示游戏时间窗口
  20. # \v[7]:显示7号变量的值
  21. # \v[a7]:显示7号防具的名称
  22. # \v[s7]:显示7号特技的名称
  23. # \v[w7]:显示7号武器的名称
  24. # \v[i7]:显示7号道具的名称
  25. # \I   :下一行从这个位置开始
  26. # \o[123]:文字透明度改为123,模拟将死之人(汗)
  27. # \h[12]:改用12号字
  28. # \b[50]:空50象素
  29. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  30. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  31. # \Lk:清除左边的图像
  32. # \Rk:清除右边的图像
  33. # \A:头像及姓名框靠左排列
  34. # \a:头像及姓名框靠右排列
  35. # \M[60]:等待60帧文字直接消失
  36. # \MS[1-8]:更改文字背景颜色
  37. # \ME:恢复文字背景颜色
  38. #颜色自定义设定范围0-255
  39. #使用方法:在文章前输入如下脚本定义颜色
  40. #          $color0 = 数值
  41. #          $color1 = 数值
  42. #          $color2 = 数值
  43. #\name参数的颜色自定义设定范围0-255
  44. #使用方法:在文章前输入如下脚本定义颜色
  45. #          $ncolor0 = 数值
  46. #          $ncolor1 = 数值
  47. #          $ncolor2 = 数值
  48. # \!   :等待玩家按回车再继续
  49. #$speed :文字的打字速度设置用的,数字越大速度越慢。

  50. #============================
  51. class Game_System
  52. attr_accessor :typing
  53. alias carol3_ini initialize
  54. def initialize
  55. carol3_ini
  56. @typing = true
  57. end
  58. end
  59. #=================================#==============================================================================
  60. # ■ Window_Message
  61. #------------------------------------------------------------------------------
  62. class Window_Message < Window_Selectable
  63.   #颜色自定义用的全局变量定义
  64.   $color0 = 255
  65.   $color1 = 255
  66.   $color2 = 255
  67.   #颜色自定义用的全局变量定义
  68.   
  69.   #说话速度设置用的全局变量
  70.   
  71.   $speed = 1
  72.   
  73. #--------------------------------------------------------------------------
  74. # ● 初始化状态
  75. #--------------------------------------------------------------------------
  76. def initialize
  77.   super(40, 50, 640, 160)
  78.   self.contents = Bitmap.new(width - 40, height - 32)
  79.   self.visible = false
  80.   self.z = 199
  81.   @fade_in = false
  82.   @fade_out = false
  83.   @contents_showing = false
  84.   @cursor_width = 0
  85. # Start
  86.   @bflag = false
  87. # End
  88.   @autoclosetime = -1
  89.   self.active = false
  90.   self.index = -1
  91.   @opacity_text_buf = Bitmap.new(32, 32)
  92. end
  93. #--------------------------------------------------------------------------
  94. # ● 释放
  95. #--------------------------------------------------------------------------
  96. def dispose
  97.   terminate_message
  98.   $game_temp.message_window_showing = false
  99.   if @input_number_window != nil
  100.     @input_number_window.dispose
  101.   end
  102.   super
  103. end
  104. #--------------------------------------------------------------------------
  105. # ● 处理信息结束
  106. #--------------------------------------------------------------------------
  107. def terminate_message
  108.   self.active = false
  109.   self.pause = false
  110.   self.index = -1
  111.   self.contents.clear
  112.   # 清除显示中标志
  113.   @contents_showing = false
  114.   # 呼叫信息调用
  115.   if $game_temp.message_proc != nil
  116.     $game_temp.message_proc.call
  117.   end
  118.   # 清除文章、选择项、输入数值的相关变量
  119.   $game_temp.message_text = nil
  120.   $game_temp.message_proc = nil
  121.   $game_temp.choice_start = 99
  122.   $game_temp.choice_max = 0
  123.   $game_temp.choice_cancel_type = 0
  124.   $game_temp.choice_proc = nil
  125.   $game_temp.num_input_start = 99
  126.   $game_temp.num_input_variable_id = 0
  127.   $game_temp.num_input_digits_max = 0
  128.   # 开放金钱窗口
  129.   if @gold_window != nil
  130.     @gold_window.dispose
  131.     @gold_window = nil
  132.   end
  133. #Start
  134.   # ピクチャ廃棄処理
  135.   begin
  136. #      if @spgra.disposed? == false
  137.       @spgra.dispose
  138. #      end
  139. #      if @backgraphic.disposed? == false
  140.       @backgraphic.dispose
  141. #      end
  142.   rescue
  143. #      print "ピクチャが読み込めていません!"
  144.   end
  145. #End
  146.   # 开放时间窗口
  147.   if @playtime_window != nil
  148.     @playtime_window.dispose
  149.     @playtime_window = nil
  150.   end
  151.   if @name_window_frame != nil
  152.     @name_window_frame.dispose
  153.     @name_window_frame = 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.   @face_bitmap = nil
  166. end
  167. def refresh
  168.   # 初期化
  169.   self.contents.clear
  170.   self.contents.font.color = normal_color
  171.   self.contents.font.size = Font.default_size
  172.   @x = @y = @max_x = @max_y = @indent = @lines = 0
  173.   @left_keep = @right_keep = false
  174.   @face_indent = 0
  175.   @opacity = 255
  176.   @cursor_width = 0
  177.   @autoclosetime = -1
  178.   @write_speed = $speed
  179.   @write_wait = 0
  180.   @mid_stop = false
  181.   face = nil
  182.   @popchar = -2
  183.   @alignment = true
  184.   if $game_temp.choice_start == 0
  185.     @x = 8
  186.   end
  187.   if $game_temp.message_text != nil
  188.     @now_text = $game_temp.message_text
  189.     #——对齐设置
  190.     if (/\\([Aa])/.match(@now_text))!=nil then
  191.       if $1 == "A"
  192.         @alignment = true
  193.       else
  194.         @alignment = false
  195.       end
  196.       @now_text.gsub!(/\\([Aa])/) { "" }
  197.     end
  198.     #——头像设置
  199.      if (/\\([Ff])\[(.+?)\]/.match(@now_text))!=nil then
  200.        @face = $2 + "_f.png"
  201.        if $1 == "f" and $game_actors[$2.to_i] != nil
  202.          face = $game_actors[$2.to_i].battler_name + "_f.png"
  203.        end
  204.        if FileTest.exist?("Graphics/Pictures/#{face}")
  205.          @face_bitmap = Bitmap.new("Graphics/Pictures/#{face}")
  206.          if @alignment
  207.            @x = @face_indent = 128
  208.            self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  209.          else
  210.            self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  211.              Rect.new(0, 0, 96, 96))
  212.          end
  213.        else
  214.          face = nil
  215.          @face_bitmap = nil
  216.        end
  217.        @now_text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  218.      end
  219.     #——左半身像设置
  220.     if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  221.       @face = "66rpg_" + $1 + "_h.png"
  222.       if $加密 == true
  223.         if @left_picture != nil
  224.           @left_picture.dispose
  225.         end
  226.         @left_picture = Sprite.new
  227.         @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  228.         @left_picture.y = 480-@left_picture.bitmap.height
  229.         @left_picture.x = 0
  230.         @left_picture.mirror = true
  231.         @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  232.       else         
  233.         if FileTest.exist?("Graphics/battlers/#{@face}")
  234.           if @left_picture != nil
  235.             @left_picture.dispose
  236.           end
  237.           @left_picture = Sprite.new
  238.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  239.           @left_picture.y = 480-@left_picture.bitmap.height
  240.           @left_picture.x = 0
  241.           @left_picture.mirror = true
  242.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  243.         end
  244.       end        
  245.     end
  246.     #——右半身像设置
  247.     if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  248.       @face = "66rpg_" + $1 + "_h.png"
  249.       if $加密 == true
  250.         if @right_picture != nil
  251.           @right_picture.dispose
  252.         end
  253.         @right_picture = Sprite.new
  254.         @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  255.         @right_picture.y = 480-@right_picture.bitmap.height
  256.         @right_picture.x = 640-@right_picture.bitmap.width
  257.         @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  258.       else
  259.         if FileTest.exist?("Graphics/battlers/#{@face}")
  260.           if @right_picture != nil
  261.             @right_picture.dispose
  262.           end
  263.           @right_picture = Sprite.new
  264.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  265.           @right_picture.y = 480-@right_picture.bitmap.height
  266.           @right_picture.x = 640-@right_picture.bitmap.width
  267.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  268.         end
  269.       end
  270.     end
  271.     if (/\\[Rr]k/.match(@now_text)) != nil
  272.       @right_keep = true
  273.       @now_text.sub!(/\\[Rr]k/) { "" }
  274.     end
  275.     if (/\\[Ll]k/.match(@now_text)) != nil
  276.       @left_keep = true
  277.       @now_text.sub!(/\\[Ll]k/) { "" }
  278.     end
  279.     # 替换人物姓名
  280.     @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  281.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  282.     end
  283.     # 显示人物姓名
  284.     name_window_set = false
  285.     if (/\\[Nn][Aa][Mm][Ee](.*?)\[(.+?)\]/.match(@now_text)) != nil
  286.       name_window_set = true
  287.       name_text = $2
  288.       @now_text.sub!(/\\[Nn][Aa][Mm][Ee](.*?)\[(.*?)\]/) { "" }
  289.     end
  290.     # 文字位置的判定
  291.     if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  292.       @popchar = $1.to_i
  293.       if @popchar == -1
  294.         @x = @indent = 48
  295.         @y = 4
  296.       end
  297.       @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  298.     end
  299.    
  300.     # 开始
  301.     begin
  302.       last_text = @now_text.clone
  303.       @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  304.     end until @now_text == last_text
  305.   @now_text.gsub!(/\\\\/) { "\000" }
  306.   @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  307.   @now_text.gsub!(/\\[Gg]/) { "\002" }
  308.   @now_text.gsub!(/\\[Tt]/) { "\004" }
  309.   @now_text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\050[#{$1}]" }
  310.   @now_text.gsub!(/\\[Ii]/) { "\023" }
  311.   @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  312.   @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  313.   @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  314.   @now_text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  315.   @now_text.gsub!(/\\[!]/) { "\020" }
  316. @now_text.gsub!(/\\[>]/) { "\016" }
  317. @now_text.gsub!(/\\[<]/) { "\017" }

  318. # Start
  319. # ◎
  320.     # "\\MS" を "\052" に、 "\\ME" を "\053" に変更
  321.     @now_text.gsub!(/\\[Mm][Ss]\[([0-9]+)\]/) { "\052[#{$1}]" }
  322.     @now_text.gsub!(/\\[Mm][Ee]/) { "\053" }
  323. # ◎
  324. # End

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


  890.   #参数的颜色自定义设定范围0-255
  891.   $ncolor0 = 255
  892.   $ncolor1 = 255
  893.   $ncolor2 = 255
  894.   #参数的颜色自定义设定范围0-255
  895.   
  896. #--------------------------------------------------------------------------
  897. # ● オブジェクト初期化
  898. #--------------------------------------------------------------------------
  899. def initialize(x, y, designate_text)
  900.   super(x-16, y-16, 32 + designate_text.size * 12, 56)
  901.   self.opacity = 0
  902.   self.back_opacity = 0
  903.   self.contents = Bitmap.new(self.width - 50, self.height - 32)
  904.   w = self.contents.width
  905.   h = self.contents.height

  906.   
  907.     #颜色自定义设定范围0-255
  908.     self.contents.font.color = Color.new($ncolor0, $ncolor1, $ncolor2)
  909.     #颜色自定义设定范围0-255

  910.    
  911.    
  912. #    self.contents.font.color = text_color(color)
  913.   self.contents.draw_text(0, 0, w, h, designate_text)
  914. end
  915. #--------------------------------------------------------------------------
  916. # ● 解放
  917. #--------------------------------------------------------------------------
  918. def dispose
  919.   self.contents.clear
  920.   super
  921. end
  922. end
复制代码
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2012-7-17
帖子
5
3
 楼主| 发表于 2012-7-17 10:03:27 | 只看该作者
对话框那个怎么用啊看不懂......
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
69
在线时间
592 小时
注册时间
2010-10-31
帖子
194

开拓者

4
发表于 2012-7-17 10:38:50 | 只看该作者
用Fuki对话框优化版 范例: Fuki对话框优化版+v6.zip (270.79 KB, 下载次数: 925)
原帖
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
3 小时
注册时间
2012-7-17
帖子
5
5
 楼主| 发表于 2012-7-17 11:07:23 | 只看该作者
黯光無影 发表于 2012-7-17 10:38
用Fuki对话框优化版 范例:
原帖

那个。貌似有个什么faces文件夹的 我的版本好像没有是怎么回事?

点评

自己新建  发表于 2012-7-17 11:19
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
229
在线时间
596 小时
注册时间
2010-6-21
帖子
1218
6
发表于 2012-7-17 20:03:37 | 只看该作者
直接显示图片,也行
如果我是一个美工就好啦!
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
325
在线时间
142 小时
注册时间
2008-11-20
帖子
231
7
发表于 2012-7-17 22:53:31 | 只看该作者
本帖最后由 癫狂侠客 于 2012-7-17 22:53 编辑

可以去看看某侠的<脚本不是高手的专利>第七.八两讲!
如果有看不懂的可以向前翻下!


给个门:
【RPGXP视频教学】脚本不是高手的专利 (正在更新...)
           http://rpg.blue/thread-238457-1-1.html
  
【RPGXP视频教学】脚本不是高手的专利 (正在更新...)
http://rpg.blue/thread-238457-1-1.html



回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-20 05:04

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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