Example #1
0
        private int GetFirstUnplayedLevelIndex()
        {
            //Assume first level by default.
            int returnLevel = 0;

            //Iterate through the map list from the beginning.
            for (int i = 0; i < m_MapList.Count; i++)
            {
                SinglePlayerMapDetails details = m_MapList[i];

                returnLevel = i;

                //If the player has earned enough medals to unlock the level...
                if ((details.medalCountRequired <= m_TotalMedalCount))
                {
                    LevelData levelData = PlayerDataManager.s_Instance.GetLevelData(details.id);

                    //And we haven't achieved/populated any of the objectives for this mission yet, break the loop so we return this level.
                    if (levelData.objectivesAchieved.Count == 0)
                    {
                        break;
                    }
                    else
                    {
                        int totalCount = 0;

                        for (int j = 0; j < levelData.objectivesAchieved.Count; j++)
                        {
                            if (levelData.objectivesAchieved[j] == true)
                            {
                                totalCount++;
                            }
                        }

                        if (totalCount == 0)
                        {
                            break;
                        }
                    }
                }
                else
                {
                    //Else if we don't have enough medals for this mission (which means we've parsed all viable missions up until now), select the previous mission in the list regardless of achievements.
                    if (returnLevel < (m_MapList.Count - 1))
                    {
                        returnLevel--;
                    }
                    break;
                }
            }

            return(returnLevel);
        }
Example #2
0
        //Assigned to Start button. Loads up gamedata and begins the mission.
        public void OnStartClick()
        {
            SinglePlayerMapDetails details = m_MapList[m_CurrentIndex];

            /*  取消关卡限制
             * if (details.medalCountRequired > m_TotalMedalCount)
             * {
             *      return;
             * }
             */
            GameSettings settings = GameSettings.s_Instance;

            settings.SetupSinglePlayer(m_CurrentIndex, new ModeDetails(details.name, details.description, details.rulesProcessor));
            m_NetManager.ProgressToGameScene();
        }
Example #3
0
        //Assigned to Start button. Loads up gamedata and begins the mission.
        public void OnStartClick()
        {
            SinglePlayerMapDetails details = m_MapList[m_CurrentIndex];

            if (details.medalCountRequired > m_TotalMedalCount)
            {
                return;
            }

            GameSettings settings = GameSettings.s_Instance;

            settings.SetupSinglePlayer(m_CurrentIndex, new ModeDetails(details.name, details.description, details.rulesProcessor));

            m_NetManager.ProgressToGameScene();
            AgoraVideoController.instance.JoinChannel(details.name);
        }
Example #4
0
        protected override void AssignByIndex()
        {
            //Set last selected level as current index.
            PlayerDataManager.s_Instance.lastLevelSelected = m_CurrentIndex;

            //Remove achievement medals from menu.
            ClearAchievements();

            //Get level data for the current index.
            SinglePlayerMapDetails details = m_MapList[m_CurrentIndex];

            //Get preview image for the level.
            SetImage(details.image);

            // Set BG depending on level biome.
            if (m_BgImage != null)
            {
                m_BgImage.color = details.effectsGroup == MapEffectsGroup.Snow ? m_SnowBgColour : m_DesertBgColour;
            }

            //If the required medal quantity to unlock this mission haven't been collected, the level is indicated as being locked and is not selectable.
            if (details.medalCountRequired > m_TotalMedalCount)
            {
                SetLevelName(LOCKED_NAME);
                m_Description.text = string.Format(LOCKED_DESCRIPTION, details.medalCountRequired);
                m_LockOverlay.SetActive(true);
                m_MedalRequirementText.text = details.medalCountRequired.ToString();
                m_StartGame.interactable    = false;
                return;
            }

            //If not locked, populate all the level info on the screen.

            m_LockOverlay.gameObject.SetActive(false);
            SetLevelName(details.name);
            m_Description.text       = details.description;
            m_StartGame.interactable = true;
            Objective[] objectives = (details.rulesProcessor as SinglePlayerRulesProcessor).objectives;

            SetAchievements(details.id, objectives);
        }