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

Project1

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

[已经解决] 怎么在XP里做到VX的文章一个字一个字输出的效果

[复制链接]

Lv1.梦旅人

梦石
0
星屑
49
在线时间
107 小时
注册时间
2012-5-1
帖子
45
跳转到指定楼层
1
发表于 2012-5-21 18:49:33 手机端发表。 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
求解啊~~~~~~

Lv3.寻梦者

双子人

梦石
0
星屑
3175
在线时间
3617 小时
注册时间
2009-4-4
帖子
4154

开拓者

2
发表于 2012-5-21 19:01:58 | 只看该作者
本帖最后由 hys111111 于 2012-5-21 19:02 编辑

103号变量就是打字效果,设置为多少就是一秒打多少个字,设置为0打字效果关闭
  1. #==============================================================================
  2. # ◎ GPRA_Window_Message
  3. #------------------------------------------------------------------------------
  4. # ◎ 显示文章的信息窗口加强。
  5. #------------------------------------------------------------------------------
  6. # 制作者:绿梨子红苹果
  7. # 个人主页:vbgm.9126.com
  8. # E-Mail:[email protected]
  9. # QQ:42378361
  10. #
  11. #\C[#RRGGBB] 直接设定RGB文字颜色。(摘录改编自SailCat的对话脚本)
  12. #\I[n]    物品图标+名称显示,显示ID为n的物品的图标以及名称。
  13. #\K[n]    技能图标+名称显示,类似上面。
  14. #\W[n]    武器图标+名称显示,类似上面。
  15. #\D[n]    防具图标+名称显示,类似上面。
  16. #\I1[n]    物品图标显示,显示ID为n的物品的图标。
  17. #\K1[n]    技能图标显示,类似上面。
  18. #\W1[n]    武器图标显示,类似上面。
  19. #\D1[n]    防具图标显示,类似上面。
  20. #\I2[n]    物品名称显示,显示ID为n的物品的名称。
  21. #\K2[n]    技能名称显示,类似上面。
  22. #\W2[n]    武器名称显示,类似上面。
  23. #\D2[n]    防具名称显示,类似上面。
  24. #\S[n]    字体大小,修改字体大小为n(最大96;最小…不要过分就可以了…建议20以上…)
  25. #\O[n]    文字不透明度,修改文字不透明度为n(0~255,255为不透明)(模拟声音变小……)
  26. #\=[n] 等待n帧
  27. #\. 等待3帧
  28. #\_ 等待30帧
  29. #\TXT[FileName][LineLabel] 打开TXT文件读入对话。FileName为文件名,LineLabel为行号(可选)。
  30. #将打开"FileName.txt"文件读取对话,然后从LineLabel行号开始读取内容到下一个行号出现处。
  31. #LineLabel在TXT文本中用"["和"]"紧紧包括,左右不允许再有任何的字符。行号标签必须独占一行。
  32. #在TXT文本中,大多数以上标识符仍然有效。但是需要注意,读取TXT文本后必须用正常方式
  33. #(就是指非TXT文本方式)结束对话,不然会陷于死循环无法中指对话,可行的办法就是利用"\~\/"来进行一次“空对话”!
  34. #参照示例工程,这个使用我真的讲不清楚……

  35. #以下三个变量
  36. #101:对话显示模式,此变量设定值影响对话显示模式:0.正常模式 1.图书模式 2.全屏模式。
  37. #102:对话自动关闭,设定正数n表示对话n帧后自动关闭,设定0或负数表示关闭此效果。
  38. #103:对话打字效果,设定正数n表示对话每帧显示出n个字符,设定0或负数表示关闭此效果。

  39. #具体可参见http://rpg.blue/forumTopicRead.asp?id=49803

  40. #注意,行首加#表示由Oksh修改或增加
  41. #==============================================================================

  42. class Window_Message < Window_Selectable
  43.   #--------------------------------------------------------------------------
  44.   # ● 初始化状态
  45.   #--------------------------------------------------------------------------
  46.   def initialize
  47.     super(60, 304, 520, 160)
  48. #    super(135, 304, 500, 160)
  49.     self.contents = Bitmap.new(width - 32, height - 32)
  50.     self.visible = false
  51.     self.z = 9998
  52.     @fade_in = false
  53.     @fade_out = false
  54.     @contents_showing = false
  55.     @cursor_width = 0
  56.     @op = 255 # 不透明度
  57.     @head_bmp = nil # 装载头像用
  58.     @head_file = nil # 头像文件名
  59.     @text = nil # 记录所处理文字
  60.     @skip = false # 记录是否跳过此次对话
  61.     @auto_close = -1 # 默认不打开自动关闭
  62.     @type_mode=-1 # 打字模式
  63.     @delay=-1 # 等待n帧标志
  64.     @finish=false # 记录文字处理是否结束
  65.     @ts = TextStream.new # 创建一个新的TXT读取流
  66.     @is_read_txt =false # 默认不是在读取txt文件
  67.     self.active = false
  68.     self.index = -1
  69.   end
  70.   #--------------------------------------------------------------------------
  71.   # ● 释放
  72.   #--------------------------------------------------------------------------
  73.   def dispose
  74.     terminate_message
  75.     $game_temp.message_window_showing = false
  76.     if @input_number_window != nil
  77.       @input_number_window.dispose
  78.     end
  79.     super
  80.   end
  81.   #--------------------------------------------------------------------------
  82.   # ● 处理信息结束
  83.   #--------------------------------------------------------------------------
  84.   def terminate_message
  85.    
  86. #以下为增加姓名框处理
  87.     if @name_window_frame != nil
  88.       @name_window_frame.dispose
  89.       @name_window_frame = nil
  90.     end
  91.     if @name_window_text != nil
  92.       @name_window_text.dispose
  93.       @name_window_text = nil
  94.     end
  95. #以上为增加姓名框处理

  96.     self.active = false
  97.     self.pause = false
  98.     self.index = -1
  99.     self.contents.clear
  100.     # 清除显示中标志
  101.     @contents_showing = false
  102.     # 呼叫信息调用
  103.     if $game_temp.message_proc != nil
  104.       $game_temp.message_proc.call
  105.     end
  106.     # 清除文章、选择项、输入数值的相关变量
  107.     $game_temp.message_text = nil
  108.     $game_temp.message_proc = nil
  109.     $game_temp.choice_start = 99
  110.     $game_temp.choice_max = 0
  111.     $game_temp.choice_cancel_type = 0
  112.     $game_temp.choice_proc = nil
  113.     $game_temp.num_input_start = 99
  114.     $game_temp.num_input_variable_id = 0
  115.     $game_temp.num_input_digits_max = 0
  116.     # 开放金钱窗口
  117.     if @gold_window != nil
  118.       @gold_window.dispose
  119.       @gold_window = nil
  120.     end
  121.   end
  122.   #--------------------------------------------------------------------------
  123.   # ● 刷新
  124.   #--------------------------------------------------------------------------
  125.   def refresh
  126.     # 清空原先内容
  127.     self.contents.clear
  128.     # 恢复一般字色
  129.     self.contents.font.color = normal_color
  130.     # 恢复字体大小
  131.     self.contents.font.size = 20
  132.     # 绘制文字位置初始化
  133.     @x = @y = 0
  134.     # 字体高度记录
  135.     @height = 32
  136.     # 文字不透明度设定为255
  137.     @op = 255
  138.     # 头像默认显示在右边
  139.     @right = true
  140.     # 头像默认显示一般表情
  141.     @face = nil
  142.     # 默认显示角色姓名
  143.     @name = nil
  144.     # 默认不跳过此次对话
  145.     @skip = false
  146.     # 从变量读取自动关闭设置
  147.     @auto_close = $game_variables[102]
  148.     # 从变量读取打字模式设置
  149.     @type_mode=$game_variables[103]
  150.     # 默认不等待
  151.     @delay=-1
  152.     # 设定文字没有处理结束
  153.     @finish=false
  154.     # 光标宽度初始化为零
  155.     @cursor_width = 0
  156.     # 到选择项的下一行字
  157.     if $game_temp.choice_start == 0
  158.       @x = 16
  159.     end
  160.     # 有等待显示的文字的情况下
  161.     # (注:因为一旦文字非空就处理,所以可以设定 $game_temp.message_text 达到显示文章的效果)
  162.     if $game_temp.message_text != nil
  163. #      # @text 功能改进
  164. #      if @text==nil or @text==""
  165. #      @text = $game_temp.message_text.dup
  166. #      else
  167. #        @text = @text + $game_temp.message_text
  168. #      end



  169. #以下为对话记录
  170.       clue = $game_temp.message_text.split(/@clu/)[1]
  171.       if clue != nil
  172.         if @text==nil
  173.           @text = $game_temp.message_text.split(/@/)[0]
  174.         else
  175.           @text = @text + $game_temp.message_text.split(/@/)[0]
  176.         end
  177.        # @text = $game_temp.message_text.split(/@/)[0]
  178.       
  179.         if $game_variables[36].include?($game_variables[3])==false
  180.           $game_variables[36][$game_variables[3]]={}
  181.         end#当前魔塔编号不存在就创建它
  182.         if $game_variables[36][$game_variables[3]].include?($game_variables[2])==false
  183.           $game_variables[36][$game_variables[3]][$game_variables[2]]=[]
  184.         end#当前魔塔编号当前楼层不存在就创建它
  185.         if $game_variables[36][0].include?($game_variables[3])==false
  186.           $game_variables[36][0][$game_variables[3]]=0
  187.         end#当前魔塔编号对话记录次数不存在就创建它
  188.         if $game_variables[36][$game_variables[3]][1000]==nil
  189.           $game_variables[36][$game_variables[3]][1000]=[]
  190.         end#当前魔塔编号对话记录顺序排列不存在就创建它

  191. #       p $game_temp.message_text.split(/@/)[0]
  192. #       p $game_variables[36][$game_variables[3]][$game_variables[2]].include?($game_temp.message_text.split(/@/)[0])
  193.         if $game_variables[36][$game_variables[3]][$game_variables[2]].include?($game_temp.message_text.split(/@/)[0])==false
  194.           $game_variables[36][$game_variables[3]][$game_variables[2]].push ($game_temp.message_text.split(/@/)[0])


  195.           $game_variables[36][0][$game_variables[3]]+=1# 已知的对话条数
  196.           @j=0
  197.           for i in 0...$game_variables[2]+1
  198.             if $game_variables[36][$game_variables[3]].include?(i)
  199.               @j+=$game_variables[36][$game_variables[3]][i].size
  200.             end
  201.           end
  202.           @j-=1
  203.           @j=0 if @j<=0

  204.           $game_variables[36][$game_variables[3]][1000].insert @j,[$game_variables[2],$game_variables[36][$game_variables[3]][$game_variables[2]][$game_variables[36][$game_variables[3]][$game_variables[2]].size-1]]
  205.         end
  206.       else
  207.         if @text==nil
  208.           @text = $game_temp.message_text.dup
  209.         else
  210.           @text = @text + $game_temp.message_text
  211.         end
  212. #        @text = $game_temp.message_text
  213.       end
  214. #以上为对话记录      
  215.       
  216.       # 最先必须要将 "\\\\" 变换为 "\000"
  217.       @text.gsub!(/\\\\/)                { "\000" }
  218.       
  219.       # 在TXT模式还没有打开的时候
  220.       if !@is_read_txt
  221.         # TXT读取模式打开
  222.         if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]\[(\w+)\]/)!=nil
  223.           # 打开文件,成功打开后再进入后面部分
  224.           if @ts.open($1,$2)
  225.             # 根据显示模式确定需要打开行数
  226.             case $game_variables[1]
  227.             when 0 # 正常模式
  228.               @text =  @ts.get_text(4)
  229.             when 1 # 图书模式
  230.               @text =  @ts.get_text(12)
  231.             when 2 # 全屏模式
  232.               @text =  @ts.get_text(15)
  233.             end
  234.             # 如果包含[END]
  235.             if @text.gsub!(/\[END\]/){""}!=nil
  236.               #退出TXT读取模式
  237.               @is_read_txt=false
  238.             else
  239.               #否则设置正在读取标志
  240.               @is_read_txt=true
  241.             end
  242.           end
  243.         else
  244.           if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]/)!=nil
  245.             # 打开文件,成功打开后再进入后面部分
  246.             if @ts.open($1,"")
  247.               # 根据显示模式确定需要打开行数
  248.               case $game_variables[101]
  249.               when 0 # 正常模式
  250.                 @text =  @ts.get_text(4)
  251.               when 1 # 图书模式
  252.                 @text =  @ts.get_text(12)
  253.               when 2 # 全屏模式
  254.                 @text =  @ts.get_text(15)
  255.               end
  256.               # 如果包含[END]
  257.               if @text.gsub!(/\[END\]/){""}!=nil
  258.                 #退出TXT读取模式
  259.                 @is_read_txt=false
  260.               else
  261.                 #否则设置正在读取标志
  262.                 @is_read_txt=true
  263.               end
  264.             end
  265.           end
  266.         end
  267.       end
  268.         
  269.       # 如果取得的字符含"\\~"时
  270.       if @text.slice!(/\\~/)!=nil
  271.         # 跳过此次对话
  272.         terminate_message
  273.         # 设置跳过此次对话标志
  274.         @skip = true
  275.         # 直接返回等待连接后面部分
  276.         return
  277.       end
  278.       
  279.       # 限制文字处理(注:这里是默认功能。)
  280.       begin
  281.         last_text = @text.clone
  282.         @text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  283.       end until @text == last_text
  284.       @text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  285.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  286.       end
  287.       #(注:后面将单个字符循环判断,所以这里将控制符全部换成单个字符)
  288.       # 为了方便将 "\\C" 变为 "\001"
  289.       @text.gsub!(/\\[Cc]\[([0-9#a-zA-Z]+)\]/)  { "\001[#{$1}]" }
  290.       # "\\G" 变为 "\002"
  291.       @text.gsub!(/\\[Gg]/)              { "\002" }
  292.       
  293.       # ========================增强功能========================
  294.       
  295.       #对话加强      
  296.       @now_text=$game_temp.message_text
  297.       name_window_set = false#\m[姓名]在对话框上增加姓名
  298.       if (/\\[Mm]\[(.+?)\]/.match(@now_text)) != nil
  299. #        name_window_set = true
  300.         name_text = $1
  301.         @now_text.sub!(/\\[Mm]\[(.*?)\]/) { "" }
  302.       end

  303.       @text.gsub!(/\\[Mm]\[(.+?)\]/) do
  304.         name_window_set = true
  305.         name_text = $1
  306.         @now_text.sub!(/\\[Mm]\[(.*?)\]/) { "" }
  307.       end
  308.       #对话加强
  309.       
  310.       
  311.       # "\\/" 删除行尾换行符号
  312.       @text.gsub!(/\\\/\n/) {""}
  313.       # 去掉不在行尾的"\\/"符号,防止出错
  314.       @text.gsub!(/\\\//) {""}
  315.       
  316.       # "\\I" 物品图标+名称显示
  317.       @text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\003[#{$1}]"+$data_items[$1.to_i].name }
  318.       # "\\K" 技能图标+名称显示
  319.       @text.gsub!(/\\[Kk]\[([0-9]+)\]/) { "\004[#{$1}]"+$data_skills[$1.to_i].name }
  320.       # "\\W" 武器图标+名称显示
  321.       @text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\005[#{$1}]"+$data_weapons[$1.to_i].name }
  322.       # "\\A" 防具图标+名称显示
  323.       @text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\006[#{$1}]"+$data_armors[$1.to_i].name }
  324.       
  325.       # 注:大量显示图片将是游戏的速度大大减慢
  326.       # "\\I1" 物品图标显示
  327.       @text.gsub!(/\\[Ii]1\[([0-9]+)\]/) { "\003[#{$1}]" }
  328.       # "\\K1" 技能图标显示
  329.       @text.gsub!(/\\[Kk]1\[([0-9]+)\]/) { "\004[#{$1}]" }
  330.       # "\\W1" 武器图标显示
  331.       @text.gsub!(/\\[Ww]1\[([0-9]+)\]/) { "\005[#{$1}]" }
  332.       # "\\A1" 防具图标显示
  333.       @text.gsub!(/\\[Dd]1\[([0-9]+)\]/) { "\006[#{$1}]" }
  334.       
  335.       # "\\I2" 物品名称显示
  336.       @text.gsub!(/\\[Ii]2\[([0-9]+)\]/) { $data_items[$1.to_i].name }
  337.       # "\\K2" 技能名称显示
  338.       @text.gsub!(/\\[Kk]2\[([0-9]+)\]/) { $data_skills[$1.to_i].name }
  339.       # "\\W2" 武器名称显示
  340.       @text.gsub!(/\\[Ww]2\[([0-9]+)\]/) { $data_weapons[$1.to_i].name }
  341.       # "\\A2" 防具名称显示
  342.       @text.gsub!(/\\[Dd]2\[([0-9]+)\]/) { $data_armors[$1.to_i].name }
  343.       
  344.       # "\\S" 字体大小(只修改第一个"\\S")
  345.       # 这里首先删掉能找到的第一个"\\S"
  346.       if @text.slice!(/\\[Ss]\[([0-9]+)\]/)!=nil
  347.         # 当找了"\\S"时满足上述条件,就设置文字大小
  348.         self.set_font_size($1.to_i)
  349.       end
  350.       # "\\O" 文字透明度(使用注意同上,模拟声音变小……)
  351.       if @text.slice!(/\\[Oo]\[([0-9]+)\]/)!=nil
  352.         self.set_font_op($1.to_i)
  353.       end

  354.       # "\\=" 停顿固定帧(延时)
  355.       @text.gsub!(/\\=\[([0-9]+)\]/)    { "\024[#{$1}]" }
  356.       # "\\." 停顿3帧
  357.       @text.gsub!(/\\\./)               { "\024[3]" }
  358.       # "\\_" 停顿1秒(30帧)
  359.       @text.gsub!(/\\_/)                { "\024[30]" }
  360.       
  361.       # "\\L" 指定头像左边显示
  362.       if @text.slice!(/\\[Ll]/)!=nil
  363.         # 设定头像居右标志为假
  364.         @right=false
  365.         # 顺便要设置@x=104,文字在右边显示
  366.         @x=104
  367.       end
  368.       # "\\X" 指定不要显示姓名,带参数就是指定显示姓名(可内部使用"\\N[]")
  369.       # 首先是寻找有没有带参数的"\\X"
  370.       if @text.slice!(/\\[Xx]\[(\w+)\]/)!=nil
  371.         # 找到的话将参数赋予@name
  372.         @name=$1
  373.       # 没有找到的话
  374.       else
  375.         # 再去寻找有没有不带参数的"\\X"
  376.         if @text.slice!(/\\[Xx]/)!=nil
  377.           # 找到的话就将姓名变成"???"
  378.           @name="???"
  379.         end
  380.       end
  381.       # "\\F" 指定表情(Face 用来指定表情啦)
  382.       # 这里"\w"表示匹配字母+数字还有下划线,同样支持中文
  383.       if @text.slice!(/\\[Ff]\[(\w+)\]/)!=nil
  384.         # 找到的话就设定表情
  385.         @face=$1
  386.       end
  387.       # "\\H" 显示头像(不明白大家为什么都喜欢用 Face 表示头像……)
  388.       # 这里我将把显示头像放到字串的最前面,因为头像应该先显示出来
  389.       if @text.slice!(/\\[Hh]\[([0-9]+)\]/)!=nil
  390.         # 找到的话就提到字符串最前面
  391.         @text="\030[#{$1}]"+@text
  392.       end
  393.       
  394.       # ================ 分析部分结束,下面是显示部分 ================
  395.    
  396.       # 在此调用过程完成,因为在update部分也会有相同代码
  397.       self.refresh_

  398.     end
  399.     # 选择项的情况
  400.     if $game_temp.choice_max > 0
  401.       @item_max = $game_temp.choice_max
  402.       self.active = true
  403.       self.index = 0
  404.     end
  405.     # 输入数值的情况
  406.     if $game_temp.num_input_variable_id > 0
  407.       digits_max = $game_temp.num_input_digits_max
  408.       number = $game_variables[$game_temp.num_input_variable_id]
  409.       @input_number_window = Window_InputNumber.new(digits_max)
  410.       @input_number_window.number = number
  411.       @input_number_window.x = self.x + 8
  412.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  413.     end
  414.    
  415. #对话加强
  416. #    reset_window
  417.     if name_window_set
  418.       off_x = 0
  419.       off_y = -40
  420.       space = 2
  421.       x = self.x + off_x - space / 2
  422.       y = self.y + off_y - space / 2
  423.       w = self.contents.text_size(name_text).width + 26 + space
  424.       h = 40 + space
  425.       @name_window_frame = Window_Frame.new(x, y, w, h)
  426.       @name_window_frame.z = self.z + 1
  427.       x = self.x + off_x + 4
  428.       y = self.y + off_y
  429.       @name_window_text = Air_Text.new(x+4, y+6, name_text)
  430.       @name_window_text.z = self.z + 2
  431.     end
  432. #对话加强

  433.   end
  434.   #--------------------------------------------------------------------------
  435.   # ● 设置窗口位置与不透明度
  436.   #--------------------------------------------------------------------------
  437.   def reset_window
  438.     # 判断现在的显示模式
  439.     case $game_variables[101]
  440.     when 0 # 普通模式
  441.       self.width=480
  442.       self.height=160
  443.       self.contents = Bitmap.new(width - 32, height - 32)
  444. #      self.x = 80
  445.       self.x = 145
  446.       if $game_temp.in_battle
  447. #        self.y = 16
  448.         self.y = 50
  449.       else
  450.         case $game_system.message_position
  451.         when 0  # 上
  452. #          self.y = 16
  453.           self.y = 50
  454.         when 1  # 中
  455.           self.y = 160
  456.         when 2  # 下
  457.           self.y = 304
  458.         end
  459.       end
  460.     when 1 # 图书模式
  461.       self.width=532
  462.       self.height=416
  463.       self.contents = Bitmap.new(width - 32, height - 32)
  464.       self.x = 54
  465.       self.y = 32
  466.     when 2 # 全屏模式
  467.       self.width=672
  468.       self.height=512
  469.       self.contents = Bitmap.new(width - 32, height - 32)
  470.       self.x = -16
  471.       self.y = -16
  472.     end
  473.     if $game_system.message_frame == 0
  474.       self.opacity = 255
  475.     else
  476.       self.opacity = 0
  477.     end
  478.     self.back_opacity = 192
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # ● 刷新画面
  482.   #--------------------------------------------------------------------------
  483.   def update
  484.     super
  485.     # 渐变的情况下
  486.     if @fade_in
  487.       # 脚本在这里设定透明度
  488.       self.contents_opacity += @op/8
  489.       if @input_number_window != nil
  490.         @input_number_window.contents_opacity += 32
  491.       end
  492.       if self.contents_opacity >= @op
  493.         @fade_in = false
  494.       end
  495.       return
  496.     end
  497.     # 输入数值的情况下
  498.     if @input_number_window != nil
  499.       @input_number_window.update
  500.       
  501. #取消-使输入框可以被取消
  502.       if Input.trigger?(Input::B)
  503.         $game_switches[44]=true
  504.         $game_system.se_play($data_system.cancel_se)
  505.         @input_number_window.dispose
  506.         @input_number_window = nil
  507.         terminate_message
  508.       end#以上为增加的功能
  509.       
  510.       # 确定
  511.       if Input.trigger?(Input::C)
  512.         $game_system.se_play($data_system.decision_se)
  513.         $game_variables[$game_temp.num_input_variable_id] =
  514.           @input_number_window.number
  515.         $game_map.need_refresh = true
  516.         # 释放输入数值窗口
  517.         @input_number_window.dispose
  518.         @input_number_window = nil
  519.         terminate_message
  520.       end
  521.       return
  522.     end
  523.     # 显示信息中的情况下
  524.     if @contents_showing
  525.       # 刷新文本
  526.       self.refresh_
  527.       # 如果不是在显示选择项中就显示暂停标志
  528.       if $game_temp.choice_max == 0
  529.         self.pause = true
  530.       end
  531.       # 取消
  532.       if Input.trigger?(Input::B)
  533.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  534.           $game_system.se_play($data_system.cancel_se)
  535.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  536.           terminate_message
  537.         end
  538.       end
  539.       # @auto_close自减计数
  540.       @auto_close-=1
  541.       # 确定或者自动关闭
  542.       if Input.trigger?(Input::C) or @auto_close==0 # @auto_close为0自动关闭,所以一开始为负数或0就不会自动关闭
  543.         # 文字还没有处理完的时候
  544.         if !@finish
  545.           # 删除所有停顿效果
  546.           @text.gsub!(/\024\[([0-9]+)\]/) { "" }
  547.           # 删除当前延迟效果
  548.           @delay = 0
  549.           # 关闭打字效果
  550.           @type_mode=-1
  551.           # 一次处理完所有的字
  552.           self.refresh_
  553.         else
  554.           # 有选择项的情况
  555.           if $game_temp.choice_max > 0
  556.             $game_system.se_play($data_system.decision_se)
  557.             $game_temp.choice_proc.call(self.index)
  558.           end
  559.           # 清空文字
  560.           terminate_message
  561.           # 在读取TXT的模式下,需要继续打开文字
  562.           if @is_read_txt
  563.             # 根据显示模式确定需要打开行数
  564.             case $game_variables[101]
  565.             when 0 # 正常模式
  566.               $game_temp.message_text =  @ts.get_text(4)
  567.             when 1 # 图书模式
  568.               $game_temp.message_text =  @ts.get_text(12)
  569.             when 2 # 全屏模式
  570.               $game_temp.message_text =  @ts.get_text(15)
  571.             end
  572.             # 如果包含[END]则退出TXT读取模式
  573.             if $game_temp.message_text.gsub!(/\[END\]/){""}!=nil
  574.               @is_read_txt=false
  575.             end
  576.           end
  577.         end
  578.       end
  579.       return
  580.     end
  581.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  582.     if @fade_out == false and !($game_temp.message_text == nil or $game_temp.message_text == "")
  583.       @contents_showing = true
  584.       $game_temp.message_window_showing = true
  585.       reset_window
  586.       refresh
  587.       Graphics.frame_reset
  588.       # 当不跳过对话时才进行淡入操作
  589.       if !@skip
  590.         self.visible = true
  591.         self.contents_opacity = 0
  592.         if @input_number_window != nil
  593.           @input_number_window.contents_opacity = 0
  594.         end
  595.         @fade_in = true
  596.       end
  597.       return
  598.     end
  599.     # 没有可以显示的信息、但是窗口为可见的情况下
  600.     if self.visible
  601.       @fade_out = true
  602.       self.opacity -= 48
  603.       if self.opacity == 0
  604.         self.visible = false
  605.         @fade_out = false
  606.         $game_temp.message_window_showing = false
  607.       end
  608.       return
  609.     end
  610.   end
  611.   #--------------------------------------------------------------------------
  612.   # ● 刷新光标矩形
  613.   #--------------------------------------------------------------------------
  614.   def update_cursor_rect
  615.     if @index >= 0
  616.       n = $game_temp.choice_start + @index
  617.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  618.     else
  619.       self.cursor_rect.empty
  620.     end
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # ● 设定字体大小
  624.   #--------------------------------------------------------------------------
  625.   def set_font_size(size=20)
  626.     # 最大字96号,再大就超过文字栏了,而且Ruby本来有限制……
  627.     if size>96
  628.       size=96
  629.     end
  630.     # 设定字的大小
  631.     self.contents.font.size = size
  632.     # 如果字太大了就要加高每行文字高度。
  633.     if size > 28
  634.       @height=size+4
  635.     else
  636.       @height=32
  637.     end
  638.   end
  639.   #--------------------------------------------------------------------------
  640.   # ● 设定文字透明
  641.   #--------------------------------------------------------------------------
  642.   def set_font_op(op=255)
  643.     # 限制透明度为0-255
  644.     if op>255
  645.       op=255
  646.     elsif op<0
  647.       op=0
  648.     end
  649.     # 这里设定文字透明是没有用的,设定透明在update过程开始
  650.     @op = op
  651.   end
  652.   #--------------------------------------------------------------------------
  653.   # ● 显示文字/头像过程
  654.   #--------------------------------------------------------------------------
  655.   def refresh_
  656.     # 处理已经结束的情况下直接return
  657.     if @finish
  658.       return
  659.     end
  660.     # 延时处理
  661.     @delay-=1
  662.     if @delay<=0
  663.       # 每次处理i个标志,这里i就设置为@type_mode了
  664.       i=@type_mode
  665.       # c 获取 1 个字 (如果不能取得文字就循环)
  666.       while ((c = @text.slice!(/./m)) != nil)
  667.         # ======================== 默认功能 ========================
  668.         # \\ 的情况下
  669.         if c == "\000"
  670.           # 还原为本来的文字
  671.           c = "\\"
  672.         end
  673.         # \C[n] 的情况下
  674.         if c == "\001"
  675.           # 取得字色编码
  676.           @text.sub!(/\[([0-9#a-zA-Z]+)\]/, "")
  677.           # 如果是设定RGB颜色
  678.           if $1[0,1]=="#"
  679.             # 先拷贝一下文字
  680.             c=$1.dup
  681.             # 分3段分别取出R,G,B颜色
  682.             c.sub!(/#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})/, "")
  683.             # 设定文字颜色
  684.             self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16),@op)
  685.             next
  686.           else
  687.             # 记录到变量 color
  688.             color = $1.to_i
  689.             # 字色0~7是有效的
  690.             if color >= 0 and color <= 7
  691.               # 设置文字颜色
  692.               self.contents.font.color = text_color(color)
  693.             end
  694.           end
  695.           # 进行下次循环
  696.           next
  697.         end
  698.         # 显示金钱窗口,这个……不用说了吧……
  699.         if c == "\002"
  700.           if @gold_window == nil
  701.             @gold_window = Window_Gold.new
  702.             @gold_window.x = 560 - @gold_window.width
  703.             if $game_temp.in_battle
  704.               @gold_window.y = 192
  705.             else
  706.               @gold_window.y = self.y >= 128 ? 32 : 384
  707.             end
  708.             @gold_window.opacity = self.opacity
  709.             @gold_window.back_opacity = self.back_opacity
  710.           end
  711.           next
  712.         end
  713.         # 另起一行文字的情况下
  714.         if c == "\n"
  715.           # 刷新选择项及光标的高
  716.           if @y >= $game_temp.choice_start
  717.             @cursor_width = [@cursor_width, @x>440 ? 448 : @x+8].max
  718.           end
  719.           # y 加 1
  720.           @y += 1
  721.           # 因为字体大小会变化,这里添加判断语句,超出就不显示了
  722.           if @y>=self.contents.height/@height
  723.             # 删除@text剩余的所有内容
  724.             @text=nil
  725.             # 然后返回
  726.             break
  727.           end
  728.           # 因为头像的缘故,这里需要改写
  729.           if @right
  730.             # 头像右边显示的时候是0
  731.             @x=0
  732.           else
  733.             # 头像靠左显示时@x要留出绘制头像空间
  734.             @x=104
  735.           end
  736.           # 移动到选择项的下一行
  737.           if @y >= $game_temp.choice_start
  738.             @x=16
  739.           end
  740.           # 下面的文字
  741.           next
  742.         end
  743.         
  744.         # ======================== 加强功能 ========================
  745.         
  746.         # 显示物品图标
  747.         if c == "\003"
  748.           # 取得物品ID
  749.           @text.sub!(/\[([0-9]+)\]/, "")
  750.           # 这里的 RPG::Cache 是高速缓存,不明白的看看帮助文档吧……
  751.           icon = RPG::Cache.icon($data_items[$1.to_i].icon_name)
  752.           # 绘制这个图标
  753. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  754. #          # 将x值增加24
  755. #          @x+=24
  756.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  757.           @x+=40
  758.           # 执行下一次循环
  759.           next
  760.         end
  761.         # 显示技能图标(因为类似物品图标显示,所以省略注释)
  762.         if c == "\004"
  763.           @text.sub!(/\[([0-9]+)\]/, "")
  764.           icon = RPG::Cache.icon($data_skills[$1.to_i].icon_name)
  765. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  766. #          # 将x值增加24
  767. #          @x+=24
  768.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  769.           @x+=40
  770.           next
  771.         end
  772.         # 显示武器图标(因为类似物品图标显示,所以省略注释)
  773.         if c == "\005"
  774.           @text.sub!(/\[([0-9]+)\]/, "")
  775.           icon = RPG::Cache.icon($data_weapons[$1.to_i].icon_name)
  776. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  777. #          # 将x值增加24
  778. #          @x+=24
  779.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  780.           @x+=40
  781.           next
  782.         end
  783.         # 显示防具图标(因为类似物品图标显示,所以省略注释)
  784.         if c == "\006"
  785.           @text.sub!(/\[([0-9]+)\]/, "")
  786.           icon = RPG::Cache.icon($data_armors[$1.to_i].icon_name)
  787. #          self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  788. #          # 将x值增加24
  789. #          @x+=24
  790.           self.contents.blt(@x+4,@y*@height+(@height-32)/2,icon,Rect.new(0, 0, 32, 32))
  791.           @x+=40
  792.           next
  793.         end
  794.         
  795.         # 等待n帧
  796.         if c == "\024"
  797.           # 取得参数(需要等待多少帧)
  798.           @text.sub!(/\[([0-9]+)\]/, "")
  799.           # 设定@delay标志
  800.           @delay = $1.to_i
  801.           # 退出此次循环
  802.           break
  803.         end
  804.         
  805.         # 显示头像
  806.         if c == "\030"
  807.           #暂时记录文字大小,用于显示完头像恢复
  808.           size=self.contents.font.size
  809.           # 设定为正常的20号字
  810.           self.contents.font.size=20
  811.           # 设定系统字色,为写名字做准备的
  812.           self.contents.font.color = system_color
  813.           # 取得"[]"内的字符并从原字串中删除这一部分
  814.           @text.sub!(/\[([0-9]+)\]/, "")
  815.           # 记录到head变量
  816.           head=$1
  817.           # 判断头像和原来的是不是一样的
  818.           if @face == nil
  819.             # 不一样
  820.             if @head_file != head
  821.               # 改变成现在的头像文件名
  822.               @head_file = head
  823.               # 不一样的话再重新载入头像
  824.               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
  825.             end
  826.           else
  827.             # 当表情不是空的时候需要考虑表情的
  828.             if @head_file != head + "_" + @face
  829.               # 改变成现在的头像文件名
  830.               @head_file = head + "_" + @face
  831.               # 不一样的话再重新载入头像
  832.               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
  833.             end
  834.           end
  835.           # 显示头像,分左右两种情况
  836.           if @right
  837.             # 绘制头像图片
  838.             self.contents.blt(348,0,@head_bmp,Rect.new(0,0,100,100))
  839.             # 显示角色姓名
  840.             if @name==nil
  841.               # 取得角色姓名到变量 c
  842.               c = $game_actors[head.to_i].name
  843.               # 描绘角色的姓名
  844.               self.contents.draw_text(348,104,100,24,c,1)
  845.             else
  846.               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
  847.               c = @name
  848.               # 描绘角色的姓名
  849.               self.contents.draw_text(348,104,100,24,c,1)
  850.             end
  851.           else
  852.             # 绘制头像图片
  853.             self.contents.blt(0,0,@head_bmp,Rect.new(0,0,100,100))
  854.             # 显示角色姓名
  855.             if @name==nil
  856.               # 取得角色姓名到变量 c
  857.               c = $game_actors[head.to_i].name
  858.               # 描绘角色的姓名
  859.               self.contents.draw_text(0,104,100,24,c,1)
  860.             else
  861.               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
  862.               c = @name
  863.               # 描绘角色的姓名
  864.               self.contents.draw_text(0,104,100,24,c,1)
  865.             end
  866.           end
  867.           # 恢复默认字色
  868.           self.contents.font.color = normal_color
  869.           # 恢复字体大小
  870.           self.contents.font.size=size
  871.           # 进行下一次循环
  872.           next
  873.         end
  874.         
  875.         # ======================== 以上加强部分 ========================
  876.         
  877.         # 描绘文字
  878.         self.contents.draw_text(4+@x,@height*@y, @height, @height, c)
  879.         # x 为描绘文字宽度进行自增运算,计算下一个文字起始位置
  880.         @x += self.contents.text_size(c).width
  881.         
  882.         # 操作了@type_mode个字符后就退出循环了,@type_mode为负则操作一次完成
  883.         i-=1
  884.         if i==0
  885.           break
  886.         end
  887.       
  888.       end
  889.     end
  890.     # 如果@text处理结束了,就设置结束标志
  891.     if @text==nil or @text==""
  892.       @finish=true
  893.     end
  894.   end
  895. end
  896. #以下为对话加强
  897. #==============================================================================
  898. # ■ Window_Frame (枠だけで中身の無いウィンドウ)
  899. #==============================================================================
  900. class Window_Frame < Window_Base
  901.   #--------------------------------------------------------------------------
  902.   # ● オブジェクト初期化
  903.   #--------------------------------------------------------------------------
  904.   def initialize(x, y, width, height)
  905.     super(x, y, width, height)
  906.     self.contents = nil
  907.     self.back_opacity =200
  908.   end
  909.   #--------------------------------------------------------------------------
  910.   # ● 解放
  911.   #--------------------------------------------------------------------------
  912.   def dispose
  913.     super
  914.     end
  915.   end
  916. #==============================================================================
  917. # ■ Air_Text (何も無いところに文字描写 = 枠の無い瞬間表示メッセージウィンドウ)
  918. #==============================================================================
  919. class Air_Text < Window_Base
  920.   #--------------------------------------------------------------------------
  921.   # ● オブジェクト初期化
  922.   #--------------------------------------------------------------------------
  923.   def initialize(x, y, designate_text)
  924.     super(x-16, y-16, 32 + designate_text.size * 12, 56)
  925.     self.opacity = 0
  926.     self.back_opacity = 0
  927.     self.contents = Bitmap.new(self.width - 32, self.height - 32)
  928.     w = self.contents.width
  929.     h = self.contents.height
  930.     self.contents.draw_text(0, 0, w, h, designate_text)
  931.   end
  932.   #--------------------------------------------------------------------------
  933.   # ● 解放
  934.   #--------------------------------------------------------------------------
  935.   def dispose
  936.     self.contents.clear
  937.     super
  938.   end
  939. end
  940. #以上为对话加强
复制代码

评分

参与人数 1星屑 +200 收起 理由
hcm + 200 感谢回答

查看全部评分

回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
107 小时
注册时间
2012-5-1
帖子
45
3
 楼主| 发表于 2012-5-21 21:52:54 | 只看该作者
代码太长了,懒得找,请问设置变量的在哪?直接就可以显示吗(使用时要加脚本吗)?

点评

脚本插入Main之前,使用时按照本脚本前面的说明  发表于 2012-5-21 22:11
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
27 小时
注册时间
2007-1-6
帖子
50
4
发表于 2012-5-21 22:11:50 | 只看该作者
hys111111 发表于 2012-5-21 19:01
103号变量就是打字效果,设置为多少就是一秒打多少个字,设置为0打字效果关闭 ...

Oksh 改过的能不能用在别的游戏里阿

点评

能  发表于 2012-5-22 12:33
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
107 小时
注册时间
2012-5-1
帖子
45
5
 楼主| 发表于 2012-5-22 05:15:04 | 只看该作者
不能用,有很多关于魔塔的,很多变量我都占用了,一个一个改太麻烦
回复

使用道具 举报

Lv3.寻梦者

双子人

梦石
0
星屑
3175
在线时间
3617 小时
注册时间
2009-4-4
帖子
4154

开拓者

6
发表于 2012-5-22 13:58:01 | 只看该作者
zsybh1 发表于 2012-5-21 21:52
代码太长了,懒得找,请问设置变量的在哪?直接就可以显示吗(使用时要加脚本吗)? ...

152行、154行和580行分别设置3个变量
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
49
在线时间
107 小时
注册时间
2012-5-1
帖子
45
7
 楼主| 发表于 2012-5-22 15:25:13 | 只看该作者
有脚本错误
回复

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
27 小时
注册时间
2007-1-6
帖子
50
8
发表于 2012-5-22 21:08:08 | 只看该作者
建议 LZ 搜索下作者留下来的信息,例如“显示文章的信息窗口加强”
回复

使用道具 举报

Lv2.观梦者

梦石
0
星屑
687
在线时间
791 小时
注册时间
2011-10-20
帖子
2394

开拓者

9
发表于 2012-5-22 22:48:07 | 只看该作者
数据!
new = 数据.scan(/./)
new.size.times{|i|print new[i]}
打印出数据啦!
欢迎点此进入我的egames.wink.ws,有RMQQ堂等

[url=http://rpg.blue/thread-317273-1-1.html]短篇八-赶选

http://yun.baidu.com/share/link?shareid=2158225779&uk=169642147&third=0


历险ARPG赢回你的疆域新的战斗模式?…………点击这里:[宋乱贼狂 for QQ堂]
http://rpg.blue/group-368-1.html
programing ....?
[url=http://rpg.blue/thrd-234658-1-1.html]
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-23 13:24

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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