public void CheckForSaveFiles()
    {
        PlayerEquipmentsDatas equipmentsData = PlayerDataSaver.LoadPlayerEquipmentsDatas();

        if (equipmentsData == null)
        {
            Debug.Log("Pas de fichier d'équipements, application des équipements de base");

            equipmentsData = new PlayerEquipmentsDatas();
            equipmentsData.SetPlayerEquipmentsData(gameBeginningEquipmentSet, new List <ShipEquipment>(), 10, 0);

            PlayerDataSaver.SavePlayerEquipmentsDatas(equipmentsData);

            IntersceneManager.intersceneManager.GetPlayerDatas.SetEquipedEquipements(gameBeginningEquipmentSet);
        }
        else
        {
            IntersceneManager.intersceneManager.GetPlayerDatas.SetEquipedEquipements(equipmentsData.GetPlayerEquipmentsSet);
        }

        PlayerProgressionDatas progressionData = PlayerDataSaver.LoadProgressionDatas();

        if (progressionData == null)
        {
            Debug.Log("Pas de fichier de progression");
            PlayerDataSaver.SavePlayerProgressionDatas(new List <PassedArenaData>(), false);
        }
        else
        {
            if (progressionData.GetPassedTuto)
            {
                passedTutorial = true;
            }
        }
    }
示例#2
0
    public void EndGame()
    {
        remainingTimeBeforeOutro = 0;

        arenaProgress = ProgressionState.Ended;

        int starNumber = scoreManager.CheckPlayerScore();

        if (IntersceneManager.intersceneManager != null)
        {
            IntersceneManager.intersceneManager.ArenaInterscInformations.SetArenaPassed(true, starNumber);
            if (IsTutorialArena)
            {
                IntersceneManager.intersceneManager.ArenaInterscInformations.SetJustPassedTutorial(true);
            }
        }

        dropManager.LootAllRemainingCrates();

        gameManager.Player.PlayerLootManager.EarnLoot(dropManager, starNumber);

        if (IsTutorialArena)
        {
            PlayerProgressionDatas data = PlayerDataSaver.LoadProgressionDatas();
            data.SetPassedTutorial();
            PlayerDataSaver.SavePlayerProgressionDatas(data);
        }

        StartOutro();
    }
    public void SkipTutorial()
    {
        PlayerProgressionDatas data = PlayerDataSaver.LoadProgressionDatas();

        if (data != null)
        {
            data.SetPassedTutorial();
            PlayerDataSaver.SavePlayerProgressionDatas(data);
            passedTutorial = true;
        }
    }
示例#4
0
    public void CheckMapProgression()
    {
        IntersceneManager intersceneManager = IntersceneManager.intersceneManager;

        if (intersceneManager != null)
        {
            bool passedTutorial = false;

            PlayerProgressionDatas progressionDatas = PlayerDataSaver.LoadProgressionDatas();

            ArenaIntersceneInformations arenaIntersceneInformations = intersceneManager.ArenaInterscInformations;

            #region Tutorial
            if (arenaIntersceneInformations.GetNeedToPassTutorial)
            {
                if (arenaIntersceneInformations.GetArenaPassed)
                {
                    progressionDatas.SetPassedTutorial();
                    arenaIntersceneInformations.SetNeedToPassTutorial(false);
                    PlayerDataSaver.SavePlayerProgressionDatas(progressionDatas.GetAllPassedArenaDatas, true);
                }
            }

            if (progressionDatas != null)
            {
                passedTutorial = progressionDatas.GetPassedTuto;
            }
            #endregion

            #region Already Unlocked

            #region V2
            List <PassedArenaData> allPassedArenaDatas = new List <PassedArenaData>();
            if (progressionDatas != null)
            {
                allPassedArenaDatas = progressionDatas.GetAllPassedArenaDatas;
                if (allPassedArenaDatas == null)
                {
                    allPassedArenaDatas = new List <PassedArenaData>();
                }

                foreach (PassedArenaData datas in allPassedArenaDatas)
                {
                    foreach (MapArenaSpot arenaSpot in allMapArenaSpots)
                    {
                        if (arenaSpot.GetArenaParameters.GetSceneToLoadName == datas.GetArenaName && datas.GetArenaPassed)
                        {
                            arenaSpot.UnlockNextProgressionContent(false, datas.GetNumberOfStars);
                            break;
                        }
                    }
                }
            }
            else
            {
                Debug.Log("pas encore d'arènes débloquées");
            }
            #endregion
            #endregion

            #region Just Unlocked
            ArenaParameters lastArenaParameters = arenaIntersceneInformations.GetLaunchedArenaParameters;
            if (lastArenaParameters == null)
            {
                arenaIntersceneInformations.SetArenaPassed(false, 0);

                if (intersceneManager.ArenaInterscInformations.GetJustPassedTutorial)
                {
                    intersceneManager.ArenaInterscInformations.SetJustPassedTutorial(false);
                    if (cinematicToPlayAfterTutorial != null)
                    {
                        cinematicToPlayAfterTutorial.PlayCinematic();
                    }
                }

                return;
            }

            #region V2
            List <string> passedArenaNames = new List <string>();

            if (allPassedArenaDatas == null)
            {
                allPassedArenaDatas = new List <PassedArenaData>();
            }

            foreach (PassedArenaData datas in allPassedArenaDatas)
            {
                if (datas.GetArenaPassed)
                {
                    passedArenaNames.Add(datas.GetArenaName);
                }
            }

            if (arenaIntersceneInformations.GetArenaPassed)
            {
                int stars = arenaIntersceneInformations.GetNumberOfStars;

                if (passedArenaNames.Contains(lastArenaParameters.GetSceneToLoadName))
                {
                    foreach (MapArenaSpot arenaSpot in allMapArenaSpots)
                    {
                        if (arenaSpot.GetArenaParameters.GetSceneToLoadName == lastArenaParameters.GetSceneToLoadName)
                        {
                            if (stars > arenaSpot.GetStarsNumber)
                            {
                                arenaSpot.UnlockNextProgressionContent(false, stars);
                            }

                            foreach (PassedArenaData datas in allPassedArenaDatas)
                            {
                                if (datas.GetArenaName == lastArenaParameters.GetSceneToLoadName)
                                {
                                    datas.ChangeNumberOfStars(stars);
                                    break;
                                }
                            }
                            PlayerDataSaver.SavePlayerProgressionDatas(allPassedArenaDatas, passedTutorial);
                            break;
                        }
                    }
                    return;
                }

                foreach (MapArenaSpot arenaSpot in allMapArenaSpots)
                {
                    if (arenaSpot.GetArenaParameters.GetSceneToLoadName == lastArenaParameters.GetSceneToLoadName)
                    {
                        arenaSpot.UnlockNextProgressionContent(true, stars);
                        break;
                    }
                }

                allPassedArenaDatas.Add(new PassedArenaData(lastArenaParameters, true, stars));
                PlayerDataSaver.SavePlayerProgressionDatas(allPassedArenaDatas, passedTutorial);
            }
            #endregion
            #endregion

            bool arenaPassed   = arenaIntersceneInformations.GetArenaPassed;
            int  numberOfStars = arenaIntersceneInformations.GetNumberOfStars;

            //arenaIntersceneInformations.SetArenaLaunchInformations(null);
            arenaIntersceneInformations.SetArenaPassed(false, 0);
        }
    }