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);
    }
    /// <summary>
    /// Almacena el numero de escudos que ha adquirido actualmente el usuario en las preferencias
    /// </summary>
    public void SaveEscudos()
    {
        Debug.Log(">>> GUARDAR ESCUDOS");

        // almacenar los escudos
        string strEscudos = "";

        for (int i = 0; i < EscudosManager.instance.GetNumEscudos(); ++i)
        {
            Escudo escudo = EscudosManager.instance.GetEscudo(i);
            if (escudo != null && escudo.numUnidades > 0)
            {
                // añadir el separador antes del id de la equipacion
                if (strEscudos != "")
                {
                    strEscudos += separadores[0];
                }

                strEscudos += escudo.id + separadoresIgual[0] + escudo.numUnidades;
            }
        }
        EncryptedPlayerPrefs.SetString("escudos", strEscudos);

        PlayerPrefs.Save();
    }
示例#3
0
    public void SetPlayerScores()
    {
        string value     = "{" + SystemInfo.deviceUniqueIdentifier + delimeter + levelMaximum + "}";
        string encrypted = EncryptedPlayerPrefs.SetString("USER", value);

        PlayerPrefs.Save();
        StartCoroutine(DBSetScores(encrypted));
    }
示例#4
0
    public static void Save(string saveKey, object saveObject, bool encrypted = true)
    {
        var aString = JsonUtility.ToJson(saveObject);

        if (encrypted)
        {
            EncryptedPlayerPrefs.SetString(saveKey, aString);
        }
        else
        {
            PlayerPrefs.SetString(saveKey, aString);
        }
    }
示例#5
0
        IEnumerator GetAccessToken(string oauth_verifier)
        {
            // header
            oauth_handler_.Clear();
            oauth_handler_.AddParameter("oauth_token", request_token_);
            oauth_handler_.AddParameter("oauth_verifier", oauth_verifier);

            var headers = new Dictionary <string, string>();

            headers["Authorization"] = oauth_handler_.GenerateHeader(kAccessUrl, "POST");

            WWW web = new WWW(kAccessUrl, null, headers);

            yield return(web);

            if (!string.IsNullOrEmpty(web.error))
            {
                Debug.Log(string.Format("GetAccessToken - failed. {0}, {1}", web.error, web.text));
                OnEventNotify(SNResultCode.kLoginFailed);
            }
            else
            {
                my_info_.id   = Regex.Match(web.text, @"user_id=([^&]+)").Groups[1].Value;
                my_info_.name = Regex.Match(web.text, @"screen_name=([^&]+)").Groups[1].Value;
                string token  = Regex.Match(web.text, @"oauth_token=([^&]+)").Groups[1].Value;
                string secret = Regex.Match(web.text, @"oauth_token_secret=([^&]+)").Groups[1].Value;

                if (!string.IsNullOrEmpty(token) && !string.IsNullOrEmpty(secret) &&
                    !string.IsNullOrEmpty(my_info_.id) && !string.IsNullOrEmpty(my_info_.name))
                {
                    Debug.Log("GetAccessToken - succeeded.");
                    Debug.Log(string.Format("id: {0}\nname: {1}\ntoken: {2}\ntoken_secret: {3}",
                                            my_info_.id, my_info_.name, token, secret));

                    oauth_handler_.AddParameter("oauth_token", token);
                    oauth_handler_.AddParameter("oauth_token_secret", secret);

                    EncryptedPlayerPrefs.SetString("user_id", my_info_.id);
                    EncryptedPlayerPrefs.SetString("screen_name", my_info_.name);
                    EncryptedPlayerPrefs.SetString("oauth_token", token);
                    EncryptedPlayerPrefs.SetString("oauth_token_secret", secret);

                    OnEventNotify(SNResultCode.kLoggedIn);
                }
                else
                {
                    Debug.Log("GetAccessToken - failed. " + web.text);
                    OnEventNotify(SNResultCode.kLoginFailed);
                }
            }
        }
    public void InitTest()
    {
        EncryptedPlayerPrefs.DeleteKey("DataExist");
        EncryptedPlayerPrefs.DeleteKey("Strength");
        EncryptedPlayerPrefs.DeleteKey("Agility");
        EncryptedPlayerPrefs.DeleteKey("Constitution");
        EncryptedPlayerPrefs.DeleteKey("Intelligence");
        EncryptedPlayerPrefs.DeleteKey("RemainPoint");
        EncryptedPlayerPrefs.DeleteKey("CurrentADLevel");
        EncryptedPlayerPrefs.DeleteKey("CurrentHealthLevel");
        EncryptedPlayerPrefs.DeleteKey("CurrentDefenseLevel");
        EncryptedPlayerPrefs.DeleteKey("CurrentSlot");
        EncryptedPlayerPrefs.DeleteKey("Gold");
        EncryptedPlayerPrefs.DeleteKey("Silver");

        for (int i = 0; i < 15; i++)
        {
            EncryptedPlayerPrefs.DeleteKey("ItemSlot" + i);
        }

        for (int i = 0; i < 7; i++)
        {
            EncryptedPlayerPrefs.DeleteKey("EquipSlot" + i);
        }

        for (int i = 0; i < 5; i++)
        {
            EncryptedPlayerPrefs.DeleteKey("TowerType" + i);
        }

        EncryptedPlayerPrefs.DeleteKey("MaxClearStage");
        for (int i = 0; i < userInfo.stageClearInfo.Length; i++)
        {
            EncryptedPlayerPrefs.DeleteKey("StageClearInfo" + i);
        }

        EncryptedPlayerPrefs.DeleteKey("PicturePath");


        EncryptedPlayerPrefs.SetString("EquipSlot" + 0, "JACK1");
        EncryptedPlayerPrefs.SetString("ItemSlot" + 0, "HAND1-1");

        EncryptedPlayerPrefs.DeleteKey("killEnemyCount");
        EncryptedPlayerPrefs.DeleteKey("stageClearCount");
    }
    /// <summary>
    /// Almacena las preferencias el numero de power ups que ha adquirido actualmente el usuario
    /// </summary>
    public void SavePowerUps()
    {
        Debug.Log(">>> GUARDAR POWER_UPS");

        // almacenar los power ups de Lanzador
        string strPowerUpsLanzador = "";

        for (int i = 0; i < PowerupInventory.descriptoresLanzador.Length; ++i)
        {
            int cantidad = PowerupService.ownInventory.GetCantidadPowerUp(PowerupInventory.descriptoresLanzador[i].idWs);
            if (cantidad > 0)
            {
                // añadir separador antes del powerup
                if (strPowerUpsLanzador != "")
                {
                    strPowerUpsLanzador += " |";
                }

                strPowerUpsLanzador += PowerupInventory.descriptoresLanzador[i].idWs + separadoresIgual[0] + cantidad.ToString();
            }
        }
        EncryptedPlayerPrefs.SetString("pwrUpsLanzador", strPowerUpsLanzador);

        // almacenar los power ups de Portero
        string strPowerUpsPortero = "";

        for (int i = 0; i < PowerupInventory.descriptoresPortero.Length; ++i)
        {
            int cantidad = PowerupService.ownInventory.GetCantidadPowerUp(PowerupInventory.descriptoresPortero[i].idWs);
            if (cantidad > 0)
            {
                // añadir separador antes del powerup
                if (strPowerUpsPortero != "")
                {
                    strPowerUpsPortero += " |";
                }

                strPowerUpsPortero += PowerupInventory.descriptoresPortero[i].idWs + separadoresIgual[0] + cantidad.ToString();
            }
        }
        EncryptedPlayerPrefs.SetString("pwrUpsPortero", strPowerUpsPortero);

        PlayerPrefs.Save();
    }
    /// <summary>
    /// Almacena las equipaciones adquiridas actualmente en las preferencias
    /// </summary>
    public void SaveEquipacionesCompradas()
    {
        Debug.Log(">>> GUARDAR EQUIPACIONES");

        // almacenar las equipaciones de lanzador compradas
        string strEquipacionesLanzadorCompradas = "";

        for (int i = 0; i < EquipacionManager.instance.numEquipacionesLanzador; ++i)
        {
            Equipacion equipacion = EquipacionManager.instance.GetEquipacionLanzador(i);
            if (equipacion != null && equipacion.estado == Equipacion.Estado.ADQUIRIDA)
            {
                // añadir el separador antes del id de la equipacion
                if (strEquipacionesLanzadorCompradas != "")
                {
                    strEquipacionesLanzadorCompradas += separadores[0];
                }

                strEquipacionesLanzadorCompradas += equipacion.assetName;
            }
        }
        EncryptedPlayerPrefs.SetString("shooterEquipaciones", strEquipacionesLanzadorCompradas);

        // almacenar las equipaciones de portero compradas
        string strEquipacionesPorteroCompradas = "";

        for (int i = 0; i < EquipacionManager.instance.numEquipacionesPortero; ++i)
        {
            Equipacion equipacion = EquipacionManager.instance.GetEquipacionPortero(i);
            if (equipacion != null && equipacion.estado == Equipacion.Estado.ADQUIRIDA)
            {
                // añadir el separador antes del id de la equipacion
                if (strEquipacionesPorteroCompradas != "")
                {
                    strEquipacionesPorteroCompradas += separadores[0];
                }

                strEquipacionesPorteroCompradas += equipacion.assetName;
            }
        }
        EncryptedPlayerPrefs.SetString("goalkeeperEquipaciones", strEquipacionesPorteroCompradas);

        PlayerPrefs.Save();
    }
    /// <summary>
    /// Almacena los jugadores adquiridos actualmente en las preferencias
    /// </summary>
    public void SaveJugadoresComprados()
    {
        Debug.Log(">>> GUARDAR JUGADORES");

        // almacenar los lanzadores comprados
        string strLanzadoresComprados = "";

        for (int i = 0; i < InfoJugadores.instance.numLanzadores; ++i)
        {
            Jugador jugador = InfoJugadores.instance.GetTirador(i);
            if (jugador != null && jugador.estado == Jugador.Estado.ADQUIRIDO)
            {
                // añadir el separador antes del id del jugador
                if (strLanzadoresComprados != "")
                {
                    strLanzadoresComprados += separadores[0];
                }

                strLanzadoresComprados += jugador.assetName;
            }
        }
        EncryptedPlayerPrefs.SetString("shootersComprados", strLanzadoresComprados);

        // almacenar los porteros comprados
        string strPorterosComprados = "";

        for (int i = 0; i < InfoJugadores.instance.numPorteros; ++i)
        {
            Jugador jugador = InfoJugadores.instance.GetPortero(i);
            if (jugador != null && jugador.estado == Jugador.Estado.ADQUIRIDO)
            {
                // añadir el separador antes del id del jugador
                if (strPorterosComprados != "")
                {
                    strPorterosComprados += separadores[0];
                }

                strPorterosComprados += jugador.assetName;
            }
        }
        EncryptedPlayerPrefs.SetString("goalkeepersComprados", strPorterosComprados);

        PlayerPrefs.Save();
    }
    /// <summary>
    /// Crea las claves en las playerprefs de una determinada lista de logros ( lista para guardar cuando se haga un playerPrefs.save() )
    /// </summary>
    /// <param name="_listaLogros"></param>
    /// <param name="_playerPrefsKey"></param>
    private void CreateListaLogrosPlayerPrefs(List <GrupoLogros> _listaLogros, string _playerPrefsKey)
    {
        string strLogros = "";

        if (_listaLogros != null)
        {
            foreach (GrupoLogros grupoLogros in _listaLogros)
            {
                // añadir un separador si procede
                if (strLogros != "")
                {
                    strLogros += separadores[0];
                }

                strLogros += grupoLogros.prefijoComunIdLogros + "=" + grupoLogros.nivelAlcanzado;
            }
        }
        EncryptedPlayerPrefs.SetString(_playerPrefsKey, strLogros);
    }
 public void SaveAlias(string alias)
 {
     EncryptedPlayerPrefs.SetString("alias", alias);
     PlayerPrefs.Save();
     Interfaz.m_uname = alias;
 }
示例#12
0
文件: Client.cs 项目: Syjgin/zerotram
 public void UpdateToken(string newToken)
 {
     _token = newToken;
     EncryptedPlayerPrefs.SetString(SavedTokenString, newToken);
 }
示例#13
0
文件: Client.cs 项目: Syjgin/zerotram
 private void SetUserid(string newid)
 {
     _userId = newid;
     EncryptedPlayerPrefs.SetString(SavedUseridString, newid);
 }