| 赞 | 0  | 
 
| VIP | 0 | 
 
| 好人卡 | 0 | 
 
| 积分 | 1 | 
 
| 经验 | 327 | 
 
| 最后登录 | 2013-5-12 | 
 
| 在线时间 | 12 小时 | 
 
 
 
 
 
Lv1.梦旅人 
	- 梦石
 - 0 
 
        - 星屑
 - 50 
 
        - 在线时间
 - 12 小时
 
        - 注册时间
 - 2013-5-6
 
        - 帖子
 - 19
 
 
 
 | 
	
2楼
 
 
 楼主 |
发表于 2013-5-7 07:58:38
|
只看该作者
 
 
 
 本帖最后由 亿万星辰 于 2013-5-8 06:54 编辑  
- #==============================================================================
 
 - # ■ Window_Skill
 
 - #------------------------------------------------------------------------------
 
 - #  特技画面、战斗画面、显示可以使用的特技浏览的窗口。
 
 - #==============================================================================
 
  
- class Window_Skill < Window_Selectable
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 初始化对像
 
 -   #     actor : 角色
 
 -   #--------------------------------------------------------------------------
 
 -   def initialize(actor)
 
 -     super(142, 64, 320, 256)
 
 -     [url=home.php?mod=space&uid=95897]@actor[/url] = actor
 
 -     @column_max = 4
 
 -     refresh
 
 -     self.index = 0
 
 -     #self.active = true
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 获取特技
 
 -   #--------------------------------------------------------------------------
 
 -   def skill
 
 -     return @data[self.index]
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 刷新
 
 -   #--------------------------------------------------------------------------
 
 -   def refresh
 
 -     if self.contents != nil
 
 -       self.contents.dispose
 
 -       self.contents = nil
 
 -     end
 
 -     @data = []
 
 -     for i in [email protected]
 
 -       skill = $game_skills[@actor.skills[i]]#$data_skills[@actor.skills[i]]
 
 -       if skill != nil
 
 -         @data.push(skill)
 
 -       end
 
 -     end
 
 -     @data.push(nil)
 
 -     # 如果项目数不是 0 就生成位图、重新描绘全部项目
 
 -     @item_max = @data.size
 
 -     if @item_max > 0
 
 -       self.contents = Bitmap.new(width - 32, row_max * 56)
 
 -       for i in 0...@item_max
 
 -         draw_item(i)
 
 -       end
 
 -     end
 
 -   end  
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 描绘项目
 
 -   #     index : 项目编号
 
 -   #--------------------------------------------------------------------------
 
 -   def draw_item(index)
 
 -     skill = @data[index]
 
 -     return if skill.nil?
 
 -     self.contents.font.color = normal_color
 
 -     self.contents.font.size = 13
 
 -     x = index % @column_max * 70#(288 + 32)
 
 -     y = index / @column_max * 56#32
 
 -     rect = Rect.new(x, y, self.width / @column_max - 32, 32)
 
 -     bitmap = RPG::Cache.icon(skill.icon_name)
 
 -     self.contents.blt(x+4, y + 4, bitmap, Rect.new(0, 0, 30, 30))
 
 -     self.contents.draw_text(x+4, y+32, 212, 32, skill.name)
 
 -     self.contents.draw_text(x+4, y+24, 64, 16, "sp:"+skill.sp_cost.to_s)
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 刷新帮助文本
 
 -   #--------------------------------------------------------------------------
 
 -   def update_help
 
 -     @help_window.set_skill(self.skill)
 
 -     @help_window.x = (self.index % @column_max * 70) + 48 + self.x
 
 -     @help_window.y = (self.index / @column_max * 56) + 52 - self.oy + self.y
 
 -   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 - 70#32
 
 -     # 计算光标坐标
 
 -     x = @index % @column_max * 70#(cursor_width + 32)
 
 -     y = @index / @column_max * 56 - self.oy
 
 -     # 更新国标矩形
 
 -     self.cursor_rect.set(x, y, 70, 56)
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 获取开头行
 
 -   #--------------------------------------------------------------------------
 
 -   def top_row
 
 -     # 将窗口内容的传送源 Y 坐标、1 行的高 32 等分
 
 -     return self.oy / 56
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 设置开头行
 
 -   #     row : 显示开头的行
 
 -   #--------------------------------------------------------------------------
 
 -   def top_row=(row)
 
 -     # row 未满 0 的场合更正为 0
 
 -     if row < 0
 
 -       row = 0
 
 -     end
 
 -     # row 超过 row_max - 1 的情况下更正为 row_max - 1 
 
 -     if row > row_max - 1
 
 -       row = row_max - 1
 
 -     end
 
 -     # row 1 行高的 32 倍、窗口内容的传送源 Y 坐标
 
 -     self.oy = row * 56
 
 -   end
 
 -   #--------------------------------------------------------------------------
 
 -   # ● 获取 1 页可以显示的行数
 
 -   #--------------------------------------------------------------------------
 
 -   def page_row_max
 
 -     # 窗口的高度,设置画面的高度减去 32 ,除以 1 行的高度 32 
 
 -     return (self.height - 32) / 56
 
 -   end
 
 - end 
 
  复制代码 |   
 
 
 
 |