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

Project1

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

问:关于《对话框中显示表情(QQ表情)》

 关闭 [复制链接]

Lv1.梦旅人

孙悟空

梦石
0
星屑
55
在线时间
15 小时
注册时间
2007-8-22
帖子
448
跳转到指定楼层
1
发表于 2007-8-26 15:55:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我用的是真对话加强完美精简版的脚本,
根据《对话框中显示表情(QQ表情)》里所说,可以通过显示武器防具的图标来在对话中插入表情..
但是我用的精简版里,把原先的显示武器(\v[w1])还有防具这些,的功能改成了显示武器名称,也就是说把这个放到对话里,对话便又显示图标,又显示名称...
哪位朋友帮我改下脚本,
我想只显示图标,不显示名称..{/wx}



  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————

  4. #从此精简版本中去除的标记:
  5. # \.   :停顿一刹那(1、2帧)
  6. # \|   :停顿片刻(20帧)
  7. # \>   :文字不用打字方式
  8. # \<   :文字使用打字方式
  9. # \!   :等待玩家按回车再继续
  10. # \~   :文字直接消失
  11. # \K[今天天气不错]:在出现“今天天气不错”这几个字的时候播放$game_system.soundname_on_speak设置的音效

  12. #新增的标记:
  13. # \d[4]:空4个字节(2个汉字)的位置
  14. # \t: 显示游戏时间窗口
  15. # \v[7]:显示7号变量的值
  16. # \v[a7]:显示7号防具的名称
  17. # \v[s7]:显示7号特技的名称
  18. # \v[w7]:显示7号武器的名称
  19. # \v[i7]:显示7号道具的名称
  20. # \A:头像及姓名框靠左排列
  21. # \a:头像及姓名框靠右排列
  22. # \u[rrggbb]:直接以RGB值十六进制指定颜色

  23. #强化功能的标记:
  24. # \F[001]:在对话显示头像“Graphics/battlers/66rpg_001_f.png”
  25. # \f[1]:在对话中显示1号角色的头像,没有的话同\F[1]效果
  26. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  27. # \l[1]:在左边显示1号角色的半身像,没有的话同\L[1]效果
  28. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  29. # \r[1]:在右边显示1号角色的半身像,没有的话同\R[1]效果
  30. # \m[李逍遥]:用默认颜色(颜色0)显示一个“李逍遥”方框,表示说话人姓名
  31. # \m2[\n[1]]:用颜色2显示1号主角的姓名方框 ----不知道有多少人盼这个功能盼了多久了呵呵

  32. #下面是脚本:

  33. #——说明

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

  37. # \m[李逍遥]:用默认颜色(颜色0)显示一个“李逍遥”方框,表示说话人姓名
  38. # \m2[\n[1]]:用颜色2显示1号主角的姓名方框

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

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

  43. # \c[0-7]:更改颜色

  44. # \u[rrggbb]:直接以十六进制指定颜色,注意这里会把透明度重设为255

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

  46. # \t: 显示游戏时间窗口

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

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

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

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

  51. # \d[4]:空4个字节(2个汉字)的位置

  52. # \F[001]:在对话显示头像“Graphics/battlers/66rpg_001_f.png”
  53. # \f[1]:在对话中显示1号角色的头像,没有的话同\F[1]效果
  54. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  55. # \l[1]:在左边显示1号角色的半身像,没有的话同\L[1]效果
  56. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  57. # \r[1]:在右边显示1号角色的半身像,没有的话同\R[1]效果

  58. # \Lk:清除左边的图像
  59. # \Rk:清除右边的图像

  60. # \v[7]:显示7号变量的值
  61. # \v[a7]:显示7号防具的名称
  62. # \v[s7]:显示7号特技的名称
  63. # \v[w7]:显示7号武器的名称
  64. # \v[i7]:显示7号道具的名称

  65. # \A:头像及姓名框靠左排列
  66. # \a:头像及姓名框靠右排列

  67. #==============================================================================
  68. # ■ Window_Message
  69. #------------------------------------------------------------------------------
  70. class Window_Message < Window_Selectable
  71.   #--------------------------------------------------------------------------
  72.   # ● 初始化状态
  73.   #--------------------------------------------------------------------------
  74.   def initialize
  75.     super(80, 304, 480, 160)
  76.     self.contents = Bitmap.new(width - 32, height - 32)
  77.     self.visible = false
  78.     self.z = 9998
  79.     @fade_in = false
  80.     @fade_out = false
  81.     @contents_showing = false
  82.     @cursor_width = 0
  83.     self.active = false
  84.     self.index = -1
  85.     @popchar = -2
  86.     @alignment = true
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 释放
  90.   #--------------------------------------------------------------------------
  91.   def dispose
  92.     terminate_message
  93.     $game_temp.message_window_showing = false
  94.     if @input_number_window != nil
  95.       @input_number_window.dispose
  96.     end
  97.     super
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 处理信息结束
  101.   #--------------------------------------------------------------------------
  102.   def terminate_message
  103.     self.active = false
  104.     self.pause = false
  105.     self.index = -1
  106.     self.contents.clear
  107.     # 清除显示中标志
  108.     @contents_showing = false
  109.     # 呼叫信息调用
  110.     if $game_temp.message_proc != nil
  111.       $game_temp.message_proc.call
  112.     end
  113.     # 清除文章、选择项、输入数值的相关变量
  114.     $game_temp.message_text = nil
  115.     $game_temp.message_proc = nil
  116.     $game_temp.choice_start = 99
  117.     $game_temp.choice_max = 0
  118.     $game_temp.choice_cancel_type = 0
  119.     $game_temp.choice_proc = nil
  120.     $game_temp.num_input_start = 99
  121.     $game_temp.num_input_variable_id = 0
  122.     $game_temp.num_input_digits_max = 0
  123.     # 开放金钱窗口
  124.     if @gold_window != nil
  125.       @gold_window.dispose
  126.       @gold_window = nil
  127.     end
  128.     # 开放时间窗口
  129.     if @playtime_window != nil
  130.       @playtime_window.dispose
  131.       @playtime_window = nil
  132.     end
  133.     # 开放姓名窗口
  134.     if @name_window != nil
  135.       @name_window.dispose
  136.       @name_window = nil
  137.     end
  138.     if @name_airtext != nil
  139.       @name_airtext.dispose
  140.       @name_airtext = nil
  141.     end
  142.     # 开放角色图片
  143.     if @right_picture != nil and @right_keep == true
  144.       @right_picture.dispose
  145.     end
  146.     if @left_picture != nil and @left_keep == true
  147.       @left_picture.dispose
  148.     end
  149.     @face_bitmap = nil
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 刷新
  153.   #--------------------------------------------------------------------------
  154.   def refresh
  155.     # 初期化
  156.     self.contents.clear
  157.     self.contents.font.color = normal_color
  158.     self.contents.font.size = Font.default_size
  159.     x = y = max_x = max_y = @indent = lines = 0
  160.     @left_keep = @right_keep = false
  161.     @face_indent = 0
  162.     @opacity = 255
  163.     @cursor_width = 0
  164.     face = nil
  165.     if $game_temp.choice_start == 0
  166.       x = 8
  167.     end
  168.     if $game_temp.message_text != nil
  169.       text = $game_temp.message_text
  170.       #——对齐设置
  171.       if (/\\([Aa])/.match(text))!=nil then
  172.         if $1 == "A"
  173.           @alignment = true
  174.         else
  175.           @alignment = false
  176.         end
  177.         text.gsub!(/\\([Aa])/) { "" }
  178.       end
  179.       #——头像设置
  180.       if (/\\([Ff])\[(.+?)\]/.match(text))!=nil then
  181.         face = "66rpg_" + $2 + "_f.png"
  182.         if $1 == "f" and $game_actors[$2.to_i] != nil
  183.           face = $game_actors[$2.to_i].battler_name + "_f.png"
  184.         end
  185.         if FileTest.exist?("Graphics/Battlers/#{face}")
  186.           @face_bitmap = Bitmap.new("Graphics/Battlers/#{face}")
  187.           if @alignment
  188.             x = @face_indent = 128
  189.             self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  190.           else
  191.             self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  192.               Rect.new(0, 0, 96, 96))
  193.           end
  194.         else
  195.           face = nil
  196.           @face_bitmap = nil
  197.         end
  198.         text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  199.       end
  200.       #——左半身像设置
  201.       if (/\\([Ll])\[(.+?)\]/.match(text))!=nil then
  202.         face = "66rpg_" + $2 + "_h.png"
  203.         if $1 == "l" and $game_actors[$2.to_i] != nil
  204.           face = $game_actors[$2.to_i].battler_name + "_h.png"
  205.         end
  206.         if $加密 == true
  207.           if @left_picture != nil
  208.             @left_picture.dispose
  209.           end
  210.           @left_picture = Sprite.new
  211.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  212.           @left_picture.y = 480-@left_picture.bitmap.height
  213.           @left_picture.x = 0
  214.           @left_picture.mirror = true
  215.           text.gsub!(/\\([Ll])\[(.*?)\]/) { "" }
  216.         else         
  217.           if FileTest.exist?("Graphics/battlers/#{face}")
  218.             if @left_picture != nil
  219.               @left_picture.dispose
  220.             end
  221.             @left_picture = Sprite.new
  222.             @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  223.             @left_picture.y = 480-@left_picture.bitmap.height
  224.             @left_picture.x = 0
  225.             @left_picture.mirror = true
  226.             text.gsub!(/\\([Ll])\[(.*?)\]/) { "" }
  227.           end
  228.         end        
  229.       end
  230.       #——右半身像设置
  231.       if (/\\([Rr])\[(.+?)\]/.match(text))!=nil then
  232.         face = "66rpg_" + $2 + "_h.png"
  233.         if $1 == "r" and $game_actors[$2.to_i] != nil
  234.           face = $game_actors[$2.to_i].battler_name + "_h.png"
  235.         end
  236.         if $加密 == true
  237.           if @right_picture != nil
  238.             @right_picture.dispose
  239.           end
  240.           @right_picture = Sprite.new
  241.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  242.           @right_picture.y = 480-@right_picture.bitmap.height
  243.           @right_picture.x = 640-@right_picture.bitmap.width
  244.           text.gsub!(/\\([Rr])\[(.*?)\]/) { "" }
  245.         else
  246.           if FileTest.exist?("Graphics/battlers/#{face}")
  247.             if @right_picture != nil
  248.               @right_picture.dispose
  249.             end
  250.             @right_picture = Sprite.new
  251.             @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  252.             @right_picture.y = 480-@right_picture.bitmap.height
  253.             @right_picture.x = 640-@right_picture.bitmap.width
  254.             text.gsub!(/\\([Rr])\[(.*?)\]/) { "" }
  255.           end
  256.         end
  257.       end
  258.       if (/\\[Rr]k/.match(text)) != nil
  259.         @right_keep = true
  260.         text.sub!(/\\[Rr]k/) { "" }
  261.       end
  262.       if (/\\[Ll]k/.match(text)) != nil
  263.         @left_keep = true
  264.         text.sub!(/\\[Ll]k/) { "" }
  265.       end
  266.       # 替换人物姓名
  267.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  268.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  269.       end
  270.       # 显示人物姓名
  271.       name_window_set = false
  272.       if (/\\[Mm]([0-9]*?)\[(.+?)\]/.match(text)) != nil
  273.         name_window_set = true
  274.         if $1 == ""
  275.           color = 0
  276.         else
  277.           color = $1.to_i
  278.         end
  279.         if color >= 0 and color <= 7
  280.           name_color = color
  281.         end
  282.         name_text = $2
  283.         text.sub!(/\\[Mm]([0-9]*?)\[(.*?)\]/) { "" }
  284.       end
  285.       # 文字位置的判定
  286.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(text))!=nil then
  287.         @popchar = $1.to_i
  288.         if @popchar == -1
  289.           x = @indent = 48
  290.           y = 4
  291.         end
  292.         text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  293.       end
  294.       # 开始
  295.       begin
  296.         last_text = text.clone
  297.         text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  298.       end until text == last_text
  299.       text.gsub!(/\\\\/) { "\000" }
  300.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  301.       text.gsub!(/\\[Gg]/) { "\002" }
  302.       text.gsub!(/\\[Tt]/) { "\003" }
  303.       text.gsub!(/\\[Uu]\[([0-9A-Fa-f]{6})\]/) { "\004[#{$1}]" }
  304.       text.gsub!(/\\[Ii]/) { "\023" }
  305.       text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  306.       text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  307.       text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  308.       text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  309.       if @popchar >= 0
  310.         max_x = 0
  311.         max_y = 4
  312.         for i in 0..3
  313.           line = text.split(/\n/)[3-i]
  314.           max_y -= 1 if line == nil and max_y <= 4-i
  315.           next if line == nil
  316.           cx = contents.text_size(line).width
  317.           max_x = cx if cx > max_x
  318.         end
  319.         self.width = max_x + 48 + @face_indent
  320.         self.height = (max_y - 1) * 32 + 64
  321.       else
  322.         max_x = self.width - 32 - @face_indent
  323.       end
  324.       reset_window
  325.       if name_window_set
  326.         w = self.contents.text_size(name_text).width + 16
  327.         xn = @alignment ? self.x : self.x + self.width - w
  328.         yn = self.y >= 40 ? self.y - 40 : self.y + self.height
  329.         @name_window = Window_Name.new(xn, yn, w)
  330.         @name_window.z = self.z + 1
  331.         @name_airtext = Window_AirText.new(xn + 8, yn + 8, name_text, name_color)
  332.         @name_airtext.z = self.z + 2
  333.       end
  334.       while ((c = text.slice!(/./m)) != nil)
  335.         if c == "\000"
  336.           c = "\\"
  337.         end
  338.         if c == "\001"
  339.           text.sub!(/\[([0-9]+)\]/, "")
  340.           color = $1.to_i
  341.           if color >= 0 and color <= 7
  342.             self.contents.font.color = text_color(color)
  343.           end
  344.           next
  345.         end
  346.         if c == "\002"
  347.           if @gold_window == nil and @popchar <= 0
  348.             @gold_window = Window_Gold.new
  349.             @gold_window.x = 560 - @gold_window.width
  350.             if $game_temp.in_battle
  351.               @gold_window.y = 192
  352.             else
  353.               @gold_window.y = self.y >= 128 ? 32 : 384
  354.             end
  355.             @gold_window.opacity = self.opacity
  356.             @gold_window.back_opacity = self.back_opacity
  357.           end
  358.           next
  359.         end
  360.         if c == "\003"
  361.           if @playtime_window == nil and @popchar <=0
  362.             @playtime_window = Window_PlayTime.new
  363.             @playtime_window.x = 80
  364.             if $game_temp.in_battle
  365.               @playtime_window.y = 192
  366.             else
  367.               @playtime_window.y = self.y >= 128 ? 32 : 384
  368.             end
  369.             @playtime_window.opacity = self.opacity
  370.             @playtime_window.back_opacity = self.back_opacity
  371.           end
  372.         end
  373.         if c == "\004"
  374.           text.sub!(/\[([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})\]/, "")
  375.           self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16), 255)
  376.           next
  377.         end
  378.         if c == "\023"
  379.           @indent = x
  380.           next
  381.         end
  382.         if c == "\024"
  383.           text.sub!(/\[([0-9]+)\]/, "")
  384.           self.contents.font.color.alpha = [[0, $1.to_i].max, 255].min
  385.           next
  386.         end
  387.         if c == "\025"
  388.           text.sub!(/\[([0-9]+)\]/, "")
  389.           self.contents.font.size = [[$1.to_i, 6].max, 32].min
  390.           next
  391.         end
  392.         if c == "\026"
  393.           text.sub!(/\[([0-9]+)\]/, "")
  394.           x += $1.to_i
  395.           next
  396.         end
  397.         if c == "\027"
  398.           text.sub!(/\[([0-9]+)\]/, "")
  399.           x += $1.to_i * self.contents.font.size / 2
  400.           next
  401.         end
  402.         if c == "\030"
  403.           text.sub!(/\[(.*?)\]/, "")
  404.           self.contents.blt(x , y * line_height + 4, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  405.           x += 24
  406.           next
  407.         end
  408.         if c == "\n"
  409.           if lines >= $game_temp.choice_start
  410.             @cursor_width = [@cursor_width, max_x - @face_indent].max
  411.           end
  412.           lines += 1
  413.           y += 1
  414.           x = 0 + @indent + @face_indent
  415.           if lines >= $game_temp.choice_start
  416.             x = 8 + @indent + @face_indent
  417.           end
  418.           next
  419.         end
  420.         # 描绘文字
  421.         self.contents.draw_text(x, line_height * y, 40, 32, c)
  422.         # x 为要描绘文字的加法运算
  423.         x += self.contents.text_size(c).width
  424.       end
  425.     end
  426.     if $game_temp.choice_max > 0
  427.       @item_max = $game_temp.choice_max
  428.       self.active = true
  429.       self.index = 0
  430.     end
  431.     if $game_temp.num_input_variable_id > 0
  432.       digits_max = $game_temp.num_input_digits_max
  433.       number = $game_variables[$game_temp.num_input_variable_id]
  434.       @input_number_window = Window_InputNumber.new(digits_max)
  435.       @input_number_window.number = number
  436.       @input_number_window.x = self.x + 8
  437.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  438.     end
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● 更新
  442.   #--------------------------------------------------------------------------
  443.   def update
  444.     super
  445.     # 渐变的情况下
  446.     if @fade_in
  447.       self.contents_opacity += 24
  448.       if @input_number_window != nil
  449.         @input_number_window.contents_opacity += 24
  450.       end
  451.       if self.contents_opacity == 255
  452.         @fade_in = false
  453.       end
  454.       return
  455.     end
  456.     # 输入数值的情况下
  457.     if @input_number_window != nil
  458.       @input_number_window.update
  459.       # 确定
  460.       if Input.trigger?(Input::C)
  461.         $game_system.se_play($data_system.decision_se)
  462.         $game_variables[$game_temp.num_input_variable_id] =
  463.           @input_number_window.number
  464.         $game_map.need_refresh = true
  465.         # 释放输入数值窗口
  466.         @input_number_window.dispose
  467.         @input_number_window = nil
  468.         terminate_message
  469.       end
  470.       return
  471.     end
  472.     # 显示信息中的情况下
  473.     if @contents_showing
  474.       # 如果不是在显示选择项中就显示暂停标志
  475.       if $game_temp.choice_max == 0
  476.         self.pause = true
  477.       end
  478.       # 取消
  479.       if Input.trigger?(Input::B)
  480.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  481.           $game_system.se_play($data_system.cancel_se)
  482.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  483.           terminate_message
  484.         end
  485.       end
  486.       # 确定
  487.       if Input.trigger?(Input::C)
  488.         if $game_temp.choice_max > 0
  489.           $game_system.se_play($data_system.decision_se)
  490.           $game_temp.choice_proc.call(self.index)
  491.         end
  492.         terminate_message
  493.       end
  494.       return
  495.     end
  496.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  497.     if @fade_out == false and $game_temp.message_text != nil
  498.       @contents_showing = true
  499.       $game_temp.message_window_showing = true
  500.       reset_window
  501.       refresh
  502.       Graphics.frame_reset
  503.       self.visible = true
  504.       self.contents_opacity = 0
  505.       if @input_number_window != nil
  506.         @input_number_window.contents_opacity = 0
  507.       end
  508.       @fade_in = true
  509.       return
  510.     end
  511.     # 没有可以显示的信息、但是窗口为可见的情况下
  512.     if self.visible
  513.       @fade_out = true
  514.       self.opacity -= 48
  515.       if self.opacity == 0
  516.         self.visible = false
  517.         @fade_out = false
  518.         $game_temp.message_window_showing = false
  519.       end
  520.       return
  521.     end
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ● 获得字符
  525.   #--------------------------------------------------------------------------
  526.   def get_character(parameter)
  527.     case parameter
  528.     when 0
  529.       return $game_player
  530.     else
  531.       events = $game_map.events
  532.       return events == nil ? nil : events[parameter]
  533.     end
  534.   end
  535.   #--------------------------------------------------------------------------
  536.   # ● 设置窗口位置与不透明度
  537.   #--------------------------------------------------------------------------
  538.   def reset_window
  539.     # 判定
  540.     if @popchar >= 0
  541.       events = $game_map.events
  542.       if events != nil
  543.         character = get_character(@popchar)
  544.         x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  545.         y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  546.         self.x = x
  547.         self.y = y
  548.       end
  549.     elsif @popchar == -1
  550.       self.x = -4
  551.       self.y = -4
  552.       self.width = 648
  553.       self.height = 488
  554.     else
  555.       if $game_temp.in_battle
  556.         self.y = 16
  557.       else
  558.         case $game_system.message_position
  559.         when 0 # 上
  560.           self.y = 16
  561.         when 1 # 中
  562.           self.y = 160
  563.         when 2 # 下
  564.           self.y = 304
  565.         end
  566.         self.x = 80
  567.         if @face_bitmap == nil
  568.           self.width = 480
  569.         else
  570.           self.width = 600
  571.           self.x -= 60
  572.         end
  573.         self.height = 160
  574.       end
  575.     end
  576.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  577.     if @face_bitmap != nil
  578.       if @alignment
  579.         self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  580.       else
  581.         self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  582.           Rect.new(0, 0, 96, 96))
  583.       end
  584.     end
  585.     if @popchar == -1
  586.       self.opacity = 255
  587.       self.back_opacity = 0
  588.     elsif $game_system.message_frame == 0
  589.       self.opacity = 255
  590.       self.back_opacity = 160
  591.     else
  592.       self.opacity = 0
  593.       self.back_opacity = 160
  594.     end
  595.   end
  596.   #--------------------------------------------------------------------------
  597.   # ● line_height
  598.   #--------------------------------------------------------------------------
  599.   # 返回値:行高
  600.   #--------------------------------------------------------------------------
  601.   def line_height
  602.     if self.contents.font.size >= 20 and self.contents.font.size <= 24
  603.       return 32
  604.     else
  605.       return self.contents.font.size * 15 / 10
  606.     end
  607.   end
  608.   #--------------------------------------------------------------------------
  609.   # ● \V 变换
  610.   #--------------------------------------------------------------------------
  611.   def convart_value(option, index)
  612.     option == nil ? option = "" : nil
  613.     option.downcase!
  614.     case option
  615.       when "i"
  616.         unless $data_items[index].name == nil
  617.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  618.         end
  619.       when "w"
  620.         unless $data_weapons[index].name == nil
  621.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  622.         end
  623.       when "a"
  624.         unless $data_armors[index].name == nil
  625.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  626.         end
  627.       when "s"
  628.         unless $data_skills[index].name == nil
  629.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  630.         end
  631.       else
  632.       r = $game_variables[index]
  633.     end
  634.     r == nil ? r = "" : nil
  635.     return r
  636.   end
  637.   #--------------------------------------------------------------------------
  638.   # ● 矩形更新
  639.   #--------------------------------------------------------------------------
  640.   def update_cursor_rect
  641.     if @index >= 0
  642.       n = $game_temp.choice_start + @index
  643.       self.cursor_rect.set(4 + @indent + @face_indent, n * 26 + 4, @cursor_width, 30)
  644.     else
  645.       self.cursor_rect.empty
  646.     end
  647.   end
  648. end
  649. #==============================================================================
  650. # ■ Window_Name
  651. #------------------------------------------------------------------------------
  652. #  显示对话人姓名的窗口。
  653. #==============================================================================

  654. class Window_Name < Window_Base
  655.   #--------------------------------------------------------------------------
  656.   # ● 初始化窗口
  657.   #--------------------------------------------------------------------------
  658.   def initialize(x, y, width)
  659.     super(x, y, width, 40)
  660.     self.contents = nil
  661.     self.back_opacity = 160
  662.   end
  663. end

  664. #==============================================================================
  665. # ■ Window_AirText
  666. #------------------------------------------------------------------------------
  667. #  显示对话人姓名的文字。
  668. #==============================================================================

  669. class Window_AirText < Window_Base
  670.   #--------------------------------------------------------------------------
  671.   # ● 初始化窗口
  672.   #--------------------------------------------------------------------------
  673.   def initialize(x, y, designate_text, color)
  674.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  675.     self.opacity = 0
  676.     self.back_opacity = 0
  677.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  678.     w = self.contents.width
  679.     h = self.contents.height
  680.     self.contents.font.color = text_color(color)
  681.     self.contents.draw_text(0, 0, w, h, designate_text)
  682.   end
  683. end
复制代码

Lv1.梦旅人

孙悟空

梦石
0
星屑
55
在线时间
15 小时
注册时间
2007-8-22
帖子
448
2
 楼主| 发表于 2007-8-26 15:55:46 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我用的是真对话加强完美精简版的脚本,
根据《对话框中显示表情(QQ表情)》里所说,可以通过显示武器防具的图标来在对话中插入表情..
但是我用的精简版里,把原先的显示武器(\v[w1])还有防具这些,的功能改成了显示武器名称,也就是说把这个放到对话里,对话便又显示图标,又显示名称...
哪位朋友帮我改下脚本,
我想只显示图标,不显示名称..{/wx}



  1. # ————————————————————————————————————
  2. # 本脚本来自www.66rpg.com,转载请保留此信息
  3. # ————————————————————————————————————

  4. #从此精简版本中去除的标记:
  5. # \.   :停顿一刹那(1、2帧)
  6. # \|   :停顿片刻(20帧)
  7. # \>   :文字不用打字方式
  8. # \<   :文字使用打字方式
  9. # \!   :等待玩家按回车再继续
  10. # \~   :文字直接消失
  11. # \K[今天天气不错]:在出现“今天天气不错”这几个字的时候播放$game_system.soundname_on_speak设置的音效

  12. #新增的标记:
  13. # \d[4]:空4个字节(2个汉字)的位置
  14. # \t: 显示游戏时间窗口
  15. # \v[7]:显示7号变量的值
  16. # \v[a7]:显示7号防具的名称
  17. # \v[s7]:显示7号特技的名称
  18. # \v[w7]:显示7号武器的名称
  19. # \v[i7]:显示7号道具的名称
  20. # \A:头像及姓名框靠左排列
  21. # \a:头像及姓名框靠右排列
  22. # \u[rrggbb]:直接以RGB值十六进制指定颜色

  23. #强化功能的标记:
  24. # \F[001]:在对话显示头像“Graphics/battlers/66rpg_001_f.png”
  25. # \f[1]:在对话中显示1号角色的头像,没有的话同\F[1]效果
  26. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  27. # \l[1]:在左边显示1号角色的半身像,没有的话同\L[1]效果
  28. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  29. # \r[1]:在右边显示1号角色的半身像,没有的话同\R[1]效果
  30. # \m[李逍遥]:用默认颜色(颜色0)显示一个“李逍遥”方框,表示说话人姓名
  31. # \m2[\n[1]]:用颜色2显示1号主角的姓名方框 ----不知道有多少人盼这个功能盼了多久了呵呵

  32. #下面是脚本:

  33. #——说明

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

  37. # \m[李逍遥]:用默认颜色(颜色0)显示一个“李逍遥”方框,表示说话人姓名
  38. # \m2[\n[1]]:用颜色2显示1号主角的姓名方框

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

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

  43. # \c[0-7]:更改颜色

  44. # \u[rrggbb]:直接以十六进制指定颜色,注意这里会把透明度重设为255

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

  46. # \t: 显示游戏时间窗口

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

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

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

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

  51. # \d[4]:空4个字节(2个汉字)的位置

  52. # \F[001]:在对话显示头像“Graphics/battlers/66rpg_001_f.png”
  53. # \f[1]:在对话中显示1号角色的头像,没有的话同\F[1]效果
  54. # \L[001]:在左边显示图片“Graphics/battlers/66rpg_001_h.png”
  55. # \l[1]:在左边显示1号角色的半身像,没有的话同\L[1]效果
  56. # \R[001]:在右边显示图片“Graphics/battlers/66rpg_001_h.png”
  57. # \r[1]:在右边显示1号角色的半身像,没有的话同\R[1]效果

  58. # \Lk:清除左边的图像
  59. # \Rk:清除右边的图像

  60. # \v[7]:显示7号变量的值
  61. # \v[a7]:显示7号防具的名称
  62. # \v[s7]:显示7号特技的名称
  63. # \v[w7]:显示7号武器的名称
  64. # \v[i7]:显示7号道具的名称

  65. # \A:头像及姓名框靠左排列
  66. # \a:头像及姓名框靠右排列

  67. #==============================================================================
  68. # ■ Window_Message
  69. #------------------------------------------------------------------------------
  70. class Window_Message < Window_Selectable
  71.   #--------------------------------------------------------------------------
  72.   # ● 初始化状态
  73.   #--------------------------------------------------------------------------
  74.   def initialize
  75.     super(80, 304, 480, 160)
  76.     self.contents = Bitmap.new(width - 32, height - 32)
  77.     self.visible = false
  78.     self.z = 9998
  79.     @fade_in = false
  80.     @fade_out = false
  81.     @contents_showing = false
  82.     @cursor_width = 0
  83.     self.active = false
  84.     self.index = -1
  85.     @popchar = -2
  86.     @alignment = true
  87.   end
  88.   #--------------------------------------------------------------------------
  89.   # ● 释放
  90.   #--------------------------------------------------------------------------
  91.   def dispose
  92.     terminate_message
  93.     $game_temp.message_window_showing = false
  94.     if @input_number_window != nil
  95.       @input_number_window.dispose
  96.     end
  97.     super
  98.   end
  99.   #--------------------------------------------------------------------------
  100.   # ● 处理信息结束
  101.   #--------------------------------------------------------------------------
  102.   def terminate_message
  103.     self.active = false
  104.     self.pause = false
  105.     self.index = -1
  106.     self.contents.clear
  107.     # 清除显示中标志
  108.     @contents_showing = false
  109.     # 呼叫信息调用
  110.     if $game_temp.message_proc != nil
  111.       $game_temp.message_proc.call
  112.     end
  113.     # 清除文章、选择项、输入数值的相关变量
  114.     $game_temp.message_text = nil
  115.     $game_temp.message_proc = nil
  116.     $game_temp.choice_start = 99
  117.     $game_temp.choice_max = 0
  118.     $game_temp.choice_cancel_type = 0
  119.     $game_temp.choice_proc = nil
  120.     $game_temp.num_input_start = 99
  121.     $game_temp.num_input_variable_id = 0
  122.     $game_temp.num_input_digits_max = 0
  123.     # 开放金钱窗口
  124.     if @gold_window != nil
  125.       @gold_window.dispose
  126.       @gold_window = nil
  127.     end
  128.     # 开放时间窗口
  129.     if @playtime_window != nil
  130.       @playtime_window.dispose
  131.       @playtime_window = nil
  132.     end
  133.     # 开放姓名窗口
  134.     if @name_window != nil
  135.       @name_window.dispose
  136.       @name_window = nil
  137.     end
  138.     if @name_airtext != nil
  139.       @name_airtext.dispose
  140.       @name_airtext = nil
  141.     end
  142.     # 开放角色图片
  143.     if @right_picture != nil and @right_keep == true
  144.       @right_picture.dispose
  145.     end
  146.     if @left_picture != nil and @left_keep == true
  147.       @left_picture.dispose
  148.     end
  149.     @face_bitmap = nil
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 刷新
  153.   #--------------------------------------------------------------------------
  154.   def refresh
  155.     # 初期化
  156.     self.contents.clear
  157.     self.contents.font.color = normal_color
  158.     self.contents.font.size = Font.default_size
  159.     x = y = max_x = max_y = @indent = lines = 0
  160.     @left_keep = @right_keep = false
  161.     @face_indent = 0
  162.     @opacity = 255
  163.     @cursor_width = 0
  164.     face = nil
  165.     if $game_temp.choice_start == 0
  166.       x = 8
  167.     end
  168.     if $game_temp.message_text != nil
  169.       text = $game_temp.message_text
  170.       #——对齐设置
  171.       if (/\\([Aa])/.match(text))!=nil then
  172.         if $1 == "A"
  173.           @alignment = true
  174.         else
  175.           @alignment = false
  176.         end
  177.         text.gsub!(/\\([Aa])/) { "" }
  178.       end
  179.       #——头像设置
  180.       if (/\\([Ff])\[(.+?)\]/.match(text))!=nil then
  181.         face = "66rpg_" + $2 + "_f.png"
  182.         if $1 == "f" and $game_actors[$2.to_i] != nil
  183.           face = $game_actors[$2.to_i].battler_name + "_f.png"
  184.         end
  185.         if FileTest.exist?("Graphics/Battlers/#{face}")
  186.           @face_bitmap = Bitmap.new("Graphics/Battlers/#{face}")
  187.           if @alignment
  188.             x = @face_indent = 128
  189.             self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  190.           else
  191.             self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  192.               Rect.new(0, 0, 96, 96))
  193.           end
  194.         else
  195.           face = nil
  196.           @face_bitmap = nil
  197.         end
  198.         text.gsub!(/\\([Ff])\[(.*?)\]/) { "" }
  199.       end
  200.       #——左半身像设置
  201.       if (/\\([Ll])\[(.+?)\]/.match(text))!=nil then
  202.         face = "66rpg_" + $2 + "_h.png"
  203.         if $1 == "l" and $game_actors[$2.to_i] != nil
  204.           face = $game_actors[$2.to_i].battler_name + "_h.png"
  205.         end
  206.         if $加密 == true
  207.           if @left_picture != nil
  208.             @left_picture.dispose
  209.           end
  210.           @left_picture = Sprite.new
  211.           @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  212.           @left_picture.y = 480-@left_picture.bitmap.height
  213.           @left_picture.x = 0
  214.           @left_picture.mirror = true
  215.           text.gsub!(/\\([Ll])\[(.*?)\]/) { "" }
  216.         else         
  217.           if FileTest.exist?("Graphics/battlers/#{face}")
  218.             if @left_picture != nil
  219.               @left_picture.dispose
  220.             end
  221.             @left_picture = Sprite.new
  222.             @left_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  223.             @left_picture.y = 480-@left_picture.bitmap.height
  224.             @left_picture.x = 0
  225.             @left_picture.mirror = true
  226.             text.gsub!(/\\([Ll])\[(.*?)\]/) { "" }
  227.           end
  228.         end        
  229.       end
  230.       #——右半身像设置
  231.       if (/\\([Rr])\[(.+?)\]/.match(text))!=nil then
  232.         face = "66rpg_" + $2 + "_h.png"
  233.         if $1 == "r" and $game_actors[$2.to_i] != nil
  234.           face = $game_actors[$2.to_i].battler_name + "_h.png"
  235.         end
  236.         if $加密 == true
  237.           if @right_picture != nil
  238.             @right_picture.dispose
  239.           end
  240.           @right_picture = Sprite.new
  241.           @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  242.           @right_picture.y = 480-@right_picture.bitmap.height
  243.           @right_picture.x = 640-@right_picture.bitmap.width
  244.           text.gsub!(/\\([Rr])\[(.*?)\]/) { "" }
  245.         else
  246.           if FileTest.exist?("Graphics/battlers/#{face}")
  247.             if @right_picture != nil
  248.               @right_picture.dispose
  249.             end
  250.             @right_picture = Sprite.new
  251.             @right_picture.bitmap = Bitmap.new("Graphics/battlers/#{face}")
  252.             @right_picture.y = 480-@right_picture.bitmap.height
  253.             @right_picture.x = 640-@right_picture.bitmap.width
  254.             text.gsub!(/\\([Rr])\[(.*?)\]/) { "" }
  255.           end
  256.         end
  257.       end
  258.       if (/\\[Rr]k/.match(text)) != nil
  259.         @right_keep = true
  260.         text.sub!(/\\[Rr]k/) { "" }
  261.       end
  262.       if (/\\[Ll]k/.match(text)) != nil
  263.         @left_keep = true
  264.         text.sub!(/\\[Ll]k/) { "" }
  265.       end
  266.       # 替换人物姓名
  267.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  268.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  269.       end
  270.       # 显示人物姓名
  271.       name_window_set = false
  272.       if (/\\[Mm]([0-9]*?)\[(.+?)\]/.match(text)) != nil
  273.         name_window_set = true
  274.         if $1 == ""
  275.           color = 0
  276.         else
  277.           color = $1.to_i
  278.         end
  279.         if color >= 0 and color <= 7
  280.           name_color = color
  281.         end
  282.         name_text = $2
  283.         text.sub!(/\\[Mm]([0-9]*?)\[(.*?)\]/) { "" }
  284.       end
  285.       # 文字位置的判定
  286.       if (/\\[Pp]\[([-1,0-9]+)\]/.match(text))!=nil then
  287.         @popchar = $1.to_i
  288.         if @popchar == -1
  289.           x = @indent = 48
  290.           y = 4
  291.         end
  292.         text.gsub!(/\\[Pp]\[([-1,0-9]+)\]/) { "" }
  293.       end
  294.       # 开始
  295.       begin
  296.         last_text = text.clone
  297.         text.gsub!(/\\[Vv]\[([IiWwAaSs]?)([0-9]+)\]/) { convart_value($1, $2.to_i) }
  298.       end until text == last_text
  299.       text.gsub!(/\\\\/) { "\000" }
  300.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  301.       text.gsub!(/\\[Gg]/) { "\002" }
  302.       text.gsub!(/\\[Tt]/) { "\003" }
  303.       text.gsub!(/\\[Uu]\[([0-9A-Fa-f]{6})\]/) { "\004[#{$1}]" }
  304.       text.gsub!(/\\[Ii]/) { "\023" }
  305.       text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\024[#{$1}]" }
  306.       text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\025[#{$1}]" }
  307.       text.gsub!(/\\[Bb]\[([0-9]+)\]/) { "\026[#{$1}]" }
  308.       text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\027[#{$1}]" }
  309.       if @popchar >= 0
  310.         max_x = 0
  311.         max_y = 4
  312.         for i in 0..3
  313.           line = text.split(/\n/)[3-i]
  314.           max_y -= 1 if line == nil and max_y <= 4-i
  315.           next if line == nil
  316.           cx = contents.text_size(line).width
  317.           max_x = cx if cx > max_x
  318.         end
  319.         self.width = max_x + 48 + @face_indent
  320.         self.height = (max_y - 1) * 32 + 64
  321.       else
  322.         max_x = self.width - 32 - @face_indent
  323.       end
  324.       reset_window
  325.       if name_window_set
  326.         w = self.contents.text_size(name_text).width + 16
  327.         xn = @alignment ? self.x : self.x + self.width - w
  328.         yn = self.y >= 40 ? self.y - 40 : self.y + self.height
  329.         @name_window = Window_Name.new(xn, yn, w)
  330.         @name_window.z = self.z + 1
  331.         @name_airtext = Window_AirText.new(xn + 8, yn + 8, name_text, name_color)
  332.         @name_airtext.z = self.z + 2
  333.       end
  334.       while ((c = text.slice!(/./m)) != nil)
  335.         if c == "\000"
  336.           c = "\\"
  337.         end
  338.         if c == "\001"
  339.           text.sub!(/\[([0-9]+)\]/, "")
  340.           color = $1.to_i
  341.           if color >= 0 and color <= 7
  342.             self.contents.font.color = text_color(color)
  343.           end
  344.           next
  345.         end
  346.         if c == "\002"
  347.           if @gold_window == nil and @popchar <= 0
  348.             @gold_window = Window_Gold.new
  349.             @gold_window.x = 560 - @gold_window.width
  350.             if $game_temp.in_battle
  351.               @gold_window.y = 192
  352.             else
  353.               @gold_window.y = self.y >= 128 ? 32 : 384
  354.             end
  355.             @gold_window.opacity = self.opacity
  356.             @gold_window.back_opacity = self.back_opacity
  357.           end
  358.           next
  359.         end
  360.         if c == "\003"
  361.           if @playtime_window == nil and @popchar <=0
  362.             @playtime_window = Window_PlayTime.new
  363.             @playtime_window.x = 80
  364.             if $game_temp.in_battle
  365.               @playtime_window.y = 192
  366.             else
  367.               @playtime_window.y = self.y >= 128 ? 32 : 384
  368.             end
  369.             @playtime_window.opacity = self.opacity
  370.             @playtime_window.back_opacity = self.back_opacity
  371.           end
  372.         end
  373.         if c == "\004"
  374.           text.sub!(/\[([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})\]/, "")
  375.           self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16), 255)
  376.           next
  377.         end
  378.         if c == "\023"
  379.           @indent = x
  380.           next
  381.         end
  382.         if c == "\024"
  383.           text.sub!(/\[([0-9]+)\]/, "")
  384.           self.contents.font.color.alpha = [[0, $1.to_i].max, 255].min
  385.           next
  386.         end
  387.         if c == "\025"
  388.           text.sub!(/\[([0-9]+)\]/, "")
  389.           self.contents.font.size = [[$1.to_i, 6].max, 32].min
  390.           next
  391.         end
  392.         if c == "\026"
  393.           text.sub!(/\[([0-9]+)\]/, "")
  394.           x += $1.to_i
  395.           next
  396.         end
  397.         if c == "\027"
  398.           text.sub!(/\[([0-9]+)\]/, "")
  399.           x += $1.to_i * self.contents.font.size / 2
  400.           next
  401.         end
  402.         if c == "\030"
  403.           text.sub!(/\[(.*?)\]/, "")
  404.           self.contents.blt(x , y * line_height + 4, RPG::Cache.icon($1), Rect.new(0, 0, 24, 24))
  405.           x += 24
  406.           next
  407.         end
  408.         if c == "\n"
  409.           if lines >= $game_temp.choice_start
  410.             @cursor_width = [@cursor_width, max_x - @face_indent].max
  411.           end
  412.           lines += 1
  413.           y += 1
  414.           x = 0 + @indent + @face_indent
  415.           if lines >= $game_temp.choice_start
  416.             x = 8 + @indent + @face_indent
  417.           end
  418.           next
  419.         end
  420.         # 描绘文字
  421.         self.contents.draw_text(x, line_height * y, 40, 32, c)
  422.         # x 为要描绘文字的加法运算
  423.         x += self.contents.text_size(c).width
  424.       end
  425.     end
  426.     if $game_temp.choice_max > 0
  427.       @item_max = $game_temp.choice_max
  428.       self.active = true
  429.       self.index = 0
  430.     end
  431.     if $game_temp.num_input_variable_id > 0
  432.       digits_max = $game_temp.num_input_digits_max
  433.       number = $game_variables[$game_temp.num_input_variable_id]
  434.       @input_number_window = Window_InputNumber.new(digits_max)
  435.       @input_number_window.number = number
  436.       @input_number_window.x = self.x + 8
  437.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  438.     end
  439.   end
  440.   #--------------------------------------------------------------------------
  441.   # ● 更新
  442.   #--------------------------------------------------------------------------
  443.   def update
  444.     super
  445.     # 渐变的情况下
  446.     if @fade_in
  447.       self.contents_opacity += 24
  448.       if @input_number_window != nil
  449.         @input_number_window.contents_opacity += 24
  450.       end
  451.       if self.contents_opacity == 255
  452.         @fade_in = false
  453.       end
  454.       return
  455.     end
  456.     # 输入数值的情况下
  457.     if @input_number_window != nil
  458.       @input_number_window.update
  459.       # 确定
  460.       if Input.trigger?(Input::C)
  461.         $game_system.se_play($data_system.decision_se)
  462.         $game_variables[$game_temp.num_input_variable_id] =
  463.           @input_number_window.number
  464.         $game_map.need_refresh = true
  465.         # 释放输入数值窗口
  466.         @input_number_window.dispose
  467.         @input_number_window = nil
  468.         terminate_message
  469.       end
  470.       return
  471.     end
  472.     # 显示信息中的情况下
  473.     if @contents_showing
  474.       # 如果不是在显示选择项中就显示暂停标志
  475.       if $game_temp.choice_max == 0
  476.         self.pause = true
  477.       end
  478.       # 取消
  479.       if Input.trigger?(Input::B)
  480.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  481.           $game_system.se_play($data_system.cancel_se)
  482.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  483.           terminate_message
  484.         end
  485.       end
  486.       # 确定
  487.       if Input.trigger?(Input::C)
  488.         if $game_temp.choice_max > 0
  489.           $game_system.se_play($data_system.decision_se)
  490.           $game_temp.choice_proc.call(self.index)
  491.         end
  492.         terminate_message
  493.       end
  494.       return
  495.     end
  496.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  497.     if @fade_out == false and $game_temp.message_text != nil
  498.       @contents_showing = true
  499.       $game_temp.message_window_showing = true
  500.       reset_window
  501.       refresh
  502.       Graphics.frame_reset
  503.       self.visible = true
  504.       self.contents_opacity = 0
  505.       if @input_number_window != nil
  506.         @input_number_window.contents_opacity = 0
  507.       end
  508.       @fade_in = true
  509.       return
  510.     end
  511.     # 没有可以显示的信息、但是窗口为可见的情况下
  512.     if self.visible
  513.       @fade_out = true
  514.       self.opacity -= 48
  515.       if self.opacity == 0
  516.         self.visible = false
  517.         @fade_out = false
  518.         $game_temp.message_window_showing = false
  519.       end
  520.       return
  521.     end
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ● 获得字符
  525.   #--------------------------------------------------------------------------
  526.   def get_character(parameter)
  527.     case parameter
  528.     when 0
  529.       return $game_player
  530.     else
  531.       events = $game_map.events
  532.       return events == nil ? nil : events[parameter]
  533.     end
  534.   end
  535.   #--------------------------------------------------------------------------
  536.   # ● 设置窗口位置与不透明度
  537.   #--------------------------------------------------------------------------
  538.   def reset_window
  539.     # 判定
  540.     if @popchar >= 0
  541.       events = $game_map.events
  542.       if events != nil
  543.         character = get_character(@popchar)
  544.         x = [[character.screen_x - 0 - self.width / 2, 4].max, 636 - self.width].min
  545.         y = [[character.screen_y - 48 - self.height, 4].max, 476 - self.height].min
  546.         self.x = x
  547.         self.y = y
  548.       end
  549.     elsif @popchar == -1
  550.       self.x = -4
  551.       self.y = -4
  552.       self.width = 648
  553.       self.height = 488
  554.     else
  555.       if $game_temp.in_battle
  556.         self.y = 16
  557.       else
  558.         case $game_system.message_position
  559.         when 0 # 上
  560.           self.y = 16
  561.         when 1 # 中
  562.           self.y = 160
  563.         when 2 # 下
  564.           self.y = 304
  565.         end
  566.         self.x = 80
  567.         if @face_bitmap == nil
  568.           self.width = 480
  569.         else
  570.           self.width = 600
  571.           self.x -= 60
  572.         end
  573.         self.height = 160
  574.       end
  575.     end
  576.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  577.     if @face_bitmap != nil
  578.       if @alignment
  579.         self.contents.blt(16, 16, @face_bitmap, Rect.new(0, 0, 96, 96))
  580.       else
  581.         self.contents.blt(self.contents.width - 112, 16, @face_bitmap,
  582.           Rect.new(0, 0, 96, 96))
  583.       end
  584.     end
  585.     if @popchar == -1
  586.       self.opacity = 255
  587.       self.back_opacity = 0
  588.     elsif $game_system.message_frame == 0
  589.       self.opacity = 255
  590.       self.back_opacity = 160
  591.     else
  592.       self.opacity = 0
  593.       self.back_opacity = 160
  594.     end
  595.   end
  596.   #--------------------------------------------------------------------------
  597.   # ● line_height
  598.   #--------------------------------------------------------------------------
  599.   # 返回値:行高
  600.   #--------------------------------------------------------------------------
  601.   def line_height
  602.     if self.contents.font.size >= 20 and self.contents.font.size <= 24
  603.       return 32
  604.     else
  605.       return self.contents.font.size * 15 / 10
  606.     end
  607.   end
  608.   #--------------------------------------------------------------------------
  609.   # ● \V 变换
  610.   #--------------------------------------------------------------------------
  611.   def convart_value(option, index)
  612.     option == nil ? option = "" : nil
  613.     option.downcase!
  614.     case option
  615.       when "i"
  616.         unless $data_items[index].name == nil
  617.           r = sprintf("\030[%s]%s", $data_items[index].icon_name, $data_items[index].name)
  618.         end
  619.       when "w"
  620.         unless $data_weapons[index].name == nil
  621.           r = sprintf("\030[%s]%s", $data_weapons[index].icon_name, $data_weapons[index].name)
  622.         end
  623.       when "a"
  624.         unless $data_armors[index].name == nil
  625.           r = sprintf("\030[%s]%s", $data_armors[index].icon_name, $data_armors[index].name)
  626.         end
  627.       when "s"
  628.         unless $data_skills[index].name == nil
  629.           r = sprintf("\030[%s]%s", $data_skills[index].icon_name, $data_skills[index].name)
  630.         end
  631.       else
  632.       r = $game_variables[index]
  633.     end
  634.     r == nil ? r = "" : nil
  635.     return r
  636.   end
  637.   #--------------------------------------------------------------------------
  638.   # ● 矩形更新
  639.   #--------------------------------------------------------------------------
  640.   def update_cursor_rect
  641.     if @index >= 0
  642.       n = $game_temp.choice_start + @index
  643.       self.cursor_rect.set(4 + @indent + @face_indent, n * 26 + 4, @cursor_width, 30)
  644.     else
  645.       self.cursor_rect.empty
  646.     end
  647.   end
  648. end
  649. #==============================================================================
  650. # ■ Window_Name
  651. #------------------------------------------------------------------------------
  652. #  显示对话人姓名的窗口。
  653. #==============================================================================

  654. class Window_Name < Window_Base
  655.   #--------------------------------------------------------------------------
  656.   # ● 初始化窗口
  657.   #--------------------------------------------------------------------------
  658.   def initialize(x, y, width)
  659.     super(x, y, width, 40)
  660.     self.contents = nil
  661.     self.back_opacity = 160
  662.   end
  663. end

  664. #==============================================================================
  665. # ■ Window_AirText
  666. #------------------------------------------------------------------------------
  667. #  显示对话人姓名的文字。
  668. #==============================================================================

  669. class Window_AirText < Window_Base
  670.   #--------------------------------------------------------------------------
  671.   # ● 初始化窗口
  672.   #--------------------------------------------------------------------------
  673.   def initialize(x, y, designate_text, color)
  674.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  675.     self.opacity = 0
  676.     self.back_opacity = 0
  677.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  678.     w = self.contents.width
  679.     h = self.contents.height
  680.     self.contents.font.color = text_color(color)
  681.     self.contents.draw_text(0, 0, w, h, designate_text)
  682.   end
  683. end
复制代码

Lv1.梦旅人

孙悟空

梦石
0
星屑
55
在线时间
15 小时
注册时间
2007-8-22
帖子
448
3
 楼主| 发表于 2007-8-26 15:58:04 | 只看该作者
哦,对了!
只要把名称留空就行了!
猛然想起!
....
直接结贴好了...最近老发无意义帖...
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-25 02:17

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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