修复白屏BUG、UI 边界溢出 BUG
This commit is contained in:
@@ -9,14 +9,26 @@ class ScoreMath {
|
||||
const ScoreMath._();
|
||||
|
||||
/// Returns the score [0..10] for a hit at [normalizedX]/[normalizedY].
|
||||
///
|
||||
/// Uses standard FITA ring proportions (as fraction of target radius):
|
||||
/// Ring 10: 0 - 5%
|
||||
/// Ring 9: 5% - 15%
|
||||
/// Ring 8: 15% - 25%
|
||||
/// ...
|
||||
/// Ring 1: 85% - 100%
|
||||
/// Miss: > 100%
|
||||
static int scoreFor(double normalizedX, double normalizedY) {
|
||||
final d = distance(normalizedX, normalizedY);
|
||||
if (d > 1.0) return 0; // miss
|
||||
final ring = (d * 10).floor();
|
||||
var score = 10 - ring;
|
||||
if (score < 1) score = 1;
|
||||
if (score > 10) score = 10;
|
||||
return score;
|
||||
if (d > 1.0) return 0;
|
||||
|
||||
if (d <= 0.05) return 10;
|
||||
|
||||
final k = ((d - 0.05) / 0.1).floor();
|
||||
final ring = 9 - k;
|
||||
|
||||
if (ring < 1) return 1;
|
||||
if (ring > 9) return 9;
|
||||
return ring;
|
||||
}
|
||||
|
||||
/// Euclidean distance from center for normalized coords.
|
||||
|
||||
Reference in New Issue
Block a user