diff --git a/Guibe.xcodeproj/project.pbxproj b/Guibe.xcodeproj/project.pbxproj index 93e931f..ec0b6f8 100644 --- a/Guibe.xcodeproj/project.pbxproj +++ b/Guibe.xcodeproj/project.pbxproj @@ -16,6 +16,7 @@ 505AFEF8229FE1BD004FF0F1 /* settingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 505AFEF7229FE1BD004FF0F1 /* settingsViewController.swift */; }; 506421C922A33D87001E8877 /* InstructionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506421C822A33D87001E8877 /* InstructionsViewController.swift */; }; 506421CD22A33EA5001E8877 /* TechSpecsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506421CC22A33EA5001E8877 /* TechSpecsViewController.swift */; }; + 5079D8AF22B7F5AF005114CB /* AudioInstrViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5079D8AE22B7F5AF005114CB /* AudioInstrViewController.swift */; }; 50969F5A22AFD57E0000C5ED /* GameLearnViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50969F5922AFD57E0000C5ED /* GameLearnViewController.swift */; }; 50969F5E22AFEBE80000C5ED /* SecondGameLearnViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50969F5D22AFEBE80000C5ED /* SecondGameLearnViewController.swift */; }; 50969F6622B08A350000C5ED /* guibe_left.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 50969F5F22B08A340000C5ED /* guibe_left.mp3 */; }; @@ -55,6 +56,7 @@ 505AFEF7229FE1BD004FF0F1 /* settingsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = settingsViewController.swift; sourceTree = ""; }; 506421C822A33D87001E8877 /* InstructionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstructionsViewController.swift; sourceTree = ""; }; 506421CC22A33EA5001E8877 /* TechSpecsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TechSpecsViewController.swift; sourceTree = ""; }; + 5079D8AE22B7F5AF005114CB /* AudioInstrViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioInstrViewController.swift; sourceTree = ""; }; 50969F5922AFD57E0000C5ED /* GameLearnViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameLearnViewController.swift; sourceTree = ""; }; 50969F5D22AFEBE80000C5ED /* SecondGameLearnViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondGameLearnViewController.swift; sourceTree = ""; }; 50969F5F22B08A340000C5ED /* guibe_left.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = guibe_left.mp3; sourceTree = ""; }; @@ -126,6 +128,7 @@ 50A7ADD6229D6A4200D58743 /* ViewController.swift */, 50A7ADE6229D6C7100D58743 /* Assets.xcassets */, 50A7ADD8229D6A4200D58743 /* Main.storyboard */, + 5079D8AE22B7F5AF005114CB /* AudioInstrViewController.swift */, 5038A32F22B68526004B2645 /* SecretsViewController.swift */, 50969F5922AFD57E0000C5ED /* GameLearnViewController.swift */, 50969F5D22AFEBE80000C5ED /* SecondGameLearnViewController.swift */, @@ -270,6 +273,7 @@ 50A7ADFD229D766800D58743 /* 7_ReadyViewController.swift in Sources */, 506421CD22A33EA5001E8877 /* TechSpecsViewController.swift in Sources */, 50A7ADF9229D75C100D58743 /* 5_HandChoiceViewController.swift in Sources */, + 5079D8AF22B7F5AF005114CB /* AudioInstrViewController.swift in Sources */, 50969F5A22AFD57E0000C5ED /* GameLearnViewController.swift in Sources */, 5038A33022B68526004B2645 /* SecretsViewController.swift in Sources */, 50B1485E22A46F7A008B16AF /* VideoInstrictionsViewController.swift in Sources */, diff --git a/Guibe/3_StartViewController.swift b/Guibe/3_StartViewController.swift index 228e483..9bd7ec6 100644 --- a/Guibe/3_StartViewController.swift +++ b/Guibe/3_StartViewController.swift @@ -30,7 +30,8 @@ class S3artViewController: UIViewController, CLLocationManagerDelegate { // self.nextBtn.layer.shadowOpacity = 0.2 // } // playVideo() - let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "screen5") as! H5ndChoiceViewController + let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "audioSet") as! AudioInstrViewController +// let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "screen5") as! H5ndChoiceViewController nextViewController.modalTransitionStyle = .crossDissolve self.present(nextViewController, animated: true, completion: nil) } diff --git a/Guibe/Assets.xcassets/s1l.imageset/s1l-1.png b/Guibe/Assets.xcassets/s1l.imageset/s1l-1.png index eec9f25..6ddd3de 100644 Binary files a/Guibe/Assets.xcassets/s1l.imageset/s1l-1.png and b/Guibe/Assets.xcassets/s1l.imageset/s1l-1.png differ diff --git a/Guibe/Assets.xcassets/s1l.imageset/s1l-2.png b/Guibe/Assets.xcassets/s1l.imageset/s1l-2.png index eec9f25..6ddd3de 100644 Binary files a/Guibe/Assets.xcassets/s1l.imageset/s1l-2.png and b/Guibe/Assets.xcassets/s1l.imageset/s1l-2.png differ diff --git a/Guibe/Assets.xcassets/s1l.imageset/s1l.png b/Guibe/Assets.xcassets/s1l.imageset/s1l.png index eec9f25..6ddd3de 100644 Binary files a/Guibe/Assets.xcassets/s1l.imageset/s1l.png and b/Guibe/Assets.xcassets/s1l.imageset/s1l.png differ diff --git a/Guibe/AudioInstrViewController.swift b/Guibe/AudioInstrViewController.swift new file mode 100644 index 0000000..1cab5bf --- /dev/null +++ b/Guibe/AudioInstrViewController.swift @@ -0,0 +1,151 @@ + // + // VideoInstrictionsViewController.swift + // Guibe + // + // Created by Max Hunt on 02/06/2019. + // Copyright © 2019 8. All rights reserved. + // + + import UIKit + import AVKit + + class AudioInstrViewController: UIViewController, AVAudioPlayerDelegate { + + var player = AVAudioPlayer() + + @IBOutlet weak var nextBtn: UIButton! + + @IBOutlet weak var b1: UIButton! + @IBOutlet weak var b2: UIButton! + @IBOutlet weak var b3: UIButton! + @IBOutlet weak var b4: UIButton! + @IBOutlet weak var b5: UIButton! + @IBOutlet weak var stopBtn: UIButton! + + + @IBAction func b1p(_ sender: Any) { + disableAllButtons() + audioPlay(fName: "i-connect") + } + + @IBAction func b2p(_ sender: Any) { + disableAllButtons() + audioPlay(fName: "i-wear") + } + + @IBAction func b3p(_ sender: Any) { + disableAllButtons() + audioPlay(fName: "i-language") + } + + @IBAction func b4p(_ sender: Any) { + disableAllButtons() + audioPlay(fName: "i-interface") + } + + @IBAction func b5p(_ sender: Any) { + disableAllButtons() + audioPlay(fName: "i-charging") + } + + @IBAction func stopBtnPressed(_ sender: Any) { + self.player.stop() + enableAllButtons() + } + + @IBAction func nextBtnPressed(_ sender: Any) { + let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "screen5") as! H5ndChoiceViewController + nextViewController.modalTransitionStyle = .crossDissolve + self.present(nextViewController, animated: true, completion: nil) + } + + + + + + + + override func viewDidLoad() { + super.viewDidLoad() + b1.accessibilityLabel = "connecting your ghibe" + b2.accessibilityLabel = "wearing your ghibe" + b3.accessibilityLabel = "ghibe language" + b4.accessibilityLabel = "ghibe interface" + b5.accessibilityLabel = "charging your ghibe" + nextBtn.accessibilityLabel = "next" + stopBtn.accessibilityLabel = "stop" + + stopBtn.alpha = 0.5 + stopBtn.isEnabled = false + + // Do any additional setup after loading the view. + } + + func disableAllButtons() { + self.b1.isEnabled = false + self.b2.isEnabled = false + self.b3.isEnabled = false + self.b4.isEnabled = false + self.b5.isEnabled = false + self.stopBtn.isEnabled = true + + UIView.animate(withDuration: 0.3, animations: { + self.b1.alpha = 0.5 + self.b2.alpha = 0.5 + self.b3.alpha = 0.5 + self.b4.alpha = 0.5 + self.b5.alpha = 0.5 + self.stopBtn.alpha = 1.0 + }) + + + + + } + + func enableAllButtons() { + self.b1.isEnabled = true + self.b2.isEnabled = true + self.b3.isEnabled = true + self.b4.isEnabled = true + self.b5.isEnabled = true + self.stopBtn.isEnabled = false + + UIView.animate(withDuration: 0.3, animations: { + self.b1.alpha = 1.0 + self.b2.alpha = 1.0 + self.b3.alpha = 1.0 + self.b4.alpha = 1.0 + self.b5.alpha = 1.0 + self.stopBtn.alpha = 0.5 + }) + } + + func audioPlay (fName: String) { + let path = Bundle.main.path(forResource: fName, ofType : "mp3")! + let url = URL(fileURLWithPath : path) + do { + player = try AVAudioPlayer(contentsOf: url) + player.delegate = self + player.play() + } catch { + debugPrint("Error in playing sound file \(fName).mp3") + } + } + + func audioPlayerDidFinishPlaying(_ player: AVAudioPlayer, successfully flag: Bool) { + enableAllButtons() + } + + + /* + // MARK: - Navigation + + // In a storyboard-based application, you will often want to do a little preparation before navigation + override func prepare(for segue: UIStoryboardSegue, sender: Any?) { + // Get the new view controller using segue.destination. + // Pass the selected object to the new view controller. + } + */ + +} diff --git a/Guibe/Base.lproj/Main.storyboard b/Guibe/Base.lproj/Main.storyboard index b09e965..a91c609 100644 --- a/Guibe/Base.lproj/Main.storyboard +++ b/Guibe/Base.lproj/Main.storyboard @@ -84,6 +84,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -92,21 +200,8 @@ - - - - - + + @@ -145,7 +263,7 @@ to wear Guibe? - + @@ -155,10 +273,6 @@ to wear Guibe? - - - -