DataToDeaths() public static method

public static DataToDeaths ( string data ) : int
data string
return int
Ejemplo n.º 1
0
    void OnReceivedData(string data)
    {
        if (player.GetKills() <= lastKills && player.GetDeaths() <= lastDeaths)
        {
            return;
        }

        int killsSince  = player.GetKills() - lastKills;
        int deathsSince = player.GetDeaths() - lastDeaths;

        if (killsSince == 0 && deathsSince == 0)
        {
            return;
        }

        int kills  = DataTranslator.DataToKills(data);
        int deaths = DataTranslator.DataToDeaths(data);

        int newKills  = killsSince + kills;
        int newDeaths = deathsSince + deaths;

        string newData = DataTranslator.ValueToData(newKills, newDeaths);

        //Debug.Log("Syncing: " + newData);

        lastKills  = player.GetKills();
        lastDeaths = player.GetDeaths();

        UserAccountManager.instance.SendData(newData);
    }
Ejemplo n.º 2
0
    void OnDataReceived(string data)
    {
        if (player.kills <= lastKills && player.deaths <= lastDeaths)
        {
            return;
        }

        int killsSinceLast  = player.kills - lastKills;
        int deathsSinceLast = player.deaths - lastDeaths;

        int kills  = DataTranslator.DataToKills(data);
        int deaths = DataTranslator.DataToDeaths(data);

        int newKills  = killsSinceLast + kills;
        int newDeaths = deathsSinceLast + deaths;

        string newData = DataTranslator.ValuesToData(newKills, newDeaths);

        Debug.Log("Syncing: " + newData);

        lastKills  = player.kills;
        lastDeaths = player.deaths;

        UserAcountManager.instance.LoggedIn_SaveDataButtonPressed(newData);
    }
Ejemplo n.º 3
0
    private void OnDataReceived(string data)
    {
        if (player.kills <= lastKills && player.deaths <= lastDeaths)
        {
            return;
        }

        int killsSinceLastSync  = player.kills - lastKills;
        int deathsSinceLastSync = player.deaths - lastDeaths;

        int kills  = DataTranslator.DataToKills(data);
        int deaths = DataTranslator.DataToDeaths(data);

        int newKills  = killsSinceLastSync + kills;
        int newDeaths = deathsSinceLastSync + deaths;

        string newData = DataTranslator.ValuesToData(newKills, newDeaths);

        Debug.Log("Syncig: " + newData);

        lastKills  = player.kills;
        lastDeaths = player.deaths;

        UserAccountManager.instance.SendData(newData);
    }
Ejemplo n.º 4
0
    void OnDataRecieved(string data)
    {
        if (player.kills <= lastKills && player.deaths <= lastDeaths)
        {
            return;
        }

        int killsSinceLast  = player.kills - lastKills;
        int deathsSinceLast = player.deaths - lastDeaths;

        // Replaced by code on line 49
        //if (killsSinceLast == 0 && deathsSinceLast == 0)
        //{
        //    return;
        //}

        int kills  = DataTranslator.DataToKills(data);
        int deaths = DataTranslator.DataToDeaths(data);

        int newKills  = killsSinceLast + kills;
        int newDeaths = deathsSinceLast + deaths;

        string newData = DataTranslator.ValuesToData(newKills, newDeaths);

        Debug.Log("Syncing: " + newData);

        lastKills  = player.kills;
        lastDeaths = player.deaths;

        UserAccountManager.instance.SendData(newData);
    }
Ejemplo n.º 5
0
    void OnDataReceived(string _data)
    {
        if (player.kills <= lastKills && player.deaths <= lastDeaths)
        {
            return;
        }

        int killsSinceLast  = player.kills - lastKills;
        int deathsSinceLast = player.deaths - lastDeaths;

        if (killsSinceLast == 0 && deathsSinceLast == 0)
        {
            return;
        }

        int _kills  = DataTranslator.DataToKills(_data);
        int _deaths = DataTranslator.DataToDeaths(_data);

        int _newKills  = killsSinceLast + _kills;
        int _newDeaths = deathsSinceLast + _deaths;

        string _newData = DataTranslator.ValuesToData(_newKills, _newDeaths);

        Debug.Log("Syncing: " + _newData);

        lastKills  = player.kills;
        lastDeaths = player.deaths;

        UserAccountManager.instance.SendData(_newData);
    }
Ejemplo n.º 6
0
    void OnDataReceived(string data)
    {
        if (player.kills <= lastKills && player.deaths <= lastDeaths)
        {
            return;
        }
        int killsSinceLast  = player.kills - lastKills;
        int deathsSinceLast = player.deaths - lastDeaths;

        int kills  = DataTranslator.DataToKills(data);
        int deaths = DataTranslator.DataToDeaths(data);

        //for new kills and deaths
        int newKills  = killsSinceLast + kills;
        int newDeaths = deathsSinceLast + deaths;

        string newData = DataTranslator.ValuesToData(newKills, newDeaths);//storages newkills, newdata in string called newData

        //to be sent to valuestodata

        Debug.Log("Syncing: " + newData);

        //To update kills and deaths variables
        lastKills  = player.kills;
        lastDeaths = player.deaths;

        UserAccountManager.instance.SendData(newData);//sends updated info to valuestodata method inside datatranslator to transform it to
        //data format by using senddata method inside useraccountmanager
    }
Ejemplo n.º 7
0
    void OnDataReceived(string data)
    {
        //if (killCount == null || deathCount == null)
        //    return;

        killCount.text  = DataTranslator.DataToKills(data).ToString() + " KILLS";
        deathCount.text = DataTranslator.DataToDeaths(data).ToString() + " DEATHS";
    }
Ejemplo n.º 8
0
 void OnReceivedData(string data)
 {
     if (killCount == null || deathCount == null)
     {
         return;
     }
     killCount.text  = DataTranslator.DataToKills(data).ToString() + " KILLS";
     deathCount.text = DataTranslator.DataToDeaths(data).ToString() + " DEATHS";
 }
Ejemplo n.º 9
0
    void OnReceivedData(string data)    //This is added as a function because it takes time to receive info from the server
    {
        if (killCount == null || deathCount == null)
        {
            return;
        }

        killCount.text  = DataTranslator.DataToKills(data).ToString() + " Kills";   //Calls datatokills function in datatranslator and sends data in form of string
        deathCount.text = DataTranslator.DataToDeaths(data).ToString() + " Deaths"; //Calls datatodeaths function in datatranslator and sends data in form of string
    }
Ejemplo n.º 10
0
    void OnReceivedData(string data)
    {
        //Debug.Log(data);

        if (killCount == null || deathCount == null)
        {
            return;
        }

        killCount.text  = DataTranslator.DataToKills(data).ToString() + " Kills";
        deathCount.text = DataTranslator.DataToDeaths(data).ToString() + " Deaths";
    }
Ejemplo n.º 11
0
    void OnDataRecieved(string data)
    {
        if (player.kills == 0 && player.deaths == 0)
        {
            return;
        }

        int kills  = DataTranslator.DataToKills(data);
        int deaths = DataTranslator.DataToDeaths(data);

        int newKills  = player.kills + kills;
        int newDeaths = player.deaths + deaths;

        string newData = DataTranslator.ValuesToData(newKills, newDeaths);

        Debug.Log("Syncing:" + newData);

        UserAccountManager.instance.SendUserData(newData);

        player.kills  = 0;
        player.deaths = 0;
    }
Ejemplo n.º 12
0
    void OnDataReceived(string data)
    {
        if (player.kills > lastKills && player.kills > lastDeath)
            return;

        int killsSinceLast = player.kills - lastKills;
        int deathsSinceLast = player.deaths - lastDeath;

        int kills = DataTranslator.DataToKills(data);
        int deaths = DataTranslator.DataToDeaths(data);

        int newKills = killsSinceLast + kills;
        int newDeath = deathsSinceLast + deaths;

        string newData = DataTranslator.ValuesToData(newKills, newDeath);

        Debug.Log("Syncing " + newData);

        lastKills = player.kills;
        lastDeath = player.deaths;

        UserAccountManager.instance.SendData(newData);
    }
Ejemplo n.º 13
0
    void OnDataReceived(string data)
    {
        if (player.Kills <= lastKills && player.Deaths <= lastDeaths)
        {
            return;
        }

        int killsSinceLast  = player.Kills - lastKills;
        int deathsSinceLast = player.Deaths - lastDeaths;

        int kills  = DataTranslator.DataToKills(data);
        int deaths = DataTranslator.DataToDeaths(data);

        int newKills  = killsSinceLast + kills;
        int newDeaths = deathsSinceLast + deaths;

        lastKills  = player.Kills;
        lastDeaths = player.Deaths;

        string newData = DataTranslator.ValueToData(newKills, newDeaths);

        Debug.Log("Syncing " + newData);
        UserAccountManager.instance.SaveorSetData(newData);
    }
 void OnReceivedData(string data)
 {
     killCount.text  = DataTranslator.DataToKills(data).ToString() + " KILLS";
     deathCount.text = DataTranslator.DataToDeaths(data).ToString() + " DEATHS";
 }