public void SaveTest()
    {
        EncryptedPlayerPrefs.SetInt("DataExist", 1);
        EncryptedPlayerPrefs.SetInt("Strength", userInfo.stat.strength);
        EncryptedPlayerPrefs.SetInt("Agility", userInfo.stat.agility);
        EncryptedPlayerPrefs.SetInt("Constitution", userInfo.stat.constitution);
        EncryptedPlayerPrefs.SetInt("Intelligence", userInfo.stat.intelligence);
        EncryptedPlayerPrefs.SetInt("RemainPoint", userInfo.stat.remainPoint);

        EncryptedPlayerPrefs.SetInt("CurrentADLevel", userInfo.castle.currentADLevel);
        EncryptedPlayerPrefs.SetInt("CurrentHealthLevel", userInfo.castle.currentHealthLevel);
        EncryptedPlayerPrefs.SetInt("CurrentDefenseLevel", userInfo.castle.currentDefenseLevel);
        EncryptedPlayerPrefs.SetInt("CurrentSlot", userInfo.castle.currentSlot);

        EncryptedPlayerPrefs.SetInt("Gold", userInfo.gold);
        EncryptedPlayerPrefs.SetInt("Silver", userInfo.silver);



        for (int i = 0; i < 5; i++)
        {
            EncryptedPlayerPrefs.SetInt("TowerType" + i, userInfo.tower.currentTowerLevel[i]);
        }

        EncryptedPlayerPrefs.SetInt("MaxClearStage", userInfo.maxClearStage);
        for (int i = 0; i < userInfo.stageClearInfo.Length; i++)
        {
            EncryptedPlayerPrefs.SetInt("StageClearInfo" + i, userInfo.stageClearInfo[i]);
        }

        EncryptedPlayerPrefs.SetString("PicturePath", userInfo.picturePath);

        EncryptedPlayerPrefs.SetInt("killEnemyCount", userInfo.achieveInfo.killEnemyCount);
        EncryptedPlayerPrefs.SetInt("stageClearCount", userInfo.achieveInfo.stageClearCount);
    }
    public void GuardarPartidaSinglePlayer()
    {
        int bitMapProgreso = 0;
        //TODO convertir esto a guardar objetivos de mision
        GameLevelMission gameLevel = MissionManager.instance.GetGameLevelMission(GameplayService.gameLevelMission.MissionName);

        GameplayService.gameLevelMission.UnFreeze();
        MissionAchievement[] retosAntes = GameplayService.gameLevelMission.GetAchievements().ToArray();
        //MissionAchievement[] retosDespues = MissionManager.instance.GetMission().Achievements.ToArray();

        if (gameLevel == null)
        {
            Debug.LogWarning(">>> No hay informacion del nivel " + GameplayService.gameLevelMission.MissionName);
        }
        else
        {
            string claveNivel = "prog" + gameLevel.MissionName;
            bitMapProgreso = EncryptedPlayerPrefs.GetInt(claveNivel, 0);

            for (int i = 0; i < retosAntes.Length; i++)
            {
                int flag = (bitMapProgreso % ((int)Mathf.Pow(10, i + 1))) / (int)Mathf.Pow(10, i);
                if (retosAntes[i].IsAchieved() && (flag == 0)) //importante el isAchieved() primero para que lo haga, evitar el lazy
                {
                    bitMapProgreso += (int)Mathf.Pow(10, retosAntes[i].Code);
                }
            }

            EncryptedPlayerPrefs.SetInt(claveNivel, bitMapProgreso);
        }

        // guardar las preferencias
        PlayerPrefs.Save();
    }
Esempio n. 3
0
    void SaveGameData()
    {
        if (isBGMplay)
        {
            EncryptedPlayerPrefs.SetInt("isBGMplay", 1);
        }
        else
        {
            EncryptedPlayerPrefs.SetInt("isBGMplay", 0);
        }

        if (isSFXplay)
        {
            EncryptedPlayerPrefs.SetInt("isSFXplay", 1);
        }
        else
        {
            EncryptedPlayerPrefs.SetInt("isSFXplay", 0);
        }

        EncryptedPlayerPrefs.SetInt("money", money);

        EncryptedPlayerPrefs.SetInt("level", level);

        EncryptedPlayerPrefs.SetInt("exp", exp);

        EncryptedPlayerPrefs.SetInt("hairColor", hairColor);

        PlayerPrefs.Save();
    }
Esempio n. 4
0
 private void Awake()
 {
     LoadEndingData();
     _stringBuilder     = new StringBuilder();
     _currentIndex      = MyStatus.instance.endingIndex;
     _questionText.text = _endingDatas[_currentIndex].endingQuestion;
     EncryptedPlayerPrefs.SetInt("Ending" + (_currentIndex + 1), 1);
 }
Esempio n. 5
0
    public void save()
    {
        FinanceManager _totalMoney = _managers.GetComponent <FinanceManager>();

        ShaftManager gett = _managers.GetComponent <ShaftManager>();

        Inventory _elevator_amount = _elevatorDropOff_Amount.GetComponent <Inventory>();

        UpgradeActorUI _elevatorUpgradeAmount   = _elevatorUpgrade.GetComponent <UpgradeActorUI>();
        Actor          _elevatorSkillMultiplier = _elevator.GetComponent <Actor>();

        UpgradeActorUI _wareHouseAmount          = _warehouseUpgrade.GetComponent <UpgradeActorUI>();
        Actor          _wareHouseSkillMultiplier = _wareHouse.GetComponent <Actor>();

        // we add the _textSplit[0] to the name of the saved value to ensure
        // that the script can be used for saving a lot of mines.
        // Encrypt & Save the total number of current shafts.
        EncryptedPlayerPrefs.SetInt(_textSplit[0] + "NumberOfShafts", +gett.Shafts.Count);

        // Encrypt & Save the totalMoney value.
        EncryptedPlayerPrefs.SetFloat(_textSplit[0] + "TotalMoney", +(float)_totalMoney.totalMoney);

        // Encrypt & Save the Elevator Drop Off Amount.
        EncryptedPlayerPrefs.SetFloat(_textSplit[0] + "ElevatorDropOff_Amount", +_elevator_amount.money);

        // Encrypt & Save the Elevator Upgrade Amount.
        EncryptedPlayerPrefs.SetFloat(_textSplit[0] + "ElevatorUpgradeAmount", +_elevatorUpgradeAmount._price);

        // Encrypt & Save the Elevator Skill Multiplier value.
        EncryptedPlayerPrefs.SetFloat(_textSplit[0] + "ElevatorSkillMultiplier", +_elevatorSkillMultiplier.SkillMultiplier);

        // Encrypt & Save the WareHouse Amount.
        EncryptedPlayerPrefs.SetFloat(_textSplit[0] + "WareHouseAmount", +_wareHouseAmount._price);

        // Encrypt & Save the WareHouse Skill Multiplier value.
        EncryptedPlayerPrefs.SetFloat(_textSplit[0] + "WareHouseSkillMultiplier", +_wareHouseSkillMultiplier.SkillMultiplier);

        // Encrypt & Save the Upgrade Amout, Skill Multiplier & Drop Off Amount
        // for every shaft.
        for (int i = 0; i < gett.Shafts.Count; i++)
        {
            float UpgradeAmount   = gett.Shafts[i].transform.GetChild(3).GetChild(1).GetComponent <UpgradeActorUI>()._price;
            float SkillMultiplier = gett.Shafts[i].transform.GetChild(1).GetComponent <Actor>().SkillMultiplier;
            float DropOff_Amount  = gett.Shafts[i].transform.GetChild(2).GetChild(1).GetComponent <Inventory>().money;

            EncryptedPlayerPrefs.SetFloat(_textSplit[0] + "UpgradeAmount" + i, UpgradeAmount);
            EncryptedPlayerPrefs.SetFloat(_textSplit[0] + "SkillMultiplier" + i, SkillMultiplier);
            EncryptedPlayerPrefs.SetFloat(_textSplit[0] + "DropOff_Amount" + i, DropOff_Amount);
        }

        // When the game is saved, hide the menu & return to game.
        _menuBackground.SetActive(false);
        Time.timeScale = 1.0f;
    }
    /*
     * /// <summary>
     * /// Almacena la informacion del juego
     * /// </summary>
     * public void Save() {
     *  Debug.LogWarning(">>> Almaceno informacion de las preferencias");
     *
     *  // almacenar el tiempo de juego
     *  PlayerPrefs.SetInt("nextTryTime", Interfaz.m_nextTryTime);
     *
     *  // almacenar el avance como portero
     *  PlayerPrefs.SetInt("goalkeeperRecord", Interfaz.m_asKeeper.record);
     *  PlayerPrefs.SetInt("goalkeeperTargets", Interfaz.m_asKeeper.targets);
     *  PlayerPrefs.SetInt("goalkeeperGoals", Interfaz.m_asKeeper.goals);
     *  PlayerPrefs.SetInt("goalkeeperGoalsStopped", Interfaz.m_asKeeper.goalsStopped);
     *  PlayerPrefs.SetInt("goalkeeperThrowOut", Interfaz.m_asKeeper.throwOut);
     *  PlayerPrefs.SetInt("goalkeeperTotalPoints", Interfaz.m_asKeeper.totalPoints);
     *  PlayerPrefs.SetInt("goalkeeperDeflected", Interfaz.m_asKeeper.deflected);
     *  PlayerPrefs.SetInt("goalkeeperPerfects", Interfaz.m_asKeeper.perfects);
     *
     *  // almacenar el avance como lanzador
     *  PlayerPrefs.SetInt("shooterRecord", Interfaz.m_asThrower.record);
     *  PlayerPrefs.SetInt("shooterTargets", Interfaz.m_asThrower.targets);
     *  PlayerPrefs.SetInt("shooterGoals", Interfaz.m_asThrower.goals);
     *  PlayerPrefs.SetInt("shooterGoalsStopped", Interfaz.m_asThrower.goalsStopped);
     *  PlayerPrefs.SetInt("shooterThrowOut", Interfaz.m_asThrower.throwOut);
     *  PlayerPrefs.SetInt("shooterTotalPoints", Interfaz.m_asThrower.totalPoints);
     *  PlayerPrefs.SetInt("shooterDeflected", Interfaz.m_asThrower.deflected);
     *  PlayerPrefs.SetInt("shooterPerfects", Interfaz.m_asThrower.perfects);
     *
     *  // almacenar la ultima mision desbloqueada
     *  PlayerPrefs.SetInt("ultimaMisionDesbloqueada", Interfaz.ultimaMisionDesbloqueada);
     *
     *  PlayerPrefs.Save();
     * }
     */

    public void ActualizarUltimoNivelDesbloqueado(int _nivel)
    {
        int lastSaved = EncryptedPlayerPrefs.GetInt("ultimaMisionDesbloqueada", 0);

        if (_nivel > lastSaved)
        {
            Interfaz.ultimaMisionDesbloqueada = _nivel;
            EncryptedPlayerPrefs.SetInt("ultimaMisionDesbloqueada", _nivel);
            PlayerPrefs.Save();
        }
    }
Esempio n. 7
0
    public void SaveScore()
    {
        int highS = EncryptedPlayerPrefs.GetInt("highScoore");

        if (EncryptedPlayerPrefs.CheckEncryption("highScoore", "int", highS.ToString()) || highS == 0)
        {
            if (highS < score)
            {
                EncryptedPlayerPrefs.SetInt("highScoore", (int)score);
                MainMenu.Instance.SetHighScore(highS);
            }
        }
    }
Esempio n. 8
0
 public void save()
 {
     foreach (GameObject item in _Objects)
     {
         //Sauvegarde de Couleur RGBA de chaque objet 3D
         //Sauvegarde de la texture sélectionné de chaque objet 3D
         EncryptedPlayerPrefs.SetFloat(item.name + "R", +item.gameObject.GetComponent <Renderer>().material.color.r);
         EncryptedPlayerPrefs.SetFloat(item.name + "G", +item.gameObject.GetComponent <Renderer>().material.color.g);
         EncryptedPlayerPrefs.SetFloat(item.name + "B", +item.gameObject.GetComponent <Renderer>().material.color.b);
         EncryptedPlayerPrefs.SetFloat(item.name + "A", +item.gameObject.GetComponent <Renderer>().material.color.a);
         EncryptedPlayerPrefs.SetInt(item.name + "Texture", +item.gameObject.GetComponent <Highlight>()._idTexture);
         GameObject.Find("Selectionner").GetComponent <Text>().text = "Sauvegarde réussie";
     }
 }
Esempio n. 9
0
 public void SuccessfulPurchase(StoreKitTransaction transaction)
 {
     if (transaction.productIdentifier == "eu.machten.Bee.extralives")
     {
         EncryptedPlayerPrefs.SetInt("xtralives", 1);
     }
     else if (transaction.productIdentifier == "eu.machten.Bee.10extralives")
     {
         EncryptedPlayerPrefs.SetInt("10xtralives", 1);
     }
     else if (transaction.productIdentifier == "eu.machten.Bee.removeads")
     {
         EncryptedPlayerPrefs.SetInt("removeadverts", 1);
         showAds = false;
         AdBinding.destroyAdBanner();
     }
 }
Esempio n. 10
0
 public void SendRecord(int newRecord, bool withFriends, System.Action <JSONObject> onComplete)
 {
     if (newRecord > _currentRecord)
     {
         _currentRecord = newRecord;
         EncryptedPlayerPrefs.SetInt(TicketsRecordKey, _currentRecord);
         if (!HandleUnsetToken(onComplete))
         {
             return;
         }
         POST("event/unlock", new Dictionary <String, String> {
             { "eventName", withFriends ? "friendsRecord" : "ticketRecord" },
             { "intParameter", newRecord.ToString() },
             { "token", _token }
         }, onComplete);
     }
 }
    void Start()
    {
        // this array should be filled before you can use EncryptedPlayerPrefs :

        EncryptedPlayerPrefs.keys = new string[5];

        EncryptedPlayerPrefs.keys[0] = "23Wrudre";
        EncryptedPlayerPrefs.keys[1] = "SP9DupHa";
        EncryptedPlayerPrefs.keys[2] = "frA5rAS3";
        EncryptedPlayerPrefs.keys[3] = "tHat2epr";
        EncryptedPlayerPrefs.keys[4] = "jaw3eDAs";


        EncryptedPlayerPrefs.SetInt("test_int", 130);
        int a = EncryptedPlayerPrefs.GetInt("test_int");

        Debug.Log(a);
    }
    public void GuardarPartidaMultiPlayer(bool _ganador, bool _perfect)
    {
        EncryptedPlayerPrefs.SetInt("duelsPlayed", PlayerPrefs.GetInt("duelsPlayed", 0) + 1);
        Interfaz.m_duelsPlayed++;
        if (_ganador)
        {
            EncryptedPlayerPrefs.SetInt("duelsWon", PlayerPrefs.GetInt("duelsWon", 0) + 1);
            Interfaz.m_duelsWon++;
        }

        if (_perfect)
        {
            EncryptedPlayerPrefs.SetInt("perfectDuels", PlayerPrefs.GetInt("perfectDuels", 0) + 1);
            Interfaz.m_perfectDuels++;
        }

        // guardar las preferencias
        PlayerPrefs.Save();
    }
Esempio n. 13
0
    private void Awake()
    {
        Screen.SetResolution(1920, 1080, true, 0);
        EncryptedPlayerPrefs.keys    = new string[5];
        EncryptedPlayerPrefs.keys[0] = "fgfkjldjds";
        EncryptedPlayerPrefs.keys[1] = "tu849tu24";
        EncryptedPlayerPrefs.keys[2] = "40kf0rk";
        EncryptedPlayerPrefs.keys[3] = "jg05ji";
        EncryptedPlayerPrefs.keys[4] = "erjeioj";

        if (!EncryptedPlayerPrefs.HasKey("Ending1"))
        {
            for (int i = 1; i <= 20; i++)
            {
                EncryptedPlayerPrefs.SetInt("Ending" + i, 0);
                EncryptedPlayerPrefs.SaveEncryption("Ending" + i, "int", "littlebrother");
            }
        }
    }
Esempio n. 14
0
    //public static Vector2[] Plot(Rigidbody2D rigidbody, Vector2 pos, Vector2 velocity, int steps)
    //{
    //    Vector2[] results = new Vector2[steps];

    //    float timestep = Time.fixedDeltaTime / Physics2D.velocityIterations;
    //    Vector2 gravityAccel = Physics2D.gravity * rigidbody.gravityScale * timestep * timestep;
    //    float drag = 1f - timestep * rigidbody.drag;
    //    Vector2 moveStep = velocity * timestep;

    //    for (int i = 0; i < steps; ++i)
    //    {
    //        moveStep += gravityAccel;
    //        moveStep *= drag;
    //        pos += moveStep;
    //        results[i] = pos;
    //    }

    //    return results;
    //}

    //public void PlotProjectileTrajectory(Rigidbody2D rigidbody, Vector2 initialPos, Vector2 force)
    //{
    //    Vector2[] results = Plot(rigidbody, initialPos, force, 10);

    //    for (int i = 0; i < results.Length; i++)
    //    {
    //        Vector3 pos = new Vector3(results[i].x, results[i].y, 0);
    //        GameObject trailObject = _trailObjects[i];
    //        trailObject.SetActive(true);
    //        trailObject.transform.position = pos;
    //    }
    //}

    //public void HideTrajectoryPlot() {
    //    for (int i = 0; i < _trailLength; i++) {
    //        _trailObjects[i].SetActive(false);
    //    }
    //}
    #endregion

    public void OnFullTrajectoryPurchased()
    {
        _hasFullTrajectory = true;
        EncryptedPlayerPrefs.SetInt(FULL_TRAJECTORY_KEY, 1);
        PlayerPrefs.Save();
    }
    public void AcumularRondaMision(Result _result, bool _perfect, int _points, bool _guardarProgresoMision)
    {
        bool goalkeeper = GameplayService.initialGameMode == GameMode.GoalKeeper;

        if (!goalkeeper)
        {
            int record = EncryptedPlayerPrefs.GetInt("shooterRecord", 0);
            if (record < RoundInfoManager.instance.puntos)
            {
                EncryptedPlayerPrefs.SetInt("shooterRecord", RoundInfoManager.instance.puntos);
                Interfaz.m_asThrower.record = RoundInfoManager.instance.puntos;
            }

            if (_points > 0)
            {
                EncryptedPlayerPrefs.SetInt("shooterTotalPoints", PlayerPrefs.GetInt("shooterTotalPoints", 0) + _points);
                Interfaz.m_asThrower.totalPoints += _points;
            }

            if (_perfect)
            {
                EncryptedPlayerPrefs.SetInt("shooterPerfects", PlayerPrefs.GetInt("shooterPerfects", 0) + 1);
                Interfaz.m_asThrower.perfects++;
            }

            switch (_result)
            {
            case Result.Saved:
                EncryptedPlayerPrefs.SetInt("shooterGoalsStopped", EncryptedPlayerPrefs.GetInt("shooterGoalsStopped", 0) + 1); Interfaz.m_asThrower.goalsStopped++; break;

            case Result.Stopped:
                EncryptedPlayerPrefs.SetInt("shooterDeflected", EncryptedPlayerPrefs.GetInt("shooterDeflected", 0) + 1); Interfaz.m_asThrower.deflected++; break;

            case Result.Goal:
                EncryptedPlayerPrefs.SetInt("shooterGoals", EncryptedPlayerPrefs.GetInt("shooterGoals", 0) + 1); Interfaz.m_asThrower.goals++; break;

            case Result.OutOfBounds:
                EncryptedPlayerPrefs.SetInt("shooterThrowOut", EncryptedPlayerPrefs.GetInt("shooterThrowOut", 0) + 1); Interfaz.m_asThrower.throwOut++; break;

            case Result.Target:
                EncryptedPlayerPrefs.SetInt("shooterTargets", EncryptedPlayerPrefs.GetInt("shooterTargets", 0) + 1); Interfaz.m_asThrower.targets++; break;
            }
        }
        else
        {
            int record = EncryptedPlayerPrefs.GetInt("goalkeeperRecord", 0);
            if (record < RoundInfoManager.instance.puntos)
            {
                EncryptedPlayerPrefs.SetInt("goalkeeperRecord", RoundInfoManager.instance.puntos);
                Interfaz.m_asKeeper.record = RoundInfoManager.instance.puntos;
            }

            if (_points > 0)
            {
                EncryptedPlayerPrefs.SetInt("goalkeeperTotalPoints", EncryptedPlayerPrefs.GetInt("goalkeeperTotalPoints", 0) + _points);
                Interfaz.m_asKeeper.totalPoints += _points;
            }

            if (_perfect)
            {
                EncryptedPlayerPrefs.SetInt("goalkeeperPerfects", EncryptedPlayerPrefs.GetInt("goalkeeperPerfects", 0) + 1);
                Interfaz.m_asKeeper.perfects++;
            }

            switch (_result)
            {
            case Result.Saved:
                EncryptedPlayerPrefs.SetInt("goalkeeperGoalsStopped", EncryptedPlayerPrefs.GetInt("goalkeeperGoalsStopped", 0) + 1); Interfaz.m_asKeeper.goalsStopped++; break;

            case Result.Stopped:
                EncryptedPlayerPrefs.SetInt("goalkeeperDeflected", EncryptedPlayerPrefs.GetInt("goalkeeperDeflected", 0) + 1); Interfaz.m_asKeeper.deflected++; break;

            case Result.Goal:
                EncryptedPlayerPrefs.SetInt("goalkeeperGoals", EncryptedPlayerPrefs.GetInt("goalkeeperGoals", 0) + 1); Interfaz.m_asKeeper.goals++; break;

            case Result.OutOfBounds:
                EncryptedPlayerPrefs.SetInt("goalkeeperThrowOut", EncryptedPlayerPrefs.GetInt("goalkeeperThrowOut", 0) + 1); Interfaz.m_asKeeper.throwOut++; break;

            case Result.Target:
                EncryptedPlayerPrefs.SetInt("goalkeeperTargets", EncryptedPlayerPrefs.GetInt("goalkeeperTargets", 0) + RoundInfoManager.instance.numTargets); Interfaz.m_asKeeper.targets++; break;
            }
        }

        if (_guardarProgresoMision)
        {
            MissionAchievement[] retosActuales = MissionManager.instance.GetMission().Achievements.ToArray();
            string claveNivel     = "prog" + GameplayService.gameLevelMission.MissionName;
            int    bitMapProgreso = EncryptedPlayerPrefs.GetInt(claveNivel, 0);

            for (int i = 0; i < retosActuales.Length; i++)
            {
                int flag = (bitMapProgreso % ((int)Mathf.Pow(10, i + 1))) / (int)Mathf.Pow(10, i);
                if ((flag == 0) && retosActuales[i].IsAchieved())
                {
                    bitMapProgreso += (int)Mathf.Pow(10, retosActuales[i].Code);
                }
            }
            EncryptedPlayerPrefs.SetInt(claveNivel, bitMapProgreso);
        }

        PlayerPrefs.Save();
    }
 public void SaveHardMoney()
 {
     EncryptedPlayerPrefs.SetInt("hardCurrency", Interfaz.MonedasHard);
     PlayerPrefs.Save();
 }
 public void SaveMoney()
 {
     EncryptedPlayerPrefs.SetInt("softCurrency", Interfaz.MonedasSoft);
     PlayerPrefs.Save();
 }
Esempio n. 18
0
 public void SaveGame(string key, int value)
 {
     EncryptedPlayerPrefs.SetInt(key, value);
 }