Beispiel #1
0
    void OnDataReceived(string data)
    {
        if (player.kills <= lastKills && player.deaths <= lastDeaths)
        {
            return;
        }

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


        int syncedKills  = DataParser.DataToKills(data);
        int syncedDeaths = DataParser.DataToDeaths(data);

        int newKills  = killsSinceLast + syncedKills;
        int newDeaths = deathsSinceLast + syncedDeaths;

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

        Debug.Log("Syncing: " + newData);
        UserAccountManager.instance.SendData(newData);

        lastKills  = player.kills;
        lastDeaths = player.deaths;
    }
Beispiel #2
0
    void OnRecievedData(string data)
    {
        if (KD == null)
        {
            return;
        }

        KD.text = DataParser.DataToKills(data) + "/" + DataParser.DataToDeaths(data);
    }