Skip to content
Snippets Groups Projects

Score replay

Merged Ghost User requested to merge score-replay into development
1 file
+ 4
6
Compare changes
  • Side-by-side
  • Inline
@@ -8,10 +8,11 @@ import { Track } from "./track";
* 控制轨迹和绘制
*/
export const TrackController = L.Class.extend({
initialize: function(tracks = [], draw, options) {
initialize: function(tracks = [], draw, allScores, options) {
L.setOptions(this, options);
this._activeScores = [0, 0];
this._tracks = [];
this._scores = allScores.scores;
this.addTrack(tracks);
this._draw = draw;
@@ -49,6 +50,16 @@ export const TrackController = L.Class.extend({
let tps = track.getTrackPointsBeforeTime(time);
if (tps && tps.length) this._draw.drawTrack(tps);
}
for (let i = 0; i < this._scores.length; i++) {
let newScore = 0;
let scores = this._scores[i];
for (let j = 0; j < scores.length; j++) {
if (scores[j].timestamp < time) {
newScore = scores[j].score;
}
}
this._activeScores[i] = newScore;
}
},
_updateTime: function() {
Loading