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

Project1

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

[已经解决] 对话加强脚本如何设置文字大小

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
20 小时
注册时间
2013-9-19
帖子
56
跳转到指定楼层
1
发表于 2013-10-1 18:57:17 | 只看该作者 |只看大图 回帖奖励 |正序浏览 |阅读模式

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

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

x
脚本内容如下
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4.  
  5. #——说明
  6.  
  7. #默认为一个字一个字的方式,如果需要一次全部显示,
  8. #请在游戏中使用脚本:$game_system.typing = true
  9.  
  10. #默认对话字没有声音,如果需要声音,
  11. #请在游戏中使用脚本:$game_system.soundname_on_speak = "这里输入文件名"
  12.   #我唯一一个见过“胡乱配音”的游戏是天使帝国2代,该游戏说话的时候每个字符随机发一个外星语音
  13.  
  14. # 其他在对话中可以使用的功能:
  15.  
  16. # \n[1]:显示1号角色的姓名
  17.  
  18. # \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
  19.  
  20. # \p[1]:对话框出现在1号事件的上方
  21. # \p[0]:主人公上方出现对话框
  22. #——————————————————使用\p功能后可以自动调整对话框大小
  23.  
  24. # \\:显示"\"这个符号
  25.  
  26. # \v[1] :显示变量1
  27.  
  28. # \v[a1] :显示防具1
  29.  
  30. # \v[w1] :显示武器1
  31.  
  32. # \v[i1] :显示物品1
  33.  
  34. # \v[s1] :显示特技1
  35.  
  36. # \c[1-8]:更改颜色
  37.  
  38. # \g:显示金钱窗口
  39.  
  40. # \a[SE文件名]:对话的时候播放SE
  41.  
  42. # \s[1-19]:更改弹字的速度
  43.  
  44. # \.   :停顿一刹那(1、2帧)
  45. # \|   :停顿片刻(20帧)
  46.  
  47. # \>   :文字不用打字方式
  48. # \<   :文字使用打字方式
  49.  
  50. # \!   :等待玩家按回车再继续
  51. # \~   :文字直接消失
  52.  
  53. # \I   :下一行从这个位置开始
  54.  
  55. # \o[123]:文字透明度改为123,模拟将死之人(汗)
  56.  
  57. # \h[12]:改用12号字
  58.  
  59. # \b[50]:空50象素
  60.  
  61. # \K[今天天气不错]:在出现“今天天气不错”这几个字的时候播放$game_system.soundname_on_speak设置的音效
  62.  
  63. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  64. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  65.  
  66. # \Lk:清除左边的图像
  67. # \Rk:清除右边的图像
  68.  
  69. #==============================================================================
  70. # ■ Game_System
  71. #------------------------------------------------------------------------------
  72. #  处理系统附属数据的类。也可执行诸如 BGM 管理之类的功能。本类的实例请参考
  73. # $game_system 。
  74. #==============================================================================
  75.  
  76. class Game_System
  77.   attr_accessor :typing
  78.   attr_accessor :soundname_on_speak
  79.   alias carol3_ini initialize
  80.   def initialize
  81.     carol3_ini
  82.     @typing = true
  83.     @soundname_on_speak = nil
  84.   end
  85. end
  86. $加密 = true
  87. #==============================================================================
  88. # ■ Window_Message
  89. #------------------------------------------------------------------------------
  90. class Window_Message < Window_Selectable
  91.   #--------------------------------------------------------------------------
  92.   # ● 初始化状态
  93.   #--------------------------------------------------------------------------
  94.   def initialize
  95.     super(80, 304, 480, 160)
  96.     self.contents = Bitmap.new(width - 32, height - 32)
  97.     self.visible = false
  98.     self.z = 9998
  99.     @fade_in = false
  100.     @fade_out = false
  101.     @contents_showing = false
  102.     @cursor_width = 0
  103.     self.active = false
  104.     self.index = -1
  105.     if $game_system.soundname_on_speak == nil then
  106.       $game_system.soundname_on_speak = ""
  107.     end
  108.     @opacity_text_buf = Bitmap.new(32, 32)
  109.   end
  110.   #--------------------------------------------------------------------------
  111.   # ● 释放
  112.   #--------------------------------------------------------------------------
  113.   def dispose
  114.     terminate_message
  115.     $game_temp.message_window_showing = false
  116.     if @input_number_window != nil
  117.       @input_number_window.dispose
  118.     end
  119.     super
  120.   end
  121.   #--------------------------------------------------------------------------
  122.   # ● 处理信息结束
  123.   #--------------------------------------------------------------------------
  124.   def terminate_message
  125.     self.active = false
  126.     self.pause = false
  127.     self.index = -1
  128.     self.contents.clear
  129.     # 清除显示中标志
  130.     @contents_showing = false
  131.     # 呼叫信息调用
  132.     if $game_temp.message_proc != nil
  133.       $game_temp.message_proc.call
  134.     end
  135.     # 清除文章、选择项、输入数值的相关变量
  136.     $game_temp.message_text = nil
  137.     $game_temp.message_proc = nil
  138.     $game_temp.choice_start = 99
  139.     $game_temp.choice_max = 0
  140.     $game_temp.choice_cancel_type = 0
  141.     $game_temp.choice_proc = nil
  142.     $game_temp.num_input_start = 99
  143.     $game_temp.num_input_variable_id = 0
  144.     $game_temp.num_input_digits_max = 0
  145.     # 开放金钱窗口
  146.     if @gold_window != nil
  147.       @gold_window.dispose
  148.       @gold_window = nil
  149.     end
  150.     if @name_window_frame != nil
  151.       @name_window_frame.dispose
  152.       @name_window_frame = nil
  153.     end
  154.     if @name_window_text != nil
  155.       @name_window_text.dispose
  156.       @name_window_text = nil
  157.     end
  158.     if @right_picture != nil and @right_keep == true
  159.       @right_picture.dispose
  160.     end   
  161.     if @left_picture != nil and @left_keep == true
  162.       @left_picture.dispose
  163.     end
  164.   end
  165.   def refresh
  166.     # 初期化
  167.     self.contents.clear
  168.     self.contents.font.color = normal_color
  169.     self.contents.font.size = Font.default_size
  170.     @x = @y = @max_x = @max_y = @indent = @lines = 0
  171.     @left_keep = @right_keep = false
  172.     @face_indent = 0
  173.     [url=home.php?mod=space&uid=316553]@opacity[/url] = 255
  174.     @cursor_width = 0
  175.     @write_speed = 0
  176.     @write_wait = 0
  177.     @mid_stop = false
  178.     @face_file = nil
  179.     @popchar = -2
  180.     if $game_temp.choice_start == 0
  181.       @x = 8
  182.     end
  183.     if $game_temp.message_text != nil
  184.       @now_text = $game_temp.message_text
  185.       #——头像设置
  186.       if (/\\[Ff]\[(.+?)\]/.match(@now_text))!=nil then
  187.         @face_file = $1 + ".png"
  188.         @x = @face_indent = 128
  189.         if FileTest.exist?("Graphics/Pictures/" + $1 + ".png")
  190.           self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  191.         end
  192.         @now_text.gsub!(/\\[Ff]\[(.*?)\]/) { "" }
  193.       end
  194.       #——左半身像设置
  195.       if (/\\[Ll]\[(.+?)\]/.match(@now_text))!=nil then
  196.         [url=home.php?mod=space&uid=84331]@face[/url] = "66rpg_" + $1 + "_h.png"
  197.         if $加密 == true
  198.           if @left_picture != nil
  199.             @left_picture.dispose
  200.           end
  201.           @left_picture = Sprite.new
  202.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  203.           @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  204.           @left_picture.x = 0
  205.           @left_picture.mirror = true
  206.           @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  207.         else         
  208.           if FileTest.exist?("Graphics/battlers/#{@face}")
  209.             if @left_picture != nil
  210.               @left_picture.dispose
  211.             end
  212.             @left_picture = Sprite.new
  213.             @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  214.             @left_picture.y = [email]480-@left_picture.bitmap.height[/email]
  215.             @left_picture.x = 0
  216.             @left_picture.mirror = true
  217.             @now_text.gsub!(/\\[Ll]\[(.*?)\]/) { "" }
  218.           end
  219.         end        
  220.       end
  221.       #——右半身像设置
  222.       if (/\\[Rr]\[(.+?)\]/.match(@now_text))!=nil then
  223.         @face = "66rpg_" + $1 + "_h.png"
  224.         if $加密 == true
  225.           if @right_picture != nil
  226.             @right_picture.dispose
  227.           end
  228.           @right_picture = Sprite.new
  229.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  230.           @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  231.           @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  232.           @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  233.         else
  234.           if FileTest.exist?("Graphics/battlers/#{@face}")
  235.             if @right_picture != nil
  236.               @right_picture.dispose
  237.             end
  238.             @right_picture = Sprite.new
  239.             @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{@face}")
  240.             @right_picture.y = [email]480-@right_picture.bitmap.height[/email]
  241.             @right_picture.x = [email]640-@right_picture.bitmap.width[/email]
  242.             @now_text.gsub!(/\\[Rr]\[(.*?)\]/) { "" }
  243.           end
  244.         end
  245.       end
  246.       if (/\\[Rr]k/.match(@now_text)) != nil
  247.         @right_keep = true
  248.         @now_text.sub!(/\\[Rr]k/) { "" }
  249.       end
  250.       if (/\\[Ll]k/.match(@now_text)) != nil
  251.         @left_keep = true
  252.         @now_text.sub!(/\\[Ll]k/) { "" }
  253.       end
  254.       # 显示人物姓名
  255.       name_window_set = false
  256.       if (/\\[Nn]ame\[(.+?)\]/.match(@now_text)) != nil
  257.         name_window_set = true
  258.         name_text = $1
  259.         @now_text.sub!(/\\[Nn]ame\[(.*?)\]/) { "" }
  260.       end
  261.  
  262.       # 文字位置的判定
  263.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(@now_text))!=nil then
  264.         @popchar = $1.to_i
  265.         if @popchar == -1
  266.           @x = @indent = 48
  267.           @y = 4
  268.         end
  269.         @now_text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  270.       end
  271.  
  272.       # 开始
  273.       begin
  274.         last_text = @now_text.clone
  275.         @now_text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  276.       end until @now_text == last_text
  277.       @now_text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  278.       $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  279.     end
  280.     @now_text.gsub!(/\\\\/) { "\000" }
  281.     @now_text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  282.     @now_text.gsub!(/\\[Gg]/) { "\002" }
  283.     @now_text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\003[#{$1}]" }
  284.     @now_text.gsub!(/\\[Aa]\[(.*?)\]/) { "\004[#{$1}]" }
  285.     @now_text.gsub!(/\\[.]/) { "\005" }
  286.     @now_text.gsub!(/\\[|]/) { "\006" }
  287.  
  288.     @now_text.gsub!(/\\[>]/) { "\016" }
  289.     @now_text.gsub!(/\\[<]/) { "\017" }
  290.     @now_text.gsub!(/\\[!]/) { "\020" }
  291.     @now_text.gsub!(/\\[~]/) { "\021" }
  292.  
  293.     @now_text.gsub!(/\\[Ii]/) { "\023" }
  294.     @now_text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  295.     @now_text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  296.     @now_text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  297.     @now_text.gsub!(/\\[Kk]\[(.*?)\]/) { "\027[#{$1}]" }
  298.     if @popchar >= 0
  299.       @text_save = @now_text.clone
  300.       @max_x = 0
  301.       @max_y = 4
  302.       for i in 0..3
  303.         line = @now_text.split(/\n/)[3-i]
  304.         @max_y -= 1 if line == nil and @max_y <= 4-i
  305.         next if line == nil
  306.         cx = contents.text_size(line).width
  307.         @max_x = cx if cx > @max_x
  308.       end
  309.       self.width = @max_x + 48 + @face_indent
  310.       self.height = (@max_y - 1) * 32 + 64
  311.     else
  312.       @max_x = self.width - 32 - @face_indent
  313.     end
  314.     reset_window
  315.       if name_window_set
  316.         off_x = 0
  317.         off_y = -40
  318.         space = 2
  319.         x = self.x + off_x - space / 2
  320.         y = self.y + off_y - space / 2
  321.         w = self.contents.text_size(name_text).width + 26 + space
  322.         h = 40 + space
  323.         @name_window_frame = Window_Frame.new(x, y, w, h)
  324.         @name_window_frame.z = self.z + 1
  325.         x = self.x + off_x + 4
  326.         y = self.y + off_y
  327.         @name_window_text = Air_Text.new(x+4, y+6, name_text)
  328.         @name_window_text.z = self.z + 2
  329.       end
  330.     end
  331.     reset_window
  332.     if $game_temp.choice_max > 0
  333.       @item_max = $game_temp.choice_max
  334.       self.active = true
  335.       self.index = 0
  336.     end
  337.     if $game_temp.num_input_variable_id > 0
  338.       digits_max = $game_temp.num_input_digits_max
  339.       number = $game_variables[$game_temp.num_input_variable_id]
  340.       @input_number_window = Window_InputNumber.new(digits_max)
  341.       @input_number_window.number = number
  342.       @input_number_window.x = self.x + 8
  343.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  344.     end
  345.   end
  346.   #--------------------------------------------------------------------------
  347.   # ● 更新
  348.   #--------------------------------------------------------------------------
  349.   def update
  350.     super
  351.     if @fade_in
  352.       self.contents_opacity += 24
  353.       if @input_number_window != nil
  354.         @input_number_window.contents_opacity += 24
  355.       end
  356.       if self.contents_opacity == 255
  357.         @fade_in = false
  358.       end
  359.       return
  360.     end
  361.     @now_text = nil if @now_text == ""
  362.  
  363.     if @now_text != nil and @mid_stop == false
  364.       if @write_wait > 0
  365.         @write_wait -= 1
  366.         return
  367.       end
  368.       text_not_skip = $game_system.typing
  369.       while true
  370.         @max_x = @x if @max_x < @x
  371.         @max_y = @y if @max_y < @y
  372.         if (c = @now_text.slice!(/./m)) != nil
  373.           if c == "\000"
  374.             c = "\\"
  375.           end
  376.           if c == "\001"
  377.             @now_text.sub!(/\[([0-9]+)\]/, "")
  378.             color = $1.to_i
  379.             if color >= 0 and color <= 7
  380.               self.contents.font.color = text_color(color)
  381.             end
  382.             c = ""
  383.           end
  384.           if c == "\002"
  385.             if @gold_window == nil and @popchar <= 0
  386.               @gold_window = Window_Gold.new
  387.               @gold_window.x = 560 - @gold_window.width
  388.               if $game_temp.in_battle
  389.                 @gold_window.y = 192
  390.               else
  391.                 @gold_window.y = self.y >= 128 ? 32 : 384
  392.               end
  393.               @gold_window.opacity = self.opacity
  394.               @gold_window.back_opacity = self.back_opacity
  395.             end
  396.             c = ""
  397.           end
  398.           if c == "\003"
  399.             @now_text.sub!(/\[([0-9]+)\]/, "")
  400.             speed = $1.to_i
  401.             if speed >= 0 and speed <= 19
  402.               @write_speed = speed
  403.             end
  404.             c = ""
  405.           end
  406.           if c == "\004"
  407.             @now_text.sub!(/\[(.*?)\]/, "")
  408.             buftxt = $1.dup.to_s
  409.             if buftxt.match(/\//) == nil and buftxt != "" then
  410.               $game_system.soundname_on_speak = "Audio/SE/" + buftxt
  411.             else
  412.               $game_system.soundname_on_speak = buftxt.dup
  413.             end
  414.             c = ""
  415.           elsif c == "\004"
  416.             c = ""
  417.           end
  418.           if c == "\005"
  419.             @write_wait += 5
  420.             c = ""
  421.           end
  422.           if c == "\006"
  423.             @write_wait += 20
  424.             c = ""
  425.           end
  426.           if c == "\016"
  427.             text_not_skip = false
  428.             c = ""
  429.           end
  430.           if c == "\017"
  431.             text_not_skip = true
  432.             c = ""
  433.           end
  434.           if c == "\020"
  435.             @mid_stop = true
  436.             c = ""
  437.           end
  438.           if c == "\021"
  439.             terminate_message
  440.             return
  441.           end
  442.           if c == "\023"
  443.             @indent = @x
  444.             c = ""
  445.           end
  446.           if c == "\024"
  447.             @now_text.sub!(/\[([0-9]+)\]/, "")
  448.             @opacity = $1.to_i
  449.             c = ""
  450.           end
  451.           if c == "\025"
  452.             @now_text.sub!(/\[([0-9]+)\]/, "")
  453.             self.contents.font.size = [[$1.to_i, 6].max, 32].min
  454.             c = ""
  455.           end
  456.           if c == "\026"
  457.             @now_text.sub!(/\[([0-9]+)\]/, "")
  458.             @x += $1.to_i
  459.             c = ""
  460.           end
  461.           if c == "\027"
  462.             @now_text.sub!(/\[(.*?)\]/, "")
  463.             @x += ruby_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), $1, @opacity)
  464.             if $game_system.soundname_on_speak != ""
  465.               Audio.se_play($game_system.soundname_on_speak)
  466.             end
  467.             c = ""
  468.           end
  469.           if c == "\030"
  470.             @now_text.sub!(/\[(.*?)\]/, "")
  471.             self.contents.blt(@x , @y * line_height + 8, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  472.            if $game_system.soundname_on_speak != ""
  473.               Audio.se_play($game_system.soundname_on_speak)
  474.             end
  475.             @x += 24
  476.             c = ""
  477.           end
  478.           if c == "\n"
  479.             if @lines >= $game_temp.choice_start
  480.               @cursor_width = [@cursor_width, @max_x - @face_indent].max
  481.             end
  482.             @lines += 1
  483.             @y += 1
  484.             @x = 0 + @indent + @face_indent
  485.             if @lines >= $game_temp.choice_start
  486.               @x = 8 + @indent + @face_indent
  487.             end
  488.             c = ""
  489.           end
  490.           if c != ""
  491.             # 文字描画
  492.             @x += opacity_draw_text(self.contents, @x, @y * line_height + (line_height - self.contents.font.size), c, @opacity)
  493.             if $game_system.soundname_on_speak != "" then
  494.             Audio.se_play($game_system.soundname_on_speak)
  495.             end
  496.           end
  497.           if Input.press?(Input::B)
  498.             text_not_skip = false
  499.           end
  500.         else
  501.           text_not_skip = true
  502.           break
  503.         end
  504.         # 終了判定
  505.         if text_not_skip
  506.           break
  507.         end
  508.       end
  509.       @write_wait += @write_speed
  510.       return
  511.     end
  512.     if @input_number_window != nil
  513.       @input_number_window.update
  514.       # 決定
  515.       if Input.trigger?(Input::C)
  516.         $game_system.se_play($data_system.decision_se)
  517.         $game_variables[$game_temp.num_input_variable_id] =
  518.         @input_number_window.number
  519.         $game_map.need_refresh = true
  520.         @input_number_window.dispose
  521.         @input_number_window = nil
  522.         terminate_message
  523.       end
  524.       return
  525.     end
  526.     if @contents_showing
  527.       if $game_temp.choice_max == 0
  528.         self.pause = true
  529.       end
  530.       # 取消
  531.       if Input.trigger?(Input::B)
  532.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  533.           $game_system.se_play($data_system.cancel_se)
  534.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  535.           terminate_message
  536.         end
  537.       end
  538.       # 決定
  539.       if Input.trigger?(Input::C)
  540.         if $game_temp.choice_max > 0
  541.           $game_system.se_play($data_system.decision_se)
  542.           $game_temp.choice_proc.call(self.index)
  543.         end
  544.         if @mid_stop
  545.           @mid_stop = false
  546.           return
  547.         else
  548.           terminate_message
  549.         end
  550.       end
  551.       return
  552.     end
  553.     if @fade_out == false and $game_temp.message_text != nil
  554.       @contents_showing = true
  555.       $game_temp.message_window_showing = true
  556.       refresh
  557.       Graphics.frame_reset
  558.       self.visible = true
  559.       self.contents_opacity = 0
  560.     if @input_number_window != nil
  561.       @input_number_window.contents_opacity = 0
  562.     end
  563.       @fade_in = true
  564.       return
  565.     end
  566.     if self.visible
  567.       @fade_out = true
  568.       self.opacity -= 48
  569.       if self.opacity == 0
  570.         self.visible = false
  571.         @fade_out = false
  572.         $game_temp.message_window_showing = false
  573.       end
  574.       return
  575.     end
  576.   end
  577.   #--------------------------------------------------------------------------
  578.   # ● 获得字符
  579.   #--------------------------------------------------------------------------
  580.   def get_character(parameter)
  581.     case parameter
  582.     when 0
  583.       return $game_player
  584.     else
  585.       events = $game_map.events
  586.       return events == nil ? nil : events[parameter]
  587.     end
  588.   end
  589.   #--------------------------------------------------------------------------
  590.   # ● ウィンドウの位置と不透明度の設定
  591.   #--------------------------------------------------------------------------
  592.   def reset_window
  593.     # 判定
  594.     if @popchar >= 0
  595.       events = $game_map.events
  596.       if events != nil
  597.         character = get_character(@popchar)
  598.         x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  599.         y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  600.         self.x = x
  601.         self.y = y
  602.       end
  603.     elsif @popchar == -1
  604.       self.x = -4
  605.       self.y = -4
  606.       self.width = 648
  607.       self.height = 488
  608.     else
  609.       if $game_temp.in_battle
  610.         self.y = 16
  611.       else
  612.         case $game_system.message_position
  613.         when 0 # 上
  614.           self.y = 16
  615.         when 1 # 中
  616.           self.y = 160
  617.         when 2 # 下
  618.           self.y = 304
  619.         end
  620.         self.x = 80
  621.         if @face_file == nil
  622.           self.width = 480
  623.         else
  624.           self.width = 600
  625.           self.x -= 60
  626.         end
  627.         self.height = 160
  628.       end
  629.     end
  630.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  631.     if @face_file != nil
  632.       self.contents.blt(16, 16, RPG::Cache.picture(@face_file), Rect.new(0, 0, 96, 96))
  633.     end
  634.     if @popchar == -1
  635.       self.opacity = 255
  636.       self.back_opacity = 0
  637.     elsif $game_system.message_frame == 0
  638.       self.opacity = 255
  639.       self.back_opacity = 200
  640.     else
  641.       self.opacity = 0
  642.       self.back_opacity = 200
  643.     end
  644.   end
  645.   #--------------------------------------------------------------------------
  646.   # ● line_height
  647.   #--------------------------------------------------------------------------
  648.   # 返回値:行高
  649.   #--------------------------------------------------------------------------
  650.   def line_height
  651.     return 32
  652.     if self.contents.font.size >= 20 and self.contents.font.size <= 24
  653.       return 32
  654.     else
  655.       return self.contents.font.size * 15 / 10
  656.     end
  657.   end
  658.   #--------------------------------------------------------------------------
  659.   # ● 透過文字描画
  660.   #--------------------------------------------------------------------------
  661.   # target :描画対象。Bitmapクラスを指定。
  662.   # x :x座標
  663.   # y :y座標
  664.   # str  :描画文字列
  665.   # opacity:透過率(0~255)
  666.   # 返回値 :文字幅(@x増加値)。
  667.   #--------------------------------------------------------------------------
  668.   def opacity_draw_text(target, x, y, str,opacity)
  669.     height = target.font.size
  670.     width = target.text_size(str).width
  671.     opacity = [[opacity, 0].max, 255].min
  672.     if opacity == 255
  673.       target.draw_text(x, y, width, height, str)
  674.       return width
  675.     else
  676.       if @opacity_text_buf.width < width or @opacity_text_buf.height < height
  677.         @opacity_text_buf.dispose
  678.         @opacity_text_buf = Bitmap.new(width, height)
  679.       else
  680.         @opacity_text_buf.clear
  681.       end
  682.       @opacity_text_buf.font.size = target.font.size
  683.       @opacity_text_buf.draw_text(0, 0, width, height, str)
  684.       target.blt(x, y, @opacity_text_buf, Rect.new(0, 0, width, height), opacity)
  685.     return width
  686.     end
  687.   end
  688.   def ruby_draw_text(target, x, y, str,opacity)
  689.     sizeback = target.font.size
  690.     target.font.size * 3 / 2 > 32 ? rubysize = 32 - target.font.size : rubysize = target.font.size / 2
  691.     rubysize = [rubysize, 6].max
  692.  
  693.     opacity = [[opacity, 0].max, 255].min
  694.     split_s = str.split(/,/)
  695.  
  696.     split_s[0] == nil ? split_s[0] = "" : nil
  697.     split_s[1] == nil ? split_s[1] = "" : nil
  698.  
  699.     height = sizeback + rubysize
  700.     width = target.text_size(split_s[0]).width
  701.  
  702.     target.font.size = rubysize
  703.     ruby_width = target.text_size(split_s[1]).width
  704.     target.font.size = sizeback
  705.  
  706.     buf_width = [target.text_size(split_s[0]).width, ruby_width].max
  707.  
  708.     width - ruby_width != 0 ? sub_x = (width - ruby_width) / 2 : sub_x = 0
  709.  
  710.     if opacity == 255
  711.       target.font.size = rubysize
  712.       target.draw_text(x + sub_x, y - target.font.size, target.text_size(split_s[1]).width, target.font.size, split_s[1])
  713.       target.font.size = sizeback
  714.       target.draw_text(x, y, width, target.font.size, split_s[0])
  715.       return width
  716.     else
  717.       if @opacity_text_buf.width < buf_width or @opacity_text_buf.height < height
  718.         @opacity_text_buf.dispose
  719.         @opacity_text_buf = Bitmap.new(buf_width, height)
  720.       else
  721.         @opacity_text_buf.clear
  722.       end
  723.       @opacity_text_buf.font.size = rubysize
  724.       @opacity_text_buf.draw_text(0 , 0, buf_width, rubysize, split_s[1], 1)
  725.       @opacity_text_buf.font.size = sizeback
  726.       @opacity_text_buf.draw_text(0 , rubysize, buf_width, sizeback, split_s[0], 1)
  727.       if sub_x >= 0
  728.         target.blt(x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  729.       else
  730.         target.blt(x + sub_x, y - rubysize, @opacity_text_buf, Rect.new(0, 0, buf_width, height), opacity)
  731.       end
  732.       return width
  733.     end
  734.   end
  735.   #--------------------------------------------------------------------------
  736.   # ● \V 变换
  737.   #--------------------------------------------------------------------------
  738.   def convart_value(option, index)
  739.     option == nil ? option = "" : nil
  740.     option.downcase!
  741.     case option
  742.       when "i"
  743.         unless $data_items[index].name == nil
  744.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  745.         end
  746.       when "w"
  747.         unless $data_weapons[index].name == nil
  748.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  749.         end
  750.       when "a"
  751.         unless $data_armors[index].name == nil
  752.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  753.         end
  754.       when "s"
  755.         unless $data_skills[index].name == nil
  756.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  757.         end
  758.       else
  759.       r = $game_variables[index]
  760.     end
  761.     r == nil ? r = "" : nil
  762.     return r
  763.   end
  764.   #--------------------------------------------------------------------------
  765.   # ● 解放
  766.   #--------------------------------------------------------------------------
  767.   def dispose
  768.     terminate_message
  769.     if @gaiji_cache != nil
  770.       unless @gaiji_cache.disposed?
  771.         @gaiji_cache.dispose
  772.       end
  773.     end
  774.     unless @opacity_text_buf.disposed?
  775.       @opacity_text_buf.dispose
  776.     end
  777.     $game_temp.message_window_showing = false
  778.     if @input_number_window != nil
  779.       @input_number_window.dispose
  780.     end
  781.     super
  782.   end
  783.   #--------------------------------------------------------------------------
  784.   # ● 矩形更新
  785.   #--------------------------------------------------------------------------
  786.   def update_cursor_rect
  787.     if @index >= 0
  788.       n = $game_temp.choice_start + @index
  789.       self.cursor_rect.set(4 + @indent + @face_indent, n * 32 + 4, @cursor_width, 32)
  790.     else
  791.       self.cursor_rect.empty
  792.     end
  793.   end
  794. end
  795. #==============================================================================
  796. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  797. #==============================================================================
  798. class Window_Frame < Window_Base
  799.   #--------------------------------------------------------------------------
  800.   # ● オブジェクト初期化
  801.   #--------------------------------------------------------------------------
  802.   def initialize(x, y, width, height)
  803.     super(x, y, width, height)
  804.     self.contents = nil
  805.     self.back_opacity = 200
  806.   end
  807.   #--------------------------------------------------------------------------
  808.   # ● 解放
  809.   #--------------------------------------------------------------------------
  810.   def dispose
  811.     super
  812.     end
  813.   end
  814. #==============================================================================
  815. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  816. #==============================================================================
  817. class Air_Text < Window_Base
  818.   #--------------------------------------------------------------------------
  819.   # ● オブジェクト初期化
  820.   #--------------------------------------------------------------------------
  821.   def initialize(x, y, designate_text)
  822.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  823.     self.opacity = 0
  824.     self.back_opacity = 0
  825.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  826.     w = self.contents.width
  827.     h = self.contents.height
  828.     self.contents.draw_text(0, 0, w, h, designate_text)
  829.   end
  830.   #--------------------------------------------------------------------------
  831.   # ● 解放
  832.   #--------------------------------------------------------------------------
  833.   def dispose
  834.     self.contents.clear
  835.     super
  836.   end
  837. end
  838.  
  839.  
  840. #==============================================================================
  841. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  842. #==============================================================================


如何设置文字大小呢?我想在文字输入内做到把文字输入至最后也不会显示不到的问题。

点评

哦,明白了。过一会儿解决  发表于 2013-10-2 08:19
.

Lv3.寻梦者

○赛

梦石
0
星屑
1249
在线时间
1276 小时
注册时间
2013-1-22
帖子
2246

贵宾

4
发表于 2013-10-3 07:16:22 | 只看该作者
这个需要修改RPG模块。。。在F1里找找module RPG试试吧
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
76
在线时间
1379 小时
注册时间
2012-7-5
帖子
1698

开拓者

3
发表于 2013-10-2 10:31:31 | 只看该作者
本帖最后由 kuerlulu 于 2013-10-2 12:29 编辑

\h[12]使用12号字
补充:
169行font.size后面更改一个你想要的数字

不知道为什么不能改,看来脚本中对字体大小重新进行了定义。。
# 不是正解的答案@asd904433675

点评

用你的方法可以了,原来是之前改错了地方!谢谢!  发表于 2013-10-3 08:31
未解决,求详细办法,我把170行的0改成1后,字便从对话框的第二行显示了。  发表于 2013-10-2 11:19
这个试过了,只限于本段文字...我想要永远都能改变字号大小的..  发表于 2013-10-2 10:42

评分

参与人数 1星屑 +60 收起 理由
myownroc + 60 认可答案

查看全部评分


  -fk: -azogi:
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3846
在线时间
1966 小时
注册时间
2013-1-3
帖子
9536
2
发表于 2013-10-1 22:14:01 | 只看该作者
我记得这里有一行注释是:用12号字显示…

点评

这个试过了,只限于本段文字...我想要永远都能改变字号大小的..  发表于 2013-10-1 23:09
《宿愿·寻剑篇》正式版已经发布!快去看看!点击进入论坛发布贴
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-30 04:32

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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