98 lines
3.2 KiB
Swift
98 lines
3.2 KiB
Swift
//
|
|
// settingsViewController.swift
|
|
// Guibe
|
|
//
|
|
// Created by Max Hunt on 30/05/2019.
|
|
// Copyright © 2019 8. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class settingsViewController: UIViewController {
|
|
let defaults = UserDefaults.standard
|
|
|
|
// OUTLETS--------------OUTLETS
|
|
@IBOutlet weak var cLeft: UIImageView!
|
|
@IBOutlet weak var cRight: UIImageView!
|
|
@IBOutlet weak var cBTop: UIImageView!
|
|
@IBOutlet weak var CSTop: UIImageView!
|
|
// OUTLETS--------------OUTLETS
|
|
|
|
|
|
// ACTIONS--------------ACTIONS
|
|
@IBAction func backBtnPressed(_ sender: Any) {
|
|
self.dismiss(animated: true, completion: nil)
|
|
}
|
|
@IBAction func leftBtnPressed(_ sender: Any) {
|
|
if defaults.integer(forKey: "handSide") == 2{
|
|
defaults.set(1, forKey: "handSide")
|
|
UIView.animate(withDuration: 0.4, animations: {self.cLeft.alpha = 1.0})
|
|
UIView.animate(withDuration: 0.4, animations: {self.cRight.alpha = 0.0})
|
|
}
|
|
}
|
|
@IBAction func rightBtnPressed(_ sender: Any) {
|
|
if defaults.integer(forKey: "handSide") == 1{
|
|
defaults.set(2, forKey: "handSide")
|
|
UIView.animate(withDuration: 0.4, animations: {self.cLeft.alpha = 0.0})
|
|
UIView.animate(withDuration: 0.4, animations: {self.cRight.alpha = 1.0})
|
|
}
|
|
}
|
|
@IBAction func bTopBtnPressed(_ sender: Any) {
|
|
if defaults.integer(forKey: "bigSide") == 2{
|
|
defaults.set(1, forKey: "bigSide")
|
|
UIView.animate(withDuration: 0.4, animations: {self.cBTop.alpha = 1.0})
|
|
UIView.animate(withDuration: 0.4, animations: {self.CSTop.alpha = 0.0})
|
|
}
|
|
}
|
|
@IBAction func sTopBtnPressed(_ sender: Any) {
|
|
if defaults.integer(forKey: "bigSide") == 1{
|
|
defaults.set(2, forKey: "bigSide")
|
|
UIView.animate(withDuration: 0.4, animations: {self.cBTop.alpha = 0.0})
|
|
UIView.animate(withDuration: 0.4, animations: {self.CSTop.alpha = 1.0})
|
|
}
|
|
}
|
|
@IBAction func resetCfgPressed(_ sender: Any) {
|
|
defaults.set(0, forKey: "setupDone")
|
|
}
|
|
|
|
// ACTIONS--------------ACTIONS
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
switch defaults.integer(forKey: "handSide") {
|
|
case 1:
|
|
cLeft.alpha = 1.0
|
|
cRight.alpha = 0.0
|
|
case 2:
|
|
cLeft.alpha = 0.0
|
|
cRight.alpha = 1.0
|
|
default:
|
|
print("ERROR, THIS CANNOT HAPPEN!!!!!")
|
|
}
|
|
|
|
switch defaults.integer(forKey: "bigSide") {
|
|
case 1:
|
|
cBTop.alpha = 1.0
|
|
CSTop.alpha = 0.0
|
|
case 2:
|
|
cBTop.alpha = 0.0
|
|
CSTop.alpha = 1.0
|
|
default:
|
|
print("ERROR, THIS CANNOT HAPPEN!!!!!")
|
|
}
|
|
// Do any additional setup after loading the view.
|
|
}
|
|
|
|
|
|
/*
|
|
// 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.
|
|
}
|
|
*/
|
|
|
|
}
|