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

Project1

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

仿仙剑对话(简单)

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
94 小时
注册时间
2007-6-3
帖子
801
跳转到指定楼层
1
发表于 2007-8-8 22:57:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我不知道以前发过没。如发过,那就删掉好了
其实就是灵儿续传和仙剑时空传的那个(个人感觉没什么)
下面正题:{/hx}
Ikki
发的这个脚本:
  1. #============================
  2. class Game_System
  3. attr_accessor :typing
  4. alias carol3_ini initialize
  5. def initialize
  6. carol3_ini
  7. @typing = true
  8. end
  9. end
  10. #=================================#==============================================================================
  11. # ■ Window_Message
  12. #------------------------------------------------------------------------------
  13. class Window_Message < Window_Selectable
  14.   #颜色自定义用的全局变量定义
  15.   $color0 = 255
  16.   $color1 = 255
  17.   $color2 = 255
  18.   #颜色自定义用的全局变量定义
  19.   
  20.   #说话速度设置用的全局变量
  21.   
  22.   $speed = 1
  23.   
  24. #--------------------------------------------------------------------------
  25. # ● 初始化状态
  26. #--------------------------------------------------------------------------
  27. def initialize
  28.   super(80, 304, 480, 160)
  29.   self.contents = Bitmap.new(width - 32, height - 32)
  30.   self.visible = false
  31.   self.z = 9998
  32.   @fade_in = false
  33.   @fade_out = false
  34.   @contents_showing = false
  35.   @cursor_width = 0
  36. # Start
  37.   @bflag = false
  38. # End
  39.   @autoclosetime = -1
  40.   self.active = false
  41.   self.index = -1
  42.   @opacity_text_buf = Bitmap.new(32, 32)
  43. end
  44. #--------------------------------------------------------------------------
  45. # ● 释放
  46. #--------------------------------------------------------------------------
  47. def dispose
  48.   terminate_message
  49.   $game_temp.message_window_showing = false
  50.   if @input_number_window != nil
  51.     @input_number_window.dispose
  52.   end
  53.   super
  54. end
  55. #--------------------------------------------------------------------------
  56. # ● 处理信息结束
  57. #--------------------------------------------------------------------------
  58. def terminate_message
  59.   self.active = false
  60.   self.pause = false
  61.   self.index = -1
  62.   self.contents.clear
  63.   # 清除显示中标志
  64.   @contents_showing = false
  65.   # 呼叫信息调用
  66.   if $game_temp.message_proc != nil
  67.     $game_temp.message_proc.call
  68.   end
  69.   # 清除文章、选择项、输入数值的相关变量
  70.   $game_temp.message_text = nil
  71.   $game_temp.message_proc = nil
  72.   $game_temp.choice_start = 99
  73.   $game_temp.choice_max = 0
  74.   $game_temp.choice_cancel_type = 0
  75.   $game_temp.choice_proc = nil
  76.   $game_temp.num_input_start = 99
  77.   $game_temp.num_input_variable_id = 0
  78.   $game_temp.num_input_digits_max = 0
  79.   # 开放金钱窗口
  80.   if @gold_window != nil
  81.     @gold_window.dispose
  82.     @gold_window = nil
  83.   end
  84. #Start
  85.   # ピクチャ廃棄処理
  86.   begin
  87. #      if @spgra.disposed? == false
  88.       @spgra.dispose
  89. #      end
  90. #      if @backgraphic.disposed? == false
  91.       @backgraphic.dispose
  92. #      end
  93.   rescue
  94. #      print "ピクチャが読み込めていません!"
  95.   end
  96. #End
  97.   # 开放时间窗口
  98.   if @playtime_window != nil
  99.     @playtime_window.dispose
  100.     @playtime_window = nil
  101.   end
  102.   if @name_window_frame != nil
  103.     @name_window_frame.dispose
  104.     @name_window_frame = nil
  105.   end
  106.   if @name_window_text != nil
  107.     @name_window_text.dispose
  108.     @name_window_text = nil
  109.   end
  110.   if @right_picture != nil and @right_keep == true
  111.     @right_picture.dispose
  112.   end   
  113.   if @left_picture != nil and @left_keep == true
  114.     @left_picture.dispose
  115.   end
  116.   @face_bitmap = nil
  117. end
  118. def refresh
  119.   # 初期化
  120.   self.contents.clear
  121.   self.contents.font.color = normal_color
  122.   self.contents.font.size = Font.default_size
  123.   @x = @y = @max_x = @max_y = @indent = @lines = 0
  124.   @left_keep = @right_keep = false
  125.   @face_indent = 0
  126.   @opacity = 255
  127.   @cursor_width = 0
  128.   @autoclosetime = -1
  129.   @write_speed = $speed
  130.   @write_wait = 0
  131.   @mid_stop = false
  132.   face = nil
  133.   @popchar = -2
  134.   @alignment = true
  135.   if $game_temp.choice_start == 0
  136.     @x = 8
  137.   end
  138.   if $game_temp.message_text != nil
  139.     @now_text = $game_temp.message_text
  140.     #——对齐设置
  141.     if (/\\([Aa])/.match(@now_text))!=nil then
  142.       if $1 == "A"
  143.         @alignment = true
  144.       else
  145.         @alignment = false
  146.       end
  147.       @now_text.gsub!(/\\([Aa])/) { "" }
  148.     end
  149.     #——头像设置
  150.      if (/\\([Ff])\[(.+?)\]/.match(@now_text))!=nil then
  151.        @face = $2 + "_f.png"
  152.        if $1 == "f" and $game_actors[$2.to_i] != nil
  153.          @face = $game_actors[$2.to_i].battler_name + "_f.png"
  154.        end
  155.        if FileTest.exist?("Graphics/Pictures/#{@face}")
  156.          @face_bitmap = Bitmap.new("Graphics/Pictures/#{@face}")
  157.          if @alignment
  158.            @x = @face_indent = 128
  159.            self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  160.          else
  161.            self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  162.              Rect.new(0, 0, 96, 96))
  163.          end
  164.        else
  165.          @face = nil
  166.          @face_bitmap = nil
  167.        end
  168.        @now_text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  169.      end
  170.     #——左半身像设置
  171.     if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  172.       @face = "66rpg_" + $1 + "_h.png"
  173.       if $加密 == true
  174.         if @left_picture != nil
  175.           @left_picture.dispose
  176.         end
  177.         @left_picture = Sprite.new
  178.         @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  179.         @left_picture.y = 480-@left_picture.bitmap.height
  180.         @left_picture.x = 0
  181.         @left_picture.mirror = true
  182.         @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  183.       else         
  184.         if FileTest.exist?("Graphics/battlers/#{@face}")
  185.           if @left_picture != nil
  186.             @left_picture.dispose
  187.           end
  188.           @left_picture = Sprite.new
  189.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  190.           @left_picture.y = 480-@left_picture.bitmap.height
  191.           @left_picture.x = 0
  192.           @left_picture.mirror = true
  193.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  194.         end
  195.       end        
  196.     end
  197.     #——右半身像设置
  198.     if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  199.       @face = "66rpg_" + $1 + "_h.png"
  200.       if $加密 == true
  201.         if @right_picture != nil
  202.           @right_picture.dispose
  203.         end
  204.         @right_picture = Sprite.new
  205.         @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  206.         @right_picture.y = 480-@right_picture.bitmap.height
  207.         @right_picture.x = 640-@right_picture.bitmap.width
  208.         @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  209.       else
  210.         if FileTest.exist?("Graphics/battlers/#{@face}")
  211.           if @right_picture != nil
  212.             @right_picture.dispose
  213.           end
  214.           @right_picture = Sprite.new
  215.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  216.           @right_picture.y = 480-@right_picture.bitmap.height
  217.           @right_picture.x = 640-@right_picture.bitmap.width
  218.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  219.         end
  220.       end
  221.     end
  222.     if (/\\[Rr]k/.match(@now_text)) != nil
  223.       @right_keep = true
  224.       @now_text.sub!(/\\[Rr]k/) { "" }
  225.     end
  226.     if (/\\[Ll]k/.match(@now_text)) != nil
  227.       @left_keep = true
  228.       @now_text.sub!(/\\[Ll]k/) { "" }
  229.     end
  230.     # 替换人物姓名
  231.     @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  232.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  233.     end
  234.     # 显示人物姓名
  235.     name_window_set = false
  236.     if (/\\[Nn][Aa][Mm][Ee](.*?)\[(.+?)\]/.match(@now_text)) != nil
  237.       name_window_set = true
  238.       name_text = $2
  239.       @now_text.sub!(/\\[Nn][Aa][Mm][Ee](.*?)\[(.*?)\]/) { "" }
  240.     end
  241.     # 文字位置的判定
  242.     if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  243.       @popchar = $1.to_i
  244.       if @popchar == -1
  245.         @x = @indent = 48
  246.         @y = 4
  247.       end
  248.       @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  249.     end
  250.    
  251.     # 开始
  252.     begin
  253.       last_text = @now_text.clone
  254.       @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  255.     end until @now_text == last_text
  256.   @now_text.gsub!(/\\\\/) { "\000" }
  257.   @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  258.   @now_text.gsub!(/\\[Gg]/) { "\002" }
  259.   @now_text.gsub!(/\\[Tt]/) { "\004" }
  260.   @now_text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\050[#{$1}]" }
  261.   @now_text.gsub!(/\\[Ii]/) { "\023" }
  262.   @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  263.   @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  264.   @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  265.   @now_text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  266.   @now_text.gsub!(/\\[!]/) { "\020" }
  267. @now_text.gsub!(/\\[>]/) { "\016" }
  268. @now_text.gsub!(/\\[<]/) { "\017" }

  269. # Start
  270. # ◎
  271.     # "\\MS" を "\052" に、 "\\ME" を "\053" に変更
  272.     @now_text.gsub!(/\\[Mm][Ss]\[([0-9]+)\]/) { "\052[#{$1}]" }
  273.     @now_text.gsub!(/\\[Mm][Ee]/) { "\053" }
  274. # ◎
  275. # End

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


  817.   #参数的颜色自定义设定范围0-255
  818.   $ncolor0 = 255
  819.   $ncolor1 = 255
  820.   $ncolor2 = 255
  821.   #参数的颜色自定义设定范围0-255
  822.   
  823. #--------------------------------------------------------------------------
  824. # ● オブジェクト初期化
  825. #--------------------------------------------------------------------------
  826. def initialize(x, y, designate_text)
  827.   super(x-16, y-16, 32 + designate_text.size * 12, 56)
  828.   self.opacity = 0
  829.   self.back_opacity = 0
  830.   self.contents = Bitmap.new(self.width - 32, self.height - 32)
  831.   w = self.contents.width
  832.   h = self.contents.height

  833.   
  834.     #颜色自定义设定范围0-255
  835.     self.contents.font.color = Color.new($ncolor0, $ncolor1, $ncolor2)
  836.     #颜色自定义设定范围0-255

  837.    
  838.    
  839. #    self.contents.font.color = text_color(color)
  840.   self.contents.draw_text(0, 0, w, h, designate_text)
  841. end
  842. #--------------------------------------------------------------------------
  843. # ● 解放
  844. #--------------------------------------------------------------------------
  845. def dispose
  846.   self.contents.clear
  847.   super
  848. end
  849. end

复制代码

将以上复制到你的脚本里
注:这个脚本不是我的
然后改到   下--显示
会发现对话框变大了   再把某个图片放进你的游戏
最后按[显示图片]坐标改445  220  
就行了看下效果   还有,打名字时如打:李逍遥    就打这个 \C[6]李逍遥\C[0]


              [本贴由 御灵 于 2008-1-24 22:43:02 进行了编辑]
无签名,不解释

Lv1.梦旅人

梦石
0
星屑
50
在线时间
94 小时
注册时间
2007-6-3
帖子
801
2
 楼主| 发表于 2007-8-8 22:57:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我不知道以前发过没。如发过,那就删掉好了
其实就是灵儿续传和仙剑时空传的那个(个人感觉没什么)
下面正题:{/hx}
Ikki
发的这个脚本:
  1. #============================
  2. class Game_System
  3. attr_accessor :typing
  4. alias carol3_ini initialize
  5. def initialize
  6. carol3_ini
  7. @typing = true
  8. end
  9. end
  10. #=================================#==============================================================================
  11. # ■ Window_Message
  12. #------------------------------------------------------------------------------
  13. class Window_Message < Window_Selectable
  14.   #颜色自定义用的全局变量定义
  15.   $color0 = 255
  16.   $color1 = 255
  17.   $color2 = 255
  18.   #颜色自定义用的全局变量定义
  19.   
  20.   #说话速度设置用的全局变量
  21.   
  22.   $speed = 1
  23.   
  24. #--------------------------------------------------------------------------
  25. # ● 初始化状态
  26. #--------------------------------------------------------------------------
  27. def initialize
  28.   super(80, 304, 480, 160)
  29.   self.contents = Bitmap.new(width - 32, height - 32)
  30.   self.visible = false
  31.   self.z = 9998
  32.   @fade_in = false
  33.   @fade_out = false
  34.   @contents_showing = false
  35.   @cursor_width = 0
  36. # Start
  37.   @bflag = false
  38. # End
  39.   @autoclosetime = -1
  40.   self.active = false
  41.   self.index = -1
  42.   @opacity_text_buf = Bitmap.new(32, 32)
  43. end
  44. #--------------------------------------------------------------------------
  45. # ● 释放
  46. #--------------------------------------------------------------------------
  47. def dispose
  48.   terminate_message
  49.   $game_temp.message_window_showing = false
  50.   if @input_number_window != nil
  51.     @input_number_window.dispose
  52.   end
  53.   super
  54. end
  55. #--------------------------------------------------------------------------
  56. # ● 处理信息结束
  57. #--------------------------------------------------------------------------
  58. def terminate_message
  59.   self.active = false
  60.   self.pause = false
  61.   self.index = -1
  62.   self.contents.clear
  63.   # 清除显示中标志
  64.   @contents_showing = false
  65.   # 呼叫信息调用
  66.   if $game_temp.message_proc != nil
  67.     $game_temp.message_proc.call
  68.   end
  69.   # 清除文章、选择项、输入数值的相关变量
  70.   $game_temp.message_text = nil
  71.   $game_temp.message_proc = nil
  72.   $game_temp.choice_start = 99
  73.   $game_temp.choice_max = 0
  74.   $game_temp.choice_cancel_type = 0
  75.   $game_temp.choice_proc = nil
  76.   $game_temp.num_input_start = 99
  77.   $game_temp.num_input_variable_id = 0
  78.   $game_temp.num_input_digits_max = 0
  79.   # 开放金钱窗口
  80.   if @gold_window != nil
  81.     @gold_window.dispose
  82.     @gold_window = nil
  83.   end
  84. #Start
  85.   # ピクチャ廃棄処理
  86.   begin
  87. #      if @spgra.disposed? == false
  88.       @spgra.dispose
  89. #      end
  90. #      if @backgraphic.disposed? == false
  91.       @backgraphic.dispose
  92. #      end
  93.   rescue
  94. #      print "ピクチャが読み込めていません!"
  95.   end
  96. #End
  97.   # 开放时间窗口
  98.   if @playtime_window != nil
  99.     @playtime_window.dispose
  100.     @playtime_window = nil
  101.   end
  102.   if @name_window_frame != nil
  103.     @name_window_frame.dispose
  104.     @name_window_frame = nil
  105.   end
  106.   if @name_window_text != nil
  107.     @name_window_text.dispose
  108.     @name_window_text = nil
  109.   end
  110.   if @right_picture != nil and @right_keep == true
  111.     @right_picture.dispose
  112.   end   
  113.   if @left_picture != nil and @left_keep == true
  114.     @left_picture.dispose
  115.   end
  116.   @face_bitmap = nil
  117. end
  118. def refresh
  119.   # 初期化
  120.   self.contents.clear
  121.   self.contents.font.color = normal_color
  122.   self.contents.font.size = Font.default_size
  123.   @x = @y = @max_x = @max_y = @indent = @lines = 0
  124.   @left_keep = @right_keep = false
  125.   @face_indent = 0
  126.   @opacity = 255
  127.   @cursor_width = 0
  128.   @autoclosetime = -1
  129.   @write_speed = $speed
  130.   @write_wait = 0
  131.   @mid_stop = false
  132.   face = nil
  133.   @popchar = -2
  134.   @alignment = true
  135.   if $game_temp.choice_start == 0
  136.     @x = 8
  137.   end
  138.   if $game_temp.message_text != nil
  139.     @now_text = $game_temp.message_text
  140.     #——对齐设置
  141.     if (/\\([Aa])/.match(@now_text))!=nil then
  142.       if $1 == "A"
  143.         @alignment = true
  144.       else
  145.         @alignment = false
  146.       end
  147.       @now_text.gsub!(/\\([Aa])/) { "" }
  148.     end
  149.     #——头像设置
  150.      if (/\\([Ff])\[(.+?)\]/.match(@now_text))!=nil then
  151.        @face = $2 + "_f.png"
  152.        if $1 == "f" and $game_actors[$2.to_i] != nil
  153.          @face = $game_actors[$2.to_i].battler_name + "_f.png"
  154.        end
  155.        if FileTest.exist?("Graphics/Pictures/#{@face}")
  156.          @face_bitmap = Bitmap.new("Graphics/Pictures/#{@face}")
  157.          if @alignment
  158.            @x = @face_indent = 128
  159.            self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  160.          else
  161.            self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  162.              Rect.new(0, 0, 96, 96))
  163.          end
  164.        else
  165.          @face = nil
  166.          @face_bitmap = nil
  167.        end
  168.        @now_text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  169.      end
  170.     #——左半身像设置
  171.     if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  172.       @face = "66rpg_" + $1 + "_h.png"
  173.       if $加密 == true
  174.         if @left_picture != nil
  175.           @left_picture.dispose
  176.         end
  177.         @left_picture = Sprite.new
  178.         @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  179.         @left_picture.y = 480-@left_picture.bitmap.height
  180.         @left_picture.x = 0
  181.         @left_picture.mirror = true
  182.         @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  183.       else         
  184.         if FileTest.exist?("Graphics/battlers/#{@face}")
  185.           if @left_picture != nil
  186.             @left_picture.dispose
  187.           end
  188.           @left_picture = Sprite.new
  189.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  190.           @left_picture.y = 480-@left_picture.bitmap.height
  191.           @left_picture.x = 0
  192.           @left_picture.mirror = true
  193.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  194.         end
  195.       end        
  196.     end
  197.     #——右半身像设置
  198.     if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  199.       @face = "66rpg_" + $1 + "_h.png"
  200.       if $加密 == true
  201.         if @right_picture != nil
  202.           @right_picture.dispose
  203.         end
  204.         @right_picture = Sprite.new
  205.         @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  206.         @right_picture.y = 480-@right_picture.bitmap.height
  207.         @right_picture.x = 640-@right_picture.bitmap.width
  208.         @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  209.       else
  210.         if FileTest.exist?("Graphics/battlers/#{@face}")
  211.           if @right_picture != nil
  212.             @right_picture.dispose
  213.           end
  214.           @right_picture = Sprite.new
  215.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  216.           @right_picture.y = 480-@right_picture.bitmap.height
  217.           @right_picture.x = 640-@right_picture.bitmap.width
  218.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  219.         end
  220.       end
  221.     end
  222.     if (/\\[Rr]k/.match(@now_text)) != nil
  223.       @right_keep = true
  224.       @now_text.sub!(/\\[Rr]k/) { "" }
  225.     end
  226.     if (/\\[Ll]k/.match(@now_text)) != nil
  227.       @left_keep = true
  228.       @now_text.sub!(/\\[Ll]k/) { "" }
  229.     end
  230.     # 替换人物姓名
  231.     @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  232.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  233.     end
  234.     # 显示人物姓名
  235.     name_window_set = false
  236.     if (/\\[Nn][Aa][Mm][Ee](.*?)\[(.+?)\]/.match(@now_text)) != nil
  237.       name_window_set = true
  238.       name_text = $2
  239.       @now_text.sub!(/\\[Nn][Aa][Mm][Ee](.*?)\[(.*?)\]/) { "" }
  240.     end
  241.     # 文字位置的判定
  242.     if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  243.       @popchar = $1.to_i
  244.       if @popchar == -1
  245.         @x = @indent = 48
  246.         @y = 4
  247.       end
  248.       @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  249.     end
  250.    
  251.     # 开始
  252.     begin
  253.       last_text = @now_text.clone
  254.       @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  255.     end until @now_text == last_text
  256.   @now_text.gsub!(/\\\\/) { "\000" }
  257.   @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  258.   @now_text.gsub!(/\\[Gg]/) { "\002" }
  259.   @now_text.gsub!(/\\[Tt]/) { "\004" }
  260.   @now_text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\050[#{$1}]" }
  261.   @now_text.gsub!(/\\[Ii]/) { "\023" }
  262.   @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  263.   @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  264.   @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  265.   @now_text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  266.   @now_text.gsub!(/\\[!]/) { "\020" }
  267. @now_text.gsub!(/\\[>]/) { "\016" }
  268. @now_text.gsub!(/\\[<]/) { "\017" }

  269. # Start
  270. # ◎
  271.     # "\\MS" を "\052" に、 "\\ME" を "\053" に変更
  272.     @now_text.gsub!(/\\[Mm][Ss]\[([0-9]+)\]/) { "\052[#{$1}]" }
  273.     @now_text.gsub!(/\\[Mm][Ee]/) { "\053" }
  274. # ◎
  275. # End

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


  817.   #参数的颜色自定义设定范围0-255
  818.   $ncolor0 = 255
  819.   $ncolor1 = 255
  820.   $ncolor2 = 255
  821.   #参数的颜色自定义设定范围0-255
  822.   
  823. #--------------------------------------------------------------------------
  824. # ● オブジェクト初期化
  825. #--------------------------------------------------------------------------
  826. def initialize(x, y, designate_text)
  827.   super(x-16, y-16, 32 + designate_text.size * 12, 56)
  828.   self.opacity = 0
  829.   self.back_opacity = 0
  830.   self.contents = Bitmap.new(self.width - 32, self.height - 32)
  831.   w = self.contents.width
  832.   h = self.contents.height

  833.   
  834.     #颜色自定义设定范围0-255
  835.     self.contents.font.color = Color.new($ncolor0, $ncolor1, $ncolor2)
  836.     #颜色自定义设定范围0-255

  837.    
  838.    
  839. #    self.contents.font.color = text_color(color)
  840.   self.contents.draw_text(0, 0, w, h, designate_text)
  841. end
  842. #--------------------------------------------------------------------------
  843. # ● 解放
  844. #--------------------------------------------------------------------------
  845. def dispose
  846.   self.contents.clear
  847.   super
  848. end
  849. end

复制代码

将以上复制到你的脚本里
注:这个脚本不是我的
然后改到   下--显示
会发现对话框变大了   再把某个图片放进你的游戏
最后按[显示图片]坐标改445  220  
就行了看下效果   还有,打名字时如打:李逍遥    就打这个 \C[6]李逍遥\C[0]


              [本贴由 御灵 于 2008-1-24 22:43:02 进行了编辑]
无签名,不解释

Lv1.梦旅人

梦石
0
星屑
50
在线时间
94 小时
注册时间
2007-6-3
帖子
801
3
 楼主| 发表于 2007-8-8 23:01:56 | 只看该作者
无签名,不解释
回复 支持 反对

使用道具 举报

Lv1.梦旅人

风雪夜不归人

梦石
0
星屑
50
在线时间
276 小时
注册时间
2006-3-7
帖子
6721

贵宾

4
发表于 2007-8-8 23:18:01 | 只看该作者
好……好长的脚本啊……效果……
有些人,到了七八月份就会诈尸。
宫斗,是女生永远的爱。
冷门,是本人不变的欲。
作弊,是玩家自由的痛。
练级,是橙光割舍的情。
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
1 小时
注册时间
2007-8-7
帖子
242
5
发表于 2007-8-8 23:28:34 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv3.寻梦者

昨日的黄昏

梦石
0
星屑
1005
在线时间
937 小时
注册时间
2006-11-5
帖子
4128

第2届短篇游戏比赛季军第3届短篇游戏大赛小游戏及其他组季军

6
发表于 2007-8-9 19:02:16 | 只看该作者
脚本来自仙剑时空传~坚定完毕~吃饭去了~{/hx}
[url=http://weibo.com/2238291690?s=6uyXnP]
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
94 小时
注册时间
2007-6-3
帖子
801
7
 楼主| 发表于 2007-8-9 19:03:40 | 只看该作者
以下引用坂崎由丽NKX于2007-8-8 16:24:46的发言:

貌似对话窗口太透明了,找不到新仙剑的感觉……

但也可以做别的游戏啊{/hx}
对新手不错{/tp}
无签名,不解释
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
94 小时
注册时间
2007-6-3
帖子
801
8
 楼主| 发表于 2007-8-9 19:09:29 | 只看该作者
[url][/url]
以下引用七夕小雨于2007-8-9 11:02:16的发言:

脚本来自仙剑时空传~坚定完毕~吃饭去了~

不对啊!灵儿续传也有啊{/fd}
无签名,不解释
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
15 小时
注册时间
2007-2-18
帖子
2464
9
发表于 2007-8-9 19:34:05 | 只看该作者
从IP上看
这个不是亿万的MJ啊
但头像...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
94 小时
注册时间
2007-6-3
帖子
801
10
 楼主| 发表于 2007-8-9 19:44:12 | 只看该作者
以下引用kaze于2007-8-9 11:34:05的发言:

从IP上看
这个不是亿万的MJ啊
但头像...

我就是借用一下嘛{/hx}{/tp}{/tp}
无签名,不解释
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-23 01:23

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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