赞 | 0 |
VIP | 5 |
好人卡 | 14 |
积分 | 15 |
经验 | 110639 |
最后登录 | 2015-10-15 |
在线时间 | 1157 小时 |
Lv3.寻梦者 小柯的徒弟
- 梦石
- 0
- 星屑
- 1535
- 在线时间
- 1157 小时
- 注册时间
- 2008-5-24
- 帖子
- 3085
|
插入到脚本"Scene_Menu(插件群集)"下面
- #==============================================================================
- # ■ Scene_Item
- #------------------------------------------------------------------------------
- # 处理物品画面的类。
- #==============================================================================
- class Scene_Item
- def initialize(index)
- @cmd_index = index
- end
-
- #——— 主处理 ————
- def main
- cmd = Window_Command_New.new($game_party.actors.size)
- cmd.index = @cmd_index
- cmd.active = false
- # 右边命令窗口
- @itemcommand_window = Window_ItemCommand.new
- @itemcommand_window.opacity = KKME::MENU_OPACITY
- @itemcommand_window.y = 672
-
- @flash_viewport_time = 0
- @flash_viewport = Viewport.new(453, 190, 142, 192)
- @flash_viewport.z = 9999
-
- @item_command_index = @itemcommand_window.index
- # 物品窗口
- @itemlist_window = Window_ItemList.new
- @itemlist_window.opacity = KKME::MENU_OPACITY
- @itemlist_window.active = false
- @itemlist_window.set_item(@item_command_index)
- @itemlist_window.x = -378
- # 帮助窗口
- @item_help_window = Window_Help_New.new
- @item_help_window.x = -580
- @item_help_window.y = 396
- @item_help_window.width = 417
- @item_help_window.opacity = KKME::MENU_OPACITY
- # 金钱窗口
- @gold_window = Window_Gold.new
- @gold_window.x = -420
- @gold_window.y = 396
- @gold_window.opacity = KKME::MENU_OPACITY
- # 关联帮助窗口
- @itemcommand_window.help_window = @item_help_window
- @itemlist_window.help_window = @item_help_window
- # 目标窗口
- @item_target_window = Window_Target.new
- @item_target_window.y = 480
- @item_target_window.opacity = KKME::MENU_OPACITY
- @item_target_window.visible = false
- @item_target_window.active = false
- # 目标装备窗口
- @item_target_window_equip = Window_Target_Equip.new
- @item_target_window_equip.y = 480
- @item_target_window_equip.opacity = KKME::MENU_OPACITY
- @item_target_window_equip.visible = false
- @item_target_window_equip.active = false
- #—— 主循环 ——
- Graphics.transition
- # 窗口的滑动
- for i in 1..8
- @item_help_window.x += 76
- @itemcommand_window.y -= 60
- @itemlist_window.x += 51
- @gold_window.x += 76
- if i == 8
- @item_help_window.x = 30
- @itemcommand_window.y = 190
- @itemlist_window.x = 30
- @gold_window.x = 470
- end
- Graphics.update
- end
-
- @flash_viewport_time = 20
- @flash_viewport.flash(Color.new(255,255,255,255),20)
-
- loop do
- Graphics.update
- Input.update
- # 更新item
- update_item_scene
- if $scene != self
- break
- end
- end
- #—— 释放窗口 ——
-
- # 窗口的滑动
- for i in 1..9
- @item_help_window.x -= 76
- @itemcommand_window.y += 60
- @itemlist_window.x -= 51
- @gold_window.x -= 76
- Graphics.update
- end
-
- Graphics.freeze
- cmd.dispose
- @itemcommand_window.dispose
- @itemlist_window.dispose
- @item_help_window.dispose
- @item_target_window.dispose
- @item_target_window_equip.dispose
- @flash_viewport.dispose
- @gold_window.dispose
- end
- #—— update的定义 ——
- def update_item_scene
- @itemcommand_window.update
- @itemlist_window.update
- @item_help_window.update
- @item_target_window.update
- @item_target_window_equip.update
-
-
- if @flash_viewport_time >0
- @flash_viewport_time -= 1
- @flash_viewport.update
- end
-
- if @item_command_index != @itemcommand_window.index
- @item_command_index = @itemcommand_window.index
- @itemlist_window.set_item(@item_command_index)
- end
-
- #—— 当某窗体在active的时候,更新之 ——
- if @itemcommand_window.active
- item_update_itemcommand
- return
- end
- if @itemlist_window.active
- item_update_itemlist
- return
- end
- if @item_target_window.active
- item_update_target
- return
- end
- if @item_target_window_equip.active
- item_update_target_equip
- return
- end
- end # update的
- #————具体更新定义————
- def item_update_itemcommand
-
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换到菜单画面
- $scene = Scene_Menu.new(@cmd_index)
- return
- end
-
- if Input.trigger?(Input::C)
- if @itemlist_window.item_number == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- @itemcommand_window.active = false
- @itemlist_window.active = true
- @itemlist_window.index = 0
- return
- end
- end
- #————具体更新定义————
- def item_update_itemlist
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @itemcommand_window.active = true
- @itemlist_window.active = false
- @itemlist_window.index = 0
- @itemcommand_window.index = @item_command_index
- return
- end
-
- if Input.trigger?(Input::C)
- @item = @itemlist_window.item
- if @item.is_a?(RPG::Item)
- unless $game_party.item_can_use?(@item.id)
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- $game_system.se_play($data_system.decision_se)
- if @item.scope >= 3
- @itemlist_window.active = false
- # 先打开目标窗口的显示,才开始滑动
- @item_target_window.visible = true
- @item_target_window.active = true
- for i in 1..8
- @item_target_window.y -= 39
- if i==8
- @item_target_window.y = 164
- end
- Graphics.update
- end
- if @item.scope == 4 || @item.scope == 6
- @item_target_window.index = -1
- else
- @item_target_window.index = 0
- end
- else
- if @item.common_event_id > 0
- $game_temp.common_event_id = @item.common_event_id
- $game_system.se_play(@item.menu_se)
- if @item.consumable
- $game_party.lose_item(@item.id, 1)
- @itemlist_window.draw_item(@itemlist_window.index)
- end
- $scene = Scene_Map.new
- return
- end
- end
- return
- else
- $game_system.se_play($data_system.decision_se)
- @itemlist_window.active = false
- @item_target_window_equip.set_item(@item)
- @item_target_window_equip.visible = true
- @item_target_window_equip.active = true
- for i in 1..8
- @item_target_window_equip.y -= 39
- if i==8
- @item_target_window_equip.y = 164
- end
- Graphics.update
- end
- @item_target_window_equip.index = 0
- return
- end
-
-
-
-
-
- end
- end
- def item_update_target_equip
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- @itemlist_window.active = true
- # 目标窗口滑动,滑动结束后才关闭显示
- for i in 1..9
- @item_target_window_equip.y += 39
- Graphics.update
- end
- @item_target_window_equip.visible = false
- @item_target_window_equip.active = false
- @itemlist_window.set_item(@item_command_index)
- return
- end
- if Input.trigger?(Input::C)
- target_actor = $game_party.actors[@item_target_window_equip.index]
- if target_actor.equippable?(@item) and $game_party.item_can_equip?(target_actor,@item)
- # 演奏装备 SE
- $game_system.se_play($data_system.equip_se)
- if @item.is_a?(RPG::Weapon)
- equip_position = 0
- elsif @item.kind == 0
- equip_position = 1
- elsif @item.kind == 1
- equip_position = 2
- elsif @item.kind == 2
- equip_position = 3
- elsif @item.kind == 3
- equip_position = 4
- end
-
- # 固定装备的情况下
- if target_actor.equip_fix?(equip_position)
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
-
- target_actor.equip(equip_position,@item.id)
-
- @itemlist_window.active = true
- # 目标窗口滑动,滑动结束后才关闭显示
- for i in 1..9
- @item_target_window_equip.y += 39
- Graphics.update
- end
- @item_target_window_equip.visible = false
- @item_target_window_equip.active = false
-
- @itemlist_window.draw_item(@itemlist_window.index)
- @itemlist_window.set_item(@item_command_index)
- else
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- end
-
-
-
- end
-
- end
-
- #———— 更新target窗口————
- def item_update_target
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- unless $game_party.item_can_use?(@item.id)
- @itemlist_window.refresh
- end
- @itemlist_window.active = true
- # 目标窗口滑动,滑动结束后才关闭显示
- for i in 1..9
- @item_target_window.y += 39
- Graphics.update
- end
- @item_target_window.visible = false
- @item_target_window.active = false
- @itemlist_window.set_item(@item_command_index)
- return
- end
- if Input.trigger?(Input::C)
- if $game_party.item_number(@item.id) == 0
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- if @item_target_window.index == -1
- used = false
- for i in $game_party.actors
- used |= i.item_effect(@item)
- end
- end
- if @item_target_window.index >= 0
- target = $game_party.actors[@item_target_window.index]
- used = target.item_effect(@item)
- end
-
- if used
- $game_system.se_play(@item.menu_se)
- if @item.consumable
- $game_party.lose_item(@item.id, 1)
- @itemlist_window.draw_item(@itemlist_window.index)
- @itemlist_window.set_item(@item_command_index)
- end
- @item_target_window.refresh
- if $game_party.all_dead?
- $scene = Scene_Gameover.new
- return
- end
-
- if @item.common_event_id > 0
- $game_temp.common_event_id = @item.common_event_id
- $scene = Scene_Map.new
- return
- end
- end
-
- unless used
- $game_system.se_play($data_system.buzzer_se)
- end
- return
- end
- end
- end
复制代码 系统信息:本贴获得楼主认可,66RPG感谢您的热情解答~ |
|