| 赞 | 14 |
| VIP | |
| 好人卡 | |
| 积分 | 25 |
| 经验 | |
| 最后登录 | 2024-3-12 |
| 在线时间 | 912 小时 |
- 梦石
- 0
- 星屑
- 2457
- 在线时间
- 912 小时
- 注册时间
- 2014-10-14
- 回帖
- 1155

|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 j296196585 于 2016-12-6 02:24 编辑
[pre lang="ruby"]class Window_HelpSkillLv < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(0, 0, 240, 13*32)
self.opacity = 200
self.z = 9000
self.contents = Bitmap.new(width - 32, height - 32)
end
def dispose
super
if @icon != nil
@icon.dispose
@icon = nil
end
end
#--------------------------------------------------------------------------
# ● 设置文本
# text : 窗口显示的字符串
# align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
#--------------------------------------------------------------------------
def set_text(x, y, skill)
# 如果文本和对齐方式的至少一方与上次的不同
if x != @x or y != @y or skill != @skill
# 再描绘文本
self.contents.clear
self.x = x
self.y = y
if @icon != nil
@icon.dispose
@icon = nil
end
#——————————color
for b in 1..150
@color_2 = Color.new(255, 128, 255, 80 - b)
@color_3 = Color.new(255, 128, 255, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 0, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4 - 32, 0, 2, 30), @color_3) if b < 20
@color_2 = Color.new(192, 192, 192, 80 - b)
@color_3 = Color.new(192, 192, 192, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 32, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4 - 32, 32, 2, 30), @color_3) if b < 20
@color_2 = Color.new(255, 255, 128, 80 - b)
@color_3 = Color.new(255, 255, 128, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 64, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4 - 32, 64, 2, 30), @color_3) if b < 20
@color_2 = Color.new(128, 255, 128, 80 - b)
@color_3 = Color.new(128, 255, 128, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 96, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4 - 32, 96, 2, 30), @color_3) if b < 20
@color_2 = Color.new(128, 255, 255, 80 - b)
@color_3 = Color.new(128, 255, 255, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 128, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4-32, 128, 2, 30), @color_3) if b < 20
@color_2 = Color.new(255, 128, 255, 80 - b)
@color_3 = Color.new(255, 128, 255, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 128+32, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4-32, 128+32, 2, 30), @color_3) if b < 20
@color_2 = Color.new(255, 255, 128, 80 - b)
@color_3 = Color.new(255, 255, 128, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 128+32*2, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4-32, 128+32*2, 2, 30), @color_3) if b < 20
@color_2 = Color.new(192, 192, 192, 80 - b)
@color_3 = Color.new(192, 192, 192, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 128+32*3, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4-32, 128+32*3, 2, 30), @color_3) if b < 20
@color_2 = Color.new(255, 128, 255, 80 - b)
@color_3 = Color.new(255, 128, 255, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 128+32*4, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4-32, 128+32*4, 2, 30), @color_3) if b < 20
@color_2 = Color.new(128, 255, 255, 80 - b)
@color_3 = Color.new(128, 255, 255, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 128+32*5, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4-32, 128+32*5, 2, 30), @color_3) if b < 20
@color_2 = Color.new(255, 128, 255, 80 - b)
@color_3 = Color.new(255, 128, 255, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 128+32*6, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4-32, 128+32*6, 2, 30), @color_3) if b < 20
@color_2 = Color.new(255, 255, 128, 80 - b)
@color_3 = Color.new(255, 255, 128, 60 + b)
self.contents.fill_rect(
Rect.new(2 * b + 4, 128+32*7, 2, 30), @color_2)
self.contents.fill_rect(
Rect.new(2 * b + 4-32, 128+32*7, 2, 30), @color_3) if b < 20
end
#——————————size
self.contents.font.size = 15
#——————————icon
@icon = RPG::Cache.icon(skill.icon_name)
self.contents.blt(
0, 4, @icon, Rect.new(0, 0, @icon.width, @icon.height))
#——————————id
yes_id = true
if yes_id
self.contents.font.color = text_color(3)
self.contents.draw_text(40, 0, width - 8, 32, "["+skill.id.to_s+"]")
#——————————name
x_plus = contents.text_size("["+skill.id.to_s+"]").width
else
x_plus = 0
end
self.contents.font.color = normal_color
self.contents.draw_text(40+x_plus, 0, width - 8, 32, skill.name)
#——————————description
self.contents.font.color = normal_color
self.contents.draw_text(0, 32, width - 8, 32, skill.description)
#——————————scope
self.contents.font.color = system_color
self.contents.draw_text(0, 32*2, width - 8, 32, "效果范围:")
self.contents.font.color = normal_color
case skill.scope
when 0
self.contents.draw_text(0, 32*2, width - 8, 32, "无", 1)
when 1
self.contents.draw_text(0, 32*2, width - 8, 32, "敌单体", 1)
when 2
self.contents.draw_text(0, 32*2, width - 8, 32, "敌全体", 1)
when 3
self.contents.draw_text(0, 32*2, width - 8, 32, "己方单体", 1)
when 4
self.contents.draw_text(0, 32*2, width - 8, 32, "己方全体", 1)
when 5
self.contents.draw_text(20, 32*2, width - 8, 32, "己方单体(HP 0)", 1)
when 6
self.contents.draw_text(20, 32*2, width - 8, 32, "己方全体(HP 0)", 1)
when 7
self.contents.draw_text(0, 32*2, width - 8, 32, "使用者", 1)
end
#——————————occasion
self.contents.font.color = system_color
self.contents.draw_text(0, 32*3, width - 8, 32, "可能使用的场合:")
self.contents.font.color = normal_color
case skill.scope
when 0
self.contents.draw_text(40, 32*3, width - 8, 32, "平时", 1)
when 1
self.contents.draw_text(40, 32*3, width - 8, 32, "战斗中", 1)
when 2
self.contents.draw_text(40, 32*3, width - 8, 32, "菜单中", 1)
when 3
self.contents.draw_text(40, 32*3, width - 8, 32, "不能使用", 1)
end
#——————————sp_cost
self.contents.font.color = system_color
self.contents.draw_text(
0, 32*4, width - 8, 32, "消耗"+$data_system.words.sp+":")
self.contents.font.color = normal_color
self.contents.draw_text(0, 32*4, width - 8, 32, skill.sp_cost.to_s, 1)
#——————————power
self.contents.font.color = system_color
self.contents.draw_text(0, 32*5, width - 8, 32, "基础威力:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 32*5, width - 8, 32, skill.power.to_s, 1)
#——————————hit
self.contents.font.color = system_color
self.contents.draw_text(0, 32*6, width - 8, 32, "命中率:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 32*6, width - 8, 32, skill.hit.to_s, 1)
#——————————element_set
self.contents.font.color = system_color
x = 0
self.contents.draw_text(0, 32*7, width - 8, 32, "属性:")
for i in skill.element_set
element_name = $data_system.elements
self.contents.font.color = normal_color
self.contents.draw_text(0, 32*7, width - 8, 32, element_name, 1)
x += 32
end
if element_name == nil
self.contents.font.color = normal_color
self.contents.draw_text(0, 32*7, width - 8, 32, "无", 1)
end
#——————————plus_state_set
self.contents.font.color = system_color
x = 0
self.contents.draw_text(0, 32*8, width - 8, 32, "附加状态:")
for i in skill.plus_state_set
state_name = $data_states.name
self.contents.font.color = normal_color
self.contents.draw_text(0, 32*8, width - 8, 32, state_name, 1)
x += 32
end
if state_name == nil
self.contents.font.color = normal_color
self.contents.draw_text(0, 32*8, width - 8, 32, "无", 1)
end
#——————————minus_state_set
self.contents.font.color = system_color
x = 0
self.contents.draw_text(0, 32*9, width - 8, 32, "解除状态:")
for i in skill.minus_state_set
state_name_2 = $data_states.name
self.contents.font.color = normal_color
self.contents.draw_text(x, 32*9, width - 8, 32, state_name_2, 1)
x += 32
end
if state_name_2 == nil
self.contents.font.color = normal_color
self.contents.draw_text(0, 32*9, width - 8, 32, "无", 1)
end
#——————————F
f = ""
if skill.atk_f > 0
f<<"攻击力"<<skill.atk_f.to_s<<"/"
end
if skill.eva_f > 0
f<<"回避"<<skill.eva_f.to_s<<"/"
end
if skill.str_f > 0
f<<"力量"<<skill.str_f.to_s<<"/"
end
if skill.dex_f > 0
f<<"灵巧"<<skill.dex_f.to_s<<"/"
end
if skill.agi_f > 0
f<<"速度"<<skill.agi_f.to_s<<"/"
end
if skill.int_f > 0
f<<"魔力"<<skill.int_f.to_s<<"/"
end
if skill.pdef_f > 0
f<<"物防"<<skill.pdef_f.to_s<<"/"
end
if skill.mdef_f > 0
f<<"魔防"<<skill.mdef_f.to_s<<"."
end
self.contents.font.color = system_color
self.contents.draw_text(
0, 32*10, width - 8, 32, "受角色能力影响系数:")
self.contents.font.color = normal_color
self.contents.draw_text(0, 32*11, width - 8, 32, f)
@x = x
@y = y
@skill = skill
@actor = nil
end
self.visible = true
end
end
# 设置模块
module Skill_Lv
ITEM = {}
end
# 直接把默认技能窗口复制来的
class Window_Skill_Lv < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(0, 128, 320, 352)
self.opacity = 160
@actor = actor
@column_max = 1
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
@data = []
for i in 0...@actor.skills.size
skill = $data_skills[@actor.skills]
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 % @column_max * (288 + 32)
y = index / @column_max * 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
if self.index != @old_index
@help_window.set_text(150, 50, self.skill == nil ? "" : self.skill)
@old_index = self.index
end
end
end
class Scene_LvSkill
def initialize(id)
@actor = $game_actors[id]
end
def main
map = Spriteset_Map.new
@skill_window = Window_Skill_Lv.new(@actor)
@skill_help = Window_HelpSkillLv.new
@skill_window.help_window = @skill_help
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
map.dispose
@skill_window.dispose
@skill_help.dispose
end
def update
@skill_window.update
end
end[/pre] |
-
|