Permalink
Browse files

Fixed bug with starting preset game and moves games into 'games' dire…

…ctory.
  • Loading branch information...
1 parent 4968698 commit 4c014dd62781a29d2faf66ada9c7ccca0c23a1fc @mcantelon committed Jan 10, 2011
Showing with 28 additions and 12 deletions.
  1. +28 −12 engine/game_selector.rb
  2. 0 { → games}/cloak_of_darkness/config.yaml
  3. BIN { → games}/daydream/background.jpg
  4. 0 { → games}/daydream/characters/cat.yaml
  5. 0 { → games}/daydream/characters/child.yaml
  6. 0 { → games}/daydream/characters/deadbeat.yaml
  7. 0 { → games}/daydream/characters/rick.yaml
  8. 0 { → games}/daydream/commands/ask.yaml
  9. 0 { → games}/daydream/commands/close.yaml
  10. 0 { → games}/daydream/commands/dig.yaml
  11. 0 { → games}/daydream/commands/drop.yaml
  12. 0 { → games}/daydream/commands/get.yaml
  13. 0 { → games}/daydream/commands/give.yaml
  14. 0 { → games}/daydream/commands/go.yaml
  15. 0 { → games}/daydream/commands/help.yaml
  16. 0 { → games}/daydream/commands/hit.yaml
  17. 0 { → games}/daydream/commands/hug.yaml
  18. 0 { → games}/daydream/commands/inventory.yaml
  19. 0 { → games}/daydream/commands/look.yaml
  20. 0 { → games}/daydream/commands/move.yaml
  21. 0 { → games}/daydream/commands/open.yaml
  22. 0 { → games}/daydream/commands/pet.yaml
  23. 0 { → games}/daydream/commands/piss.yaml
  24. 0 { → games}/daydream/commands/quit.yaml
  25. 0 { → games}/daydream/commands/read.yaml
  26. 0 { → games}/daydream/commands/say.yaml
  27. 0 { → games}/daydream/commands/search.yaml
  28. 0 { → games}/daydream/commands/smoke.yaml
  29. 0 { → games}/daydream/commands/talk.yaml
  30. 0 { → games}/daydream/commands/unlock.yaml
  31. 0 { → games}/daydream/commands/wait.yaml
  32. 0 { → games}/daydream/commands/wear.yaml
  33. 0 { → games}/daydream/config.yaml
  34. 0 { → games}/daydream/doors/doors.yaml
  35. 0 { → games}/daydream/locations/bedroom.yaml
  36. 0 { → games}/daydream/locations/closet.yaml
  37. 0 { → games}/daydream/locations/entrance.yaml
  38. 0 { → games}/daydream/locations/hallway.yaml
  39. BIN { → games}/daydream/locations/images/bedroom.jpg
  40. BIN { → games}/daydream/locations/images/closet.jpg
  41. BIN { → games}/daydream/locations/images/entrance.jpg
  42. BIN { → games}/daydream/locations/images/hallway.jpg
  43. BIN { → games}/daydream/locations/images/upstairs.jpg
  44. BIN { → games}/daydream/locations/images/yard.jpg
  45. 0 { → games}/daydream/locations/upstairs.yaml
  46. 0 { → games}/daydream/locations/yard.yaml
  47. 0 { → games}/daydream/parsing/command_abbreviations.yaml
  48. 0 { → games}/daydream/parsing/garbage_words.yaml
  49. 0 { → games}/daydream/parsing/global_synonyms.yaml
  50. 0 { → games}/daydream/player/player.yaml
  51. 0 { → games}/daydream/props/props.yaml
  52. 0 { → games}/daydream/transitions.yaml
  53. 0 { → games}/new_game/commands/drop.yaml
  54. 0 { → games}/new_game/commands/get.yaml
  55. 0 { → games}/new_game/commands/go.yaml
  56. 0 { → games}/new_game/commands/inventory.yaml
  57. 0 { → games}/new_game/commands/look.yaml
  58. 0 { → games}/new_game/commands/quit.yaml
  59. 0 { → games}/new_game/commands/read.yaml
  60. 0 { → games}/new_game/config.yaml
  61. 0 { → games}/new_game/locations/apartment.yaml
  62. 0 { → games}/new_game/parsing/command_abbreviations.yaml
  63. 0 { → games}/new_game/player/player.yaml
  64. 0 { → games}/new_game/props/props.yaml
  65. 0 { → games}/new_game/transitions.yaml
  66. 0 { → games}/pirate_adventure/characters/crocodiles.yaml
  67. 0 { → games}/pirate_adventure/characters/parrot.yaml
  68. 0 { → games}/pirate_adventure/characters/pirate.yaml
  69. 0 { → games}/pirate_adventure/characters/snakes.yaml
  70. 0 { → games}/pirate_adventure/commands/build.yaml
  71. 0 { → games}/pirate_adventure/commands/dig.yaml
  72. 0 { → games}/pirate_adventure/commands/drop.yaml
  73. 0 { → games}/pirate_adventure/commands/get.yaml
  74. 0 { → games}/pirate_adventure/commands/give.yaml
  75. 0 { → games}/pirate_adventure/commands/go.yaml
  76. 0 { → games}/pirate_adventure/commands/inventory.yaml
  77. 0 { → games}/pirate_adventure/commands/jump.yaml
  78. 0 { → games}/pirate_adventure/commands/light.yaml
  79. 0 { → games}/pirate_adventure/commands/look.yaml
  80. 0 { → games}/pirate_adventure/commands/open.yaml
  81. 0 { → games}/pirate_adventure/commands/pace.yaml
  82. 0 { → games}/pirate_adventure/commands/poot.yaml
  83. 0 { → games}/pirate_adventure/commands/poot2.yaml
  84. 0 { → games}/pirate_adventure/commands/quit.yaml
  85. 0 { → games}/pirate_adventure/commands/read.yaml
  86. 0 { → games}/pirate_adventure/commands/sail.yaml
  87. 0 { → games}/pirate_adventure/commands/say.yaml
  88. 0 { → games}/pirate_adventure/commands/score.yaml
  89. 0 { → games}/pirate_adventure/commands/unlight.yaml
  90. 0 { → games}/pirate_adventure/commands/wait.yaml
  91. 0 { → games}/pirate_adventure/commands/wake.yaml
  92. 0 { → games}/pirate_adventure/commands/weigh.yaml
  93. 0 { → games}/pirate_adventure/complete_walkthrough
  94. 0 { → games}/pirate_adventure/config.yaml
  95. 0 { → games}/pirate_adventure/doors/doors.yaml
  96. 0 { → games}/pirate_adventure/locations/alcove.yaml
  97. 0 { → games}/pirate_adventure/locations/apartment.yaml
  98. 0 { → games}/pirate_adventure/locations/attic.yaml
  99. 0 { → games}/pirate_adventure/locations/beach.yaml
  100. 0 { → games}/pirate_adventure/locations/cave1.yaml
  101. 0 { → games}/pirate_adventure/locations/cave2.yaml
  102. 0 { → games}/pirate_adventure/locations/cave3.yaml
  103. 0 { → games}/pirate_adventure/locations/cave4.yaml
  104. 0 { → games}/pirate_adventure/locations/cavern.yaml
  105. 0 { → games}/pirate_adventure/locations/field.yaml
  106. 0 { → games}/pirate_adventure/locations/foot_of_hill.yaml
  107. 0 { → games}/pirate_adventure/locations/graveyard.yaml
  108. 0 { → games}/pirate_adventure/locations/hallway.yaml
  109. 0 { → games}/pirate_adventure/locations/lagoon.yaml
  110. 0 { → games}/pirate_adventure/locations/ledge.yaml
  111. 0 { → games}/pirate_adventure/locations/meadow.yaml
  112. 0 { → games}/pirate_adventure/locations/monastery.yaml
  113. 0 { → games}/pirate_adventure/locations/neverneverland.yaml
  114. 0 { → games}/pirate_adventure/locations/ocean.yaml
  115. 0 { → games}/pirate_adventure/locations/passageway.yaml
  116. 0 { → games}/pirate_adventure/locations/pit.yaml
  117. 0 { → games}/pirate_adventure/locations/shack.yaml
  118. 0 { → games}/pirate_adventure/locations/shed.yaml
  119. 0 { → games}/pirate_adventure/locations/ship.yaml
  120. 0 { → games}/pirate_adventure/locations/shore.yaml
  121. 0 { → games}/pirate_adventure/locations/top_of_hill.yaml
  122. 0 { → games}/pirate_adventure/parsing/command_abbreviations.yaml
  123. 0 { → games}/pirate_adventure/parsing/garbage_words.yaml
  124. 0 { → games}/pirate_adventure/parsing/global_synonyms.yaml
  125. 0 { → games}/pirate_adventure/player/player.yaml
  126. 0 { → games}/pirate_adventure/props/props.yaml
  127. 0 { → games}/pirate_adventure/transitions.yaml
View
@@ -2,30 +2,45 @@ def game_selector(app, app_base_path)
game_directories = game_selector_directories(app_base_path)
- if game_directories.size == 1
+ stack do
- game_selector_launch(app, app_base_path, game_directories.first)
+ if game_directories.size == 1
- else
+ message = "Loading " + game_directories.first
+ game = game_directories.first
- text = para "Choose game:"
+ #text = para ("Loading " + game_directories.first)
+ #text.align = 'center'
+
+ #btn = button 'OK' do
+ # game_selector_launch(app, app_base_path, game_directories.first)
+ #end
+
+ else
+
+ message = "Choose game:"
+
+ end
+
+ text = para message
text.align = 'center'
- game_select = list_box :items => game_directories
+ if !game
+ game_select = list_box :items => game_directories
+ end
btn = button 'OK' do
- if game_select.text()
- game_selector_launch(app, app_base_path, game_select.text())
+ if game || game_select.text()
+ load_game = game ? game : game_select.text()
+ game_selector_launch(app, app_base_path, load_game)
end
end
-
end
-
end
def game_selector_launch(app, app_base_path, game_directory)
- game_path = app_base_path + '/' + game_directory + '/'
+ game_path = app_base_path + '/games/' + game_directory + '/'
config = File.open("#{game_path}config.yaml", 'r') { |f| YAML::load(f.read) }
main(app, app_base_path, game_path, config)
@@ -34,10 +49,11 @@ def game_selector_launch(app, app_base_path, game_directory)
def game_selector_directories(app_base_path)
game_directories = []
+ game_directory = app_base_path + '/games'
# Scan each directory in the application directory for a config.yaml file
- Dir.entries(app_base_path).each do |entry|
- path = app_base_path + '/' + entry
+ Dir.entries(game_directory).each do |entry|
+ path = game_directory + '/' + entry
if path != '.' && path != '..' && FileTest.directory?(path)
Dir.entries(path).each do |child_entry|
if child_entry == 'config.yaml'
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 4c014dd

Please sign in to comment.