66type
77 TRSLoginLobby = record
88 Bounds, Button: TBox;
9- OCRFilter: TOCRColorFilter;
109 end;
1110
1211procedure TRSLoginLobby.Setup();
1312begin
14- Self.OCRFilter := TOCRColorFilter.Create([$FFFFFF]);
15-
1613 Self.Bounds.X1 := Target.Bounds.Width div 2 - 382;
1714 Self.Bounds.X2 := Target.Bounds.Width div 2 + 382;
1815 Self.Bounds.Y1 := Target.Bounds.Y1;
3027
3128function TRSLoginLobby.IsOpen(): Boolean;
3229begin
33- Result := 1 = OCR.Locate(Self.Button, 'CLICK HERE TO PLAY', RSFonts.BOLD_12_SHADOW,Self.OCRFilter) ;
30+ Result := OCR.Locate(Self.Button, 'CLICK HERE TO PLAY', [$FFFFFF], 0, OCR.BOLD_SHADOW) > 0.999 ;
3431end;
3532
3633function TRSLoginLobby.WaitOpen(const time: Integer = 600; interval: Integer = -1): Boolean;
6764 TRSLoginWorldSwitcher = record
6865 Bounds: TBox;
6966 OpenButton, CancelButton: TBox;
70- CurrentOCRFilter, WorldOCRFilter: TOCRColorFilter;
7167 CurrentWorld: Integer;
7268 WorldBoxes: TBoxArray;
7369
7672
7773procedure TRSLoginWorldSwitcher.Setup();
7874begin
79- Self.CurrentOCRFilter := TOCRColorFilter.Create([$FFFFFF]);
80- Self.WorldOCRFilter := TOCRColorFilter.Create([$000000, $0000FF]);
81-
8275 Self.Bounds.X1 := Target.Bounds.Width div 2 - 382;
8376 Self.Bounds.X2 := Target.Bounds.Width div 2 + 382;
8477 Self.Bounds.Y1 := Target.Bounds.Y1;
142135
143136function TRSLoginWorldSwitcher.Read(index: Integer): Integer;
144137begin
145- Result := OCR.RecognizeNumber(Self.WorldBoxes[index], Self.WorldOCRFilter, RSFonts.BOLD_12 );
138+ Result := OCR.RecognizeNumber(Self.WorldBoxes[index], OCR.BOLD, [$000000, $0000FF], 0 );
146139end;
147140
148141
172165function TRSLoginWorldSwitcher.GetCurrent(): Integer;
173166begin
174167 if not Self.Close() then Exit;
175- Result := OCR.RecognizeNumber(Self.OpenButton, Self.CurrentOCRFilter, RSFonts.BOLD_12_SHADOW );
168+ Result := OCR.RecognizeNumber(Self.OpenButton, OCR.BOLD_SHADOW, [$FFFFFF], 0 );
176169 if InRange(Self.CurrentWorld, 301, 580) then Self.CurrentWorld := Result;
177170end;
178171
@@ -181,7 +174,7 @@ function TRSLoginWorldSwitcher.Find(world: Integer; out index: Integer): Boolean
181174begin
182175 repeat
183176 for index := 0 to High(Self.WorldBoxes) do
184- if OCR.RecognizeNumber(Self.WorldBoxes[index], Self.WorldOCRFilter, RSFonts.BOLD_12 ) = world then
177+ if OCR.RecognizeNumber(Self.WorldBoxes[index], OCR.BOLD, [$000000, $0000FF], 0 ) = world then
185178 Exit(True);
186179 until not Self.NextPage();
187180
249242 TRSLogin = record
250243 Lobby: TRSLoginLobby;
251244 WorldSwitcher: TRSLoginWorldSwitcher;
252-
253245 Bounds: TBox;
254- WhiteOCR, YellowOCR: TOCRColorFilter;
255246
256247 Inputs: array [ERSLoginInput] of TBox;
257248 Buttons: array [ERSLoginButton] of record
@@ -270,9 +261,6 @@ begin
270261 Self.WorldSwitcher.Setup();
271262 Self.Lobby.Setup();
272263
273- Self.WhiteOCR := TOCRColorFilter.Create([$FFFFFF]);
274- Self.YellowOCR := TOCRColorFilter.Create([$00FFFF]);
275-
276264 Self.Bounds.X1 := Target.Bounds.Width div 2 - 176;
277265 Self.Bounds.Y1 := Target.Bounds.Y1 + 172;
278266 Self.Bounds.X2 := Target.Bounds.Width div 2 + 176;
@@ -354,9 +342,9 @@ begin
354342 end;
355343
356344 if Self.Buttons[button].Bold then
357- Result := Self.Buttons[button].Text = OCR.Recognize(Self.Buttons[button].Bounds, Self.WhiteOCR, RSFonts.BOLD_12_SHADOW)
358- else
359- Result := Self.Buttons[button].Text = OCR.Recognize(Self.Buttons[button].Bounds, Self.WhiteOCR, RSFonts.PLAIN_12 );
345+ Exit( Self.Buttons[button].Text = OCR.Recognize(Self.Buttons[button].Bounds, OCR.BOLD_SHADOW, [$FFFFFF], 0));
346+
347+ Result := Self.Buttons[button].Text = OCR.Recognize(Self.Buttons[button].Bounds, OCR.PLAIN_12, [$FFFFFF], 0 );
360348end;
361349
362350function TRSLogin.ClickButton(button: ERSLoginButton): Boolean;
@@ -410,9 +398,9 @@ function TRSLogin.GetMessage(): ERSLoginMessage;
410398var
411399 dialog: String;
412400begin
413- dialog := OCR.RecognizeLines(Self.Bounds, Self.YellowOCR, RSFonts.BOLD_12_SHADOW ).Join(' ');
401+ dialog := OCR.RecognizeLines(Self.Bounds, OCR.BOLD_SHADOW, [$00FFFF], 0 ).Join(' ');
414402 if dialog = '' then
415- dialog := OCR.RecognizeLines(Self.Bounds, Self.WhiteOCR, RSFonts.BOLD_12_SHADOW ).Join(' ');
403+ dialog := OCR.RecognizeLines(Self.Bounds, OCR.BOLD_SHADOW, [$FFFFFF], 0 ).Join(' ');
416404 if dialog = '' then Exit;
417405
418406 for Result := ERSLoginMessage.WELCOME to High(ERSLoginMessage)-1 do
0 commit comments