-
Notifications
You must be signed in to change notification settings - Fork 0
/
MenuVC.swift
77 lines (46 loc) · 1.42 KB
/
MenuVC.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
// MenuVC.swift
// Color-Pong
//
// Created by huangzhen on 23/03/2017.
// Copyright © 2017 huangzhen. All rights reserved.
//
import Foundation
import UIKit
import SpriteKit
enum GameType{
case easy
case med
case hard
case player2
}
class MenuVC: UIViewController{
override func viewDidLoad() {
p2.layer.cornerRadius = 10
let skView = view as! SKView
skView.presentScene(MainMenuScene(size:skView.bounds.size))
}
override var preferredStatusBarStyle: UIStatusBarStyle{
return UIStatusBarStyle.lightContent
}
@IBAction func player2(_ sender: Any) {
moveToGame(game: .player2)
}
@IBAction func easy(_ sender: Any) {
moveToGame(game: .easy)
}
@IBAction func med(_ sender: Any) {
moveToGame(game: .med)
}
@IBAction func hard(_ sender: Any) {
moveToGame(game: .hard)
}
func moveToGame(game: GameType){
let gameVC = self.storyboard?.instantiateViewController(withIdentifier: "gameVC") as! GameViewController
currentGameType = game
//((gameVC.view as! SKView).scene as GameScene).
gameVC.restart(self)
self.navigationController?.pushViewController(gameVC, animated: true)
}
@IBOutlet weak var p2: UIButton!
}