Update GameHelper.py
This commit is contained in:
parent
5057b0dfa9
commit
3a7a94d11f
|
@ -384,69 +384,3 @@ class GameHelper:
|
||||||
else:
|
else:
|
||||||
clickMap.append(1)
|
clickMap.append(1)
|
||||||
QtWidgets.QApplication.processEvents(QEventLoop.AllEvents, 10)
|
QtWidgets.QApplication.processEvents(QEventLoop.AllEvents, 10)
|
||||||
|
|
||||||
|
|
||||||
# for file in os.listdir("pics"):
|
|
||||||
# info = file.split(".")
|
|
||||||
# if info[1] == "png":
|
|
||||||
# tmpImage = Image.open("pics/" + file)
|
|
||||||
# imgBGR = cv2.imread("pics/" + file)
|
|
||||||
# Pics.update({info[0]: tmpImage})
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
mp.freeze_support()
|
|
||||||
class A:
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
Pics = {}
|
|
||||||
PicsCV = {}
|
|
||||||
Handle = win32gui.FindWindow("Hlddz", None)
|
|
||||||
form = A()
|
|
||||||
form.MyHandCardsPos = (250, 764, 1141, 70) # 我的截图区域
|
|
||||||
form.LPlayedCardsPos = (463, 355, 380, 250) # 左边截图区域
|
|
||||||
form.RPlayedCardsPos = (946, 355, 380, 250) # 右边截图区域
|
|
||||||
form.LandlordFlagPos = [(1281, 276, 110, 140), (267, 695, 110, 140), (424, 237, 110, 140)] # 地主标志截图区域(右-我-左)
|
|
||||||
form.ThreeLandlordCardsPos = (753, 32, 287, 136) # 地主底牌截图区域,resize成349x168
|
|
||||||
form.PassBtnPoss = (686, 659, 419, 100)
|
|
||||||
GameHelper = GameHelper()
|
|
||||||
# img, _ = GameHelper.Screenshot()
|
|
||||||
img = Image.open(r"C:\Users\q9294\Desktop\cardselect.png")
|
|
||||||
img2 = Image.open(r"pics/card_corner.png")
|
|
||||||
img = img.resize((1796, 1047))
|
|
||||||
# imgcv = cv2.cvtColor(np.asarray(img), cv2.COLOR_RGB2BGR)
|
|
||||||
# st = time.time()
|
|
||||||
# re = LocateOnImage(imgcv, GameHelper.PicsCV["card_edge"], region=None, confidence=0.999)
|
|
||||||
# print(re)
|
|
||||||
# print(time.time()-st)
|
|
||||||
# st = time.time()
|
|
||||||
# re = pyautogui.locate(needleImage=GameHelper.Pics["card_edge"], haystackImage=img, confidence=0.9)
|
|
||||||
# print(re)
|
|
||||||
# print(time.time()-st)
|
|
||||||
# st = time.time()
|
|
||||||
img, _ = GameHelper.Screenshot()
|
|
||||||
cards, _= GameHelper.GetCards(img)
|
|
||||||
# cards = "".join([i[0] for i in cards])
|
|
||||||
print(cards)
|
|
||||||
print(len(cards))
|
|
||||||
# et = time.time()
|
|
||||||
# print(et - st)
|
|
||||||
# pos2 = pyautogui.locate(needleImage=Pics["card_edge"], haystackImage=img, confidence=0.9)
|
|
||||||
# pos = FindImage(img, PicsCV["card_corner"], threshold=0.7)
|
|
||||||
# print(pos)
|
|
||||||
# print(pos2)
|
|
||||||
# for p in pos:
|
|
||||||
# img = DrawRectWithText(img, (p[0], p[1], 50, 50), "p1")
|
|
||||||
# img = DrawRectWithText(img, (pos2[0], pos2[1], 50, 50), "p2")
|
|
||||||
# img = DrawRectWithText(img, (sx+50*i, sy-checkSelect*25,sw,sh), c)
|
|
||||||
# img = DrawRectWithText(img, form.LPlayedCardsPos, "LPlayed")
|
|
||||||
# img = DrawRectWithText(img, form.RPlayedCardsPos, "RPlayed")
|
|
||||||
# img = DrawRectWithText(img, form.MyHandCardsPos, "MyCard")
|
|
||||||
# img = DrawRectWithText(img, form.ThreeLandlordCardsPos, "ThreeLLCPos")
|
|
||||||
# img = DrawRectWithText(img, form.LandlordFlagPos[0], "RFlag")
|
|
||||||
# img = DrawRectWithText(img, form.LandlordFlagPos[1], "MyFlag")
|
|
||||||
# img = DrawRectWithText(img, form.LandlordFlagPos[2], "LFlag")
|
|
||||||
# img = DrawRectWithText(img, form.PassBtnPoss, "Btns")
|
|
||||||
# ShowImg(img)
|
|
||||||
exit()
|
|
||||||
|
|
Loading…
Reference in New Issue