Exemplo n.º 1
0
        public static int GetCurrentSessionStarCount()
        {
            var currentLevel = GameMaster.GetCurrentLevel();

            if (currentLevel == null)
            {
                return(0);
            }
            return(LevelProgressHelper.GetLevelStarCount(currentLevel, finishedIpis));
        }
Exemplo n.º 2
0
 void Start()
 {
     GatesPosition      = new List <Vector3>();
     finishedIpis       = 0;
     Screen.orientation = ScreenOrientation.LandscapeLeft;
     SetGO(false);
     Screen.sleepTimeout = (int)SleepTimeout.NeverSleep;
     //Tundub,et unity kiiks, et seda tuleb ise alati settida
     SetDeviceRotationOptions();
     IpiCounter.Reset();
     animatingTileCount   = 0;
     levelProgressWrapper = LevelProgressHelper.GetLevelProgress();
 }
Exemplo n.º 3
0
        public static void UnLockNextLevel()
        {
            string nextName = LevelLoader.GetNextLevelNameButDoNotChangeStateOfCurrentGame(); // siin ei tohi setida Gamemasteri järgmise leveli nimeks

            // AINULT UNLOCK -- kui kasutaja vajutab next nuppu viime järgmisele
            levelProgressWrapper = LevelProgressHelper.GetLevelProgress();

            var currentLevel = levelProgressWrapper.LevelProgress.FirstOrDefault(x => x.LevelName == nextName);

            if (currentLevel == null)
            {
                currentLevel = new LevelProgress()
                {
                    LevelName = nextName
                };
                levelProgressWrapper.LevelProgress.Add(currentLevel);
            }
            currentLevel.IsUnLocked = true;
            LevelProgressHelper.UpdateLevelProgress(levelProgressWrapper);
        }
Exemplo n.º 4
0
        public static void UpdateCurrentLevelIpisMaxCount()
        {
            levelProgressWrapper = LevelProgressHelper.GetLevelProgress();

            if (string.IsNullOrEmpty(Assets.Scripts.Common.GameMaster.levelName))
            {
                return;
            }

            var currentLevel = levelProgressWrapper.LevelProgress.FirstOrDefault(x => x.LevelName == Assets.Scripts.Common.GameMaster.levelName);

            if (currentLevel == null)
            {
                currentLevel = new LevelProgress()
                {
                    LevelName = GameMaster.levelName
                };
                levelProgressWrapper.LevelProgress.Add(currentLevel);
            }
            UpdateLevelIpisMaxCount(currentLevel);
            LevelProgressHelper.UpdateLevelProgress(levelProgressWrapper);
        }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        if (MainMenu.levelProgressWrapper == null)
        {
            MainMenu.levelProgressWrapper = LevelProgressHelper.GetLevelProgress();
        }
        MainMenu.redirectToShopScreen = false;
        var levelList = GameMaster.ReLoadMaps();

        int totalCount   = levelList.Count - 1;
        int cells        = (int)Mathf.CeilToInt((levelList.Count / RowCount));
        int totalCounter = 0;
        var position     = new Vector3(XStart, YStart);
        //Kuna meil on Y telg sassis siis arvutame seda teist pidi ehk peegelpildis
        var positionText = new Vector3(XStart, YStart - YMargin);

        for (int s = 0; s < cells; s++)
        {
            for (int i = 0; i < RowCount; i++)
            {
                if (totalCounter > totalCount)
                {
                    break;
                }
                var levelMap      = levelList[totalCounter];
                var levelProgress = MainMenu.levelProgressWrapper.LevelProgress.FirstOrDefault(x => x.LevelName == levelMap.FileName);
                if (levelProgress == null)
                {
                    levelProgress = new LevelProgress {
                        LevelName = levelMap.FileName, IsUnLocked = AllwaysUnLocked
                    };
                    MainMenu.levelProgressWrapper.LevelProgress.Add(levelProgress);
                }
                else if (AllwaysUnLocked)
                {
                    levelProgress.IsUnLocked = AllwaysUnLocked;
                }
                GameObject clone     = GetGridElement(levelMap, levelProgress, levelList, MainMenu.levelProgressWrapper, position);
                var        starCount = LevelProgressHelper.GetLevelStarCount(levelProgress, levelMap);
                foreach (Transform child in clone.transform)
                {
                    LevelSelect levelSelectButton = child.GetComponent(typeof(LevelSelect)) as LevelSelect;
                    if (levelSelectButton != null)
                    {
                        levelSelectButton.LevelName  = levelMap.FileName;
                        levelSelectButton.LevelPath  = Application.dataPath + "/Resources/LevelData/" + levelMap.FileName + ".txt";
                        levelSelectButton.IsUnLocked = levelProgress.IsCompleted;
                    }
                    ObjectLabel objectLabel = child.GetComponent(typeof(ObjectLabel)) as ObjectLabel;
                    if (objectLabel)
                    {
                        GUIText gUiText = objectLabel.GetComponent <GUIText>();
                        if (gUiText != null)
                        {
                            gUiText.text = (totalCounter + 1).ToString();
                        }
                    }
                    if (child.name == "stars_select" && starCount > 0)
                    {
                        starCount--;
                        child.GetComponent <Renderer>().material.mainTextureOffset = new Vector2(0, 0);
                    }
                }
                position.x     += XMargin;
                positionText.x += XMargin;
                totalCounter++;
            }
            position.x      = XStart;
            position.y     -= YMargin;
            positionText.y += YMargin;
            positionText.x  = XStart;
        }
        GameMaster.AdjustGUISizes();
        LevelProgressHelper.UpdateLevelProgress(MainMenu.levelProgressWrapper);
    }