diff --git a/HeadsUpper/.DS_Store b/HeadsUpper/.DS_Store new file mode 100644 index 0000000..9b5579d Binary files /dev/null and b/HeadsUpper/.DS_Store differ diff --git a/HeadsUpper/HeadsUpper.xcodeproj/project.pbxproj b/HeadsUpper/HeadsUpper.xcodeproj/project.pbxproj index fb900f8..a7a055e 100644 --- a/HeadsUpper/HeadsUpper.xcodeproj/project.pbxproj +++ b/HeadsUpper/HeadsUpper.xcodeproj/project.pbxproj @@ -7,21 +7,42 @@ objects = { /* Begin PBXBuildFile section */ + 5D9DB1531C7A139C00BCB139 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D9DB1521C7A139C00BCB139 /* QuartzCore.framework */; }; + 5D9DB1551C7A151900BCB139 /* TT Pines Bold Italic DEMO.otf in Resources */ = {isa = PBXBuildFile; fileRef = 5D9DB1541C7A151900BCB139 /* TT Pines Bold Italic DEMO.otf */; }; + 5D9DB1611C7A21AD00BCB139 /* GameCategoriesTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D9DB1601C7A21AD00BCB139 /* GameCategoriesTableViewController.m */; }; + 5D9DB1641C7A21FE00BCB139 /* GameCategoryTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D9DB1631C7A21FE00BCB139 /* GameCategoryTableViewCell.m */; }; + 5D9DB1671C7A2F7000BCB139 /* GameViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D9DB1661C7A2F7000BCB139 /* GameViewController.m */; }; + 5D9DB16A1C7A4B9500BCB139 /* AudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 5D9DB1691C7A4B9500BCB139 /* AudioPlayer.m */; }; + 5D9DB16C1C7A4BA400BCB139 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5D9DB16B1C7A4BA400BCB139 /* AVFoundation.framework */; }; + 5D9DB16F1C7A4E3600BCB139 /* correct.wav in Resources */ = {isa = PBXBuildFile; fileRef = 5D9DB16D1C7A4E3600BCB139 /* correct.wav */; }; + 5D9DB1701C7A4E3600BCB139 /* incorrect.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 5D9DB16E1C7A4E3600BCB139 /* incorrect.mp3 */; }; + 5D9DB1741C7A60CF00BCB139 /* glamour.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 5D9DB1731C7A60CF00BCB139 /* glamour.mp3 */; }; 8D89695C1C755D0200D32E8A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D89695B1C755D0200D32E8A /* main.m */; }; 8D89695F1C755D0200D32E8A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D89695E1C755D0200D32E8A /* AppDelegate.m */; }; - 8D8969621C755D0200D32E8A /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8D8969611C755D0200D32E8A /* ViewController.m */; }; 8D8969651C755D0200D32E8A /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D8969631C755D0200D32E8A /* Main.storyboard */; }; 8D8969671C755D0200D32E8A /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8D8969661C755D0200D32E8A /* Assets.xcassets */; }; 8D89696A1C755D0200D32E8A /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8D8969681C755D0200D32E8A /* LaunchScreen.storyboard */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 5D9DB1521C7A139C00BCB139 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 5D9DB1541C7A151900BCB139 /* TT Pines Bold Italic DEMO.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "TT Pines Bold Italic DEMO.otf"; sourceTree = ""; }; + 5D9DB15F1C7A21AD00BCB139 /* GameCategoriesTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameCategoriesTableViewController.h; sourceTree = ""; }; + 5D9DB1601C7A21AD00BCB139 /* GameCategoriesTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameCategoriesTableViewController.m; sourceTree = ""; }; + 5D9DB1621C7A21FE00BCB139 /* GameCategoryTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameCategoryTableViewCell.h; sourceTree = ""; }; + 5D9DB1631C7A21FE00BCB139 /* GameCategoryTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameCategoryTableViewCell.m; sourceTree = ""; }; + 5D9DB1651C7A2F7000BCB139 /* GameViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GameViewController.h; sourceTree = ""; }; + 5D9DB1661C7A2F7000BCB139 /* GameViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GameViewController.m; sourceTree = ""; }; + 5D9DB1681C7A4B9500BCB139 /* AudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioPlayer.h; sourceTree = ""; }; + 5D9DB1691C7A4B9500BCB139 /* AudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AudioPlayer.m; sourceTree = ""; }; + 5D9DB16B1C7A4BA400BCB139 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 5D9DB16D1C7A4E3600BCB139 /* correct.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = correct.wav; sourceTree = ""; }; + 5D9DB16E1C7A4E3600BCB139 /* incorrect.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = incorrect.mp3; sourceTree = ""; }; + 5D9DB1731C7A60CF00BCB139 /* glamour.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = glamour.mp3; sourceTree = ""; }; 8D8969571C755D0200D32E8A /* HeadsUpper.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HeadsUpper.app; sourceTree = BUILT_PRODUCTS_DIR; }; 8D89695B1C755D0200D32E8A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 8D89695D1C755D0200D32E8A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 8D89695E1C755D0200D32E8A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; - 8D8969601C755D0200D32E8A /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; - 8D8969611C755D0200D32E8A /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 8D8969641C755D0200D32E8A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 8D8969661C755D0200D32E8A /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 8D8969691C755D0200D32E8A /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; @@ -33,6 +54,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 5D9DB16C1C7A4BA400BCB139 /* AVFoundation.framework in Frameworks */, + 5D9DB1531C7A139C00BCB139 /* QuartzCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -42,6 +65,8 @@ 8D89694E1C755D0200D32E8A = { isa = PBXGroup; children = ( + 5D9DB16B1C7A4BA400BCB139 /* AVFoundation.framework */, + 5D9DB1521C7A139C00BCB139 /* QuartzCore.framework */, 8D8969591C755D0200D32E8A /* HeadsUpper */, 8D8969581C755D0200D32E8A /* Products */, ); @@ -60,8 +85,14 @@ children = ( 8D89695D1C755D0200D32E8A /* AppDelegate.h */, 8D89695E1C755D0200D32E8A /* AppDelegate.m */, - 8D8969601C755D0200D32E8A /* ViewController.h */, - 8D8969611C755D0200D32E8A /* ViewController.m */, + 5D9DB1621C7A21FE00BCB139 /* GameCategoryTableViewCell.h */, + 5D9DB1631C7A21FE00BCB139 /* GameCategoryTableViewCell.m */, + 5D9DB15F1C7A21AD00BCB139 /* GameCategoriesTableViewController.h */, + 5D9DB1601C7A21AD00BCB139 /* GameCategoriesTableViewController.m */, + 5D9DB1651C7A2F7000BCB139 /* GameViewController.h */, + 5D9DB1661C7A2F7000BCB139 /* GameViewController.m */, + 5D9DB1681C7A4B9500BCB139 /* AudioPlayer.h */, + 5D9DB1691C7A4B9500BCB139 /* AudioPlayer.m */, 8D8969631C755D0200D32E8A /* Main.storyboard */, 8D8969661C755D0200D32E8A /* Assets.xcassets */, 8D8969681C755D0200D32E8A /* LaunchScreen.storyboard */, @@ -74,7 +105,11 @@ 8D89695A1C755D0200D32E8A /* Supporting Files */ = { isa = PBXGroup; children = ( + 5D9DB1541C7A151900BCB139 /* TT Pines Bold Italic DEMO.otf */, 8D89695B1C755D0200D32E8A /* main.m */, + 5D9DB16D1C7A4E3600BCB139 /* correct.wav */, + 5D9DB16E1C7A4E3600BCB139 /* incorrect.mp3 */, + 5D9DB1731C7A60CF00BCB139 /* glamour.mp3 */, ); name = "Supporting Files"; sourceTree = ""; @@ -138,7 +173,11 @@ files = ( 8D89696A1C755D0200D32E8A /* LaunchScreen.storyboard in Resources */, 8D8969671C755D0200D32E8A /* Assets.xcassets in Resources */, + 5D9DB1551C7A151900BCB139 /* TT Pines Bold Italic DEMO.otf in Resources */, + 5D9DB16F1C7A4E3600BCB139 /* correct.wav in Resources */, + 5D9DB1701C7A4E3600BCB139 /* incorrect.mp3 in Resources */, 8D8969651C755D0200D32E8A /* Main.storyboard in Resources */, + 5D9DB1741C7A60CF00BCB139 /* glamour.mp3 in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -149,7 +188,10 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 8D8969621C755D0200D32E8A /* ViewController.m in Sources */, + 5D9DB1671C7A2F7000BCB139 /* GameViewController.m in Sources */, + 5D9DB16A1C7A4B9500BCB139 /* AudioPlayer.m in Sources */, + 5D9DB1611C7A21AD00BCB139 /* GameCategoriesTableViewController.m in Sources */, + 5D9DB1641C7A21FE00BCB139 /* GameCategoryTableViewCell.m in Sources */, 8D89695F1C755D0200D32E8A /* AppDelegate.m in Sources */, 8D89695C1C755D0200D32E8A /* main.m in Sources */, ); @@ -300,6 +342,7 @@ 8D8969701C755D0200D32E8A /* Release */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; diff --git a/HeadsUpper/HeadsUpper/AppDelegate.h b/HeadsUpper/HeadsUpper/AppDelegate.h index 28b1de3..12095cb 100644 --- a/HeadsUpper/HeadsUpper/AppDelegate.h +++ b/HeadsUpper/HeadsUpper/AppDelegate.h @@ -6,11 +6,13 @@ // Copyright © 2016 Michael Kavouras. All rights reserved. // +#import #import @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; +@property (strong, nonatomic) AVAudioPlayer* backgroundMusicPlayer; @end diff --git a/HeadsUpper/HeadsUpper/AppDelegate.m b/HeadsUpper/HeadsUpper/AppDelegate.m index b8814af..12e005e 100644 --- a/HeadsUpper/HeadsUpper/AppDelegate.m +++ b/HeadsUpper/HeadsUpper/AppDelegate.m @@ -6,6 +6,7 @@ // Copyright © 2016 Michael Kavouras. All rights reserved. // + #import "AppDelegate.h" @interface AppDelegate () @@ -15,8 +16,18 @@ @interface AppDelegate () @implementation AppDelegate -- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"glamour" ofType:@"mp3"]]; + NSError *error; + self.backgroundMusicPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]; + [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil]; + [[AVAudioSession sharedInstance] setActive: YES error: nil]; + [[UIApplication sharedApplication] beginReceivingRemoteControlEvents]; + self.backgroundMusicPlayer.volume = 0.8; + self.backgroundMusicPlayer.numberOfLoops = -1; + [self.backgroundMusicPlayer play]; + return YES; } diff --git a/HeadsUpper/HeadsUpper/AudioPlayer.h b/HeadsUpper/HeadsUpper/AudioPlayer.h new file mode 100644 index 0000000..86601e9 --- /dev/null +++ b/HeadsUpper/HeadsUpper/AudioPlayer.h @@ -0,0 +1,19 @@ +// +// AudioPlayer.h +// HeadsUpper +// +// Created by Jackie Meggesto on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import +#import + +@interface AudioPlayer : NSObject + +@property (nonatomic) AVAudioPlayer* correctPlayer; +@property (nonatomic) AVAudioPlayer* incorrectPlayer; + +-(id)initWithAudioPlayers; + +@end diff --git a/HeadsUpper/HeadsUpper/AudioPlayer.m b/HeadsUpper/HeadsUpper/AudioPlayer.m new file mode 100644 index 0000000..152e248 --- /dev/null +++ b/HeadsUpper/HeadsUpper/AudioPlayer.m @@ -0,0 +1,38 @@ +// +// AudioPlayer.m +// HeadsUpper +// +// Created by Jackie Meggesto on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import "AudioPlayer.h" + +@implementation AudioPlayer + +-(id)initWithAudioPlayers +{ + + if(self == [super init]) { + + NSString *correctPath = [NSString stringWithFormat:@"%@/correct.wav", [[NSBundle mainBundle] resourcePath]]; + NSString *incorrectPath = [NSString stringWithFormat:@"%@/incorrect.mp3", [[NSBundle mainBundle] resourcePath]]; + + NSURL *correctSoundURL = [NSURL fileURLWithPath:correctPath]; + NSURL *incorrectSoundURL = [NSURL fileURLWithPath:incorrectPath]; + + self.correctPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:correctSoundURL error:nil]; + self.incorrectPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:incorrectSoundURL error:nil]; + self.correctPlayer.volume = 0.6; + self.incorrectPlayer.volume = 0.6; + + return self; + + } else { + return nil; + } + + +} + +@end diff --git a/HeadsUpper/HeadsUpper/Base.lproj/Main.storyboard b/HeadsUpper/HeadsUpper/Base.lproj/Main.storyboard index f56d2f3..9a46b92 100644 --- a/HeadsUpper/HeadsUpper/Base.lproj/Main.storyboard +++ b/HeadsUpper/HeadsUpper/Base.lproj/Main.storyboard @@ -1,25 +1,131 @@ - + - + + + + + TTPinesDEMO-BoldItalic + TTPinesDEMO-BoldItalic + TTPinesDEMO-BoldItalic + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - + - + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + diff --git a/HeadsUpper/HeadsUpper/GameCategoriesTableViewController.h b/HeadsUpper/HeadsUpper/GameCategoriesTableViewController.h new file mode 100644 index 0000000..4ca5c28 --- /dev/null +++ b/HeadsUpper/HeadsUpper/GameCategoriesTableViewController.h @@ -0,0 +1,13 @@ +// +// GameCategoriesTableViewController.h +// HeadsUpper +// +// Created by Jackie Meggesto on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import + +@interface GameCategoriesTableViewController : UITableViewController + +@end diff --git a/HeadsUpper/HeadsUpper/GameCategoriesTableViewController.m b/HeadsUpper/HeadsUpper/GameCategoriesTableViewController.m new file mode 100644 index 0000000..17ecd56 --- /dev/null +++ b/HeadsUpper/HeadsUpper/GameCategoriesTableViewController.m @@ -0,0 +1,93 @@ +// +// GameCategoriesTableViewController.m +// HeadsUpper +// +// Created by Jackie Meggesto on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import +#import "GameViewController.h" +#import +#import "GameCategoriesTableViewController.h" +#import "GameCategoryTableViewCell.h" + +@interface GameCategoriesTableViewController () + + + +@property (nonatomic) NSMutableDictionary* gameCategories; + +@end + +@implementation GameCategoriesTableViewController + +- (void)viewDidLoad { + + + + + [super viewDidLoad]; + [self.navigationItem setTitle:@"Main Menu"]; + [self setUpDataSource]; + +} + + + + +#pragma mark - Table view data source + +-(void)setUpDataSource +{ + self.gameCategories = [[NSMutableDictionary alloc]init]; + + [self.gameCategories setObject:@[@"Janet Jackson", @"Leighton Meester", @"Willow Smith", @"Matt Lauer", @"Josh Duhamel", @"Sharon Osbourne", @"Spencer Pratt", @"Demi Moore", @"Whitney Houston", @"Nicole Kidman", @"Miley Cyrus", @"Victoria Beckham", @"LeAnn Rimes", @"Dakota Fanning", @"Dr. Seuss", @"Ryan Phillippe", @"Steve Carell", @"Chris Rock", @"Collin Ferell", @"Drake", @"Rachel McAdams", @"Maya Rudolph"] forKey:@"Superstars"]; + [self.gameCategories setObject:@[@"El Niño", @"Viagra", @"Animaniacs", @"League of their Own", @"Happy Gilmore", @"Nick Carter", @"My Heart Will Go On", @"I Know What You Did Last Summer", @"Can You Feel The Love Tonight", @"The Macarana", @"Light-up Sneakers", @"Boy Meets World", @"Baby Got Back", @"Smells Like Teen Spirit", @"Super Soakers", @"7th Heaven", @"Garth Brooks", @"Floppy Discs", @"Kramer", @"Blink 182", @"Surge"] forKey:@"That's So 90's"]; + [self.gameCategories setObject:@[@"\"Girl On Fire\" Alicia Keys", @"\"U Can't Touch This\" \n MC Hammer", @"\"Hello\" Lionel Richie", @"\"Dark Horse\" Katy Perry", @"\"Someboyd To Love\" \n Queen", @"\"No Scrubs\" TLC", @"\"Happy\" Pharrell Williams", @"\"Piano Man\" Billy Joel", @"\"Blurred Lines\" \n Robin Thicke", @"\"Fantasy\" Mariah Carey", @"\"I Will Survive\" \n Gloria Gaynor", @"\"Come and Get it\" \n Selena Gomez", @"\"Halo\" Beyonce", @"\"I Believe I Can Fly\" \n R.Kelly", @"\"The Sign\" Ace of Base", @"\"Diamonds\" Rihanna", @"\"A Thousand Miles\" \n Vanessa Carlton", @"\"What a Wonderful World\" \n Louis Armstrong", @"\"We Belong Together\" \n Mariah Carey", @"\"(I Can't Get No) Satisfaction\""] forKey:@"Hey Mr. DJ"]; + [self.gameCategories setObject:@[@"Colin Farrell", @"Mozart", @"Billy Joel", @"Judy Garland", @"Napoleon Bonaparte", @"Queen Elizabeth II", @"Fred Armisen", @"Henry Ford", @"Jon Lovitz", @"Julia Child", @"Catherine the Great", @"Magic Johnson", @"Uma Thurman", @"Orson Welles", @"Kathy Bates", @"George Orwell", @"Billy Crystal", @"Farrah Fawcett", @"Gary Busey", @"Chris Farley", @"Tom Selleck", @"Alexander the Great"] forKey:@"Icons"]; + [self.gameCategories setObject:@[@"Chipmunk", @"Dragon", @"Wasp", @"Snake", @"Jellyfish", @"Emu", @"Boar", @"Crocodile", @"Shrimp", @"Lemur", @"Caterpillar", @"Sea Urchain", @"Dolphin ", @"Camel", @"Viper", @"Fox", @"Tuna", @"Baboon", @"Chinchilla", @"Human", @"Crawfish", @"Cricket", @"Frog", @"Tiger", @"Guinea Pig", @"Gnat", @"Killer Whale", @"Coral", @"T-Rex", @"Oyster"] forKey:@"Animals"]; + + +} + +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ +#warning Incomplete implementation, return the number of sections + return 1; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ +#warning Incomplete implementation, return the number of rows + return [self.gameCategories allKeys].count; +} + + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + GameCategoryTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GameCategory" forIndexPath:indexPath]; + + + cell.categoryLabel.text = [self.gameCategories allKeys][indexPath.row]; + + return cell; + +} + +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath + +{ + GameViewController* gvc = [self.storyboard instantiateViewControllerWithIdentifier:@"GameViewController"]; + + NSArray* keys = [self.gameCategories allKeys]; + NSMutableArray* arrayForGVC = [[NSMutableArray alloc]initWithArray:[self.gameCategories objectForKey:keys[indexPath.row]]]; + gvc.gameDataArray = arrayForGVC; + + [self.navigationController pushViewController:gvc animated:YES]; + +} + + + +@end diff --git a/HeadsUpper/HeadsUpper/GameCategoryTableViewCell.h b/HeadsUpper/HeadsUpper/GameCategoryTableViewCell.h new file mode 100644 index 0000000..620a05f --- /dev/null +++ b/HeadsUpper/HeadsUpper/GameCategoryTableViewCell.h @@ -0,0 +1,16 @@ +// +// GameCategoryTableViewCell.h +// HeadsUpper +// +// Created by Jackie Meggesto on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import + +@interface GameCategoryTableViewCell : UITableViewCell + +@property (nonatomic) IBOutlet UILabel* categoryLabel; +@property (nonatomic) IBOutlet UIView* categoryLabelView; + +@end diff --git a/HeadsUpper/HeadsUpper/GameCategoryTableViewCell.m b/HeadsUpper/HeadsUpper/GameCategoryTableViewCell.m new file mode 100644 index 0000000..02ed1a3 --- /dev/null +++ b/HeadsUpper/HeadsUpper/GameCategoryTableViewCell.m @@ -0,0 +1,25 @@ +// +// GameCategoryTableViewCell.m +// HeadsUpper +// +// Created by Jackie Meggesto on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + + +#import "GameCategoryTableViewCell.h" + +@implementation GameCategoryTableViewCell + + +- (void)awakeFromNib { + +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/HeadsUpper/HeadsUpper/GameViewController.h b/HeadsUpper/HeadsUpper/GameViewController.h new file mode 100644 index 0000000..6ed597b --- /dev/null +++ b/HeadsUpper/HeadsUpper/GameViewController.h @@ -0,0 +1,15 @@ +// +// GameViewController.h +// HeadsUpper +// +// Created by Jackie Meggesto on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import + +@interface GameViewController : UIViewController + +@property (nonatomic) NSMutableArray* gameDataArray; + +@end diff --git a/HeadsUpper/HeadsUpper/GameViewController.m b/HeadsUpper/HeadsUpper/GameViewController.m new file mode 100644 index 0000000..f5ff36f --- /dev/null +++ b/HeadsUpper/HeadsUpper/GameViewController.m @@ -0,0 +1,165 @@ +// +// GameViewController.m +// HeadsUpper +// +// Created by Jackie Meggesto on 2/21/16. +// Copyright © 2016 Michael Kavouras. All rights reserved. +// + +#import "AudioPlayer.h" +#import "GameViewController.h" + +@interface GameViewController () + +@property (nonatomic) AudioPlayer* audioPlayer; + +@property (nonatomic) NSTimer* mainTimer; +@property (nonatomic) NSTimer* readyTimer; + +@property (weak, nonatomic) IBOutlet UILabel *mainLabel; +@property (weak, nonatomic) IBOutlet UILabel *timerLabel; + +@property (nonatomic) NSInteger readyCounter; +@property (nonatomic) NSInteger mainCounter; +@property (nonatomic) NSInteger correctAnswers; + +@property (nonatomic) UISwipeGestureRecognizer* leftSwipe; +@property (nonatomic) UISwipeGestureRecognizer* rightSwipe; + + +@end + +@implementation GameViewController + +- (void)viewDidLoad { + + self.audioPlayer = [[AudioPlayer alloc]initWithAudioPlayers]; + self.correctAnswers = 0; + self.readyCounter = 3; + self.mainCounter = 60; + [super viewDidLoad]; + self.view.backgroundColor = [UIColor blueColor]; +} +-(void)viewDidAppear:(BOOL)animated +{ + + [self setUpReadyTimer]; +} + +#pragma mark Gesture Recognition + +-(void)setUpGestureRecognizer +{ + + self.leftSwipe = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipe:)]; + self.leftSwipe.direction = UISwipeGestureRecognizerDirectionLeft; + [self.view addGestureRecognizer:self.leftSwipe]; + + self.rightSwipe = [[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(handleSwipe:)]; + self.rightSwipe.direction = UISwipeGestureRecognizerDirectionRight; + [self.view addGestureRecognizer:self.rightSwipe]; + +} +-(void)handleSwipe:(UISwipeGestureRecognizer*)gesture +{ + if(self.gameDataArray.count > 0) + { + switch (gesture.direction) { + case UISwipeGestureRecognizerDirectionLeft: + + + [self.gameDataArray removeObjectAtIndex:self.gameDataArray.count-1]; + self.mainLabel.text = [self.gameDataArray lastObject]; + [self.audioPlayer.incorrectPlayer play]; + + break; + case UISwipeGestureRecognizerDirectionRight: + + [self.gameDataArray removeObjectAtIndex:([self.gameDataArray count] - 1)]; + self.mainLabel.text = [self.gameDataArray lastObject]; + self.correctAnswers++; + [self.audioPlayer.correctPlayer play]; + break; + + default: + NSLog(@"something's not right"); + break; + } + + } else { + + self.mainLabel.text = @"All out of questions!"; + [self.mainTimer invalidate]; + + } + + + +} +-(void)removeGestureRecognizers +{ + + [self.view removeGestureRecognizer:self.leftSwipe]; + [self.view removeGestureRecognizer:self.rightSwipe]; + +} + +#pragma mark Timer Methods +-(void)setUpReadyTimer +{ + + self.readyTimer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(fireReadyTimer:) userInfo:nil repeats:YES]; + [[NSRunLoop mainRunLoop] addTimer:self.readyTimer forMode:NSRunLoopCommonModes]; + +} +-(void)fireReadyTimer:(NSTimer*)timer +{ + + + if(self.readyCounter == 0) { + + self.mainLabel.text = self.gameDataArray[0]; + [timer invalidate]; + [self setUpMainTimer]; + [self setUpGestureRecognizer]; + + } else { + self.mainLabel.text = [NSString stringWithFormat:@"%ld", self.readyCounter]; + self.readyCounter -= 1; + } + + +} +-(void)setUpMainTimer +{ + + self.mainTimer = [NSTimer timerWithTimeInterval:1.0 target:self selector:@selector(fireMainTimer) userInfo:nil repeats:YES]; + [[NSRunLoop mainRunLoop] addTimer:self.mainTimer forMode:NSRunLoopCommonModes]; + +} +-(void)fireMainTimer +{ + self.timerLabel.text = [NSString stringWithFormat:@"%ld", self.mainCounter]; + if(self.mainCounter <= 0) { + + self.mainLabel.text = @"0"; + [self.audioPlayer.incorrectPlayer play]; + self.mainLabel.text = [NSString stringWithFormat:@"Game over! \n You got %ld right!", self.correctAnswers]; + [self.mainTimer invalidate]; + [self removeGestureRecognizers]; + + } else if (self.correctAnswers == 6) { + + self.mainLabel.text = @"Fabulous!"; + [self.mainTimer invalidate]; + [self removeGestureRecognizers]; + + } else { + + self.timerLabel.text = [NSString stringWithFormat:@"%ld", self.mainCounter]; + self.mainCounter--; + + + } +} +@end diff --git a/HeadsUpper/HeadsUpper/Info.plist b/HeadsUpper/HeadsUpper/Info.plist index 6905cc6..3d0fb6e 100644 --- a/HeadsUpper/HeadsUpper/Info.plist +++ b/HeadsUpper/HeadsUpper/Info.plist @@ -2,6 +2,10 @@ + UIAppFonts + + TT Pines Bold Italic DEMO.otf + CFBundleDevelopmentRegion en CFBundleExecutable diff --git a/HeadsUpper/HeadsUpper/TT Pines Bold Italic DEMO.otf b/HeadsUpper/HeadsUpper/TT Pines Bold Italic DEMO.otf new file mode 100755 index 0000000..30bf02a Binary files /dev/null and b/HeadsUpper/HeadsUpper/TT Pines Bold Italic DEMO.otf differ diff --git a/HeadsUpper/HeadsUpper/ViewController.h b/HeadsUpper/HeadsUpper/ViewController.h deleted file mode 100644 index 65d6cf5..0000000 --- a/HeadsUpper/HeadsUpper/ViewController.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ViewController.h -// HeadsUpper -// -// Created by Michael Kavouras on 2/17/16. -// Copyright © 2016 Michael Kavouras. All rights reserved. -// - -#import - -@interface ViewController : UIViewController - - -@end - diff --git a/HeadsUpper/HeadsUpper/ViewController.m b/HeadsUpper/HeadsUpper/ViewController.m deleted file mode 100644 index 14ce57a..0000000 --- a/HeadsUpper/HeadsUpper/ViewController.m +++ /dev/null @@ -1,27 +0,0 @@ -// -// ViewController.m -// HeadsUpper -// -// Created by Michael Kavouras on 2/17/16. -// Copyright © 2016 Michael Kavouras. All rights reserved. -// - -#import "ViewController.h" - -@interface ViewController () - -@end - -@implementation ViewController - -- (void)viewDidLoad { - [super viewDidLoad]; - // Do any additional setup after loading the view, typically from a nib. -} - -- (void)didReceiveMemoryWarning { - [super didReceiveMemoryWarning]; - // Dispose of any resources that can be recreated. -} - -@end diff --git a/HeadsUpper/HeadsUpper/correct.wav b/HeadsUpper/HeadsUpper/correct.wav new file mode 100644 index 0000000..ea09f84 Binary files /dev/null and b/HeadsUpper/HeadsUpper/correct.wav differ diff --git a/HeadsUpper/HeadsUpper/glamour.mp3 b/HeadsUpper/HeadsUpper/glamour.mp3 new file mode 100644 index 0000000..b6819d8 Binary files /dev/null and b/HeadsUpper/HeadsUpper/glamour.mp3 differ diff --git a/HeadsUpper/HeadsUpper/incorrect.mp3 b/HeadsUpper/HeadsUpper/incorrect.mp3 new file mode 100644 index 0000000..51e0670 Binary files /dev/null and b/HeadsUpper/HeadsUpper/incorrect.mp3 differ diff --git a/HeadsUpper/Podfile b/HeadsUpper/Podfile new file mode 100644 index 0000000..e69de29