| 
 
| 赞 | 2 |  
| VIP | 0 |  
| 好人卡 | 0 |  
| 积分 | 1 |  
| 经验 | 4954 |  
| 最后登录 | 2024-3-18 |  
| 在线时间 | 54 小时 |  
 Lv1.梦旅人 
	梦石0 星屑81 在线时间54 小时注册时间2008-12-24帖子345 | 
| 
本帖最后由 kula1900 于 2009-7-5 12:55 编辑
x
加入我们,或者,欢迎回来。您需要 登录 才可以下载或查看,没有帐号?注册会员  
 对于原作者在每个要显示的即时消息的脚本中加入
 def ……
 不怎么方便实用
 end
 本人修改后只需2个脚本就能添加
 不过在某些方面还比不上原作者的脚本
 比如 大量消息她不会自动换行!其他的应该没什么了吧
 
 窗口脚本:
 
 #==============================================================================# ■ Window_Down
 #------------------------------------------------------------------------------
 #   信息窗口。Instant_Messaging
 #==============================================================================
 class Window_Instant_Messaging < Window_Selectable
 # 显示行数数列
 INSTANT_SIZE = 10
 #--------------------------------------------------------------------------
 # ● 初始化对像
 #--------------------------------------------------------------------------
 def initialize
 # 设置窗口坐标,和窗口大小
 super(0, 250, 330, 240)
 # 绝对透明处理
 self.opacity = 0
 # 激活处理
 self.active = false
 self.index = 0
 end
 #--------------------------------------------------------------------------
 # ● 刷新
 #--------------------------------------------------------------------------
 def refresh(count = 0)
 if $old_messaging.size > 0
 # 如果hash表的键值数值大于显示的所能容下的行数
 if $old_messaging.size > INSTANT_SIZE
 # 计算多出来的部分
 @size = INSTANT_SIZE
 @count = $old_messaging.size
 @count -= INSTANT_SIZE
 else
 # 如果没有超过…就返回0
 @size = $old_messaging.size
 @count = 0
 end
 self.contents = Bitmap.new(width - 32, INSTANT_SIZE * 16)
 # 清理不需要的字符串--清楚多出来的字
 self.contents.clear
 @count_no = 0
 # 循环处理能够显示的
 for i in 0...@size
 if i + count + @count >= 0
 @no = i + count + @count
 # 变量 = 键值
 item = $old_messaging[@no]
 x = 0
 y = (i - @count_no) * 16 # ----显示"常量:INSTANT_SIZE"行,不介意很大
 # 显示键值
 self.contents.font.size = 14
 self.contents.font.color = Color.new(-170,-170,-170,255)
 self.contents.draw_text(x + 6, y + 1, self.contents.text_size(item).width, 16, item, 0)
 self.contents.font.color = normal_color
 self.contents.draw_text(x + 5, y, self.contents.text_size(item).width, 16, item, 0)
 end
 end
 end
 end
 #--------------------------------------
 #  ● 刷新光标
 #--------------------------------------
 def update_cursor_rect
 # 光标位置不满 0 的情况下
 if @index < 0
 self.cursor_rect.empty
 return
 end
 # 获取当前的行
 row = @index / @column_max
 # 当前行被显示开头行前面的情况下
 if row < self.top_row
 # 从当前行向开头行滚动
 self.top_row = row
 end
 # 当前行被显示末尾行之后的情况下
 if row > self.top_row + (self.page_row_max - 1)
 # 从当前行向末尾滚动
 self.top_row = row - (self.page_row_max - 1)
 end
 # 计算光标的宽
 cursor_width = self.width / @column_max - 32
 # cursor_width = 0
 # 计算光标坐标
 x = @index % @column_max * (cursor_width + 32)
 y = @index / @column_max * 32 - self.oy
 # 更新国标矩形
 self.cursor_rect.set(x, y, self.width - 32, 96)
 end
 end
#-------------------------------------------------------------------------------# □ Game_Instant_Messaging处理即时信息的系统类
 #-------------------------------------------------------------------------------
 # 从游戏重新开始 或者是 游戏读档 都会工作,如果清除过那么自己看效果吧
 class Game_Instant_Messaging
 #--------------------------------------------------------------------------
 # ● 初始化
 #--------------------------------------------------------------------------
 def initialize
 # 生成即时信息显示窗口
 @instant_messaging_window = Window_Instant_Messaging.new
 @instant_messaging_window.z = -1
 @instant_messaging_window.index = -1
 @instant_messaging_window.active = @look = false
 @count = 0
 end
 #--------------------------------------------------------------------------
 # ● 刷新 $game_instant_messaging.update
 #--------------------------------------------------------------------------
 def update
 @instant_messaging_window.refresh
 @instant_messaging_window.update
 end
 #--------------------------------------------------------------------------
 # ● 清除 $game_instant_messaging.clear
 #--------------------------------------------------------------------------
 def clear
 @instant_messaging_window.dispose
 end
 #--------------------------------------------------------------------------
 # ● 设置即时消息 $game_instant_messaging.setup("你好") or
 # ● 用法:        messagin = "你好"
 #                 $game_instant_messaging.setup(messagin)
 #--------------------------------------------------------------------------
 def setup(messaging)
 $old_messaging[$old_messaging.size] = messaging
 end
 #--------------------------------------------------------------------------
 # ● 往上查看(查看过期信息) $game_instant_messaging.up
 #--------------------------------------------------------------------------
 def up
 @size = 0 - $old_messaging.size + 11
 if @count >= @size
 @count -= 1
 end
 @instant_messaging_window.refresh(@count)
 @instant_messaging_window.update
 end
 #--------------------------------------------------------------------------
 # ● 往下查看---不能超过0--超过0后果自付  $game_instant_messaging.down
 #--------------------------------------------------------------------------
 def down
 if @count < 0
 @count += 1
 end
 @instant_messaging_window.refresh(@count)
 @instant_messaging_window.update
 end
 end
 用法上面都有,请看注释!在读档 开始处希望添加个全局变量$game_instant_messaging = Game_Instant_Messaging.new
 就可以了
 
 附件
  第二种-简化-即时消息显示方式.rar
(192.45 KB, 下载次数: 847) | 
 |