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

Project1

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

[已经解决] 谁能推荐个简单好用的对话脚本

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
137
在线时间
60 小时
注册时间
2011-4-17
帖子
15
跳转到指定楼层
1
发表于 2011-4-25 12:56:29 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
谁能推荐个简单好用的对话脚本

Lv1.梦旅人

梦石
0
星屑
137
在线时间
60 小时
注册时间
2011-4-17
帖子
15
2
 楼主| 发表于 2011-4-25 13:52:44 | 只看该作者
本帖最后由 Q932915640 于 2011-4-25 13:53 编辑

顶制的我都不太满意
----------------------
一不小心,连楼了
管理员别扣分噶~~
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
389
在线时间
894 小时
注册时间
2009-10-12
帖子
1829
3
发表于 2011-4-25 19:47:24 | 只看该作者
本帖最后由 日月星辰 于 2011-4-25 19:57 编辑
Q932915640 发表于 2011-4-25 13:52
顶制的我都不太满意
----------------------
一不小心,连楼了


首先,你自己可以用编辑功能编辑掉。

其次…Pia这里看看,基本上能满足90%的审美需求,用法也算简单,自己看脚本里的注释和事件的范例,如果效果觉得还不行的自己还素材。
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
73 小时
注册时间
2010-6-26
帖子
279
4
发表于 2011-4-26 18:24:29 | 只看该作者
  1. #默认为一个字一个字的方式,如果需要一次全部显示,
  2. #请在游戏中使用脚本:$game_system.typing = true
  3. # 其他在对话中可以使用的功能:

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

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

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

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


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

  910.   
  911.     #颜色自定义设定范围0-255
  912.     self.contents.font.color = Color.new($ncolor0, $ncolor1, $ncolor2)
  913.     #颜色自定义设定范围0-255

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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-20 22:02

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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