|
|
@ -1,5 +1,7 @@
|
|
|
|
import 'Player.dart';
|
|
|
|
import 'Player.dart';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final maxScoreInFrame = 30;
|
|
|
|
|
|
|
|
|
|
|
|
abstract class AbstractRound {
|
|
|
|
abstract class AbstractRound {
|
|
|
|
int? _firstThrow;
|
|
|
|
int? _firstThrow;
|
|
|
|
int? _secondThrow;
|
|
|
|
int? _secondThrow;
|
|
|
@ -28,8 +30,12 @@ abstract class AbstractRound {
|
|
|
|
int? get points => _points;
|
|
|
|
int? get points => _points;
|
|
|
|
|
|
|
|
|
|
|
|
set points(int? value) {
|
|
|
|
set points(int? value) {
|
|
|
|
|
|
|
|
if((value??0)>=maxScoreInFrame){
|
|
|
|
|
|
|
|
_points=maxScoreInFrame;
|
|
|
|
|
|
|
|
}else {
|
|
|
|
_points = value;
|
|
|
|
_points = value;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int get number => _number;
|
|
|
|
int get number => _number;
|
|
|
@ -76,11 +82,14 @@ abstract class AbstractRound {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void update(int val){
|
|
|
|
void update(int val){
|
|
|
|
|
|
|
|
print(" ROUND " + number.toString() + "UPDATE : " + val.toString());
|
|
|
|
|
|
|
|
|
|
|
|
points = (points ?? 0) + val;
|
|
|
|
points = (points ?? 0) + val;
|
|
|
|
previousRound?.update(val);
|
|
|
|
previousRound?.update(val);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void unsubscribePreviousRound(){
|
|
|
|
void unsubscribePreviousRound(){
|
|
|
|
|
|
|
|
print("UNSUBSCRIBE");
|
|
|
|
previousRound?.unsubscribePreviousRound();
|
|
|
|
previousRound?.unsubscribePreviousRound();
|
|
|
|
previousRound=null;
|
|
|
|
previousRound=null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|