仙剑之十里坡

标题: 覆盖存档提示 [打印本页]

作者: 御剑奇侠    时间: 2010-11-7 20:33
标题: 覆盖存档提示
本帖最后由 御剑奇侠 于 2010-11-9 19:34 编辑
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. #==============================================================================
  4. #在覆盖存档的时候弹出对话框提示
  5. class Scene_Save < Scene_File
  6. # -----------------------------
  7. def initialize
  8. super("储存到哪一个进度")
  9. @confirm_window = Window_Base.new(120, 188, 400, 64)
  10. @confirm_window.contents = Bitmap.new(368, 32)
  11. string = "确定要覆盖这个进度吗?"
  12. @confirm_window.contents.font.name = "黑体"
  13. @confirm_window.contents.font.size = 24
  14. @confirm_window.contents.draw_text(4, 0, 368, 32, string)
  15. @yes_no_window = Window_Command.new(100, ["覆盖", "取消"])
  16. @confirm_window.visible = false
  17. @confirm_window.z = 1500
  18. @yes_no_window.visible = false
  19. @yes_no_window.active = false
  20. @yes_no_window.index = 1
  21. @yes_no_window.x = 270
  22. @yes_no_window.y = 252
  23. @yes_no_window.z = 1500
  24. @mode = 0
  25. end
  26. # -----------------------------
  27. def on_decision(filename)
  28. if FileTest.exist?(filename)
  29. @confirm_window.visible = true
  30. @yes_no_window.visible = true
  31. @yes_no_window.active = true
  32. @mode = 1
  33. else
  34. $game_system.se_play($data_system.save_se)
  35. file = File.open(filename, "wb")
  36. write_save_data(file)
  37. file.close
  38. if $game_temp.save_calling
  39. $game_temp.save_calling = false
  40. $scene = Scene_Map.new
  41. return
  42. end
  43. $scene = Scene_Menu.new(4)
  44. end
  45. end
  46. # -----------------------------
  47. def update
  48. if @mode == 0
  49. super
  50. else
  51. @help_window.update
  52. @yes_no_window.update
  53. if Input.trigger?(Input::C)
  54. $game_system.se_play($data_system.decision_se)
  55. if @yes_no_window.index == 0
  56. @yes_no_window.visible = false
  57. @yes_no_window.active = false
  58. @confirm_window.visible = false
  59. filename = make_filename(@file_index)
  60. $game_system.se_play($data_system.save_se)
  61. file = File.open(filename, "wb")
  62. write_save_data(file)
  63. file.close
  64. if $game_temp.save_calling
  65. $game_temp.save_calling = false
  66. $scene = Scene_Map.new
  67. else
  68. $scene = Scene_Menu.new(4)
  69. end
  70. else
  71. @confirm_window.visible = false
  72. @yes_no_window.visible = false
  73. @yes_no_window.active = false
  74. @yes_no_window.index = 1
  75. @mode = 0
  76. end
  77. end
  78. if Input.trigger?(Input::B)
  79. @confirm_window.visible = false
  80. @yes_no_window.visible = false
  81. @yes_no_window.active = false
  82. @yes_no_window.index = 1
  83. @mode = 0
  84. return
  85. end
  86. end
  87. end
  88. # -----------------------------
  89. def on_cancel
  90. $game_system.se_play($data_system.cancel_se)
  91. if $game_temp.save_calling
  92. $game_temp.save_calling = false
  93. $scene = Scene_Map.new
  94. return
  95. end
  96. $scene = Scene_Menu.new(4)
  97. end
  98. # -----------------------------
  99. def write_save_data(file)
  100. characters = []
  101. for i in 0...$game_party.actors.size
  102. actor = $game_party.actors
  103. characters.push([actor.character_name, actor.character_hue])
  104. end
  105. Marshal.dump(characters, file)
  106. Marshal.dump(Graphics.frame_count, file)
  107. $game_system.save_count += 1
  108. $game_system.magic_number = $data_system.magic_number
  109. Marshal.dump($game_system, file)
  110. Marshal.dump($game_switches, file)
  111. Marshal.dump($game_variables, file)
  112. Marshal.dump($game_self_switches, file)
  113. Marshal.dump($game_screen, file)
  114. Marshal.dump($game_actors, file)
  115. Marshal.dump($game_party, file)
  116. Marshal.dump($game_troop, file)
  117. Marshal.dump($game_map, file)
  118. Marshal.dump($game_player, file)
  119. end
  120. end
  121. class Scene_File
  122. alias carol3_main main
  123. def main
  124. carol3_main
  125. if self.is_a?(Scene_Save)
  126. @confirm_window.dispose
  127. @yes_no_window.dispose
  128. end
  129. end
  130. end
  131. #==============================================================================
  132. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  133. #==============================================================================
复制代码

复制全部脚本内容,在Main脚本之前按insert,插入此脚本全部内容。功能:覆盖存档的时候弹出提示“是否覆盖”
作者: 文无缺    时间: 2010-11-8 04:56
这次有用代码插入...很好很有爱...
这脚本比较常有,不错...支持~




欢迎光临 仙剑之十里坡 (http://palslp.com/bbs/) Powered by Discuz! X2.5