def _doEnter(self): bsInternal._addTransaction( { 'type': 'IMPORT_PLAYLIST', 'expireTime': time.time() + 5, 'code': bs.textWidget(query=self._textField) }, callback=bs.WeakCall(self._onImportResponse)) bsInternal._runTransactions() bs.screenMessage(bs.Lstr(resource='importingText'))
def _cancelPress(self): if bs.getRealTime() - self._startTime < 1000: bs.playSound(bs.getSound('error')) return bsInternal._addTransaction({ 'type': 'DIALOG_RESPONSE', 'dialogID': self._dialogID, 'response': 0 }) bs.containerWidget(edit=self._rootWidget, transition='outScale')
def a(): bsInternal._addTransaction( { 'type': 'PUBLIC_PARTY_QUERY', 'proto': env['protocolVersion'], 'lang': bs.getLanguage() }, callback=lol) bsInternal._runTransactions() bs.realTimer(30000, a)
def _onCheatingPress(self): bsInternal._addTransaction({ 'type': 'REPORT_ACCOUNT', 'reason': 'cheating', 'account': self._accountID }) import urllib body = bs.Lstr(resource='reportPlayerExplanationText').evaluate() bs.openURL( 'mailto:[email protected]?subject=BombSquad Player Report: ' + self._accountID + '&body=' + urllib.quote(bs.utf8(body))) self.close()
def _generatePress(self): if bsInternal._getAccountState() != 'SIGNED_IN': bsUI.showSignInPrompt() return bs.screenMessage( bs.Lstr(resource='gatherWindow.requestingAPromoCodeText'), color=(0, 1, 0)) bsInternal._addTransaction({ 'type': 'ACCOUNT_LINK_CODE_REQUEST', 'expireTime': time.time() + 5 }) bsInternal._runTransactions()
def _awardLocalAchievement(ach): try: a = getAchievement(ach) if a is not None and not a.isComplete(): # report new achievements to the game-service.. bsInternal._reportAchievement(ach) # and to our account.. bsInternal._addTransaction({'type': 'ACHIEVEMENT', 'name': ach}) # now attempt to show a banner _displayBanner(ach) except Exception: bs.printException()
def fetchedDataCallBack(self, address, port, result): #print (address, port, result) global finalFetchedAddress finalFetchedAddress = address global finalFetchedPort finalFetchedPort = port if result is not None: env = bs.getEnvironment() try: bsInternal._addTransaction( { 'type': 'PUBLIC_PARTY_QUERY', 'proto': env['protocolVersion'], 'lang': bs.getLanguage() }, callback=bs.WeakCall(self._serverSynchronizer)) bsInternal._runTransactions() except Exception as e: print(e) if 1 < result < 100: self.pingStatusColor = (0, 1, 0) elif 100 < result < 500: self.pingStatusColor = (1, 1, 0) else: self.pingStatusColor = (1, 0, 0) if self._rootWidget.exists(): fadeToBack() bs.textWidget(edit=self.lt, text='') bs.textWidget(edit=self.pt, text='ping:') bs.textWidget(edit=self.pvt, text=str(result), color=self.pingStatusColor) if self.buttonChecker == False: self.sb = bs.buttonWidget( parent=self._rootWidget, autoSelect=True, position=(140, 125), size=(80, 20), textColor=(1.0, 1.0, 1.0), label=bs.Lstr(resource='statsText'), color=(0.356, 0.760, 0.905), onActivateCall=self._stats) self.ob = bs.buttonWidget( parent=self._rootWidget, autoSelect=True, position=(105, 15), size=(150, 50), color=(0.356, 0.760, 0.905), textColor=(1.0, 1.0, 1.0), label=bs.Lstr( resource='gatherWindow.manualConnectText'), onActivateCall=self._connect) self.buttonChecker = True else: if self._rootWidget.exists(): fadeToRed() if self.buttonChecker == True: self.sb.delete() self.ob.delete() self.buttonChecker = False bs.textWidget(edit=self.t, text='') bs.textWidget(edit=self.pt, text='') bs.textWidget(edit=self.pvt, text='') bs.textWidget(edit=self.ts, text='') bs.textWidget(edit=self.tvs, text='') bs.textWidget(edit=self.lt, text='SERVER OFFLINE', color=(1, 0, 0))