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

Project1

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

[已经解决] 关于这个“呼出对话框优化版”的问题~~

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
72 小时
注册时间
2011-9-5
帖子
30
跳转到指定楼层
1
发表于 2011-10-9 21:52:15 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 巽离阔 于 2011-10-9 21:55 编辑

就是下面那个脚本,效果是如果文章第一行有个冒号的话他会自动用中括号括起来然后变成蓝色字,如果没有冒号所有文字就成了白色字了看不清楚

请问怎么调整没有冒号时的文章文字的颜色?还有怎么修改那个蓝色中括号的效果?

有冒号时




没有冒号时字变成了白色···



  1. #==============================================================================
  2. #    呼出对话框优化版
  3. #    原版作者:by パラ犬(日)
  4. #    汉化修改: by bbschat◎66RPG.com,2006年1月
  5. #    脚本更新:by KKME◎66RPG.com,2007年2月
  6. #    脚本更新:by 绫晓露雪萌◎66RPG.com,2007年7月
  7. #    脚本优化:by Linki Shy,2010年5月
  8. #------------------------------------------------------------------------------
  9. # 使用说明:
  10. #   1. 此脚本主要是解决了在1.03版XP上的方块问题,以及增加了一些功能
  11. #
  12. #   2. 人名美化使用方法与以前一样
  13. #
  14. #   3. 默认人物头像在左边显示
  15. #      如果需要右边显示,在输入的名称之后加"@r"即可
  16. #      例: "阿尔西斯@r:"(注意必须小写)
  17. #
  18. #   4. 在对话中更改字体的方法:
  19. #       \f[X]:更改字号为X
  20. #
  21. #   5. 在对话中显示(技能 物品 武器 防具 人物)图标和名称的方法:
  22. #       \s[X]: 显示第X号技能图标和名称
  23. #       \i[X]: 显示第X号物品图标和名称
  24. #       \w[X]: 显示第X号武器图标和名称
  25. #       \a[X]: 显示第X号防具图标和名称
  26. #       \r[X]: 显示第X号人物图标和名称
  27. #
  28. #   6. 在对话中更改文字不透明度的方法:
  29. #       \o[X]: 把文字不透明度更改为X (取值范围为0~255)
  30. #   
  31. #   7. 在对话中关闭或开启拟声音效的方法:
  32. #       \q:默认开启时,执行一次关闭,再执行一次则开启
  33. #
  34. #   8. 如果需要自定义字体颜色,
  35. #       可以打开"Graphics/Windowskins"目录下的"Window.png"文件查看
  36. #       使用方法与VX类似
  37. #
  38. # 素材要求:
  39. #   1. 要求所有半身像朝向一致(默认是正面偏右)
  40. #
  41. #--------------------------------------------------------------------------
  42. # ● 参数设置
  43. #--------------------------------------------------------------------------
  44. # 预设字体组
  45.   FONT_ARRAY = ["黑体", "宋体", "仿宋_GB2312"]
  46. # 控制显示尾部图标的开关号
  47.   TAIL_SHOW  = true
  48. # 头像图片保存目录的设定
  49.   FACE_PIC_DIR = "Graphics/Faces/"
  50. # 呼出对话框用Skin设定
  51.   FUKI_SKIN_NAME = "Window"
  52. # 字体大小
  53.   MES_FONT_SIZE = 20
  54. # 字体颜色
  55.   FUKI_COLOR = Color.new(0, 0, 0, 255)
  56. # 窗口透明度
  57.   FUKI_OPACITY = 255         # 呼出对话框
  58.   MES_OPACITY = 160          # 默认信息窗口
  59. # 窗口表示时是否根据画面大小自动检查窗口出现的位置,
  60. # 自动改变位置( true / false )
  61.   POS_FIX = true
  62. # 角色高度尺寸
  63.   CHARACTOR_HEIGHT = 50
  64. # 呼出对话框的相对位置(纵坐标)
  65.   POP_SHIFT_TOP = 0          # 表示位置为上的时候
  66.   POP_SHIFT_UNDER = -4       # 表示位置为下的时候
  67. # 信息的表示速度(数字越小速度越快,0为瞬间表示)
  68. # 游戏中 可随时用数字代入 $mes_speed 来改变消息表示速度。
  69.   MES_SPEED = 0
  70.   
  71.   $play_voice = false
  72.   $mes_name = ""
  73.   $mes_id   = nil
  74. #==============================================================================

  75. #==============================================================================
  76. # 方便用户同时设置2个常用参数而使用的函数
  77. #==============================================================================
  78. def chat(id = nil,name = "")
  79.   $mes_id = id
  80.   $mes_name = name
  81. end

  82. #==============================================================================
  83. # □ Game_Temp
  84. #==============================================================================

  85. class Game_Temp
  86.   attr_accessor  :namebmp              #保存头像图片的Hash表
  87.   alias initialize_fuki initialize
  88.   def initialize
  89.     initialize_fuki
  90.     # 如果不想使用角色名字直接作为头像文件名
  91.     # 可在这里重新设定角色名字与文件名的对应关系
  92.     @namebmp ={"玩家"=>"维斯特"}
  93.   end
  94. end

  95. #==============================================================================
  96. # ■ Window_InputNumber
  97. #==============================================================================

  98. class Window_InputNumber < Window_Base
  99.   #--------------------------------------------------------------------------
  100.   # ● 初始化对像
  101.   #     digits_max : 位数
  102.   #--------------------------------------------------------------------------
  103.   def initialize(digits_max)
  104.     @digits_max = digits_max
  105.     @number = 0
  106.     # 从数字的幅度计算(假定与 0~9 等幅)光标的幅度
  107.     dummy_bitmap = Bitmap.new(MES_FONT_SIZE, MES_FONT_SIZE)
  108.     @cursor_width = dummy_bitmap.text_size("0").width + 8
  109.     dummy_bitmap.dispose
  110.     super(0, 0, @cursor_width * @digits_max + 32, 64)
  111.     self.contents = Bitmap.new(width - 32, height - 32)
  112.     self.contents.font.size = MES_FONT_SIZE
  113.     self.contents.font.color = FUKI_COLOR
  114.     self.z += 9999
  115.     self.opacity = 0
  116.     @index = 0
  117.     refresh
  118.     update_cursor_rect
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 更新光标矩形
  122.   #--------------------------------------------------------------------------
  123.   def update_cursor_rect
  124.     self.cursor_rect.set(@index * @cursor_width-4, 0, @cursor_width, MES_FONT_SIZE + 4)
  125.   end
  126.   #--------------------------------------------------------------------------
  127.   # ● 刷新
  128.   #--------------------------------------------------------------------------
  129.   def refresh
  130.     self.contents.clear
  131.     s = sprintf("%0*d", @digits_max, @number)
  132.     for i in 0...@digits_max
  133.       self.contents.draw_text(i * @cursor_width, 0, 24, MES_FONT_SIZE + 4, s[i,1])
  134.     end
  135.   end
  136. end

  137. #==============================================================================
  138. # □ Window_Message
  139. #==============================================================================

  140. class Window_Message < Window_Selectable
  141.   
  142.   #--------------------------------------------------------------------------
  143.   # ● 初始化状态
  144.   #--------------------------------------------------------------------------
  145.   def initialize
  146.     super(80, 304, 480, 160)
  147.     self.contents = Bitmap.new(width - 32, height - 32)
  148.     self.contents.font.color = text_color(0)
  149.     self.visible = false
  150.     self.z = 9998
  151.     @fade_in = false
  152.     @fade_out = false
  153.     @contents_showing = false
  154.     @cursor_width = 0
  155.     self.active = false
  156.     self.index = -1
  157.     @w = 0
  158.     @h = 0
  159.     @wait = 0
  160.     @dx = 0
  161.     @dy = 0
  162.     $mes_speed = MES_SPEED
  163.     #------------------------
  164.     # ★ 特殊时期中断标志
  165.     #------------------------
  166.     @no_term_stop = false
  167.     @save_x = 0
  168.     @save_y = 0
  169.     @old_text_info = []
  170.     @show_right = false
  171.     @show_name  = false
  172.     @face_width = 0
  173.   end
  174.   #--------------------------------------------------------------------------
  175.   # ○ 决定窗口尺寸并生成窗口
  176.   #--------------------------------------------------------------------------
  177.   def refresh_create
  178.     unless @no_term_stop
  179.       @pic_skin.dispose if @pic_skin != nil
  180.       if $game_temp.message_text.include?(":")
  181.         if $game_temp.message_text.include?("@r")
  182.           @show_right = true
  183.           $game_temp.message_text.sub!(/\@r/, "")
  184.         end
  185.         @show_name = true
  186.         $game_temp.message_text = '\c[7]【' + $game_temp.message_text
  187.         $game_temp.message_text.sub!(/\:/, '\c[7]】\c[0]')
  188.       end
  189.       self.contents.clear
  190.       self.contents.font.color = normal_color
  191.       # 取得窗口尺寸
  192.       get_windowsize
  193.       w = @w + 40
  194.       h = @h * (self.contents.font.size + 4) + 30
  195.       h = 64 if h < 64
  196.       # 生成呼出窗口
  197.       set_fukidasi(self.x, self.y, w, h)
  198.       draw_msg_face
  199.       create_backbmp
  200.     end
  201.     # 初始化信息表示使用的变量
  202.     @dx = @save_x
  203.     @dx += @face_width unless @show_right
  204.     @dy = @save_y
  205.     @cursor_width = 0
  206.     @contents_drawing = true
  207.     #update
  208.     # 瞬间表示的情况下
  209.     if $mes_speed == 0
  210.       # 循环信息描绘处理
  211.       while $game_temp.message_text != ""
  212.         draw_massage
  213.       end
  214.       draw_opt_text
  215.       @contents_showing_end = true
  216.       @contents_drawing = false
  217.     else
  218.       # 一个一个描绘文字
  219.       refresh_drawtext
  220.     end
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # ○ 一个一个描绘文字
  224.   #--------------------------------------------------------------------------
  225.   def refresh_drawtext
  226.     if $game_temp.message_text != ""
  227.       if @wait > 0
  228.         @wait -= 1
  229.       elsif @wait == 0
  230.         # 描绘处理
  231.         draw_massage
  232.         @wait = $mes_speed
  233.       end
  234.     else
  235.       draw_opt_text
  236.       @contents_showing_end = true
  237.       @contents_drawing = false
  238.     end
  239.   end
  240.   #--------------------------------------------------------------------------
  241.   # ○ 取得窗口尺寸
  242.   #--------------------------------------------------------------------------
  243.   def get_windowsize
  244.     get_face_width($mes_name)
  245.     x = y = 0
  246.     @h = @w = 0
  247.     @cursor_width = 0
  248.     # 有选择项的话,处理字的缩进
  249.     if $game_temp.choice_start == 0
  250.       x = 16
  251.     end
  252.     # 有等待显示的文字的情况下
  253.     if $game_temp.message_text != nil
  254.     text = $game_temp.message_text.clone
  255.       # 限制文字处理
  256.       begin
  257.         last_text = text.clone
  258.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  259.       end until text == last_text
  260.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  261.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  262.       end
  263.       text.gsub!(/\\\\/)                 { "\x00" }
  264.       text.gsub!(/\\[Cc]\[([0-9]+)\]/)   { "\x01" }
  265.       text.gsub!(/\\[Gg]/)               { "\x02" }
  266.       text.gsub!(/\\[Ss]\[([0-9]+)\]/)   { "\x03" + $data_skills[$1.to_i].name }
  267.       text.gsub!(/\\[Ii]\[([0-9]+)\]/)   { "\x04" + $data_items[$1.to_i].name }
  268.       text.gsub!(/\\[Ww]\[([0-9]+)\]/)   { "\x05" + $data_weapons[$1.to_i].name }
  269.       text.gsub!(/\\[Aa]\[([0-9]+)\]/)   { "\x06" + $data_armors[$1.to_i].name }
  270.       text.gsub!(/\\[Rr]\[([0-9]+)\]/)   { "\x10" + $game_actors[$1.to_i].name }
  271.       # c 获取 1 个字 (如果不能取得文字就循环)
  272.       while ((c = text.slice!(/./m)) != nil)
  273.         if c == "\x00"
  274.           c = "\\"
  275.         end
  276.         if c == "\x01" or c == "\x02"
  277.           next
  278.         end
  279.         if c == "\x03" or c == "\x04" or c == "\x05" or c == "\x06" or c == "\x010"
  280.           c = "   "
  281.         end
  282.         if c == "\n"
  283.           # y 累加 1
  284.           y += 1
  285.           # 取得纵横尺寸
  286.           @h = y
  287.           @w = x > @w ? x : @w
  288.           if y >= $game_temp.choice_start
  289.             @w = x + MES_FONT_SIZE > @w ? x + MES_FONT_SIZE : @w
  290.           end
  291.           x = 0
  292.           x = MES_FONT_SIZE if y >= $game_temp.choice_start
  293.           # 下面的文字
  294.           next
  295.         end
  296.         # x 为要描绘文字的宽度加法运算
  297.         x += self.contents.text_size(c).width
  298.       end
  299.     end
  300.     # 输入数值的情况
  301.     if $game_temp.num_input_variable_id > 0
  302.       digits_max = $game_temp.num_input_digits_max
  303.       number = $game_variables[$game_temp.num_input_variable_id]
  304.       @h += 1
  305.       x = digits_max * self.contents.font.size + 16
  306.       @w = x > @w ? x : @w
  307.     end
  308.     @w += @face_width
  309.     @w = 96 if @w < 96
  310.   end
  311.   #--------------------------------------------------------------------------
  312.   # ○ 描绘信息处理
  313.   #--------------------------------------------------------------------------
  314.   def draw_massage
  315.     # 有等待显示的文字的情况下
  316.     if $game_temp.message_text != nil or @old_text_info != nil
  317.       text = $game_temp.message_text
  318.       #p text
  319.       # 限制文字处理
  320.       begin
  321.         last_text = text.clone
  322.         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  323.       end until text == last_text
  324.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  325.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  326.       end
  327.       text.gsub!(/\\\\/)                 { "\x00" }
  328.       text.gsub!(/\\[Cc]\[([0-9]+)\]/)   { "\x01[#{$1}]" }
  329.       text.gsub!(/\\[Gg]/)               { "\x02" }
  330.       text.gsub!(/\\[Ss]\[([0-9]+)\]/)   { "\x03[#{$1}]" }
  331.       text.gsub!(/\\[Ii]\[([0-9]+)\]/)   { "\x04[#{$1}]" }
  332.       text.gsub!(/\\[Ww]\[([0-9]+)\]/)   { "\x05[#{$1}]" }
  333.       text.gsub!(/\\[Aa]\[([0-9]+)\]/)   { "\x06[#{$1}]" }
  334.       text.gsub!(/\\[Oo]\[([0-9]+)\]/)   { "\x07[#{$1}]" }
  335.       text.gsub!(/\\[Qq]/)               { "\x08" }
  336.       text.gsub!(/\\[Ff]\[([0-9]+)\]/)   { "\x09[#{$1}]" }
  337.       text.gsub!(/\\[Rr]\[([0-9]+)\]/)   { "\x10[#{$1}]" }
  338.       # c 获取 1 个字
  339.       c = text.slice!(/./m)
  340.       # 选择项的情况
  341.       if @dy >= $game_temp.choice_start
  342.         # 处理字的缩进
  343.         @dx = MES_FONT_SIZE
  344.         @dx += @face_width unless @show_right
  345.         @dx += MES_FONT_SIZE if @show_name
  346.         # 描绘文字
  347.         self.contents.draw_text(@dx, 24 * @dy, 24, 24, c)
  348.         # x 为要描绘文字宽度的加法运算
  349.         @dx += self.contents.text_size(c).width
  350.         # 循环
  351.         while ((c = text.slice!(/./m)) != "\n")
  352.           # 描绘文字
  353.           self.contents.draw_text(@dx, 24 * @dy, 24, 24, c)
  354.           # x 为要描绘文字宽度的加法运算
  355.           @dx += self.contents.text_size(c).width
  356.         end
  357.         if c == "\n"
  358.           # 更新光标宽度
  359.           @cursor_width = [@cursor_width, @dx - @face_width].max
  360.           # dy 累加 1
  361.           @dy += 1
  362.         end
  363.         return
  364.       end
  365.       case c
  366.       when "\x00"
  367.         c = "\\"            
  368.       when "\x01"                  
  369.         text.sub!(/\[([0-9]+)\]/, "")
  370.         color = $1.to_i
  371.         self.contents.font.color = text_color(color)
  372.       when "\x02"
  373.         @contents_showing_end = true
  374.         @contents_drawing = false
  375.         terminate_messageX
  376.         @save_x = @dx
  377.         @save_y = @dy
  378.       when "\x03"
  379.         text.sub!(/\[([0-9]+)\]/, "")
  380.         last_character
  381.         draw_icon($data_skills[$1.to_i], 4 + @dx, 24 * @dy)
  382.         @dx += self.contents.text_size("   ").width
  383.       when "\x04"
  384.         text.sub!(/\[([0-9]+)\]/, "")
  385.         last_character
  386.         draw_icon($data_items[$1.to_i], 4 + @dx, 24 * @dy)
  387.         @dx += self.contents.text_size("   ").width
  388.       when "\x05"
  389.         text.sub!(/\[([0-9]+)\]/, "")
  390.         last_character
  391.         draw_icon($data_weapons[$1.to_i], 4 + @dx, 24 * @dy)
  392.         @dx += self.contents.text_size("   ").width
  393.       when "\x06"
  394.         text.sub!(/\[([0-9]+)\]/, "")
  395.         last_character
  396.         draw_icon($data_armors[$1.to_i], 4 + @dx, 24 * @dy)
  397.         @dx += self.contents.text_size("   ").width
  398.       when "\x07"
  399.         text.sub!(/\[([0-9]+)\]/, "")
  400.         self.contents.font.color.alpha = $1.to_i
  401.       when "\x08"
  402.         text.sub!(/\[([0-9]+)\]/, "")
  403.         $play_voice = !$play_voice
  404.       when "\x09"
  405.         text.sub!(/\[([0-9]+)\]/, "")
  406.         self.contents.font.name = FONT_ARRAY[$1.to_i]
  407.       when "\x10"
  408.         text.sub!(/\[([0-9]+)\]/, "")
  409.         last_character
  410.         draw_actor_graphic($game_actors[$1.to_i], 4 + @dx, 24 * @dy)
  411.         @dx += self.contents.text_size("   ").width
  412.       when "\n"
  413.         @dy += 1
  414.         @dx = 0
  415.         @dx += @face_width unless @show_right
  416.         @dx += MES_FONT_SIZE if @show_name
  417.         last_character
  418.       else
  419.         last_character
  420.         size_zy = 6  # 设定文字动态增大幅度
  421.         if c != nil
  422.           self.contents.font.size = MES_FONT_SIZE
  423.           font_size = self.contents.font.size += size_zy
  424.           @old_text_info.push(@dx , @dy , font_size, self.contents.font.color.clone, c)
  425.           self.contents.draw_text(4 + @dx, (font_size + 4 - size_zy) * @dy - size_zy / 2, font_size, font_size, c)
  426.           self.contents.font.size -= size_zy
  427.           Audio.se_play("Audio/SE/Voice", 90, 100) if $play_voice and c != " "
  428.           @dx += self.contents.text_size(c).width
  429.         end
  430.       end
  431.     end
  432.   end
  433.   #--------------------------------------------------------------------------
  434.   # ○ 完成上一个字符的描绘
  435.   #--------------------------------------------------------------------------
  436.   def last_character
  437.     size_zy = 6  # 设定文字动态增大幅度
  438.     unless @old_text_info == []
  439.       self.contents.fill_rect (4 + @old_text_info[0], (@old_text_info[2]+ 4 - size_zy) * @old_text_info[1] - size_zy / 2, @old_text_info[2], @old_text_info[2], Color.new(0,0,0,0))
  440.       color = self.contents.font.color.clone
  441.       self.contents.font.color = @old_text_info[3].clone
  442.       self.contents.font.size = @old_text_info[2] -= size_zy
  443.       self.contents.draw_text(4 + @old_text_info[0], (@old_text_info[2] + 4) * @old_text_info[1], @old_text_info[2], @old_text_info[2], @old_text_info[4])
  444.       self.contents.font.color = color
  445.       @old_text_info = []
  446.     end
  447.   end
  448.   #--------------------------------------------------------------------------
  449.   # ○ 选择项和输入数值的情况下
  450.   #--------------------------------------------------------------------------
  451.   def draw_opt_text
  452.     # 选择项的情况下
  453.     if $game_temp.choice_max > 0
  454.       @item_max = $game_temp.choice_max
  455.       self.active = true
  456.       self.index = 0
  457.     end
  458.     # 输入数值的情况下
  459.     if $game_temp.num_input_variable_id > 0
  460.       digits_max = $game_temp.num_input_digits_max
  461.       number = $game_variables[$game_temp.num_input_variable_id]
  462.       @input_number_window = Window_InputNumber.new(digits_max)
  463.       @input_number_window.number = number
  464.       @input_number_window.x = self.x + @face_width + MES_FONT_SIZE + 8
  465.       @input_number_window.y = self.y + $game_temp.num_input_start * (MES_FONT_SIZE + 2)
  466.     end
  467.   end
  468.   #--------------------------------------------------------------------------
  469.   # ○ 生成背景图片
  470.   #--------------------------------------------------------------------------
  471.   def create_backbmp
  472.     @pic_skin.dispose if @pic_skin != nil
  473.     @pic_skin = Sprite.new
  474.     @pic_skin.opacity = 0 unless @no_term_stop
  475.     @pic_skin.bitmap = Bitmap.new(self.width + 32, self.height + 32)
  476.     @pic_skin.x = self.x + 2
  477.     @pic_skin.y = self.y + 2
  478.     @pic_skin.z = self.z
  479.     bitmap = RPG::Cache.windowskin(FUKI_SKIN_NAME)
  480.     rect = Rect.new(0, 0, 32, 32)
  481.     @pic_skin.bitmap.blt(0, 0, bitmap, rect)
  482.     rect = Rect.new(96, 0, 32, 32)
  483.     @pic_skin.bitmap.blt(self.width-32, 0, bitmap, rect)
  484.     rect = Rect.new(0, 96, 32, 32)
  485.     @pic_skin.bitmap.blt(0, self.height-32, bitmap, rect)
  486.     rect = Rect.new(96, 96, 32, 32)
  487.     @pic_skin.bitmap.blt(self.width-32, self.height-32, bitmap, rect)
  488.     rect = Rect.new(0, 32, 32, 32)
  489.     @pic_skin.bitmap.stretch_blt(Rect.new(0, 32, 32, self.height - 64), bitmap, rect)
  490.     rect = Rect.new(96, 32, 32, 32)
  491.     @pic_skin.bitmap.stretch_blt(Rect.new(self.width-32,32,32,self.height-64), bitmap, rect)
  492.     rect = Rect.new(32, 0, 32, 32)
  493.     @pic_skin.bitmap.stretch_blt(Rect.new(32,0,self.width-64,self.height-32), bitmap, rect)
  494.     rect = Rect.new(32, 96, 32, 32)
  495.     @pic_skin.bitmap.stretch_blt(Rect.new(32,self.height-32,self.width-64,32), bitmap, rect)
  496.     bitmap.dispose
  497.   end
  498.   #--------------------------------------------------------------------------
  499.   # ○ 设置呼出对话框
  500.   #--------------------------------------------------------------------------
  501.   def set_fukidasi(x, y, width, height)
  502.     begin
  503.       self.pause = false # 不显示暂停标志
  504.       pos = get_fuki_pos(width, height) # 取得对话框位置
  505.       x = pos[0]
  506.       y = pos[1]
  507.       self.windowskin = RPG::Cache.windowskin($game_system.windowskin_name)
  508.       self.x = x
  509.       self.y = y
  510.       self.height = height
  511.       self.width = width
  512.       unless @no_term_stop
  513.         self.contents.dispose
  514.         self.contents = Bitmap.new(width - 32, height - 32)
  515.         self.back_opacity = FUKI_OPACITY
  516.         self.contents.clear
  517.         self.contents.font.color = Color.new(0, 0, 0,255)
  518.         self.contents.font.size = MES_FONT_SIZE
  519.       end
  520.       if $game_system.message_frame == 0
  521.         tale_pos = get_tale_pos
  522.         @tale = Sprite.new
  523.         @tale.bitmap = Bitmap.new(64, 32)
  524.         if TAIL_SHOW
  525.           case @message_position
  526.           when 0  # 上
  527.             bitmap = RPG::Cache.windowskin(FUKI_SKIN_NAME)
  528.             rect = Rect.new(32, 32, 64, 32)
  529.             @tale.bitmap.blt(0, 0, bitmap, rect)
  530.             bitmap.dispose
  531.             @tale.x = tale_pos[0]
  532.             @tale.x += 8 if @tale.x < 64
  533.             if @tale.x > 640 - 64
  534.               @tale.mirror = true
  535.               @tale.x -= 64
  536.             end
  537.             @tale.y = tale_pos[1]
  538.             @tale.z = self.z + 1
  539.           when 1  # 中
  540.             @tale.dispose
  541.             @tale = nil
  542.           when 2  # 下
  543.             bitmap = RPG::Cache.windowskin(FUKI_SKIN_NAME)
  544.             rect = Rect.new(32, 64, 64, 32)
  545.             @tale.bitmap.blt(0, 0, bitmap, rect)
  546.             bitmap.dispose
  547.             @tale.x = tale_pos[0]
  548.             @tale.x += 8 if @tale.x < 64
  549.             if @tale.x > 640 - 64
  550.               @tale.mirror = true
  551.               @tale.x -= 64
  552.             end
  553.             @tale.y = tale_pos[1]
  554.             @tale.z = self.z + 1
  555.           end
  556.         end
  557.       end
  558.     rescue
  559.       del_fukidasi
  560.       reset_window(width, height)
  561.     end
  562.   end
  563.   #--------------------------------------------------------------------------
  564.   # ○ 计算呼出对话框的位置
  565.   #--------------------------------------------------------------------------
  566.   def get_fuki_pos(width, height)
  567.     # 取得角色
  568.     @character = get_character($mes_id)
  569.     if @character == nil
  570.       # 角色不存在的情况下使用默认信息框
  571.       del_fukidasi
  572.       reset_window(width, height)
  573.       return
  574.     end
  575.     # 处理坐标
  576.     x = (@character.real_x - $game_map.display_x + 64) * 32 / 128 - (width / 2)
  577.     # 为尽量显示在画面内而移动横坐标
  578.     if x + width > 640
  579.       x = 640 - width
  580.     elsif x < 0
  581.       x = 0
  582.     end
  583.     # 决定窗口位置
  584.     case $game_system.message_position
  585.     when 0  # 上
  586.       y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - CHARACTOR_HEIGHT + POP_SHIFT_TOP
  587.     when 1  # 中
  588.       x = (640 - width) / 2
  589.       y = (480 - height) / 2
  590.     when 2  # 下
  591.       y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + POP_SHIFT_UNDER
  592.     end
  593.     # 纪录文章显示位置
  594.     @message_position = $game_system.message_position
  595.     if POS_FIX
  596.       case @message_position
  597.       when 0  # 上
  598.         if y <= 0
  599.           @message_position = 2
  600.           y =  (@character.real_y - $game_map.display_y + 64) * 32 / 128 + 32 + POP_SHIFT_UNDER
  601.         end
  602.       when 2  # 下
  603.         if y + height >= 480
  604.           @message_position = 0
  605.           y = (@character.real_y - $game_map.display_y + 64) * 32 / 128 - height - CHARACTOR_HEIGHT + POP_SHIFT_TOP
  606.         end
  607.       end
  608.     end
  609.     return [x, y]
  610.   end
  611.   #--------------------------------------------------------------------------
  612.   # ○ 计算尾部图标的位置
  613.   #--------------------------------------------------------------------------
  614.   def get_tale_pos
  615.     case @message_position
  616.     when 0  # 上
  617.       # 处理坐标
  618.       x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 8
  619.       y = self.y + self.height - 6
  620.     when 1  # 中
  621.       x = nil
  622.       y = nil
  623.     when 2  # 下
  624.       # 处理坐标
  625.       x = ( @character.real_x - $game_map.display_x + 64 ) * 32 / 128 - 8
  626.       y = self.y - 18
  627.     end
  628.     return [x, y]
  629.   end
  630.   #--------------------------------------------------------------------------
  631.   # ○ 设置角色半身像窗口
  632.   #--------------------------------------------------------------------------
  633.   def draw_msg_face
  634.     @face_sprite.dispose if @face_sprite != nil
  635.     # $mes_name为空时不显示
  636.     if $mes_name == nil or $mes_name == ""
  637.       return
  638.     else
  639.       # 设定变量
  640.       mes_name = $mes_name
  641.       if $game_temp.namebmp[mes_name] == nil
  642.         sFile = FACE_PIC_DIR + mes_name
  643.       else
  644.         sFile = FACE_PIC_DIR + $game_temp.namebmp[mes_name]
  645.       end
  646.       bitmap = Bitmap.new(sFile)
  647.       @pic_width = bitmap.width
  648.       @pic_height = bitmap.height
  649.       @face_sprite = Sprite.new
  650.       @face_sprite.x = self.x + 26
  651.       @face_sprite.x = self.x + self.width - @pic_width - 26 if @show_right
  652.       @face_sprite.y = self.y + self.height - @pic_height - 6
  653.       @face_sprite.bitmap = bitmap
  654.       @face_sprite.z = self.z + 3
  655.       @face_sprite.mirror = @show_right
  656.       @face_sprite.opacity = 0
  657.     end
  658.   end
  659.   #--------------------------------------------------------------------------
  660.   # ○ 释放呼出对话框
  661.   #--------------------------------------------------------------------------
  662.   def del_fukidasi
  663.     if @tale != nil
  664.       @tale.dispose
  665.       @tale = nil
  666.     end
  667.     self.opacity = 0
  668.     self.x = 80
  669.     self.width = 480
  670.     self.height = 160
  671.     self.contents.dispose
  672.     self.contents = Bitmap.new(width - 32, height - 32)
  673.     self.pause = true
  674.   end
  675.   #--------------------------------------------------------------------------
  676.   # ○ 取得角色
  677.   #     parameter : 参数
  678.   #--------------------------------------------------------------------------
  679.   def get_character(parameter)
  680.     # 参数分歧
  681.     case parameter
  682.     when nil
  683.       return events == nil
  684.     when -1  # 玩家
  685.       return $game_player
  686.     when 0   # 该事件
  687.       events = $game_map.events
  688.       return events == nil ? nil : events[$active_event_id]
  689.     else     # 特定事件
  690.       events = $game_map.events
  691.       return events == nil ? nil : events[parameter]
  692.     end
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● 设定窗口位置和不透明度
  696.   #--------------------------------------------------------------------------
  697.   def reset_window(width = nil, height = nil)
  698.     if $game_temp.in_battle
  699.       self.y = 16
  700.     else
  701.       case $game_system.message_position
  702.       when 0  # 上
  703.         self.y = 16
  704.       when 1  # 中
  705.         if height != nil and width != nil
  706.           self.y = (480 - height) / 2 - 32
  707.           self.x = (640 - width) / 2
  708.           self.width = width
  709.           self.height = height
  710.           self.contents.dispose
  711.           self.contents = Bitmap.new(width - 32, height - 32)
  712.         else
  713.           self.y = 160
  714.         end
  715.       when 2  # 下
  716.         self.y = 304
  717.       end
  718.     end
  719.     self.opacity = 0
  720.     self.back_opacity = MES_OPACITY
  721.   end
  722.   #--------------------------------------------------------------------------
  723.   # ● 刷新画面
  724.   #--------------------------------------------------------------------------
  725.   def update
  726.     super
  727.     update_fuki                 # 呼出模式下跟随事件移动
  728.     if @fade_in                 # 渐变的情况下
  729.       self.contents_opacity += 24
  730.       @pic_skin.opacity += 20
  731.       if @tale != nil
  732.         @face_sprite.opacity += 24 if @face_sprite != nil and !@face_sprite.disposed?
  733.         @tale.opacity += 20
  734.       end
  735.       @input_number_window.contents_opacity += 24 if @input_number_window != nil
  736.       @fade_in = false if self.contents_opacity == 255
  737.       return
  738.     end
  739.     if @contents_drawing        # 显示信息中的情况下
  740.       refresh_drawtext
  741.       return
  742.     end
  743.     update_input_number_window  # 输入数值的情况下
  744.     if @contents_showing_end    # 显示信息结束的情况下
  745.       if $game_temp.choice_max == 0 and @tale == nil
  746.         self.pause = true
  747.       else
  748.         self.pause = false
  749.       end
  750.       update_choose
  751.       return
  752.     end
  753.     if @fade_out == false and $game_temp.message_text != nil # 在渐变以外的状态下
  754.       @contents_showing = true
  755.       $game_temp.message_window_showing = true
  756.       reset_window
  757.       refresh_create
  758.       if @no_term_stop
  759.         self.visible = true        
  760.       else
  761.         @tale.opacity = 0 if @tale != nil
  762.         Graphics.frame_reset
  763.         self.visible = true
  764.         self.contents_opacity = 0
  765.         @input_number_window.contents_opacity = 0 if @input_number_window != nil
  766.         @fade_in = true
  767.       end
  768.       return
  769.     end
  770.     unless @no_term_stop # 没有可以显示的信息、但是窗口为可见的情况下
  771.       if self.visible
  772.         @fade_out = true
  773.         self.opacity -= 48
  774.         @face_sprite.opacity -= 48 if @face_sprite != nil and !@face_sprite.disposed?
  775.         @pic_skin.opacity -= 48 if @pic_skin != nil and !@pic_skin.disposed?
  776.         @tale.opacity -= 48 if @tale != nil and [email protected]?
  777.         if (@face_sprite == nil) or @face_sprite.disposed? or (@face_sprite.opacity == 0)
  778.           self.visible = false
  779.           @face_sprite.dispose if @face_sprite != nil
  780.           @pic_skin.dispose
  781.           @fade_out = false
  782.           $game_temp.message_window_showing = false
  783.           del_fukidasi
  784.         end
  785.         return
  786.       end
  787.     else
  788.       $game_temp.message_window_showing = false   
  789.     end
  790.   end
  791.   #--------------------------------------------------------------------------
  792.   # ● 释放
  793.   #--------------------------------------------------------------------------
  794.   def dispose
  795.     terminate_message
  796.     $game_temp.message_window_showing = false
  797.     @input_number_window.dispose if @input_number_window != nil
  798.     super
  799.   end
  800.   #--------------------------------------------------------------------------
  801.   # ● 信息结束处理
  802.   #--------------------------------------------------------------------------
  803.   def terminate_message
  804.     self.active = false
  805.     self.pause = false
  806.     self.index = -1
  807.     self.contents.clear
  808.     # 清除显示中标志
  809.     @contents_showing = false
  810.     @contents_showing_end = false
  811.     $mes_name = ""
  812.     # 呼叫信息调用
  813.     $game_temp.message_proc.call if $game_temp.message_proc != nil
  814.     # 清除文章、选择项、输入数值的相关变量
  815.     $game_temp.message_text = nil
  816.     $game_temp.message_proc = nil
  817.     $game_temp.choice_start = 99
  818.     $game_temp.choice_max = 0
  819.     $game_temp.choice_cancel_type = 0
  820.     $game_temp.choice_proc = nil
  821.     $game_temp.num_input_start = 99
  822.     $game_temp.num_input_variable_id = 0
  823.     $game_temp.num_input_digits_max = 0
  824.     # 释放金钱窗口
  825.     if @gold_window != nil
  826.       @gold_window.dispose
  827.       @gold_window = nil
  828.     end
  829.     @no_term_stop = false
  830.     @save_x = 0
  831.     @save_y = 0
  832.     @show_right = false
  833.     @show_name  = false
  834.     @face_width = 0
  835.   end
  836.   #--------------------------------------------------------------------------
  837.   # ● ★信息结束处理★
  838.   #--------------------------------------------------------------------------
  839.   def terminate_messageX
  840.     self.active = false
  841.     self.pause = false
  842.     self.index = -1
  843.     # 清除显示中标志
  844.     @contents_showing = false
  845.     @contents_showing_end = false
  846.     # 呼叫信息调用
  847.     $game_temp.message_proc.call if $game_temp.message_proc != nil
  848.     # 清除文章、选择项、输入数值的相关变量
  849.     $game_temp.message_text = nil
  850.     $game_temp.message_proc = nil
  851.     @no_term_stop = true
  852.     @show_right = false
  853.     @show_name  = false
  854.     @face_width = 0
  855.   end
  856.   #--------------------------------------------------------------------------
  857.   # ● 刷新光标矩形
  858.   #--------------------------------------------------------------------------
  859.   def update_cursor_rect
  860.     if @index >= 0
  861.       n = $game_temp.choice_start + @index
  862.       self.cursor_rect.set(MES_FONT_SIZE / 2, n * (MES_FONT_SIZE + 4), @cursor_width, MES_FONT_SIZE + 4)
  863.       self.cursor_rect.x += @face_width unless @show_right
  864.       self.cursor_rect.x += MES_FONT_SIZE / 2 if @show_name
  865.     else
  866.       self.cursor_rect.empty
  867.     end
  868.   end
  869.   #--------------------------------------------------------------------------
  870.   # ● 获取文字颜色色
  871.   #     n : 文字颜色编号 (0~31)
  872.   #--------------------------------------------------------------------------
  873.   def text_color(n)
  874.     return normal_color if n > 31
  875.     x = (n % 8) * 16
  876.     y = 128 + (n / 8) * 16
  877.     return RPG::Cache.windowskin(FUKI_SKIN_NAME).get_pixel(x, y)
  878.   end
  879.   #--------------------------------------------------------------------------
  880.   # ● 取得普通文字色
  881.   #--------------------------------------------------------------------------
  882.   def normal_color
  883.     nil_color = Color.new(0,0,0,255)
  884.     return FUKI_COLOR if FUKI_COLOR != nil_color
  885.     return nil_color
  886.   end
  887.   #--------------------------------------------------------------------------
  888.   # ● 获取头像宽度
  889.   #--------------------------------------------------------------------------
  890.   def get_face_width(face_name)
  891.     return if $mes_name == ""
  892.     filename = FACE_PIC_DIR + face_name
  893.     bitmap = Bitmap.new(filename)
  894.     @face_width = bitmap.width + MES_FONT_SIZE
  895.     bitmap.dispose
  896.   end
  897.   #--------------------------------------------------------------------------
  898.   # ● 描绘物品
  899.   #     item : 物品
  900.   #--------------------------------------------------------------------------
  901.   def draw_icon(item, x, y)
  902.     return if item == nil
  903.     bitmap = RPG::Cache.icon(item.icon_name)
  904.     self.contents.blt(x + 4, y, bitmap, Rect.new(0, 0, 24, 24))
  905.     color = self.contents.font.color.clone
  906.     self.contents.font.color = text_color(1)
  907.     self.contents.draw_text(x + 28, y, self.contents.text_size(item.name).width + 5, 24, item.name)
  908.     self.contents.font.color = color
  909.     @dx += self.contents.text_size(item.name).width
  910.   end
  911.   #--------------------------------------------------------------------------
  912.   # ● 图形的描绘
  913.   #     actor : 角色
  914.   #     x     : 描画目标 X 坐标
  915.   #     y     : 描画目标 Y 坐标
  916.   #--------------------------------------------------------------------------
  917.   def draw_actor_graphic(actor, x, y)
  918.     bitmap = RPG::Cache.character(actor.character_name, actor.character_hue)
  919.     cw = bitmap.width / 4
  920.     ch = bitmap.height / 4
  921.     src_rect = Rect.new(0, 0, cw, ch)
  922.     self.contents.blt(x, y - 4, bitmap, src_rect)
  923.     color = self.contents.font.color.clone
  924.     self.contents.font.color = text_color(1)
  925.     self.contents.draw_text(x + 32, y, self.contents.text_size(actor.name).width + 5, 24, actor.name)
  926.     self.contents.font.color = color
  927.     @dx += self.contents.text_size(actor.name).width
  928.   end
  929.   #--------------------------------------------------------------------------
  930.   # ● 刷新呼出对话框
  931.   #--------------------------------------------------------------------------
  932.   def update_fuki
  933.     if @tale != nil
  934.       pos = get_fuki_pos(self.width, self.height)
  935.       self.x = pos[0]
  936.       self.y = pos[1]
  937.       tale_pos = get_tale_pos
  938.       @tale.mirror = false
  939.       @tale.x = tale_pos[0]
  940.       @tale.x += 8 if @tale.x < 64
  941.       if @tale.x > 640 - 64
  942.         @tale.mirror = true
  943.         @tale.x -= 64
  944.       end
  945.       @tale.y = tale_pos[1]
  946.       @pic_skin.x = self.x + 2
  947.       @pic_skin.y = self.y + 2
  948.       if @face_sprite != nil and !@face_sprite.disposed?
  949.         @face_sprite.x = self.x + 26
  950.         @face_sprite.x = self.x + self.width - @pic_width - 26 if @show_right
  951.         @face_sprite.y = self.y + self.height - @pic_height - 6
  952.       end
  953.     end
  954.   end
  955.   #--------------------------------------------------------------------------
  956.   # ● 刷新数字输入框
  957.   #--------------------------------------------------------------------------
  958.   def update_input_number_window
  959.     if @input_number_window != nil
  960.       @input_number_window.update
  961.       # 确定
  962.       if Input.trigger?(Input::C)
  963.         $game_system.se_play($data_system.decision_se)
  964.         $game_variables[$game_temp.num_input_variable_id] = @input_number_window.number
  965.         # 释放输入数值窗口
  966.         @input_number_window.dispose
  967.         @input_number_window = nil
  968.         $game_map.need_refresh = true
  969.         terminate_message
  970.         del_fukidasi
  971.       end
  972.       return
  973.     end
  974.   end
  975.   #--------------------------------------------------------------------------
  976.   # ● 刷新选择输入
  977.   #--------------------------------------------------------------------------
  978.   def update_choose
  979.     if Input.trigger?(Input::B)
  980.       if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  981.         $game_system.se_play($data_system.cancel_se)
  982.         $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  983.         terminate_message
  984.       end
  985.     end
  986.     if Input.trigger?(Input::C)
  987.       if $game_temp.choice_max > 0
  988.         $game_system.se_play($data_system.decision_se)
  989.         $game_temp.choice_proc.call(self.index)
  990.       end
  991.       terminate_message
  992.       del_fukidasi
  993.     end
  994.   end
  995. end
复制代码

1.png (16.33 KB, 下载次数: 1)

有冒号的情况

有冒号的情况

Lv1.梦旅人

梦石
0
星屑
49
在线时间
46 小时
注册时间
2011-10-7
帖子
95
2
发表于 2011-10-9 21:55:15 | 只看该作者
只要输出
  1. \c[7]文字
复制代码
这种的文章就可以让文字变成蓝色
我是傻逼
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
72 小时
注册时间
2011-9-5
帖子
30
3
 楼主| 发表于 2011-10-9 21:59:10 | 只看该作者
我不是字母君 发表于 2011-10-9 21:55
只要输出这种的文章就可以让文字变成蓝色

恩恩谢谢~另外那个没有冒号时的文字颜色怎么改呢?那个才是真正烦人的东西..我试着把所有颜色的数据改了改发现都和那个字的颜色没关系啊
回复

使用道具 举报

Lv2.观梦者

(?????)

梦石
0
星屑
787
在线时间
1327 小时
注册时间
2011-7-18
帖子
3184

贵宾

4
发表于 2011-10-9 22:25:57 | 只看该作者
本帖最后由 各种压力的猫君 于 2011-10-9 23:05 编辑

http://rpg.blue/forum.php?mod=vi ... 8%E5%8C%96%E7%89%88

测试无问题。

仔细看范例写法你就懂了。这种类型的文字要在开头\c[0]指定文字颜色为黑色。

PS:不知道是不是我用1.02版的问题……我显示的不是白色而是橙色 = = b
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
72 小时
注册时间
2011-9-5
帖子
30
5
 楼主| 发表于 2011-10-10 19:56:35 | 只看该作者
Shy07 发表于 2011-10-9 22:39
理论上对白是不需要冒号的,所以用来判断人名,但是旁白可能需要冒号,这个在写脚本时确实有些欠考虑
解决 ...

恩这种解决方法也很好,谢谢~


巽离阔于2011-10-10 19:57补充以下内容:
是哦好奇怪···没关系了每次都定义一下颜色看来就好了,或者我偷懒,旁白时在最后加一个:···这样旁白就成了蓝色的了效果也很好~


巽离阔于2011-10-10 19:58补充以下内容:
谢谢~
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2025-7-21 01:46

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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