コード例 #1
0
        private void UpdateSingleButton(int levelIndex)
        {
            Button btn = levels[levelIndex];

            string    levelId   = Main.instance.gameDefinition.activeLevels[levelIndex].levelId;
            LevelData levelData = Progress.instance.levelData[levelId];

            if (levelIndex == 0)
            {
                btn.image.sprite = levelIndex == current ? leftCurrent :
                                   levelIndex <= unlocked || levelData.isStarted ? leftUnlocked : leftLocked;
                if (numberOfLevels == 1)
                {
                    progressBarParent.SetActive(false);
                }
            }
            else if (levelIndex < numberOfLevels - 1)
            {
                btn.image.sprite = levelIndex == current ? midCurrent :
                                   levelIndex <= unlocked || levelData.isStarted ? midUnlocked : midLocked;
            }
            else
            {
                btn.image.sprite = levelIndex == current ? rightCurrent :
                                   levelIndex <= unlocked || levelData.isStarted ? rightUnlocked : rightLocked;
            }

            btn.interactable = (levelIndex <= unlocked || levelData.isStarted) && levelIndex != current;

            UITooltip tooltip = btn.GetComponent <UITooltip>();

            if (tooltip)
            {
                tooltip.text = "Nivå " + levelIndex;
                if (levelIndex == current)
                {
                    tooltip.text = "<color=green><b>" + tooltip.text + "</b></color> <color=grey>(Nuvarande)</color>";
                }

                if (levelIndex > unlocked && !levelData.isStarted)
                {
                    tooltip.text += " <color=grey>(Låst)</color>";
                }

                tooltip.ApplyTooltipTextChange();
            }
        }
コード例 #2
0
        private void UpdateSingleButton(int levelIndex)
        {
            var btn = levels[levelIndex];

            var levelId   = Main.Instance.GameDefinition.activeLevels[levelIndex].levelId;
            var levelData = Progress.Instance.LevelData[levelId];

            if (levelIndex == 0)
            {
                btn.image.sprite = levelIndex == Current ? LeftCurrent : (levelIndex <= Unlocked || levelData.IsStarted ? LeftUnlocked : LeftLocked);
                if (NumberOfLevels == 1)
                {
                    ProgressBarParent.SetActive(false);
                }
            }
            else if (levelIndex < NumberOfLevels - 1)
            {
                btn.image.sprite = levelIndex == Current ? MidCurrent : (levelIndex <= Unlocked || levelData.IsStarted ? MidUnlocked : MidLocked);
            }
            else
            {
                btn.image.sprite = levelIndex == Current ? RightCurrent : (levelIndex <= Unlocked || levelData.IsStarted ? RightUnlocked : RightLocked);
            }

            btn.interactable = (levelIndex <= Unlocked || levelData.IsStarted) && levelIndex != Current;

            UITooltip tooltip = btn.GetComponent <UITooltip>();

            if (tooltip)
            {
                tooltip.text = "Nivå " + levelIndex;
                if (levelIndex == Current)
                {
                    tooltip.text = "<color=green><b>" + tooltip.text + "</b></color> <color=grey>(Nuvarande)</color>";
                }
                if (levelIndex > Unlocked && !levelData.IsStarted)
                {
                    tooltip.text += " <color=grey>(Låst)</color>";
                }
                tooltip.ApplyTooltipTextChange();
            }
        }
コード例 #3
0
        private void UpdateSingleButton(int level)
        {
            var btn = levels[level];

            if (level == 0)
            {
                btn.image.sprite = level == Current ? LeftCurrent : (level > Unlocked ? LeftLocked : LeftUnlocked);
                if (NumberOfLevels == 1)
                {
                    ProgressBarParent.SetActive(false);
                }
            }
            else if (level < NumberOfLevels - 1)
            {
                btn.image.sprite = level == Current ? MidCurrent : (level > Unlocked ? MidLocked : MidUnlocked);
            }
            else
            {
                btn.image.sprite = level == Current ? RightCurrent : (level > Unlocked ? RightLocked : RightUnlocked);
            }

            btn.interactable = level <= Unlocked && level != Current;

            UITooltip tooltip = btn.GetComponent <UITooltip>();

            if (tooltip)
            {
                tooltip.text = Manus.Loader.allManuses[level] != null ? "Demo" : "Nivå " + GetLevelNumber(level);
                if (level == Current)
                {
                    tooltip.text = "<color=green><b>" + tooltip.text + "</b></color> <color=grey>(Nuvarande)</color>";
                }
                if (level > Unlocked)
                {
                    tooltip.text += " <color=grey>(Låst)</color>";
                }
                tooltip.ApplyTooltipTextChange();
            }
        }