Learnability Game

This commit is contained in:
Max Hunt 2019-06-11 15:10:05 +01:00
parent 3f5d07fd5a
commit 25a1ff8411
9 changed files with 437 additions and 8 deletions

View File

@ -13,6 +13,8 @@
506421C722A339B7001E8877 /* xright.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = 506421C422A339B7001E8877 /* xright.mp3 */; };
506421C922A33D87001E8877 /* InstructionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506421C822A33D87001E8877 /* InstructionsViewController.swift */; };
506421CD22A33EA5001E8877 /* TechSpecsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 506421CC22A33EA5001E8877 /* TechSpecsViewController.swift */; };
50969F5A22AFD57E0000C5ED /* GameLearnViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50969F5922AFD57E0000C5ED /* GameLearnViewController.swift */; };
50969F5E22AFEBE80000C5ED /* SecondGameLearnViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50969F5D22AFEBE80000C5ED /* SecondGameLearnViewController.swift */; };
50A7ADD5229D6A4200D58743 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A7ADD4229D6A4200D58743 /* AppDelegate.swift */; };
50A7ADD7229D6A4200D58743 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50A7ADD6229D6A4200D58743 /* ViewController.swift */; };
50A7ADDA229D6A4200D58743 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 50A7ADD8229D6A4200D58743 /* Main.storyboard */; };
@ -40,6 +42,8 @@
506421C422A339B7001E8877 /* xright.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = xright.mp3; sourceTree = "<group>"; };
506421C822A33D87001E8877 /* InstructionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstructionsViewController.swift; sourceTree = "<group>"; };
506421CC22A33EA5001E8877 /* TechSpecsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TechSpecsViewController.swift; sourceTree = "<group>"; };
50969F5922AFD57E0000C5ED /* GameLearnViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameLearnViewController.swift; sourceTree = "<group>"; };
50969F5D22AFEBE80000C5ED /* SecondGameLearnViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SecondGameLearnViewController.swift; sourceTree = "<group>"; };
50A7ADD1229D6A4200D58743 /* Guibe.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Guibe.app; sourceTree = BUILT_PRODUCTS_DIR; };
50A7ADD4229D6A4200D58743 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
50A7ADD6229D6A4200D58743 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
@ -105,6 +109,8 @@
50A7ADD6229D6A4200D58743 /* ViewController.swift */,
50A7ADE6229D6C7100D58743 /* Assets.xcassets */,
50A7ADD8229D6A4200D58743 /* Main.storyboard */,
50969F5922AFD57E0000C5ED /* GameLearnViewController.swift */,
50969F5D22AFEBE80000C5ED /* SecondGameLearnViewController.swift */,
50E3DDF222AC5F9200E04D0B /* setupTextInstructionsViewController.swift */,
50B1485D22A46F7A008B16AF /* VideoInstrictionsViewController.swift */,
50B1485B22A46EBD008B16AF /* WrittenInstructionsViewController.swift */,
@ -225,7 +231,9 @@
50A7ADFD229D766800D58743 /* 7_ReadyViewController.swift in Sources */,
506421CD22A33EA5001E8877 /* TechSpecsViewController.swift in Sources */,
50A7ADF9229D75C100D58743 /* 5_HandChoiceViewController.swift in Sources */,
50969F5A22AFD57E0000C5ED /* GameLearnViewController.swift in Sources */,
50B1485E22A46F7A008B16AF /* VideoInstrictionsViewController.swift in Sources */,
50969F5E22AFEBE80000C5ED /* SecondGameLearnViewController.swift in Sources */,
50E3DDF322AC5F9200E04D0B /* setupTextInstructionsViewController.swift in Sources */,
50B1485C22A46EBD008B16AF /* WrittenInstructionsViewController.swift in Sources */,
50A7ADD7229D6A4200D58743 /* ViewController.swift in Sources */,

View File

@ -17,13 +17,13 @@ class S6deChoiceViewController: UIViewController {
@IBAction func topBigPressed(_ sender: Any) {
defaults.set(1, forKey: "bigSide")
let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "screen7") as! R7adyViewController
let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "screen6_5") as! GameLearnViewController
nextViewController.modalTransitionStyle = .crossDissolve
self.present(nextViewController, animated: true, completion: nil)
}
@IBAction func bottomBigPressed(_ sender: Any) {
defaults.set(2, forKey: "bigSide")
let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "screen7") as! R7adyViewController
let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "screen6_5") as! GameLearnViewController
nextViewController.modalTransitionStyle = .crossDissolve
self.present(nextViewController, animated: true, completion: nil)
}

View File

@ -0,0 +1,23 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "buttonMedSize.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "buttonMedSize-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "buttonMedSize-2.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -183,9 +183,72 @@
</objects>
<point key="canvasLocation" x="2687" y="21"/>
</scene>
<!--Game Learn View Controller-->
<scene sceneID="oO4-oL-3Ss">
<objects>
<viewController storyboardIdentifier="screen6_5" useStoryboardIdentifierAsRestorationIdentifier="YES" id="5T0-tQ-Zc3" customClass="GameLearnViewController" customModule="Guibe" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="2XH-El-mte">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" fixedFrame="YES" progressViewStyle="bar" translatesAutoresizingMaskIntoConstraints="NO" id="oRi-Kv-h1c">
<rect key="frame" x="20" y="836.33333333333337" width="374" height="1.6666666666666665"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</progressView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label Text" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7wZ-GO-jAW">
<rect key="frame" x="20" y="232" width="374" height="120"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="23"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="45n-4F-Fwa">
<rect key="frame" x="80" y="476" width="255" height="99"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="29"/>
<state key="normal" title="Text" backgroundImage="buttonMedSize">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="buttonPressed:" destination="5T0-tQ-Zc3" eventType="touchUpInside" id="a11-Vg-Rdn"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="IT4-4O-Tuj">
<rect key="frame" x="68" y="678" width="279" height="96"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" backgroundImage="nextBtn"/>
<connections>
<action selector="nextBtnPressed:" destination="5T0-tQ-Zc3" eventType="touchUpInside" id="SGK-QQ-4nf"/>
</connections>
</button>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" bounces="NO" scrollEnabled="NO" bouncesZoom="NO" editable="NO" text="Learning Sequence" textAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="OJv-jh-NI8">
<rect key="frame" x="27" y="69" width="361" height="88"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="textColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" type="system" pointSize="30"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="iyP-cN-gcP"/>
</view>
<connections>
<outlet property="mainButton" destination="45n-4F-Fwa" id="2YX-8H-na9"/>
<outlet property="nextBtn" destination="IT4-4O-Tuj" id="XSF-wz-JaY"/>
<outlet property="progressBar" destination="oRi-Kv-h1c" id="MiO-3W-Qe3"/>
<outlet property="textLabel" destination="7wZ-GO-jAW" id="oti-xh-MYP"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="X5p-sN-YHS" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3602.898550724638" y="20.758928571428569"/>
</scene>
<!--7ady View Controller-->
<scene sceneID="alI-ln-agi">
<objects>
<placeholder placeholderIdentifier="IBFirstResponder" id="sFx-6a-7bc" userLabel="First Responder" sceneMemberID="firstResponder"/>
<viewController storyboardIdentifier="screen7" useStoryboardIdentifierAsRestorationIdentifier="YES" id="lTn-Ln-RFg" customClass="R7adyViewController" customModule="Guibe" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="6A0-Zn-hBC">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
@ -204,9 +267,8 @@
<viewLayoutGuide key="safeArea" id="AzM-Y7-if5"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="sFx-6a-7bc" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="3603" y="21"/>
<point key="canvasLocation" x="4442" y="21"/>
</scene>
<!--Main View Controller-->
<scene sceneID="55K-vG-ne9">
@ -744,7 +806,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="iKA-Ec-DYO">
<rect key="frame" x="29" y="379" width="299" height="51"/>
<rect key="frame" x="29" y="443" width="299" height="51"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="32"/>
<state key="normal" title="More coming soon!!!!!">
@ -788,6 +850,19 @@
</segue>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="xgn-og-o9u">
<rect key="frame" x="29" y="368" width="272" height="51"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="32"/>
<state key="normal" title="Relearn Instructions">
<color key="titleColor" cocoaTouchSystemColor="scrollViewTexturedBackgroundColor"/>
</state>
<connections>
<segue destination="ppL-gd-4JI" kind="popoverPresentation" popoverAnchorView="xgn-og-o9u" id="gsg-p4-GcU">
<popoverArrowDirection key="popoverArrowDirection" up="YES" down="YES" left="YES" right="YES"/>
</segue>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="qYW-KB-ok9"/>
@ -901,10 +976,10 @@
<nil key="highlightedColor"/>
</label>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="Xmt-1u-pXu">
<rect key="frame" x="20" y="109" width="374" height="936"/>
<rect key="frame" x="20" y="109" width="374" height="753"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<mutableString key="text">To turn on your guibe, press the button on the **side of the bracelet**. Your Guibe bracelet will vibrate to let you know that the connection has been successful.
<string key="text">To turn on your guibe, press the button on the **side of the bracelet**. Your Guibe bracelet will vibrate to let you know that the connection has been successful.
Go to the main screen to search for a destination. When ready, select Begin Journey. You will feel 3 buzzes: ready, steady, go! You are now ready to start the journey and can begin walking.
@ -916,7 +991,7 @@ You are almost set, just one more instruction! When you have arrived at your des
The casing of your device serves as a portable charger. Charge the casing via the mains and simply slip the guibe onto the casing dock to charge it wirelessly.
And thats all you need to know to follow the vibe!</mutableString>
And thats all you need to know to follow the vibe!</string>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
@ -1062,11 +1137,75 @@ And thats all you need to know to follow the vibe!</mutableString>
</objects>
<point key="canvasLocation" x="3603" y="777"/>
</scene>
<!--Second Game Learn View Controller-->
<scene sceneID="IKb-gs-cdX">
<objects>
<viewController id="ppL-gd-4JI" customClass="SecondGameLearnViewController" customModule="Guibe" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="w1b-M5-Yp6">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Learning Sequence" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ie9-3v-3oh">
<rect key="frame" x="72" y="44" width="270" height="36"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="30"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<progressView opaque="NO" contentMode="scaleToFill" verticalHuggingPriority="750" fixedFrame="YES" progressViewStyle="bar" translatesAutoresizingMaskIntoConstraints="NO" id="OwN-Ov-RpE">
<rect key="frame" x="20" y="861" width="374" height="1.6666666666666665"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="0.66666666669999997" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</progressView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Label Text" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="G5y-q3-Ci3">
<rect key="frame" x="20" y="257" width="374" height="120"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="23"/>
<color key="textColor" white="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="BUg-ox-cUu">
<rect key="frame" x="80" y="501" width="255" height="99"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="29"/>
<state key="normal" title="Text" backgroundImage="buttonMedSize">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="buttonPressed:" destination="5T0-tQ-Zc3" eventType="touchUpInside" id="JxP-d8-Bzg"/>
<action selector="mainBtnPressed:" destination="ppL-gd-4JI" eventType="touchUpInside" id="paI-bl-Fzq"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hF6-5i-YIa">
<rect key="frame" x="68" y="703" width="279" height="96"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" backgroundImage="nextBtn"/>
<connections>
<action selector="nextBtnPressed:" destination="5T0-tQ-Zc3" eventType="touchUpInside" id="aO5-QW-pSI"/>
<action selector="nextBtnPressed:" destination="ppL-gd-4JI" eventType="touchUpInside" id="pmv-BV-Cbx"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<viewLayoutGuide key="safeArea" id="Wm0-30-s8F"/>
</view>
<connections>
<outlet property="mainButton" destination="BUg-ox-cUu" id="SzX-ws-uHq"/>
<outlet property="nextBtn" destination="hF6-5i-YIa" id="BcR-1g-dDV"/>
<outlet property="progressBar" destination="OwN-Ov-RpE" id="sxM-U2-TVm"/>
<outlet property="textLabel" destination="G5y-q3-Ci3" id="Qhb-H2-bMR"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="jXW-Bh-OYb" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="4441" y="777"/>
</scene>
</scenes>
<resources>
<image name="LoadScreen" width="294.66665649414062" height="638"/>
<image name="appLogo" width="341.33334350585938" height="341.33334350585938"/>
<image name="blank" width="314.66665649414062" height="76"/>
<image name="buttonMedSize" width="207" height="83.333335876464844"/>
<image name="circle" width="575.33331298828125" height="568.33331298828125"/>
<image name="guibeWord" width="250.66667175292969" height="100"/>
<image name="headingButton" width="341.66665649414062" height="341.66665649414062"/>

View File

@ -0,0 +1,133 @@
//
// GameLearnViewController.swift
// Guibe
//
// Created by Max Hunt on 11/06/2019.
// Copyright © 2019 8. All rights reserved.
//
import UIKit
import AVKit
class GameLearnViewController: UIViewController {
@IBOutlet weak var mainButton: UIButton!
@IBOutlet weak var textLabel: UILabel!
@IBOutlet weak var progressBar: UIProgressView!
@IBOutlet weak var nextBtn: UIButton!
@IBAction func buttonPressed(_ sender: Any) {
}
@IBAction func nextBtnPressed(_ sender: Any) {
stepCounter += 1
stepThrough(ptr: stepCounter)
}
var stepCounter: Int = 0
override func viewDidLoad() {
super.viewDidLoad()
textLabel.text = "Now we will .......\n........."
// Do any additional setup after loading the view.
}
func stepThrough(ptr:Int) {
switch ptr {
case 1:
beginJourney()
case 2:
arrivedAtDestination()
case 3:
wrongDirection()
case 4:
turnRight()
case 5:
turnLeft()
case 6:
showDone()
case 7:
nextPage()
default:
return
}
}
func beginJourney() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "This means \n'begin journey'"
self.mainButton.setTitle("Try me", for: .normal)
self.progressBar.setProgress(0.2, animated: true)
self.textLabel.accessibilityLabel = "This means begin journey"
self.mainButton.accessibilityLabel = "Try me"
}
func arrivedAtDestination() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "This means \n'arrived at destination'"
self.mainButton.setTitle("Try me", for: .normal)
self.progressBar.setProgress(0.4, animated: true)
self.textLabel.accessibilityLabel = "This means arrived at destination"
self.mainButton.accessibilityLabel = "Try me"
}
func wrongDirection() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "This means \n'you're walking in the wrong direction'"
self.mainButton.setTitle("Try me", for: .normal)
self.progressBar.setProgress(0.6, animated: true)
self.textLabel.accessibilityLabel = "This means you're walking in the wrong direction"
self.mainButton.accessibilityLabel = "Try me"
}
func turnRight() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "This means \n'turn right'"
self.mainButton.setTitle("Try me", for: .normal)
self.progressBar.setProgress(0.8, animated: true)
self.textLabel.accessibilityLabel = "This means turn right"
self.mainButton.accessibilityLabel = "Try me"
}
func turnLeft() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "This means \n'begin journey'"
self.mainButton.setTitle("Try me", for: .normal)
self.progressBar.setProgress(1.0, animated: true)
self.textLabel.accessibilityLabel = "This means turn left"
self.mainButton.accessibilityLabel = "Try me"
}
func showDone() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "You are finished"
self.mainButton.alpha = 0.0
self.progressBar.alpha = 0.0
self.textLabel.accessibilityLabel = "You are finished"
self.mainButton.accessibilityLabel = "Try me"
}
func nextPage() {
let nextViewController = self.storyboard?.instantiateViewController(withIdentifier: "screen7") as! R7adyViewController
nextViewController.modalTransitionStyle = .crossDissolve
self.present(nextViewController, animated: true, completion: nil)
}
}
extension UIView {
func fadeTransition(_ duration:CFTimeInterval) {
let animation = CATransition()
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
animation.type = CATransitionType.fade
animation.duration = duration
layer.add(animation, forKey: CATransitionType.fade.rawValue)
}
}

View File

@ -0,0 +1,126 @@
//
// SecondGameLearnViewController.swift
// Guibe
//
// Created by Max Hunt on 11/06/2019.
// Copyright © 2019 8. All rights reserved.
//
import UIKit
class SecondGameLearnViewController: UIViewController {
@IBOutlet weak var textLabel: UILabel!
@IBOutlet weak var mainButton: UIButton!
@IBOutlet weak var nextBtn: UIButton!
@IBOutlet weak var progressBar: UIProgressView!
@IBAction func mainBtnPressed(_ sender: Any) {
}
@IBAction func nextBtnPressed(_ sender: Any) {
stepCounter += 1
stepThrough(ptr: stepCounter)
}
var stepCounter: Int = 0
override func viewDidLoad() {
super.viewDidLoad()
textLabel.text = "Now we will .......\n........."
// Do any additional setup after loading the view.
}
func stepThrough(ptr:Int) {
switch ptr {
case 1:
beginJourney()
case 2:
arrivedAtDestination()
case 3:
wrongDirection()
case 4:
turnRight()
case 5:
turnLeft()
case 6:
showDone()
case 7:
nextPage()
default:
return
}
}
func beginJourney() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "This means \n'begin journey'"
self.mainButton.setTitle("Try me", for: .normal)
self.progressBar.setProgress(0.2, animated: true)
self.textLabel.accessibilityLabel = "This means begin journey"
self.mainButton.accessibilityLabel = "Try me"
}
func arrivedAtDestination() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "This means \n'arrived at destination'"
self.mainButton.setTitle("Try me", for: .normal)
self.progressBar.setProgress(0.4, animated: true)
self.textLabel.accessibilityLabel = "This means arrived at destination"
self.mainButton.accessibilityLabel = "Try me"
}
func wrongDirection() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "This means \n'you're walking in the wrong direction'"
self.mainButton.setTitle("Try me", for: .normal)
self.progressBar.setProgress(0.6, animated: true)
self.textLabel.accessibilityLabel = "This means you're walking in the wrong direction"
self.mainButton.accessibilityLabel = "Try me"
}
func turnRight() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "This means \n'turn right'"
self.mainButton.setTitle("Try me", for: .normal)
self.progressBar.setProgress(0.8, animated: true)
self.textLabel.accessibilityLabel = "This means turn right"
self.mainButton.accessibilityLabel = "Try me"
}
func turnLeft() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "This means \n'begin journey'"
self.mainButton.setTitle("Try me", for: .normal)
self.progressBar.setProgress(1.0, animated: true)
self.textLabel.accessibilityLabel = "This means turn left"
self.mainButton.accessibilityLabel = "Try me"
}
func showDone() {
self.textLabel.fadeTransition(0.5)
self.textLabel.text = "You are finished"
self.mainButton.alpha = 0.0
self.progressBar.alpha = 0.0
self.textLabel.accessibilityLabel = "You are finished"
self.mainButton.accessibilityLabel = "Try me"
}
func nextPage() {
self.dismiss(animated: true, completion: nil)
}
}
//extension UIView {
//
// func fadeTransition(_ duration:CFTimeInterval) {
// let animation = CATransition()
// animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeInEaseOut)
// animation.type = CATransitionType.fade
// animation.duration = duration
// layer.add(animation, forKey: CATransitionType.fade.rawValue)
// }
//}