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

Project1

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

显示文章,崩字怎和么做啊?

 关闭 [复制链接]
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-6-28
帖子
10
跳转到指定楼层
1
发表于 2007-6-28 14:45:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-6-28
帖子
10
2
 楼主| 发表于 2007-6-28 14:45:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽

Lv1.梦旅人

梦石
0
星屑
60
在线时间
61 小时
注册时间
2006-9-15
帖子
946
3
发表于 2007-6-28 14:47:10 | 只看该作者
  1. #默认为一个字一个字的方式,如果需要一次全部显示,
  2. #请在游戏中使用脚本:$game_system.typing = true
  3.       
  4. #默认对话字没有声音,如果需要声音,
  5. #请在游戏中使用脚本:$game_system.soundname_on_speak = "这里输入文件名"
  6.   #我唯一一个见过“胡乱配音”的游戏是天使帝国2代,该游戏说话的时候每个字符随机发一个外星语音

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  741. #==============================================================================
  742. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  743. #==============================================================================
  744. class Window_Frame < Window_Base
  745.   #--------------------------------------------------------------------------
  746.   # ● オブジェクト初期化
  747.   #--------------------------------------------------------------------------
  748.   def initialize(x, y, width, height)
  749.     super(x, y, width, height)
  750.     self.contents = nil
  751.     self.back_opacity = 200
  752.   end
  753.   #--------------------------------------------------------------------------
  754.   # ● 解放
  755.   #--------------------------------------------------------------------------
  756.   def dispose
  757.     super
  758.     end
  759.   end
  760. #==============================================================================
  761. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  762. #==============================================================================
  763. class Air_Text < Window_Base
  764.   #--------------------------------------------------------------------------
  765.   # ● オブジェクト初期化
  766.   #--------------------------------------------------------------------------
  767.   def initialize(x, y, designate_text)
  768.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  769.     self.opacity = 0
  770.     self.back_opacity = 0
  771.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  772.     w = self.contents.width
  773.     h = self.contents.height
  774.     self.contents.draw_text(0, 0, w, h, designate_text)
  775.   end
  776.   #--------------------------------------------------------------------------
  777.   # ● 解放
  778.   #--------------------------------------------------------------------------
  779.   def dispose
  780.     self.contents.clear
  781.     super
  782.   end
  783. end
复制代码


参看说明把
系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2007-6-28
帖子
10
4
 楼主| 发表于 2007-6-28 15:09:11 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-9-21 10:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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