def setting_user_data2(): # 初始化 drive path = resource.resource_path('box64.dll') vid = 0xc230 pid = 0x6899 lib, handle = box_drive64.open_box(path, vid, pid) # 修改 pid 和 vid setting_user_data(lib, handle, encryption)
def modify_vid_pid2(): # 初始化 drive path = resource.resource_path('box64.dll') vid = 0xc216 pid = 0x0301 lib, handle = box_drive64.open_box(path, vid, pid) # 修改 pid 和 vid m_vid, m_pid = 0xc230, 0x6899 modify_vid_pid(lib, handle, m_vid, m_pid)
def __init__(self, job_file, pdf_file, job_title, onHandled, printer): super(Handler, self).__init__() self.job_file = job_file self.pdf_file = pdf_file self.job_title = job_title self.onHandled = onHandled self.printer = '%s%s' % ('%printer%', printer) self.exe_file = resource_path(os.path.join('gsview', 'gswin64c.exe')) pass
def init(): global _lib, _handle, _init_data, _init_weapon_name_data, _config_data # 初始化 drive path = resource.resource_path('box64.dll') if environment.env.usb_has_default == 1: vid = None pid = None _lib, _handle = box_drive64.init(path, vid, pid) else: vid = 0xc230 pid = 0x6899 _lib, _handle = box_drive64.init(path, vid, pid) box_drive64.mouse_move_r(_lib, _handle, 0, 200) logging.info('加载 drive 成功!') # 读取配置文件 if os.path.exists('data_config'): config_data_path = os.path.join(os.getcwd(), 'data_config') print('加载外部 data_config 配置文件..') else: print('加载exe data_config 配置文件..') config_data_path = resource.resource_path('data_config') _config_data = data_config_parser.parser(config_data_path) logging.info('加载 data_config 成功!') # 初始化 配件信息 parts_path = resource.resource_path(os.path.join('img', 'parts')) weapon_name_path = resource.resource_path( os.path.join('img', 'weapon_name')) _init_data = weapon.init_parts(parts_path) _init_weapon_name_data = weapon.init_weapon_name(weapon_name_path) logging.info('加载配件图片数据成功!') # 设置返回数据 return _lib, _handle, _init_data, _init_weapon_name_data
def __init__(self, nx_root=None, options_file=None, log_file=None, error_log_file=None, exe_file=None): super(NxproxyProc, self).__init__() self.exe_file = exe_file if exe_file else resource_path( os.path.join( 'nxproxy', 'nxproxy.exe')) #os.path.normpath('./nxproxy/nxproxy.exe') self.nx_root = nx_root if nx_root else './sessions' self.options_file = options_file if options_file else os.path.join( self.nx_root, 'options') self.error_log_file = error_log_file if error_log_file else os.path.join( self.nx_root, 'session.err') self.log_file = log_file if log_file else os.path.join( self.nx_root, 'session.log') #print(self.exe_file) self.proc = None
def ggame(self): pygame.init() # 定变量判断该退出游戏 game = True bg1 = pygame.image.load("%s" % resource_path(os.path.join("ImageTxtSource", "map_2.png"))) bg2 = pygame.image.load("%s" % resource_path(os.path.join("ImageTxtSource", "map_21.png"))) # 地图图片的x轴起始点 pos_x = 0 # 创建一个时钟实例 framerate = pygame.time.Clock() # 创建精灵实例 # 猪脚 role2 = MySprite(self.screen) role2.load("%s" % resource_path(os.path.join("ImageTxtSource", "ROLE_2.png")), 100, 140, 8) role2_dead = MySprite(self.screen) role2_dead.load('%s' % resource_path(os.path.join("ImageTxtSource", "roleDeaD.png")), 130, 130, 8) # boss boss = MySprite(self.screen) boss.load("%s" % resource_path(os.path.join("ImageTxtSource", "BossRunR.png")), 230, 440, 6) boss_dead = MySprite(self.screen) boss_dead.load("%s" % resource_path(os.path.join("ImageTxtSource", "BossDisappear.png")), 300, 300, 5) # 小箭头 tipp = MySprite(self.screen) tipp.load("%s" % resource_path(os.path.join("ImageTxtSource", "tipp.png")), 70, 100, 12) # 设置图片帧 role2.first_frame = 0 role2.last_frame = 7 # 设置位置 role2.position = 400, 350 boss.position = 10, 110 tipp.position = 115, 470 # 创建精灵组 group2man = pygame.sprite.Group() group2boss = pygame.sprite.Group() group2tipp = pygame.sprite.Group() # 将精灵加入组(加组顺序注意) group2man.add(role2) group2boss.add(boss) group2tipp.add(tipp) # 打开英文文本 f = open('%s' % resource_path(os.path.join("ImageTxtSource", "Englishtext.txt")), 'rb') # 打印屏幕的字符串切片索引初始值 idex = 0 # 初次加载屏幕上的字符串文字,前面加个w strTEXT = 'wwe always knew our daughter kendall was going be a performer' # ---------------------- 开始跑酷游戏循环 ---------------------------- while True: framerate.tick(60) ticks = pygame.time.get_ticks() # 读取英文文本 strr = f.readline() strr = strr.decode() start = len(strr) # 降低难度减少了很多条件,下面有些判断没有意义 # 判断键盘输入asscii码值和字符串第n个字符码值是否相等 if self.value == ord(strr[idex]): self.role2_movee = True # 如果当前字符串长度等于1,意味着这是字符串最后一个字符 if len(strr[idex::]) == 1: strTEXT = strr[idex:idex + 40] # 再次循环会获取下一行字符串 else: # 切出字符串重新赋值给要显示在屏幕上的字符串 strTEXT = strr[idex:idex + 40] idex += 1 # 保持角色位置 f.seek(-start, 1) # 匹配错误,回到开头位置再读字符串 else: f.seek(-start, 1) # 显示文本 # 创建字体 Myfont = pygame.font.SysFont("arial", 40) Myfont_2 = pygame.font.SysFont("arial", 26) # 英文句子文本 textimagee = Myfont.render(strTEXT[1::], True, (207, 95, 192)) # 得分文本 LastScore_scoreeimagee_timeeimagee = Myfont_2.render("SECONDS: " + str(self.timee), True, (1, 136, 251)) # ----------------------------------------------------------------------- # 将地图画在屏幕上 if pos_x >= -4800: self.screen.blit(bg1, (pos_x, 0)) pos_x += -4 else: self.screen.blit(bg1, (pos_x, 0)) self.screen.blit(bg2, (pos_x + 4800, 0)) pos_x += -4 if pos_x == -9600: pos_x = 0 # ------------------------- 角色移动 ------------------------ # 如果角色判断移动的变量为False,减X坐标 if not self.role2_movee: role2.X += -0.5 else: # 如果变量为True,角色x坐标加上n像素 role2.X += 10 # 移动完重新给判断角色移动变量赋予False self.role2_movee = False # ---------------------------- 游戏结束 ------------------------------------------- # 冲突检测 collide_list = pygame.sprite.spritecollideany(role2, group2boss) # 如果冲突 if collide_list: # 是跑酷游戏存活变量设为 False,同时主线程收到此信号 self.game = False # 将死亡角色设置为未死亡角色位置 role2_dead.position = role2.X, role2.Y # 替代角色动画帧 group2man.add(role2_dead) group2man.remove(role2) group2boss.remove(boss) group2boss.add(boss_dead) boss_dead.position = 10, 110 # -------------- 角色冲突不立即退出,刷新完死亡动画 ------------------- # 如果角色死亡角色帧在最后一帧 if role2_dead.frame == role2_dead.last_frame: self.screen.fill((50, 50, 100)) winimage = Myfont.render("Defeat !", True, (234, 32, 0)) qqq = 0 # 刷新显示分数n 遍再退出线程 while qqq < 6: self.screen.blit(winimage, (340, 250)) # 将退出提示画在屏幕右上角 self.screen.blit(self.ESCimage, (710, 0)) pygame.display.update() qqq += 1 time.sleep(0.1) self.game = True self.value = None self.role2_movee = False break # 如果boss死亡角色帧在最后一帧 if boss_dead.frame == boss_dead.last_frame: self.screen.fill((50, 50, 100)) winimage = Myfont.render("Defeat !", True, (234, 32, 0)) qqq = 0 # 刷新显示分数n 遍再退出线程 while qqq < 6: self.screen.blit(winimage, (340, 250)) # 将退出提示画在屏幕右上角 self.screen.blit(self.ESCimage, (710, 0)) pygame.display.update() qqq += 1 time.sleep(0.1) self.game = True self.value = None self.role2_movee = False break # 否则继续循环直到满足上述条件一种 # 如果角色达到右边界 if role2.X > 800: # 是跑酷游戏存活变量设为 False,同时主线程收到此信号 self.game = False self.screen.fill((50, 50, 100)) winimage = Myfont.render("Victory ! SECONDS: %s" % (str(self.timee)), True, (255, 255, 255)) qqq = 0 while qqq < 5: self.screen.blit(winimage, (250, 250)) # 将退出提示画在屏幕右上角 self.screen.blit(self.ESCimage, (710, 0)) pygame.display.update() qqq += 1 time.sleep(0.1) self.game = True self.value = None self.role2_movee = False break # ------------------------ 屏幕显示 --------------------------------------- # 将英文句子显示在屏幕 self.screen.blit(textimagee, (150, 550)) # 将得分显示在屏幕 self.screen.blit(LastScore_scoreeimagee_timeeimagee, (330, 0)) # 设置更新帧率 group2man.update(ticks, 70) group2boss.update(ticks, 160) group2tipp.update(ticks, 140) # 将精灵显示在屏幕 group2man.draw(self.screen) group2boss.draw(self.screen) group2tipp.draw(self.screen) # 将退出提示画在屏幕右上角 self.screen.blit(self.ESCimage, (710, 0)) pygame.display.update()
def __init__(self, is_full): self.is_full = is_full self.backgroundmusic = [resource_path(os.path.join("music", "beihanshatan.ogg")), \ resource_path(os.path.join("music", "biyougong.ogg")), \ resource_path(os.path.join("music", "guandaonanbei.ogg")), \ resource_path(os.path.join("music", "lanxianzheng.ogg")), \ resource_path(os.path.join("music", "lanxianzhengwai.ogg")), \ resource_path(os.path.join("music", "penglaidao.ogg")), \ resource_path(os.path.join("music", "qianyuanshan.ogg")), \ resource_path(os.path.join("music", "tianyongcheng.ogg")), \ resource_path(os.path.join("music", "wulongshan.ogg")), \ resource_path(os.path.join("music", "zhongnanshan.ogg"))] self.warmusic = [resource_path(os.path.join("music", "war1.ogg")), \ resource_path(os.path.join("music", "war2.ogg")), \ resource_path(os.path.join("music", "war3.ogg"))] pygame.init() # 设置全屏FULLSCREEN self.screen = pygame.display.set_mode((800, 600), self.is_full, 32) # 游戏图标(来源于网络,data2敌法师) ICO = pygame.image.load("%s" % resource_path(os.path.join("ImageTxtSource", "ICO.png"))).convert_alpha() pygame.display.set_icon(ICO) # 鼠标指针图标 self.mousee = pygame.image.load( "%s" % resource_path(os.path.join("ImageTxtSource", "mousee.png"))).convert_alpha() self.width, self.height = self.mousee.get_size() self.mousee = pygame.transform.smoothscale(self.mousee, (self.width // 6, self.height // 6)) # 隐藏鼠标 pygame.mouse.set_visible(False) # 跑酷游戏是否结束的变量 self.game = True # 跑酷游戏内角色是否'移动'的判断的变量 self.role2_movee = False # 用于记录跑酷游戏内键盘输入的字符的asscii码值 self.value = None # 跑酷计时初始值 self.timee = 0 # 定义一种字体,显示退出提示 Myfont_3 = pygame.font.SysFont("arial", 20) self.ESCimage = Myfont_3.render("ESC to exit", True, (234, 32, 0)) while True: # 随机加载一个背景音乐 MusicRandomResult = random.choice(range(0, 10)) # 淡出播放时间 pygame.mixer.music.fadeout(1000) # 加载音乐 pygame.mixer.music.load(self.backgroundmusic[MusicRandomResult]) pygame.mixer.music.set_volume(0.7) pygame.mixer.music.play(10) # 调用主界面 self.Main_interfa() # 初始化变量self.game,循环外变量在游戏过程中实时会被改变,不放进循环 # 游戏主进程退出到主界面前会将设为False,再次进入游戏前将其设为True self.game = True # 初始化游戏时间 self.timee = 0 # 随机加载一个背景音乐 MusicRandomResult = random.choice(range(0, 3)) pygame.mixer.music.load(self.warmusic[MusicRandomResult]) # 淡出播放时间 pygame.mixer.music.fadeout(1000) # 加载音乐 pygame.mixer.music.load(self.warmusic[MusicRandomResult]) pygame.mixer.music.set_volume(0.7) pygame.mixer.music.play(10) # 调用跑酷游戏 self.gamestart()
def info_box(self, title, message): msg = QMessageBox(QMessageBox.Information, title, message, QMessageBox.Ok) msg.setWindowIcon(QIcon(resource_path('icon.ico'))) msg.exec_()
def invalid_input(self, message): msg = QMessageBox(QMessageBox.Warning, "Invalid Input", message, QMessageBox.Ok) msg.setWindowIcon(QIcon(resource_path('icon.ico'))) msg.exec_() return False
配置文件 path :param path: :return: """ data_object_arr = {} for file_name in os.listdir(path): config = open(os.path.join(path, file_name), encoding='utf-8') config_data = json.load(config) data_object = data_config_object.Data() data_object.name = config_data['name'] data_object.left_right_correction = config_data[ 'left_right_correction'] data_object.speed = config_data['speed'] data_object.muzzle = config_data['muzzle'] data_object.grip = config_data['grip'] data_object.clip = config_data['clip'] data_object.butt = config_data['butt'] data_object.sight = config_data['sight'] # print('data_object -> {}'.format(data_object)) filed = file_name.replace('.json', '') data_object_arr[filed] = data_object print('加载配置 ->{}'.format(file_name)) return data_object_arr if __name__ == '__main__': path = resource.resource_path('data_config') parser(path)
def LLocalfindci(ci): f = open('%s'\ %resource_path(os.path.join("localdirsource","DIR.txt")),'rb') f.seek(0, 0) #实际X if ci[0].lower() > "x" or ci[0].lower() == 'x': f.seek(20531459, 0) ##循环读字节数区间内的每行进行正则表达式判断,匹配成功则指针返回开头、结束循环 while True: # print('0000000') line = f.readline().decode() rresult = re.findall('"%s\\r\\n' % ci, line) if rresult: # print(rresult) #跳过第一行 line = f.readline().decode() #初始化一个字符串 StrResult = '' #检索单词成功后检索单词意义结束位置并返回字符串 while True: line = f.readline().decode() line2 = line[::-1] rresult = re.findall('\\n\\r;;"', line2) if not rresult: StrResult += line else: StrResult += line f.seek(0, 0) f.close() return StrResult else: if f.tell() > 20625884: # print('没有记录') f.seek(0, 0) break else: #实际T #为True跳到T的索引,文本没有t if ci[0].lower() > "t" or ci[0].lower() == "t": f.seek(18105744, 0) ## while True: # print('1111111') line = f.readline().decode() rresult = re.findall('"%s\\r\\n' % ci, line) if rresult: # print(rresult) #跳过第一行 line = f.readline().decode() #初始化一个字符串 StrResult = '' #检索单词成功后检索单词意义结束位置并返回字符串 while True: line = f.readline().decode() line2 = line[::-1] rresult = re.findall('\\n\\r;;"', line2) if not rresult: StrResult += line else: StrResult += line f.seek(0, 0) f.close() return StrResult else: if f.tell() > 20531459: # print('没有记录') f.seek(0, 0) break else: #实际Q if ci[0].lower() > "q" or ci[0].lower() == "q": f.seek(14395319, 0) ## while True: # print('33333333') line = f.readline().decode() rresult = re.findall('"%s\\r\\n' % ci, line) if rresult: # print(rresult) #跳过第一行 line = f.readline().decode() #初始化一个字符串 StrResult = '' #检索单词成功后检索单词意义结束位置并返回字符串 while True: line = f.readline().decode() line2 = line[::-1] rresult = re.findall('\\n\\r;;"', line2) if not rresult: StrResult += line else: StrResult += line f.seek(0, 0) f.close() return StrResult else: if f.tell() > 18105744: # print('没有记录') f.seek(0, 0) break else: continue else: #实际m if ci[0].lower() > 'm' or ci[0].lower() == 'm': f.seek(10675521, 0) ## while True: # print('44444444') line = f.readline().decode() rresult = re.findall('"%s\\r\\n' % ci, line) if rresult: # print(rresult) #跳过第一行 line = f.readline().decode() #初始化一个字符串 StrResult = '' #检索单词成功后检索单词意义结束位置并返回字符串 while True: line = f.readline().decode() line2 = line[::-1] rresult = re.findall('\\n\\r;;"', line2) if not rresult: StrResult += line else: StrResult += line f.seek(0, 0) f.close() return StrResult else: if f.tell() > 14395319: # print('没有记录') f.seek(0, 0) break else: continue else: #实际I if ci[0].lower() > "i" or ci[0].lower() == 'i': f.seek(8904612, 0) ## while True: # print('555555555') line = f.readline().decode() rresult = re.findall('"%s\\r\\n' % ci, line) if rresult: # print(rresult) #跳过第一行 line = f.readline().decode() #初始化一个字符串 StrResult = '' #检索单词成功后检索单词意义结束位置并返回字符串 while True: line = f.readline().decode() line2 = line[::-1] rresult = re.findall('\\n\\r;;"', line2) if not rresult: StrResult += line else: StrResult += line f.seek(0, 0) f.close() return StrResult else: if f.tell() > 10675521: # print('没有记录') f.seek(0, 0) break else: continue else: #实际F if ci[0].lower() > "f" or ci[0].lower() == 'f': f.seek(6378372, 0) ## while True: # print('666666666') line = f.readline().decode() rresult = re.findall('"%s\\r\\n' % ci, line) if rresult: # print(rresult) #跳过第一行 line = f.readline().decode() #初始化一个字符串 StrResult = '' #检索单词成功后检索单词意义结束位置并返回字符串 while True: line = f.readline().decode() line2 = line[::-1] rresult = re.findall( '\\n\\r;;"', line2) if not rresult: StrResult += line else: StrResult += line f.seek(0, 0) f.close() return StrResult else: if f.tell() > 8904612: # print('没有记录') f.seek(0, 0) break else: continue else: #实际C if ci[0].lower() > "c" or ci[0].lower() == "c": f.seek(2469170, 0) ## while True: # print('77777777') line = f.readline().decode() rresult = re.findall( '"%s\\r\\n' % ci, line) if rresult: # print(rresult) #跳过第一行 line = f.readline().decode() #初始化一个字符串 StrResult = '' #检索单词成功后检索单词意义结束位置并返回字符串 while True: line = f.readline().decode() line2 = line[::-1] rresult = re.findall( '\\n\\r;;"', line2) if not rresult: StrResult += line else: StrResult += line f.seek(0, 0) f.close() return StrResult else: if f.tell() > 6378372: # print('没有记录') f.seek(0, 0) break else: continue else: f.seek(0, 0) ## while True: # print('88888888') line = f.readline().decode() rresult = re.findall( '"%s\\r\\n' % ci, line) if rresult: # print(rresult) #跳过第一行 line = f.readline().decode() #初始化一个字符串 StrResult = '' #检索单词成功后检索单词意义结束位置并返回字符串 while True: line = f.readline().decode() line2 = line[::-1] rresult = re.findall( '\\n\\r;;"', line2) if not rresult: StrResult += line else: StrResult += line f.seek(0, 0) f.close() return StrResult else: if f.tell() > 2469170: # print('没有记录') f.seek(0, 0) break else: continue f.close()
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(730, 580) MainWindow.setFixedSize(730, 580) MainWindow.setWindowIcon(QtGui.QIcon(resource_path('icon.ico'))) MainWindow.setWindowTitle("Discord Rich Presence Customizer") self.centralwidget = QtWidgets.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.updateButton = QtWidgets.QPushButton(self.centralwidget) self.updateButton.setGeometry(QtCore.QRect(310, 510, 101, 23)) self.updateButton.setObjectName("updateButton") self.groupBox = QtWidgets.QGroupBox(self.centralwidget) self.groupBox.setGeometry(QtCore.QRect(10, 10, 711, 471)) self.groupBox.setTitle("") self.groupBox.setObjectName("groupBox") self.gridLayoutWidget = QtWidgets.QWidget(self.groupBox) self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 10, 691, 451)) self.gridLayoutWidget.setObjectName("gridLayoutWidget") self.gridLayout = QtWidgets.QGridLayout(self.gridLayoutWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 6, 1, 1, 1) self.endTimeEdit = QtWidgets.QDateTimeEdit(self.gridLayoutWidget) self.endTimeEdit.setEnabled(False) self.endTimeEdit.setDateTime(QtCore.QDateTime(QtCore.QDate(2020, 1, 1), QtCore.QTime(1, 0, 0))) self.endTimeEdit.setCalendarPopup(True) self.endTimeEdit.setTimeSpec(QtCore.Qt.LocalTime) self.endTimeEdit.setObjectName("endTimeEdit") self.gridLayout.addWidget(self.endTimeEdit, 4, 2, 1, 1) spacerItem1 = QtWidgets.QSpacerItem(120, 20, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem1, 1, 1, 1, 1) spacerItem2 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem2, 12, 1, 1, 1) spacerItem3 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem3, 9, 1, 1, 1) self.startTimeCheck = QtWidgets.QCheckBox(self.gridLayoutWidget) self.startTimeCheck.setObjectName("startTimeCheck") self.gridLayout.addWidget(self.startTimeCheck, 3, 0, 1, 1) self.partyMaxLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.partyMaxLabel.setObjectName("partyMaxLabel") self.gridLayout.addWidget(self.partyMaxLabel, 13, 2, 1, 1) self.largeImageKeyEdit = QtWidgets.QLineEdit(self.gridLayoutWidget) self.largeImageKeyEdit.setObjectName("largeImageKeyEdit") self.gridLayout.addWidget(self.largeImageKeyEdit, 8, 0, 1, 1) self.smallImageTextEdit = QtWidgets.QLineEdit(self.gridLayoutWidget) self.smallImageTextEdit.setObjectName("smallImageTextEdit") self.gridLayout.addWidget(self.smallImageTextEdit, 11, 2, 1, 1) self.startTimeEdit = QtWidgets.QDateTimeEdit(self.gridLayoutWidget) self.startTimeEdit.setEnabled(False) self.startTimeEdit.setDateTime(QtCore.QDateTime(QtCore.QDate(2020, 1, 1), QtCore.QTime(0, 0, 0))) self.startTimeEdit.setCalendarPopup(True) self.startTimeEdit.setTimeSpec(QtCore.Qt.LocalTime) self.startTimeEdit.setObjectName("startTimeEdit") self.gridLayout.addWidget(self.startTimeEdit, 4, 0, 1, 1) self.largeImageTextLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.largeImageTextLabel.setObjectName("largeImageTextLabel") self.gridLayout.addWidget(self.largeImageTextLabel, 7, 2, 1, 1) self.largeImageKeyLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.largeImageKeyLabel.setObjectName("largeImageKeyLabel") self.gridLayout.addWidget(self.largeImageKeyLabel, 7, 0, 1, 1) self.stateLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.stateLabel.setObjectName("stateLabel") self.gridLayout.addWidget(self.stateLabel, 0, 0, 1, 1) self.smallImageKeyEdit = QtWidgets.QLineEdit(self.gridLayoutWidget) self.smallImageKeyEdit.setObjectName("smallImageKeyEdit") self.gridLayout.addWidget(self.smallImageKeyEdit, 11, 0, 1, 1) self.partyMaxEdit = QtWidgets.QSpinBox(self.gridLayoutWidget) self.partyMaxEdit.setObjectName("partyMaxEdit") self.gridLayout.addWidget(self.partyMaxEdit, 14, 2, 1, 1) self.stateEdit = QtWidgets.QLineEdit(self.gridLayoutWidget) self.stateEdit.setObjectName("stateEdit") self.gridLayout.addWidget(self.stateEdit, 1, 0, 1, 1) self.partySizeEdit = QtWidgets.QSpinBox(self.gridLayoutWidget) self.partySizeEdit.setObjectName("partySizeEdit") self.gridLayout.addWidget(self.partySizeEdit, 14, 0, 1, 1) self.largeImageTextEdit = QtWidgets.QLineEdit(self.gridLayoutWidget) self.largeImageTextEdit.setObjectName("largeImageTextEdit") self.gridLayout.addWidget(self.largeImageTextEdit, 8, 2, 1, 1) self.detailsLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.detailsLabel.setObjectName("detailsLabel") self.gridLayout.addWidget(self.detailsLabel, 0, 2, 1, 1) self.detailsEdit = QtWidgets.QLineEdit(self.gridLayoutWidget) self.detailsEdit.setObjectName("detailsEdit") self.gridLayout.addWidget(self.detailsEdit, 1, 2, 1, 1) self.smallImageKeyLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.smallImageKeyLabel.setObjectName("smallImageKeyLabel") self.gridLayout.addWidget(self.smallImageKeyLabel, 10, 0, 1, 1) self.smallImageTextLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.smallImageTextLabel.setObjectName("smallImageTextLabel") self.gridLayout.addWidget(self.smallImageTextLabel, 10, 2, 1, 1) self.endTimeCheck = QtWidgets.QCheckBox(self.gridLayoutWidget) self.endTimeCheck.setObjectName("endTimeCheck") self.gridLayout.addWidget(self.endTimeCheck, 3, 2, 1, 1) self.partySizeLabel = QtWidgets.QLabel(self.gridLayoutWidget) self.partySizeLabel.setObjectName("partySizeLabel") self.gridLayout.addWidget(self.partySizeLabel, 13, 0, 1, 1) spacerItem4 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem4, 2, 1, 1, 1) self.autoStartTimeCheck = QtWidgets.QCheckBox(self.gridLayoutWidget) self.autoStartTimeCheck.setEnabled(False) self.autoStartTimeCheck.setObjectName("autoStartTimeCheck") self.gridLayout.addWidget(self.autoStartTimeCheck, 5, 0, 1, 1) self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget) self.verticalLayoutWidget.setGeometry(QtCore.QRect(20, 490, 160, 41)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.appIdLabel = QtWidgets.QLabel(self.verticalLayoutWidget) self.appIdLabel.setObjectName("appIdLabel") self.verticalLayout.addWidget(self.appIdLabel) self.appIdEdit = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.appIdEdit.setObjectName("appIdEdit") self.verticalLayout.addWidget(self.appIdEdit) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 731, 21)) self.menubar.setObjectName("menubar") self.menuHelp = QtWidgets.QMenu(self.menubar) self.menuHelp.setObjectName("menuHelp") self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile.setObjectName("menuFile") MainWindow.setMenuBar(self.menubar) self.statusbar = QtWidgets.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.actionGitHub_Wiki = QtWidgets.QAction(MainWindow) self.actionGitHub_Wiki.setObjectName("actionGitHub_Wiki") self.actionDeveloper_Portal = QtWidgets.QAction(MainWindow) self.actionDeveloper_Portal.setObjectName("actionDeveloper_Portal") self.actionAbout_Discord_RPC = QtWidgets.QAction(MainWindow) self.actionAbout_Discord_RPC.setObjectName("actionAbout_Discord_RPC") self.actionComing_Soon = QtWidgets.QAction(MainWindow) self.actionComing_Soon.setEnabled(False) self.actionComing_Soon.setObjectName("actionComing_Soon") self.menuHelp.addAction(self.actionGitHub_Wiki) self.menuHelp.addAction(self.actionDeveloper_Portal) self.menuHelp.addSeparator() self.menuHelp.addAction(self.actionAbout_Discord_RPC) self.menuFile.addAction(self.actionComing_Soon) self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuHelp.menuAction()) self.retranslateUi(MainWindow) self.bind_signals() self.set_datetimes() QtCore.QMetaObject.connectSlotsByName(MainWindow)
def play_open(): path = resource.resource_path(os.path.join('pm3', 'snap1.ogg')) winsound.PlaySound(path, flags=1)
logging.info("==========================================================") logging.info(" 欢迎使用 Box USB 驱动小精灵") logging.info("") logging.info(" F6自动[步枪] F7自动[狙击] End 关闭功能") logging.info(" [切换功能]先 End 关闭当前功能.") logging.info("==========================================================") # 入口 if __name__ == '__main__': try: # 设置 logging 级别 logging.basicConfig(level=environment.env.logging_level) # 加载 box 驱动文件 drive_path = resource.resource_path('box64.dll') if environment.env.usb_has_default == 2: lib, handle = box_drive64.inmmit(drive_path, None, None) else: lib, handle = box_drive64.init(drive_path, environment.env.usb_vid, environment.env.usb_pid) # 设置 box 驱动 _systemContext.box_lib = lib _systemContext.box_handle = handle _systemContext.box_handle64 = handle # 初始化 截屏 _systemContext.capture = image_util.capture(None) # 打印 banner
def get_music(*names, **kwds): """Return the full pathname of a music file from the "music" resource subdirectory.""" prefix = kwds.pop('prefix', "music") return resource_path(prefix, *names)
def fix_fuzz(*args): Window.size = (Window.width, self.small_height) def enable_help(*args): self.root.ids.help_button.disabled = False Clock.schedule_once(fix_fuzz, .6) Clock.schedule_once(enable_help, 1) def run_emul(self): if Switcher.switch_to_target(): Emulator.emulate() self.info("Completed") else: self.info("Failed to load browser tab!") def on_start(self, *args): register_topmost(Window, TITLE) TITLE = 'Datelbot' if __name__ == '__main__' or 'main': Window.set_icon(resource_path('img/icon.ico')) Window.set_title(TITLE) kivy.resources.resource_add_path(resource_path()) datelbot = DatelbotApp() datelbot.run()
res = 'prostrate' break return res """ ////////////////// 检查是否开镜 ////////////////// """ if __name__ == '__main__': # path = resource.resource_path(os.path.join('img', 'screenshot', '20190423175051_1.jpg')) # path = resource.resource_path(os.path.join('img', 'screenshot', '20190424225757_1.jpg')) # path = resource.resource_path(os.path.join('img', 'screenshot', '20190425100723_1.jpg')) path = resource.resource_path( os.path.join('img', 'screenshot', '20190425100717_1.jpg')) # path = resource.resource_path(os.path.join('img', 'screenshot', '20190425100714_1.jpg')) img = Image.open(path) # positions = package_positions() # position_images = package_positions_images(img, positions) # has_package = has_package_page(position_images) # positions = shoot_positions() # position_images = shoot_images(img, positions) # has_shoot = check_shoot(position_images) now = time.time() positions = stance_positions() position_images = stance_images(img, positions) has_stance = check_stance(position_images)
def Main_interfa(self): pygame.init() # 背景图片 background = pygame.image.load( '%s' % resource_path(os.path.join("ImageTxtSource", "map_1.png"))).convert_alpha() pygame.display.set_caption("破碎之剑") font = pygame.font.SysFont("arial", 18) # 定义一个时钟实例 framerate = pygame.time.Clock() # 创建精灵实例 # 角色 role = MySprite(self.screen) role.load("%s" % resource_path(os.path.join("ImageTxtSource", "ROLE_.png")), 130, 140, 8) chicken = MySprite(self.screen) chicken.load("%s" % resource_path(os.path.join("ImageTxtSource", "ji006.png")), 50, 47, 15) fire = MySprite(self.screen) fire.load("%s" % resource_path(os.path.join("ImageTxtSource", "fire001.png")), 30, 100, 8) fire2 = MySprite(self.screen) fire2.load("%s" % resource_path(os.path.join("ImageTxtSource", "fire001.png")), 30, 100, 8) sword = MySprite(self.screen) sword.load("%s" % resource_path(os.path.join("ImageTxtSource", "sword.png")), 24, 100, 9) boss0 = MySprite(self.screen) boss0.load("%s" % resource_path(os.path.join("ImageTxtSource", "BosStand.png")), 196, 190, 4) # 选帧 fire2.first_frame = 2 # 从位图第几张开始,起始索引为0 fire2.last_frame = 4 # 位图第几张位图结束 fire.first_frame = 2 fire.last_frame = 4 # 设置位置 chicken.position = 650, 452 fire.position = 360, 315 fire2.position = 263, 290 role.position = 0, 335 sword.position = 410, 190 boss0.position = 525, 0 # 创建精灵组 group = pygame.sprite.Group() group1 = pygame.sprite.Group() group2 = pygame.sprite.Group() # 将精灵加入组 group1.add(chicken) group1.add(fire) group1.add(fire2) group1.add(sword) group2.add(boss0) group.add(role) # 局部变量判断 Main_interface = True role_moving = False player_health = 0 # 第一次运行如果没有鼠标事件,则初始一个参数给下面 mouse_x, mouse_y = 400, 320 # ------------- 开始游戏主界面循环(方向只有上下左右) ------------------------ while True: framerate.tick(15) ticks = pygame.time.get_ticks() # 接收键盘事件 for event in pygame.event.get(): keys = pygame.key.get_pressed() if event.type == pygame.QUIT: sys.exit() # 上下左右 elif keys[K_UP] or keys[K_w]: role.direction = 1 elif keys[K_RIGHT] or keys[K_d]: role.direction = 6 elif keys[K_DOWN] or keys[K_s]: role.direction = 8 elif keys[K_LEFT] or keys[K_a]: role.direction = 5 else: # 玩家静止 role.direction = 0 # 接收鼠标当前悬浮位置 if event.type == MOUSEMOTION: mouse_x, mouse_y = event.pos # 键盘输入esc退出 key = pygame.key.get_pressed() if key[pygame.K_ESCAPE]: exit() # -------------- 主界面存活 ------------------------- if Main_interface: # 角色的状态帧的起点终点取决于方向direction role.first_frame = role.direction * role.columns role.last_frame = role.first_frame + role.columns - 1 # ??? if role.frame < role.first_frame: role.frame = role.first_frame # 算出移动距离, 实施移动玩家坐标, 移动距离和 方向 和 速度(速度定义为V, 单位帧移动像素距离) 有关 V = 7 if role.direction == 1: role.Y += -V elif role.direction == 5: role.X += -V elif role.direction == 6: role.X += V elif role.direction == 8: role.Y += V # (地图边界)(移动后的X和Y坐标如果大于地图边界,设置保持原来位置) if (role.X > 394 and role.Y < 335) or \ (role.X < 394 and role.Y < 264) or \ (role.X > 394 and role.Y > 335) or \ (role.X < 0) or \ (role.Y > 500): if role.direction == 1: role.Y += V elif role.direction == 5: role.X += V elif role.direction == 6: role.X += -V elif role.direction == 8: role.Y += -V # (守护者区域)(进入圣剑守护神区域) if role.X > 230 and role.X < 394 and role.Y < 266: Main_interface = False # 更新玩家精灵组 # ??? group.update(ticks, 50) # ------------ 主界面死亡 --------------------- else: # 结束当前循环,进入下一个循环 break # 将地图画在屏幕上 self.screen.blit(background, (0, 0)) # 设置更新帧率 group.update(ticks) group1.update(ticks, 90) group2.update(ticks, 120) # 将精灵画在屏幕上 group1.draw(self.screen) group2.draw(self.screen) group.draw(self.screen) # 将退出提示画在屏幕右上角 self.screen.blit(self.ESCimage, (710, 0)) # 将鼠标图片画在屏幕上,参数是试的 self.screen.blit(self.mousee, (mouse_x - self.width // 2 / 5, mouse_y - self.height // 2 / 5)) pygame.display.update()
def get_music(*names, **kwds): """Return the full pathname of a music file from the "music" resource subdirectory.""" prefix = kwds.pop('prefix', "music") return resource_path(prefix, *names)
def __init__(self, exe_file=None, log_file=None): self.exe_file = exe_file if exe_file else resource_path( os.path.join('vcxsrv', 'vcxsrv.exe')) #self.log_file = log_file if log_file else os.path.join(self.nx_root, 'session.log') self.log_file = log_file if log_file else 'nul'