Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(void)timerRun
- {
- self.secondsCount--;
- int seconds = self.secondsCount;
- NSString *timerOutput = [NSString stringWithFormat:@"%i",seconds];
- self.timerLabel.text = timerOutput;
- if(self.secondsCount == 0)
- {
- [self.gameCountDownTimer invalidate];
- self.objSecondView = [[SecondViewController alloc]initWithNibName:@"SecondViewController." bundle:nil];
- self.finalScore =self.gameScore;
- NSLog(@"THE FINAL_CURRENT SCORE IS %d!!!!!!!!!!!!!",self.finalScore);
- [self performSegueWithIdentifier:@"secondViewScreen" sender:self];
- }
- }
- -(void)setTimer
- {
- self.secondsCount = TIMER_LENGTH;
- self.gameCountDownTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerRun) userInfo:nil repeats:YES];
- }
- - (void)DetectDrawing:(DrawingGameGlyphDetectorView*)theView glyphDetected:(WTMGlyph *)glyph withScore:(float)score
- {
- NSNumber *number = [[NSNumber alloc]initWithInt:10];
- if (score < GESTURE_SCORE_THRESHOLD)
- return;
- else if([glyph.name isEqualToString:convertAnswer])
- {
- NSLog(@"WOOOOOOOO!HOOOOOO!~~~");
- self.gameScore += GAME_SCORE;
- if(self.answer > number)
- {
- self.gameScore += GAME_SCORE_BONUS;
- }
- self.scoreLabel.text = [NSString stringWithFormat:@"Score:%i",self.gameScore];
- self.objSecondView.finalScore = self.scoreLabel.text;
- [self viewDidAppear:YES];
- }
- }
- - (void)viewDidLoad
- {
- [self setTimer];
- self.gameScore = 0;
- [super viewDidLoad];
- }
- -(void)viewWillAppear:(BOOL)animated
- {
- self.objFirstView = [[FirstViewController alloc]initWithNibName:@"FirstViewController." bundle:nil];
- self.finalScoreText.text = [NSString stringWithFormat:@"%i",self.objFirstView.finalScore];
- NSLog(@"NEW VIEW!!!!!! AND THE FINAL SCORE IS!!!! %i",self.objFirstView.finalScore);
- }
- - (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
- {
- SecondViewController *dest = [segue destinationViewController];
- dest.finalScoreText.text = [NSString stringWithFormat:@"%i",self.gamescore];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement