Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #import <UIKit/UIKit.h>
- @interface gameFirstViewController : UIViewController<UIAlertViewDelegate>
- @end
- #import <Foundation/Foundation.h>
- @interface GameLogic : UIView
- //all sorts of various non relevant property declarations
- @end
- //action to take when an alert is shown
- - (void)alertView:(UIAlertView *)alertView
- didDismissWithButtonIndex:(NSInteger) buttonIndex
- { NSLog(@"OK Tapped");
- NSUserDefaults *MySettingsData = [NSUserDefaults standardUserDefaults];
- row= [MySettingsData integerForKey:@"Row_count"];
- col = [MySettingsData integerForKey:@"Column_count"];
- if(buttonIndex==0)
- {
- for(int i=0;i<row;++i)
- {
- for(int j=0;j<col;++j)
- {
- myarr[i][j]=0;
- }
- }
- if(_TimerStatus ==1)
- {
- [mainTimer invalidate];
- mainTimer=nil;
- _TimerStatus=0;
- }
- [self super_reset];
- [self setNeedsDisplay];
- NSLog(@"Game reset");
- return;
- }
- }
- UIAlertView *myAlert = [[UIAlertView alloc]initWithTitle: @"GAME OVER"
- message:@"You clicked on a mine, tap on ok to reset"
- delegate:self
- cancelButtonTitle:@"Ok"
- otherButtonTitles:nil, nil];
- [myAlert performSelectorOnMainThread:@selector(show)
- withObject:nil
- waitUntilDone:YES];
- UIAlertView *myAlert = [[UIAlertView alloc]initWithTitle: @"You Won! Whoo Hoo"
- message:@"You have successfully dodged every minefield"
- delegate:self
- cancelButtonTitle:@"Ok"
- otherButtonTitles:nil, nil];
- [myAlert performSelectorOnMainThread:@selector(show)
- withObject:nil
- waitUntilDone:YES];
- dispatch_async(dispatch_get_main_queue(), ^{
- [[[UIAlertView alloc] initWithTitle:@"GAME OVER" message:@"You clicked on a mine, tap on ok to reset" delegate:self cancelButtonTitle:@"Ok" otherButtonTitles:nil] show];
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement