25 switch (theButton.tag) { |
25 switch (theButton.tag) { |
26 case 0: |
26 case 0: |
27 [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil]; |
27 [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil]; |
28 break; |
28 break; |
29 case 1: |
29 case 1: |
30 [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil]; |
30 [self performSelector:@selector(startGame) |
31 [self performSelector:@selector(startSDLgame) |
|
32 withObject:nil |
31 withObject:nil |
33 afterDelay:0.4]; |
32 afterDelay:0.25]; |
34 break; |
33 break; |
35 } |
34 } |
36 } |
35 } |
37 |
36 |
38 -(void) startSDLgame { |
37 -(void) startGame { |
39 [[SDLUIKitDelegate sharedAppDelegate] startSDLgame]; |
38 if ([teamConfigViewController.listOfSelectedTeams count] < 2) { |
|
39 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Too few teams playing",@"") |
|
40 message:NSLocalizedString(@"You need to select at least two teams to play a Game",@"") |
|
41 delegate:nil |
|
42 cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") |
|
43 otherButtonTitles:nil]; |
|
44 [alert show]; |
|
45 [alert release]; |
|
46 } else { |
|
47 [teamConfigViewController.listOfSelectedTeams writeToFile:GAMECONFIG_FILE() atomically:YES]; |
|
48 [[NSNotificationCenter defaultCenter] postNotificationName:@"dismissModalView" object:nil]; |
|
49 [[SDLUIKitDelegate sharedAppDelegate] startSDLgame]; |
|
50 } |
40 } |
51 } |
41 |
52 |
42 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. |
|
43 -(void) viewDidLoad { |
53 -(void) viewDidLoad { |
44 teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
54 teamConfigViewController = [[TeamConfigViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
45 activeController = teamConfigViewController; |
55 activeController = teamConfigViewController; |
46 |
56 |
47 [self.view insertSubview:teamConfigViewController.view atIndex:0]; |
57 [self.view insertSubview:teamConfigViewController.view atIndex:0]; |