赞 | 0 |
VIP | 0 |
好人卡 | 2 |
积分 | 1 |
经验 | 175482 |
最后登录 | 2014-1-10 |
在线时间 | 27 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 27 小时
- 注册时间
- 2008-2-13
- 帖子
- 1740
|
- #==============================================================================
- # ■ Scene_Save
- #------------------------------------------------------------------------------
- # 处理存档画面的类。
- #==============================================================================
- class Scene_Save < Scene_File
- #--------------------------------------------------------------------------
- # ● 初始化对像
- #--------------------------------------------------------------------------
- def initialize
- super("要保存到这个文件吗?")
- end
- #--------------------------------------------------------------------------
- # ● 确定时的处理
- #--------------------------------------------------------------------------
- def on_decision(filename)
- # 演奏存档 SE
- $game_system.se_play($data_system.save_se)
- # 写入存档数据
- file = File.open(filename, "wb")
- write_save_data(file)
- file.close
- # 如果被事件调用
- if $game_temp.save_calling
- # 清除存档调用标志
- $game_temp.save_calling = false
- # 切换到地图画面
- $scene = Scene_Map.new
- return
- end
- # 切换到菜单画面
- $scene = Scene_Menu.new(7)
- end
- #--------------------------------------------------------------------------
- # ● 取消时的处理
- #--------------------------------------------------------------------------
- def on_cancel
- # 演奏取消 SE
- $game_system.se_play($data_system.cancel_se)
- # 如果被事件调用
- if $game_temp.save_calling
- # 清除存档调用标志
- $game_temp.save_calling = false
- # 切换到地图画面
- $scene = Scene_Map.new
- return
- end
- # 切换到菜单画面
- $scene = Scene_Menu.new(7)
- end
- #--------------------------------------------------------------------------
- # ● 写入存档数据
- # file : 写入用文件对像 (已经打开)
- #--------------------------------------------------------------------------
- def write_save_data(file)
- # 生成描绘存档文件用的角色图形
- characters = []
- for i in 0...$game_party.actors.size
- actor = $game_party.actors[i]
- characters.push([actor.character_name, actor.character_hue])
- end
- # 写入描绘存档文件用的角色数据
- Marshal.dump(characters, file)
- # 写入测量游戏时间用画面计数
- Marshal.dump(Graphics.frame_count, file)
- # 增加 1 次存档次数
- $game_system.save_count += 1
- # 保存魔法编号
- # (将编辑器保存的值以随机值替换)
- $game_system.magic_number = $data_system.magic_number
- # 写入各种游戏对像
- Marshal.dump($game_system, file)
- Marshal.dump($game_switches, file)
- Marshal.dump($game_variables, file)
- Marshal.dump($game_self_switches, file)
- Marshal.dump($game_screen, file)
- Marshal.dump($game_actors, file)
- Marshal.dump($game_party, file)
- Marshal.dump($game_troop, file)
- Marshal.dump($game_map, file)
- Marshal.dump($game_player, file)
- end
- end
- class Window_Command_New < Window_Selectable
- def initialize(actors=4,enemynums=0)
- super(438, 20, 172, 160)
- self.contents = Bitmap.new(width - 32, height - 32)
- self.opacity = HS::OPACITY
- @commands = ["战斗","物品","魔法","状态","装备","队列","任务","存档"]
- @item_max = 8
- @column_max = 2
- @actors = actors
- @enemynums = enemynums
- draw_item(0, @enemynums==0 ? disabled_color : normal_color)
- draw_item(1, normal_color)
- draw_item(2, @actors==0 ? disabled_color : normal_color)
- draw_item(3, @actors==0 ? disabled_color : normal_color)
- draw_item(4, @actors==0 ? disabled_color : normal_color)
- draw_item(5, @actors==0 ? disabled_color : normal_color)
- draw_item(6, normal_color)
- draw_item(7, normal_color)
- self.index = 0
- end
- def draw_item(index, color)
- self.contents.font.color = color
- x = 4 + index % 2 * 70
- y = index / 2 * 32
- rect = Rect.new(x, y, 64, 32)
- self.contents.fill_rect(rect, Color.new(0, 0, 0, 0))
- self.contents.draw_text(rect, @commands[index], 1)
- end
- def update_cursor_rect
- x = 4 + index % 2 * 70
- y = index / 2 * 32
- self.cursor_rect.set(x, y, 64, 32)
- end
- end
- class Scene_Menu
- def initialize(menu_index = 0)
- @menu_index = menu_index
- end
- def main
- # check_enemy_in_map($game_player.x,$game_player.y)
- cmd = Window_Command_New.new($game_party.actors.size)
- cmd.index = @menu_index
- Graphics.transition
- loop do
- Graphics.update
- Input.update
- cmd.update
- if Input.trigger?(Input::B)
- $game_system.se_play($data_system.cancel_se)
- $scene = Scene_Map.new
- end
- if Input.trigger?(Input::C)
- case cmd.index
- when 0
- $game_system.se_play($data_system.buzzer_se)
- when 1
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Item.new
- when 2
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Skill.new
- when 3
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Status.new
- when 4
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Equip.new
- when 5
- $game_system.se_play($data_system.decision_se)
- $scene = Scene_Change_Turn.new
- when 6
- print "可以自己结合叶子的任务系统设计"
- when 7
- $game_system.se_play($data_system.decision_se)
- $scene=Scene_Save.new
- end
- end
- if $scene != self
- break
- end
- end
- Graphics.freeze
- cmd.dispose
- end
- end
复制代码
插入到Main之前,少处修改{/gg} 系统信息:本贴由楼主认可为正确答案,66RPG感谢您的热情解答~ |
|