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

Project1

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

[已经解决] 厄,文字显示方面

[复制链接]
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2010-9-30
帖子
6
跳转到指定楼层
1
发表于 2010-10-2 17:15:39 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽

Lv3.寻梦者

梦石
3
星屑
50
在线时间
762 小时
注册时间
2010-8-17
帖子
681
2
发表于 2010-10-2 17:21:07 | 只看该作者
或许你可以用任务系统做出这种效果……我就做过,不知合不合适?
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
85
在线时间
578 小时
注册时间
2010-6-29
帖子
365
3
发表于 2010-10-2 19:47:45 | 只看该作者
:L楼主说的是6R中文图书馆吧
为了四公主苦逼赚钱中。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
29 小时
注册时间
2010-7-5
帖子
483
4
发表于 2010-10-2 19:51:59 | 只看该作者
1.6r中文图书馆
2.用下面脚本覆盖window.message,打开51号开关就可以显示很长的文章。
用\~加在文章后面使文章连贯
  1. #==============================================================================
  2. # ◎ GPRA_Window_Message
  3. #------------------------------------------------------------------------------
  4. # ◎ 显示文章的信息窗口加强。
  5. #------------------------------------------------------------------------------
  6. # 制作者:绿梨子红苹果
  7. # 个人主页:vbgm.9126.com
  8. # E-Mail:[email protected]
  9. # QQ:42378361
  10. #==============================================================================

  11. class Window_Message < Window_Selectable
  12.   #--------------------------------------------------------------------------
  13.   # ● 初始化状态
  14.   #--------------------------------------------------------------------------
  15.   def initialize
  16.     super(80, 304, 480, 160)
  17.     self.contents = Bitmap.new(width - 32, height - 32)
  18.     self.visible = false
  19.     self.z = 9998
  20.     @fade_in = false
  21.     @fade_out = false
  22.     @contents_showing = false
  23.     @cursor_width = 0
  24.     @op = 255 # 不透明度
  25.     @head_bmp = nil # 装载头像用
  26.     @head_file = nil # 头像文件名
  27.     @text = nil # 记录所处理文字
  28.     @skip = false # 记录是否跳过此次对话
  29.     @auto_close = -1 # 默认不打开自动关闭
  30.     @type_mode=-1 # 打字模式
  31.     @delay=-1 # 等待n帧标志
  32.     @finish=false # 记录文字处理是否结束
  33.     @ts = TextStream.new # 创建一个新的TXT读取流
  34.     @is_read_txt =false # 默认不是在读取txt文件
  35.     self.active = false
  36.     self.index = -1
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 释放
  40.   #--------------------------------------------------------------------------
  41.   def dispose
  42.     terminate_message
  43.     $game_temp.message_window_showing = false
  44.     if @input_number_window != nil
  45.       @input_number_window.dispose
  46.     end
  47.     super
  48.   end
  49.   #--------------------------------------------------------------------------
  50.   # ● 处理信息结束
  51.   #--------------------------------------------------------------------------
  52.   def terminate_message
  53.     self.active = false
  54.     self.pause = false
  55.     self.index = -1
  56.     self.contents.clear
  57.     # 清除显示中标志
  58.     @contents_showing = false
  59.     # 呼叫信息调用
  60.     if $game_temp.message_proc != nil
  61.       $game_temp.message_proc.call
  62.     end
  63.     # 清除文章、选择项、输入数值的相关变量
  64.     $game_temp.message_text = nil
  65.     $game_temp.message_proc = nil
  66.     $game_temp.choice_start = 99
  67.     $game_temp.choice_max = 0
  68.     $game_temp.choice_cancel_type = 0
  69.     $game_temp.choice_proc = nil
  70.     $game_temp.num_input_start = 99
  71.     $game_temp.num_input_variable_id = 0
  72.     $game_temp.num_input_digits_max = 0
  73.     # 开放金钱窗口
  74.     if @gold_window != nil
  75.       @gold_window.dispose
  76.       @gold_window = nil
  77.     end
  78.   end
  79.   #--------------------------------------------------------------------------
  80.   # ● 刷新
  81.   #--------------------------------------------------------------------------
  82.   def refresh
  83.     # 清空原先内容
  84.     self.contents.clear
  85.     # 恢复一般字色
  86.     self.contents.font.color = normal_color
  87.     # 恢复字体大小
  88.     self.contents.font.size = 20
  89.     # 绘制文字位置初始化
  90.     @x = @y = 0
  91.     # 字体高度记录
  92.     @height = 32
  93.     # 文字不透明度设定为255
  94.     @op = 255
  95.     # 头像默认显示在右边
  96.     @right = true
  97.     # 头像默认显示一般表情
  98.     @face = nil
  99.     # 默认显示角色姓名
  100.     @name = nil
  101.     # 默认不跳过此次对话
  102.     @skip = false
  103.     # 从变量读取自动关闭设置
  104.     @auto_close = $game_variables[52]
  105.     # 从变量读取打字模式设置
  106.     @type_mode=$game_variables[53]
  107.     # 默认不等待
  108.     @delay=-1
  109.     # 设定文字没有处理结束
  110.     @finish=false
  111.     # 光标宽度初始化为零
  112.     @cursor_width = 0
  113.     # 到选择项的下一行字
  114.     if $game_temp.choice_start == 0
  115.       @x = 16
  116.     end
  117.     # 有等待显示的文字的情况下
  118.     # (注:因为一旦文字非空就处理,所以可以设定 $game_temp.message_text 达到显示文章的效果)
  119.     if $game_temp.message_text != nil
  120.       # @text 功能改进
  121.       if @text==nil or @text==""
  122.         @text = $game_temp.message_text.dup
  123.       else
  124.         @text = @text + $game_temp.message_text
  125.       end
  126.       
  127.       # 最先必须要将 "\\\\" 变换为 "\000"
  128.       @text.gsub!(/\\\\/)                { "\000" }
  129.       
  130.       # 在TXT模式还没有打开的时候
  131.       if !@is_read_txt
  132.         # TXT读取模式打开
  133.         if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]\[(\w+)\]/)!=nil
  134.           # 打开文件,成功打开后再进入后面部分
  135.           if @ts.open($1,$2)
  136.             # 根据显示模式确定需要打开行数
  137.             case $game_variables[51]
  138.             when 0 # 正常模式
  139.               @text =  @ts.get_text(4)
  140.             when 1 # 图书模式
  141.               @text =  @ts.get_text(12)
  142.             when 2 # 全屏模式
  143.               @text =  @ts.get_text(1)
  144.             when 3 # 下方对话
  145.               @text =  @ts.get_text(1)
  146.             end
  147.             # 如果包含[END]
  148.             if @text.gsub!(/\[END\]/){""}!=nil
  149.               #退出TXT读取模式
  150.               @is_read_txt=false
  151.             else
  152.               #否则设置正在读取标志
  153.               @is_read_txt=true
  154.             end
  155.           end
  156.         else
  157.           if @text.slice!(/\\[Tt][Xx][Tt]\[(\w+)\]/)!=nil
  158.             # 打开文件,成功打开后再进入后面部分
  159.             if @ts.open($1,"")
  160.               # 根据显示模式确定需要打开行数
  161.               case $game_variables[51]
  162.               when 0 # 正常模式
  163.                 @text =  @ts.get_text(4)
  164.               when 1 # 图书模式
  165.                 @text =  @ts.get_text(12)
  166.               when 2 # 全屏模式
  167.                 @text =  @ts.get_text(1)
  168.               when 3 # 下方对话
  169.                 @text =  @ts.get_text(1)
  170.               end
  171.               # 如果包含[END]
  172.               if @text.gsub!(/\[END\]/){""}!=nil
  173.                 #退出TXT读取模式
  174.                 @is_read_txt=false
  175.               else
  176.                 #否则设置正在读取标志
  177.                 @is_read_txt=true
  178.               end
  179.             end
  180.           end
  181.         end
  182.       end
  183.         
  184.       # 如果取得的字符含"\\~"时
  185.       if @text.slice!(/\\~/)!=nil
  186.         # 跳过此次对话
  187.         terminate_message
  188.         # 设置跳过此次对话标志
  189.         @skip = true
  190.         # 直接返回等待连接后面部分
  191.         return
  192.       end
  193.       
  194.       # 限制文字处理(注:这里是默认功能。)
  195.       begin
  196.         last_text = @text.clone
  197.         @text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  198.       end until @text == last_text
  199.       @text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  200.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  201.       end
  202.       #(注:后面将单个字符循环判断,所以这里将控制符全部换成单个字符)
  203.       # 为了方便将 "\\C" 变为 "\001"
  204.       @text.gsub!(/\\[Cc]\[([0-9#a-zA-Z]+)\]/)  { "\001[#{$1}]" }
  205.       # "\\G" 变为 "\002"
  206.       @text.gsub!(/\\[Gg]/)              { "\002" }
  207.       
  208.       # ========================增强功能========================
  209.       
  210.       # "\\/" 删除行尾换行符号
  211.       @text.gsub!(/\\\/\n/) {""}
  212.       # 去掉不在行尾的"\\/"符号,防止出错
  213.       @text.gsub!(/\\\//) {""}
  214.       
  215.       # "\\I" 物品图标+名称显示
  216.       @text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\003[#{$1}]"+$data_items[$1.to_i].name }
  217.       # "\\K" 技能图标+名称显示
  218.       @text.gsub!(/\\[Kk]\[([0-9]+)\]/) { "\004[#{$1}]"+$data_skills[$1.to_i].name }
  219.       # "\\W" 武器图标+名称显示
  220.       @text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\005[#{$1}]"+$data_weapons[$1.to_i].name }
  221.       # "\\A" 防具图标+名称显示
  222.       @text.gsub!(/\\[Dd]\[([0-9]+)\]/) { "\006[#{$1}]"+$data_armors[$1.to_i].name }
  223.       
  224.       # 注:大量显示图片将是游戏的速度大大减慢
  225.       # "\\I1" 物品图标显示
  226.       @text.gsub!(/\\[Ii]1\[([0-9]+)\]/) { "\003[#{$1}]" }
  227.       # "\\K1" 技能图标显示
  228.       @text.gsub!(/\\[Kk]1\[([0-9]+)\]/) { "\004[#{$1}]" }
  229.       # "\\W1" 武器图标显示
  230.       @text.gsub!(/\\[Ww]1\[([0-9]+)\]/) { "\005[#{$1}]" }
  231.       # "\\A1" 防具图标显示
  232.       @text.gsub!(/\\[Dd]1\[([0-9]+)\]/) { "\006[#{$1}]" }
  233.       
  234.       # "\\I2" 物品名称显示
  235.       @text.gsub!(/\\[Ii]2\[([0-9]+)\]/) { $data_items[$1.to_i].name }
  236.       # "\\K2" 技能名称显示
  237.       @text.gsub!(/\\[Kk]2\[([0-9]+)\]/) { $data_skills[$1.to_i].name }
  238.       # "\\W2" 武器名称显示
  239.       @text.gsub!(/\\[Ww]2\[([0-9]+)\]/) { $data_weapons[$1.to_i].name }
  240.       # "\\A2" 防具名称显示
  241.       @text.gsub!(/\\[Dd]2\[([0-9]+)\]/) { $data_armors[$1.to_i].name }
  242.       
  243.       # "\\S" 字体大小(只修改第一个"\\S")
  244.       # 这里首先删掉能找到的第一个"\\S"
  245.       if @text.slice!(/\\[Ss]\[([0-9]+)\]/)!=nil
  246.         # 当找了"\\S"时满足上述条件,就设置文字大小
  247.         self.set_font_size($1.to_i)
  248.       end
  249.       # "\\O" 文字透明度(使用注意同上,模拟声音变小……)
  250.       if @text.slice!(/\\[Oo]\[([0-9]+)\]/)!=nil
  251.         self.set_font_op($1.to_i)
  252.       end

  253.       # "\\=" 停顿固定帧(延时)
  254.       @text.gsub!(/\\=\[([0-9]+)\]/)    { "\024[#{$1}]" }
  255.       # "\\." 停顿3帧
  256.       @text.gsub!(/\\\./)               { "\024[3]" }
  257.       # "\\_" 停顿1秒(30帧)
  258.       @text.gsub!(/\\_/)                { "\024[30]" }
  259.       
  260.       # "\\L" 指定头像左边显示
  261.       if @text.slice!(/\\[Ll]/)!=nil
  262.         # 设定头像居右标志为假
  263.         @right=false
  264.         # 顺便要设置@x=104,文字在右边显示
  265.         @x=104
  266.       end
  267.       # "\\X" 指定不要显示姓名,带参数就是指定显示姓名(可内部使用"\\N[]")
  268.       # 首先是寻找有没有带参数的"\\X"
  269.       if @text.slice!(/\\[Xx]\[(\w+)\]/)!=nil
  270.         # 找到的话将参数赋予@name
  271.         @name=$1
  272.       # 没有找到的话
  273.       else
  274.         # 再去寻找有没有不带参数的"\\X"
  275.         if @text.slice!(/\\[Xx]/)!=nil
  276.           # 找到的话就将姓名变成"???"
  277.           @name="???"
  278.         end
  279.       end
  280.       # "\\F" 指定表情(Face 用来指定表情啦)
  281.       # 这里"\w"表示匹配字母+数字还有下划线,同样支持中文
  282.       if @text.slice!(/\\[Ff]\[(\w+)\]/)!=nil
  283.         # 找到的话就设定表情
  284.         @face=$1
  285.       end
  286.       # "\\H" 显示头像(不明白大家为什么都喜欢用 Face 表示头像……)
  287.       # 这里我将把显示头像放到字串的最前面,因为头像应该先显示出来
  288.       if @text.slice!(/\\[Hh]\[([0-9]+)\]/)!=nil
  289.         # 找到的话就提到字符串最前面
  290.         @text="\030[#{$1}]"+@text
  291.       end
  292.       
  293.       # ================ 分析部分结束,下面是显示部分 ================
  294.    
  295.       # 在此调用过程完成,因为在update部分也会有相同代码
  296.       self.refresh_

  297.     end
  298.     # 选择项的情况
  299.     if $game_temp.choice_max > 0
  300.       @item_max = $game_temp.choice_max
  301.       self.active = true
  302.       self.index = 0
  303.     end
  304.     # 输入数值的情况
  305.     if $game_temp.num_input_variable_id > 0
  306.       digits_max = $game_temp.num_input_digits_max
  307.       number = $game_variables[$game_temp.num_input_variable_id]
  308.       @input_number_window = Window_InputNumber.new(digits_max)
  309.       @input_number_window.number = number
  310.       @input_number_window.x = self.x + 8
  311.       @input_number_window.y = self.y + $game_temp.num_input_start * 32
  312.     end
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ● 设置窗口位置与不透明度
  316.   #--------------------------------------------------------------------------
  317.   def reset_window
  318.     # 判断现在的显示模式
  319.     case $game_variables[51]
  320.     when 0 # 普通模式
  321.       self.width=480
  322.       self.height=160
  323.       self.contents = Bitmap.new(width - 32, height - 32)
  324.       self.x = 80
  325.       if $game_temp.in_battle
  326.         self.y = 16
  327.       else
  328.         case $game_system.message_position
  329.         when 0  # 上
  330.           self.y = 16
  331.         when 1  # 中
  332.           self.y = 160
  333.         when 2  # 下
  334.           self.y = 304
  335.         end
  336.       end
  337.     when 1 # 图书模式
  338.       self.width=532
  339.       self.height=416
  340.       self.contents = Bitmap.new(width - 32, height - 32)
  341.       self.x = 54
  342.       self.y = 32
  343.     when 2 # 全屏模式
  344.       self.width=360
  345.       self.height=64
  346.       self.contents = Bitmap.new(width - 32, height - 32)
  347.       self.x = 160
  348.       self.y = 100
  349.     when 3 #下方显示
  350.       self.width=400
  351.       self.height=64
  352.       self.contents = Bitmap.new(width - 32, height - 32)
  353.       self.x = 120
  354.       self.y = 410
  355.     end
  356.     if $game_system.message_frame == 0
  357.       self.opacity = 255
  358.     else
  359.       self.opacity = 0
  360.     end
  361.     self.back_opacity = 192
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ● 刷新画面
  365.   #--------------------------------------------------------------------------
  366.   def update
  367.     super
  368.     # 渐变的情况下
  369.     if @fade_in
  370.       # 脚本在这里设定透明度
  371.       self.contents_opacity += @op/8
  372.       if @input_number_window != nil
  373.         @input_number_window.contents_opacity += 32
  374.       end
  375.       if self.contents_opacity >= @op
  376.         @fade_in = false
  377.       end
  378.       return
  379.     end
  380.     # 输入数值的情况下
  381.     if @input_number_window != nil
  382.       @input_number_window.update
  383.       # 确定
  384.       if Input.trigger?(Input::C)
  385.         $game_system.se_play($data_system.decision_se)
  386.         $game_variables[$game_temp.num_input_variable_id] =
  387.           @input_number_window.number
  388.         $game_map.need_refresh = true
  389.         # 释放输入数值窗口
  390.         @input_number_window.dispose
  391.         @input_number_window = nil
  392.         terminate_message
  393.       end
  394.       return
  395.     end
  396.     # 显示信息中的情况下
  397.     if @contents_showing
  398.       # 刷新文本
  399.       self.refresh_
  400.       # 如果不是在显示选择项中就显示暂停标志
  401.       if $game_temp.choice_max == 0
  402.         self.pause = true
  403.       end
  404.       # 取消
  405.       if Input.trigger?(Input::B)
  406.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  407.           $game_system.se_play($data_system.cancel_se)
  408.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  409.           terminate_message
  410.         end
  411.       end
  412.       # @auto_close自减计数
  413.       @auto_close-=1
  414.       # 确定或者自动关闭
  415.       if Input.trigger?(Input::C) or @auto_close==0 # @auto_close为0自动关闭,所以一开始为负数或0就不会自动关闭
  416.         # 文字还没有处理完的时候
  417.         if !@finish
  418.           # 删除所有停顿效果
  419.           @text.gsub!(/\024\[([0-9]+)\]/) { "" }
  420.           # 删除当前延迟效果
  421.           @delay = 0
  422.           # 关闭打字效果
  423.           @type_mode=-1
  424.           # 一次处理完所有的字
  425.           self.refresh_
  426.         else
  427.           # 有选择项的情况
  428.           if $game_temp.choice_max > 0
  429.             $game_system.se_play($data_system.decision_se)
  430.             $game_temp.choice_proc.call(self.index)
  431.           end
  432.           # 清空文字
  433.           terminate_message
  434.           # 在读取TXT的模式下,需要继续打开文字
  435.           if @is_read_txt
  436.             # 根据显示模式确定需要打开行数
  437.             case $game_variables[51]
  438.             when 0 # 正常模式
  439.               $game_temp.message_text =  @ts.get_text(4)
  440.             when 1 # 图书模式
  441.               $game_temp.message_text =  @ts.get_text(12)
  442.             when 2 # 全屏模式
  443.               $game_temp.message_text =  @ts.get_text(1)
  444.             when 3 # 下方显示
  445.               $game_temp.message_text =  @ts.get_text(1)
  446.             end
  447.             # 如果包含[END]则退出TXT读取模式
  448.             if $game_temp.message_text.gsub!(/\[END\]/){""}!=nil
  449.               @is_read_txt=false
  450.             end
  451.           end
  452.         end
  453.       end
  454.       return
  455.     end
  456.     # 在渐变以外的状态下有等待显示的信息与选择项的场合
  457.     if @fade_out == false and !($game_temp.message_text == nil or $game_temp.message_text == "")
  458.       @contents_showing = true
  459.       $game_temp.message_window_showing = true
  460.       reset_window
  461.       refresh
  462.       Graphics.frame_reset
  463.       # 当不跳过对话时才进行淡入操作
  464.       if !@skip
  465.         self.visible = true
  466.         self.contents_opacity = 0
  467.         if @input_number_window != nil
  468.           @input_number_window.contents_opacity = 0
  469.         end
  470.         @fade_in = true
  471.       end
  472.       return
  473.     end
  474.     # 没有可以显示的信息、但是窗口为可见的情况下
  475.     if self.visible
  476.       @fade_out = true
  477.       self.opacity -= 48
  478.       if self.opacity == 0
  479.         self.visible = false
  480.         @fade_out = false
  481.         $game_temp.message_window_showing = false
  482.       end
  483.       return
  484.     end
  485.   end
  486.   #--------------------------------------------------------------------------
  487.   # ● 刷新光标矩形
  488.   #--------------------------------------------------------------------------
  489.   def update_cursor_rect
  490.     if @index >= 0
  491.       n = $game_temp.choice_start + @index
  492.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  493.     else
  494.       self.cursor_rect.empty
  495.     end
  496.   end
  497.   #--------------------------------------------------------------------------
  498.   # ● 设定字体大小
  499.   #--------------------------------------------------------------------------
  500.   def set_font_size(size=20)
  501.     # 最大字96号,再大就超过文字栏了,而且Ruby本来有限制……
  502.     if size>96
  503.       size=96
  504.     end
  505.     # 设定字的大小
  506.     self.contents.font.size = size
  507.     # 如果字太大了就要加高每行文字高度。
  508.     if size > 28
  509.       @height=size+4
  510.     else
  511.       @height=32
  512.     end
  513.   end
  514.   #--------------------------------------------------------------------------
  515.   # ● 设定文字透明
  516.   #--------------------------------------------------------------------------
  517.   def set_font_op(op=255)
  518.     # 限制透明度为0-255
  519.     if op>255
  520.       op=255
  521.     elsif op<0
  522.       op=0
  523.     end
  524.     # 这里设定文字透明是没有用的,设定透明在update过程开始
  525.     @op = op
  526.   end
  527.   #--------------------------------------------------------------------------
  528.   # ● 显示文字/头像过程
  529.   #--------------------------------------------------------------------------
  530.   def refresh_
  531.     # 处理已经结束的情况下直接return
  532.     if @finish
  533.       return
  534.     end
  535.     # 延时处理
  536.     @delay-=1
  537.     if @delay<=0
  538.       # 每次处理i个标志,这里i就设置为@type_mode了
  539.       i=@type_mode
  540.       # c 获取 1 个字 (如果不能取得文字就循环)
  541.       while ((c = @text.slice!(/./m)) != nil)
  542.         # ======================== 默认功能 ========================
  543.         # \\ 的情况下
  544.         if c == "\000"
  545.           # 还原为本来的文字
  546.           c = "\\"
  547.         end
  548.         # \C[n] 的情况下
  549.         if c == "\001"
  550.           # 取得字色编码
  551.           @text.sub!(/\[([0-9#a-zA-Z]+)\]/, "")
  552.           # 如果是设定RGB颜色
  553.           if $1[0,1]=="#"
  554.             # 先拷贝一下文字
  555.             c=$1.dup
  556.             # 分3段分别取出R,G,B颜色
  557.             c.sub!(/#([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})([0-9A-Fa-f]{2})/, "")
  558.             # 设定文字颜色
  559.             self.contents.font.color = Color.new($1.to_i(16), $2.to_i(16), $3.to_i(16),@op)
  560.             next
  561.           else
  562.             # 记录到变量 color
  563.             color = $1.to_i
  564.             # 字色0~7是有效的
  565.             if color >= 0 and color <= 7
  566.               # 设置文字颜色
  567.               self.contents.font.color = text_color(color)
  568.             end
  569.           end
  570.           # 进行下次循环
  571.           next
  572.         end
  573.         # 显示金钱窗口,这个……不用说了吧……
  574.         if c == "\002"
  575.           if @gold_window == nil
  576.             @gold_window = Window_Gold.new
  577.             @gold_window.x = 560 - @gold_window.width
  578.             if $game_temp.in_battle
  579.               @gold_window.y = 192
  580.             else
  581.               @gold_window.y = self.y >= 128 ? 32 : 384
  582.             end
  583.             @gold_window.opacity = self.opacity
  584.             @gold_window.back_opacity = self.back_opacity
  585.           end
  586.           next
  587.         end
  588.         # 另起一行文字的情况下
  589.         if c == "\n"
  590.           # 刷新选择项及光标的高
  591.           if @y >= $game_temp.choice_start
  592.             @cursor_width = [@cursor_width, @x>440 ? 448 : @x+8].max
  593.           end
  594.           # y 加 1
  595.           @y += 1
  596.           # 因为字体大小会变化,这里添加判断语句,超出就不显示了
  597.           if @y>=self.contents.height/@height
  598.             # 删除@text剩余的所有内容
  599.             @text=nil
  600.             # 然后返回
  601.             break
  602.           end
  603.           # 因为头像的缘故,这里需要改写
  604.           if @right
  605.             # 头像右边显示的时候是0
  606.             @x=0
  607.           else
  608.             # 头像靠左显示时@x要留出绘制头像空间
  609.             @x=104
  610.           end
  611.           # 移动到选择项的下一行
  612.           if @y >= $game_temp.choice_start
  613.             @x=16
  614.           end
  615.           # 下面的文字
  616.           next
  617.         end
  618.         
  619.         # ======================== 加强功能 ========================
  620.         
  621.         # 显示物品图标
  622.         if c == "\003"
  623.           # 取得物品ID
  624.           @text.sub!(/\[([0-9]+)\]/, "")
  625.           # 这里的 RPG::Cache 是高速缓存,不明白的看看帮助文档吧……
  626.           icon = RPG::Cache.icon($data_items[$1.to_i].icon_name)
  627.           # 绘制这个图标
  628.           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  629.           # 将x值增加24
  630.           @x+=24
  631.           # 执行下一次循环
  632.           next
  633.         end
  634.         # 显示技能图标(因为类似物品图标显示,所以省略注释)
  635.         if c == "\004"
  636.           @text.sub!(/\[([0-9]+)\]/, "")
  637.           icon = RPG::Cache.icon($data_skills[$1.to_i].icon_name)
  638.           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  639.           @x+=24
  640.           next
  641.         end
  642.         # 显示武器图标(因为类似物品图标显示,所以省略注释)
  643.         if c == "\005"
  644.           @text.sub!(/\[([0-9]+)\]/, "")
  645.           icon = RPG::Cache.icon($data_weapons[$1.to_i].icon_name)
  646.           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  647.           @x+=24
  648.           next
  649.         end
  650.         # 显示防具图标(因为类似物品图标显示,所以省略注释)
  651.         if c == "\006"
  652.           @text.sub!(/\[([0-9]+)\]/, "")
  653.           icon = RPG::Cache.icon($data_armors[$1.to_i].icon_name)
  654.           self.contents.blt(@x+4,@y*@height+(@height-24)/2,icon,Rect.new(0, 0, 24, 24))
  655.           @x+=24
  656.           next
  657.         end
  658.         
  659.         # 等待n帧
  660.         if c == "\024"
  661.           # 取得参数(需要等待多少帧)
  662.           @text.sub!(/\[([0-9]+)\]/, "")
  663.           # 设定@delay标志
  664.           @delay = $1.to_i
  665.           # 退出此次循环
  666.           break
  667.         end
  668.         
  669.         # 显示头像
  670.         if c == "\030"
  671.           #暂时记录文字大小,用于显示完头像恢复
  672.           size=self.contents.font.size
  673.           # 设定为正常的20号字
  674.           self.contents.font.size=20
  675.           # 设定系统字色,为写名字做准备的
  676.           self.contents.font.color = system_color
  677.           # 取得"[]"内的字符并从原字串中删除这一部分
  678.           @text.sub!(/\[([0-9]+)\]/, "")
  679.           # 记录到head变量
  680.           head=$1
  681.           # 判断头像和原来的是不是一样的
  682.           if @face == nil
  683.             # 不一样
  684.             if @head_file != head
  685.               # 改变成现在的头像文件名
  686.               @head_file = head
  687.               # 不一样的话再重新载入头像
  688.               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
  689.             end
  690.           else
  691.             # 当表情不是空的时候需要考虑表情的
  692.             if @head_file != head + "_" + @face
  693.               # 改变成现在的头像文件名
  694.               @head_file = head + "_" + @face
  695.               # 不一样的话再重新载入头像
  696.               @head_bmp=RPG::Cache.character("head/gpra_"+@head_file, 0)
  697.             end
  698.           end
  699.           # 显示头像,分左右两种情况
  700.           if @right
  701.             # 绘制头像图片
  702.             self.contents.blt(348,0,@head_bmp,Rect.new(0,0,100,100))
  703.             # 显示角色姓名
  704.             if @name==nil
  705.               # 取得角色姓名到变量 c
  706.               c = $game_actors[head.to_i].name
  707.               # 描绘角色的姓名
  708.               self.contents.draw_text(348,104,100,24,c,1)
  709.             else
  710.               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
  711.               c = @name
  712.               # 描绘角色的姓名
  713.               self.contents.draw_text(348,104,100,24,c,1)
  714.             end
  715.           else
  716.             # 绘制头像图片
  717.             self.contents.blt(0,0,@head_bmp,Rect.new(0,0,100,100))
  718.             # 显示角色姓名
  719.             if @name==nil
  720.               # 取得角色姓名到变量 c
  721.               c = $game_actors[head.to_i].name
  722.               # 描绘角色的姓名
  723.               self.contents.draw_text(0,104,100,24,c,1)
  724.             else
  725.               # 取得"???"到变量 c,当然这个"???"可以改为其他的默认值
  726.               c = @name
  727.               # 描绘角色的姓名
  728.               self.contents.draw_text(0,104,100,24,c,1)
  729.             end
  730.           end
  731.           # 恢复默认字色
  732.           self.contents.font.color = normal_color
  733.           # 恢复字体大小
  734.           self.contents.font.size=size
  735.           # 进行下一次循环
  736.           next
  737.         end
  738.         
  739.         # ======================== 以上加强部分 ========================
  740.         
  741.         # 描绘文字
  742.         self.contents.draw_text(4+@x,@height*@y, @height, @height, c)
  743.         # x 为描绘文字宽度进行自增运算,计算下一个文字起始位置
  744.         @x += self.contents.text_size(c).width
  745.         
  746.         # 操作了@type_mode个字符后就退出循环了,@type_mode为负则操作一次完成
  747.         i-=1
  748.         if i==0
  749.           break
  750.         end
  751.       
  752.       end
  753.     end
  754.     # 如果@text处理结束了,就设置结束标志
  755.     if @text==nil or @text==""
  756.       @finish=true
  757.     end
  758.   end
  759. end
复制代码

评分

参与人数 1星屑 +200 收起 理由
IamI + 200 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
0 小时
注册时间
2010-9-30
帖子
6
5
 楼主| 发表于 2010-10-3 13:22:09 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-23 04:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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