Ejemplo n.º 1
0
        private void LoadGraphs()
        {
            JObject beatmapSettings = new JObject(
                new JProperty("cs", Calculator.Beatmap.Difficulty.CS),
                new JProperty("ar", Calculator.Beatmap.Difficulty.AR)
                );

            JArray hitObjects = new JArray(Calculator.DifficultyPoints.Where(p => p.BaseHitObject.GetType() != typeof(Spinner)).Select(p => new JObject(
                                                                                                                                           new JProperty("x", p.BaseHitObject.X),
                                                                                                                                           new JProperty("y", p.BaseHitObject.Y),
                                                                                                                                           new JProperty("time", p.BaseHitObject.Time),
                                                                                                                                           new JProperty("newCombo", p.BaseHitObject.NewCombo)
                                                                                                                                           )));

            JArray dataPoints = new JArray( // array of skill
                Calculator.DifficultyPoints[0].SkillDatas.Select((skillData, i) => new JObject(
                                                                     new JProperty("name", skillData.SkillType.Name),
                                                                     new JProperty("dataSets", new JArray( // array of datapoint type
                                                                                       skillData.DataPoints.Keys.Select(dataPointName => new JObject(
                                                                                                                            new JProperty("name", dataPointName),
                                                                                                                            new JProperty("dataPoints", new JArray(
                                                                                                                                              Calculator.DifficultyPoints.Where(p => p.BaseHitObject.GetType() != typeof(Spinner)).Select(difficultyPoint => new JValue(difficultyPoint.SkillDatas[i].DataPoints[dataPointName]))
                                                                                                                                              ))
                                                                                                                            ))
                                                                                       ))
                                                                     ))
                );

            GraphBrowser.ExecuteScriptAsync($"setData({beatmapSettings.ToString()}, {hitObjects.ToString()}, {dataPoints.ToString()});");
        }