Пример #1
0
 public Quest()
 {
     timeLength      = -1;
     geolocalisation = new Coordinates();
     statistics      = new QuestStatistics(this);
     checkpoints     = new List <CheckPoint>();
 }
Пример #2
0
    public static JArray ToJson(QuestStatistics qs)
    {
        JArray jsonStatistics = new JArray();

        foreach (var qsu in qs.Marks)
        {
            jsonStatistics.Add(JSONHelper.ToJson(qsu));
        }

        return(jsonStatistics);
    }
Пример #3
0
 /// <summary>
 /// Initializes a new fully initialized instance of the <see cref="Quest"/> class.
 /// </summary>
 /// <param name="geolocalisation">The geolocalisation.</param>
 /// <param name="description">The description.</param>
 /// <param name="creator">The creator.</param>
 /// <param name="checkpoints">The checkpoints.</param>
 public Quest(Coordinates geolocalisation, string title, string description, int experienceEarned,
              string idCreator, List <CheckPoint> checkpoints)
 {
     this.title            = title;
     this.geolocalisation  = geolocalisation;
     this.description      = description;
     this.experienceEarned = experienceEarned;
     timeLength            = -1;
     statistics            = new QuestStatistics(this);
     this.idCreator        = idCreator;
     this.checkpoints      = checkpoints;
 }
Пример #4
0
        private void UpdateScores()
        {
            var stats = _quest.GetStatistics();

            lblCoderLevel.Text   = QuestStatistics.LevelToString(stats.CoderLevel);
            lblCoderDesc.Text    = stats.CoderDescription;
            lblFocusLevel.Text   = QuestStatistics.LevelToString(stats.FocusLevel);
            lblFocusDesc.Text    = stats.FocusDescription;
            lblProjectLevel.Text = QuestStatistics.LevelToString(stats.ProjectLevel);
            lblProjectDesc.Text  = stats.ProjectDescription;

            lblCodeCount.Text    = stats.CodeCount.ToString("N0");
            lblProjectCount.Text = stats.ProjectCount.ToString("N0");
            lblCodeTime.Text     = stats.CodingTime.ToString("g");

            lblUsername.Text = _user.Username;
            lblSync.Text     = _user.LastSync.ToString("g");
            cmdLogin.Text    = _user.IsLogged ? "Logout" : "Login";
        }
    /// <summary>
    /// Handles the transription between the numeric rank of a quest, and its graphic representation with color filled stars
    /// </summary>
    /// <param name="statistics">The statistic object of the selected quest which contains its mark, given by the users</param>
    public void StarsManager(QuestStatistics statistics)
    {
        double mark = statistics.ComputeMean();

        //TODO gerer le cas sans moyenne
        if (double.IsNaN(mark))
        {
            mark = 0;
        }

        for (int i = 0; i < mark && i < stars.Count; i++)
        {
            stars[i].color = starRated;
        }
        for (int i = (int)mark; i < stars.Count; i++)
        {
            stars[i].color = starUnrated;
        }
    }