赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 11 |
经验 | 6860 |
最后登录 | 2024-2-17 |
在线时间 | 326 小时 |
Lv3.寻梦者
- 梦石
- 0
- 星屑
- 1085
- 在线时间
- 326 小时
- 注册时间
- 2012-8-18
- 帖子
- 27
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 niuyi119 于 2019-10-13 15:49 编辑
$equipneed = {4=>[1]}#Mislier剑需要治疗
$armorneed = {4=>[3]}#Mislier盾需要治疗欧姆
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
# 处理装备画面的类。
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● 刷新画面 (物品窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 激活右侧窗口
@right_window.active = true
@item_window.active = false
@item_window.index = -1
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
######################################################
if $equipneed[@item_window.item.id] != nil and @item_window.item.is_a?(RPG::Weapon)
array = $equipneed[@item_window.item.id]
for i in array
if @actor.skills.include?(i) == false
$game_system.se_play($data_system.buzzer_se)
return
end
end
end
if $armorneed[@item_window.item.id] != nil and @item_window.item.is_a?(RPG::Armor)
array = $armorneed[@item_window.item.id]
for i in array
if @actor.skills.include?(i) == false
$game_system.se_play($data_system.buzzer_se)
return
end
end
end
###################################################
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 获取物品窗口现在选择的装备数据
item = @item_window.item
# 变更装备
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
# 激活右侧窗口
@right_window.active = true
@item_window.active = false
@item_window.index = -1
# 再生成右侧窗口、物品窗口的内容
@right_window.refresh
@item_window.refresh
return
end
end
end
复制代码
下面是八人制战斗的装备栏脚本有这个上面的就不起作用那位大神给融合一下
PATH_OF_IMAGES = "Graphics/Pictures/"
class Window_Base < Window
def actor_parameter(actor,type)
case type
when 0
parameter_value = actor.atk
when 1
parameter_value = actor.pdef
when 2
parameter_value = actor.mdef
when 3
parameter_value = actor.str
when 4
parameter_value = actor.dex
when 5
parameter_value = actor.agi
when 6
parameter_value = actor.int
end
end
#--------------------------------------------------------------------------
# ● 描绘水平值
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
#--------------------------------------------------------------------------
def draw_actor_level_new(actor, x, y, color = normal_color)
self.contents.font.color = system_color
self.contents.draw_text(x, y, 32, 32, "Lv")
self.contents.font.color = color
self.contents.draw_text(x + 32, y, 24, 32, actor.level.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 描绘能力值
# actor : 角色
# x : 描画目标 X 坐标
# y : 描画目标 Y 坐标
# type : 能力值种类 (0~6)
#--------------------------------------------------------------------------
def draw_actor_parameter_new(actor, x, y, type, color = normal_color)
case type
when 0
parameter_name = "攻击"
parameter_value = actor.atk
when 1
parameter_name = "物防"
parameter_value = actor.pdef
when 2
parameter_name = "魔防"
parameter_value = actor.mdef
when 3
parameter_name = "力量"
parameter_value = actor.str
when 4
parameter_name = "耐力"
parameter_value = actor.dex
when 5
parameter_name = "速度"
parameter_value = actor.agi
when 6
parameter_name = "精神"
parameter_value = actor.int
end
self.contents.font.color = system_color
self.contents.draw_text(x, y, 120, 32, parameter_name)
self.contents.font.color = color
self.contents.draw_text(x + 40, y, 36, 32, parameter_value.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 蓝色的
#--------------------------------------------------------------------------
def blue_color
return Color.new(0, 0, 255, 220)
end
#--------------------------------------------------------------------------
# ● 红色的
#--------------------------------------------------------------------------
def red_color
return Color.new(255, 0, 0)
end
end
#==============================================================================
# ■ Window_EquipLeft
#------------------------------------------------------------------------------
# 装备画面的、显示角色能力值变化的窗口。
#==============================================================================
class Window_Equip_left < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(30, 20, 180, 362)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.size = 20
@actor = actor
@color1 = normal_color
@color2 = normal_color
@color3 = normal_color
@color4 = normal_color
@color5 = normal_color
@color6 = normal_color#
refresh
end
def set_actor(actor)
@actor = actor
refresh
end
def set_parameters_color(color1 = normal_color,color2 = normal_color,color3 = normal_color,color4 = normal_color,color5 = normal_color,color6 = normal_color)
@color1 = color1
@color2 = color2
@color3 = color3
@color4 = color4
@color5 = color5
@color6 = color6#
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
####################
upordown_x = 156
equipopacity_u = 0
equipopacity_d = 0
c = 20
cc = 60
####################
testname = @actor.battler_name+"-1.PNG"
bitmap=Bitmap.new("Graphics/battlers/#{testname}")
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height) #——可自己调整大小
self.contents.blt(90, 0, bitmap, src_rect)#####################
draw_actor_name(@actor, 0, 0)
draw_actor_parameter_new(@actor, 0, 64, 0)
draw_actor_parameter_new(@actor, 0, 76 + c, 1)
draw_actor_parameter_new(@actor, 0, 88 + 2*c, 2)
draw_actor_level_new(@actor, 0, 32, @color1)
draw_actor_parameter_new(@actor, 0, 112 + 3*c, 3, @color2)
draw_actor_parameter_new(@actor, 0, 124 + 4*c, 4, @color3)
draw_actor_parameter_new(@actor, 0, 136 + 5*c, 5, @color4)
draw_actor_parameter_new(@actor, 0, 148 + 6*c, 6, @color5)
# 攻击力
if @new_atk != nil
if actor_parameter(@actor,0) > @new_atk
equipopacity_u = 0
equipopacity_d = 255
e_atk = actor_parameter(@actor,0) - @new_atk
cx = contents.text_size(e_atk.to_s).width
equip_color = down_color
elsif actor_parameter(@actor,0) < @new_atk
equipopacity_u = 255
equipopacity_d = 0
e_atk = @new_atk - actor_parameter(@actor,0)
cx = contents.text_size(e_atk.to_s).width
equip_color = up_color
else
equipopacity_u = 0
equipopacity_d = 0
end
bitmap = Bitmap.new(PATH_OF_IMAGES + "up.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 70, bitmap, src_rect,equipopacity_u)
bitmap = Bitmap.new(PATH_OF_IMAGES + "down.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 70, bitmap, src_rect,equipopacity_d)
if @new_atk != actor_parameter(@actor,0)
self.contents.font.color = equip_color
self.contents.draw_text(68+c+12, 64, 36, 32, e_atk.to_s, 2)
end
end
# 物理防御
if @new_pdef != nil
if actor_parameter(@actor,1) > @new_pdef
equipopacity_u = 0
equipopacity_d = 255
e_pdef = actor_parameter(@actor,1) - @new_pdef
cx = contents.text_size(e_pdef.to_s).width
equip_color = down_color
elsif actor_parameter(@actor,1) < @new_pdef
equipopacity_u = 255
equipopacity_d = 0
e_pdef = @new_pdef - actor_parameter(@actor,1)
cx = contents.text_size(e_pdef.to_s).width
equip_color = up_color
else
equipopacity_u = 0
equipopacity_d = 0
end
bitmap = Bitmap.new(PATH_OF_IMAGES + "up.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c,82+c, bitmap, src_rect,equipopacity_u)
bitmap = Bitmap.new(PATH_OF_IMAGES + "down.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 82+c, bitmap, src_rect,equipopacity_d)
if actor_parameter(@actor,1) != @new_pdef
self.contents.font.color = equip_color
self.contents.draw_text(68+c+12, 76+c, 36, 32, e_pdef.to_s, 2)
end
end
# 魔法防御
if @new_mdef != nil
if actor_parameter(@actor,2) > @new_mdef
equipopacity_u = 0
equipopacity_d = 255
e_mdef = actor_parameter(@actor,2) - @new_mdef
cx = contents.text_size(e_mdef.to_s).width
equip_color = down_color
elsif actor_parameter(@actor,2) < @new_mdef
equipopacity_u = 255
equipopacity_d = 0
e_mdef = @new_mdef - actor_parameter(@actor,2)
cx = contents.text_size(e_mdef.to_s).width
equip_color = up_color
else
equipopacity_u = 0
equipopacity_d = 0
end
bitmap = Bitmap.new(PATH_OF_IMAGES + "up.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 94 + 2*c, bitmap, src_rect,equipopacity_u)
bitmap = Bitmap.new(PATH_OF_IMAGES + "down.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 94 + 2*c, bitmap, src_rect,equipopacity_d)
if actor_parameter(@actor,2) != @new_mdef
self.contents.font.color = equip_color
self.contents.draw_text(68+c+12, 88 + 2*c, 36, 32, e_mdef.to_s, 2)
end
end
# 力量
if @new_str != nil
if actor_parameter(@actor,3) > @new_str
equipopacity_u = 0
equipopacity_d = 255
e_str = actor_parameter(@actor,3) - @new_str
cx = contents.text_size(e_str.to_s).width
equip_color = down_color
elsif actor_parameter(@actor,3) < @new_str
equipopacity_u = 255
equipopacity_d = 0
e_str = @new_str - actor_parameter(@actor,3)
cx = contents.text_size(e_str.to_s).width
equip_color = up_color
else
equipopacity_u = 0
equipopacity_d = 0
end
bitmap = Bitmap.new(PATH_OF_IMAGES + "up.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 118 + 3*c, bitmap, src_rect,equipopacity_u)
bitmap = Bitmap.new(PATH_OF_IMAGES + "down.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 118 + 3*c, bitmap, src_rect,equipopacity_d)
if actor_parameter(@actor,3) != @new_str
self.contents.font.color = equip_color
self.contents.draw_text(68+c+12, 112 + 3*c, 36, 32, e_str.to_s, 2)
end
end
# 灵巧
if @new_dex != nil
if actor_parameter(@actor,4) > @new_dex
equipopacity_u = 0
equipopacity_d = 255
e_dex = actor_parameter(@actor,4) - @new_dex
cx = contents.text_size(e_dex.to_s).width
equip_color = down_color
elsif actor_parameter(@actor,4) < @new_dex
equipopacity_u = 255
equipopacity_d = 0
e_dex = @new_dex - actor_parameter(@actor,4)
cx = contents.text_size(e_dex.to_s).width
equip_color = up_color
else
equipopacity_u = 0
equipopacity_d = 0
end
bitmap = Bitmap.new(PATH_OF_IMAGES + "up.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 130+4*c, bitmap, src_rect,equipopacity_u)
bitmap = Bitmap.new(PATH_OF_IMAGES + "down.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 130+4*c, bitmap, src_rect,equipopacity_d)
if actor_parameter(@actor,4) != @new_dex
self.contents.font.color = equip_color
self.contents.draw_text(68+c+12, 124+4*c, 36, 32, e_dex.to_s, 2)
end
end
# 速度
if @new_agi != nil
if actor_parameter(@actor,5) > @new_agi
equipopacity_u = 0
equipopacity_d = 255
e_agi = actor_parameter(@actor,5) - @new_agi
cx = contents.text_size(e_agi.to_s).width
equip_color = down_color
elsif actor_parameter(@actor,5) < @new_agi
equipopacity_u = 255
equipopacity_d = 0
e_agi = @new_agi - actor_parameter(@actor,5)
cx = contents.text_size(e_agi.to_s).width
equip_color = up_color
else
equipopacity_u = 0
equipopacity_d = 0
end
bitmap = Bitmap.new(PATH_OF_IMAGES + "up.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 142+5*c, bitmap, src_rect,equipopacity_u)
bitmap = Bitmap.new(PATH_OF_IMAGES + "down.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 142+5*c, bitmap, src_rect,equipopacity_d)
if actor_parameter(@actor,5) != @new_agi
self.contents.font.color = equip_color
self.contents.draw_text(68+c+12, 136+5*c, 36, 32, e_agi.to_s, 2)
end
end
# 魔力
if @new_int != nil
if actor_parameter(@actor,6) > @new_int
equipopacity_u = 0
equipopacity_d = 255
e_int = actor_parameter(@actor,6) - @new_int
cx = contents.text_size(e_int.to_s).width
equip_color = down_color
elsif actor_parameter(@actor,6) < @new_int
equipopacity_u = 255
equipopacity_d = 0
e_int = @new_int - actor_parameter(@actor,6)
cx = contents.text_size(e_int.to_s).width
equip_color = up_color
else
equipopacity_u = 0
equipopacity_d = 0
end
bitmap = Bitmap.new(PATH_OF_IMAGES + "up.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 156+6*c, bitmap, src_rect,equipopacity_u)
bitmap = Bitmap.new(PATH_OF_IMAGES + "down.png")
cw = bitmap.width
ch = bitmap.height
src_rect = Rect.new(0, 0, cw, ch)
self.contents.blt(68+c, 156+6*c, bitmap, src_rect,equipopacity_d)
if actor_parameter(@actor,6) != @new_int
self.contents.font.color = equip_color
self.contents.draw_text(68+c+12, 148+6*c, 36, 32, e_int.to_s, 2)
end
end
end
#--------------------------------------------------------------------------
# ● 变更装备后的能力值设置
# new_atk : 变更装备后的攻击力
# new_pdef : 变更装备后的物理防御
# new_mdef : 变更装备后的魔法防御
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_pdef, new_mdef,new_str,new_dex,new_agi,new_int)
if @new_atk != new_atk or @new_pdef != new_pdef or @new_mdef != new_mdef or @new_str != new_str or @new_dex != new_dex or @new_agi != new_agi or @new_int != new_int
@new_atk = new_atk
@new_pdef = new_pdef
@new_mdef = new_mdef
@new_str = new_str
@new_dex = new_dex
@new_agi = new_agi
@new_int = new_int
refresh
end
end
end
#==============================================================================
# ■ Window_EquipRight
#------------------------------------------------------------------------------
# 装备画面、显示角色现在装备的物品的窗口。
#==============================================================================
class Window_Equip_right < Window_Selectable_New
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
#--------------------------------------------------------------------------
def initialize(actor)
super(220, 20, 208, 272)#(220, 20, 208, 172)
self.contents = Bitmap.new(width - 32, height - 32)
@actor = actor
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
def set_actor(actor)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
@data = []
@data.push($data_weapons[@actor.weapon_id])
@data.push($data_armors[@actor.armor1_id])
@data.push($data_armors[@actor.armor2_id])
@data.push($data_armors[@actor.armor3_id])
@data.push($data_armors[@actor.armor4_id])
@item_max = @data.size
self.contents.font.color = system_color
y_r = 4 # 右窗口 y 坐标
self.contents.font.size = 20
self.contents.draw_text(y_r, 28 * 0, 92, 32, "配备")
self.contents.draw_text(y_r, 28 * 1, 92, 32, "部队")
self.contents.draw_text(y_r, 28 * 2, 92, 32, "士官")
self.contents.draw_text(y_r, 28 * 3, 92, 32, "军官")
self.contents.draw_text(y_r, 28 * 4, 92, 32, "附属")
self.contents.font.size = 15#18
draw_item_name(@data[0], 48, 28 * 0)
draw_item_name(@data[1], 48, 28 * 1)
draw_item_name(@data[2], 48, 28 * 2)
draw_item_name(@data[3], 48, 28 * 3)
draw_item_name(@data[4], 48, 28 * 4)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(make_description(self.item))
end
# 更新光标
def update_cursor_rect
self.cursor_rect.set(0, @index * 28+2, 176, 28)#28+2, 176, 28)
end
end
#==============================================================================
# ■ Window_EquipItem
#------------------------------------------------------------------------------
# 装备画面、显示浏览变更装备的候补物品的窗口。
#==============================================================================
class Window_Equip_item < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# actor : 角色
# equip_type : 装备部位 (0~3)
#--------------------------------------------------------------------------
def initialize(actor, equip_type)
super(220, 202, 400, 180)#(220, 202, 390, 180)
self.opacity = HS::OPACITY
@actor = actor
@equip_type = equip_type
@column_max = 2
refresh
self.active = false
self.index = -1
end
#--------------------------------------------------------------------------
# ● 获取物品
#--------------------------------------------------------------------------
def item
return @data[self.index]
end
def set_actor(actor)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
# 添加可以装备的武器
if @equip_type == 0
weapon_set = $data_classes[@actor.class_id].weapon_set
for i in 1...$data_weapons.size
if $game_party.weapon_number(i) > 0 and weapon_set.include?(i)
@data.push($data_weapons)
end
end
end
# 添加可以装备的防具
if @equip_type != 0
armor_set = $data_classes[@actor.class_id].armor_set
for i in 1...$data_armors.size
if $game_party.armor_number(i) > 0 and armor_set.include?(i)
if $data_armors.kind == @equip_type-1
@data.push($data_armors)
end
end
end
end
# 添加空白
@data.push(nil)
# 生成位图、描绘全部项目
@item_max = @data.size
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max-1
draw_item(i)
end
s = @data.size-1
x_l = 4 + s % 2 * 201#4+ s % 2 * 201
self.contents.font.size = 21#21
self.contents.font.color = Color.new(0,0,0,255)
self.contents.draw_text(x_l-1, s/2*32-1, 128, 32, "[调整部队]")
self.contents.draw_text(x_l-1, s/2*32+1, 128, 32, "[调整部队]")
self.contents.draw_text(x_l+1, s/2*32-1, 128, 32, "[调整部队]")
self.contents.draw_text(x_l+1, s/2*32+1, 128, 32, "[调整部队]")
self.contents.font.color = normal_color
self.contents.draw_text(x_l, s/2*32, 128, 32, "[调整部队]")
end
#--------------------------------------------------------------------------
# ● 项目的描绘
# index : 项目符号
#--------------------------------------------------------------------------
def draw_item(index)
item = @data[index]
x = 4 + index % 2 * (187-0)#195-8
y = index / 2 * 32#32
case item
when RPG::Weapon
number = $game_party.weapon_number(item.id)
when RPG::Armor
number = $game_party.armor_number(item.id)
end
if $game_party.item_can_equip?(@actor,item)
self.contents.font.color = normal_color
else
self.contents.font.color = disabled_color
end
self.contents.font.size = 20#20
bitmap = RPG::Cache.icon(item.icon_name)
self.contents.blt(x, y + 1, bitmap, Rect.new(0, 0, 24, 24))#4
self.contents.draw_text(x + 26, y, 212, 32, item.name, 0)#18, y, 212, 32, item.name, 0)
self.contents.draw_text(x + 36 + 104, y, 24, 32, number.to_s, 2)#58 + 104, y, 24, 32, number.to_s, 2)
end
#--------------------------------------------------------------------------
# ● 刷新帮助文本
#--------------------------------------------------------------------------
def update_help
@help_window.set_text(make_description(self.item))
end
def update_cursor_rect
cursor_width = self.width / @column_max - 32
if @index == -1
x = 0
y = 0
else
x = @index % @column_max * (cursor_width + 24)
y = @index / @column_max * 32 - self.oy
end
self.cursor_rect.set(x, y, cursor_width, 32)#32
end
end
#############################################################################
#############################################################################
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
# 处理装备画面的类。
#==============================================================================
#############################################################################
#############################################################################
class Scene_Equip
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
cmd = Window_Command_New.new($game_party.actors.size)
cmd.index = 4
cmd.active = false
# 生成角色索引窗口
@equip_actor_window = Window_Character.new
@equip_actor_window.x = -580#-580
@equip_actor_window.opacity = HS::OPACITY
@equip_actor_window.index = 0
@equip_acotr_index = @equip_actor_window.index
# 获取角色
@equip_actor = $game_party.actors[@equip_acotr_index]
# 生成窗口
@equip_help_window = Window_Help_New.new
@equip_help_window.x = 30
@equip_help_window.y = 480
@equip_help_window.opacity = HS::OPACITY
# 生成装备左窗口
@equip_window_left = Window_Equip_left.new(@equip_actor)
@equip_window_left.x = -180
@equip_window_left.opacity = HS::OPACITY
# 生成装备右窗口
@equip_window_right = Window_Equip_right.new(@equip_actor)
@equip_window_right.x = -208
@equip_window_right.opacity = HS::OPACITY
@equip_window_right.active = false
@equip_item_window1 = Window_Equip_item.new(@equip_actor, 0)
@equip_item_window2 = Window_Equip_item.new(@equip_actor, 1)
@equip_item_window3 = Window_Equip_item.new(@equip_actor, 2)
@equip_item_window4 = Window_Equip_item.new(@equip_actor, 3)
@equip_item_window5 = Window_Equip_item.new(@equip_actor, 4)
@equip_item_window6 = Window_Equip_item.new(@equip_actor, 5)#
@equip_item_window1.y = 480
@equip_item_window2.y = 480
@equip_item_window3.y = 480
@equip_item_window4.y = 480
@equip_item_window5.y = 480
@equip_item_window6.y = 480#
@equip_item_window2.visible = false
@equip_item_window3.visible = false
@equip_item_window4.visible = false
@equip_item_window5.visible = false
@equip_item_window6.visible = false#
# 关联帮助窗口
@equip_window_right.help_window = @equip_help_window
@equip_item_window1.help_window = @equip_help_window
@equip_item_window2.help_window = @equip_help_window
@equip_item_window3.help_window = @equip_help_window
@equip_item_window4.help_window = @equip_help_window
@equip_item_window5.help_window = @equip_help_window#
Graphics.transition
# 窗口的滑动
for i in 1..8
@equip_window_left.x += 26
@equip_window_right.x += 53
@equip_actor_window.x += 76
@equip_item_window1.y -= 34
@equip_item_window2.y -= 34
@equip_item_window3.y -= 34
@equip_item_window4.y -= 34
@equip_item_window5.y -= 34
@equip_item_window6.y -= 34#
if i==8
@equip_window_left.x = 30
@equip_window_right.x = 220
@equip_actor_window.x = 30
@equip_item_window1.y = 202
@equip_item_window2.y = 202
@equip_item_window3.y = 202
@equip_item_window4.y = 202
@equip_item_window5.y = 202
@equip_item_window6.y = 202#
end
Graphics.update
end
equip_refresh
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update_equip_scene
# 如果画面切换的话的就中断循环
if $scene != self
break
end
end
# 窗口的滑动
for i in 1..9
@equip_window_left.x -= 26
@equip_window_right.x -= 53
@equip_actor_window.x -= 76
@equip_item_window1.y += 34
@equip_item_window2.y += 34
@equip_item_window3.y += 34
@equip_item_window4.y += 34
@equip_item_window5.y += 34#
Graphics.update
end
Graphics.freeze
cmd.dispose
# 释放窗口
@equip_actor_window.dispose
@equip_help_window.dispose
@equip_window_left.dispose
@equip_window_right.dispose
@equip_item_window1.dispose
@equip_item_window2.dispose
@equip_item_window3.dispose
@equip_item_window4.dispose
@equip_item_window5.dispose#
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def equip_refresh
# 设置物品窗口的可视状态
@equip_item_window1.visible = (@equip_window_right.index == 0)
@equip_item_window2.visible = (@equip_window_right.index == 1)
@equip_item_window3.visible = (@equip_window_right.index == 2)
@equip_item_window4.visible = (@equip_window_right.index == 3)
@equip_item_window5.visible = (@equip_window_right.index == 4)
@equip_item_window6.visible = (@equip_window_right.index == 5)#
# 获取当前装备中的物品
item1 = @equip_window_right.item
# 设置当前的物品窗口到 @equip_item_window
case @equip_window_right.index
when 0
@equip_item_window = @equip_item_window1
when 1
@equip_item_window = @equip_item_window2
when 2
@equip_item_window = @equip_item_window3
when 3
@equip_item_window = @equip_item_window4
when 4
@equip_item_window = @equip_item_window5
when 5
@equip_item_window = @equip_item_window6#
end
# 右窗口被激活的情况下
if @equip_window_right.active
# 删除变更装备后的能力
@equip_window_left.set_new_parameters(nil, nil, nil, nil, nil, nil, nil)
end
# 物品窗口被激活的情况下
if @equip_item_window.active
# 获取现在选中的物品
item2 = @equip_item_window.item
# 属性不够以红色显示
if @now_item != item2
if item2 != nil
@equip_window_left.set_parameters_color($game_party.item_can_equip01?(@equip_actor,item2),$game_party.item_can_equip02?(@equip_actor,item2),$game_party.item_can_equip03?(@equip_actor,item2),$game_party.item_can_equip04?(@equip_actor,item2),$game_party.item_can_equip05?(@equip_actor,item2))
@now_item = item2
end
end
# 变更装备
last_hp = @equip_actor.hp
last_sp = @equip_actor.sp
@equip_actor.equip(@equip_window_right.index, item2 == nil ? 0 : item2.id)
# 获取变更装备后的能力值
new_atk = @equip_actor.atk
new_pdef = @equip_actor.pdef
new_mdef = @equip_actor.mdef
new_str = @equip_actor.str
new_dex = @equip_actor.dex
new_agi = @equip_actor.agi
new_int = @equip_actor.int
# 返回到装备
@equip_actor.equip(@equip_window_right.index, item1 == nil ? 0 : item1.id)
@equip_actor.hp = last_hp
@equip_actor.sp = last_sp
# 描画左窗口
@equip_window_left.set_new_parameters(new_atk, new_pdef, new_mdef, new_str, new_dex, new_agi, new_int)
else
# 取消属性颜色
if @now_item != nil
@equip_window_left.set_parameters_color
@now_item = nil
end
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update_equip_scene
# 刷新窗口
@equip_window_left.update
@equip_window_right.update
@equip_actor_window.update
@equip_item_window.update
equip_refresh
if @equip_acotr_index != @equip_actor_window.index
@equip_acotr_index = @equip_actor_window.index
@equip_actor = $game_party.actors[@equip_acotr_index]
@equip_window_left.set_actor(@equip_actor)
@equip_window_right.set_actor(@equip_actor)
@equip_item_window.set_actor(@equip_actor)
end
if @equip_actor_window.active
equip_update_actor_window
return
end
# 右侧窗口被激活的情况下: 调用 update_right
if @equip_window_right.active
equip_update_right
return
end
# 物品窗口被激活的情况下: 调用 update_item
if @equip_item_window.active
equip_update_item
return
end
end
def equip_update_actor_window
@equip_actor = $game_party.actors[@equip_actor_window.index]
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Menu.new(4)
return
end
if Input.trigger?(Input::C)
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活物品窗口
@equip_window_right.active = true
@equip_actor_window.active = false
@equip_window_right.index = 0
for i in 1..8
@equip_actor_window.y += 10
@equip_help_window.y -= 10
if i==8
@equip_actor_window.y = 480
@equip_help_window.y = 396
end
Graphics.update
end
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (右侧窗口被激活的情况下)
#--------------------------------------------------------------------------
def equip_update_right
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 结束该菜单
@equip_window_right.active = false
@equip_actor_window.active = true
for i in 1..8
@equip_actor_window.y -= 10
@equip_help_window.y += 10
if i==8
@equip_actor_window.y = 396
@equip_help_window.y = 480
end
Graphics.update
end
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 固定装备的情况下
if @equip_actor.equip_fix?(@equip_window_right.index)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活物品窗口
@equip_window_right.active = false
@equip_item_window.active = true
@equip_item_window.index = 0
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (物品窗口被激活的情况下)
#--------------------------------------------------------------------------
def equip_update_item
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 激活右侧窗口
@equip_window_right.active = true
@equip_item_window.active = false
@equip_item_window.index = -1
return
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 获取物品窗口现在选择的装备数据
item = @equip_item_window.item
@equip_acotr_index = @equip_actor_window.index
@equip_actor = $game_party.actors[@equip_acotr_index]
@equip_item_window.set_actor(@equip_actor)
if item != nil
unless $game_party.item_can_equip?(@equip_actor,item)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
else
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 变更装备
@equip_actor.equip(@equip_window_right.index, item == nil ? 0 : item.id)
# 激活右侧窗口
@equip_window_right.active = true
@equip_item_window.active = false
@equip_item_window.index = -1
# 再生成右侧窗口、物品窗口的内容
@equip_window_right.refresh
@equip_item_window.refresh
return
end
else
# 演奏装备 SE
$game_system.se_play($data_system.equip_se)
# 变更装备
@equip_actor.equip(@equip_window_right.index, item == nil ? 0 : item.id)
# 激活右侧窗口
@equip_window_right.active = true
@equip_item_window.active = false
@equip_item_window.index = -1
# 再生成右侧窗口、物品窗口的内容
@equip_window_right.refresh
@equip_item_window.refresh
return
end
end
end
end
|
|