diff --git a/TetraVex/AppDelegate.swift b/TetraVex/AppDelegate.swift index 654835b..f6dd928 100644 --- a/TetraVex/AppDelegate.swift +++ b/TetraVex/AppDelegate.swift @@ -14,6 +14,7 @@ class AppDelegate: NSObject, NSApplicationDelegate { var currentGameModel : TVGameModel = TVGameModel() var currentGamePieces : [[TVPieceModel]]? + var gameStarted: Bool = false var optionMenu: NSMenuItem? { return NSApplication.shared.mainMenu? @@ -185,6 +186,18 @@ class AppDelegate: NSObject, NSApplicationDelegate { pv.solvedBoard = currentGamePieces pv.newBoard(currentGameModel.boardWidth, height: currentGameModel.boardHeight) + gameStarted = true } +} +//MARK: - Menu validation +extension AppDelegate: NSMenuItemValidation { + func validateMenuItem(_ menuItem: NSMenuItem) -> Bool { + if !gameStarted { + if 10...36 ~= menuItem.tag { + return false + } + } + return true + } } diff --git a/TetraVex/Base.lproj/Main.storyboard b/TetraVex/Base.lproj/Main.storyboard index 876268f..da4bc3d 100644 --- a/TetraVex/Base.lproj/Main.storyboard +++ b/TetraVex/Base.lproj/Main.storyboard @@ -99,31 +99,31 @@ - + - + - + - + - + @@ -136,31 +136,31 @@ - + - + - + - + - + @@ -170,19 +170,19 @@ - + - + - +