Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2014
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. -(void)Workauto{
  2. secondsCount1 = 10;
  3. autoperiods = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(autoperiod) userInfo:nil repeats:YES];
  4. }
  5.  
  6. -(void)autoperiod{
  7. secondsCount1 = secondsCount1 -1;
  8. int minuts = secondsCount1/ 60;
  9. int seconds = secondsCount1 - (minuts * 60);
  10.  
  11. NSString *timerOutput = [NSString stringWithFormat:@"%2d:%.2d", minuts , seconds];
  12. Count.text = timerOutput;
  13. if (secondsCount1 == 0){
  14. secondsCount1=0;
  15. [autoperiods invalidate];
  16. autoperiods=nil;
  17.  
  18. Count.hidden=YES;
  19. AutoTimeLeftLabel.hidden=YES;
  20. TimeLeft.hidden=NO;
  21. TimeLeftlabel.hidden=NO;
  22.  
  23. Ball.hidden=NO;
  24. Ball2.hidden=NO;
  25. BluBall.hidden=NO;
  26. BluBall2.hidden=NO;
  27.  
  28. RedHigh1.hidden=YES;
  29. RedHigh2.hidden=YES;
  30. RedHigh3.hidden=YES;
  31. RedHigh4.hidden=YES;
  32.  
  33. RedLow1.hidden=YES;
  34. RedLow2.hidden=YES;
  35.  
  36. BlueHigh1.hidden=YES;
  37. BlueHigh2.hidden=YES;
  38. BlueHigh3.hidden=YES;
  39. BlueHigh4.hidden=YES;
  40.  
  41. BlueLow1.hidden=YES;
  42. BlueLow2.hidden=YES;
  43.  
  44. RedMid1.hidden=YES;
  45. RedMid2.hidden=YES;
  46. RedMid3.hidden=YES;
  47. RedMid4.hidden=YES;
  48.  
  49. BlueMid1.hidden=YES;
  50. BlueMid2.hidden=YES;
  51. BlueMid3.hidden=YES;
  52. BlueMid4.hidden=YES;
  53.  
  54. move = [NSTimer scheduledTimerWithTimeInterval:0.03 target:self selector:@selector(move) userInfo:nil repeats:YES];
  55. pos = CGPointMake(4.0, -4.0);
  56. move2 = [NSTimer scheduledTimerWithTimeInterval:0.04 target:self selector:@selector(move2) userInfo:nil repeats:YES];
  57. pos2 = CGPointMake(3.0, 4.0);
  58. Update = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(onTimer) userInfo:nil repeats:YES];
  59. DPad = [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(DPad) userInfo:nil repeats:YES];
  60.  
  61. //RedGoals = [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(RedGoals) userInfo:nil repeats:YES];
  62. //BlueGoals = [NSTimer scheduledTimerWithTimeInterval:0.001 target:self selector:@selector(BlueGoals) userInfo:nil repeats:YES];
  63. [self SetTimer];
  64. }
  65. }
  66.  
  67. -(void)SetTimer{
  68. comeonandcount = 150;
  69. GameTimer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(GameTimerCo) userInfo:nil repeats:YES];
  70. }
  71.  
  72. -(void)GameTimerCo{
  73. comeonandcount = comeonandcount - 1;
  74. int minuts = comeonandcount / 60;
  75. int seconds = comeonandcount - (minuts * 60);
  76.  
  77. NSString *timerOutputGame = [NSString stringWithFormat:@"%2d:%.2d", minuts , seconds];
  78. TimeLeft.text = timerOutputGame;
  79.  
  80. if (comeonandcount == 0){
  81. comeonandcount=0;
  82. [GameTimer invalidate];
  83. GameTimer=nil;
  84.  
  85. [move invalidate];
  86. [move2 invalidate];
  87. }
  88. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement