Hopefully fix cut values (thanks denpadokei)
This commit is contained in:
parent
a0cdde3ab2
commit
c002647108
@ -44,14 +44,14 @@ export default class ScoreStats extends Component {
|
|||||||
<p className={styles.scoreStatsAverageCut}>Average Cut</p>
|
<p className={styles.scoreStatsAverageCut}>Average Cut</p>
|
||||||
<div className={styles.scoreStatsHands}>
|
<div className={styles.scoreStatsHands}>
|
||||||
<div className={styles.scoreStatsLeft}>
|
<div className={styles.scoreStatsLeft}>
|
||||||
<p>{this.getAverage(data.SaberA.averagePreSwing).toFixed(2)}</p>
|
<p>{data.SaberA.averagePreSwing.toFixed(2)}</p>
|
||||||
<p>{this.getAverage(data.SaberA.averagePostSwing).toFixed(2)}</p>
|
<p>{data.SaberA.averagePostSwing.toFixed(2)}</p>
|
||||||
<p>{this.getAverage(data.SaberA.averageCut).toFixed(2)}</p>
|
<p>{data.SaberA.cutDistanceScore.toFixed(2)}</p>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.scoreStatsRight}>
|
<div className={styles.scoreStatsRight}>
|
||||||
<p>{this.getAverage(data.SaberB.averagePreSwing).toFixed(2)}</p>
|
<p>{data.SaberB.averagePreSwing.toFixed(2)}</p>
|
||||||
<p>{this.getAverage(data.SaberB.averagePostSwing).toFixed(2)}</p>
|
<p>{data.SaberB.averagePostSwing.toFixed(2)}</p>
|
||||||
<p>{this.getAverage(data.SaberB.averageCut).toFixed(2)}</p>
|
<p>{data.SaberB.cutDistanceScore.toFixed(2)}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,6 +15,16 @@ export default class Overlay extends Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
|
this.cutData = [];
|
||||||
|
this.cutData.SaberA = {
|
||||||
|
count: [0, 0, 0],
|
||||||
|
totalScore: [0, 0, 0],
|
||||||
|
};
|
||||||
|
this.cutData.SaberB = {
|
||||||
|
count: [0, 0, 0],
|
||||||
|
totalScore: [0, 0, 0],
|
||||||
|
};
|
||||||
|
|
||||||
this._mounted = false;
|
this._mounted = false;
|
||||||
this.state = {
|
this.state = {
|
||||||
hasError: false,
|
hasError: false,
|
||||||
@ -41,14 +51,14 @@ export default class Overlay extends Component {
|
|||||||
failed: false,
|
failed: false,
|
||||||
mapStarCount: undefined,
|
mapStarCount: undefined,
|
||||||
SaberA: {
|
SaberA: {
|
||||||
averageCut: [15.0],
|
cutDistanceScore: 0.0,
|
||||||
averagePreSwing: [70.0],
|
averagePreSwing: 0.0,
|
||||||
averagePostSwing: [30.0],
|
averagePostSwing: 0.0,
|
||||||
},
|
},
|
||||||
SaberB: {
|
SaberB: {
|
||||||
averageCut: [15.0],
|
cutDistanceScore: 0.0,
|
||||||
averagePreSwing: [70.0],
|
averagePreSwing: 0.0,
|
||||||
averagePostSwing: [30.0],
|
averagePostSwing: 0.0,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
this.setupTimer();
|
this.setupTimer();
|
||||||
@ -297,16 +307,25 @@ export default class Overlay extends Component {
|
|||||||
await this.updateData(this.state.id);
|
await this.updateData(this.state.id);
|
||||||
}, 1000); // 1 second
|
}, 1000); // 1 second
|
||||||
}
|
}
|
||||||
|
this.cutData = [];
|
||||||
|
this.cutData.SaberA = {
|
||||||
|
count: [0, 0, 0],
|
||||||
|
totalScore: [0, 0, 0],
|
||||||
|
};
|
||||||
|
this.cutData.SaberB = {
|
||||||
|
count: [0, 0, 0],
|
||||||
|
totalScore: [0, 0, 0],
|
||||||
|
};
|
||||||
this.setState({
|
this.setState({
|
||||||
SaberA: {
|
SaberA: {
|
||||||
averageCut: [15.0],
|
cutDistanceScore: 0.0,
|
||||||
averagePreSwing: [70.0],
|
averagePreSwing: 0.0,
|
||||||
averagePostSwing: [30.0],
|
averagePostSwing: 0.0,
|
||||||
},
|
},
|
||||||
SaberB: {
|
SaberB: {
|
||||||
averageCut: [15.0],
|
cutDistanceScore: 0.0,
|
||||||
averagePreSwing: [70.0],
|
averagePreSwing: 0.0,
|
||||||
averagePostSwing: [30.0],
|
averagePostSwing: 0.0,
|
||||||
},
|
},
|
||||||
songInfo: undefined,
|
songInfo: undefined,
|
||||||
beatSaverData: undefined,
|
beatSaverData: undefined,
|
||||||
@ -352,25 +371,25 @@ export default class Overlay extends Component {
|
|||||||
noteFullyCut: (data) => {
|
noteFullyCut: (data) => {
|
||||||
const { noteCut } = data;
|
const { noteCut } = data;
|
||||||
|
|
||||||
|
let beforeCutScore = 0.0;
|
||||||
|
let afterCutScore = 0.0;
|
||||||
|
let cutDistanceScore = 0.0;
|
||||||
|
|
||||||
|
const cutDataSaber = this.cutData[noteCut.saberType];
|
||||||
|
cutDataSaber.count[0]++;
|
||||||
|
cutDataSaber.count[1]++;
|
||||||
|
cutDataSaber.count[2]++;
|
||||||
|
cutDataSaber.totalScore[0] += noteCut.beforeCutScore;
|
||||||
|
cutDataSaber.totalScore[1] += noteCut.afterCutScore;
|
||||||
|
cutDataSaber.totalScore[2] += noteCut.cutDistanceScore;
|
||||||
|
beforeCutScore = cutDataSaber.totalScore[0] / cutDataSaber.count[0];
|
||||||
|
afterCutScore = cutDataSaber.totalScore[1] / cutDataSaber.count[1];
|
||||||
|
cutDistanceScore = cutDataSaber.totalScore[2] / cutDataSaber.count[2];
|
||||||
|
|
||||||
const cutData = this.state[noteCut.saberType];
|
const cutData = this.state[noteCut.saberType];
|
||||||
if (cutData.averageCut.includes(15) && cutData.averageCut.length === 1) {
|
cutData.averagePreSwing = beforeCutScore;
|
||||||
cutData.averageCut = [];
|
cutData.averagePostSwing = afterCutScore;
|
||||||
}
|
cutData.cutDistanceScore = cutDistanceScore;
|
||||||
if (
|
|
||||||
cutData.averagePreSwing.includes(70) &&
|
|
||||||
cutData.averagePreSwing.length === 1
|
|
||||||
) {
|
|
||||||
cutData.averagePreSwing = [];
|
|
||||||
}
|
|
||||||
if (
|
|
||||||
cutData.averagePostSwing.includes(30) &&
|
|
||||||
cutData.averagePostSwing.length === 1
|
|
||||||
) {
|
|
||||||
cutData.averagePostSwing = [];
|
|
||||||
}
|
|
||||||
cutData.averagePreSwing.push(noteCut.beforeCutScore);
|
|
||||||
cutData.averagePostSwing.push(noteCut.afterCutScore);
|
|
||||||
cutData.averageCut.push(noteCut.cutDistanceScore);
|
|
||||||
this.setState({ [noteCut.saberType]: cutData });
|
this.setState({ [noteCut.saberType]: cutData });
|
||||||
},
|
},
|
||||||
songStart: (data) => {
|
songStart: (data) => {
|
||||||
|
Reference in New Issue
Block a user