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

Project1

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

[已经解决] 白痴问题:如何实现显示字符类似打字效果

 关闭 [复制链接]

Lv1.梦旅人

梦石
0
星屑
81
在线时间
54 小时
注册时间
2008-12-24
帖子
345
跳转到指定楼层
1
发表于 2009-7-23 17:37:29 | 显示全部楼层 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 凌辰 于 2009-7-28 23:22 编辑
  1. #===========================================================
  2. # ■ Window_Instant_Messaging
  3. #------------------------------------------------------------------------------
  4. #   信息窗口。Instant_Messaging
  5. #===========================================================
  6. class Window_Instant_Messaging < Window_Selectable
  7.   # 显示行数数列
  8.   INSTANT_SIZE = 10
  9.   #--------------------------------------------------------------------------
  10.   # ● 初始化对像
  11.   #--------------------------------------------------------------------------
  12.   def initialize
  13.     # 设置窗口坐标,和窗口大小
  14.     super(0, 250, 330, 240)
  15.     # 绝对透明处理
  16.     self.opacity = 0
  17.     # 激活处理
  18.     self.active = false
  19.     self.index = 0
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 刷新
  23.   #--------------------------------------------------------------------------
  24.   def refresh(count = 0)
  25.     if $old_messaging.size >= 0
  26.       # 如果hash表的键值数值大于显示的所能容下的行数
  27.       if $old_messaging.size > INSTANT_SIZE
  28.         # 计算多出来的部分
  29.         @size = INSTANT_SIZE
  30.         @count = $old_messaging.size
  31.         @count -= INSTANT_SIZE
  32.       else
  33.         # 如果没有超过…就返回0
  34.         @size = $old_messaging.size
  35.         @count = 0
  36.       end
  37.       self.contents = Bitmap.new(width - 32, INSTANT_SIZE * 16)
  38.       # 清理不需要的字符串--清楚多出来的字
  39.       self.contents.clear
  40.       @count_no = 0
  41.       # 循环处理能够显示的
  42.       for i in 0...@size
  43.         if i + count + @count >= 0
  44.           @no = i + count + @count
  45.           # 变量 = 键值
  46.           item = $old_messaging[@no]
  47.           x = 0
  48.           y = (i - @count_no) * 16 # ----显示"常量:INSTANT_SIZE"行,不介意很大
  49.           # 显示键值
  50.           self.contents.font.color = Color.new(-170,-170,-170,255)
  51.           self.contents.font.size = 14
  52.           self.contents.draw_text(x + 6, y + 1, self.contents.text_size(item).width, 16, item, 0)
  53.           self.contents.font.color = normal_color
  54.           self.contents.draw_text(x + 5, y, self.contents.text_size(item).width, 16, item, 0)
  55.         end
  56.       end
  57.     end
  58.   end
  59.   #--------------------------------------
  60.   #  ● 刷新光标
  61.   #--------------------------------------
  62.   def update_cursor_rect
  63.     # 光标位置不满 0 的情况下
  64.     if @index < 0
  65.       self.cursor_rect.empty
  66.       return
  67.     end
  68.     # 获取当前的行
  69.     row = @index / @column_max
  70.     # 当前行被显示开头行前面的情况下
  71.     if row < self.top_row
  72.       # 从当前行向开头行滚动
  73.       self.top_row = row
  74.     end
  75.     # 当前行被显示末尾行之后的情况下
  76.     if row > self.top_row + (self.page_row_max - 1)
  77.       # 从当前行向末尾滚动
  78.       self.top_row = row - (self.page_row_max - 1)
  79.     end
  80.     # 计算光标的宽
  81.     cursor_width = self.width / @column_max - 32
  82.     # cursor_width = 0
  83.     # 计算光标坐标
  84.     x = @index % @column_max * (cursor_width + 32)
  85.     y = @index / @column_max * 32 - self.oy
  86.     # 更新国标矩形
  87.     self.cursor_rect.set(x, y, self.width - 32, 96)
  88.   end
  89. end
复制代码
自己写的~可是一直很想让他实现打字效果
请将脚本框在代码框内。
丧尸语录-终の千年
类型:恐怖
      爱情
      悬疑
      休闲
の名:千年の制裁の
系统--- 50%
画面---  0%
美工---  0%
地图---  0%
数据库-  0%
剧情---  50%
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-6-4 02:47

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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