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

Project1

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

修改换行符\n后,选择项不会换行了,怎么改?

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
60
在线时间
9 小时
注册时间
2006-9-7
帖子
303
跳转到指定楼层
1
发表于 2009-2-1 22:45:28 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x


  修改换行符\n后,选择项不会换行了,怎么修改选择项在修改换行符后也正常.?

  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #
  5. #  \C[X](要变色的文字前加上)
  6. # 1 蓝色
  7. # 2 红色
  8. # 3 绿色
  9. # 4 天蓝
  10. # 5 粉红
  11. # 6 黄色
  12. # 7 灰色

  13. # ----------------------------
  14. class Window_Message < Window_Selectable
  15.   attr_accessor :autoclosetime
  16.   attr_accessor :op
  17. # ----------------------------
  18.   def initialize
  19.     super(65, 304, 520, 180)
  20.     self.contents = Bitmap.new(width - 32, height - 32)
  21.     self.visible = false
  22.     self.z = 9998
  23.     @fade_in = false
  24.     @fade_out = false
  25.     @contents_showing = false
  26.     @cursor_width = 0
  27.     @autoclosetime = -1
  28.     @op = 255
  29.     @refreshflag = false
  30.     $game_system.message_position = 1  # 1 对话框居中
  31.     self.active = false
  32.     self.index = -1
  33.   end
  34. # ----------------------------
  35.   def dispose
  36.     terminate_message
  37.     $game_temp.message_window_showing = false
  38.     if @input_number_window != nil
  39.       @input_number_window.dispose
  40.     end
  41.     super
  42.   end
  43. # ----------------------------
  44.   def terminate_message
  45.     self.active = false
  46.     self.pause = false
  47.     self.index = -1
  48.     self.contents.clear
  49.     @contents_showing = false
  50.     if $game_temp.message_proc != nil
  51.       $game_temp.message_proc.call
  52.     end
  53.     $game_temp.message_text = nil
  54.     $game_temp.message_proc = nil
  55.     $game_temp.choice_start = 99
  56.     $game_temp.choice_max = 0
  57.     $game_temp.choice_cancel_type = 0
  58.     $game_temp.choice_proc = nil
  59.     $game_temp.num_input_start = 99
  60.     $game_temp.num_input_variable_id = 0
  61.     $game_temp.num_input_digits_max = 0
  62.     if @gold_window != nil
  63.       @gold_window.dispose
  64.       @gold_window = nil
  65.     end
  66.   end
  67. # ----------------------------
  68.   def refresh
  69.     self.contents.clear
  70.     self.contents.font.color = normal_color
  71.     self.contents.font.name = "黑体"
  72.     self.contents.font.size = 16
  73.     x = y = 0
  74.     @cursor_width = 0
  75.     @autoclosetime = -1
  76.     @refreshflag = true
  77.     lineheight = 15
  78.     active = ""
  79.     a = ""
  80.     centerflag = false
  81.     rightflag = false
  82.     bannerflag = false
  83.     if $game_temp.choice_start == 0
  84.       x = 8
  85.     end
  86.     if $game_temp.message_text != nil
  87.       text = $game_temp.message_text
  88.       begin
  89.       last_text = text.clone
  90.       text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
  91.       end until text == last_text
  92.       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
  93.         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
  94.       end
  95.       text.gsub!(/\\\\/) { "\000" }
  96.       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
  97.       text.gsub!(/\\[Gg]/) { "\002" }
  98.        text.gsub!(/\\[Ii]\[([0-9]+)\]/) { "\003[#{$1}]" }
  99.       text.gsub!(/\\[Ff]\[([0-9]+)\]/) { "\004[#{$1}]" }
  100.       text.gsub!(/\\[Aa]\[([0-9]+)\]/) { "\005[#{$1}]" }
  101.       text.gsub!(/\\[Xx]/) { "\006" }
  102.       text.gsub!(/\\[Rr]/) { "\007" }
  103.       text.gsub!(/\\[Dd]/) { "\011" }
  104.       text.gsub!(/\\[Ss]\[([0-9]+)\]/) { "\023[#{$1}]" }
  105.       text.gsub!(/\\[Bb]/) { "\017" }
  106.       text.gsub!(/\\[Ww]\[([0-9]+)\]/) { "\014[#{$1}]" }
  107.       text.gsub!(/\\[Mm]\[([0-9]+)\]/) { "\015[#{$1}]" }
  108.       text.gsub!(/\\[Oo]\[([0-9]+)\]/) { "\016[#{$1}]" }
  109.       text.gsub!(/\\[Jj]\[([0-9]+)\]/) { "\013[#{$1}]" }
  110.       text.gsub!(/\\[Hh]\[([0-9]+)\]/) { "\021[#{$1}]" }
  111.       text.gsub!(/\\[Kk]\[([0-9]+)\]/) { "\022[#{$1}]" }
  112.       while ((c = text.slice!(/./m)) != nil)
  113.         if c == "\000"
  114.           c = "\\"
  115.         end
  116.         if c == "\001"
  117.           text.sub!(/\[([0-9]+)\]/, "")
  118.           color = $1.to_i
  119.           if color >= 0 and color <= 7
  120.             self.contents.font.color = text_color(color)
  121.           end
  122.           next
  123.         end
  124.         if c == "\002"
  125.           if @gold_window == nil
  126.             @gold_window = Window_Gold.new
  127.             @gold_window.x = 560 - @gold_window.width
  128.             if $game_temp.in_battle
  129.               @gold_window.y = 192
  130.             else
  131.               @gold_window.y = self.y >= 128 ? 32 : 384
  132.             end
  133.             @gold_window.opacity = self.opacity
  134.             @gold_window.back_opacity = self.back_opacity
  135.           end
  136.           next
  137.         end
  138.           if c == "\003"
  139.           text.sub!(/\[([0-9]+)\]/, "")
  140.           item_sub = $1.to_i
  141.           c = $data_items[item_sub].name
  142.           l = self.contents.text_size(c).width
  143.           draw_item_name($data_items[item_sub], x, y * 32 + 1)
  144.           x = x + l + 24
  145.           next
  146.         end
  147.          if c == "\004"
  148.           text.sub!(/\[([0-9]+)\]/, "")
  149.           fontize = $1.to_i
  150.           case fontize
  151.             when 1
  152.               self.contents.font.name = "黑体"
  153.             when 2
  154.               self.contents.font.name = "High Tower Text"
  155.             when 3
  156.               self.contents.font.name = "Tw Cen MT"
  157.             when 4
  158.               self.contents.font.name = "Tahoma"
  159.           end
  160.           next
  161.         end
  162.          if c == "\005"
  163.           text.sub!(/\[([0-9]+)\]/, "")
  164.           @autoclosetime = $1.to_i
  165.           next
  166.         end
  167.         if c == "\006"
  168.           centerflag = true
  169.           next
  170.         end
  171.         if c == "\007"
  172.           rightflag = true
  173.           next
  174.         end
  175.         if c == "\011"
  176.           self.contents.font.name = "黑体"
  177.           self.contents.font.size = 18
  178.           self.contents.font.color = normal_color
  179.           lineheight = 32
  180.           next
  181.         end
  182.         if c == "\014"
  183.           text.sub!(/\[([0-9]+)\]/, "")
  184.           w_sub = $1.to_i
  185.           c = $data_weapons[w_sub].name
  186.           l = self.contents.text_size(c).width
  187.           bitmap = RPG::Cache.icon($data_weapons[w_sub].icon_name)
  188.           self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24))
  189.           x += 28
  190.           self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c)
  191.           x = x + l
  192.           next
  193.         end
  194.           if c == "\015"
  195.           text.sub!(/\[([0-9]+)\]/, "")
  196.           a_sub = $1.to_i
  197.           c = $data_armors[a_sub].name
  198.           l = self.contents.text_size(c).width
  199.           bitmap = RPG::Cache.icon($data_armors[a_sub].icon_name)
  200.           self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24))
  201.           x += 28
  202.           self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c)
  203.           x = x + l
  204.           next
  205.         end
  206.           if c == "\016"
  207.           text.sub!(/\[([0-9]+)\]/, "")
  208.           @op = $1.to_i
  209.           next
  210.         end
  211.          if c == "\017"
  212.           bannerflag = true
  213.           next
  214.         end
  215.         if c == "\018"
  216.           text.sub!(/\[([0-9]+)\]/, "")
  217.           jump = $1.to_i
  218.           x += jump
  219.           next
  220.         end
  221.           if c == "\021"
  222.           text.sub!(/\[([0-9]+)\]/, "")
  223.           lineheight = $1.to_i
  224.           next
  225.         end
  226.         if c == "\022"
  227.           text.sub!(/\[([0-9]+)\]/, "")
  228.           skill_sub = $1.to_i
  229.           c = $data_skills[skill_sub].name
  230.           l = self.contents.text_size(c).width
  231.           bitmap = RPG::Cache.icon($data_skills[skill_sub].icon_name)
  232.           self.contents.blt(x+4, y * 32+ 4, bitmap, Rect.new(0, 0, 24, 24))
  233.           x += 28
  234.           self.contents.draw_text(x+4, 32 * y, l+32, lineheight, c)
  235.           x = x + l
  236.           next
  237.         end
  238.          if c == "\023"
  239.           text.sub!(/\[([0-9]+)\]/, "")
  240.           bigness = $1.to_i
  241.           self.contents.font.size = bigness
  242.           next
  243.         end
  244.             
  245.         if c == "\p"
  246.           if centerflag == true
  247.             x = 520 - x
  248.             x = x / 2
  249.             self.contents.draw_text(x, 32 * y, 520-x, lineheight, a)
  250.           end
  251.           if rightflag == true
  252.             x = 520 - x
  253.             self.contents.draw_text(x, 32 * y, 520-x, lineheight, a)
  254.           end
  255.           if bannerflag == true
  256.             x = 520 - x
  257.             x = x / 2
  258.             self.contents.draw_text(x, 44, 520-x, lineheight, a)
  259.           end
  260.           a = ""
  261.           centerflag = false
  262.           rightflag = false
  263.           bannerflag = false
  264.           if y >= $game_temp.choice_start
  265.             @cursor_width = [@cursor_width, x].max
  266.           end
  267.           y += 1
  268.           x = 0
  269.           if y >= $game_temp.choice_start
  270.             x = 8
  271.           end
  272.           next
  273.        end
  274.         if centerflag == false && rightflag == false && bannerflag == false
  275.         # 控制字体间隔
  276.         self.contents.draw_text(1 + x, 20 * y, 40, lineheight, c)
  277.         x += self.contents.text_size(c).width
  278.       else
  279.         a += c
  280.         x += self.contents.text_size(c).width
  281.         end
  282.       end

  283.     end
  284.     if $game_temp.choice_max > 0
  285.       @item_max = $game_temp.choice_max
  286.       self.active = true
  287.       self.index = 0
  288.     end
  289. #    if $game_temp.num_input_variable_id > 0
  290. #      digits_max = $game_temp.num_input_digits_max
  291. #      number = $game_variables[$game_temp.num_input_variable_id]
  292. #      @input_number_window = Window_InputNumber.new(digits_max)
  293. #      @input_number_window.number = number
  294. #      @input_number_window.x = self.x + 8
  295. #      @input_number_window.y = self.y + $game_temp.num_input_start * 32
  296. #    end


  297. end

  298. # ----------------------------
  299.   def reset_window
  300.     if $game_temp.in_battle
  301.       self.y = 16
  302.     else
  303.       case $game_system.message_position
  304.       when 0
  305.         self.y = 16
  306.       when 1
  307.         self.y = 160
  308.       when 2
  309.         self.y = 304
  310.       end
  311.     end
  312.     if $game_system.message_frame == 0
  313.       self.opacity = 255
  314.     else
  315.       self.opacity = 0
  316.     end
  317.     self.back_opacity = 255 # 背景不透明
  318.   end
  319. # ----------------------------  
  320.   def update
  321.     super
  322.     if @refreshflag && @fade_in == false
  323.       self.contents_opacity = @op
  324.      end
  325.     if @autoclosetime == 0
  326.     @autoclosetime = -1
  327.      terminate_message
  328.    end
  329.     if @autoclosetime >= 1
  330.     @autoclosetime -= 1
  331.     end
  332.     if @fade_in
  333.       self.contents_opacity += 24
  334.       if @input_number_window != nil
  335.         @input_number_window.contents_opacity += 24
  336.       end
  337.       if self.contents_opacity >= @op
  338.         @fade_in = false
  339.       end
  340.       return
  341.     end
  342.     if @input_number_window != nil
  343.       @input_number_window.update
  344.       if Input.trigger?(Input::C)
  345.         $game_system.se_play($data_system.decision_se)
  346.         $game_variables[$game_temp.num_input_variable_id] =
  347.           @input_number_window.number
  348.         $game_map.need_refresh = true
  349.         @input_number_window.dispose
  350.         @input_number_window = nil
  351.         terminate_message
  352.       end
  353.       return
  354.     end
  355.     if @contents_showing
  356.       if $game_temp.choice_max == 0
  357.         self.pause = true
  358.       end
  359.       if Input.trigger?(Input::B)
  360.         if $game_temp.choice_max > 0 and $game_temp.choice_cancel_type > 0
  361.           $game_system.se_play($data_system.cancel_se)
  362.           $game_temp.choice_proc.call($game_temp.choice_cancel_type - 1)
  363.           terminate_message
  364.         end
  365.       end
  366.       if Input.trigger?(Input::C)
  367.         if $game_temp.choice_max > 0
  368.           $game_system.se_play($data_system.decision_se)
  369.           $game_temp.choice_proc.call(self.index)
  370.         end
  371.         @op = 255
  372.         terminate_message
  373.       end
  374.       return
  375.     end
  376.     if @fade_out == false and $game_temp.message_text != nil
  377.       @contents_showing = true
  378.       $game_temp.message_window_showing = true
  379.       reset_window
  380.       refresh
  381.       Graphics.frame_reset
  382.       self.visible = true
  383.       self.contents_opacity = 0
  384.       if @input_number_window != nil
  385.         @input_number_window.contents_opacity = 0
  386.       end
  387.       @fade_in = true
  388.       return
  389.     end
  390.     if self.visible
  391.       @fade_out = true
  392.       self.opacity -= 48
  393.       if self.opacity == 0
  394.         self.visible = false
  395.         @fade_out = false
  396.         $game_temp.message_window_showing = false
  397.       end
  398.       return
  399.     end
  400.   end
  401. # ----------------------------
  402.   def update_cursor_rect
  403.     if @index >= 0
  404.       n = $game_temp.choice_start + @index
  405.       self.cursor_rect.set(8, n * 32, @cursor_width, 32)
  406.     else
  407.       self.cursor_rect.empty
  408.     end
  409.   end
  410. end
复制代码

此贴于 2009-2-3 7:31:20 被版主darkten提醒,请楼主看到后对本贴做出回应。
版务信息:本贴由楼主自主结贴~
十年磨一剑,蓦然回首,年华如水,青春如歌。
头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
21 小时
注册时间
2007-7-3
帖子
573
2
发表于 2009-2-2 01:09:11 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
9 小时
注册时间
2006-9-7
帖子
303
3
 楼主| 发表于 2009-2-2 03:32:55 | 只看该作者
我修改之后是要用 P 来换行, 这个很正常, 不正常的是那个 选择项 不会自动换行,而且选择的柜型框也没有了, 哪里出了问题?
十年磨一剑,蓦然回首,年华如水,青春如歌。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
60
在线时间
9 小时
注册时间
2006-9-7
帖子
303
4
 楼主| 发表于 2009-2-2 19:32:23 | 只看该作者
我使用了 续行符脚本, 和这个有关吗?
十年磨一剑,蓦然回首,年华如水,青春如歌。
回复 支持 反对

使用道具 举报

头像被屏蔽

Lv1.梦旅人 (禁止发言)

梦石
0
星屑
50
在线时间
21 小时
注册时间
2007-7-3
帖子
573
5
发表于 2009-2-3 00:40:59 | 只看该作者
提示: 作者被禁止或删除 内容自动屏蔽
签名被屏蔽
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-5-11 13:47

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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