| 赞 | 0  | 
 
| VIP | 2 | 
 
| 好人卡 | 0 | 
 
| 积分 | 16 | 
 
| 经验 | 38341 | 
 
| 最后登录 | 2024-5-15 | 
 
| 在线时间 | 626 小时 | 
 
 
 
 
 
Lv3.寻梦者 
	- 梦石
 - 0 
 
        - 星屑
 - 1556 
 
        - 在线时间
 - 626 小时
 
        - 注册时间
 - 2010-8-5
 
        - 帖子
 - 451
 
 
 
 | 
	
3楼
 
 
 楼主 |
发表于 2014-7-10 21:37:34
|
只看该作者
 
 
 
batfjtn 发表于 2014-7-10 21:26 ![]()  
这个是窗口大小~~!! 
 
和信息没关系~~!  
你想的太复杂了- -。简单的一个- #==============================================================================
 
 - # ■ System
 
 - #------------------------------------------------------------------------------
 
 - #  我的系统。
 
 - #==============================================================================
 
 - module System
 
 -   #============================================================================
 
 -   # ■ Window_Text
 
 -   #----------------------------------------------------------------------------
 
 -   #  信息显示窗口。
 
 -   #============================================================================
 
 -   class Window_Text < Window_Base
 
 -     #------------------------------------------------------------------------
 
 -     # ● 定义实例变量
 
 -     #------------------------------------------------------------------------
 
 -     attr_reader   :text_height                # 内容的高
 
 -     #------------------------------------------------------------------------
 
 -     # ● 初始化对像
 
 -     #------------------------------------------------------------------------
 
 -     def initialize
 
 -       super(630,0,352,176)
 
 -       self.windowskin = nil
 
 -       self.z = 400
 
 -       @text_height = 0
 
 -       refresh(nil)
 
 -     end
 
 -     #------------------------------------------------------------------------
 
 -     # ● 刷新
 
 -     #------------------------------------------------------------------------
 
 -     def refresh(text = nil)
 
 -       # 在地图中的情况下
 
 -       if $scene.is_a?(Scene_Map) or $scene.is_a?(Scene_Battle)
 
 -         return if text.nil? and $data.text.nil? or $禁
 
 -         text = text.nil? ? "" : text + "\n"
 
 -         text = $data.text.clone + text.clone
 
 -       else
 
 -         return if text.nil?
 
 -       end
 
 -       self.oy = [@text_height - 144, 0].max if !$锁
 
 -       self.contents = Bitmap.new(self.width - 32, self.oy + self.height + 18)
 
 -       self.contents.font = Font.new("宋体",14)
 
 -       # 描绘内容
 
 -       draw_text(text)
 
 -     end
 
 -     #------------------------------------------------------------------------
 
 -     # ● 清空内容
 
 -     #------------------------------------------------------------------------
 
 -     def clear_text
 
 -       if self.contents != nil
 
 -         self.contents.dispose
 
 -         self.contents = nil
 
 -       end
 
 -       self.contents = Bitmap.new(self.width - 32, self.oy + self.height + 18)
 
 -       self.oy = 0
 
 -       $data.text = ""
 
 -     end
 
 -     #------------------------------------------------------------------------
 
 -     # ● 写入文字
 
 -     #------------------------------------------------------------------------
 
 -     def txt=(text)
 
 -       self.refresh(text)
 
 -     end
 
 -     #------------------------------------------------------------------------
 
 -     # ● 描绘内容
 
 -     #------------------------------------------------------------------------
 
 -     def draw_text(text)
 
 -       # 在地图中的情况下
 
 -       if $scene.is_a?(Scene_Map) or $scene.is_a?(Scene_Battle)
 
 -         $data.text = text.clone
 
 -       end
 
 -       # 初始化位置
 
 -       x = y = 0
 
 -       # 限制文字处理
 
 -       begin
 
 -         last_text = text.clone
 
 -         text.gsub!(/\\[Vv]\[([0-9]+)\]/) { $game_variables[$1.to_i] }
 
 -       end until text == last_text
 
 -       text.gsub!(/\\[Nn]\[([0-9]+)\]/) do
 
 -         $game_actors[$1.to_i] != nil ? $game_actors[$1.to_i].name : ""
 
 -       end
 
 -       # 为了方便、将 "\\\\" 变换为 "\000" 
 
 -       text.gsub!(/\\\\/) { "\000" }
 
 -       # "\C" 变为 "\001" 和 "\P" 变为 "\002"
 
 -       text.gsub!(/\\[Cc]\[([0-9]+)\]/) { "\001[#{$1}]" }
 
 -       text.gsub!(/\\[Pp]/) { "\002" }
 
 -       # c 获取 1 个字 (如果不能取得文字就循环)
 
 -       while ((c = text.slice!(/./m)) != nil)
 
 -         # \\ 的情况下
 
 -         if c == "\000"
 
 -           # 还原为本来的文字
 
 -           c = "\\"
 
 -         end
 
 -         # \C[n] 的情况下
 
 -         if c == "\001"
 
 -           # 更改文字色
 
 -           text.sub!(/\[([0-9]+)\]/, "")
 
 -           color = $1.to_i
 
 -           if color >= 0 and color <= 7
 
 -             self.contents.font.color = text_color(color)
 
 -           end
 
 -           # 下面的文字
 
 -           next
 
 -         end
 
 -         # 图片描绘
 
 -         if c == "\002"
 
 -           icon_name = ""
 
 -           while ((cha = text.slice!(/./m)) != "]")
 
 -             next if cha == "["
 
 -             icon_name += cha
 
 -           end
 
 -           icon = Bitmap.new("UI/" + "#{icon_name}")
 
 -           # 换行处理
 
 -           if x + icon.width > self.contents.width
 
 -             y += 18
 
 -             x = 0
 
 -           end
 
 -           self.contents.blt(x + 3, y, icon, icon.rect)
 
 -           x += icon.width
 
 -           # 下面的文字
 
 -           next
 
 -         end
 
 -         # 另起一行文字的情况下
 
 -         if c == "\n"
 
 -           y += 18
 
 -           x = 0
 
 -           # 下面的文字
 
 -           next
 
 -         end
 
 -         # 自动换行处理
 
 -         if x + self.contents.text_size(c).width > self.contents.width
 
 -           y += 18
 
 -           x = 0
 
 -         end
 
 -         # 描绘文字
 
 -         self.contents.draw_text(x + 3, y + 1, self.contents.font.size, self.contents.font.size, c)
 
 -         # x 为要描绘文字的加法运算
 
 -         x += self.contents.text_size(c).width
 
 -         # 内容自动滚动
 
 -         @text_height = y
 
 -         self.oy += 18 if y > 126 + self.oy and !$锁
 
 -       end
 
 -     end
 
 -     #------------------------------------------------------------------------
 
 -     # ● 刷新画面
 
 -     #------------------------------------------------------------------------
 
 -     def update
 
 -       super
 
 -     end
 
 -   end
 
 - end
 
  复制代码 |   
 
 
 
 |