예제 #1
0
        public static bool IsLevelLocked(PillarConfig config, int difficulty)
        {
            if (AllProgressionUnlocked)
            {
                return(false);
            }

            // If null, check difficulty
            if (config.PreviousConfig == null)
            {
                // Easy is unlocked so is holochess and tower defense.
                if (difficulty == 1 || config.Game == Game.HoloChess || config.Game == Game.TowerDefense)
                {
                    return(false);
                }

                // Only Assault can get here.
                if (config.Game == Game.Assault)
                {
                    return(!GetDuelApi().Progress.HasCompleted(DuelAPI.Duelist.KyloRen, difficulty - 1));
                }

                return(false);
            }

            // Hard Core Duel Track Exception, must have all 3 medals
            if (difficulty == 3 && config.Planet == PlanetType.Core && config.Game == Game.Assault && config.PillarNumber == 1)
            {
                return(!(IsMedalUnlocked(MedalType.Insight) && IsMedalUnlocked(MedalType.Leadership) && IsMedalUnlocked(MedalType.AdvancedCombat)));
            }

            return(!IsLevelComplete(config.PreviousConfig, difficulty));
        }
예제 #2
0
        /// <summary>
        /// Logs the game result.
        /// </summary>
        /// <param name="result">Result.</param>
        /// <param name="rating">Rating.</param>
        /// <param name="multiplayer">If set to <c>true</c> multiplayer.</param>
        private static void LogGameResult(string result, int rating, bool multiplayer)
        {
            // MenuController.ConfigToLoad won't get set while testing specific games in editor
            if (MenuController.ConfigToLoad == null)
            {
                return;
            }

            PillarConfig    config = MenuController.ConfigToLoad;
            ActionAnalytics action = new ActionAnalytics(result,
                                                         GameModeFromConfig(config) + result,
                                                         config.PillarNumber,
                                                         rating.ToString(),
                                                         multiplayer ? "multiplayer" : "single_player",
                                                         MenuController.DifficultyToLoad.ToString(),
                                                         config.ContextForAnalytics());

            string stepName = result;

            if (config.Game == Game.Assault || config.Game == Game.Duel)
            {
                // difficulty is only used for Duel and Assault. Not for Holochess and Tower Defense.
                stepName += "_" + MenuController.DifficultyToLoad.ToString();
            }
            TimingAnalytics timingAction = new TimingAnalytics((int)(UnityEngine.Time.time - timeGameStarted),
                                                               GameModeFromConfig(config).TrimEnd('.'),
                                                               config.ContextForAnalytics(),
                                                               config.PillarNumber,
                                                               stepName);

            Analytics.LogAction(action);
            Analytics.LogTimingAction(timingAction);
            LogToConsole("LogGameResult: " + result + " " + rating.ToString());
        }
예제 #3
0
        public static int GetLevelAchievements(PillarConfig config, int difficulty)
        {
            switch (config.Game)
            {
            // 1 = win, 2 = hits under 15, 3 = hits under 10
            case Game.Assault:
                return(GetAssaultApi().RatingForStage(config, difficulty));

            case Game.Duel:
                return(DuelRating.RatingForStage(config, difficulty));

            // 1 = primary, 2 = secondary
            case Game.TowerDefense:
                if (GetTDAPI().DidEarnEmblem(config.Battle, TDAPI.Emblems.Secondary))
                {
                    return(2);
                }

                if (GetTDAPI().DidEarnEmblem(config.Battle, TDAPI.Emblems.Victory))
                {
                    return(1);
                }
                break;

            case Game.HoloChess:
                return(GetChessApi().RatingForStage(config));
            }

            return(0);
        }
예제 #4
0
        /// <summary>
        /// Sets the "beaten" flag for a level.
        /// </summary>
        /// <param name="pillarConfig">Pillar config.</param>
        /// <param name="difficulty">Difficulty.</param>
        /// <param name="hitsTaken">Hits taken.</param>
        public static void SetLevelBeaten(PillarConfig pillarConfig, int difficulty = 1, int hitsTaken = 0)
        {
            PersistentDataStorage data            = new PersistentDataStorage(Game.ForceVision);
            ProgressionData       progressionData = GetProgressionData(data);

            progressionData.LevelsBeat.Add(new ProgressionLevel(pillarConfig, difficulty, hitsTaken));
            data.SaveSerialized(ProgressionFile, progressionData);
        }
        private Difficulty GetDifficultyToCheck(PillarConfig config)
        {
            switch (config.Game)
            {
            case Game.Assault:
                return((config.Planet == PlanetType.Core) ? Difficulty.Medium : Difficulty.Easy);

            case Game.Duel:
                return((config.Duelist == DuelAPI.Duelist.Archivist) ? Difficulty.Medium : Difficulty.Easy);

            default:
                return(Difficulty.Easy);
            }
        }
예제 #6
0
        /// <summary>
        /// Returns a "game mode" string from a PillarConfig
        /// </summary>
        /// <returns>The mode from config.</returns>
        /// <param name="config">Config.</param>
        private static string GameModeFromConfig(PillarConfig config)
        {
            switch (config.Game)
            {
            case Game.Assault:
            case Game.Duel:
                return("CombatChallenge.");

            case Game.HoloChess:
                return("InsightChallenge.");

            case Game.TowerDefense:
                return("LeadershipChallenge.");

            default:
                return("UnknownGameMode.");
            }
        }
예제 #7
0
        /// <summary>
        /// Logs unlocking a pawn / force power, etc.
        /// </summary>
        /// <param name="unlock">Unlock.</param>
        /// <param name="multiplayer">If set to <c>true</c> multiplayer.</param>
        public static void LogUnlock(string unlock, bool multiplayer = false)
        {
            PillarConfig config = MenuController.ConfigToLoad;

            if (config == null)
            {
                return;
            }

            ActionAnalytics action = new ActionAnalytics("unit_unlocked",
                                                         GameModeFromConfig(config) + "unit_unlocked",
                                                         config.PillarNumber,
                                                         unlock,
                                                         multiplayer ? "multiplayer" : "single_player",
                                                         MenuController.DifficultyToLoad.ToString(),
                                                         config.ContextForAnalytics());

            Analytics.LogAction(action);
            LogToConsole("LogUnlock: " + unlock);
        }
예제 #8
0
        /// <summary>
        /// Logs a game starting or restarting.
        /// </summary>
        /// <param name="restart">Whether the game is starting normally, or restarting via "restart" in the pause menu.</param>
        /// <param name="multiplayer">If set to <c>true</c> multiplayer.</param>
        private static void LogGameStartOrRestart(bool restart, bool multiplayer)
        {
            // MenuController.ConfigToLoad won't get set while testing specific games in editor
            if (MenuController.ConfigToLoad == null)
            {
                return;
            }

            PillarConfig    config = MenuController.ConfigToLoad;
            ActionAnalytics action = new ActionAnalytics("game_start",
                                                         GameModeFromConfig(config) + "game_start",
                                                         config.PillarNumber,
                                                         restart ? "retry" : null,
                                                         multiplayer ? "multiplayer" : "single_player",
                                                         MenuController.DifficultyToLoad.ToString(),
                                                         config.ContextForAnalytics());

            timeGameStarted = UnityEngine.Time.time;
            Analytics.LogAction(action);
            LogToConsole("LogGameStartOrRestart: restart=" + restart.ToString());
        }
예제 #9
0
        public static bool IsLevelComplete(PillarConfig config, int difficulty)
        {
            if (AllProgressionUnlocked)
            {
                return(true);
            }

            switch (config.Game)
            {
            case Game.Assault:
                return(GetAssaultApi().RatingForStage(config, difficulty) > 0);

            case Game.Duel:
                return(GetDuelApi().Progress.HasCompleted(config.Duelist, difficulty));

            case Game.HoloChess:
                return(GetChessApi().RatingForStage(config) > 0);

            case Game.TowerDefense:
                return(GetTDAPI().DidEarnEmblem(config.Battle, TDAPI.Emblems.Victory));
            }

            return(true);
        }
예제 #10
0
        public void FinishLevel(bool victory)
        {
            // Clear Triggers
            ArchivistInterstitialController.Triggers.Clear();
            MenuAudioController.Triggers.Clear();

            // If this is the first time you won this level
            bool firstTimeBeat        = false;
            bool earnedInsight        = false;
            bool earnedLeadership     = false;
            bool earnedAdvancedCombat = false;

            // Level we just played
            PillarConfig          lastPlayedLevel      = MenuController.ConfigToLoad;
            Difficulty            lastPlayedDifficulty = MenuController.DifficultyToLoad;
            PersistentDataStorage data            = new PersistentDataStorage(Game.ForceVision);
            ProgressionData       progressionData = GetProgressionData(data);

            // Did not come from a game
            if (lastPlayedLevel == null || progressionData == null)
            {
                LoadNextScene(false, false);
                return;
            }

            // Just earned a medal
            if (!progressionData.InsightMedalUnlocked && IsMedalUnlocked(MedalType.Insight))
            {
                earnedInsight = true;
                progressionData.InsightMedalUnlocked = true;
            }

            if (!progressionData.LeadershipMedalUnlocked && IsMedalUnlocked(MedalType.Leadership))
            {
                earnedLeadership = true;
                progressionData.LeadershipMedalUnlocked = true;
            }

            if (!progressionData.CombatUnlocked && IsMedalUnlocked(MedalType.Combat))
            {
                progressionData.CombatUnlocked = true;
            }

            if (!progressionData.AdvancedCombatUnlocked && IsMedalUnlocked(MedalType.AdvancedCombat))
            {
                earnedAdvancedCombat = true;
                progressionData.AdvancedCombatUnlocked = true;
            }

            if (!progressionData.MasteryUnlocked && IsMedalUnlocked(MedalType.Mastery))
            {
                progressionData.MasteryUnlocked = true;
            }

            data.SaveSerialized(ProgressionFile, progressionData);

            // Check for first time.
            if (victory)
            {
                ProgressionLevel level = progressionData.LevelsBeat.Find(check => (check.LevelHash == lastPlayedLevel.GetHashCode() && (int)lastPlayedDifficulty == check.Difficulty));
                int hitsTaken          = 0;
                if (lastPlayedLevel.Game == Game.Duel && GetDuelApi().LastResult != null)
                {
                    hitsTaken = GetDuelApi().LastResult.HitsTaken;
                    Log.Debug("LastResult found. Setting hitsTaken to " + hitsTaken.ToString());
                }
                else
                {
                    Log.Debug("LastResult NOT found. Setting hitsTaken to zero");
                }

                if (level == null)
                {
                    SetLevelBeaten(lastPlayedLevel, (int)lastPlayedDifficulty, hitsTaken);
                    firstTimeBeat = true;
                    if (lastPlayedLevel.IsBonusPlanet)
                    {
                        PlanetLineController.BeatFirstTime = false;
                        MenuController.UnlockedPillar      = true;
                    }
                    else
                    {
                        PlanetLineController.BeatFirstTime = true;
                    }
                }

                // You did better this time (DUEL only)
                else if (level.HitsTaken > hitsTaken)
                {
                    progressionData.LevelsBeat.First(item => item == level).HitsTaken = hitsTaken;
                    data.SaveSerialized(ProgressionFile, progressionData);
                }
            }

            #region LOSS TRIGGERS

            // Defeat Archivist and strike down (loss)
            if (lastPlayedDifficulty == Difficulty.Hard && lastPlayedLevel.Duelist == DuelAPI.Duelist.Archivist && !victory)
            {
                ProgressionLevel level = progressionData.LevelsLost.Find(check => (check.LevelHash == lastPlayedLevel.GetHashCode() && (int)lastPlayedDifficulty == check.Difficulty));

                if (GetDuelApi().LastResult != null && GetDuelApi().LastResult.DuelEnd == DuelAPI.DuelEndCondition.ObjectiveFail && level == null)
                {
                    progressionData.LevelsLost.Add(new ProgressionLevel(lastPlayedLevel, (int)lastPlayedDifficulty));
                    data.SaveSerialized(ProgressionFile, progressionData);

                    // Animation Trigger: Defeat Archivist on hard  and strike down
                    MenuAudioController.Triggers.Add(Constants.LoseCoreDuelHard);

                    LoadNextScene(true, victory);
                    return;
                }
            }

            // First Loss based on Config Values
            if (!victory && !string.IsNullOrEmpty(lastPlayedLevel.LostVOTrigger[(int)lastPlayedDifficulty - 1]))
            {
                ProgressionLevel level = progressionData.LevelsLost.Find(check => (check.LevelHash == lastPlayedLevel.GetHashCode() && (int)lastPlayedDifficulty == check.Difficulty));

                // First Time Loss
                if (level == null)
                {
                    // Save it
                    progressionData.LevelsLost.Add(new ProgressionLevel(lastPlayedLevel, (int)lastPlayedDifficulty));
                    data.SaveSerialized(ProgressionFile, progressionData);

                    // Audio Trigger:

                    /*
                     * Config: first loss on pillar 1 of assault (easy, medium, and hard), chess, tower for all planets
                     * Config: First Time win first Strategy battle on Naboo
                     * Config: First time win first Holochess match on Naboo
                     * Config: First time defeat last assault mode on each planet (easy and medium)
                     */
                    MenuAudioController.Triggers.Add(lastPlayedLevel.LostVOTrigger[(int)lastPlayedDifficulty - 1]);

                    LoadNextScene(true, victory);
                    return;
                }
            }

            #endregion

            // Always go back to where you came if you lose
            if (!victory)
            {
                LoadNextScene(true, victory);
                return;
            }

            // Not first time, either go back to where you came, or the next planet
            if (!firstTimeBeat)
            {
                LoadNextScene(true, victory);
                return;
            }

            // Error..
            if (lastPlayedLevel.Interstitial.Length < (int)lastPlayedDifficulty)
            {
                LoadNextScene(false, victory);
                return;
            }

            // They unlocked green for the first time
            if (lastPlayedLevel.Game == Game.Duel && lastPlayedDifficulty == Difficulty.Easy && lastPlayedLevel.Duelist == DuelAPI.Duelist.KyloRen)
            {
                SetSavedSaberColorID((int)ColorID.GREEN);
            }

            // Hard Archivist Let Live
            if (lastPlayedDifficulty == Difficulty.Hard && lastPlayedLevel.Duelist == DuelAPI.Duelist.Archivist)
            {
                SetSavedSaberColorID((int)ColorID.PURPLE);

                // Animation Trigger: Defeat Archivist on hard and let live
                ArchivistInterstitialController.Triggers.Add(Constants.WinCoreDuelHard);

                LoadNextScene(false, victory);
                return;
            }

            bool earnAllTrailMedals = false;

            // Beat the LAST duelist on Hard
            if (earnedAdvancedCombat)
            {
                // Animation Trigger: Config: Defeat Naboo, Garal, Lothel, Hoth, Takodana Duelist on hard
                string audioEvent = lastPlayedLevel.InterstitialTrigger[(int)lastPlayedDifficulty - 1];
                ArchivistInterstitialController.Triggers.Add(audioEvent);

                // Animation Trigger: Earn Advanced Combat Medal
                ArchivistInterstitialController.Triggers.Add(Constants.EarnAdvancedCombat);

                // This will always stack 2, 3 if 2 other medals are unlocked already
                if (IsMedalUnlocked(MedalType.Insight) && IsMedalUnlocked(MedalType.Leadership))
                {
                    // Animation Trigger: Earned advanced combat, leadership, Insight medals
                    ArchivistInterstitialController.Triggers.Add(Constants.EarnAllTrailMedals);

                    // Stack 3 animations, Duelist Beat, Medal Earned, Dark Archivist Unlocked
                    progressionData.DarkArchivistUnlocked = true;
                    data.SaveSerialized(ProgressionFile, progressionData);
                }

                LoadNextScene(false, victory);
                return;
            }

            // Unlocked Dark Archivist
            if ((earnedLeadership || earnedInsight) && !progressionData.DarkArchivistUnlocked)
            {
                if (IsMedalUnlocked(MedalType.Insight) && IsMedalUnlocked(MedalType.Leadership) && IsMedalUnlocked(MedalType.AdvancedCombat))
                {
                    // Animation Trigger: Earned advanced combat, leadership, Insight medals
                    earnAllTrailMedals = true;

                    progressionData.DarkArchivistUnlocked = true;
                    data.SaveSerialized(ProgressionFile, progressionData);
                }
            }

            // Animation Trigger

            /*
             *      Config: Defeat Ren on easy
             *      Config: Defeat Archivist on med
             *      Config: Defeat Core Holochess
             *      Config: Defeat Core Tower Defense
             *      Config: Defeat Naboo, Garal, Lothel, Hoth, Takodana Duelist on hard
             */
            if (lastPlayedLevel.Interstitial[(int)lastPlayedDifficulty - 1])
            {
                string audioEvent = lastPlayedLevel.InterstitialTrigger[(int)lastPlayedDifficulty - 1];
                ArchivistInterstitialController.Triggers.Add(audioEvent);
            }

            // Audio Trigger

            /*
             * Config: Defeat Maul Easy
             * Config: Win Naboo Holochess Trial
             * Config: Win Naboo Strategy Trial
             * Config: Defeat Sister on easy
             * Config: Win Garel Holochess Trial
             * Config: Win Garel Strategy Trial
             * Config: Defeat Inquisitor on easy
             * Config: Win Lothal Holochess Trial
             * Config: Win Lothal Strategy Trial
             * Config: Defeat Vader on easy
             * Config: Win Hoth Holochess Trial
             * Config: Win Hoth Strategy Trial
             * Config: Win Takodana Holochess
             * Config: Win Takodana Strategy
             * Config: Defeat Maul on Med
             * Config: Defeat Sister on Med
             * Config: Defeat Inquisitor on med
             * Config: Defeat Vader on med
             * Config: Defeat Ren on med
             */
            else if (!string.IsNullOrEmpty(lastPlayedLevel.InterstitialTrigger[(int)lastPlayedDifficulty - 1]))
            {
                // checking for duel games on bonus planet
                if (lastPlayedLevel.IsBonusPlanet)
                {
                    bool hasWonStrategy = towerApi.HasWonBattle(TDAPI.Battles.Crait_3);
                    if (lastPlayedLevel.Game == Game.Duel)
                    {
                        // player has not completed strategy
                        if (!hasWonStrategy)
                        {
                            if (lastPlayedDifficulty == Difficulty.Easy)
                            {
                                MenuAudioController.Triggers.Add(AudioEventName.Progression.CompleteCraitDuelistAndNotCompleteStrategy);
                            }
                            else if (lastPlayedDifficulty == Difficulty.Medium)
                            {
                                MenuAudioController.Triggers.Add(AudioEventName.Progression.CompleteCraitDuelistMedium);
                            }
                            else if (lastPlayedDifficulty == Difficulty.Hard)
                            {
                                MenuAudioController.Triggers.Add(AudioEventName.Progression.CompleteCraitDuelistHard);
                            }
                        }
                        // player has completed strategy
                        else
                        {
                            if (lastPlayedDifficulty == Difficulty.Easy)
                            {
                                ArchivistInterstitialController.Triggers.Add(AudioEventName.Progression.CompleteCraitDuelistAndCompleteStrategy);
                            }
                        }
                    }
                    else if (lastPlayedLevel.Game == Game.TowerDefense)
                    {
                        // checking if duelist complete (easy)
                        bool hasWonDuelist = duelApi.Progress.HasCompleted(DuelAPI.Duelist.PraetorianGuards, 1);

                        if (hasWonStrategy && !hasWonDuelist)
                        {
                            MenuAudioController.Triggers.Add(AudioEventName.Progression.CompleteCraitStrategyAndNotCompleteDuelist);
                        }
                        else if (hasWonStrategy && hasWonDuelist)
                        {
                            ArchivistInterstitialController.Triggers.Add(AudioEventName.Progression.CompleteCraitDuelistAndCompleteStrategy);
                        }
                    }
                    else if (lastPlayedLevel.Game == Game.Assault && lastPlayedLevel.PillarNumber == 2)
                    {
                        MenuAudioController.Triggers.Add(lastPlayedLevel.InterstitialTrigger[(int)lastPlayedDifficulty - 1]);
                    }
                }
                else
                {
                    string audioEvent = lastPlayedLevel.InterstitialTrigger[(int)lastPlayedDifficulty - 1];
                    MenuAudioController.Triggers.Add(audioEvent);
                }
            }

            // Make it last
            if (earnAllTrailMedals)
            {
                ArchivistInterstitialController.Triggers.Add(Constants.EarnAllTrailMedals);
            }

            if (lastPlayedLevel.IsBonusPlanet && lastPlayedLevel.Game == Game.Duel)
            {
                LoadNextScene(true, victory);
            }
            else
            {
                LoadNextScene((lastPlayedLevel.PillarNumber < 3), victory);
            }
        }
예제 #11
0
 public ProgressionLevel(PillarConfig config, int difficulty, int hitsTaken = 0)
 {
     LevelHash  = config.GetHashCode();
     Difficulty = difficulty;
     HitsTaken  = hitsTaken;
 }
예제 #12
0
        private void DelayedDeepLinkOnLoadAction()
        {
            if (Galaxy == null || Holocron == null)
            {
                return;
            }

            // Galaxy
            Galaxy.GetComponent <Animator>().Play("galaxy_hiddenToTertiary");

            // Planet
            GameObject planet;

            if (DeepLinkToBonusPlanet == null)
            {
                planet = Galaxy.transform.Find("Planets/" + DeepLinkToPlanet + "_rotationOffset/planetRot/planet").gameObject;
            }
            else
            {
                planet = Galaxy.transform.Find("Planets/" + DeepLinkToBonusPlanet.Value + "_rotationOffset/planetRot/planet").gameObject;
            }

            PlanetMenuNode planetNode = planet.GetComponent <PlanetMenuNode>();

            if (planetNode == null)
            {
                return;
            }

            planetNode.FacePlayer(stereoCamera.transform);
            selectedNodeParent = planetNode.GetRootTransform().parent;
            planetNode.GetRootTransform().SetParent(Galaxy.transform.parent, true);
            planetNode.Animator.Play("planet_hiddenToSecondary");

            // Pillars
            Animator animator;

            if (!planetNode.IsBonusPlanet)
            {
                animator = pillars.GetPlanetAnimator(planetNode.Planet);
            }
            else
            {
                animator = pillars.GetPlanetAnimator(planetNode.BonusPlanet);
            }
            animator.Play("planetPillars_planetTo" + GetGameName(DeepLinkToGame));
            pillars.FacePlayer(stereoCamera.transform);

            // Holocron
            Holocron.GetComponent <Animator>().Play("ClosedIdle");

            // Setup selected and last selected
            lastNode     = planetNode;
            selectedNode = animator.transform.Find("Pillars_" + GetGameName(DeepLinkToGame)).GetComponentInChildren <SurfaceMenuNode>(true);

            // Ambience
            if (!planetNode.IsBonusPlanet)
            {
                AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + DeepLinkToPlanet + "_Play", selectedNode.gameObject);
            }
            else
            {
                AudioEvent.Play("MAP_SFX_GalaxyMap_Ambience_" + DeepLinkToBonusPlanet.Value + "_Play", selectedNode.gameObject);
            }

            // Find the right pillar and select it
            PillarMenuNode[] pillarNodes = selectedNode.transform.GetComponentsInChildren <PillarMenuNode>(true);

            for (int i = 0; i < pillarNodes.Length; i++)
            {
                if (pillarNodes[i].Config == ConfigToLoad)
                {
                    selectedPillarNode          = pillarNodes[i];
                    selectedPillarNode.Selected = true;
                    selectedPillarNode.AnimatePillar();
                    break;
                }
            }

            // Find next pillar
            if (MenuController.UnlockedPillar)
            {
                for (int i = 0; i < pillarNodes.Length; i++)
                {
                    if (pillarNodes[i].Config.PreviousConfig == selectedPillarNode.Config)
                    {
                        // Turn on the effect
                        if (pillarNodes[i].FirstUnlockEffect != null)
                        {
                            pillarNodes[i].FirstUnlockEffect.SetActive(true);

                            // Play the audio
                            if (pillarNodes[i].Config.Game == Game.Duel)
                            {
                                string audioEvent = AudioEventName.Archivist.GalaxyMap.DuelPillarUnlock[(int)DifficultyToLoad,
                                                                                                        (int)pillarNodes[i].Config.Duelist];

                                if (!string.IsNullOrEmpty(audioEvent))
                                {
                                    AudioEvent.Play(audioEvent, Holocron);
                                }
                            }
                        }

                        break;
                    }
                }

                MenuController.UnlockedPillar = false;
            }

            // Bent Screen
            if (!planetNode.IsBonusPlanet)
            {
                pillars.UIController.Setup(selectedNode as SurfaceMenuNode, planetNode.Planet);
            }
            else
            {
                pillars.UIController.Setup(selectedNode as SurfaceMenuNode, planetNode.BonusPlanet);
            }

            if (selectedPillarNode != null)
            {
                pillars.UIController.Setup(selectedPillarNode, deepLinkDifficulty);
            }

            // Reset
            DeepLinkOnLoad = false;
            ConfigToLoad   = null;
        }
예제 #13
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;
            }
        }