public void UpdateState()
        {
            if (Configs == null)
            {
                return;
            }

            bool locked   = true;
            int  complete = 0;
            int  total    = Configs.Length;

            for (int i = 0; i < total; i++)
            {
                if (i == 0)
                {
                    // Exception when playing on hard (Not Core)
                    if (Configs[i].Planet != PlanetType.Core && Difficulty == 3 && Configs[i].Game == Game.Assault && ContainerAPI.GetDuelApi().Progress.HasCompleted(DuelAPI.Duelist.Archivist, 2))
                    {
                        locked = false;
                    }
                    else
                    {
                        locked = ContainerAPI.IsLevelLocked(Configs[i], Difficulty) || ContainerAPI.IsPlanetLocked(Configs[i].Planet);
                    }
                }

                if (ContainerAPI.IsLevelComplete(Configs[i], Difficulty))
                {
                    complete++;
                }
            }

            NotStarted.SetActive(locked);
            InProgress.SetActive(!locked && complete < total);
            Complete.SetActive(total == complete);
        }
Esempio n. 2
0
        public void UpdateState(Difficulty difficulty)
        {
            // Exception when playing on hard (Not Core)
            if (Config.Planet != PlanetType.Core && difficulty == Difficulty.Hard && (Config.Game == Game.Duel || Config.Game == Game.Assault) && Config.PillarNumber == 1 && ContainerAPI.GetDuelApi().Progress.HasCompleted(DuelAPI.Duelist.Archivist, 2))
            {
                Locked = false;
            }
            else
            {
                Locked = (Config != null) && ContainerAPI.IsLevelLocked(Config, (int)difficulty);
            }

            // Locked
            if (LockObject != null)
            {
                LockObject.SetActive(Locked);
            }

            if (TintParent != null)
            {
                Image[] tintImages = TintParent.GetComponentsInChildren <Image>();

                for (int i = 0; i < tintImages.Length; i++)
                {
                    tintImages[i].color = (Locked) ? lockedColor : unlockedColor;
                }
            }

            // The Shaders
            GameObject root = (PedestalModel != null) ? PedestalModel : gameObject;

            SkinnedMeshRenderer[] renderers = root.GetComponentsInChildren <SkinnedMeshRenderer>();
            foreach (SkinnedMeshRenderer renderer in renderers)
            {
                if (renderer == null || renderer.materials == null)
                {
                    continue;
                }

                foreach (Material material in renderer.materials)
                {
                    if (material.HasProperty("_DESATURATE"))
                    {
                        material.SetFloat("_DESATURATE", (Locked) ? 1 : 0);
                        material.shader = material.shader;
                    }
                }
            }

            // Pin
            if (PinObject != null)
            {
                switch (Config.Game)
                {
                case Game.Assault:
                case Game.Duel:
                    if (PinController.GuardianPinConfig != null)
                    {
                        PinObject.SetActive(PinController.GuardianPinConfig.Contains(Config) && (int)difficulty == PinController.GuardianPinConfigDifficulty);
                    }
                    break;

                case Game.HoloChess:
                    PinObject.SetActive(Config == PinController.ConsularPinConfig);
                    break;

                case Game.TowerDefense:
                    PinObject.SetActive(Config == PinController.CommanderPinConfig);
                    break;
                }
            }
        }
Esempio n. 3
0
        public void ShowLines()
        {
            // Show Lines
            if (!ContainerAPI.AllProgressionUnlocked)
            {
                int  lastUnlocked = -1;
                bool foundLocked  = false;
                for (int difficulty = 1; difficulty <= 3; difficulty++)
                {
                    for (int i = 0; i < DuelConfigs.Length; i++)
                    {
                        // Easy only has 5 planets to check.
                        if (difficulty == 1 && i > 14)
                        {
                            continue;
                        }

                        if (ContainerAPI.IsLevelLocked(DuelConfigs[i], difficulty))
                        {
                            foundLocked = true;
                            break;
                        }

                        lastUnlocked++;
                    }

                    if (foundLocked)
                    {
                        break;
                    }
                }

                int planetCount = System.Enum.GetNames(typeof(PlanetType)).Length;
                int easyCount   = (planetCount - 1) * 3;
                int mediumCount = easyCount + (planetCount * 3);

                // Easy (first 3 don't count, 5 planets (core doesn't have easy) * 3 pillars per)
                if (lastUnlocked > 2 && lastUnlocked < easyCount)
                {
                    lastUnlocked = lastUnlocked - 3;
                    int  planet      = Mathf.FloorToInt(lastUnlocked / 3.0f);
                    bool firstUnlock = (BeatFirstTime && (lastUnlocked % 3 == 0));

                    for (int currentPlanet = planet; currentPlanet >= 0; currentPlanet--)
                    {
                        PlayBlueLine(PlanetLines[currentPlanet], firstUnlock && currentPlanet == planet);
                    }
                }

                // Special case of Takodana to Naboo
                else if (lastUnlocked >= easyCount && lastUnlocked < easyCount + 3 && lastUnlocked < mediumCount)
                {
                    bool firstUnlock = (BeatFirstTime && (lastUnlocked % 3 == 0));

                    // Enable All Blue (Except Core)
                    for (int i = 0; i < PlanetLines.Length - 1; i++)
                    {
                        PlanetLines[i].gameObject.SetActive(true);
                        PlanetLines[i].Play(BlueExtendName);
                    }

                    // Including the special line
                    PlayBlueLine(TakodanaToNabooLine, firstUnlock);
                }

                // Medium, no line for first 3, 6 more planets * 3 pillars.
                else if (lastUnlocked >= easyCount + 3 && lastUnlocked < mediumCount)
                {
                    // Enable All Blue (Except Core)
                    for (int i = 0; i < PlanetLines.Length - 1; i++)
                    {
                        PlanetLines[i].gameObject.SetActive(true);
                        PlanetLines[i].Play(BlueExtendName);
                    }

                    // Enable Blue for bonus planets
                    BonusPlanetLines[0].gameObject.SetActive(true);
                    BonusPlanetLines[0].Play(BlueExtendName);

                    // Include special unless we are at the core
                    if (lastUnlocked < mediumCount - 3)
                    {
                        TakodanaToNabooLine.gameObject.SetActive(true);
                        TakodanaToNabooLine.Play(BlueExtendName);
                    }

                    lastUnlocked = lastUnlocked - easyCount;
                    int  planet      = Mathf.FloorToInt(lastUnlocked / 3.0f) - 1;
                    bool firstUnlock = (BeatFirstTime && (lastUnlocked % 3 == 0));

                    for (int currentPlanet = planet; currentPlanet >= 0; currentPlanet--)
                    {
                        PlanetLines[currentPlanet].gameObject.SetActive(true);
                        PlanetLines[currentPlanet].Play((firstUnlock && currentPlanet == planet) ? GoldAnimateName : GoldExtendName);
                    }
                }
            }

            BeatFirstTime = false;
        }
Esempio n. 4
0
        private void Start()
        {
            PillarConfig currentConfig = null;

            GuardianPinConfig.Clear();

            // Guardian Track, this one is weird.

            // If the hard archivist is not beating but all hard duelist are, only pin the core (if TD / Chess are beat).
            if (!ContainerAPI.IsLevelComplete(GuardianFinalBattle, 3) && ContainerAPI.IsMedalUnlocked(MedalType.AdvancedCombat))
            {
                if (ContainerAPI.IsMedalUnlocked(MedalType.Insight) && ContainerAPI.IsMedalUnlocked(MedalType.Leadership))
                {
                    // We need to know the given pillar too..
                    currentConfig = GuardianFinalBattle;

                    // We only need to check the last 3 in this execption.
                    for (int i = 0; i < 3; i++)
                    {
                        if (!ContainerAPI.IsLevelLocked(currentConfig, 3))
                        {
                            GuardianPinConfig.Add(currentConfig);
                            GuardianPinConfigDifficulty = 3;
                            break;
                        }

                        currentConfig = currentConfig.PreviousConfig;
                    }

                    // Show the Planet Pin
                    PinHolders[(int)PlanetType.Core].ShowPin(PinType.Guardian);
                }
            }

            // If you beat archivist on medium, we show pins for all planets that you haven't beat the duelist on
            else if (ContainerAPI.IsLevelComplete(GuardianFinalBattle, 2))
            {
                currentConfig = GuardianFinalBattle;
                while (currentConfig != null)
                {
                    // Only Duelist that are not on the core, another exception.
                    if (currentConfig.Game == Game.Duel && !ContainerAPI.IsLevelComplete(currentConfig, 3) && currentConfig.Planet != PlanetType.Core)
                    {
                        // Save for later, More exceptions, need to check back 3 pillars here too....
                        PillarConfig second = currentConfig.PreviousConfig;
                        PillarConfig first  = (second != null) ? second.PreviousConfig : null;

                        if (first != null && !ContainerAPI.IsLevelComplete(first, 3))
                        {
                            GuardianPinConfig.Add(first);
                        }
                        else if (second != null && !ContainerAPI.IsLevelComplete(second, 3))
                        {
                            GuardianPinConfig.Add(second);
                        }
                        else
                        {
                            GuardianPinConfig.Add(currentConfig);
                        }

                        GuardianPinConfigDifficulty = 3;

                        // We show the pin?
                        PinHolders[(int)currentConfig.Planet].ShowPin(PinType.Guardian);
                    }

                    currentConfig = currentConfig.PreviousConfig;
                }
            }

            // If you havent...
            else
            {
                // Check medium progress then easy.
                for (int difficulty = 2; difficulty > 0; difficulty--)
                {
                    currentConfig = GuardianFinalBattle;
                    while (currentConfig != null)
                    {
                        if (!ContainerAPI.IsLevelLocked(currentConfig, difficulty))
                        {
                            // Save for later
                            GuardianPinConfig.Add(currentConfig);
                            GuardianPinConfigDifficulty = difficulty;

                            // We show the pin?
                            PinHolders[(int)currentConfig.Planet].ShowPin(PinType.Guardian);
                            difficulty = 0;
                            break;
                        }

                        currentConfig = currentConfig.PreviousConfig;
                    }
                }
            }

            // Commander Track (Easy Only)
            currentConfig = CommanderFinalBattle;
            while (currentConfig != null)
            {
                // First one not locked.
                if (!ContainerAPI.IsLevelLocked(currentConfig, 1))
                {
                    // Last Level is unlocked but not beat
                    if (currentConfig == CommanderFinalBattle)
                    {
                        if (!ContainerAPI.IsLevelComplete(currentConfig, 1))
                        {
                            PinHolders[(int)PlanetType.Core].ShowPin(PinType.Commander);
                            CommanderPinConfig = currentConfig;
                        }
                        break;
                    }

                    // Save for later
                    CommanderPinConfig = currentConfig;

                    // We show the pin?
                    PinHolders[(int)currentConfig.Planet].ShowPin(PinType.Commander);
                    break;
                }

                currentConfig = currentConfig.PreviousConfig;
            }

            // Consular Track (Easy Only)
            currentConfig = ConsularFinalBattle;
            while (currentConfig != null)
            {
                // First one not locked.
                if (!ContainerAPI.IsLevelLocked(currentConfig, 1))
                {
                    // Last Level is unlocked
                    if (currentConfig == ConsularFinalBattle)
                    {
                        // but not beat
                        if (!ContainerAPI.IsLevelComplete(currentConfig, 1))
                        {
                            PinHolders[(int)PlanetType.Core].ShowPin(PinType.Consular);
                            ConsularPinConfig = currentConfig;
                        }
                        break;
                    }

                    // Save for later
                    ConsularPinConfig = currentConfig;

                    // We show the pin?
                    PinHolders[(int)currentConfig.Planet].ShowPin(PinType.Consular);
                    break;
                }

                currentConfig = currentConfig.PreviousConfig;
            }
        }