赞 | 0 |
VIP | 0 |
好人卡 | 0 |
积分 | 3 |
经验 | 4624 |
最后登录 | 2018-4-17 |
在线时间 | 75 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 255
- 在线时间
- 75 小时
- 注册时间
- 2014-6-26
- 帖子
- 155
|
善用论坛搜索#==============================================================================
# 本脚本来自www.66rpg.com,转载和使用请保留此信息 #==============================================================================
module RPG
class Weapon
def name
name = @name.split(/@/)[0]
return name != nil ? name : ''
end
def pic_name
pic_name = @name.split(/@/)[1]
return pic_name != nil ? pic_name : ""
end
end
class Armor
def name
name = @name.split(/@/)[0]
return name != nil ? name : ''
end
def pic_name
pic_name = @name.split(/@/)[1]
return pic_name != nil ? pic_name : ""
end
end
end
#==============================================================================
# ■ Window_Equip
#------------------------------------------------------------------------------
# 装备物品大图标显示。
#==============================================================================
class Window_Equip < Window_Base
#--------------------------------------------------------------------------
# ● 初始化对像
#--------------------------------------------------------------------------
def initialize
super(500, 98, 640, 480)
@item = nil
self.contents = Bitmap.new(width - 32, height - 32)
self.opacity = 0
refresh
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
self.contents.clear
if @item != nil
bitmap = RPG::Cache.picture(@item.pic_name)
pic_rect = Rect.new(0, 0, bitmap.width, bitmap.height)
self.contents.blt(0, 0, bitmap, pic_rect)
end
end
def set_item(item)
@item = item
end
end
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
# 处理装备画面的类。
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 获取角色
@actor = $game_party.actors[@actor_index]
# 生成窗口
@help_window = Window_Help.new
@left_window = Window_EquipLeft.new(@actor)
@right_window = Window_EquipRight.new(@actor)
@item_window1 = Window_EquipItem.new(@actor, 0)
@item_window2 = Window_EquipItem.new(@actor, 1)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 3)
@item_window5 = Window_EquipItem.new(@actor, 4)
# 关联帮助窗口
@right_window.help_window = @help_window
@item_window1.help_window = @help_window
@item_window2.help_window = @help_window
@item_window3.help_window = @help_window
@item_window4.help_window = @help_window
@item_window5.help_window = @help_window
# 设置光标位置
@right_window.index = @equip_index
##############
@equip_window = Window_Equip.new
##############
refresh
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话的就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@help_window.dispose
@left_window.dispose
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
##############
@equip_window.dispose
##############
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
# 设置物品窗口的可视状态
@item_window1.visible = (@right_window.index == 0)
@item_window2.visible = (@right_window.index == 1)
@item_window3.visible = (@right_window.index == 2)
@item_window4.visible = (@right_window.index == 3)
@item_window5.visible = (@right_window.index == 4)
# 获取当前装备中的物品
item1 = @right_window.item
##############
@equip_window.set_item(item1)
##############
# 设置当前的物品窗口到 @item_window
case @right_window.index
when 0
@item_window = @item_window1
when 1
@item_window = @item_window2
when 2
@item_window = @item_window3
when 3
@item_window = @item_window4
when 4
@item_window = @item_window5
end
# 右窗口被激活的情况下
if @right_window.active
# 删除变更装备后的能力
@left_window.set_new_parameters(nil, nil, nil)
end
# 物品窗口被激活的情况下
if @item_window.active
# 获取现在选中的物品
item2 = @item_window.item
# 变更装备
last_hp = @actor.hp
last_sp = @actor.sp
@actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
# 获取变更装备后的能力值
new_atk = @actor.atk
new_pdef = @actor.pdef
new_mdef = @actor.mdef
# 返回到装备
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# 描画左窗口
@left_window.set_new_parameters(new_atk, new_pdef, new_mdef)
##################
@equip_window.set_item(item2)
##################
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
# 刷新窗口
@left_window.update
@right_window.update
@item_window.update
##############
@equip_window.refresh
##############
refresh
# 右侧窗口被激活的情况下: 调用 update_right
if @right_window.active
update_right
return
end
# 物品窗口被激活的情况下: 调用 update_item
if @item_window.active
update_item
return
end
end
end
#==============================================================================
# 本脚本来自www.66RPG.com,使用和转载请保留此信息
#============================================================================== |
评分
-
查看全部评分
|