赞 | 4 |
VIP | 0 |
好人卡 | 0 |
积分 | 78 |
经验 | 15725 |
最后登录 | 2024-11-21 |
在线时间 | 1343 小时 |
Lv4.逐梦者
- 梦石
- 0
- 星屑
- 7802
- 在线时间
- 1343 小时
- 注册时间
- 2015-8-15
- 帖子
- 752
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 金芒芒 于 2024-4-18 09:05 编辑
第一个脚本精灵不能显示第二脚本的装备属性内容了
#============================================================================== # 〓 套装 〓 <显示> Author : 芯☆淡茹水 #============================================================================== # 套装说明窗口 #============================================================================== class Suit_Help < Sprite #-------------------------------------------------------------------------- attr_reader :actor_index, :suit_id #-------------------------------------------------------------------------- # 初始化 #-------------------------------------------------------------------------- def initialize(actor_index) super() @actor_index = actor_index @suit_id = 0 @contents = Sprite.new @help_width = XdRs_Suit::Help_Width hide end #-------------------------------------------------------------------------- # 释放 #-------------------------------------------------------------------------- def dispose dispose_bitmap @contents.dispose super end #-------------------------------------------------------------------------- # 释放位图 #-------------------------------------------------------------------------- def dispose_bitmap @contents.bitmap && @contents.bitmap.dispose self.bitmap && self.bitmap.dispose end #-------------------------------------------------------------------------- # 隐藏 #-------------------------------------------------------------------------- def hide; self.visible = @contents.visible = false; end #-------------------------------------------------------------------------- # 显示 #-------------------------------------------------------------------------- def show; self.visible = @contents.visible = true; end #-------------------------------------------------------------------------- # 角色实例 #-------------------------------------------------------------------------- def actor; return $game_party.actors[@actor_index]; end #-------------------------------------------------------------------------- # 设置角色索引 #-------------------------------------------------------------------------- def set_actor(index);@actor_index != index && refresh(index, @suit_id);end #-------------------------------------------------------------------------- # 设置套装ID #-------------------------------------------------------------------------- def set_suit_id(id); @suit_id != id && refresh(@actor_index, id); end #-------------------------------------------------------------------------- # 设置位置 #-------------------------------------------------------------------------- def set_place(x, y) gw = XdRs_Suit::Graphics_Width gh = XdRs_Suit::Graphics_Height x = self.bitmap ? [[0, x].max, gw - self.bitmap.width].min : x y = self.bitmap ? [[0, y].max, gh - self.bitmap.height].min : y self.x = @contents.x = x self.y = @contents.y = y self.z = 998; @contents.z = 999 end #-------------------------------------------------------------------------- # 刷新 #-------------------------------------------------------------------------- def refresh(index, id) hide @actor_index = index @suit_id = id return if !actor || @suit_id == 0 setup_effects recreate_image draw_all show end #-------------------------------------------------------------------------- # 设置套装效果 #-------------------------------------------------------------------------- def setup_effects @effect = Suit_Effect.new(@suit_id, actor.suit_num(@suit_id)) @all_equips = XdRs_Suit.suits(@suit_id) @words = [] (@all_equips.size-1).times{|i| @words.push(@effect.words(i))} @words = @words.find_all{|w| w != ""} @all_equips = XdRs_Suit.suits(@suit_id) end #-------------------------------------------------------------------------- # 重新生成图像 #-------------------------------------------------------------------------- def recreate_image dispose_bitmap height = height_count self.bitmap = Bitmap.new(@help_width, height) @contents.bitmap = Bitmap.new(@help_width, height) @contents.bitmap.font.bold = true end #-------------------------------------------------------------------------- # 高度计算 #-------------------------------------------------------------------------- def height_count height = 100 @words.each do |w| height += [w.size, 1].max * 22 + 22 end return height + @all_equips.size * 22 end #-------------------------------------------------------------------------- # 设置文字颜色 #-------------------------------------------------------------------------- def set_font_color(color) @contents.bitmap.font.color = color end #-------------------------------------------------------------------------- # 描绘文字 #-------------------------------------------------------------------------- def draw_text(x, y, w, h, text, a=0) last_color = @contents.bitmap.font.color.clone ow = XdRs_Suit.out_line_width set_font_color(Color.new(0,0,0,160)) @contents.bitmap.draw_text(x+ow, y, w, h, text, a) @contents.bitmap.draw_text(x-ow, y, w, h, text, a) @contents.bitmap.draw_text(x, y+ow, w, h, text, a) @contents.bitmap.draw_text(x, y-ow, w, h, text, a) @contents.bitmap.draw_text(x+ow, y+ow, w, h, text, a) @contents.bitmap.draw_text(x-ow, y-ow, w, h, text, a) set_font_color(last_color) @contents.bitmap.draw_text(x, y, w, h, text, a) end #-------------------------------------------------------------------------- # 描绘所有内容 #-------------------------------------------------------------------------- def draw_all draw_bg draw_words end #-------------------------------------------------------------------------- # 描绘背景 #-------------------------------------------------------------------------- def draw_bg color = XdRs_Suit.get_color(0) color.alpha = 10 x = y = 0; w = self.bitmap.width; h = self.bitmap.height 5.times do |i| self.bitmap.fill_rect(x,y,w,h,color) color.alpha += 30 x+=1;y+=1;w-=2;h-=2 end self.bitmap.fill_rect(5,7,@help_width-10,30,XdRs_Suit.get_color(3)) end #-------------------------------------------------------------------------- # 描绘效果语言文本 #-------------------------------------------------------------------------- def draw_words return if !actor || @suit_id == 0 || !@contents.bitmap @contents.bitmap.clear y = 10 @contents.bitmap.font.size = 20 set_font_color(XdRs_Suit.get_color(1)) text = XdRs_Suit::Tit_Word.gsub("\name", @effect.name) draw_text(0, y, @help_width, 24, text, 1) y += 28 set_font_color(XdRs_Suit.get_color(3)) @contents.bitmap.font.size = 16 draw_text(0, y, @help_width, 20, XdRs_Suit.suit_num_text(@suit_id, actor), 1) y += 24 size = @all_equips.size - 1 size.times{|i| y = draw_stage(i, y)} y += 10 @all_equips.size.times do |i| draw_equip(@all_equips[i], y+i*22) end end #-------------------------------------------------------------------------- # 检查角色件数阶段是否激活效果 #-------------------------------------------------------------------------- def is_act?(num, n) return (num - 2 - n) >= 0 end #-------------------------------------------------------------------------- # 描绘件数阶段效果 #-------------------------------------------------------------------------- def draw_stage(index, y) num = actor.suit_num(@suit_id) set_font_color(XdRs_Suit.get_color(is_act?(num, index) ? 2 : 4)) a = ["天书坎","天书坤","天书震","天书巽","天书中宫""天书乾"][index] draw_text(0, y, @help_width, 20, a, 1) # draw_text(0, y, @help_width, 20, "装备 #{index+2} 件", 1) y += 22 word = @words[index] if (word.size == 0) set_font_color(XdRs_Suit.get_color(4)) draw_text(0, y, @help_width, 20, "(无)", 1) y += 20 else set_font_color(XdRs_Suit.get_color(is_act?(num, index) ? 3 : 4)) word.each do |e| e == "" && next draw_text(0, y, @help_width, 20, e, 1) y += 20 end end return y + 10 end #-------------------------------------------------------------------------- # 描绘装备 #-------------------------------------------------------------------------- def draw_equip(equip, y) set_font_color(XdRs_Suit.get_color(actor.is_equiped?(equip) ? 3 : 4)) cw = @contents.bitmap.text_size(equip.name).width + 4 x = (@help_width - cw - 24) / 2 bitmap = RPG::Cache.icon(equip.icon_name) size = XdRs_Suit::Icon_Size rect1 = Rect.new(x, y, 20, 20) rect2 = Rect.new(0, 0, size, size) @contents.bitmap.stretch_blt(rect1, bitmap, rect2) draw_text(x+24, y+3, cw, 20, equip.name) end end #============================================================================== class Scene_Equip #-------------------------------------------------------------------------- # 更改主程序 #-------------------------------------------------------------------------- alias xdrs_suit_main main def main @suit_help = Suit_Help.new(@actor_index) xdrs_suit_main @suit_help.dispose end #-------------------------------------------------------------------------- # 更改刷新 #-------------------------------------------------------------------------- alias xdrs_suit_update update def update update_suit_help xdrs_suit_update end #-------------------------------------------------------------------------- # 刷新套装说明窗口 #-------------------------------------------------------------------------- def update_suit_help @suit_help.set_actor(@actor.index) if @right_window.active equip = @right_window.item elsif @item_window.active equip = @item_window.item end @suit_help.set_suit_id(XdRs_Suit.suit_id(equip)) update_place end #-------------------------------------------------------------------------- # 刷新套装说明窗口位置 #-------------------------------------------------------------------------- def update_place return unless @suit_help.visible if @right_window.active x = @right_window.x - XdRs_Suit::Help_Width y = @right_window.index * 32 + @right_window.y elsif @item_window.active index = @item_window.index x = @item_window.x + (index+1) % 2 * @item_window.width / 2 y = @item_window.y + index / 2 * 32 end @suit_help.set_place(x, y) end #-------------------------------------------------------------------------- # 更改刷新项目 #-------------------------------------------------------------------------- alias xdrs_suit_update_item update_item def update_item xdrs_suit_update_item Input.trigger?(Input::C) && @suit_help.draw_words end end
#==============================================================================
# 〓 套装 〓 <显示> Author : 芯☆淡茹水
#==============================================================================
# 套装说明窗口
#==============================================================================
class Suit_Help < Sprite
#--------------------------------------------------------------------------
attr_reader :actor_index, :suit_id
#--------------------------------------------------------------------------
# 初始化
#--------------------------------------------------------------------------
def initialize(actor_index)
super()
@actor_index = actor_index
@suit_id = 0
@contents = Sprite.new
@help_width = XdRs_Suit::Help_Width
hide
end
#--------------------------------------------------------------------------
# 释放
#--------------------------------------------------------------------------
def dispose
dispose_bitmap
@contents.dispose
super
end
#--------------------------------------------------------------------------
# 释放位图
#--------------------------------------------------------------------------
def dispose_bitmap
@contents.bitmap && @contents.bitmap.dispose
self.bitmap && self.bitmap.dispose
end
#--------------------------------------------------------------------------
# 隐藏
#--------------------------------------------------------------------------
def hide; self.visible = @contents.visible = false; end
#--------------------------------------------------------------------------
# 显示
#--------------------------------------------------------------------------
def show; self.visible = @contents.visible = true; end
#--------------------------------------------------------------------------
# 角色实例
#--------------------------------------------------------------------------
def actor; return $game_party.actors[@actor_index]; end
#--------------------------------------------------------------------------
# 设置角色索引
#--------------------------------------------------------------------------
def set_actor(index);@actor_index != index && refresh(index, @suit_id);end
#--------------------------------------------------------------------------
# 设置套装ID
#--------------------------------------------------------------------------
def set_suit_id(id); @suit_id != id && refresh(@actor_index, id); end
#--------------------------------------------------------------------------
# 设置位置
#--------------------------------------------------------------------------
def set_place(x, y)
gw = XdRs_Suit::Graphics_Width
gh = XdRs_Suit::Graphics_Height
x = self.bitmap ? [[0, x].max, gw - self.bitmap.width].min : x
y = self.bitmap ? [[0, y].max, gh - self.bitmap.height].min : y
self.x = @contents.x = x
self.y = @contents.y = y
self.z = 998; @contents.z = 999
end
#--------------------------------------------------------------------------
# 刷新
#--------------------------------------------------------------------------
def refresh(index, id)
hide
@actor_index = index
@suit_id = id
return if !actor || @suit_id == 0
setup_effects
recreate_image
draw_all
show
end
#--------------------------------------------------------------------------
# 设置套装效果
#--------------------------------------------------------------------------
def setup_effects
@effect = Suit_Effect.new(@suit_id, actor.suit_num(@suit_id))
@all_equips = XdRs_Suit.suits(@suit_id)
@words = []
(@all_equips.size-1).times{|i| @words.push(@effect.words(i))}
@words = @words.find_all{|w| w != ""}
@all_equips = XdRs_Suit.suits(@suit_id)
end
#--------------------------------------------------------------------------
# 重新生成图像
#--------------------------------------------------------------------------
def recreate_image
dispose_bitmap
height = height_count
self.bitmap = Bitmap.new(@help_width, height)
@contents.bitmap = Bitmap.new(@help_width, height)
@contents.bitmap.font.bold = true
end
#--------------------------------------------------------------------------
# 高度计算
#--------------------------------------------------------------------------
def height_count
height = 100
@words.each do |w|
height += [w.size, 1].max * 22 + 22
end
return height + @all_equips.size * 22
end
#--------------------------------------------------------------------------
# 设置文字颜色
#--------------------------------------------------------------------------
def set_font_color(color)
@contents.bitmap.font.color = color
end
#--------------------------------------------------------------------------
# 描绘文字
#--------------------------------------------------------------------------
def draw_text(x, y, w, h, text, a=0)
last_color = @contents.bitmap.font.color.clone
ow = XdRs_Suit.out_line_width
set_font_color(Color.new(0,0,0,160))
@contents.bitmap.draw_text(x+ow, y, w, h, text, a)
@contents.bitmap.draw_text(x-ow, y, w, h, text, a)
@contents.bitmap.draw_text(x, y+ow, w, h, text, a)
@contents.bitmap.draw_text(x, y-ow, w, h, text, a)
@contents.bitmap.draw_text(x+ow, y+ow, w, h, text, a)
@contents.bitmap.draw_text(x-ow, y-ow, w, h, text, a)
set_font_color(last_color)
@contents.bitmap.draw_text(x, y, w, h, text, a)
end
#--------------------------------------------------------------------------
# 描绘所有内容
#--------------------------------------------------------------------------
def draw_all
draw_bg
draw_words
end
#--------------------------------------------------------------------------
# 描绘背景
#--------------------------------------------------------------------------
def draw_bg
color = XdRs_Suit.get_color(0)
color.alpha = 10
x = y = 0; w = self.bitmap.width; h = self.bitmap.height
5.times do |i|
self.bitmap.fill_rect(x,y,w,h,color)
color.alpha += 30
x+=1;y+=1;w-=2;h-=2
end
self.bitmap.fill_rect(5,7,@help_width-10,30,XdRs_Suit.get_color(3))
end
#--------------------------------------------------------------------------
# 描绘效果语言文本
#--------------------------------------------------------------------------
def draw_words
return if !actor || @suit_id == 0 || !@contents.bitmap
@contents.bitmap.clear
y = 10
@contents.bitmap.font.size = 20
set_font_color(XdRs_Suit.get_color(1))
text = XdRs_Suit::Tit_Word.gsub("\name", @effect.name)
draw_text(0, y, @help_width, 24, text, 1)
y += 28
set_font_color(XdRs_Suit.get_color(3))
@contents.bitmap.font.size = 16
draw_text(0, y, @help_width, 20, XdRs_Suit.suit_num_text(@suit_id, actor), 1)
y += 24
size = @all_equips.size - 1
size.times{|i| y = draw_stage(i, y)}
y += 10
@all_equips.size.times do |i|
draw_equip(@all_equips[i], y+i*22)
end
end
#--------------------------------------------------------------------------
# 检查角色件数阶段是否激活效果
#--------------------------------------------------------------------------
def is_act?(num, n)
return (num - 2 - n) >= 0
end
#--------------------------------------------------------------------------
# 描绘件数阶段效果
#--------------------------------------------------------------------------
def draw_stage(index, y)
num = actor.suit_num(@suit_id)
set_font_color(XdRs_Suit.get_color(is_act?(num, index) ? 2 : 4))
a = ["天书坎","天书坤","天书震","天书巽","天书中宫""天书乾"][index]
draw_text(0, y, @help_width, 20, a, 1)
# draw_text(0, y, @help_width, 20, "装备 #{index+2} 件", 1)
y += 22
word = @words[index]
if (word.size == 0)
set_font_color(XdRs_Suit.get_color(4))
draw_text(0, y, @help_width, 20, "(无)", 1)
y += 20
else
set_font_color(XdRs_Suit.get_color(is_act?(num, index) ? 3 : 4))
word.each do |e|
e == "" && next
draw_text(0, y, @help_width, 20, e, 1)
y += 20
end
end
return y + 10
end
#--------------------------------------------------------------------------
# 描绘装备
#--------------------------------------------------------------------------
def draw_equip(equip, y)
set_font_color(XdRs_Suit.get_color(actor.is_equiped?(equip) ? 3 : 4))
cw = @contents.bitmap.text_size(equip.name).width + 4
x = (@help_width - cw - 24) / 2
bitmap = RPG::Cache.icon(equip.icon_name)
size = XdRs_Suit::Icon_Size
rect1 = Rect.new(x, y, 20, 20)
rect2 = Rect.new(0, 0, size, size)
@contents.bitmap.stretch_blt(rect1, bitmap, rect2)
draw_text(x+24, y+3, cw, 20, equip.name)
end
end
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# 更改主程序
#--------------------------------------------------------------------------
alias xdrs_suit_main main
def main
@suit_help = Suit_Help.new(@actor_index)
xdrs_suit_main
@suit_help.dispose
end
#--------------------------------------------------------------------------
# 更改刷新
#--------------------------------------------------------------------------
alias xdrs_suit_update update
def update
update_suit_help
xdrs_suit_update
end
#--------------------------------------------------------------------------
# 刷新套装说明窗口
#--------------------------------------------------------------------------
def update_suit_help
@suit_help.set_actor(@actor.index)
if @right_window.active
equip = @right_window.item
elsif @item_window.active
equip = @item_window.item
end
@suit_help.set_suit_id(XdRs_Suit.suit_id(equip))
update_place
end
#--------------------------------------------------------------------------
# 刷新套装说明窗口位置
#--------------------------------------------------------------------------
def update_place
return unless @suit_help.visible
if @right_window.active
x = @right_window.x - XdRs_Suit::Help_Width
y = @right_window.index * 32 + @right_window.y
elsif @item_window.active
index = @item_window.index
x = @item_window.x + (index+1) % 2 * @item_window.width / 2
y = @item_window.y + index / 2 * 32
end
@suit_help.set_place(x, y)
end
#--------------------------------------------------------------------------
# 更改刷新项目
#--------------------------------------------------------------------------
alias xdrs_suit_update_item update_item
def update_item
xdrs_suit_update_item
Input.trigger?(Input::C) && @suit_help.draw_words
end
end
#============================================================================== # ■ Scene_Equip #------------------------------------------------------------------------------ # 处理装备画面的类。 #============================================================================== class Scene_Equip #-------------------------------------------------------------------------- # ● 初始化对像 # actor_index : 角色索引 # equip_index : 装备索引 #-------------------------------------------------------------------------- def initialize(actor_index = 0) @actor_index = actor_index end #-------------------------------------------------------------------------- # ● 主处理 #-------------------------------------------------------------------------- def main # 生成地图背景 @menuXiaoLiu_TransparentBackground = Spriteset_Map.new # 获取角色 @actor = $game_party.actors[@actor_index] @right_window = Window_EquipRight.new(@actor)#右边窗口= @right_window.set_new_parameters(nil) @item_window1 = Window_EquipItem.new(@actor, 1) @item_window2 = Window_EquipItem.new(@actor, 0) @item_window3 = Window_EquipItem.new(@actor, 2) @item_window4 = Window_EquipItem.new(@actor, 4) @item_window5 = Window_EquipItem.new(@actor, 3) @item_window6 = Window_EquipItem.new(@actor, 5) @item_window7 = Window_EquipItem.new(@actor, 6) @menuXiaoLiu_HelpText = XiaoLiu_Window_HelpText.new @menuXiaoLiu_HelpText.set_text = "确认进入该选项 取消返回地图" @equipXiaoLiu_IndexCommand = XiaoLiu_Window_EquipCommand.new @item_window1.visible = true @item_window2.visible = false @item_window3.visible = false @item_window4.visible = false @item_window5.visible = false @item_window6.visible = false @item_window7.visible = false # 执行过渡 Graphics.transition # 主循环 loop do # 刷新游戏画面 Graphics.update # 刷新输入信息 Input.update # 刷新画面 update # 如果画面切换的话的就中断循环 if $scene != self break end end # 准备过渡 Graphics.freeze # 释放窗口 @right_window.dispose @item_window1.dispose @item_window2.dispose @item_window3.dispose @item_window4.dispose @item_window5.dispose @item_window6.dispose @item_window7.dispose @menuXiaoLiu_HelpText.dispose @equipXiaoLiu_IndexCommand.dispose @menuXiaoLiu_TransparentBackground.dispose end #-------------------------------------------------------------------------- # ● 刷新 #-------------------------------------------------------------------------- def refresh case @equipXiaoLiu_IndexCommand.index when 0 # 设置物品窗口的可视状态 @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) @item_window6.visible = false @item_window7.visible = false when 1 @item_window1.visible = false @item_window2.visible = false @item_window3.visible = false @item_window4.visible = false @item_window5.visible = false @item_window6.visible = true @item_window7.visible = false when 2 @item_window1.visible = false @item_window2.visible = false @item_window3.visible = false @item_window4.visible = false @item_window5.visible = false @item_window6.visible = false @item_window7.visible = true end # 获取当前装备中的物品 item1 = @right_window.item # 设置当前的物品窗口到 @item_window case @equipXiaoLiu_IndexCommand.index when 0 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 when 1 @item_window = @item_window6 when 2 @item_window = @item_window7 end # 右窗口被激活的情况下 if @right_window.active # 删除变更装备后的能力 @right_window.set_new_parameters(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 @nePar = [] @nePar.push(@actor.atk) @nePar.push(@actor.pdef) @nePar.push(@actor.mdef) @nePar.push(@actor.str) @nePar.push(@actor.dex) @nePar.push(@actor.agi) @nePar.push(@actor.int) # 返回到装备 @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id) @actor.hp = last_hp @actor.sp = last_sp # 描画左窗口 @right_window.set_new_parameters(@nePar) end end #-------------------------------------------------------------------------- # ● 刷新画面 #-------------------------------------------------------------------------- def update @equipXiaoLiu_IndexCommand.update # 右侧窗口被激活的情况下: 调用 update_right if @right_window.active update_right return end # 物品窗口被激活的情况下: 调用 update_item if @item_window != nil and @item_window.active update_item return end return xiaoliuUpdate_IndexCommand if @equipXiaoLiu_IndexCommand.active end def xiaoliuUpdate_IndexCommand @item_window1.visible = (@equipXiaoLiu_IndexCommand.index == 0) @item_window6.visible = (@equipXiaoLiu_IndexCommand.index == 1) @item_window7.visible = (@equipXiaoLiu_IndexCommand.index == 2) # 按下 R 键的情况下 if Input.trigger?(Input::R) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至下一位角色 @actor_index += 1 @actor_index %= $game_party.actors.size # 切换到别的装备画面 $scene = Scene_Equip.new(@actor_index) return end # 按下 L 键的情况下 if Input.trigger?(Input::L) # 演奏光标 SE $game_system.se_play($data_system.cursor_se) # 移至上一位角色 @actor_index += $game_party.actors.size - 1 @actor_index %= $game_party.actors.size # 切换到别的装备画面 $scene = Scene_Equip.new(@actor_index) return end # 按下 B 键的情况下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) # 切换到菜单画面 $scene = Scene_Menu.new(2) return end if Input.trigger?(Input::C) $game_system.se_play($data_system.decision_se) @equipXiaoLiu_IndexCommand.active = false @right_window.active = true @right_window.index = 0 return end end #-------------------------------------------------------------------------- # ● 刷新画面 (右侧窗口被激活的情况下) #-------------------------------------------------------------------------- def update_right refresh @right_window.update @right_window.set_index = @equipXiaoLiu_IndexCommand.index # 按下 B 键的情况下 if Input.trigger?(Input::B) # 演奏取消 SE $game_system.se_play($data_system.cancel_se) @equipXiaoLiu_IndexCommand.active = true @right_window.active = false @right_window.index = -1 @item_window2.visible = false @item_window3.visible = false @item_window4.visible = false @item_window5.visible = false return end if Input.trigger?(Input::X) p @right_window.index end # 按下 C 键的情况下 if Input.trigger?(Input::C) # 固定装备的情况下 if @actor.equip_fix?(@right_window.index) # 演奏冻结 SE $game_system.se_play($data_system.buzzer_se) return end # 演奏确定 SE $game_system.se_play($data_system.decision_se) # 激活物品窗口 @right_window.active = false @item_window.active = true @item_window.index = 0 return end end #-------------------------------------------------------------------------- # ● 刷新画面 (物品窗口被激活的情况下) #-------------------------------------------------------------------------- def update_item refresh @item_window.update # 按下 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) $game_system.se_play($data_system.equip_se) case @equipXiaoLiu_IndexCommand.index when 0 item = @item_window.item @actor.equip(@right_window.index, item == nil ? 0 : item.id) when 1 item_rune = @item_window.item case @right_window.index when 0 # 符文1槽 body_rune = @actor.rune1 $game_party.gain_item(body_rune.id, 1) if body_rune != nil @actor.rune1 = item_rune $game_party.lose_item(item_rune.id, 1) when 1 # 符文2槽 body_rune = @actor.rune2 $game_party.gain_item(body_rune.id, 1) if body_rune != nil @actor.rune2 = item_rune $game_party.lose_item(item_rune.id, 1) when 2 # 符文3槽 body_rune = @actor.rune3 $game_party.gain_item(body_rune.id, 1) if body_rune != nil @actor.rune3 = item_rune $game_party.lose_item(item_rune.id, 1) end when 2 item_stone = @item_window.item case @right_window.index when 0 # 宝石1槽 body_stone = @actor.stone1 $game_party.gain_item(body_stone.id, 1) if body_stone != nil @actor.stone1 = item_stone $game_party.lose_item(body_stone.id, 1) when 1 # 宝石2槽 body_stone = @actor.stone2 $game_party.gain_item(body_stone.id, 1) if body_stone != nil @actor.stone2 = item_stone $game_party.lose_item(body_stone.id, 1) when 2 # 宝石3槽 body_stone = @actor.stone3 $game_party.gain_item(body_stone.id, 1) if body_stone != nil @actor.stone3 = item_stone $game_party.lose_item(body_stone.id, 1) when 3 # 宝石4槽 body_stone = @actor.stone4 $game_party.gain_item(body_stone.id, 1) if body_stone != nil @actor.stone4 = item_stone $game_party.lose_item(body_stone.id, 1) when 4 # 宝石5槽 body_stone = @actor.stone5 $game_party.gain_item(body_stone.id, 1) if body_stone != nil @actor.stone5 = item_stone $game_party.lose_item(body_stone.id, 1) when 5 # 宝石6槽 body_stone = @actor.stone6 $game_party.gain_item(body_stone.id, 1) if body_stone != nil @actor.stone6 = item_stone $game_party.lose_item(body_stone.id, 1) end end @right_window.active = true @item_window.active = false @item_window.index = -1 @right_window.refresh @item_window.refresh return end end end
#==============================================================================
# ■ Scene_Equip
#------------------------------------------------------------------------------
# 处理装备画面的类。
#==============================================================================
class Scene_Equip
#--------------------------------------------------------------------------
# ● 初始化对像
# actor_index : 角色索引
# equip_index : 装备索引
#--------------------------------------------------------------------------
def initialize(actor_index = 0)
@actor_index = actor_index
end
#--------------------------------------------------------------------------
# ● 主处理
#--------------------------------------------------------------------------
def main
# 生成地图背景
@menuXiaoLiu_TransparentBackground = Spriteset_Map.new
# 获取角色
@actor = $game_party.actors[@actor_index]
@right_window = Window_EquipRight.new(@actor)#右边窗口=
@right_window.set_new_parameters(nil)
@item_window1 = Window_EquipItem.new(@actor, 1)
@item_window2 = Window_EquipItem.new(@actor, 0)
@item_window3 = Window_EquipItem.new(@actor, 2)
@item_window4 = Window_EquipItem.new(@actor, 4)
@item_window5 = Window_EquipItem.new(@actor, 3)
@item_window6 = Window_EquipItem.new(@actor, 5)
@item_window7 = Window_EquipItem.new(@actor, 6)
@menuXiaoLiu_HelpText = XiaoLiu_Window_HelpText.new
@menuXiaoLiu_HelpText.set_text = "确认进入该选项 取消返回地图"
@equipXiaoLiu_IndexCommand = XiaoLiu_Window_EquipCommand.new
@item_window1.visible = true
@item_window2.visible = false
@item_window3.visible = false
@item_window4.visible = false
@item_window5.visible = false
@item_window6.visible = false
@item_window7.visible = false
# 执行过渡
Graphics.transition
# 主循环
loop do
# 刷新游戏画面
Graphics.update
# 刷新输入信息
Input.update
# 刷新画面
update
# 如果画面切换的话的就中断循环
if $scene != self
break
end
end
# 准备过渡
Graphics.freeze
# 释放窗口
@right_window.dispose
@item_window1.dispose
@item_window2.dispose
@item_window3.dispose
@item_window4.dispose
@item_window5.dispose
@item_window6.dispose
@item_window7.dispose
@menuXiaoLiu_HelpText.dispose
@equipXiaoLiu_IndexCommand.dispose
@menuXiaoLiu_TransparentBackground.dispose
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh
case @equipXiaoLiu_IndexCommand.index
when 0
# 设置物品窗口的可视状态
@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)
@item_window6.visible = false
@item_window7.visible = false
when 1
@item_window1.visible = false
@item_window2.visible = false
@item_window3.visible = false
@item_window4.visible = false
@item_window5.visible = false
@item_window6.visible = true
@item_window7.visible = false
when 2
@item_window1.visible = false
@item_window2.visible = false
@item_window3.visible = false
@item_window4.visible = false
@item_window5.visible = false
@item_window6.visible = false
@item_window7.visible = true
end
# 获取当前装备中的物品
item1 = @right_window.item
# 设置当前的物品窗口到 @item_window
case @equipXiaoLiu_IndexCommand.index
when 0
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
when 1
@item_window = @item_window6
when 2
@item_window = @item_window7
end
# 右窗口被激活的情况下
if @right_window.active
# 删除变更装备后的能力
@right_window.set_new_parameters(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
@nePar = []
@nePar.push(@actor.atk)
@nePar.push(@actor.pdef)
@nePar.push(@actor.mdef)
@nePar.push(@actor.str)
@nePar.push(@actor.dex)
@nePar.push(@actor.agi)
@nePar.push(@actor.int)
# 返回到装备
@actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
@actor.hp = last_hp
@actor.sp = last_sp
# 描画左窗口
@right_window.set_new_parameters(@nePar)
end
end
#--------------------------------------------------------------------------
# ● 刷新画面
#--------------------------------------------------------------------------
def update
@equipXiaoLiu_IndexCommand.update
# 右侧窗口被激活的情况下: 调用 update_right
if @right_window.active
update_right
return
end
# 物品窗口被激活的情况下: 调用 update_item
if @item_window != nil and @item_window.active
update_item
return
end
return xiaoliuUpdate_IndexCommand if @equipXiaoLiu_IndexCommand.active
end
def xiaoliuUpdate_IndexCommand
@item_window1.visible = (@equipXiaoLiu_IndexCommand.index == 0)
@item_window6.visible = (@equipXiaoLiu_IndexCommand.index == 1)
@item_window7.visible = (@equipXiaoLiu_IndexCommand.index == 2)
# 按下 R 键的情况下
if Input.trigger?(Input::R)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至下一位角色
@actor_index += 1
@actor_index %= $game_party.actors.size
# 切换到别的装备画面
$scene = Scene_Equip.new(@actor_index)
return
end
# 按下 L 键的情况下
if Input.trigger?(Input::L)
# 演奏光标 SE
$game_system.se_play($data_system.cursor_se)
# 移至上一位角色
@actor_index += $game_party.actors.size - 1
@actor_index %= $game_party.actors.size
# 切换到别的装备画面
$scene = Scene_Equip.new(@actor_index)
return
end
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
# 切换到菜单画面
$scene = Scene_Menu.new(2)
return
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
@equipXiaoLiu_IndexCommand.active = false
@right_window.active = true
@right_window.index = 0
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (右侧窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_right
refresh
@right_window.update
@right_window.set_index = @equipXiaoLiu_IndexCommand.index
# 按下 B 键的情况下
if Input.trigger?(Input::B)
# 演奏取消 SE
$game_system.se_play($data_system.cancel_se)
@equipXiaoLiu_IndexCommand.active = true
@right_window.active = false
@right_window.index = -1
@item_window2.visible = false
@item_window3.visible = false
@item_window4.visible = false
@item_window5.visible = false
return
end
if Input.trigger?(Input::X)
p @right_window.index
end
# 按下 C 键的情况下
if Input.trigger?(Input::C)
# 固定装备的情况下
if @actor.equip_fix?(@right_window.index)
# 演奏冻结 SE
$game_system.se_play($data_system.buzzer_se)
return
end
# 演奏确定 SE
$game_system.se_play($data_system.decision_se)
# 激活物品窗口
@right_window.active = false
@item_window.active = true
@item_window.index = 0
return
end
end
#--------------------------------------------------------------------------
# ● 刷新画面 (物品窗口被激活的情况下)
#--------------------------------------------------------------------------
def update_item
refresh
@item_window.update
# 按下 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)
$game_system.se_play($data_system.equip_se)
case @equipXiaoLiu_IndexCommand.index
when 0
item = @item_window.item
@actor.equip(@right_window.index, item == nil ? 0 : item.id)
when 1
item_rune = @item_window.item
case @right_window.index
when 0 # 符文1槽
body_rune = @actor.rune1
$game_party.gain_item(body_rune.id, 1) if body_rune != nil
@actor.rune1 = item_rune
$game_party.lose_item(item_rune.id, 1)
when 1 # 符文2槽
body_rune = @actor.rune2
$game_party.gain_item(body_rune.id, 1) if body_rune != nil
@actor.rune2 = item_rune
$game_party.lose_item(item_rune.id, 1)
when 2 # 符文3槽
body_rune = @actor.rune3
$game_party.gain_item(body_rune.id, 1) if body_rune != nil
@actor.rune3 = item_rune
$game_party.lose_item(item_rune.id, 1)
end
when 2
item_stone = @item_window.item
case @right_window.index
when 0 # 宝石1槽
body_stone = @actor.stone1
$game_party.gain_item(body_stone.id, 1) if body_stone != nil
@actor.stone1 = item_stone
$game_party.lose_item(body_stone.id, 1)
when 1 # 宝石2槽
body_stone = @actor.stone2
$game_party.gain_item(body_stone.id, 1) if body_stone != nil
@actor.stone2 = item_stone
$game_party.lose_item(body_stone.id, 1)
when 2 # 宝石3槽
body_stone = @actor.stone3
$game_party.gain_item(body_stone.id, 1) if body_stone != nil
@actor.stone3 = item_stone
$game_party.lose_item(body_stone.id, 1)
when 3 # 宝石4槽
body_stone = @actor.stone4
$game_party.gain_item(body_stone.id, 1) if body_stone != nil
@actor.stone4 = item_stone
$game_party.lose_item(body_stone.id, 1)
when 4 # 宝石5槽
body_stone = @actor.stone5
$game_party.gain_item(body_stone.id, 1) if body_stone != nil
@actor.stone5 = item_stone
$game_party.lose_item(body_stone.id, 1)
when 5 # 宝石6槽
body_stone = @actor.stone6
$game_party.gain_item(body_stone.id, 1) if body_stone != nil
@actor.stone6 = item_stone
$game_party.lose_item(body_stone.id, 1)
end
end
@right_window.active = true
@item_window.active = false
@item_window.index = -1
@right_window.refresh
@item_window.refresh
return
end
end
end
|
|