Beispiel #1
0
        public void OnLevelWon(AzumiEventType Event_Type, Component Sender, object Param = null)
        {
            ScoreManager myScoreManager = Sender as ScoreManager;
            int          totalScore     = myScoreManager.TotalScore;
            int          numberOfStars  = myScoreManager.NumberOfStars;

            LevelPlayerData currentLevelData = ChapterPlayerDataList[lastChapterNumber - 1].LevelPlayerDataList[lastLevelNumber - 1];

            currentLevelData.Wins++;
            if (totalScore > currentLevelData.HighScore)
            {
                currentLevelData.HighScore = totalScore;
            }
            if (numberOfStars > currentLevelData.MaxStarsEarned)
            {
                currentLevelData.MaxStarsEarned = numberOfStars;
            }
            newOpenLevel = GetNextLevel(lastChapterNumber, lastLevelNumber);

            if (newOpenLevel != null && newOpenLevel.LevelIsOpen == false)
            {
                newOpenLevel.LevelIsOpen      = true;
                newOpenLevel.LevelIsNewlyOpen = true;

                highestOpenChapter = newOpenLevel.ChapterNumber;
            }
            WritePlayerLevelSettings();
        }
Beispiel #2
0
        void SetUpNewPlayerData()
        {
            ChapterPlayerDataList = new List <ChapterPlayerData>();
            for (int i = 0; i < 4; i++)
            {
                ChapterPlayerData nextChapter = new ChapterPlayerData();
                nextChapter.ChapterNumber = i + 1;
                List <LevelPlayerData> newLevels = new List <LevelPlayerData>();
                for (int j = 0; j < 10; j++)
                {
                    LevelPlayerData nextLevel = new LevelPlayerData();
                    nextLevel.ChapterNumber  = nextChapter.ChapterNumber;
                    nextLevel.LevelNumber    = j + 1;
                    nextLevel.HighScore      = 0;
                    nextLevel.MaxStarsEarned = 0;
                    nextLevel.Wins           = 0;
                    nextLevel.Losses         = 0;
                    newLevels.Add(nextLevel);

                    if (i == 0 && j == 0)
                    {
                        nextLevel.LevelIsOpen = true;
                    }
                    else
                    {
                        nextLevel.LevelIsOpen = false;
                    }
                }
                nextChapter.LevelPlayerDataList = newLevels;
                ChapterPlayerDataList.Add(nextChapter);
            }
        }
Beispiel #3
0
 public void IncrementTimesPlayed()
 {
     if (lastChapterNumber != 0)
     {
         LevelPlayerData currentLevelData = ChapterPlayerDataList[lastChapterNumber - 1].LevelPlayerDataList[lastLevelNumber - 1];
         currentLevelData.timesPlayedThisSession++;
     }
 }
Beispiel #4
0
        JSONArray GetPlayerLevelsData(JSONArray newArray, ChapterPlayerData currentChapter)
        {
            for (int i = 0; i < currentChapter.LevelPlayerDataList.Count; i++)
            {
                LevelPlayerData currentLevel = currentChapter.LevelPlayerDataList[i];

                JSONClass newNode = new JSONClass();
                newNode["LevelNumber"].AsInt    = currentLevel.LevelNumber;
                newNode["HighScore"].AsInt      = currentLevel.HighScore;
                newNode["MaxStarsEarned"].AsInt = currentLevel.MaxStarsEarned;
                newNode["LevelIsOpen"].AsBool   = currentLevel.LevelIsOpen;
                newNode["Wins"].AsInt           = currentLevel.Wins;
                newNode["Losses"].AsInt         = currentLevel.Losses;

                newArray.Add(newNode);
            }
            return(newArray);
        }
Beispiel #5
0
        List <LevelPlayerData> SetUpPlayerLevels(JSONNode levelInfo, int chapterNumber)
        {
            List <LevelPlayerData> newLevels = new List <LevelPlayerData>();

            for (int i = 0; i < levelInfo.Count; i++)
            {
                LevelPlayerData nextLevel = new LevelPlayerData();
                nextLevel.ChapterNumber  = chapterNumber;
                nextLevel.LevelNumber    = levelInfo[i]["LevelNumber"].AsInt;
                nextLevel.HighScore      = levelInfo[i]["HighScore"].AsInt;
                nextLevel.MaxStarsEarned = levelInfo[i]["MaxStarsEarned"].AsInt;
                nextLevel.LevelIsOpen    = levelInfo[i]["LevelIsOpen"].AsBool;
                nextLevel.Wins           = levelInfo[i]["Wins"].AsInt;
                nextLevel.Losses         = levelInfo[i]["Losses"].AsInt;

                if (nextLevel.LevelIsOpen)
                {
                    highestOpenChapter = nextLevel.ChapterNumber;
                }
                newLevels.Add(nextLevel);
            }
            return(newLevels);
        }
Beispiel #6
0
        public void OnLevelLost(AzumiEventType Event_Type, Component Sender, object Param = null)
        {
            LevelPlayerData currentLevelData = ChapterPlayerDataList[lastChapterNumber - 1].LevelPlayerDataList[lastLevelNumber - 1];

            currentLevelData.Losses++;
        }
Beispiel #7
0
        public int GetLosses()
        {
            LevelPlayerData currentLevelData = ChapterPlayerDataList[lastChapterNumber - 1].LevelPlayerDataList[lastLevelNumber - 1];

            return(currentLevelData.Losses);
        }
Beispiel #8
0
        public int GetTimesLevelPlayed()
        {
            LevelPlayerData currentLevelData = ChapterPlayerDataList[lastChapterNumber - 1].LevelPlayerDataList[lastLevelNumber - 1];

            return(currentLevelData.timesPlayedThisSession);
        }