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

Project1

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

[已经解决] 66rpg整合脚本中的对话加强如何改变角色姓名的字体颜色

[复制链接]

Lv1.梦旅人

梦石
0
星屑
55
在线时间
60 小时
注册时间
2009-7-16
帖子
199
跳转到指定楼层
1
发表于 2015-2-17 17:15:39 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 RyanBern 于 2015-2-17 17:38 编辑

如图,怎样更改姓名栏字体颜色?


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

Lv4.逐梦者

「Pemercyia」


Urhurrenna

梦石
0
星屑
9335
在线时间
2745 小时
注册时间
2008-9-5
帖子
3540

开拓者短篇八RM组冠军短篇九导演组亚军白银编剧

2
发表于 2015-2-17 17:43:15 | 只看该作者
在脚本最后面的"■ Air_Text"脚本里加两句就可以了~
  1. #==============================================================================
  2. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  3. #==============================================================================
  4. class Air_Text < Window_Base
  5.   #--------------------------------------------------------------------------
  6.   # ● オブジェクト初期化
  7.   #--------------------------------------------------------------------------
  8.   def initialize(x, y, designate_text)
  9.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  10.     self.opacity = 0
  11.     self.back_opacity = 0
  12.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  13.     self.contents.font.size = 20
  14.     w = self.contents.width
  15.     h = self.contents.height
  16.     self.contents.font.color = Color.new(255, 150 ,150)  # ←这里,可以自己设定Color颜色
  17.     self.contents.draw_text(0, 0, w, h, designate_text)
  18.     self.contents.font.color = normal_color                  # ←这里,以防万一还原一下颜色
  19.   end
  20.   #--------------------------------------------------------------------------
  21.   # ● 解放
  22.   #--------------------------------------------------------------------------
  23.   def dispose
  24.     self.contents.clear
  25.     super
  26.   end
  27. end
复制代码

点评

有效,非常感谢,颜色改好了。  发表于 2015-2-17 18:13

评分

参与人数 1梦石 +1 收起 理由
RyanBern + 1 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9275
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

3
发表于 2015-2-17 20:57:09 | 只看该作者
cinderelmini 发表于 2015-2-17 00:43
在脚本最后面的"■ Air_Text"脚本里加两句就可以了~

@hys111111 问题解决
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-25 07:10

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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