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

Project1

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

[已经过期] 求在对话框上显示角色名的脚本

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1236
在线时间
152 小时
注册时间
2006-2-12
帖子
226
跳转到指定楼层
1
发表于 2014-5-15 21:40:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
如题,我之前用了什么对话加强脚本,但是那个名字是在对话框里面出现的,我需要一个在对话框上面出现小框框显示角色名,谢谢啦~~

Lv1.梦旅人

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

开拓者

2
发表于 2014-5-15 21:56:05 | 只看该作者
fuki对话框
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
375 小时
注册时间
2013-10-1
帖子
77
3
发表于 2014-5-15 23:14:04 | 只看该作者
你用的是哪个脚本?一般都是需要使用特定符号来让名字显示在小框里的。。。
比如我用的这个脚本上面是这样的。。。

# 其他在对话中可以使用的功能:
# \n[1]:显示1号角色的姓名
# \name[李逍遥]:显示一个“李逍遥”方框,表示说话人姓名
# \\:显示"\"这个符号
# \c[1-8]:更改颜色
# \g:显示金钱窗口
# \a[SE文件名]:对话的时候播放SE
# \s[1-19]:更改弹字的速度
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1236
在线时间
152 小时
注册时间
2006-2-12
帖子
226
4
 楼主| 发表于 2014-5-16 09:24:26 | 只看该作者
斯塔萨菲雅 发表于 2014-5-15 23:14
你用的是哪个脚本?一般都是需要使用特定符号来让名字显示在小框里的。。。
比如我用的这个脚本上面是这样 ...

求这个脚本啊…………我的不是这个
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
375 小时
注册时间
2013-10-1
帖子
77
5
发表于 2014-5-16 17:33:08 | 只看该作者
douqunbo 发表于 2014-5-16 09:24
求这个脚本啊…………我的不是这个

我这个已经被我乱改过了。。。= =
我也没保留原版,现在两边论坛又都不能搜索是什么情况= =。。

你用的脚本前面有没有类似这样的注释?
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1236
在线时间
152 小时
注册时间
2006-2-12
帖子
226
6
 楼主| 发表于 2014-5-17 08:52:36 | 只看该作者
斯塔萨菲雅 发表于 2014-5-16 17:33
我这个已经被我乱改过了。。。= =
我也没保留原版,现在两边论坛又都不能搜索是什么情况= =。。

没有……没关系我也只要用那一个功能就够啦~改了的没关系
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
375 小时
注册时间
2013-10-1
帖子
77
7
发表于 2014-5-17 15:08:57 | 只看该作者
那你试试看吧,需要改一下547行附近和很多地方的坐标。因为我改大了窗口的分辨率。。。


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



评分

参与人数 1星屑 +120 收起 理由
myownroc + 120 塞糖

查看全部评分

回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
59
在线时间
398 小时
注册时间
2011-10-6
帖子
987
8
发表于 2014-5-18 11:13:49 | 只看该作者
这是范例,怎么用里面的脚本都有说明

66加强对话框与Fuki对话框整合 附送功能.rar

411.73 KB, 下载次数: 34

评分

参与人数 1星屑 +120 收起 理由
myownroc + 120 塞糖

查看全部评分

回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-22 03:58

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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