- 注册时间
- 2005-2-1
- 最后登录
- 2007-1-7
⑥精研
不灌水者
- 积分
- 2494
|
发表于 2007-3-5 00:24:42
|
显示全部楼层
基于论坛上传附件大小过于苛刻,直接发脚本了,LZ可以新建一个工程把脚本插进去
差不多就是这样吧?-
- #==============================================================================
- # ■ Scene_Menu
- #------------------------------------------------------------------------------
- # 处理菜单画面的类。
- #==============================================================================
- class Scene_Menu
- #--------------------------------------------------------------------------
- # ● 初始化对像
- # menu_index : 命令光标的初期位置
- #--------------------------------------------------------------------------
- def initialize(menu_index = 0)
- @menu_index = menu_index
- end
- #--------------------------------------------------------------------------
- # ● 主处理
- #--------------------------------------------------------------------------
- def main
- # 生成命令窗口
- s1 = $data_system.words.item
- s2 = $data_system.words.skill
- s3 = $data_system.words.equip
- s4 = "状态"
- s5 = "存档"
- s6 = "结束游戏"
- s7 = "更变物品"
- @command_window = Window_Command.new(160, [s1, s2, s3, s4, s5, s6,s7])
- @command_window.index = @menu_index
- b1= "存入物品"
- b2= "取出物品"
- @item_window = Window_Command.new(160, [b1,b2])
- @item_window.y=280
- @item_window.index = @menu_index
- @item_window.active = false
- @item_window.visible = false
-
- # 同伴人数为 0 的情况下
- if $game_party.actors.size == 0
- # 物品、特技、装备、状态无效化
- @command_window.disable_item(0)
- @command_window.disable_item(1)
- @command_window.disable_item(2)
- @command_window.disable_item(3)
- end
- # 禁止存档的情况下
- if $game_system.save_disabled
- # 存档无效
- @command_window.disable_item(4)
- end
- # 生成状态窗口
- @status_window = Window_MenuStatus.new
- @status_window.x = 160
- @status_window.y = 0
- # 执行过渡
- Graphics.transition
- # 主循环
- loop do
- # 刷新游戏画面
- Graphics.update
- # 刷新输入信息
- Input.update
- # 刷新画面
- update
- # 如果切换画面就中断循环
- if $scene != self
- break
- end
- end
- # 准备过渡
- Graphics.freeze
- # 释放窗口
- @command_window.dispose
- @status_window.dispose
- @item_window.dispose
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面
- #--------------------------------------------------------------------------
- def update
- # 刷新窗口
- @command_window.update
- @status_window.update
- @item_window.update
- # 命令窗口被激活的情况下: 调用 update_command
- if @command_window.active
- update_command
- return
- end
- # 状态窗口被激活的情况下: 调用 update_status
- if @status_window.active
- update_status
- return
- end
- if @item_window.active
- update_actor_items
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (命令窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_command
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 切换的地图画面
- $scene = Scene_Map.new
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 同伴人数为 0、存档、游戏结束以外的场合
- if $game_party.actors.size == 0 and @command_window.index < 4
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 命令窗口的光标位置分支
- case @command_window.index
- when 0 # 物品
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到物品画面
- $scene = Scene_Item.new
- when 1 # 特技
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 2 # 装备
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 3 # 状态
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 激活状态窗口
- @command_window.active = false
- @status_window.active = true
- @status_window.index = 0
- when 4 # 存档
- # 禁止存档的情况下
- if $game_system.save_disabled
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到存档画面
- $scene = Scene_Save.new
- when 5 # 游戏结束
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到游戏结束画面
- $scene = Scene_End.new
- when 6 # 游戏结束
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- @command_window.active = false
- @item_window.active = true
- @item_window.visible = true
- @item_window.index = 0
- end
- return
- end
- end
- def update_actor_items
- if Input.trigger?(Input::C)
- @item_window.active = false
- @status_window.active = true
- @status_window.index = 0
- return
- end
- end
- #--------------------------------------------------------------------------
- # ● 刷新画面 (状态窗口被激活的情况下)
- #--------------------------------------------------------------------------
- def update_status
- # 按下 B 键的情况下
- if Input.trigger?(Input::B)
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 激活命令窗口
- @command_window.active = true
- @status_window.active = false
- @status_window.index = -1
- return
- end
- # 按下 C 键的情况下
- if Input.trigger?(Input::C)
- # 命令窗口的光标位置分支
- case @command_window.index
- when 1 # 特技
- # 本角色的行动限制在 2 以上的情况下
- if $game_party.actors[@status_window.index].restriction >= 2
- # 演奏冻结 SE
- $game_system.se_play($data_system.buzzer_se)
- return
- end
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到特技画面
- $scene = Scene_Skill.new(@status_window.index)
- when 2 # 装备
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换的装备画面
- $scene = Scene_Equip.new(@status_window.index)
- when 3 # 状态
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
- # 切换到状态画面
- $scene = Scene_Status.new(@status_window.index)
- when 6 # 存取选项
- @item_window.visible = false
- $actor=$game_party.actors[@status_window.index]
- if @item_window.index == 0
- # 演奏确定 SE
- $game_system.se_play($data_system.decision_se)
-
- $scene = Scene_Actor_Items_Save.new
- else
- $scene = Scene_Actor_Items_Get.new
- end
- end
- return
- end
- end
- end
- #队员携带道具
- class Game_Actor < Game_Battler
- attr_accessor :items
- def setup(actor_id)
- actor = $data_actors[actor_id]
- @actor_id = actor_id
- @name = actor.name
- @character_name = actor.character_name
- @character_hue = actor.character_hue
- @battler_name = actor.battler_name
- @battler_hue = actor.battler_hue
- @class_id = actor.class_id
- @weapon_id = actor.weapon_id
- @armor1_id = actor.armor1_id
- @armor2_id = actor.armor2_id
- @armor3_id = actor.armor3_id
- @armor4_id = actor.armor4_id
- @level = actor.initial_level
- @exp_list = Array.new(101)
- make_exp_list
- @exp = @exp_list[@level]
- @skills = []
- @hp = maxhp
- @sp = maxsp
- @states = []
- @states_turn = {}
- @maxhp_plus = 0
- @maxsp_plus = 0
- @str_plus = 0
- @dex_plus = 0
- @agi_plus = 0
- @int_plus = 0
- @items=[]
- for i in 1..@level
- for j in $data_classes[@class_id].learnings
- if j.level == i
- learn_skill(j.skill_id)
- end
- end
- end
- update_auto_state(nil, $data_armors[@armor1_id])
- update_auto_state(nil, $data_armors[@armor2_id])
- update_auto_state(nil, $data_armors[@armor3_id])
- update_auto_state(nil, $data_armors[@armor4_id])
- end
- end
- class Scene_Actor_Items_Save
- def main
- @help_window = Window_Help.new
- @item_window = Window_Item.new
- @item_window.help_window = @help_window
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help_window.dispose
- @item_window.dispose
- end
- def update
- @help_window.update
- @item_window.update
- if @item_window.active
- update_item
- return
- end
- end
- def update_item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Menu.new(6)
- return
- end
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- $actor.items.push(@item_window.item)
- case @item_window.item
- when RPG::Item
- $game_party.lose_item(@item_window.item.id, 1)
- when RPG::Weapon
- $game_party.lose_weapon(@item_window.item.id, 1)
- when RPG::Armor
- $game_party.lose_armor(@item_window.item.id, 1)
- end
- @item_window.refresh
- return
- end
- end
- end
- class Scene_Actor_Items_Get
- def main
- @help_window = Window_Help.new
- @item_window = Window_Actor_Items.new
- @item_window.help_window = @help_window
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- update
- if $scene != self
- break
- end
- end
- Graphics.freeze
- @help_window.dispose
- @item_window.dispose
- end
- def update
- @help_window.update
- @item_window.update
- update_item
- end
- def update_item
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Menu.new(6)
- return
- end
- if Input.trigger?(Input::C)
- $game_system.se_play($data_system.decision_se)
- case @item_window.item
- when RPG::Item
- $game_party.gain_item(@item_window.item.id, 1)
- when RPG::Weapon
- $game_party.gain_weapon(@item_window.item.id, 1)
- when RPG::Armor
- $game_party.gain_armor(@item_window.item.id, 1)
- end
- $actor.items[@item_window.index]=nil
- $actor.items.compact!
- @item_window.refresh
- return
- end
- end
- end
- class Window_Actor_Items < Window_Selectable
- def initialize
- super(0, 64, 640, 416)
- @column_max = 2
- refresh
- self.index = 0
- end
- def item
- return @data[self.index]
- end
- def refresh
- if self.contents != nil
- self.contents.dispose
- self.contents = nil
- end
- @data = []
- for i in 0..$actor.items.size
- case $actor.items[i]
- when RPG::Item
- @data.push($data_items[$actor.items[i].id])
- when RPG::Weapon
- @data.push($data_weapons[$actor.items[i].id])
- when RPG::Armor
- @data.push($data_armors[$actor.items[i].id])
- end
- end
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 32)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- def draw_item(index)
- item = @data[index]
- case item
- when RPG::Item
- number = $game_party.item_number(item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(item.id)
- when RPG::Armor
- number = $game_party.armor_number(item.id)
- end
- self.contents.font.color = normal_color
- x = 4 + index % 2 * (288 + 32)
- y = index / 2 * 32
- rect = Rect.new(x, y, self.width / @column_max - 32, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- bitmap = RPG::Cache.icon(item.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
- end
- def update_help
- @help_window.set_text(self.item == nil ? "" : self.item.description)
- end
- end
复制代码
[s:5] [s:5] |
|