示例#1
0
        public Player(PlayerSaveData playerData, ContentManager content)
            : this(playerData.SlotNumber)
        {
            if (playerData == null)
            {
                throw new ArgumentNullException("playerData");
            }
            if (content == null)
            {
                throw new ArgumentNullException("content");
            }

            name = playerData.PlayerName;

            // load starting puzzleset
            PuzzleSet puzzleSet = content.Load <PuzzleSet>(playerData.PuzzleSetSaveData.assetName).Clone() as PuzzleSet;

            puzzleSet.LoadContent(content);

            // apply saved items to puzzleset
            puzzleSet.Statistics = playerData.PuzzleSetSaveData.puzzleSetStatistics;

            for (int i = 0; i < puzzleSet.Puzzles.Count; i++)
            {
                puzzleSet.Puzzles[i].IsCleared        = playerData.PuzzleSetSaveData.IsPuzzleCleared[i];
                puzzleSet.Puzzles[i].IsLocked         = playerData.PuzzleSetSaveData.IsPuzzleLocked[i];
                puzzleSet.Puzzles[i].Statistics       = playerData.PuzzleSetSaveData.AllPuzzleStatistics[i];
                puzzleSet.Puzzles[i].PlayerSolution   = playerData.PuzzleSetSaveData.PlayerSolutions[i];
                puzzleSet.Puzzles[i].IsRenderPortrait = true;
            }
            PuzzleEngine.IsCheckRender = true;

            // load updated puzzleset
            PuzzleEngine.LoadContent(content, puzzleSet);
        }
示例#2
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];
        }