def isMatch(cls, img: np.ndarray):
     title = api.loadImageByKey('TeamSelection', 'title')
     cancelConfirm = api.loadImageByKey('TeamSelection', 'cancelConfirm')
     match = api.identifyLocation(img, title)
     if match is None: return False
     if not api.isAround(match, (287, 137)): return False
     match = api.identifyLocation(img, cancelConfirm)
     if match is None: return False
     if not api.isAround(match, (1087, 662)): return False
     return True
 def isMatch(cls, img: np.ndarray):
     title = api.loadImageByKey('autoCombatSetting', 'title')
     text = api.loadImageByKey('autoCombatSetting', 'infoText')
     buttonConfirm = api.loadImageByKey('autoCombatSetting', 'confirm')
     match = api.identifyLocation(img, title)
     if match is None: return False
     if not api.isAround(match, (361, 122)): return False
     match = api.identifyLocation(img, text, 3)
     if match is None: return False
     #if not api.isAround(match, (408, 602)): return False
     match = api.identifyLocation(img, buttonConfirm)
     if match is None: return False
     if not api.isAround(match, (992, 602)): return False
     return True
 def isMatch(cls, img: np.ndarray):
     text = api.loadImageByKey('combat', 'text')
     iconGK = api.loadImageByKey('combat', 'iconGK')
     buttonReturn = api.loadImageByKey('combat', 'buttonReturn')
     match = api.identifyLocation(img, text)
     if match is None: return False
     if not api.isAround(match, (247, 52)): return False
     match = api.identifyLocation(img, iconGK)
     if match is None: return False
     if not api.isAround(match, (96, 634)): return False
     match = api.identifyLocation(img, buttonReturn)
     if match is None: return False
     if not api.isAround(match, (73, 49)): return False
     return True
 def isMatch(cls, img: np.ndarray):
     t = api.loadImageByKey('base', 'buttonCombat')
     c, v = image.matchTemplateExact(img, t)
     if v >= 5 or (not api.isAround(c, (924, 535))):
         return False
     t = api.loadImageByKey('base', 'iconMoreResource')
     c, v = image.matchTemplateExact(img, t)
     if v >= 5 or (not api.isAround(c, (1252, 28))):
         return False
     t = api.loadImageByKey('base', 'playerName')
     c, v = image.matchTemplateExact(img, t)
     if v >= 5 or (not api.isAround(c, (144, 33))):
         return False
     t = api.loadImageByKey('base', 'iconStore')
     c, v = image.matchTemplateExact(img, t)
     if v >= 5 or (not api.isAround(c, (902, 728))):
         return False
     return True
 def isMatch(cls, img: np.ndarray):
     title = api.loadImageByKey('combatSetting', 'title')
     text = api.loadImageByKey('combatSetting', 'text')
     buttonAuto = api.loadImageByKey('combatSetting', 'buttonAutoCombat')
     buttonNormal = api.loadImageByKey('combatSetting',
                                       'buttonNormalCombat')
     match = api.identifyLocation(img, title)
     if match is None: return False
     if not api.isAround(match, (359, 122)): return False
     match = api.identifyLocation(img, text)
     if match is None: return False
     if not api.isAround(match, (408, 602)): return False
     match = api.identifyLocation(img, buttonAuto)
     if match is None: return False
     if not api.isAround(match, (682, 603)): return False
     match = api.identifyLocation(img, buttonNormal)
     if match is None: return False
     if not api.isAround(match, (883, 602)): return False
     return True
示例#6
0
import image
import api

im = image.loadImage('test\\resource\\auto1_2_select_team.png')
t = api.loadImageByKey('TeamSelection', 'tag2Selected')

center, v = image.matchTemplateExact(im, t)
tsize = image.getImageSize(t)
pt1 = (center[0] - tsize[0] // 2, center[1] - tsize[1] // 2)
pt2 = (center[0] + tsize[0] // 2, center[1] + tsize[1] // 2)
rst = image.drawBox(im, pt1, pt2)
image.showImage(rst)
image.waitKeyboard()
image.releaseAllWindows()
print(center)
print(v)
 def hasEmptySlot(cls, img):
     slot = api.loadImageByKey('autoCombatSetting', 'emptySlot')
     match = api.identifyLocation(img, slot, 2)
     if match is None: return False
 def getButtonMap1_2(cls, img):
     button = api.loadImageByKey('combat', 'buttonBattle1-2')
     match = api.identifyLocation(img, button)
     return match
 def Team2Selected(self, img):
     tag2Sel = api.loadImageByKey('TeamSelection', 'tag2Selected')
     match = api.identifyLocation(img, tag2Sel, 3)
     return match
 def Team2(cls, img):
     tag2 = api.loadImageByKey('TeamSelection', 'tag2')
     match = api.identifyLocation(img, tag2, 3)
     return match