diff options
Diffstat (limited to 'Classes/GameModeSelectionLayer.m')
| -rw-r--r-- | Classes/GameModeSelectionLayer.m | 51 |
1 files changed, 12 insertions, 39 deletions
| diff --git a/Classes/GameModeSelectionLayer.m b/Classes/GameModeSelectionLayer.m index 03af89d..4e51357 100644 --- a/Classes/GameModeSelectionLayer.m +++ b/Classes/GameModeSelectionLayer.m | |||
| @@ -11,11 +11,10 @@ | |||
| 11 | #import <sqlite3.h> | 11 | #import <sqlite3.h> |
| 12 | #import "Cart_CollectAppDelegate.h" | 12 | #import "Cart_CollectAppDelegate.h" |
| 13 | #import "MainMenuLayer.h" | 13 | #import "MainMenuLayer.h" |
| 14 | #import "TutorialMode.h" | ||
| 15 | #import "ClassicGameMode.h" | ||
| 16 | #import "NMPanelMenu.h" | 14 | #import "NMPanelMenu.h" |
| 17 | #import "JumpGameMode.h" | ||
| 18 | #import "ZoomFadeTransition.h" | 15 | #import "ZoomFadeTransition.h" |
| 16 | #import "GameModeInfo.h" | ||
| 17 | #import "GameModeManager.h" | ||
| 19 | 18 | ||
| 20 | @implementation GameModeSelectionLayer | 19 | @implementation GameModeSelectionLayer |
| 21 | 20 | ||
| @@ -44,31 +43,14 @@ | |||
| 44 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; | 43 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; |
| 45 | gameModes = [[NSMutableArray alloc] init]; | 44 | gameModes = [[NSMutableArray alloc] init]; |
| 46 | 45 | ||
| 47 | GameModeSelection* tutorialSelection = [GameModeSelection selectionWithName:@"Tutorial" location:@"Florence" filename:@"florence" unlocked:YES]; | 46 | for (GameModeInfo* info in [[GameModeManager sharedInstance] gameModes]) |
| 48 | [gameModes addObject:tutorialSelection]; | ||
| 49 | |||
| 50 | GameModeSelection* collectSelection; | ||
| 51 | |||
| 52 | collectSelection = [GameModeSelection selectionWithName:@"Collect" location:@"Paris" filename:@"paris" unlocked:YES]; | ||
| 53 | /* if ([defaults boolForKey:@"hasDoneTutorial"]) | ||
| 54 | { | ||
| 55 | collectSelection = [GameModeSelection selectionWithName:@"Collect" location:@"Paris" filename:@"paris" unlocked:YES]; | ||
| 56 | } else { | ||
| 57 | collectSelection = [GameModeSelection selectionWithName:@"Collect" location:@"Paris" filename:@"paris" unlockCondition:@"Beat the tutorial!"]; | ||
| 58 | }*/ | ||
| 59 | |||
| 60 | [gameModes addObject:collectSelection]; | ||
| 61 | |||
| 62 | GameModeSelection* jumpSelection; | ||
| 63 | jumpSelection = [GameModeSelection selectionWithName:@"Jump" location:@"Venice" filename:@"venice" unlocked:YES]; | ||
| 64 | /* if ([defaults boolForKey:@"unlockedJumpMode"]) | ||
| 65 | { | 47 | { |
| 66 | jumpSelection = [GameModeSelection selectionWithName:@"Jump" location:@"Venice" filename:@"venice" unlocked:YES]; | 48 | if (info.unlocked) |
| 67 | } else { | 49 | { |
| 68 | jumpSelection = [GameModeSelection selectionWithName:@"Jump" location:@"Venice" filename:@"venice" unlockCondition:@"Get 3000 points in Collect!"]; | 50 | GameModeSelection* selection = [GameModeSelection selectionWithGameModeInfo:info]; |
| 69 | }*/ | 51 | [gameModes addObject:selection]; |
| 70 | 52 | } | |
| 71 | [gameModes addObject:jumpSelection]; | 53 | } |
| 72 | 54 | ||
| 73 | CCMenu* menu = [CCMenu menuWithItems:nil]; | 55 | CCMenu* menu = [CCMenu menuWithItems:nil]; |
| 74 | float onePanelWide = 128; | 56 | float onePanelWide = 128; |
| @@ -132,24 +114,15 @@ | |||
| 132 | [[CCDirector sharedDirector] replaceScene:[MainMenuLayer scene]]; | 114 | [[CCDirector sharedDirector] replaceScene:[MainMenuLayer scene]]; |
| 133 | } | 115 | } |
| 134 | 116 | ||
| 135 | - (void)didSelectGameMode:(GameModeSelection *)gameMode | 117 | - (void)didSelectGameMode:(GameModeSelection *)selection |
| 136 | { | 118 | { |
| 137 | [scrollView setScrollEnabled:NO]; | 119 | [scrollView setScrollEnabled:NO]; |
| 138 | [pageControl removeFromSuperview]; | 120 | [pageControl removeFromSuperview]; |
| 139 | 121 | ||
| 140 | CGPoint opp = [scrollView convertPoint:gameMode.position toView:[[CCDirector sharedDirector] openGLView]]; | 122 | CGPoint opp = [scrollView convertPoint:selection.position toView:[[CCDirector sharedDirector] openGLView]]; |
| 141 | CGPoint endPosition = ccp(0-(opp.x+158), opp.y); | 123 | CGPoint endPosition = ccp(0-(opp.x+158), opp.y); |
| 142 | 124 | ||
| 143 | if ([gameMode.name isEqual:@"Tutorial"]) | 125 | [[CCDirector sharedDirector] replaceScene:[ZoomFadeTransition transitionWithDuration:5.0f scene:[selection.gameMode scene] position:endPosition]]; |
| 144 | { | ||
| 145 | [[CCDirector sharedDirector] replaceScene:[ZoomFadeTransition transitionWithDuration:5.0f scene:[TutorialMode scene] position:endPosition]]; | ||
| 146 | } else if ([gameMode.name isEqual:@"Collect"]) | ||
| 147 | { | ||
| 148 | [[CCDirector sharedDirector] replaceScene:[ZoomFadeTransition transitionWithDuration:5.0f scene:[ClassicGameMode scene] position:endPosition]]; | ||
| 149 | } else if ([gameMode.name isEqual:@"Jump"]) | ||
| 150 | { | ||
| 151 | [[CCDirector sharedDirector] replaceScene:[ZoomFadeTransition transitionWithDuration:5.0f scene:[JumpGameMode scene] position:endPosition]]; | ||
| 152 | } | ||
| 153 | } | 126 | } |
| 154 | 127 | ||
| 155 | @end | 128 | @end |
