I'm going to get TWC stats + handling in tl_match_view
This commit is contained in:
parent
a9a94e9209
commit
94d4e650d5
|
@ -398,12 +398,14 @@ class Clears {
|
||||||
late int doubles;
|
late int doubles;
|
||||||
late int triples;
|
late int triples;
|
||||||
late int quads;
|
late int quads;
|
||||||
|
late int pentas;
|
||||||
late int allClears;
|
late int allClears;
|
||||||
late int tSpinZeros;
|
late int tSpinZeros;
|
||||||
late int tSpinSingles;
|
late int tSpinSingles;
|
||||||
late int tSpinDoubles;
|
late int tSpinDoubles;
|
||||||
late int tSpinTriples;
|
late int tSpinTriples;
|
||||||
late int tSpinQuads;
|
late int tSpinQuads;
|
||||||
|
late int tSpinPentas;
|
||||||
late int tSpinMiniZeros;
|
late int tSpinMiniZeros;
|
||||||
late int tSpinMiniSingles;
|
late int tSpinMiniSingles;
|
||||||
late int tSpinMiniDoubles;
|
late int tSpinMiniDoubles;
|
||||||
|
@ -413,11 +415,13 @@ class Clears {
|
||||||
required this.doubles,
|
required this.doubles,
|
||||||
required this.triples,
|
required this.triples,
|
||||||
required this.quads,
|
required this.quads,
|
||||||
|
required this.pentas,
|
||||||
required this.allClears,
|
required this.allClears,
|
||||||
required this.tSpinZeros,
|
required this.tSpinZeros,
|
||||||
required this.tSpinSingles,
|
required this.tSpinSingles,
|
||||||
required this.tSpinDoubles,
|
required this.tSpinDoubles,
|
||||||
required this.tSpinTriples,
|
required this.tSpinTriples,
|
||||||
|
required this.tSpinPentas,
|
||||||
required this.tSpinQuads,
|
required this.tSpinQuads,
|
||||||
required this.tSpinMiniZeros,
|
required this.tSpinMiniZeros,
|
||||||
required this.tSpinMiniSingles,
|
required this.tSpinMiniSingles,
|
||||||
|
@ -428,6 +432,7 @@ class Clears {
|
||||||
doubles = json['doubles'];
|
doubles = json['doubles'];
|
||||||
triples = json['triples'];
|
triples = json['triples'];
|
||||||
quads = json['quads'];
|
quads = json['quads'];
|
||||||
|
pentas = json['pentas']??0;
|
||||||
tSpinZeros = json['realtspins'];
|
tSpinZeros = json['realtspins'];
|
||||||
tSpinMiniZeros = json['minitspins'];
|
tSpinMiniZeros = json['minitspins'];
|
||||||
tSpinMiniSingles = json['minitspinsingles'];
|
tSpinMiniSingles = json['minitspinsingles'];
|
||||||
|
@ -436,6 +441,7 @@ class Clears {
|
||||||
tSpinDoubles = json['tspindoubles'];
|
tSpinDoubles = json['tspindoubles'];
|
||||||
tSpinTriples = json['tspintriples'];
|
tSpinTriples = json['tspintriples'];
|
||||||
tSpinQuads = json['tspinquads'];
|
tSpinQuads = json['tspinquads'];
|
||||||
|
tSpinPentas = json['tspinpentas']??0;
|
||||||
allClears = json['allclear'];
|
allClears = json['allclear'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -445,6 +451,7 @@ class Clears {
|
||||||
data['doubles'] = doubles;
|
data['doubles'] = doubles;
|
||||||
data['triples'] = triples;
|
data['triples'] = triples;
|
||||||
data['quads'] = quads;
|
data['quads'] = quads;
|
||||||
|
data['pentas'] = pentas;
|
||||||
data['realtspins'] = tSpinZeros;
|
data['realtspins'] = tSpinZeros;
|
||||||
data['minitspins'] = tSpinMiniZeros;
|
data['minitspins'] = tSpinMiniZeros;
|
||||||
data['minitspinsingles'] = tSpinMiniSingles;
|
data['minitspinsingles'] = tSpinMiniSingles;
|
||||||
|
@ -453,6 +460,7 @@ class Clears {
|
||||||
data['tspindoubles'] = tSpinDoubles;
|
data['tspindoubles'] = tSpinDoubles;
|
||||||
data['tspintriples'] = tSpinTriples;
|
data['tspintriples'] = tSpinTriples;
|
||||||
data['tspinquads'] = tSpinQuads;
|
data['tspinquads'] = tSpinQuads;
|
||||||
|
data['tspinpentas'] = tSpinPentas;
|
||||||
data['allclear'] = allClears;
|
data['allclear'] = allClears;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,95 @@
|
||||||
|
import 'dart:math';
|
||||||
|
import 'tetrio.dart';
|
||||||
|
|
||||||
|
// I want to implement those fancy TWC stats
|
||||||
|
// So, i'm going to read replay for things
|
||||||
|
|
||||||
|
class Garbage{ // charsys where???
|
||||||
|
late int sent;
|
||||||
|
late int recived;
|
||||||
|
late int attack;
|
||||||
|
late int cleared;
|
||||||
|
|
||||||
|
Garbage({
|
||||||
|
required this.sent,
|
||||||
|
required this.recived,
|
||||||
|
required this.attack,
|
||||||
|
required this.cleared
|
||||||
|
});
|
||||||
|
|
||||||
|
Garbage.fromJson(Map<String, dynamic> json){
|
||||||
|
sent = json['sent'];
|
||||||
|
recived = json['recived'];
|
||||||
|
attack = json['attack'];
|
||||||
|
cleared = json['cleared'];
|
||||||
|
}
|
||||||
|
|
||||||
|
Garbage.toJson(){
|
||||||
|
// наху надо
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class ReplayStats{
|
||||||
|
late int seed;
|
||||||
|
late int linesCleared;
|
||||||
|
late int inputs;
|
||||||
|
late int holds;
|
||||||
|
late int score;
|
||||||
|
late int topCombo;
|
||||||
|
late int topBtB;
|
||||||
|
late int tspins;
|
||||||
|
late Clears clears;
|
||||||
|
late Garbage garbage;
|
||||||
|
late Finesse finesse;
|
||||||
|
late int kills;
|
||||||
|
|
||||||
|
ReplayStats({
|
||||||
|
required this.seed,
|
||||||
|
required this.linesCleared,
|
||||||
|
required this.inputs,
|
||||||
|
required this.holds,
|
||||||
|
required this.score,
|
||||||
|
required this.topCombo,
|
||||||
|
required this.topBtB,
|
||||||
|
required this.tspins,
|
||||||
|
required this.clears,
|
||||||
|
required this.garbage,
|
||||||
|
required this.finesse,
|
||||||
|
required this.kills,
|
||||||
|
});
|
||||||
|
|
||||||
|
ReplayStats.fromJson(Map<String, dynamic> json){
|
||||||
|
seed = json['seed'];
|
||||||
|
linesCleared = json['lines'];
|
||||||
|
inputs = json['inputs'];
|
||||||
|
holds = json['holds'];
|
||||||
|
score = json['score'];
|
||||||
|
topCombo = json['topcombo'];
|
||||||
|
topBtB = json['topbtb'];
|
||||||
|
tspins = json['tspins'];
|
||||||
|
clears = Clears.fromJson(json['clears']);
|
||||||
|
garbage = Garbage.fromJson(json['garbage']);
|
||||||
|
finesse = Finesse.fromJson(json['finesse']);
|
||||||
|
kills = json['kills'];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class ReplayData{
|
||||||
|
late String id;
|
||||||
|
late List<EndContextMulti> endcontext;
|
||||||
|
late List<List<ReplayStats>> stats;
|
||||||
|
late List<int> roundLengths; // in frames
|
||||||
|
|
||||||
|
ReplayData({
|
||||||
|
required this.id,
|
||||||
|
required this.endcontext,
|
||||||
|
required this.stats,
|
||||||
|
required this.roundLengths
|
||||||
|
});
|
||||||
|
|
||||||
|
ReplayData.fromJson(Map<String, dynamic> json){
|
||||||
|
// завтра разберусь,
|
||||||
|
// пока что знаю, что тут будет for loop, который чекает replay["data"]
|
||||||
|
}
|
||||||
|
}
|
|
@ -215,6 +215,7 @@ class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
|
||||||
final t = Translations.of(context);
|
final t = Translations.of(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
drawer: widget.player == null ? NavDrawer(changePlayer) : null,
|
drawer: widget.player == null ? NavDrawer(changePlayer) : null,
|
||||||
|
drawerEdgeDragWidth: MediaQuery.of(context).size.width * 0.2,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: !_searchBoolean
|
title: !_searchBoolean
|
||||||
? Text(
|
? Text(
|
||||||
|
@ -327,6 +328,7 @@ class _MainState extends State<MainView> with SingleTickerProviderStateMixin {
|
||||||
SliverToBoxAdapter(
|
SliverToBoxAdapter(
|
||||||
child: TabBar(
|
child: TabBar(
|
||||||
controller: _tabController,
|
controller: _tabController,
|
||||||
|
padding: EdgeInsets.all(0.0),
|
||||||
isScrollable: true,
|
isScrollable: true,
|
||||||
tabs: [
|
tabs: [
|
||||||
Tab(text: t.tetraLeague),
|
Tab(text: t.tetraLeague),
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
import 'package:tetra_stats/services/crud_exceptions.dart';
|
import 'package:tetra_stats/services/crud_exceptions.dart';
|
||||||
|
import 'package:tetra_stats/views/compare_view.dart' show CompareThingy, CompareBoolThingy;
|
||||||
import 'package:tetra_stats/widgets/vs_graphs.dart';
|
import 'package:tetra_stats/widgets/vs_graphs.dart';
|
||||||
import 'main_view.dart' show teto;
|
import 'main_view.dart' show teto;
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
@ -341,6 +342,38 @@ class TlMatchResultState extends State<TlMatchResultView> {
|
||||||
roundSelector.isNegative ? widget.record.endContext.firstWhere((element) => element.userId != widget.initPlayerId).playstyle : widget.record.endContext.firstWhere((element) => element.userId != widget.initPlayerId).playstyleTracking[roundSelector]
|
roundSelector.isNegative ? widget.record.endContext.firstWhere((element) => element.userId != widget.initPlayerId).playstyle : widget.record.endContext.firstWhere((element) => element.userId != widget.initPlayerId).playstyleTracking[roundSelector]
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
const Divider(),
|
||||||
|
Column(
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 16),
|
||||||
|
child: Text("Handling",
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: "Eurostile Round Extended",
|
||||||
|
fontSize: bigScreen ? 42 : 28)),
|
||||||
|
),
|
||||||
|
CompareThingy(
|
||||||
|
greenSide: widget.record.endContext.firstWhere((element) => element.userId == widget.initPlayerId).handling.das,
|
||||||
|
redSide: widget.record.endContext.firstWhere((element) => element.userId != widget.initPlayerId).handling.das,
|
||||||
|
label: "DAS",
|
||||||
|
higherIsBetter: false),
|
||||||
|
CompareThingy(
|
||||||
|
greenSide: widget.record.endContext.firstWhere((element) => element.userId == widget.initPlayerId).handling.arr,
|
||||||
|
redSide: widget.record.endContext.firstWhere((element) => element.userId != widget.initPlayerId).handling.arr,
|
||||||
|
label: "ARR",
|
||||||
|
higherIsBetter: false),
|
||||||
|
CompareThingy(
|
||||||
|
greenSide: widget.record.endContext.firstWhere((element) => element.userId == widget.initPlayerId).handling.sdf,
|
||||||
|
redSide: widget.record.endContext.firstWhere((element) => element.userId != widget.initPlayerId).handling.sdf,
|
||||||
|
label: "SDF",
|
||||||
|
higherIsBetter: true),
|
||||||
|
CompareBoolThingy(
|
||||||
|
greenSide: widget.record.endContext.firstWhere((element) => element.userId == widget.initPlayerId).handling.safeLock,
|
||||||
|
redSide: widget.record.endContext.firstWhere((element) => element.userId != widget.initPlayerId).handling.safeLock,
|
||||||
|
label: "safeLock",
|
||||||
|
trueIsBetter: true)
|
||||||
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -349,131 +382,3 @@ class TlMatchResultState extends State<TlMatchResultView> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CompareThingy extends StatelessWidget {
|
|
||||||
final num greenSide;
|
|
||||||
final num redSide;
|
|
||||||
final String label;
|
|
||||||
final bool higherIsBetter;
|
|
||||||
final int? fractionDigits;
|
|
||||||
const CompareThingy(
|
|
||||||
{super.key,
|
|
||||||
required this.greenSide,
|
|
||||||
required this.redSide,
|
|
||||||
required this.label,
|
|
||||||
required this.higherIsBetter,
|
|
||||||
this.fractionDigits});
|
|
||||||
|
|
||||||
String verdict(num greenSide, num redSide, int fraction) {
|
|
||||||
var f = NumberFormat("+#,###.##;-#,###.##");
|
|
||||||
f.maximumFractionDigits = fraction;
|
|
||||||
return f.format((greenSide - redSide));
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
NumberFormat f = NumberFormat.decimalPatternDigits(locale: LocaleSettings.currentLocale.languageCode, decimalDigits: fractionDigits ?? 0);
|
|
||||||
return Padding(
|
|
||||||
padding: const EdgeInsets.fromLTRB(16, 2, 16, 2),
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(4),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
gradient: LinearGradient(
|
|
||||||
colors: const [Colors.green, Colors.transparent],
|
|
||||||
begin: Alignment.centerLeft,
|
|
||||||
end: Alignment.centerRight,
|
|
||||||
stops: [
|
|
||||||
0.0,
|
|
||||||
higherIsBetter
|
|
||||||
? greenSide > redSide
|
|
||||||
? 0.6
|
|
||||||
: 0
|
|
||||||
: greenSide < redSide
|
|
||||||
? 0.6
|
|
||||||
: 0
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
child: Text(
|
|
||||||
f.format(greenSide),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
shadows: <Shadow>[
|
|
||||||
Shadow(
|
|
||||||
offset: Offset(0.0, 0.0),
|
|
||||||
blurRadius: 3.0,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
Shadow(
|
|
||||||
offset: Offset(0.0, 0.0),
|
|
||||||
blurRadius: 8.0,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.start,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
Column(
|
|
||||||
children: [
|
|
||||||
Text(
|
|
||||||
label,
|
|
||||||
style: const TextStyle(fontSize: 22),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
verdict(greenSide, redSide,
|
|
||||||
fractionDigits != null ? fractionDigits! + 2 : 0),
|
|
||||||
style: const TextStyle(fontSize: 16),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Expanded(
|
|
||||||
child: Container(
|
|
||||||
padding: const EdgeInsets.all(4),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
gradient: LinearGradient(
|
|
||||||
colors: const [Colors.red, Colors.transparent],
|
|
||||||
begin: Alignment.centerRight,
|
|
||||||
end: Alignment.centerLeft,
|
|
||||||
stops: [
|
|
||||||
0.0,
|
|
||||||
higherIsBetter
|
|
||||||
? redSide > greenSide
|
|
||||||
? 0.6
|
|
||||||
: 0
|
|
||||||
: redSide < greenSide
|
|
||||||
? 0.6
|
|
||||||
: 0
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
child: Text(
|
|
||||||
f.format(redSide),
|
|
||||||
style: const TextStyle(
|
|
||||||
fontSize: 22,
|
|
||||||
shadows: <Shadow>[
|
|
||||||
Shadow(
|
|
||||||
offset: Offset(0.0, 0.0),
|
|
||||||
blurRadius: 3.0,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
Shadow(
|
|
||||||
offset: Offset(0.0, 0.0),
|
|
||||||
blurRadius: 8.0,
|
|
||||||
color: Colors.black,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
textAlign: TextAlign.end,
|
|
||||||
),
|
|
||||||
)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue