Advertisement
Guest User

Untitled

a guest
Apr 25th, 2014
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. #import <UIKit/UIKit.h>
  2.  
  3. @interface gameFirstViewController : UIViewController<UIAlertViewDelegate>
  4.  
  5. @end
  6.  
  7. #import <Foundation/Foundation.h>
  8.  
  9. @interface GameLogic : UIView
  10. //all sorts of various non relevant property declarations
  11. @end
  12.  
  13. //action to take when an alert is shown
  14. - (void)alertView:(UIAlertView *)alertView
  15. didDismissWithButtonIndex:(NSInteger) buttonIndex
  16. { NSLog(@"OK Tapped");
  17. NSUserDefaults *MySettingsData = [NSUserDefaults standardUserDefaults];
  18. row= [MySettingsData integerForKey:@"Row_count"];
  19. col = [MySettingsData integerForKey:@"Column_count"];
  20. if(buttonIndex==0)
  21. {
  22. for(int i=0;i<row;++i)
  23. {
  24. for(int j=0;j<col;++j)
  25. {
  26. myarr[i][j]=0;
  27. }
  28. }
  29. if(_TimerStatus ==1)
  30. {
  31. [mainTimer invalidate];
  32. mainTimer=nil;
  33. _TimerStatus=0;
  34. }
  35. [self super_reset];
  36. [self setNeedsDisplay];
  37. NSLog(@"Game reset");
  38. return;
  39. }
  40. }
  41.  
  42. UIAlertView *myAlert = [[UIAlertView alloc]initWithTitle: @"GAME OVER"
  43. message:@"You clicked on a mine, tap on ok to reset"
  44. delegate:self
  45. cancelButtonTitle:@"Ok"
  46. otherButtonTitles:nil, nil];
  47. [myAlert performSelectorOnMainThread:@selector(show)
  48. withObject:nil
  49. waitUntilDone:YES];
  50.  
  51. UIAlertView *myAlert = [[UIAlertView alloc]initWithTitle: @"You Won! Whoo Hoo"
  52. message:@"You have successfully dodged every minefield"
  53. delegate:self
  54. cancelButtonTitle:@"Ok"
  55. otherButtonTitles:nil, nil];
  56. [myAlert performSelectorOnMainThread:@selector(show)
  57. withObject:nil
  58. waitUntilDone:YES];
  59.  
  60. dispatch_async(dispatch_get_main_queue(), ^{
  61. [[[UIAlertView alloc] initWithTitle:@"GAME OVER" message:@"You clicked on a mine, tap on ok to reset" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil] show];
  62. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement