赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 1 |
经验 | 315 |
最后登录 | 2013-1-15 |
在线时间 | 9 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 9 小时
- 注册时间
- 2012-4-9
- 帖子
- 9
|
#--------------------------------------------------------------------------
def terminate
super
dispose_menu_background
@help_window.dispose
@equip_window.dispose
@status_window.dispose
dispose_item_windows
end
#--------------------------------------------------------------------------
# ● 回到原画面
#--------------------------------------------------------------------------
def return_scene
$scene = Scene_Menu.new(2)
end
#--------------------------------------------------------------------------
# ● 切换至下一角色画面
#--------------------------------------------------------------------------
def next_actor
@actor_index += 1
@actor_index %= $game_party.members.size
$scene = Scene_Equip.new(@actor_index, @equip_window.index)
end
#--------------------------------------------------------------------------
# ● 切换至上一角色画面
#--------------------------------------------------------------------------
def prev_actor
@actor_index += $game_party.members.size - 1
@actor_index %= $game_party.members.size
$scene = Scene_Equip.new(@actor_index, @equip_window.index)
end
#--------------------------------------------------------------------------
# ● 更新画面
#--------------------------------------------------------------------------
def update
super
update_menu_background
@help_window.update
update_equip_window
update_status_window
update_item_windows
if @equip_window.active
update_equip_selection
elsif @item_window.active
update_item_selection
end
end
#--------------------------------------------------------------------------
# ● 生成装备物品窗口
#--------------------------------------------------------------------------
def create_item_windows
@item_windows = []
for i in 0...EQUIP_TYPE_MAX
@item_windows[i] = Window_EquipItem.new(0, 184, 544, 232, @actor, i)
@item_windows[i].help_window = @help_window
@item_windows[i].visible = (@equip_index == i)
@item_windows[i].y = 232
@item_windows[i].height = 184
@item_windows[i].active = false
@item_windows[i].index = -1
end
end
#--------------------------------------------------------------------------
# ● 释放装备物品窗口
#--------------------------------------------------------------------------
def dispose_item_windows
for window in @item_windows
window.dispose
end
end
#--------------------------------------------------------------------------
# ● 更新装备物品窗口
#--------------------------------------------------------------------------
def update_item_windows
for i in 0...EQUIP_TYPE_MAX
@item_windows[i].visible = (@equip_window.index == i)
@item_windows[i].update
end
@item_window = @item_windows[@equip_window.index]
end
#--------------------------------------------------------------------------
# ● 更新装备窗口
#--------------------------------------------------------------------------
def update_equip_window
@equip_window.update
end
#--------------------------------------------------------------------------
# ● 更新状态窗口
#--------------------------------------------------------------------------
def update_status_window
if @equip_window.active
@status_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
elsif @item_window.active
temp_actor = @actor.clone
temp_actor.change_equip(@equip_window.index, @item_window.item, true)
new_atk = temp_actor.atk
new_def = temp_actor.def
new_spi = temp_actor.spi
new_agi = temp_actor.agi
new_mdef = temp_actor.mdef
new_hit = temp_actor.hit
new_eva = temp_actor.eva
new_cri = temp_actor.cri
@status_window.set_new_parameters(new_atk, new_def, new_spi, new_agi, new_mdef, new_hit, new_eva, new_cri)
end
@status_window.update
end
#--------------------------------------------------------------------------
# ● 更新装备区域选择
#--------------------------------------------------------------------------
def update_equip_selection
if Input.trigger?(Input::B)
Sound.play_cancel
return_scene
elsif Input.trigger?(Input::R)
Sound.play_cursor
next_actor
elsif Input.trigger?(Input::L)
Sound.play_cursor
prev_actor
elsif Input.trigger?(Input::C)
if @actor.fix_equipment
Sound.play_buzzer
else
Sound.play_decision
@equip_window.active = false
@item_window.active = true
@item_window.index = 0
end
end
end
#--------------------------------------------------------------------------
# ● 更新装备物品选择
#--------------------------------------------------------------------------
def update_item_selection
if Input.trigger?(Input::B)
Sound.play_cancel
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
elsif Input.trigger?(Input::C)
Sound.play_equip
@actor.change_equip(@equip_window.index, @item_window.item)
@equip_window.active = true
@item_window.active = false
@item_window.index = -1
@equip_window.refresh
for item_window in @item_windows
item_window.refresh
end
end
end
end
#==============================================================================
# ■ Window_EquipStatus
#------------------------------------------------------------------------------
# 装备画面的、显示角色能力值变化的窗口。
#==============================================================================
class Window_EquipStatus < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
# ● 初始化对像
# x : 窗口 X 座标
# y : 窗口 Y 座标
# actor : 角色
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y-58, 208, WLH * 9 + 18)
@actor = actor
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
draw_actor_name(@actor, 4, -3)
draw_parameter(0, WLH * 1, 0)
draw_parameter(0, WLH * 2, 1)
draw_parameter(0, WLH * 3, 2)
draw_parameter(0, WLH * 4, 3)
draw_parameter(0, WLH * 5, 4)
draw_parameter(0, WLH * 6, 5)
draw_parameter(0, WLH * 7, 6)
draw_parameter(0, WLH * 8, 7)
end
#--------------------------------------------------------------------------
# ● 设置装备後的能力值
# new_atk : 装备後的攻击力
# new_def : 装备後的防御力
# new_spi : 装备後的精神力
# new_agi : 装备後的敏捷
#--------------------------------------------------------------------------
def set_new_parameters(new_atk, new_def, new_spi, new_agi, new_mdef, new_hit, new_eva, new_cri)
if @new_atk != new_atk or @new_def != new_def or
@new_spi != new_spi or @new_agi != new_agi or
@new_mdef != new_mdef or @new_hit != new_hit or
@new_eva != new_eva or @new_cri != new_cri
@new_atk = new_atk
@new_def = new_def
@new_spi = new_spi
@new_agi = new_agi
@new_mdef = new_mdef
@new_hit = new_hit
@new_eva = new_eva
@new_cri = new_cri
refresh
end
end
#--------------------------------------------------------------------------
# ● 获取装备後的能力值文字颜色
# old_value : 装备前的能力值
# new_value : 装备後的能力值
#--------------------------------------------------------------------------
def new_parameter_color(old_value, new_value)
if new_value > old_value # 增强
return power_up_color
elsif new_value == old_value # 不变
return normal_color
else # 减弱
return power_down_color
end
end
#--------------------------------------------------------------------------
# ● 绘制能力值
# x : 绘制点 X 座标
# y : 绘制点 Y 座标
# type : 能力值 (0:攻击力、1:防御力、2:精神力、3:敏捷)
#--------------------------------------------------------------------------
def draw_parameter(x, y, type)
case type
when 0
name = Vocab::atk
value = @actor.atk
new_value = @new_atk
when 1
name = Vocab::def
value = @actor.def
new_value = @new_def
when 2
name = Vocab::spi
value = @actor.spi
new_value = @new_spi
when 4
name = Vocab::agi
value = @actor.agi
new_value = @new_agi
when 3
name = "魔防"
value = @actor.mdef
new_value = @new_mdef
when 5
name = "命中"
value = @actor.hit
new_value = @new_hit
when 6
name = "回避"
value = @actor.eva
new_value = @new_eva
when 7
name = "暴击"
value = @actor.cri
new_value = @new_cri
end
self.contents.font.color = system_color
self.contents.draw_text(x + 4, y-10, 80, WLH, name)
self.contents.font.color = normal_color
self.contents.draw_text(x + 90, y-10, 30, WLH, value, 2)
self.contents.font.color = system_color
self.contents.draw_text(x + 122, y-10, 20, WLH, ">", 1)
if new_value != nil
self.contents.font.color = new_parameter_color(value, new_value)
self.contents.draw_text(x + 142, y-11, 30, WLH, new_value, 2)
end
end
end
#==============================================================================
# ■ Window_Equip
#------------------------------------------------------------------------------
# 装备画面、显示角色现在装备的物品的窗口。
#==============================================================================
class Window_Equip < Window_Selectable
#--------------------------------------------------------------------------
# ● 初始化对像
# x : 窗口 X 座标
# y : 窗口 Y 座标
# actor : 角色
#--------------------------------------------------------------------------
def initialize(x, y, actor)
super(x, y-58, 336, WLH * 9 + 18)
@actor = actor
refresh
self.index = 0
end
end
不知道是不 |
|