Confirm native split UI before selecting and drag a visible selected ball
This commit is contained in:
@@ -57,6 +57,22 @@ function BallClear($Board,[string]$Id) {
|
||||
}
|
||||
return $true
|
||||
}
|
||||
function SplitModeVisible([string]$Path) {
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
$image=[Drawing.Bitmap]::new($Path)
|
||||
$min=450;$max=0;$dark=0
|
||||
try {
|
||||
if($image.Width-ne2400-or$image.Height-ne1080){throw 'Split UI probe requires the documented 2400x1080 AVD'}
|
||||
for($y=802;$y-lt862;$y++){for($x=180;$x-lt450;$x++){
|
||||
$pixel=$image.GetPixel($x,$y)
|
||||
if($pixel.R-lt100-and$pixel.G-lt110-and$pixel.B-lt150){$dark++;$min=[Math]::Min($min,$x);$max=[Math]::Max($max,$x)}
|
||||
}}
|
||||
} finally {$image.Dispose()}
|
||||
# Korean fixed-size label: 취소 spans79px; 나누기 spans117px in the actual APK captures.
|
||||
$visible=$dark-ge300-and($max-$min)-ge60-and($max-$min)-le95
|
||||
$commands.Add(@{command='Read actual native split button label bounds';png=$Path;darkPixels=$dark;minX=$min;maxX=$max;splitCancelLabel=$visible;utc=[DateTime]::UtcNow.ToString('o')})
|
||||
return $visible
|
||||
}
|
||||
function TapBall([string]$Name,$Board,[string]$Id) {
|
||||
$point=BallPoint $Board $Id
|
||||
if(!(WorldSafe $point)){throw "Refused unsafe native ball tap $Id at $($point-join',')"}
|
||||
|
||||
Reference in New Issue
Block a user