赞 | 9 |
VIP | 1 |
好人卡 | 6 |
积分 | 205 |
经验 | 289801 |
最后登录 | 2025-6-10 |
在线时间 | 94 小时 |
Lv5.捕梦者 御灵的宠物
- 梦石
- 12
- 星屑
- 8481
- 在线时间
- 94 小时
- 注册时间
- 2006-12-11
- 帖子
- 3156

|
直接从我自己的工程里翻出来给你……
- class Game_Actor
- attr_accessor :set_skills # 名称
- alias new_initialize initialize
- def initialize(actor_id)
- @set_skills = []
- for i in 0...5
- @set_skills.push(0)
- end
- new_initialize(actor_id)
- end
- end
- #==============================================================================
- # ■ Window_SetupSkill
- #==============================================================================
- class Window_SetupSkill < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor : 角色
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 352, 640, 128)
- @set_skills = actor.set_skills#[57,35,67,13,60]
- @actor = actor
- @column_max = 5
- @item_max = 5
- refresh
- self.index = 0
- # 战斗中的情况下将窗口移至中央并将其半透明化
- if $game_temp.in_battle
- self.y = 64
- self.height = 256
- self.back_opacity = 160
- end
- end
- #--------------------------------------------------------------------------
- # ● 获取特技
- #--------------------------------------------------------------------------
- # def skill
- # return @data[self.index]
- # end
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- # 如果项目数不是 0 就生成位图、重新描绘全部项目
- self.contents = Bitmap.new(width - 32, height- 32)
- self.contents.font.size = 16
- if @set_skills != nil
- for i in 0...@set_skills.size
- draw_skill(i)
- end
- end
- end
- def draw_skill(i)
- unless @set_skills[i] == 0
- skill = $data_skills[@set_skills[i]]
- if $game_party.actors[0].skill_can_use?(skill.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 8 + 128 * i
- y = 0
- rect = Rect.new(x, y, 24, 24)
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x + 8, y + 24, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x, y, 204, 32, skill.name, 0)
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(12 + 128 * i, 32, 72, 24, KEY_NAME[i])
- 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
- # 计算光标坐标
- x = @index % @column_max * (cursor_width + 32)
- y = @index / @column_max * 32 - self.oy
- # 更新国标矩形
- self.cursor_rect.set(x, y, cursor_width, 64)
- end
- end
复制代码- #==============================================================================
- # ■ Window_Skill
- #------------------------------------------------------------------------------
- # 特技画面、战斗画面、显示可以使用的特技浏览的窗口。
- #==============================================================================
- class Window_Skill < Window_Selectable
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # actor : 角色
- #--------------------------------------------------------------------------
- def initialize(actor)
- super(0, 128, 640, 224)
- @actor = actor
- @column_max = 2
- refresh
- self.index = 0
- # 战斗中的情况下将窗口移至中央并将其半透明化
- 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 = $data_skills[@actor.skills[i]]
- if skill != nil
- @data.push(skill)
- end
- end
- # 如果项目数不是 0 就生成位图、重新描绘全部项目
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 描绘项目
- # index : 项目编号
- #--------------------------------------------------------------------------
- def draw_item(index)
- skill = @data[index]
- if @actor.skill_can_use?(skill.id)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(skill.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 204, 32, skill.name, 0)
- self.contents.draw_text(x + 232, y, 48, 32, skill.sp_cost.to_s, 2)
- end
- #--------------------------------------------------------------------------
- # ● 刷新帮助文本
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_text(self.skill == nil ? "" : self.skill.description)
- end
- end
复制代码 系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~ |
|