Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.91 KB | None | 0 0
  1. -(void)timerRun
  2. {
  3. self.secondsCount--;
  4. int seconds = self.secondsCount;
  5.  
  6. NSString *timerOutput = [NSString stringWithFormat:@"%i",seconds];
  7. self.timerLabel.text = timerOutput;
  8.  
  9. if(self.secondsCount == 0)
  10. {
  11. [self.gameCountDownTimer invalidate];
  12.  
  13.  
  14. self.objSecondView = [[SecondViewController alloc]initWithNibName:@"SecondViewController." bundle:nil];
  15.  
  16. self.finalScore =self.gameScore;
  17.  
  18. NSLog(@"THE FINAL_CURRENT SCORE IS %d!!!!!!!!!!!!!",self.finalScore);
  19.  
  20. [self performSegueWithIdentifier:@"secondViewScreen" sender:self];
  21.  
  22.  
  23. }
  24.  
  25.  
  26.  
  27. }
  28.  
  29. -(void)setTimer
  30. {
  31. self.secondsCount = TIMER_LENGTH;
  32. self.gameCountDownTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(timerRun) userInfo:nil repeats:YES];
  33.  
  34. }
  35. - (void)DetectDrawing:(DrawingGameGlyphDetectorView*)theView glyphDetected:(WTMGlyph *)glyph withScore:(float)score
  36. {
  37. NSNumber *number = [[NSNumber alloc]initWithInt:10];
  38.  
  39. if (score < GESTURE_SCORE_THRESHOLD)
  40. return;
  41. else if([glyph.name isEqualToString:convertAnswer])
  42. {
  43. NSLog(@"WOOOOOOOO!HOOOOOO!~~~");
  44.  
  45. self.gameScore += GAME_SCORE;
  46.  
  47. if(self.answer > number)
  48. {
  49. self.gameScore += GAME_SCORE_BONUS;
  50.  
  51. }
  52. self.scoreLabel.text = [NSString stringWithFormat:@"Score:%i",self.gameScore];
  53. self.objSecondView.finalScore = self.scoreLabel.text;
  54. [self viewDidAppear:YES];
  55. }
  56.  
  57. }
  58.  
  59. - (void)viewDidLoad
  60. {
  61. [self setTimer];
  62. self.gameScore = 0;
  63.  
  64.  
  65. [super viewDidLoad];
  66. }
  67.  
  68. -(void)viewWillAppear:(BOOL)animated
  69. {
  70.  
  71. self.objFirstView = [[FirstViewController alloc]initWithNibName:@"FirstViewController." bundle:nil];
  72.  
  73. self.finalScoreText.text = [NSString stringWithFormat:@"%i",self.objFirstView.finalScore];
  74.  
  75. NSLog(@"NEW VIEW!!!!!! AND THE FINAL SCORE IS!!!! %i",self.objFirstView.finalScore);
  76.  
  77. }
  78.  
  79. - (void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  80. {
  81. SecondViewController *dest = [segue destinationViewController];
  82. dest.finalScoreText.text = [NSString stringWithFormat:@"%i",self.gamescore];
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement