Ejemplo n.º 1
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();
    }
Ejemplo n.º 2
0
    public void OpenAfterCrateOpeningInterface()
    {
        PlayerEquipmentsDatas playerEquipmentsData = PlayerDataSaver.LoadPlayerEquipmentsDatas();

        //cratesParent.position = Vector3.SmoothDamp(cratesParent.position, cratesPositionWhenAllOpened.position, ref Vector3.zero, 1.5f);

        if (IntersceneManager.intersceneManager != null)
        {
            int numberOfTooMuchEquipments = playerLootManager.GetAllLootedEquipments.Count + playerEquipmentsData.GetPlayerEquipmentsInventory.Count - IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerInventoryCapacity;
            if (numberOfTooMuchEquipments > 0)
            {
                tooMuchLootButton.gameObject.SetActive(true);
                afterLootFinishedPanel.SetActive(false);
                tooMuchLootButton.SetButtonLabel("There's too much for us to carry. We have to throw " + numberOfTooMuchEquipments + " equipments.");
            }
            else
            {
                OpenReadyToContinuePanel();
            }
        }
        else
        {
            OpenReadyToContinuePanel();
        }
    }
Ejemplo n.º 3
0
    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;
            }
        }
    }
Ejemplo n.º 4
0
 private void Awake()
 {
     playerDataSaver   = GetComponent <PlayerDataSaver>();
     monstersText.text = "0";
     amountText.text   = "0";
     GetMonstersFromCloud();
 }
Ejemplo n.º 5
0
    public void LoadAllShopsDatas()
    {
        SellersData sellersData = PlayerDataSaver.LoadShopDatas();

        if (sellersData != null)
        {
            if (sellersData.GetAllSellersDatas != null)
            {
                foreach (SingleSellerData singleSellerData in sellersData.GetAllSellersDatas)
                {
                    string shopName = singleSellerData.GetShopName;
                    foreach (ShopWithShopParameters shop in allShopsWithParameters)
                    {
                        if (shopName == shop.GetShopName)
                        {
                            shop.SetSoldItems(singleSellerData.GetAllSoldEquipments);
                            break;
                        }
                    }
                }
            }
        }

        /*if(sellersData != null)
         *  allShopsWithParameters = sellersData.GetAllSellersDatas*/
    }
Ejemplo n.º 6
0
 private void Awake()
 {
     playerDataSaver = GetComponent <PlayerDataSaver>();
     MonsterDestroyer.OnMonsterClicked += MonsterDestroyer_OnMonsterClicked;
     player          = Camera.main;
     battleText.text = "Battle info...";
     currentState    = BattleState.Idle;
 }
Ejemplo n.º 7
0
 private void Awake()
 {
     cam             = FindObjectOfType <MonsterDestroyer>();
     playerDataSaver = GetComponent <PlayerDataSaver>();
     if (playerDataSaver.GetScavHunt() == 1)
     {
         StartCoroutine(ResumeScavengerHunt());
     }
 }
Ejemplo n.º 8
0
 private void Awake()
 {
     playerDataSaver        = GetComponent <PlayerDataSaver>();
     wasteToUnlockCounter   = playerDataSaver.GetWasteCollected();
     recycleToUnlockCounter = playerDataSaver.GetRecycleCollected();
     tasks = playerDataSaver.GetTasks();
     CheckForLocations();
     GetAchievementsFromData();
 }
Ejemplo n.º 9
0
 private void Awake()
 {
     currentBuildLevel        = SceneManager.GetActiveScene().buildIndex;
     usernameInputField       = usernameInputField.GetComponent <TMP_InputField>();
     passwordInputField       = passwordInputField.GetComponent <TMP_InputField>();
     repeatPasswordInputField = repeatPasswordInputField.GetComponent <TMP_InputField>();
     emailInputField          = emailInputField.GetComponent <TMP_InputField>();
     playerDataSaver          = GetComponent <PlayerDataSaver>();
 }
Ejemplo n.º 10
0
 private void Awake()
 {
     if (calculateDistance == null)
     {
         calculateDistance = FindObjectOfType <CalculateDistance>();
     }
     scanRubbish     = GetComponent <ScanRubbish>();
     fillerImage     = GetComponent <Image>();
     playerDataSaver = GetComponent <PlayerDataSaver>();
 }
Ejemplo n.º 11
0
    // Start is called before the first frame update
    void Start()
    {
        initialsInputField = GameObject.Find("InitialsInputField").transform;
        initialsInputField.gameObject.SetActive(false);

        scoreChecked = false;

        playerData      = PlayerDataSaver.LoadPlayerData();
        mostRecentScore = playerData.recentScore;
    }
Ejemplo n.º 12
0
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Ejemplo n.º 13
0
    public void SkipTutorial()
    {
        PlayerProgressionDatas data = PlayerDataSaver.LoadProgressionDatas();

        if (data != null)
        {
            data.SetPassedTutorial();
            PlayerDataSaver.SavePlayerProgressionDatas(data);
            passedTutorial = true;
        }
    }
Ejemplo n.º 14
0
 public void Awake()
 {
     playerDataSaver   = GetComponent <PlayerDataSaver>();
     currentBuildIndex = SceneManager.GetActiveScene().buildIndex;
     if (string.IsNullOrEmpty(PlayFabSettings.TitleId))
     {
         PlayFabSettings.TitleId = "F86EF";
     }
     if (locationProvider == null)
     {
         locationProvider = FindObjectOfType <DeviceLocationProvider>();
     }
 }
Ejemplo n.º 15
0
    public void Reinitialize()
    {
        IntersceneManager intersceneManager = IntersceneManager.intersceneManager;

        PlayerDataSaver.ErasePlayerDatas();
        intersceneManager.GetPlayerDatas.Reinitialize();
        intersceneManager.ArenaInterscInformations.Reinitialize();
        intersceneManager.ArenaInterscInformations.SetNeedToPassTutorial(true);
        intersceneManager.MapInterscInformations.Reinitialize();
        intersceneManager.MapInterscInformations.SetMapIntersceneInfos(mapSceneName, Vector3.zero, null);
        passedTutorial = false;
        CheckForSaveFiles();
    }
Ejemplo n.º 16
0
    // Start is called before the first frame update
    void Start()
    {
        // Load Player Data
        playerData = PlayerDataSaver.LoadPlayerData();

        // Populate Fields
        firstPlaceText.GetComponent <Text>().text  = playerData.firstPlaceScore.ToString();
        secondPlaceText.GetComponent <Text>().text = playerData.secondPlaceScore.ToString();
        thirdPlaceText.GetComponent <Text>().text  = playerData.thirdPlaceScore.ToString();

        firstPlaceInitials.GetComponent <Text>().text  = playerData.firstPlaceInitials.ToUpper();
        secondPlaceInitials.GetComponent <Text>().text = playerData.secondPlaceInitials.ToUpper();
        thirdPlaceInitials.GetComponent <Text>().text  = playerData.thirdPlaceInitials.ToUpper();
    }
Ejemplo n.º 17
0
    //ne pas oublier d'assigner les sellers data au SetUp
    public void SaveShopParameters(ShopWithShopParameters parameters)
    {
        SellersData sellersData = PlayerDataSaver.LoadShopDatas();

        if (sellersData != null)
        {
            sellersData.SetSellersData(parameters);
            PlayerDataSaver.SaveSellersDatas(sellersData);
        }
        else
        {
            SaveAllShopsDatas();
        }
    }
Ejemplo n.º 18
0
    public void OpenLootExchangePanel(List<ShipEquipment> lootEquipments)
    {
        hadToSort = true;

        equipmentsInformationsManager.SetUpForArena(ThrowSelectedObject);

        lootExchangePanel.gameObject.SetActive(true);

        PlayerEquipmentsDatas equipmentDatas = PlayerDataSaver.LoadPlayerEquipmentsDatas();
        playerInventory = equipmentDatas.GetPlayerEquipmentsInventory;

        lootedEquipments = lootEquipments;

        UpdateInterface();
    }
Ejemplo n.º 19
0
    public void UpdateArmorAmountAndLifeInterface()
    {
        ShipEquipmentHull hullEquip = EquipedEquipments.GetHullEquipment as ShipEquipmentHull;

        if (hullEquip != null)
        {
            relatedShip.LfManager.SetUpArmorAndLife(hullEquip.GetShipMaximumLife, Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hullEquip.GetShipMaximumArmor), hullEquip.GetShipMaximumArmor);
            relatedShip.PlrInterface.SetLifeBar(hullEquip.GetShipMaximumLife, Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hullEquip.GetShipMaximumArmor), hullEquip.GetShipMaximumArmor);

            PlayerEquipmentsDatas equipmentsData = PlayerDataSaver.LoadPlayerEquipmentsDatas();
            equipmentsData.SetPlayerArmorAmount(relatedShip.LfManager.GetCurrentArmorAmount);
            equipmentsData.SetPlayerGoldAmount(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount);
            PlayerDataSaver.SavePlayerEquipmentsDatas(equipmentsData);
        }
    }
Ejemplo n.º 20
0
    public void SaveHighScore()
    {
        if (playerPosition == 1)
        {
            playerData.thirdPlaceInitials  = playerData.secondPlaceInitials;
            playerData.secondPlaceInitials = playerData.firstPlaceInitials;
            playerData.firstPlaceInitials  = initialsInputField.GetComponent <InputField>().text;
        }
        else if (playerPosition == 2)
        {
            playerData.thirdPlaceInitials  = playerData.secondPlaceInitials;
            playerData.secondPlaceInitials = initialsInputField.GetComponent <InputField>().text;
        }
        else if (playerPosition == 3)
        {
            playerData.thirdPlaceInitials = initialsInputField.GetComponent <InputField>().text;
        }

        // Now save all the data
        PlayerDataSaver.SavePlayerData(playerData);
    }
Ejemplo n.º 21
0
    public void LootCrate()
    {
        LootPopUpObject lootPopUpObject = GameManager.gameManager.PoolManager.GetLootPopUp(LootPopUpPoolTag.Normal, PoolInteractionType.GetFromPool);

        lootPopUpObject.transform.position = transform.position;

        if (lootedEquipment != null)
        {
            lootingPlayer.PlayerLootManager.AddLootedEquipment(lootedEquipment);
            lootPopUpObject.SetUp(transform.position, lootedEquipment.GetEquipmentInformations.GetEquipmentIcon);
        }

        if (ArenaManager.arenaManager != null)
        {
            if (lootedGold != 0)
            {
                lootingPlayer.PlayerLootManager.AddLootedGold(lootedGold);
                lootPopUpObject.SetUp(transform.position, lootedGold);
            }

            ArenaManager.arenaManager.DropManager.RemoveDropCrate(this);
        }
        else
        {
            if (IntersceneManager.intersceneManager != null)
            {
                IntersceneManager.intersceneManager.GetPlayerDatas.EarnMoney(lootedGold);

                PlayerEquipmentsDatas data = PlayerDataSaver.LoadPlayerEquipmentsDatas();
                data.SetPlayerGoldAmount(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount);
                PlayerDataSaver.SavePlayerEquipmentsDatas(data);

                lootPopUpObject.SetUp(transform.position, lootedGold);
            }
        }

        gameObject.SetActive(false);
        GameManager.gameManager.PoolManager.ReturnLootCrate(this);
    }
Ejemplo n.º 22
0
    public void SetUpPlayerInventoryAndSet()
    {
        PlayerEquipmentsDatas playerEquipmentsDatas = PlayerDataSaver.LoadPlayerEquipmentsDatas();

        if (playerEquipmentsDatas != null)
        {
            IntersceneManager.intersceneManager.GetPlayerDatas.SetPlayerCurrentArmorValue(playerEquipmentsDatas.GetPlayerArmorAmount);
            IntersceneManager.intersceneManager.GetPlayerDatas.SetCurrentPlayerGoldAmount(playerEquipmentsDatas.GetPlayerGoldAmount);

            mapManager.ShipCompoManager.SetPlayerEquipmentsSet(playerEquipmentsDatas.GetPlayerEquipmentsSet);
            List <ShipEquipment> playerEquipmentsInventory = playerEquipmentsDatas.GetPlayerEquipmentsInventory;
            inventoryManager.SetPlayerEquipments(playerEquipmentsInventory);
            mapManager.UpdatePlayerEquipments();

            docksInterface.UpdatePlayerGoldText();

            ShipEquipmentHull hull = playerEquipmentsDatas.GetPlayerEquipmentsSet.GetHullEquipment as ShipEquipmentHull;
            if (hull != null)
            {
                //docksInterface.UpdatePlayerHullLifeText(hull.GetShipMaximumLife);
                docksInterface.UpdatePlayerHullArmorText(Mathf.Clamp(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerCurrentArmorValue, 0, hull.GetShipMaximumArmor), hull.GetShipMaximumArmor);
            }
        }
    }
Ejemplo n.º 23
0
    public void Restart()
    {
        /*if (!restarting)
         * {*/
        PlayerEquipmentsDatas equipmentsData = PlayerDataSaver.LoadPlayerEquipmentsDatas();

        if (equipmentsData == null)
        {
            equipmentsData = new PlayerEquipmentsDatas();
            equipmentsData.SetPlayerEquipmentsData(new EquipmentsSet(), new List <ShipEquipment>(), player.LfManager.GetCurrentArmorAmount, IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount);
        }
        else
        {
            equipmentsData.SetPlayerArmorAmount(player.LfManager.GetCurrentArmorAmount);
            equipmentsData.SetPlayerGoldAmount(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount);
        }
        IntersceneManager.intersceneManager.GetPlayerDatas.SetPlayerCurrentArmorValue(player.LfManager.GetCurrentArmorAmount);

        PlayerDataSaver.SavePlayerEquipmentsDatas(equipmentsData);

        SceneManager.LoadSceneAsync(SceneManager.GetActiveScene().buildIndex);
        //restarting = true;
        //}
    }
Ejemplo n.º 24
0
 private void OnEnable()
 {
     playerDataSaver   = GetComponent <PlayerDataSaver>();
     levelRubbishCombo = new Dictionary <int, int>()
     {
         { 1, 20 },
         { 2, 50 },
         { 3, 100 },
         { 4, 200 },
         { 5, 300 },
         { 6, 500 },
         { 7, 700 },
         { 8, 1000 },
         { 9, 1250 },
         { 10, 1500 },
         { 11, 1750 },
         { 12, 2000 },
         { 13, 2500 },
         { 14, 3000 },
         { 15, 5000 }
     };
     levelSlider = GetComponent <Slider>();
     Filling();
 }
Ejemplo n.º 25
0
 public void SaveAllShopsDatas()
 {
     PlayerDataSaver.SaveSellersDatas(allShopsWithParameters);
 }
Ejemplo n.º 26
0
 private void Awake()
 {
     playerDataSaver      = GetComponent <PlayerDataSaver>();
     teamnameSetterButton = GetComponent <Button>();
 }
Ejemplo n.º 27
0
 private void Start()
 {
     playerDataSaver = GetComponent <PlayerDataSaver>();
     myBadge         = playerDataSaver.GetProgressLevel();
     BadgeToData();
 }
Ejemplo n.º 28
0
 private void Awake()
 {
     playerDataSaver = GetComponent <PlayerDataSaver>();
     btn             = GetComponent <Button>();
     coins           = playerDataSaver.GetCoinsAvailable();
 }
Ejemplo n.º 29
0
 private void Awake()
 {
     playerDataSaver = GetComponent <PlayerDataSaver>();
     EnableCards();
 }
Ejemplo n.º 30
0
    public void GoBackToMap()
    {
        /*if (backingToMap)
         *  return;*/

        if (IntersceneManager.intersceneManager == null)
        {
            Debug.LogWarning("Attention : il n'y a pas d'IntersceneManager actuellement, impossible de retourner sur la map");
        }

        string menuSceneName    = IntersceneManager.intersceneManager.MapInterscInformations.GetMapSceneName;
        string specialSceneName = IntersceneManager.intersceneManager.MapInterscInformations.GetSpecialSceneToLoadName;

        try
        {
            PlayerEquipmentsDatas equipmentsData = PlayerDataSaver.LoadPlayerEquipmentsDatas();
            if (equipmentsData == null)
            {
                equipmentsData = new PlayerEquipmentsDatas();

                List <ShipEquipment> playerInventoryEquipments = new List <ShipEquipment>();
                if (equipmentLootExchangeManager.HadToSort)
                {
                    foreach (ShipEquipment equip in equipmentLootExchangeManager.GetPlayerModifiedLoot)
                    {
                        playerInventoryEquipments.Add(equip);
                    }
                }
                else
                {
                    foreach (ShipEquipment equip in player.PlayerLootManager.GetAllLootedEquipments)
                    {
                        playerInventoryEquipments.Add(equip);
                    }
                }

                equipmentsData.SetPlayerEquipmentsData(new EquipmentsSet(), playerInventoryEquipments, player.LfManager.GetCurrentArmorAmount, IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount);
            }
            else
            {
                equipmentsData.SetPlayerArmorAmount(player.LfManager.GetCurrentArmorAmount);
                equipmentsData.SetPlayerGoldAmount(IntersceneManager.intersceneManager.GetPlayerDatas.GetPlayerGoldAmount);

                List <ShipEquipment> playerInventoryEquipments = new List <ShipEquipment>();
                if (equipmentLootExchangeManager.HadToSort)
                {
                    foreach (ShipEquipment equip in equipmentLootExchangeManager.GetPlayerModifiedInventory)
                    {
                        playerInventoryEquipments.Add(equip);
                    }

                    foreach (ShipEquipment equip in equipmentLootExchangeManager.GetPlayerModifiedLoot)
                    {
                        playerInventoryEquipments.Add(equip);
                    }
                }
                else
                {
                    playerInventoryEquipments = equipmentsData.GetPlayerEquipmentsInventory;
                    foreach (ShipEquipment equip in player.PlayerLootManager.GetAllLootedEquipments)
                    {
                        playerInventoryEquipments.Add(equip);
                    }
                }

                equipmentsData.SetPlayerInventory(playerInventoryEquipments);
            }

            PlayerDataSaver.SavePlayerEquipmentsDatas(equipmentsData);


            if (specialSceneName != null && specialSceneName != "" && Won)
            {
                IntersceneManager.intersceneManager.MapInterscInformations.ResetSpecialScene();
                SceneManager.LoadSceneAsync(specialSceneName);
            }
            else
            {
                SceneManager.LoadSceneAsync(menuSceneName);
            }
            //backingToMap = true;
        }
        catch
        {
            Debug.LogWarning("Attention : le nom de scène n'a pas été assigné sur l'interscene manager, ou la scene n'existe pas (ou n'as pas été buildée)");
        }
    }