private MusicRhythmInfo LoadJson(string jsonId) { string text = new AssetLoader().LoadTextSync(AssetLoader.GetMusicRhythmDataPath(jsonId)); MusicRhythmInfo info = JsonConvert.DeserializeObject <MusicRhythmInfo>(text); TestMusicRhythmInfo(jsonId, info); return(info); }
private void TestMusicRhythmInfo(string jsonId, MusicRhythmInfo info) { int shortNum = 0; int longNum = 0; foreach (var v in info.Ticks) { if (v.TickType == 1) { shortNum++; } else if (v.TickType == 2) { longNum++; } } Debug.LogError("jsonId = " + jsonId + " shortNum = " + shortNum + " longNum = " + longNum); }
public void InitRunningData(float musicLen) { runningInfo = new MusicRhythmRunningInfo(); int musicId = _activityMusicVo.MusicId; //LoadJson("10000"); //LoadJson("10001"); //LoadJson("10002"); MusicGameDiffTypePB diff = _activityMusicVo.Diff; string jsonId = musicId.ToString() + ((int)diff).ToString(); Debug.LogError(jsonId); _rhythmInInfo = LoadJson(jsonId); _rhythmInInfo.Ticks.Sort(); runningInfo.activityId = _activityMusicVo.ActivityId; runningInfo.diff = _activityMusicVo.Diff; runningInfo.musicLen = musicLen; runningInfo.musicId = musicId; runningInfo.musicName = GetMusicNameById(musicId); runningInfo.ScoreRule = GetMusicGameScoreRule(musicId, diff); runningInfo.JudgeMusicDataPBs = GetJudgeRule(); }