-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainScene.m
13094 lines (10136 loc) · 466 KB
/
MainScene.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// ViewController.m
// Historiucs
//
// Created by Lance Walker on 2/17/15.
// Copyright (c) 2015 Lance Walker. All rights reserved.
// Add Test review and study help
#import "MainScene.h"
@implementation ViewController
#pragma mark - Sync Properties:
@synthesize SearchBar;
@synthesize AnswerScroll;
#pragma mark - Voids & Action Senders:
//Voids
- (void)viewDidLoad {
[super viewDidLoad];
if (IntroScreen == YES){
[self Begining];
} else if (IntroScreen == NO){
[self IntroScreen];
}
//NSUser Defaults
[[NSUserDefaults standardUserDefaults] synchronize];
}
-(void)Begining{ //Inital Void
//Boolien Control
RetrunBOOL = YES; FlashCards = NO; SearchBOOL = NO; Terms = NO; Unit1BOOL = NO; Unit2BOOL = NO; Unit3BOOL = NO; Unit4BOOL = NO; Unit5BOOL = NO; Ch1 = NO;
Ch2 = NO; Ch3 = NO; Ch4 = NO; Ch5 = NO; Ch6 = NO; Ch7 = NO; Ch8 = NO; Ch9 = NO; Ch10 = NO; Ch11 = NO; Ch12 = NO; Ch13 = NO; Ch14 = NO; Ch15 = NO; Ch16 =
NO; Ch17 = NO; Ch18 = NO; Ch19 = NO; Ch20 = NO; Ch21 = NO; Ch22 = NO; Ch23 = NO; ResultBOOL = NO; NextSelect = NO; PreviousSelect = NO; FirstResultBOOL = NO;
PauseBOOL = NO; NextResultBOOL = NO; IntroScreen = YES;
//End Boolien Control
//Integer Control
BeginningInt = 1; QuestionInt = 0; ChapterQuestionInt = 0; TimerMinutes = 0; TimerSeconds = 0; TimerHour = 0;
//End Integer Control
//End GUI
//Theme: Papyrus egyptian theme
//UI Element Control
//Timer
[Timer invalidate]; [Cycletimer invalidate];
//End Timer
//Fonts/ Styles
//Texts
MainTitle.text = @"Historicus"; SearchBar.text = @"";
[PreviousQuestion setTitle:@"Return" forState:UIControlStateNormal]; [QuitButton setTitle:@"Return Home" forState:UIControlStateNormal];
[BackButton setTitle:@"Back" forState:UIControlStateNormal];
[Unit1Button setTitle:@"Unit 1, Time period: Prehistory - 600 CE" forState:UIControlStateNormal];
[Unit2Button setTitle:@"Unit 2, Time period: 600 CE- 1450 CE" forState:UIControlStateNormal];
[Unit3Button setTitle:@"Unit 3, Time period: 1450 CE - 1750 CE" forState:UIControlStateNormal];
[Unit4Button setTitle:@"Unit 4, Time period: 1750 CE - 1914 CE" forState:UIControlStateNormal];
[Unit5Button setTitle:@"Unit 5, Time period: 1914 CE - Present Day" forState:UIControlStateNormal];
TimerLabelSeconds.text = @"Time, 00:00";
//End Texts
//End UI Element Control
//GUI
PreviousQuestion.hidden = YES; BackButton.hidden = YES; SearchButton.hidden = YES; SearchBar.hidden = YES; QuestionNumber.hidden = YES;
PreviousCard.hidden = YES; QuitButton.hidden = YES; Unit1Scroll.hidden = YES; Unit2Scroll.hidden = YES; Unit3Scroll.hidden = YES;
Unit4Scroll.hidden = YES; Unit5Scroll.hidden = YES; FlashCardTitle.hidden = YES; AnswertocardLabel.hidden = YES; AnswerScroll.hidden = YES; Unit1Button.hidden = YES;
Unit2Button.hidden = YES; Unit3Button.hidden = YES; Unit4Button.hidden = YES; Unit5Button.hidden = YES; TimerLabelSeconds.hidden = YES;
ReturnButton.hidden = YES; ResumeButton.hidden = YES; NextCard.hidden = YES; Answertocard.hidden = YES; EraseAllDataButton.hidden = YES;
SettingButton.hidden = NO; FlashCardsButton.hidden = NO; TermsButton.hidden = NO; StudyLog.hidden = NO; IntroImg.hidden = YES; MainTitle.hidden = NO;
MarginLine.hidden = NO;
//End GUI
//Scrolls View GUI
//Scroll view GUI
Unit1Scroll.backgroundColor = [UIColor clearColor];
Unit2Scroll.backgroundColor = [UIColor clearColor];
Unit3Scroll.backgroundColor = [UIColor clearColor];
Unit4Scroll.backgroundColor = [UIColor clearColor];
Unit5Scroll.backgroundColor = [UIColor clearColor];
Unit1Scroll.layer.cornerRadius = 11;
Unit1Scroll.layer.masksToBounds = YES;
Unit1Scroll.layer.borderWidth = 2;
Unit1Scroll.layer.borderColor = [UIColor blackColor].CGColor;
Unit2Scroll.layer.cornerRadius = 11;
Unit2Scroll.layer.masksToBounds = YES;
Unit2Scroll.layer.borderWidth = 2;
Unit2Scroll.layer.borderColor = [UIColor blackColor].CGColor;
Unit3Scroll.layer.cornerRadius = 11;
Unit3Scroll.layer.masksToBounds = YES;
Unit3Scroll.layer.borderWidth = 2;
Unit3Scroll.layer.borderColor = [UIColor blackColor].CGColor;
Unit4Scroll.layer.cornerRadius = 11;
Unit4Scroll.layer.masksToBounds = YES;
Unit4Scroll.layer.borderWidth = 2;
Unit4Scroll.layer.borderColor = [UIColor blackColor].CGColor;
Unit5Scroll.layer.cornerRadius = 11;
Unit5Scroll.layer.masksToBounds = YES;
Unit5Scroll.layer.borderWidth = 2;
Unit5Scroll.layer.borderColor = [UIColor blackColor].CGColor;
//End UI Element Control
[AnswertocardLabel setNumberOfLines:100];
[AnswertocardLabel sizeToFit];
Zero = @"0";
//Data Recalls
UserDefaults = [NSUserDefaults standardUserDefaults];
InitialLoad = [[NSUserDefaults standardUserDefaults] integerForKey:@"InitialInt"];
[self.AnswerScroll setContentSize:CGSizeMake(553, 400)];
[self.AnswerScroll setPagingEnabled:YES];
[self.AnswerScroll addSubview:AnswertocardLabel];
if (InitialLoad == 0){ //First time game is loaded
//TitleScreen
InitialLoad = 1;
//Study log == 0,0,0
LogArray = [[NSMutableArray alloc] init];
LogMinutes = 0;
LogSeconds = 0;
LogHours = 0;
[[NSUserDefaults standardUserDefaults] setInteger:InitialLoad forKey:@"InitialInt"];
//Save
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
[userDefaults setObject:LogArray forKey:@"StudyLogArray"];
[userDefaults synchronize];
} else if (InitialLoad == 1) { //Other times game is loaded
//Data Recalls
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
LogArray = [[userDefaults objectForKey:@"StudyLogArray"]mutableCopy];
//NSUInteger
LogSeconds = [[NSUserDefaults standardUserDefaults] integerForKey:@"LogSeconds"];
LogMinutes = [[NSUserDefaults standardUserDefaults] integerForKey:@"LogMinutes"];
LogHours = [[NSUserDefaults standardUserDefaults] integerForKey:@"LogHours"];
}
//Develper Log
NSLog(@"Array: %@", LogArray);
NSLog(@"Seconds: %i", LogSeconds);
NSLog(@"Minutes: %i", LogMinutes);
NSLog(@"Hours: %i", LogHours);
//End Develper
}
//Tutorial
-(void)IntroScreen{
[self performSelector:@selector(Begining) withObject:nil afterDelay:2.0];
//GUI
SettingButton.hidden = YES; FlashCardsButton.hidden = YES; TermsButton.hidden = YES; StudyLog.hidden = YES; IntroImg.hidden = NO; MainTitle.hidden = YES; MarginLine.hidden = YES;
PreviousQuestion.hidden = YES; BackButton.hidden = YES; SearchButton.hidden = YES; SearchBar.hidden = YES; QuestionNumber.hidden = YES;
PreviousCard.hidden = YES; QuitButton.hidden = YES; Unit1Scroll.hidden = YES; Unit2Scroll.hidden = YES; Unit3Scroll.hidden = YES;
Unit4Scroll.hidden = YES; Unit5Scroll.hidden = YES; FlashCardTitle.hidden = YES; AnswertocardLabel.hidden = YES; AnswerScroll.hidden = YES; Unit1Button.hidden = YES;
Unit2Button.hidden = YES; Unit3Button.hidden = YES; Unit4Button.hidden = YES; Unit5Button.hidden = YES; TimerLabelSeconds.hidden = YES;
ReturnButton.hidden = YES; ResumeButton.hidden = YES; NextCard.hidden = YES; Answertocard.hidden = YES;
EraseAllDataButton.hidden = YES;
//End GUI
//Texts
MainTitle.text = @"Historicus"; SearchBar.text = @"";
[ResumeButton setTitle:@"Resume Session" forState:UIControlStateNormal];
[PreviousQuestion setTitle:@"Return" forState:UIControlStateNormal]; [QuitButton setTitle:@"Return Home" forState:UIControlStateNormal];
[BackButton setTitle:@"Back" forState:UIControlStateNormal];
[Unit1Button setTitle:@"Unit 1, Time period: Prehistory - 600 CE" forState:UIControlStateNormal];
[Unit2Button setTitle:@"Unit 2, Time period: 600 CE- 1450 CE" forState:UIControlStateNormal];
[Unit3Button setTitle:@"Unit 3, Time period: 1450 CE - 1750 CE" forState:UIControlStateNormal];
[Unit4Button setTitle:@"Unit 4, Time period: 1750 CE - 1914 CE" forState:UIControlStateNormal];
[Unit5Button setTitle:@"Unit 5, Time period: 1914 CE - Present Day" forState:UIControlStateNormal];
TimerLabelSeconds.text = @"Time, 00:00:00";
//End Texts
}
-(void)PauseVoid{
if (FlashCards == YES){
if (FirstResultBOOL == NO & SearchBOOL == NO){
PreviousQuestionInt = QuestionInt;
NSLog(@"%i", PreviousQuestionInt);
} else {
nil;
}
}
if (Terms == YES){
if (FirstResultBOOL == NO & SearchBOOL == NO){
PreviousTermInt = ChapterQuestionInt;
NSLog(@"%i", PreviousQuestionInt);
} else {
nil;
}
}
//Common Implementation
//GUI
ReturnButton.hidden = YES; NextCard.hidden = YES; AnswertocardLabel.hidden = YES; AnswerScroll.hidden = YES; Answertocard.hidden = YES;
QuestionNumber.hidden = YES;
QuitButton.hidden = NO; SearchBar.hidden = NO; SearchButton.hidden = NO; PreviousCard.hidden = YES; ResumeButton.hidden = NO;
FlashCardTitle.hidden = YES;
MainTitle.hidden = NO; TimerLabelSeconds.hidden = YES;
//End GUI
//UI Element Control
MainTitle.text = [NSString stringWithFormat:@"%@ paused", PauseString];
[ResumeButton setTitle:[NSString stringWithFormat:@"Resume %@", PauseString] forState:UIControlStateNormal];
//End UI Element Control
//BOOliens
PauseBOOL = YES;
//Timer Control
[Timer invalidate];
[Cycletimer invalidate];
}
-(void)CycleVoid{ //Search Void == Response
if (PreviousSelect == NO & NextSelect == NO){ //First Search Method
//Search Method first
if (FlashCards == YES){
QuestionInt = QuestionInt + 1;
[self QuestionsVoid]; //Database
} else if (Terms == YES){
ChapterQuestionInt = ChapterQuestionInt + 1;
[self ChapterTerms];
}
} else if (NextSelect == YES){ //Next Result
//Search Method
if (FlashCards == YES){
QuestionInt = QuestionInt + 1;
[self QuestionsVoid]; //Database
} else if (Terms == YES){
ChapterQuestionInt = ChapterQuestionInt + 1;
[self ChapterTerms];
}
} else if (PreviousSelect == YES){ //Previous Result
//Search Method
if (FlashCards == YES){
QuestionInt = QuestionInt - 1;
[self QuestionsVoid]; //Database
} else if (Terms == YES){
ChapterQuestionInt = ChapterQuestionInt - 1;
[self ChapterTerms];
}
}
if ([ReturnString containsString:EndStringUpper] || [ReturnString containsString:EndStringLower]){
[self SearchResultVoid];
}
//Terms Here
if (FlashCards == YES){
if (QuestionInt == 1100){ //No Result/End of Results
NSLog(@"Boolien read");
if (NoResults == YES){
FlashCardTitle.text = [NSString stringWithFormat:@"No results containing: %@", EndStringUpper];
QuestionNumber.text = @"Question 1100/1100";
PreviousCard.hidden = YES;
} else {
FlashCardTitle.text = [NSString stringWithFormat:@"No more results containing: %@", EndStringUpper];
QuestionNumber.text = @"Question 1100/1100";
PreviousCard.hidden = NO;
PreviousSelect = YES;
NextResultBOOL = YES;
}
//GUI
NextCard.hidden = YES; PreviousQuestion.hidden = NO; ReturnButton.hidden = NO; SearchBar.hidden = YES;
SearchBar.text = @""; Answertocard.hidden = YES;
//End GUI
//UI Element Control
[Cycletimer invalidate]; //Stop Search Method
}
} else if (Terms == YES){
if (ChapterQuestionInt == 329){
if (NoResults == YES){
FlashCardTitle.text = [NSString stringWithFormat:@"No results containing: %@", EndStringUpper];
PreviousCard.hidden = YES;
} else {
FlashCardTitle.text = [NSString stringWithFormat:@"No more results containing: %@", EndStringUpper];
PreviousCard.hidden = NO;
}
//GUI
NextCard.hidden = YES; PreviousQuestion.hidden = NO; ReturnButton.hidden = NO; SearchBar.hidden = YES;
SearchBar.text = @""; Answertocard.hidden = YES;
//End GUI
//UI Element Control
[Cycletimer invalidate]; //Stop Search Method
}
}
}
//Search == Response
-(void)SearchResultVoid{
//Boolien Control
NoResults = NO; NextResultBOOL = YES; PreviousSelect = NO; NextSelect = NO;
//End Boolien Control
if (FirstResultBOOL == YES){
FirstResultBOOL = NO;
if (FlashCards == YES){
FirstResult = QuestionInt;
} else if (Terms == YES){
FirstResult = ChapterQuestionInt;
}
} else {
nil;
}
if (FirstResult == QuestionInt || FirstResult == ChapterQuestionInt){
PreviousCard.hidden = YES;
} else if (FirstResult != QuestionInt || FirstResult != ChapterQuestionInt){
PreviousCard.hidden = NO;
}
//GUI
SearchBar.hidden = YES; NextCard.hidden = NO; PreviousQuestion.hidden = NO; ReturnButton.hidden = NO; QuestionNumber.hidden = NO; Answertocard.hidden = NO;
MainTitle.hidden = YES; FlashCardTitle.hidden = NO; TimerLabelSeconds.hidden = NO;
//End GUI
//UI Element Control
SearchBar.text = @"";
FlashCardTitle.text = [NSString stringWithFormat:@"%@", ReturnString];
AnswertocardLabel.text = [NSString stringWithFormat:@"%@", AnswerString];
//Conditional
if (FlashCards == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/1100", QuestionInt];
//Int Control
PreviousResultInt = QuestionInt;
[self QuestionsVoid];
} else if (Terms == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/329", ChapterQuestionInt];
//Int Control
PreviousResultInt = ChapterQuestionInt;
[self ChapterTerms];
}
//End UI Element Control
[Cycletimer invalidate];
NSLog(@"%i", PreviousResultInt);
NSLog(@"%i", FirstResult);
}
-(void)QuestionSelectorVoid{ //Database restrictions
if (FlashCards == YES & SearchBOOL == NO & FirstResultBOOL == NO){
if (Unit1BOOL == YES){ //Unit 1 restrictions
if (QuestionInt < 2){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (QuestionInt > 127){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Unit2BOOL == YES){ //Unit 2 restrictions
if (QuestionInt < 129){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (QuestionInt > 410){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Unit3BOOL == YES){ //Unit 3 Restrictions
if (QuestionInt < 412){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (QuestionInt > 637){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Unit4BOOL == YES){ //Unit 4 Restrictions
if (QuestionInt < 639){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (QuestionInt > 905){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Unit5BOOL == YES){ //Unit 5 Restrictions
if (QuestionInt < 906){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (QuestionInt > 1100){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
}
if (Terms == YES){
if (Ch1 == YES){ //Ch 1 restrictions
if (ChapterQuestionInt < 115){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 126){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch2 == YES){ //Ch 2 restrictions
if (ChapterQuestionInt < 129){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 138){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch3 == YES){ //Ch 3 restrictions
if (ChapterQuestionInt < 141){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 150){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch4 == YES){ //Ch4 restrictions
if (ChapterQuestionInt < 153){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 161){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch5 == YES){ //Ch5 restrictions
if (ChapterQuestionInt < 175){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 187){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch6 == YES){ //Ch6 restrictions
if (ChapterQuestionInt < 190){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 198){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch7 == YES){ //Ch7 restrictions
if (ChapterQuestionInt < 201){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 208){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch8 == YES){ //Ch8 restrictions
if (ChapterQuestionInt < 211){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 218){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch9 == YES){ //Ch9 restrictions
if (ChapterQuestionInt < 221){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 234){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch10 == YES){ //Ch10 restrictions
if (ChapterQuestionInt < 237){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 250){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch11 == YES){ //Ch11 restirctions
if (ChapterQuestionInt < 253){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 268){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch12 == YES){ //Ch12 restrictions
if (ChapterQuestionInt < 271){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 280){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch13 == YES){ //Ch13 restrictions
if (ChapterQuestionInt < 283){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 298){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch14 == YES){ //Ch14 restrictions
if (ChapterQuestionInt < 301){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 315){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch15 == YES){ //Ch15 restrictions
if (ChapterQuestionInt < 318){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 328){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch16 == YES){ //Ch16 restrictions
if (ChapterQuestionInt < 2){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 13){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch17 == YES){ //Ch17 restrictions
if (ChapterQuestionInt < 16){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 24){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch18 == YES){ //Ch18 restrictions
if (ChapterQuestionInt < 27){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 39){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch19 == YES){ //Ch19 restrictions
if (ChapterQuestionInt < 42){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 54){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch20 == YES){ //Ch20 restrictions
if (ChapterQuestionInt < 57){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 65){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch21 == YES){ //Ch21 restrictions
if (ChapterQuestionInt < 68){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 82){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch22 == YES){ //Ch22 restrictions
if (ChapterQuestionInt < 85){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 98){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
if (Ch23 == YES){ //Ch23 restrictions
if (ChapterQuestionInt < 101){
PreviousCard.hidden = YES;
} else {
PreviousCard.hidden = NO;
}
if (ChapterQuestionInt > 112){
NextCard.hidden = YES;
} else {
NextCard.hidden = NO;
}
}
}
}
-(void)SecondsVoid{ //Timer Control
TimerSeconds = TimerSeconds + 1;
//Hours
if (TimerHour < 10){
HourReadout = [NSString stringWithFormat:@"0%i", TimerHour];
} else {
HourReadout = [NSString stringWithFormat:@"%i", TimerHour];
}
//Minutes
if (TimerMinutes == 60){
MinuteReadout = [NSString stringWithFormat:@"00"];
TimerMinutes = 0;
}
if (TimerMinutes < 10){
MinuteReadout = [NSString stringWithFormat:@"0%i", TimerMinutes];
} else {
MinuteReadout = [NSString stringWithFormat:@"%i", TimerMinutes];
}
//Seconds
if (TimerSeconds == 60){
SecondsReadout = [NSString stringWithFormat:@"00"];
TimerSeconds = 0;
} else if (TimerSeconds < 10){
SecondsReadout = [NSString stringWithFormat:@"0%i", TimerSeconds];
} else {
SecondsReadout = [NSString stringWithFormat:@"%i", TimerSeconds];
}
//Update Integers
if (TimerSeconds == 59){
TimerMinutes = TimerMinutes + 1;
}
if (TimerMinutes == 59){
TimerMinutes = 0;
TimerHour = TimerHour + 1;
}
//UI
if (TimerHour == 0){
TimerLabelSeconds.text = [NSString stringWithFormat:@"Time, %@:%@", MinuteReadout, SecondsReadout];
} else {
TimerLabelSeconds.text = [NSString stringWithFormat:@"Time, %@:%@:%@", HourReadout, MinuteReadout, SecondsReadout];
}
//Time Stamp
totalTimeString = [NSString stringWithFormat:@"Time Studied, %@:%@:%@", HourReadout, MinuteReadout, SecondsReadout];
}
//Converts Seconds > 59 = Mintes & Minutes = Hours > 59 //Days
-(void)ConvertDataLog{
ConvertSeconds = LogSeconds - 60;
ConvertMinutes = LogMinutes - 60;
if (ConvertSeconds < 0){
LogSeconds = LogSeconds;
} else {
LogMinutes = LogMinutes + 1;
LogSeconds = LogSeconds - 60;
[self ConvertDataLog];
}
if (ConvertMinutes < 0){
LogMinutes = LogMinutes;
} else {
LogHours = LogHours + 1;
LogMinutes = LogMinutes - 60;
[self ConvertDataLog];
}
//Develper
NSLog(@"Converted Seconds: %i", LogSeconds); //Logs Seconds
NSLog(@"Converted Minutes: %i", LogMinutes); //Logs Minutes
NSLog(@"Converted Hours: %i", LogHours); //Logs Hour
//End Dervelper
//Re-saved log data
//[UserDefaults setObject:LogArray forKey:@"BookMarks"]; //Saves BookMarks
[[NSUserDefaults standardUserDefaults] setInteger:LogSeconds forKey:@"LogSeconds"]; //Resaves logged seconds
[[NSUserDefaults standardUserDefaults] setInteger:LogMinutes forKey:@"LogMinutes"]; //Resaves logged minutes
[[NSUserDefaults standardUserDefaults] setInteger:LogHours forKey:@"LogHours"]; //Resaves logged hours
}
-(void)CommonVoidUnits{
if (FlashCards == YES){
if (BeginningBOOL == YES){
BeginningBOOL = NO;
QuestionNumberInt = 1;
//GUI
Unit1Button.hidden = YES; Unit2Button.hidden = YES; Unit3Button.hidden = YES; Unit4Button.hidden = YES; Unit5Button.hidden = YES;
MainTitle.hidden = YES; FlashCardTitle.hidden = NO; Answertocard.hidden = NO; BackButton.hidden = YES; ReturnButton.hidden = NO;
TimerLabelSeconds.hidden = NO; QuestionNumber.hidden = NO;
//End GUI
//Inital Time Stamp
CurrentDate = [NSDate date];
intialTimeFormat = [[NSDateFormatter alloc] init];
[intialTimeFormat setDateFormat:@"hh:mm a"];
intialTimeString = [intialTimeFormat stringFromDate:CurrentDate];
Timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(SecondsVoid) userInfo:nil repeats:YES];
}
//UI Element Control
FlashCardTitle.text = [NSString stringWithFormat:@"%@", ReturnString];
AnswertocardLabel.text = [NSString stringWithFormat:@"%@", AnswerString];
[ReturnButton setTitle:@"Pause" forState:UIControlStateNormal];
if (Unit1BOOL == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/128", QuestionNumberInt];
PauseString = @"Unit 1";
} else if (Unit2BOOL == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/282", QuestionNumberInt];
PauseString = @"Unit 2";
} else if (Unit3BOOL == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/226", QuestionNumberInt];
PauseString = @"Unit 3";
} else if (Unit4BOOL == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/267", QuestionNumberInt];
PauseString = @"Unit 4";
} else if (Unit5BOOL == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/300", QuestionNumberInt];
PauseString = @"Unit 5";
}
if (Answer == NO){
Answer = YES;
AnswertocardLabel.hidden = YES;
AnswerScroll.hidden = YES;
[Answertocard setTitle:@"Reveal Answer" forState:UIControlStateNormal];
} else {
nil;
}
//Develper
NSLog(@"Previous search method %i", PreviousResultInt); // Previous == Search method
//End Develper
//Integer Control
PreviousResultInt = QuestionInt;
//End Integer Control
[self QuestionSelectorVoid];
}
}
-(void)CommonTermUnits{
if (BeginningBOOL == YES){
//Boolien Control
BeginningBOOL = NO;
//End Boolien Control
//GUI Control
Answertocard.hidden = NO; TimerLabelSeconds.hidden = NO;
//End GUI Control
//Integer control
QuestionNumberInt = 1;
//End Integer Control
//Inital Time Stamp
CurrentDate = [NSDate date];
intialTimeFormat = [[NSDateFormatter alloc] init];
[intialTimeFormat setDateFormat:@"hh:mm a"];
intialTimeString = [intialTimeFormat stringFromDate:CurrentDate];
Timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(SecondsVoid) userInfo:nil repeats:YES];
}
//GUI Control
MainTitle.hidden = YES; FlashCardTitle.hidden = NO; Unit1Scroll.hidden = YES; Unit2Scroll.hidden = YES; Unit3Scroll.hidden = YES;
Unit4Scroll.hidden = YES; Unit5Scroll.hidden = YES; BackButton.hidden = YES; ReturnButton.hidden = NO; QuestionNumber.hidden = NO;
//End GUI Control
//UI Element Control
FlashCardTitle.text = [NSString stringWithFormat:@"%@", ReturnString];
AnswertocardLabel.text = [NSString stringWithFormat:@"%@", AnswerString];
[ReturnButton setTitle:@"Pause" forState:UIControlStateNormal];
if (Ch1 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/14", QuestionNumberInt];
PauseString = @"Chapter 1";
} else if (Ch2 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/12", QuestionNumberInt];
PauseString = @"Chapter 2";
} else if (Ch3 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/12", QuestionNumberInt];
PauseString = @"Chapter 3";
} else if (Ch4 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/12", QuestionNumberInt];
PauseString = @"Chapter 4";
} else if (Ch5 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/15", QuestionNumberInt];
PauseString = @"Chapter 5";
} else if (Ch6 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/11", QuestionNumberInt];
PauseString = @"Chapter 6";
} else if (Ch7 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/10", QuestionNumberInt];
PauseString = @"Chapter 7";
} else if (Ch8 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/10", QuestionNumberInt];
PauseString = @"Chapter 8";
} else if (Ch9 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/17", QuestionNumberInt];
PauseString = @"Chapter 9";
} else if (Ch10 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/16", QuestionNumberInt];
PauseString = @"Chapter 10";
} else if (Ch11 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/19", QuestionNumberInt];
PauseString = @"Chapter 11";
} else if (Ch12 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/12", QuestionNumberInt];
PauseString = @"Chapter 12";
} else if (Ch13 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/18", QuestionNumberInt];
PauseString = @"Chapter 13";
} else if (Ch14 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/17", QuestionNumberInt];
PauseString = @"Chapter 14";
} else if (Ch15 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/13", QuestionNumberInt];
PauseString = @"Chapter 15";
} else if (Ch16 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/14", QuestionNumberInt];
PauseString = @"Chapter 16";
} else if (Ch17 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/11", QuestionNumberInt];
PauseString = @"Chapter 17";
} else if (Ch18 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/15", QuestionNumberInt];
PauseString = @"Chapter 18";
} else if (Ch19 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/15", QuestionNumberInt];
PauseString = @"Chapter 19";
} else if (Ch20 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/11", QuestionNumberInt];
PauseString = @"Chapter 20";
} else if (Ch21 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/18", QuestionNumberInt];
PauseString = @"Chapter 21";
} else if (Ch22 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/16", QuestionNumberInt];
PauseString = @"Chapter 22";
} else if (Ch23 == YES){
QuestionNumber.text = [NSString stringWithFormat:@"Question %i/14", QuestionNumberInt];
PauseString = @"Chapter 23";
}
//End Element Control