public void Prepare(Mission mission, Dictionary <ScoreType, Result> actualResults)
    {
        Mission = mission;
        //you can only repeat specified missions (i have no time to do backend search for last random mission)
        ButtonRepeat.SetActive(mission.MissionType == MissionType.Specified);
        //GetComponent<ButtonsInCloud>().ButtonTopText = mission.MissionType == MissionType.Random?"Quick Mission":"Next mission";
        ActualResults = actualResults;
        TextLeaderboardNames.GetComponent <Text>().text  = "";
        TextLeaderboardScores.GetComponent <Text>().text = "";

        YourScore = new LevelScore();
        YourScore.AddInfo(Game.Me.UserName, (int)actualResults[ScoreType.Interventions].Value, WebConnector.GetDeviceId(), actualResults[ScoreType.Time].Value, -1);
        LevelScore yourPrevious = mission.YourBest;

        TextYourScore.GetComponent <Text>().text = YourScore.Interventions + " interv, " + (YourScore.Time.ToString("##.##")) + " seconds";

        int   interventionDelta = yourPrevious.Interventions - YourScore.Interventions;
        float timeDelta         = yourPrevious.Time - YourScore.Time;

        if (yourPrevious.Interventions == 0 || YourScore.Interventions < yourPrevious.Interventions || (YourScore.Interventions == yourPrevious.Interventions && YourScore.Time < yourPrevious.Time))
        {
            TextYourScore.GetComponent <Text>().text += "\n (YOUR RECORD";
            if (yourPrevious.Interventions == 0)
            {
                TextYourScore.GetComponent <Text>().text += ", first try";
            }
            else
            {
                if (interventionDelta > 0)
                {
                    TextYourScore.GetComponent <Text>().text += " by " + interventionDelta + " interv";
                }
                else
                {
                    TextYourScore.GetComponent <Text>().text += " by " + timeDelta.ToString("##.##") + " seconds";
                }
            }
            TextYourScore.GetComponent <Text>().text += ")";
        }
        else
        {
            TextYourScore.GetComponent <Text>().text += "\n WORSE THAN YOUR RECORD BY ";
            if (interventionDelta < 0)
            {
                TextYourScore.GetComponent <Text>().text += -interventionDelta + " interv";
            }
            else
            {
                TextYourScore.GetComponent <Text>().text += (-timeDelta).ToString("##.##") + " seconds";
            }
        }

        TextLeaderboardNames.GetComponent <Text>().text  = "Loading";
        TextLeaderboardScores.GetComponent <Text>().text = "scores";
        ImageYellowStraw.SetActive(false);
        UpdateText(Mission.BestScores);
    }
    private List <LevelScore> ParseScores(JSONNode resultsJson)
    {
        List <LevelScore> tmp = new List <LevelScore>();

        foreach (JSONNode rJson in resultsJson.Childs)
        {
            LevelScore ls = new LevelScore();
            if (rJson["deviceId"] != null)
            {
                ls.AddInfo(rJson["name"].Value, rJson["interventions"].AsInt, rJson["deviceId"].Value, rJson["time"].AsInt / 1000f, rJson["place"].AsInt);
            }
            tmp.Add(ls);
        }

        return(tmp);
    }
    private List <LevelScore> ParseScores(JSONNode n)
    {
        List <LevelScore> scores = new List <LevelScore>();


        int i = 1;

        foreach (JSONNode tile in n.Childs)
        {
            LevelScore ls = new LevelScore();
            if (tile["deviceId"] != null)
            {
                string name     = tile["name"];
                int    interv   = tile["interventions"].AsInt;
                float  time     = tile["time"].AsInt / 1000f;
                string deviceId = tile["deviceId"];
                int    place    = tile["place"].AsInt;
                ls.AddInfo(name, interv, deviceId, time, place);
            }
            scores.Add(ls);
        }
        return(scores);
    }