From 2738527d9cce7f1a3876143e523a7cfd189f8b8c Mon Sep 17 00:00:00 2001 From: Jennifer Taylor Date: Sat, 8 Oct 2022 02:25:03 +0000 Subject: [PATCH] Tweak Museca frontend, add judgement stats to all pages. --- bemani/frontend/museca/museca.py | 2 + .../controllers/jubeat/topscores.react.js | 8 +- .../static/controllers/museca/player.react.js | 6 +- .../controllers/museca/records.react.js | 204 ++++++++++-------- .../static/controllers/museca/scores.react.js | 22 +- .../controllers/museca/topscores.react.js | 25 ++- 6 files changed, 158 insertions(+), 109 deletions(-) diff --git a/bemani/frontend/museca/museca.py b/bemani/frontend/museca/museca.py index 08cf465..c0e2db2 100644 --- a/bemani/frontend/museca/museca.py +++ b/bemani/frontend/museca/museca.py @@ -50,6 +50,7 @@ class MusecaFrontend(FrontendBase): MusecaBase.CLEAR_TYPE_FULL_COMBO: 'Full Combo', }.get(score.data.get_int('clear_type'), 'Failed') formatted_score['medal'] = score.data.get_int('clear_type') + formatted_score['stats'] = score.data.get_dict('stats') return formatted_score def format_attempt(self, userid: UserID, attempt: Attempt) -> Dict[str, Any]: @@ -72,6 +73,7 @@ class MusecaFrontend(FrontendBase): MusecaBase.CLEAR_TYPE_FULL_COMBO: 'Full Combo', }.get(attempt.data.get_int('clear_type'), 'Failed') formatted_attempt['medal'] = attempt.data.get_int('clear_type') + formatted_attempt['stats'] = attempt.data.get_dict('stats') return formatted_attempt def format_profile(self, profile: Profile, playstats: ValidatedDict) -> Dict[str, Any]: diff --git a/bemani/frontend/static/controllers/jubeat/topscores.react.js b/bemani/frontend/static/controllers/jubeat/topscores.react.js index b9fd95e..4ec7fc9 100644 --- a/bemani/frontend/static/controllers/jubeat/topscores.react.js +++ b/bemani/frontend/static/controllers/jubeat/topscores.react.js @@ -148,13 +148,13 @@ var top_scores = React.createClass({ ); return has_stats ?
{topscore.stats.perfect} - / + / {topscore.stats.great} - / + / {topscore.stats.good} - / + / {topscore.stats.poor} - / + / {topscore.stats.miss}
: null; } diff --git a/bemani/frontend/static/controllers/museca/player.react.js b/bemani/frontend/static/controllers/museca/player.react.js index 3cb5867..59e3164 100644 --- a/bemani/frontend/static/controllers/museca/player.react.js +++ b/bemani/frontend/static/controllers/museca/player.react.js @@ -59,13 +59,13 @@ var profile_view = React.createClass({
{player.extid} - + - + - + {player.plays}回
diff --git a/bemani/frontend/static/controllers/museca/records.react.js b/bemani/frontend/static/controllers/museca/records.react.js index 7ca5d88..404a303 100644 --- a/bemani/frontend/static/controllers/museca/records.react.js +++ b/bemani/frontend/static/controllers/museca/records.react.js @@ -27,20 +27,32 @@ var HighScore = React.createClass({ if (!this.props.score) { return null; } + has_stats = ( + this.props.score.stats.critical > 0 || + this.props.score.stats.near > 0 || + this.props.score.stats.error > 0 + ); return (
Score {this.props.score.points} - {this.props.score.grade} -
-
Combo {this.props.score.combo < 0 ? '-' : this.props.score.combo}
- {this.props.score.clear_type} + {this.props.score.grade} +
+ {has_stats ?
+ {this.props.score.stats.critical} + / + {this.props.score.stats.near} + / + {this.props.score.stats.error} +
: null} +
+ {this.props.score.clear_type.toUpperCase()}
{ this.props.score.userid && window.shownames ?
{ @@ -206,8 +218,10 @@ var network_records = React.createClass({ if (paginate && curpage != this.state.subtab) { return null; } return ( - - { this.state.versions[(-songid) - 1] } + + { + !paginate ? this.state.versions[(-songid) - 1] : "Song / Artist / Difficulties" + } { 'Green (\u7FE0)' } { 'Orange (\u6A59)' } { 'Red (\u6731)' } @@ -415,96 +429,98 @@ var network_records = React.createClass({ renderBySongIDList: function(songids, showplays) { return ( - - - - - - - - - - - {songids.map(function(songid, index) { - if (index < this.state.offset || index >= this.state.offset + this.state.limit) { - return null; - } - - var records = this.state.records[songid]; - if (!records) { - records = {}; - } - - var plays = this.getPlays(records); - var difficulties = this.state.songs[songid].difficulties; - return ( - - - - - - - ); - }.bind(this))} - - - - + + + + + + ); + }.bind(this))} + + + + + + +
Song{ 'Green (\u7FE0)' }{ 'Orange (\u6A59)' }{ 'Red (\u6731)' }
- -
- {this.renderDifficulty(songid, 0)} - / - {this.renderDifficulty(songid, 1)} - / - {this.renderDifficulty(songid, 2)} -
- { showplays ?
#{index + 1} - {plays}{plays == 1 ? ' play' : ' plays'}
: null } -
0 ? "" : "nochart"}> - - 0 ? "" : "nochart"}> - - 0 ? "" : "nochart"}> - -
- { this.state.offset > 0 ? - : null +
+ + + + + + + + + + + {songids.map(function(songid, index) { + if (index < this.state.offset || index >= this.state.offset + this.state.limit) { + return null; } - { (this.state.offset + this.state.limit) < songids.length ? - = songids.length) { return } - this.setState({offset: page}); - }.bind(this)}/> : - null + + var records = this.state.records[songid]; + if (!records) { + records = {}; } - - - -
Song / Artist / Difficulties{ 'Green (\u7FE0)' }{ 'Orange (\u6A59)' }{ 'Red (\u6731)' }
+ + var plays = this.getPlays(records); + var difficulties = this.state.songs[songid].difficulties; + return ( +
+ +
+ {this.renderDifficulty(songid, 0)} + / + {this.renderDifficulty(songid, 1)} + / + {this.renderDifficulty(songid, 2)} +
+ { showplays ?
#{index + 1} - {plays}{plays == 1 ? ' play' : ' plays'}
: null } +
0 ? "" : "nochart"}> + + 0 ? "" : "nochart"}> + + 0 ? "" : "nochart"}> + +
+ { this.state.offset > 0 ? + : null + } + { (this.state.offset + this.state.limit) < songids.length ? + = songids.length) { return } + this.setState({offset: page}); + }.bind(this)}/> : + null + } +
+
); }, diff --git a/bemani/frontend/static/controllers/museca/scores.react.js b/bemani/frontend/static/controllers/museca/scores.react.js index 23bf02e..b8e9075 100644 --- a/bemani/frontend/static/controllers/museca/scores.react.js +++ b/bemani/frontend/static/controllers/museca/scores.react.js @@ -58,19 +58,29 @@ var network_scores = React.createClass({ }, renderScore: function(score) { + has_stats = ( + score.stats.critical > 0 || + score.stats.near > 0 || + score.stats.error > 0 + ); return (
Score {score.points} - {score.grade} -
-
Combo {score.combo < 0 ? '-' : score.combo} + {score.grade}
+ {has_stats ?
+ {score.stats.critical} + / + {score.stats.near} + / + {score.stats.error} +
: null}
- {score.clear_type} + {score.clear_type.toUpperCase()}
); @@ -84,8 +94,8 @@ var network_scores = React.createClass({ { window.shownames ? Name : null } Timestamp - Song - Chart + Song / Artist + Difficulty Score diff --git a/bemani/frontend/static/controllers/museca/topscores.react.js b/bemani/frontend/static/controllers/museca/topscores.react.js index d25881c..815dcee 100644 --- a/bemani/frontend/static/controllers/museca/topscores.react.js +++ b/bemani/frontend/static/controllers/museca/topscores.react.js @@ -88,7 +88,7 @@ var top_scores = React.createClass({ }.bind(this))}
- 0 ? topscore.combo : '-'; }, + sort: function(a, b) { + return a.combo - b.combo; + }, + reverse: true, + }, + { + name: 'Judgement Stats', + render: function(topscore) { + has_stats = ( + topscore.stats.critical > 0 || + topscore.stats.near > 0 || + topscore.stats.error > 0 + ); + return has_stats ?
+ {topscore.stats.critical} + / + {topscore.stats.near} + / + {topscore.stats.error} +
: null; + } }, ]} defaultsort='Score'