// // StartController.swift // spotTheSpy // // Created by Paolo Alberti on 14/05/18. // Copyright © 2018 Paolo. All rights reserved. // import UIKit class StartController: UIViewController, BWWalkthroughViewControllerDelegate { @IBOutlet var giocaBtn: UIButton! @IBOutlet var regoleBtn: UIButton! @IBOutlet var sfondoView: UIImageView! @IBOutlet var mainView: UIView! override func viewDidLoad() { super.viewDidLoad() DataManager.shared.StartC = self DataManager.shared.cambiaStile(stile: DataManager.shared.stileGrafica) DataManager.shared.rimuoviNotifiche() giocaBtn.cornerRadius = 5 giocaBtn.applyGradient(colours: [bluscuro, blu]) giocaBtn.borderWidth = 2 giocaBtn.borderColor = grigio regoleBtn.cornerRadius = 5 regoleBtn.applyGradient(colours: [bluscuro, blu]) regoleBtn.borderWidth = 2 regoleBtn.borderColor = grigio giocaBtn.setTitle(NSLocalizedString("Gioca", comment: ""), for: .normal) regoleBtn.setTitle(NSLocalizedString("Regole del Gioco", comment: ""), for: .normal) // Ridimensiono la schermata delle Opzioni per i diversi Device (NON uso l'Auto Layout) var scale = self.view.frame.size.width/414 if (UIDevice.current.userInterfaceIdiom == .pad) { scale = self.view.frame.size.height/736 } mainView.transform = CGAffineTransform(scaleX: scale, y: scale) } @IBAction func gioca(_ sender: UIButton) { Sound.play(file: "click.mp3") DataManager.shared.lightGen.impactOccurred() } @IBAction func mostraRegole(_ sender: UIButton) { mostraWalkthrough() } func mostraWalkthrough() { // Get view controllers and build the walkthrough let stb = UIStoryboard(name: "Main", bundle: nil) let walkthrough = stb.instantiateViewController(withIdentifier: "container") as! BWWalkthroughViewController let page_uno = stb.instantiateViewController(withIdentifier: "tut1") //let pag_due = stb.instantiateViewController(withIdentifier: "tut2") let page_tre = stb.instantiateViewController(withIdentifier: "tut3") let page_quattro = stb.instantiateViewController(withIdentifier: "tut4") let page_cinque = stb.instantiateViewController(withIdentifier: "tut5") let page_sei = stb.instantiateViewController(withIdentifier: "tut6") // Attach the pages to the master walkthrough.delegate = self walkthrough.add(viewController:page_uno) //walkthrough.add(viewController:pag_due) walkthrough.add(viewController:page_tre) walkthrough.add(viewController:page_quattro) walkthrough.add(viewController:page_cinque) walkthrough.add(viewController:page_sei) self.present(walkthrough, animated: true, completion: nil) } func walkthroughCloseButtonPressed() { self.dismiss(animated: true, completion: nil) } }