Permalink
Browse files

Continue, rather than reset when epic mode completed.

  • Loading branch information...
1 parent 63c815b commit d242e989ca505047bfd9d070f1ebc2311e490c13 @Spooner committed Feb 27, 2012
Showing with 28 additions and 23 deletions.
  1. +28 −23 lib/ruby_armor/states/play.rb
@@ -150,28 +150,7 @@ def create_ui_bar
end
@continue_button = button "Continue", button_options.merge(tip: "Climb up the stairs to the next level") do
- # Save the code used to complete the level for posterity.
- File.open File.join(profile.player_path, "ruby_armor/player_#{profile.epic? ? "EPIC" : level.number.to_s.rjust(2, '0')}.rb"), "w" do |file|
- file.puts @loaded_code
-
- file.puts
- file.puts
- file.puts "#" * 40
- file.puts "=begin"
- file.puts
- file.puts record_log { level.tally_points }
- file.puts
-
- if profile.epic? and @game.final_report
- file.puts @game.final_report
- else
- file.puts "Completed in #{turn} turns."
- end
-
- file.puts
- file.puts "=end"
- file.puts "#" * 40
- end
+ save_player_code
# Move to next level.
if @game.next_level.exists?
@@ -208,6 +187,31 @@ def create_ui_bar
end
end
+ def save_player_code
+ # Save the code used to complete the level for posterity.
+ File.open File.join(profile.player_path, "ruby_armor/player_#{profile.epic? ? "EPIC" : level.number.to_s.rjust(2, '0')}.rb"), "w" do |file|
+ file.puts @loaded_code
+
+ file.puts
+ file.puts
+ file.puts "#" * 40
+ file.puts "=begin"
+ file.puts
+ file.puts record_log { level.tally_points }
+ file.puts
+
+ if profile.epic? and @game.final_report
+ file.puts @game.final_report
+ else
+ file.puts "Completed in #{turn} turns."
+ end
+
+ file.puts
+ file.puts "=end"
+ file.puts "#" * 40
+ end
+ end
+
def create_log_tabs
vertical padding: 0, spacing: 0 do
@log_tabs_group = group do
@@ -510,7 +514,8 @@ def play_turn
refresh_labels
if level.passed?
- @continue_button.enabled = true unless profile.epic?
+ @reset_button.enabled = false if profile.epic? # Continue will save performance; reset won't.
+ @continue_button.enabled = true
if profile.next_level.exists?
self.puts "Success! You have found the stairs."

0 comments on commit d242e98

Please sign in to comment.