赞 1  
 
VIP 246 
 
好人卡 87 
 
积分 1  
经验 34142 
 
最后登录 2015-1-15 
 
在线时间 323 小时 
 
 
 
Lv1.梦旅人 
	梦石 0  星屑 55  
        在线时间 323 小时 
        注册时间 2010-8-21 
        帖子 666  
 
 
	
加入我们,或者,欢迎回来。 您需要 登录  才可以下载或查看,没有帐号?注册会员  
 
x 
 
[教程]文字自动换行).width > line_width  # 竟然打错了,不知道误导了谁没,这句应该在这#============================================================================== 
# ■ Window_Help2 
#============================================================================== 
 
class  Window_Help2 < Window_Base
  #-------------------------------------------------------------------------- 
  # ● 初始化对像 
  #-------------------------------------------------------------------------- 
  def  initialize
    super ( 0 , 0 , 640 , 480 ) 
    self .contents  = Bitmap.new ( width - 32 , height - 32 ) 
  end 
  #-------------------------------------------------------------------------- 
  # ● 设置文本 
  #     text  : 窗口显示的字符串 
  #-------------------------------------------------------------------------- 
  def  set_text( text) 
    line_width = self .width  - 32  - 4  * 2 
    text_array = text.scan ( /./) 
    temp_str = "" 
    line = 0 
    for  i in  0 ...text_array .size 
      if  self .contents .text_size ( temp_str+text_array) .width  > line_width
        self .contents .draw_text ( 4 , line*32 , line_width , 32 , temp_str) 
        temp_str = "" 
        line += 1 
      end 
      if  i == text_array.size  - 1 
        self .contents .draw_text ( 4 , line*32 , line_width , 32 , temp_str+text_array) 
      end 
      temp_str += text_array # 竟然打错了,不知道误导了谁没,这句应该在这 
    end 
  end 
end 
#============================================================================== 
# ■ Window_Help2 
#============================================================================== 
 
class  Window_Help2 < Window_Base
  #-------------------------------------------------------------------------- 
  # ● 初始化对像 
  #-------------------------------------------------------------------------- 
  def  initialize
    super ( 0 , 0 , 640 , 480 ) 
    self .contents  = Bitmap.new ( width - 32 , height - 32 ) 
  end 
  #-------------------------------------------------------------------------- 
  # ● 设置文本 
  #     text  : 窗口显示的字符串 
  #-------------------------------------------------------------------------- 
  def  set_text( text) 
    line_width = self .width  - 32  - 4  * 2 
    text_array = text.scan ( /./) 
    temp_str = "" 
    line = 0 
    for  i in  0 ...text_array .size 
      if  self .contents .text_size ( temp_str+text_array) .width  > line_width
        self .contents .draw_text ( 4 , line*32 , line_width , 32 , temp_str) 
        temp_str = "" 
        line += 1 
      end 
      if  i == text_array.size  - 1 
        self .contents .draw_text ( 4 , line*32 , line_width , 32 , temp_str+text_array) 
      end 
      temp_str += text_array # 竟然打错了,不知道误导了谁没,这句应该在这 
    end 
  end 
end 
class  Scene_Temp
  def  main
    Window_Help2.new .set_text ( "六6RPG 半角RP,全角G,只是测试而已! " *10 ) 
    Graphics.transition 
    loop  do 
      Graphics.update 
    end 
  end 
end 
class  Scene_Temp
  def  main
    Window_Help2.new .set_text ( "六6RPG 半角RP,全角G,只是测试而已! " *10 ) 
    Graphics.transition 
    loop  do 
      Graphics.update 
    end 
  end 
end