Skip to content
Snippets Groups Projects
Commit ae7039c2 authored by peters's avatar peters
Browse files

comments almost done

Almost all swift files are fully commented now, only ExploreViewController is missing yet
parent 229c0dae
No related branches found
No related tags found
No related merge requests found
...@@ -15,8 +15,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate { ...@@ -15,8 +15,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch. ///added support for audio playback
let audioSession = AVAudioSession.sharedInstance() let audioSession = AVAudioSession.sharedInstance()
do { do {
try audioSession.setCategory(.playback, mode: .moviePlayback) try audioSession.setCategory(.playback, mode: .moviePlayback)
......
...@@ -8,14 +8,24 @@ ...@@ -8,14 +8,24 @@
import UIKit import UIKit
import AVKit import AVKit
import AVFoundation import AVFoundation
/**
Controller for the main menu.
This is the starting point of our app - the first view that is presented to the user.
The view has four buttons:
1) AR = shows the video about the (not successfully included) AR experience. This should be deleted in a fully functioning app, of course.
2) Start Exploration = leads to the exploration view with AR image anchor tracking and the real game experience.
3) Tutorial = shows the tutorial video that is presented to the user and explains the general functionality of the game.
4) Reset = resets the stats of the game to get a fresh experience.
*/
class HomeViewController: UIViewController, UIAlertViewDelegate { class HomeViewController: UIViewController, UIAlertViewDelegate {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
Game.resetGame() Game.resetGame()
} }
/**
If button AR is clicked play a full screen video.
*/
@IBAction func btnShowAR(_ sender: Any) { @IBAction func btnShowAR(_ sender: Any) {
let url = URL(fileURLWithPath: Bundle.main.path(forResource: "ar-mode", ofType: "mp4")!) let url = URL(fileURLWithPath: Bundle.main.path(forResource: "ar-mode", ofType: "mp4")!)
...@@ -31,7 +41,9 @@ class HomeViewController: UIViewController, UIAlertViewDelegate { ...@@ -31,7 +41,9 @@ class HomeViewController: UIViewController, UIAlertViewDelegate {
player.play() player.play()
} }
} }
/**
If button Reset is clicked reset the game. Function uses the Game.reset function. After that the app presents an alert window to the user that tells him/her that the game was resetted.
*/
@IBAction func btnResetGame(_ sender: Any) { @IBAction func btnResetGame(_ sender: Any) {
print("Reset Button touched.") print("Reset Button touched.")
Game.resetGame() Game.resetGame()
...@@ -45,13 +57,17 @@ class HomeViewController: UIViewController, UIAlertViewDelegate { ...@@ -45,13 +57,17 @@ class HomeViewController: UIViewController, UIAlertViewDelegate {
// Present Alert Controller // Present Alert Controller
self.present(alertController, animated: true, completion: nil) self.present(alertController, animated: true, completion: nil)
} }
/**
If button Start Exploration is tapped, vibrate and segue to the view of exploration mode --> ExploreViewController.swift.
*/
@IBAction func btnStartExploration(_ sender: Any) { @IBAction func btnStartExploration(_ sender: Any) {
Game.setMode(mode: .exploration) Game.setMode(mode: .exploration)
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) AudioServicesPlaySystemSound(kSystemSoundID_Vibrate)
performSegue(withIdentifier: "fromHome2ExploreSegue", sender: self) performSegue(withIdentifier: "fromHome2ExploreSegue", sender: self)
} }
/**
If button Tutorial is tapped play a full screen video.
*/
@IBAction func btnPlayTutorialVideo(_ sender: Any) { @IBAction func btnPlayTutorialVideo(_ sender: Any) {
let url = URL(fileURLWithPath: Bundle.main.path(forResource: "tutorial", ofType: "mp4")!) let url = URL(fileURLWithPath: Bundle.main.path(forResource: "tutorial", ofType: "mp4")!)
......
...@@ -9,8 +9,14 @@ import UIKit ...@@ -9,8 +9,14 @@ import UIKit
import AVKit import AVKit
import AVFoundation import AVFoundation
/**
Controller for showing windows in a new view, mostly for
- the inventory
- images to show information to the user like tasks that are not implemented in the demo.
*/
class ImagesViewController: UIViewController { class ImagesViewController: UIViewController {
///standard image that is shown if no filename is passed through the segue
var filename = "Avatar.png" var filename = "Avatar.png"
@IBOutlet weak var tasksImages: UIImageView! @IBOutlet weak var tasksImages: UIImageView!
......
...@@ -7,6 +7,9 @@ ...@@ -7,6 +7,9 @@
import UIKit import UIKit
/**
Controller for showing the inventory - depending on the status of the game.
*/
class InventoryViewController: UIViewController { class InventoryViewController: UIViewController {
@IBOutlet weak var inventoryImage: UIImageView! @IBOutlet weak var inventoryImage: UIImageView!
...@@ -16,6 +19,10 @@ class InventoryViewController: UIViewController { ...@@ -16,6 +19,10 @@ class InventoryViewController: UIViewController {
self.showSolvedImage() self.showSolvedImage()
} }
/**
Checks if at least one station was solved. As we only have one station in the demo this means one station (or more) solved to show the image for a collected inventory. If no station was solved yet show an empty inventory.
For a fully functional app this should be rewritten to show approriate images for already solved stations.
*/
private func showSolvedImage() { private func showSolvedImage() {
let solved = Game.getSolvedStations() let solved = Game.getSolvedStations()
if solved.count == 0 if solved.count == 0
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
import UIKit import UIKit
import AVKit import AVKit
import AVFoundation import AVFoundation
/**
Deprecated class, never used.
*/
class VideoTutorialViewController: UIViewController { class VideoTutorialViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
......
...@@ -8,6 +8,9 @@ ...@@ -8,6 +8,9 @@
import UIKit import UIKit
import RealityKit import RealityKit
/**
A left over ... deprecated
*/
class ViewController: UIViewController { class ViewController: UIViewController {
@IBOutlet var arView: ARView! @IBOutlet var arView: ARView!
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment