Esempio n. 1
0
        /// Starting a New Session
        /// Start a new session based on the data provided.
        public static void StartNewSession(GameStartDescription gameStartDescription, ScreenManager screenManager, MainGameScreen introScreen)
        {
            // check the parameters
            if (gameStartDescription == null)
            {
                throw new ArgumentNullException("gameStartDescripton");
            }
            if (screenManager == null)
            {
                throw new ArgumentNullException("screenManager");
            }
            if (introScreen == null)
            {
                throw new ArgumentNullException("gameplayScreen");
            }

            // end any existing session
            EndSession();

            // create a new singleton
            singleton = new Session(screenManager);

            ContentManager sessionContent = screenManager.SessionContent;

            singleton.player = new Player(gameStartDescription.SaveSlotNumber);

            PuzzleSet puzzleSet = sessionContent.Load <PuzzleSet>(Path.Combine(@"PuzzleSets", gameStartDescription.PuzzleSetContentName)).Clone() as PuzzleSet;

            puzzleSet.LoadContent(sessionContent);

            puzzleSet.ResetPuzzleLocks();

            PuzzleEngine.LoadContent(sessionContent, puzzleSet);
            PuzzleEngine.MainScreen.CreditsPanel.LoadContent(sessionContent);

            foreach (Puzzle puzzle in puzzleSet.Puzzles)
            {
                puzzle.IsRenderPortrait = true;
            }
            PuzzleEngine.IsCheckRender = true;

//            gamer = SignedInGamer.SignedInGamers[InputManager.PlayerIndex];
        }