41 -(IBAction) buttonPressed:(id) sender { |
41 -(IBAction) buttonPressed:(id) sender { |
42 UIButton *theButton = (UIButton *)sender; |
42 UIButton *theButton = (UIButton *)sender; |
43 |
43 |
44 switch (theButton.tag) { |
44 switch (theButton.tag) { |
45 case 0: |
45 case 0: |
46 playSound(@"backSound"); |
|
47 if ([self.mapConfigViewController busy]) { |
46 if ([self.mapConfigViewController busy]) { |
48 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Wait for the Preview",@"") |
47 UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Wait for the Preview",@"") |
49 message:NSLocalizedString(@"Before returning the preview needs to be generated",@"") |
48 message:NSLocalizedString(@"Before returning the preview needs to be generated",@"") |
50 delegate:nil |
49 delegate:nil |
51 cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") |
50 cancelButtonTitle:NSLocalizedString(@"Ok, got it",@"") |
52 otherButtonTitles:nil]; |
51 otherButtonTitles:nil]; |
53 [alert show]; |
52 [alert show]; |
54 [alert release]; |
53 [alert release]; |
55 } else |
54 } else { |
|
55 playSound(@"backSound"); |
56 [[self parentViewController] dismissModalViewControllerAnimated:YES]; |
56 [[self parentViewController] dismissModalViewControllerAnimated:YES]; |
|
57 } |
57 break; |
58 break; |
58 case 1: |
59 case 1: |
59 playSound(@"clickSound"); |
60 playSound(@"clickSound"); |
60 theButton.enabled = NO; |
61 theButton.enabled = NO; |
61 [self startGame:theButton]; |
62 [self startGame:theButton]; |
231 gameDictionary,@"game_dictionary", |
232 gameDictionary,@"game_dictionary", |
232 [NSNumber numberWithBool:NO],@"netgame", |
233 [NSNumber numberWithBool:NO],@"netgame", |
233 @"",@"savefile", |
234 @"",@"savefile", |
234 nil]; |
235 nil]; |
235 |
236 |
236 |
237 // also modify SavedGamesViewController.m |
237 StatsPageViewController *statsPage = [[StatsPageViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
238 StatsPageViewController *statsPage = [[StatsPageViewController alloc] initWithStyle:UITableViewStyleGrouped]; |
238 statsPage.modalTransitionStyle = UIModalTransitionStyleCoverVertical; |
239 statsPage.modalTransitionStyle = UIModalTransitionStyleCoverVertical; |
239 if ([statsPage respondsToSelector:@selector(setModalPresentationStyle:)]) |
240 if ([statsPage respondsToSelector:@selector(setModalPresentationStyle:)]) |
240 statsPage.modalPresentationStyle = UIModalPresentationPageSheet; |
241 statsPage.modalPresentationStyle = UIModalPresentationPageSheet; |
241 [self presentModalViewController:statsPage animated:NO]; |
242 // avoid showing the stat page immediately, but wait for 3 seconds |
242 |
243 [self performSelector:@selector(presentModalViewController:animated:) withObject:statsPage afterDelay:3]; |
243 // also modify SavedGamesViewController.m |
244 |
244 NSArray *stats = [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary]; |
245 NSArray *stats = [[SDLUIKitDelegate sharedAppDelegate] startSDLgame:allDataNecessary]; |
245 if ([stats count] <= 1) { |
246 if ([stats count] <= 1) { |
246 DLog(@"%@",stats); |
247 DLog(@"%@",stats); |
247 [statsPage dismissModalViewControllerAnimated:NO]; |
248 [statsPage dismissModalViewControllerAnimated:NO]; |
248 } else { |
249 } else { |
249 statsPage.statsArray = stats; |
250 statsPage.statsArray = stats; |
250 [statsPage.tableView reloadData]; |
251 [statsPage.tableView reloadData]; |
251 [statsPage viewWillAppear:YES]; |
252 [statsPage viewWillAppear:YES]; |
252 } |
253 } |
253 |
|
254 |
254 |
255 [statsPage release]; |
255 [statsPage release]; |
256 } |
256 } |
257 |
257 |
258 -(void) loadNiceHogs { |
258 -(void) loadNiceHogs { |