def adminKick(self, popupWindow, choice): def getIndex(): for i in bsInternal._getGameRoster(): if i["clientID"] == self._popupPartyMemberClientID: return bsInternal._getGameRoster().index(i) if choice == "kick": if self._popupPartyMemberIsHost: bs.playSound(bs.getSound('error')) bs.screenMessage(bs.Lstr(resource='internal.cantKickHostError'), color=(1, 0, 0)) else: print self._popupPartyMemberClientID result = bsInternal._disconnectClient( self._popupPartyMemberClientID) if not result: bs.playSound(bs.getSound('error')) bs.screenMessage( bs.Lstr(resource='getTicketsWindow.unavailableText'), color=(1, 0, 0)) else: f = open(bs.getEnvironment()['userScriptsDirectory'] + "/ban.txt", 'a') for i in bsInternal._getGameRoster(): cid = i['clientID'] if cid == self._popupPartyMemberClientID: bsInternal._chatMessage("/kick " + str(cid)) f.write(i['players'][0]['nameFull'] + ' - ' + eval(bsInternal._getGameRoster()[getIndex()] ["specString"])["n"] + '\n') bs.textWidget(edit=self._textField, text='')
def __init__(self, transition='inRight'): class EditSession: _sessionType = bs.FreeForAllSession def getSessionType(self): return self._sessionType self._editSession = EditSession() self._R = bs.getResource('addGameWindow') self._width = 650 self._height = 346 if gSmallUI else 380 if gMedUI else 440 topExtra = 30 if gSmallUI else 20 self._scrollWidth = 210 self._rootWidget = bs.containerWidget(size=(self._width, self._height+topExtra), transition=transition, scale=2.17 if gSmallUI else 1.5 if gMedUI else 1.0, stackOffset=(0, 1) if gSmallUI else (0, 0)) self._backButton = bs.buttonWidget(parent=self._rootWidget, position=(58, self._height-53), size=(165, 70), scale=0.75, textScale=1.2, label=bs.getResource('backText'), autoSelect=True, buttonType='back', onActivateCall=self._back) self._selectButton = selectButton = bs.buttonWidget(parent=self._rootWidget, position=(self._width-172, self._height-50), autoSelect=True, size=(160, 60), scale=0.75, textScale=1.2, label=bs.getResource('selectText'), onActivateCall=self._add) bs.textWidget(parent=self._rootWidget, position=(self._width*0.5, self._height-28), size=(0, 0), scale=1.0, text="Select Game", hAlign='center', color=gTitleColor, maxWidth=250, vAlign='center') v = self._height - 64 self._selectedTitleText = bs.textWidget(parent=self._rootWidget, position=(self._scrollWidth+50+30, v-15), size=(0, 0), scale=1.0, color=(0.7, 1.0, 0.7, 1.0), maxWidth=self._width-self._scrollWidth-150, hAlign='left', vAlign='center') v -= 30 self._selectedDescriptionText = bs.textWidget(parent=self._rootWidget, position=(self._scrollWidth+50+30, v), size=(0, 0), scale=0.7, color=(0.5, 0.8, 0.5, 1.0), maxWidth=self._width-self._scrollWidth-150, hAlign='left') scrollHeight = self._height-100 v = self._height - 60 self._scrollWidget = bs.scrollWidget(parent=self._rootWidget, position=(61, v-scrollHeight), size=(self._scrollWidth, scrollHeight)) bs.widget(edit=self._scrollWidget, upWidget=self._backButton, leftWidget=self._backButton, rightWidget=selectButton) self._column = None v -= 35 bs.containerWidget(edit=self._rootWidget, cancelButton=self._backButton, startButton=selectButton) self._selectedGameType = None bs.containerWidget(edit=self._rootWidget, selectedChild=self._scrollWidget) self._refresh() if config["selected"]: for gt in bsUtils.getGameTypes(): if not gt.supportsSessionType(self._editSession._sessionType): continue if gt.__name__ == config["selected"]: self._refresh(selected=gt) self._setSelectedGameType(gt)
def __init__(self, transition='inRight'): class EditSession: _sessionType = bs.FreeForAllSession def getSessionType(self): return self._sessionType self._editSession = EditSession() self._width = 650 self._height = 346 if gSmallUI else 380 if gMedUI else 440 topExtra = 30 if gSmallUI else 20 self._scrollWidth = 210 self._rootWidget = bs.containerWidget(size=(self._width, self._height+topExtra), transition=transition, scale=2.17 if gSmallUI else 1.5 if gMedUI else 1.0, stackOffset=(0, 1) if gSmallUI else (0, 0)) self._backButton = bs.buttonWidget(parent=self._rootWidget, position=(58, self._height-53), size=(165, 70), scale=0.75, textScale=1.2, label=bs.Lstr(resource='backText'), autoSelect=True, buttonType='back', onActivateCall=self._back) self._selectButton = selectButton = bs.buttonWidget(parent=self._rootWidget, position=(self._width-172, self._height-50), autoSelect=True, size=(160, 60), scale=0.75, textScale=1.2, label=bs.Lstr(resource='selectText'), onActivateCall=self._add) bs.textWidget(parent=self._rootWidget, position=(self._width*0.5, self._height-28), size=(0, 0), scale=1.0, text="Select Game", hAlign='center', color=gTitleColor, maxWidth=250, vAlign='center') v = self._height - 64 self._selectedTitleText = bs.textWidget(parent=self._rootWidget, position=(self._scrollWidth+50+30, v-15), size=(0, 0), scale=1.0, color=(0.7, 1.0, 0.7, 1.0), maxWidth=self._width-self._scrollWidth-150, hAlign='left', vAlign='center') v -= 30 self._selectedDescriptionText = bs.textWidget(parent=self._rootWidget, position=(self._scrollWidth+50+30, v), size=(0, 0), scale=0.7, color=(0.5, 0.8, 0.5, 1.0), maxWidth=self._width-self._scrollWidth-150, hAlign='left') scrollHeight = self._height-100 v = self._height - 60 self._scrollWidget = bs.scrollWidget(parent=self._rootWidget, position=(61, v-scrollHeight), size=(self._scrollWidth, scrollHeight)) bs.widget(edit=self._scrollWidget, upWidget=self._backButton, leftWidget=self._backButton, rightWidget=selectButton) self._column = None v -= 35 bs.containerWidget(edit=self._rootWidget, cancelButton=self._backButton, startButton=selectButton) self._selectedGameType = None bs.containerWidget(edit=self._rootWidget, selectedChild=self._scrollWidget) self._refresh() if config["selected"]: for gt in bsUtils.getGameTypes(): if not gt.supportsSessionType(self._editSession._sessionType): continue if gt.__name__ == config["selected"]: self._refresh(selected=gt) self._setSelectedGameType(gt)
def newInit(self, transition='inRight', originWidget=None): if originWidget is not None: self._transitionOut = 'outScale' scaleOrigin = originWidget.getScreenSpaceCenter() transition = 'inScale' else: self._transitionOut = 'outRight' scaleOrigin = None width = 600 if gSmallUI else 600 height = 360 if gSmallUI else 435 self._gOnlyHeight = height if any([b.textOnly for b in buttons]): if len(textbuttonlayouts[sum([b.textOnly for b in buttons])]) > 1: height += 80 if gSmallUI else 120 else: height += 60 if gSmallUI else 80 self._width, self._height = width, height buttonHeight = 42 R = bs.getResource('settingsWindow') topExtra = 20 if gSmallUI else 0 if originWidget is not None: self._rootWidget = bs.containerWidget(size=(width,height+topExtra),transition=transition, scaleOriginStackOffset=scaleOrigin, scale=1.75 if gSmallUI else 1.35 if gMedUI else 1.0, stackOffset=(0,-8) if gSmallUI else (0,0)) else: self._rootWidget = bs.containerWidget(size=(width,height+topExtra),transition=transition, scale=1.75 if gSmallUI else 1.35 if gMedUI else 1.0, stackOffset=(0,-8) if gSmallUI else (0,0)) self._backButton = b = bs.buttonWidget(parent=self._rootWidget,autoSelect=True,position=(40,height-55),size=(130,60),scale=0.8,textScale=1.2, label=bs.getResource('backText'),buttonType='back',onActivateCall=self._doBack) bs.containerWidget(edit=self._rootWidget, cancelButton=b) t = bs.textWidget(parent=self._rootWidget, position=(0, height-44), size=(width,25), text=R.titleText, color=gTitleColor, hAlign="center", vAlign="center", maxWidth=130) if gDoAndroidNav: bs.buttonWidget(edit=b, buttonType='backSmall', size=(60, 60), label=bs.getSpecialChar('logoFlat')) bs.textWidget(edit=t, hAlign='left', position=(93, height-44)) icon_buttons = sorted([b for b in buttons if b.icon], key=lambda b: b.sorting_position) for i, button in enumerate(icon_buttons): x, y = button._create_icon_button(self, i) text_buttons = sorted([b for b in buttons if b.textOnly], key=lambda b: b.sorting_position) for i, button in enumerate(text_buttons): button._create_text_button(self, i, y) for button in buttons: button.setLocals(self) self._restoreState()
def cb(data): newBranch = branch if data: bs.screenMessage('ok') else: bs.screenMessage('failed to fetch branch') newBranch = "master" bs.screenMessage("set branch to " + newBranch) config["branch"] = newBranch bs.writeConfig() if self.branch.exists(): bs.textWidget(edit=self.branch, text=newBranch) self.modManagerWindow._cb_refresh()
def _refresh(self, selectGetMoreGamesButton=False, selected=None): if self._column is not None: self._column.delete() # for c in self._column.getChildren(): # c.delete() self._column = bs.columnWidget(parent=self._scrollWidget) gameTypes = [gt for gt in bsUtils.getGameTypes() if gt.supportsSessionType(self._editSession._sessionType)] # sort in this language gameTypes.sort(key=lambda g:g.getNameLocalized()) for i, gameType in enumerate(gameTypes): t = bs.textWidget(parent=self._column,position=(0,0),size=(self._width-88,24),text=gameType.getNameLocalized(), hAlign="left",vAlign="center", color=(0.8,0.8,0.8,1.0), maxWidth=self._scrollWidth*0.8, onSelectCall=bs.Call(self._setSelectedGameType,gameType), alwaysHighlight=True, selectable=True,onActivateCall=bs.Call(bs.realTimer,100,self._selectButton.activate)) if i == 0: bs.widget(edit=t, upWidget=self._backButton) if gameType == selected: bs.containerWidget(edit=self._column,selectedChild=t,visibleChild=t) self._getMoreGamesButton = bs.buttonWidget(parent=self._column,autoSelect=True, label=self._R.getMoreGamesText, color=(0.54,0.52,0.67), textColor=(0.7,0.65,0.7), onActivateCall=self._onGetMoreGamesPress, size=(178,50)) if selectGetMoreGamesButton: bs.containerWidget(edit=self._column,selectedChild=self._getMoreGamesButton, visibleChild=self._getMoreGamesButton)
def _refresh(self, selectGetMoreGamesButton=False, selected=None): if self._column is not None: self._column.delete() self._column = bs.columnWidget(parent=self._scrollWidget) gameTypes = [gt for gt in bsUtils.getGameTypes() if gt.supportsSessionType(self._editSession._sessionType)] # sort in this language gameTypes.sort(key=lambda g: g.getDisplayString()) for i, gameType in enumerate(gameTypes): t = bs.textWidget(parent=self._column, position=(0, 0), size=(self._width-88, 24), text=gameType.getDisplayString(), hAlign="left", vAlign="center", color=(0.8, 0.8, 0.8, 1.0), maxWidth=self._scrollWidth*0.8, onSelectCall=bs.Call(self._setSelectedGameType, gameType), alwaysHighlight=True, selectable=True, onActivateCall=bs.Call(bs.realTimer, 100, self._selectButton.activate)) if i == 0: bs.widget(edit=t, upWidget=self._backButton) if gameType == selected: bs.containerWidget(edit=self._column, selectedChild=t, visibleChild=t) self._getMoreGamesButton = bs.buttonWidget(parent=self._column, autoSelect=True, label=bs.Lstr(resource='addGameWindow.getMoreGamesText'), color=(0.54, 0.52, 0.67), textColor=(0.7, 0.65, 0.7), onActivateCall=self._onGetMoreGamesPress, size=(178, 50)) if selectGetMoreGamesButton: bs.containerWidget(edit=self._column, selectedChild=self._getMoreGamesButton, visibleChild=self._getMoreGamesButton)
def __init__(self, data): self._width = 350 self._height = 200 self._rootWidget = bs.containerWidget( size=(self._width, self._height), color=(0.45, 0.63, 0.15), transition='inScale', scale=1.8 if bsUI.gSmallUI else 1.35 if bsUI.gMedUI else 1.0) self._data = copy.deepcopy(data) bs.playSound(bs.getSound('cashRegister')) bs.playSound(bs.getSound('swish')) self._cancelButton = bs.buttonWidget(parent=self._rootWidget, scale=0.5, position=(40, self._height - 40), size=(50, 50), label='', onActivateCall=self.close, autoSelect=True, color=(0.45, 0.63, 0.15), icon=bs.getTexture('crossOut'), iconScale=1.2) bs.containerWidget(edit=self._rootWidget, cancelButton=self._cancelButton) t = bs.textWidget(parent=self._rootWidget, position=(self._width * 0.5, self._height * 0.5), size=(0, 0), color=(1.0, 3.0, 1.0), scale=2.0, hAlign="center", vAlign="center", text=data['code'], maxWidth=self._width * 0.85)
def __init__(self, data, origin=(0, 0)): self._width = 450 self._height = 300 self._rootWidget = bs.containerWidget( size=(self._width, self._height), color=(0.45, 0.63, 0.15), transition='inScale', scale=1.8 if bsUI.gSmallUI else 1.35 if bsUI.gMedUI else 1.0) bs.playSound(bs.getSound('cashRegister')) bs.playSound(bs.getSound('swish')) self._cancelButton = bs.buttonWidget(parent=self._rootWidget, scale=0.7, position=(40, self._height - (40)), size=(50, 50), label='', onActivateCall=self.close, autoSelect=True, color=(0.45, 0.63, 0.15), icon=bs.getTexture('crossOut'), iconScale=1.2) bs.containerWidget(edit=self._rootWidget, cancelButton=self._cancelButton) t = bs.textWidget( parent=self._rootWidget, position=(self._width * 0.5, self._height * 0.645), size=(0, 0), color=bsUI.gInfoTextColor, scale=0.6, flatness=1.0, hAlign="center", vAlign="center", text=bs.Lstr(resource='importPlaylistCodeInstructionsText'), maxWidth=self._width * 0.85) t = bs.textWidget(parent=self._rootWidget, position=(self._width * 0.5, self._height * 0.445), size=(0, 0), color=(1.0, 3.0, 1.0), scale=2.0, hAlign="center", vAlign="center", text=data, maxWidth=self._width * 0.85)
def newMethod(self, *args, **kwargs): oldMethod(self, *args, **kwargs) width = -130 height = -22.5 if gSmallUI else -54.5 if gMedUI else -79 size = (94.5, 85) if gSmallUI else (91, 81) if gMedUI else (90, 80) global delayChecker if not delayChecker: delay = 1900 delayChecker = True else: delay = 0 self._inGame = not isinstance(bsInternal._getForegroundHostSession(), bsMainMenu.MainMenuSession) if not self._inGame: self._MythBServerButton = b = bs.buttonWidget( parent=self._rootWidget, position=(width, height), color=(0.356, 0.760, 0.905), size=size, transitionDelay=delay, textScale=1.0, textColor=(1, 1, 1), buttonType='square', texture=bs.getTexture('buttonSquare'), label='', onActivateCall=_doServerStatusWindow) bs.textWidget(parent=self._rootWidget, position=(width + 20, height + 6.5), scale=0.75, drawController=b, transitionDelay=delay, color=(0.75, 1.0, 0.7), maxWidth=width * 0.33, text='MythB.', hAlign='center', vAlign='center') iconSize = -width * 0.38 bs.imageWidget(parent=self._rootWidget, size=(iconSize, iconSize), transitionDelay=delay, color=(1.2, 0.843, 0), position=(width + 20, height + 27), drawController=b, texture=bs.getTexture('star'))
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 __init__(self,transition='inRight'): self._width = width = 550 self._height = height = 420 self._scrollWidth = self._width*0.90 self._scrollHeight = self._height - 180 self._subWidth = self._scrollWidth*0.95; self._subHeight = 200 self._current_tab = bs.getConfig()['effectsMod']['tab'] txtFinal = "Ajustes de Effects Mod" if bs.getLanguage() == "Spanish" else "Effects Mod Settings" if bs.getLanguage() == "Spanish": self._credits = ("Modifica y aplica efectos\n" "personalizados a tus personajes.\n\n" "Programado por Froshlee14") else: self._credits = ("Modify and add custom\n" "effects to your characters.\n\n" "Mod made by SAHIL") self._rootWidget = bs.containerWidget(size=(width,height),transition=transition, scale=2.0 if gSmallUI else 1.4 if gMedUI else 1.0, stackOffset=(0,-30) if gSmallUI else (0,0)) self._backButton = b = bs.buttonWidget(parent=self._rootWidget,autoSelect=True,position=(60,self._height-75),size=(130,60), scale=0.8,textScale=1.2,label=bs.Lstr(resource='backText'),buttonType='back',onActivateCall=self._back) if gDoAndroidNav: bs.buttonWidget(edit=self._backButton,buttonType='backSmall',size=(60,60),label=bs.getSpecialChar('back')) bs.containerWidget(edit=self._rootWidget,cancelButton=b) t = bs.textWidget(parent=self._rootWidget,position=(0,height-70),size=(width,50), text=txtFinal, hAlign="center",color=gTitleColor, vAlign="center",maxWidth=width*0.5) v = self._subHeight - 55 v0 = height - 90 tabs = [['general','General' if bs.getLanguage() == "Spanish" else 'General'], ['effects','Efectos' if bs.getLanguage() == "Spanish" else 'Effects'], #['soon','Proximamente' if bs.getLanguage() == "Spanish" else 'Coming soon'], ['info',"Info" if bs.getLanguage() == "Spanish" else 'Info'],] self._tab_buttons = bsUI._createTabButtons( self._rootWidget, tabs, pos=(self._width*0.08,45+self._scrollHeight), size=(self._scrollWidth*0.93,30), onSelectCall=self._setTab) self._scrollWidget = bs.scrollWidget(parent=self._rootWidget,size=(self._subWidth,self._scrollHeight), highlight=False, position=(self._width*0.08,51),captureArrows=True) self._tabContainer = None self._setTab(self._current_tab)
def __init__(self, data): self._dialogID = data['dialogID'] txt = bs.Lstr(translate=('serverResponses', data['text']), subs=data.get('subs', [])).evaluate() txt = txt.strip() txtScale = 1.5 txtHeight = bsInternal._getStringHeight( txt, suppressWarning=True) * txtScale self._width = 500 self._height = 130 + min(200, txtHeight) self._rootWidget = bs.containerWidget( size=(self._width, self._height), transition='inScale', scale=1.8 if bsUI.gSmallUI else 1.35 if bsUI.gMedUI else 1.0) self._startTime = bs.getRealTime() bs.playSound(bs.getSound('swish')) t = bs.textWidget(parent=self._rootWidget, position=(self._width * 0.5, 70 + (self._height - 70) * 0.5), size=(0, 0), color=(1.0, 3.0, 1.0), scale=txtScale, hAlign="center", vAlign="center", text=txt, maxWidth=self._width * 0.85, maxHeight=(self._height - 110)) showCancel = data.get('showCancel', True) if showCancel: self._cancelButton = bs.buttonWidget( parent=self._rootWidget, position=(30, 30), size=(160, 60), autoSelect=True, label=bs.Lstr(resource='cancelText'), onActivateCall=self._cancelPress) else: self._cancelButton = None self._okButton = bs.buttonWidget( parent=self._rootWidget, position=((self._width - 182) if showCancel else (self._width * 0.5 - 80), 30), size=(160, 60), autoSelect=True, label=bs.Lstr(resource='okText'), onActivateCall=self._okPress) bs.containerWidget(edit=self._rootWidget, cancelButton=self._cancelButton, startButton=self._okButton, selectedChild=self._okButton)
def __init__(self, accountID, originWidget): self._width = 550 self._height = 220 self._accountID = accountID self._transitionOut = 'outScale' scaleOrigin = originWidget.getScreenSpaceCenter() transition = 'inScale' self._rootWidget = bs.containerWidget( size=(self._width, self._height), transition='inScale', scaleOriginStackOffset=scaleOrigin, scale=1.8 if bsUI.gSmallUI else 1.35 if bsUI.gMedUI else 1.0) self._cancelButton = bs.buttonWidget(parent=self._rootWidget, scale=0.7, position=(40, self._height - 50), size=(50, 50), label='', onActivateCall=self.close, autoSelect=True, color=(0.4, 0.4, 0.5), icon=bs.getTexture('crossOut'), iconScale=1.2) bs.containerWidget(edit=self._rootWidget, cancelButton=self._cancelButton) t = bs.textWidget(parent=self._rootWidget, position=(self._width * 0.5, self._height * 0.64), size=(0, 0), color=(1, 1, 1, 0.8), scale=1.2, hAlign="center", vAlign="center", text=bs.Lstr(resource='reportThisPlayerReasonText'), maxWidth=self._width * 0.85) bs.buttonWidget(parent=self._rootWidget, size=(235, 60), position=(20, 30), label=bs.Lstr(resource='reportThisPlayerLanguageText'), onActivateCall=self._onLanguagePress, autoSelect=True) bs.buttonWidget(parent=self._rootWidget, size=(235, 60), position=(self._width - 255, 30), label=bs.Lstr(resource='reportThisPlayerCheatingText'), onActivateCall=self._onCheatingPress, autoSelect=True)
def _serverSynchronizer(self, result): if result is None: return else: ipAdr = result['l'] for i in ipAdr: if i['a'] == finalFetchedAddress and i['p'] == finalFetchedPort: if i['s'] == i['sm']: self.partySizeColor = (1, 0, 0) else: self.partySizeColor = (0, 1, 0) if self._rootWidget.exists(): bs.textWidget(edit=self.t, text=i['n']) bs.textWidget(edit=self.tvs, text='size:') bs.textWidget(edit=self.ts, text=str(i['s']) + '/' + str(i['sm']), color=self.partySizeColor) global finalFetchedStats finalFetchedStats = i[ 'sa'] if i['sa'] != '' else self.sb.delete()
def _serverStatusCheckThread(self, fetchedAddress, fetchedPort): height = 200 width = 360 class PingThread(threading.Thread): def __init__(self, address, port, call): threading.Thread.__init__(self) self._address = bs.utf8(address) self._port = port self._call = call def run(self): try: import socket socket_type = bsUtils._getIPAddressType(self._address) s = socket.socket(socket_type, socket.SOCK_DGRAM) s.connect((self._address, self._port)) accessible = False start_time = time.time() s.settimeout(1) for i in range(3): s.send('\x0b') try: # 11: BS_PACKET_SIMPLE_PING result = s.recv(10) except Exception: result = None if result == '\x0c': # 12: BS_PACKET_SIMPLE_PONG accessible = True break time.sleep(1) s.close() ping = int((time.time() - start_time) * 1000.0) bs.callInGameThread( bs.Call(self._call, self._address, self._port, ping if accessible else None)) except Exception as e: print(e) if fetchedPort != None: PingThread(fetchedAddress, fetchedPort, bs.Call(self.fetchedDataCallBack)).start() if self._rootWidget.exists(): fadeToBack() 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=bs.Lstr( resource='gatherWindow.addressFetchErrorText'), color=(1, 1, 1))
def popupMenuSelectedChoice(self, popupWindow, choice): if choice == "kickOrg": if self._popupPartyMemberIsHost: bs.playSound(bs.getSound('error')) bs.screenMessage(bs.Lstr(resource='internal.cantKickHostError'), color=(1, 0, 0)) else: #print self._popupPartyMemberClientID result = bsInternal._disconnectClient( self._popupPartyMemberClientID) if not result: bs.playSound(bs.getSound('error')) bs.screenMessage( bs.Lstr(resource='getTicketsWindow.unavailableText'), color=(1, 0, 0)) elif choice == "kick": bsInternal._chatMessage("/" + choice + " " + (str(self._popupPartyMemberClientID))) elif choice == "ban": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "unban": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "remove": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "curse": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "celebrate": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "freeze": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "thaw": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "kill": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "knock": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "punch": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "headless": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "heal": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "shield": for client in bsInternal._getGameRoster(): if client['clientID'] == self._popupPartyMemberClientID: try: bsInternal._chatMessage("/" + choice + " " + str(client['players'][0]['name'])) except: pass elif choice == "list": bsInternal._chatMessage("/" + choice) elif choice == "camera": bsInternal._chatMessage("/" + choice) elif choice == "slow": bsInternal._chatMessage("/" + choice) elif choice == "amnesty": bsInternal._chatMessage("/" + choice) elif choice == "help": bsInternal._chatMessage("/" + choice) elif choice == "end": bsInternal._chatMessage("/" + choice) elif choice == "headlessall": bsInternal._chatMessage("/" + choice) elif choice == "killall": bsInternal._chatMessage("/" + choice) elif choice == "freezeall": bsInternal._chatMessage("/" + choice) elif choice == "curseall": bsInternal._chatMessage("/" + choice) elif choice == "shieldall": bsInternal._chatMessage("/" + choice) elif choice == "healall": bsInternal._chatMessage("/" + choice) elif choice == "knockall": bsInternal._chatMessage("/" + choice) elif choice == "thawall": bsInternal._chatMessage("/" + choice) elif choice == "punchall": bsInternal._chatMessage("/" + choice) elif choice == "celebrateall": bsInternal._chatMessage("/" + choice) elif self._popupType == 'menu': if choice in ('mute', 'unmute'): bsConfig = bs.getConfig() bsConfig['Chat Muted'] = (choice == 'mute') bs.writeConfig() bs.applySettings() self._update() else: bs.textWidget(edit=self._textField, text='')
def __init__(self): # position=originWidget.getScreenSpaceCenter() position = (0, 0) scale = 2.3 if bsUI.gSmallUI else 1.65 if bsUI.gMedUI else 1.23 self._transitioningOut = False self._width = 570 self._height = 350 bgColor = (0.5, 0.4, 0.6) bsUI.PopupWindow.__init__(self, position=position, size=(self._width, self._height), scale=scale, bgColor=bgColor) env = bs.getEnvironment() self._cancelButton = bs.buttonWidget( parent=self._rootWidget, position=(50, self._height - 30), size=(50, 50), scale=0.5, label='', color=bgColor, onActivateCall=self._onCancelPress, autoSelect=True, icon=bs.getTexture('crossOut'), iconScale=1.2) env = bs.getEnvironment() if (env['platform'] == 'android' and env['subplatform'] == 'alibaba'): txt = ( '\xe8\xbf\x99\xe6\x98\xaf\xe4\xb8\x80\xe4\xb8\xaa\xe5\x8f\xaf\xe4\xbb\xa5\xe5\x92\x8c\xe5\xae\xb6\xe4\xba\xba\xe6\x9c\x8b\xe5\x8f\x8b\xe4\xb8\x80\xe8\xb5\xb7\xe7\x8e\xa9\xe7\x9a\x84\xe6\xb8\xb8\xe6\x88\x8f,\xe5\x90\x8c\xe6\x97\xb6\xe6\x94\xaf\xe6\x8c\x81\xe8\x81\x94 \xe2\x80\xa8\xe7\xbd\x91\xe5\xaf\xb9\xe6\x88\x98\xe3\x80\x82\n' '\xe5\xa6\x82\xe6\xb2\xa1\xe6\x9c\x89\xe6\xb8\xb8\xe6\x88\x8f\xe6\x89\x8b\xe6\x9f\x84,\xe5\x8f\xaf\xe4\xbb\xa5\xe4\xbd\xbf\xe7\x94\xa8\xe7\xa7\xbb\xe5\x8a\xa8\xe8\xae\xbe\xe5\xa4\x87\xe6\x89\xab\xe7\xa0\x81\xe4\xb8\x8b\xe8\xbd\xbd\xe2\x80\x9c\xe9\x98\xbf\xe9\x87\x8c\xc2\xa0TV\xc2\xa0\xe5\x8a\xa9\xe6\x89\x8b\xe2\x80\x9d\xe7\x94\xa8 \xe6\x9d\xa5\xe4\xbb\xa3\xe6\x9b\xbf\xe5\xa4\x96\xe8\xae\xbe\xe3\x80\x82\n' '\xe6\x9c\x80\xe5\xa4\x9a\xe6\x94\xaf\xe6\x8c\x81\xe6\x8e\xa5\xe5\x85\xa5\xc2\xa08\xc2\xa0\xe4\xb8\xaa\xe5\xa4\x96\xe8\xae\xbe' ) bs.textWidget(parent=self._rootWidget, size=(0, 0), hAlign='center', vAlign='center', maxWidth=self._width * 0.9, position=(self._width * 0.5, 60), text=txt) bs.imageWidget(parent=self._rootWidget, position=(self._width - 260, self._height * 0.63 - 100), size=(200, 200), texture=bs.getTexture('aliControllerQR')) bs.imageWidget(parent=self._rootWidget, position=(40, self._height * 0.58 - 100), size=(230, 230), texture=bs.getTexture('multiplayerExamples')) else: bs.imageWidget(parent=self._rootWidget, position=(self._width * 0.5 - 110, self._height * 0.67 - 110), size=(220, 220), texture=bs.getTexture('multiplayerExamples')) bs.textWidget( parent=self._rootWidget, size=(0, 0), hAlign='center', vAlign='center', maxWidth=self._width * 0.9, position=(self._width * 0.5, 60), text=bs.Lstr(resource='remoteAppInfoShortText', subs=[('${APP_NAME}', bs.Lstr(resource='titleText')), ('${REMOTE_APP_NAME}', bs.Lstr(resource='remote_app.app_name'))]))
def popupMenuSelectedChoice(self, popupWindow, choice): cmd = self._popupType == 'commands' if cmd and choice == 'kick': self._popupType = 'partyMemberPress' popupMenuOld(self, popupWindow=popupWindow, choice=choice) elif cmd: bs.textWidget(edit=self._textField, text='') if choice in ['/skin']: account = get_account(self._popupPartyMemberClientID) if account is not None: self._popupType = {'skins': account} self._popupWindow(choices=skins) elif choice in commands_account_needed: account = get_account(self._popupPartyMemberClientID) if account is not None: bs.textWidget(edit=self._textField, text=choice + ' ' + account) elif choice in commands: result = get_number(self._popupPartyMemberClientID) if len(result) > 0: self._popupType = 'number' bs.textWidget(edit=self._textField, text=choice) if len(result) > 1: self._popupWindow(choices=result) else: choice = str(result[0]) else: bs.textWidget(edit=self._textField, text='') if self._popupType == 'number': bs.textWidget(edit=self._textField, text=(bs.textWidget(query=self._textField) + ' ' + choice)) elif isinstance(self._popupType, dict) and 'skins' in self._popupType and choice != '/skin': bs.textWidget(edit=self._textField, text=('/skin ' + choice + ' ' + self._popupType.values()[0])) else: popupMenuOld(self, popupWindow=popupWindow, choice=choice)
def __init__(self, transition='inRight', originWidget=None): if originWidget is not None: self._transitionOut = 'outScale' scaleOrigin = originWidget.getScreenSpaceCenter() transition = 'inScale' else: self._transitionOut = 'outRight' scaleOrigin = None transition = 'inRight' bgColor = (0.4, 0.4, 0.5) self._width = 540 self._height = 330 baseScale = 2.0 if bsUI.gSmallUI else 1.6 if bsUI.gMedUI else 1.1 self._rootWidget = bs.containerWidget( size=(self._width, self._height), transition=transition, scale=baseScale, scaleOriginStackOffset=scaleOrigin, stackOffset=(0, -10) if bsUI.gSmallUI else (0, 0)) self._cancelButton = bs.buttonWidget(parent=self._rootWidget, position=(50, self._height - 30), size=(50, 50), scale=0.5, label='', color=bgColor, onActivateCall=self._cancel, autoSelect=True, icon=bs.getTexture('crossOut'), iconScale=1.2) bs.textWidget( parent=self._rootWidget, position=(self._width * 0.5, self._height * 0.57), size=(0, 0), text=bs.Lstr( resource='accountSettingsWindow.linkAccountsInstructionsText', subs=[('${COUNT}', str( bsInternal._getAccountMiscReadVal( 'maxLinkAccounts', 5)))]), maxWidth=self._width * 0.9, color=bsUI.gInfoTextColor, maxHeight=self._height * 0.6, hAlign='center', vAlign='center') bs.containerWidget(edit=self._rootWidget, cancelButton=self._cancelButton) bs.buttonWidget( parent=self._rootWidget, position=(40, 30), size=(200, 60), label=bs.Lstr( resource='accountSettingsWindow.linkAccountsGenerateCodeText'), autoSelect=True, onActivateCall=self._generatePress) self._enterCodeButton = bs.buttonWidget( parent=self._rootWidget, position=(self._width - 240, 30), size=(200, 60), label=bs.Lstr( resource='accountSettingsWindow.linkAccountsEnterCodeText'), autoSelect=True, onActivateCall=self._enterCodePress)
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))
def newInit(self, transition='inRight', originWidget=None): if originWidget is not None: self._transitionOut = 'outScale' scaleOrigin = originWidget.getScreenSpaceCenter() transition = 'inScale' else: self._transitionOut = 'outRight' scaleOrigin = None width = 600 if gSmallUI else 600 height = 360 if gSmallUI else 435 self._gOnlyHeight = height if any([b.textOnly for b in buttons]): if len(textbuttonlayouts[sum([b.textOnly for b in buttons])]) > 1: height += 80 if gSmallUI else 120 else: height += 60 if gSmallUI else 80 self._width, self._height = width, height R = bs.getResource('settingsWindow') topExtra = 20 if gSmallUI else 0 if originWidget is not None: self._rootWidget = bs.containerWidget( size=(width, height + topExtra), transition=transition, scaleOriginStackOffset=scaleOrigin, scale=1.75 if gSmallUI else 1.35 if gMedUI else 1.0, stackOffset=(0, -8) if gSmallUI else (0, 0)) else: self._rootWidget = bs.containerWidget( size=(width, height + topExtra), transition=transition, scale=1.75 if gSmallUI else 1.35 if gMedUI else 1.0, stackOffset=(0, -8) if gSmallUI else (0, 0)) self._backButton = b = bs.buttonWidget(parent=self._rootWidget, autoSelect=True, position=(40, height - 55), size=(130, 60), scale=0.8, textScale=1.2, label=bs.getResource('backText'), buttonType='back', onActivateCall=self._doBack) bs.containerWidget(edit=self._rootWidget, cancelButton=b) t = bs.textWidget(parent=self._rootWidget, position=(0, height - 44), size=(width, 25), text=R.titleText, color=gTitleColor, hAlign="center", vAlign="center", maxWidth=130) if gDoAndroidNav: bs.buttonWidget(edit=b, buttonType='backSmall', size=(60, 60), label=bs.getSpecialChar('logoFlat')) bs.textWidget(edit=t, hAlign='left', position=(93, height - 44)) icon_buttons = sorted([b for b in buttons if b.icon], key=lambda b: b.sorting_position) for i, button in enumerate(icon_buttons): x, y = button._create_icon_button(self, i) text_buttons = sorted([b for b in buttons if b.textOnly], key=lambda b: b.sorting_position) for i, button in enumerate(text_buttons): button._create_text_button(self, i, y) for button in buttons: button.setLocals(self) self._restoreState()
def _rebuildForState(self, newState): if self._state is not None: self._saveState() # clear out previous state (if any) children = self._rootWidget.getChildren() for c in children: c.delete() self._state = newState # print 'REBUILDING FOR STATE',self._state self._cancelButton = bs.buttonWidget(parent=self._rootWidget, position=(20, self._height - 30), size=(50, 50), scale=0.5, label='', color=self._bgColor, onActivateCall=self._onCancel, autoSelect=True, icon=bs.getTexture('crossOut'), iconScale=1.2) titleScale = 0.6 titleColor = (1, 1, 1, 0.4) showPrizes = False showLevel = False showForfeitButton = False if self._state == 'error': titleStr = bs.Lstr(resource='coopSelectWindow.challengesText') bs.textWidget(parent=self._rootWidget, position=(self._width * 0.5, self._height * 0.5), size=(0, 0), hAlign='center', vAlign='center', scale=0.7, text=bs.Lstr(resource='errorText'), maxWidth=self._width * 0.8) elif self._state == 'skipWaitNextChallenge': titleStr = bs.Lstr(resource='coopSelectWindow.nextChallengeText') #showLevel = True bWidth = 140 bHeight = 130 imgWidth = 80 imgHeight = 80 bPos = (self._width * 0.5, self._height * 0.52) b = bs.buttonWidget(parent=self._rootWidget, position=(bPos[0] - bWidth * 0.5, bPos[1] - bHeight * 0.5), onActivateCall=bs.WeakCall(self._load), label='', size=(bWidth, bHeight), buttonType='square', autoSelect=True) bs.containerWidget(edit=self._rootWidget, selectedChild=b) bs.textWidget( parent=self._rootWidget, drawController=b, hAlign='center', vAlign='center', text=bs.Lstr(resource='coopSelectWindow.skipWaitText'), size=(0, 0), maxWidth=bWidth * 0.8, color=(0.75, 1.0, 0.7), position=(bPos[0], bPos[1] - bHeight * 0.0), scale=0.9) bs.textWidget(parent=self._rootWidget, drawController=b, hAlign='center', vAlign='center', text=bs.getSpecialChar('ticket') + str(self._waitTickets), size=(0, 0), scale=0.6, color=(1, 0.5, 0), position=(bPos[0], bPos[1] - bHeight * 0.23)) # bs.imageWidget(parent=self._rootWidget,drawController=b,size=(80,80), # position=(bPos[0]-imgWidth*0.5,bPos[1]-imgHeight*0.5),texture=bs.getTexture('tickets')) #showPrizes = True elif self._state == 'skipWaitNextPlay': showLevel = True showForfeitButton = True bWidth = 140 bHeight = 130 imgWidth = 80 imgHeight = 80 bPos = (self._width * 0.5, self._height * 0.52) b = bs.buttonWidget(parent=self._rootWidget, position=(bPos[0] - bWidth * 0.5, bPos[1] - bHeight * 0.5), onActivateCall=bs.WeakCall(self._play), label='', size=(bWidth, bHeight), buttonType='square', autoSelect=True) bs.widget(edit=b, upWidget=self._cancelButton) bs.containerWidget(edit=self._rootWidget, selectedChild=b) bs.textWidget( parent=self._rootWidget, drawController=b, hAlign='center', vAlign='center', text=bs.Lstr(resource='coopSelectWindow.playNowText'), size=(0, 0), maxWidth=bWidth * 0.8, color=(0.75, 1.0, 0.7), position=(bPos[0], bPos[1] - bHeight * 0.0), scale=0.9) bs.textWidget(parent=self._rootWidget, drawController=b, hAlign='center', vAlign='center', text=bs.getSpecialChar('ticket') + str(self._waitTickets), size=(0, 0), scale=0.6, color=(1, 0.5, 0), position=(bPos[0], bPos[1] - bHeight * 0.23)) # bs.imageWidget(parent=self._rootWidget,drawController=b,size=(80,80), # position=(bPos[0]-imgWidth*0.5,bPos[1]-imgHeight*0.5),texture=bs.getTexture('tickets')) showPrizes = True elif self._state == 'freePlay': showLevel = True showForfeitButton = True bWidth = 140 bHeight = 130 b = bs.buttonWidget(parent=self._rootWidget, position=(self._width * 0.5 - bWidth * 0.5, self._height * 0.52 - bHeight * 0.5), onActivateCall=bs.WeakCall(self._play), label=bs.Lstr(resource='playText'), size=(bWidth, bHeight), buttonType='square', autoSelect=True) bs.widget(edit=b, upWidget=self._cancelButton) bs.containerWidget(edit=self._rootWidget, selectedChild=b) showPrizes = True elif self._state == 'ended': titleStr = bs.Lstr(resource='coopSelectWindow.challengesText') bs.textWidget(parent=self._rootWidget, position=(self._width * 0.5, self._height * 0.5), size=(0, 0), hAlign='center', vAlign='center', scale=0.7, text=bs.Lstr(resource='challengeEndedText'), maxWidth=self._width * 0.8) else: titleStr = '' print 'Unrecognized state for ChallengeEntryWindow:', self._state if showLevel: titleColor = (1, 1, 1, 0.7) titleStr = 'Meteor Shower Blah' titleScale = 0.7 bs.textWidget(parent=self._rootWidget, position=(self._width * 0.5, self._height * 0.86), size=(0, 0), hAlign='center', vAlign='center', color=(0.8, 0.8, 0.4, 0.7), flatness=1.0, scale=0.55, text=bs.Lstr(resource='levelText', subs=[('${NUMBER}', str(self._level))]), maxWidth=self._width * 0.8) self._titleText = bs.textWidget(parent=self._rootWidget, position=(self._width * 0.5, self._height - 20), size=(0, 0), hAlign='center', vAlign='center', scale=titleScale, text=titleStr, maxWidth=200, color=titleColor) if showForfeitButton: bWidth = 40 bHeight = 25 self._forfeitButton = bs.buttonWidget( parent=self._rootWidget, position=(self._width - bWidth - 16, self._height - bHeight - 10), label=bs.Lstr(resource='coopSelectWindow.forfeitText'), size=(bWidth, bHeight), buttonType='square', color=(0.6, 0.45, 0.6), onActivateCall=bs.WeakCall(self._onForfeitPress), textColor=(0.65, 0.55, 0.65), autoSelect=True) else: self._forfeitButton = None if showPrizes: bs.textWidget(parent=self._rootWidget, position=(self._width * 0.5, self._height * 0.24), size=(0, 0), hAlign='center', vAlign='center', flatness=1.0, scale=0.6, text=bs.Lstr(resource='coopSelectWindow.prizesText'), maxWidth=self._width * 0.8, color=(0.8, 0.8, 1, 0.5)), prizes = [] if self._prizeTrophy is not None: prizes.append( bs.getSpecialChar('trophy' + str(self._prizeTrophy))) if self._prizeTickets != 0: prizes.append( bs.getSpecialChar('ticketBacking') + str(self._prizeTickets)) bs.textWidget(parent=self._rootWidget, position=(self._width * 0.5, self._height * 0.13), size=(0, 0), hAlign='center', vAlign='center', scale=0.8, flatness=1.0, color=(0.7, 0.7, 0.7, 1), text=' '.join(prizes), maxWidth=self._width * 0.8) self._restoreState()
def __init__(self): self.buttonChecker = False height = 200 width = 360 bs.containerWidget(edit=uiGlobals['mainMenuWindow'], transition='outLeft') self._rootWidget = bs.containerWidget( size=(width, height), transition=('inRight'), toolbarVisibility='MENU_MINIMAL_NOBACK', parent=bsInternal._getSpecialWidget('overlayStack'), scale=2.1 if gSmallUI else 1.5 if gMedUI else 1.3, color=(0.215, 0.278, 0.309)) self.lt = bs.textWidget(parent=self._rootWidget, position=(width / 2, height / 2), size=(0, 0), hAlign="center", vAlign="center", shadow=1.0, text=bs.Lstr(resource='loadingText'), scale=1.0, maxWidth=width * 0.9, maxHeight=height - 75) self.t = bs.textWidget(parent=self._rootWidget, position=(width * 0.5, height - 5 - (height - 75) * 0.25), shadow=1.0, size=(0, 0), hAlign="center", vAlign="center", text='', scale=1.0, maxWidth=250, maxHeight=height - 75) self.pt = bs.textWidget(parent=self._rootWidget, position=(width * 0.2, height - 5 - (height - 75) * 0.8), shadow=1.0, size=(0, 0), hAlign="center", vAlign="center", text='', scale=1.0, maxWidth=width * 0.9, maxHeight=height - 75) self.pvt = bs.textWidget(parent=self._rootWidget, shadow=1.0, position=(width * 0.30, height - 5 - (height - 75) * 0.8), size=(0, 0), hAlign="left", vAlign="center", text='', scale=1.0, maxWidth=width * 0.9, maxHeight=height - 75) self.ts = bs.textWidget(parent=self._rootWidget, shadow=1.0, position=(width * 0.75, height - 5 - (height - 75) * 0.8), size=(0, 0), hAlign="left", vAlign="center", text='', scale=1.0, maxWidth=width * 0.9, maxHeight=height - 75) self.tvs = bs.textWidget(parent=self._rootWidget, shadow=1.0, position=(width * 0.65, height - 5 - (height - 75) * 0.8), size=(0, 0), hAlign="center", vAlign="center", text='', scale=1.0, maxWidth=width * 0.9, maxHeight=height - 75) self.cb = b = bs.buttonWidget(parent=self._rootWidget, autoSelect=True, buttonType='backSmall', position=(20, 150), size=(30, 30), scale=1.0, textResScale=1.5, textColor=(0.9, 0.9, 0.9), label=bs.getSpecialChar('back'), color=(0.356, 0.760, 0.905), textScale=0.7, onActivateCall=self._cancel) bs.containerWidget(edit=self._rootWidget, cancelButton=b) self.Timir = bs.Timer(5000, bs.WeakCall(self._serverAddressFetchThread), repeat=True, timeType='real')
def _setTab(self,tab): self._colorTimer = None self._current_tab = tab bs.getConfig()['effectsMod']['tab'] = tab bs.writeConfig() bsUI._updateTabButtonColors(self._tab_buttons, tab) if self._tabContainer is not None and self._tabContainer.exists(): self._tabContainer.delete() self._tabData = {} if tab == 'info': subHeight = 200 self._tabContainer = c = bs.containerWidget(parent=self._scrollWidget,size=(self._subWidth,subHeight), background=False) bs.widget(edit=self._tabContainer,upWidget=self._backButton) v = subHeight - 40 cWidth = self._scrollWidth cHeight = min(self._scrollHeight, 200*1.0+100) self._timeDelayText = bs.textWidget( parent=c, position=(0,v), color=(0.1, 1.0, 0.1), scale=1.2, size=(self._subWidth, 0), maxWidth=cWidth * 0.9, maxHeight=cHeight * 0.9, hAlign='center', vAlign='center', text='EFFECTS MOD v1.1') v -= 100 t = bs.textWidget( parent=c, position=(0, v), color=(0.8, 0.8, 0.8), scale=0.8, size=(self._subWidth*0.95, 0), maxWidth=cWidth * 0.9, maxHeight=cHeight * 0.9, hAlign='center', vAlign='center', text=self._credits) v -= 140 elif tab == 'general': subHeight = 200 self._tabContainer = c = bs.containerWidget(parent=self._scrollWidget,size=(self._subWidth,subHeight), background=False) v = subHeight - 70 reset = bs.buttonWidget(parent=c, autoSelect=True,onActivateCall=self.restoreSettings, position=((self._scrollWidth*0.45)-150, v), size=(300,50),scale=1.0, textScale=1.2,textColor=(1,1,1), label="Restaurar ajustes por defecto" if bs.getLanguage() == "Spanish" else "Restore default settings") bs.buttonWidget(edit=reset,upWidget=self._backButton) v -= 70 self.bw = bs.checkBoxWidget(parent=c,position=(self._subWidth*0.1,v), value=bs.getConfig()["effectsMod"]["color"], onValueChangeCall=bs.Call(self._setSetting,'color'), maxWidth=self._scrollWidth*0.9, text='Aplicar color de perfiles' if bs.getLanguage() == 'Spanish' else 'Apply profile colors',autoSelect=True) elif tab == "effects": self._selected = None baseScale = 2.4 if gSmallUI else 1.5 if gMedUI else 1.0 popupMenuScale = baseScale*1.2 subHeight = 250 v = subHeight - 20 self._tabContainer = c = bs.containerWidget(parent=self._rootWidget,size=(self._subWidth,subHeight), background=False) spawnEffectsList = ['none','in','out','xplode','show'] if bs.getLanguage() == "Spanish": spawnEffectsListDisplay = ['Ninguno','Ondas adentro','Ondas afuera','Explosion','Mostrar circulo'] else: spawnEffectsListDisplay = ['None','Circles In','Circles Out','Circle Explode','Show circle'] t = bs.textWidget(parent=c,position=(self._subWidth*0.2,v), text="Efectos de spawn" if bs.getLanguage() == "Spanish" else "Spawn effects", maxWidth=self._scrollWidth,size=(self._subWidth*0.5,self._scrollHeight*0.1),color=(0.7,0.7,0.7),hAlign="left",scale=0.8,) sePopup = PopupMenu(parent=c,position=(self._subWidth*0.6,v-15),width=150,scale=popupMenuScale, choices=spawnEffectsList, choicesDisplay=spawnEffectsListDisplay, currentChoice= bs.getConfig()["effectsMod"]["spawnEffect"], onValueChangeCall=self._setSpawnEffect) bs.widget(edit=sePopup.getButtonWidget(),upWidget=self._backButton) v -= 60 effectsList = ['none','path','fire'] if bs.getLanguage() == "Spanish": effectsListDisplay = ['Ninguno','Linea punteda','Hombre de fuego'] else: effectsListDisplay = ['None','Dotted line','Fireman'] t = bs.textWidget(parent=c,position=(self._subWidth*0.2,v), text="Efectos in-Game" if bs.getLanguage() == "Spanish" else "In-Game ffects", maxWidth=self._scrollWidth,size=(self._subWidth*0.5,self._scrollHeight*0.1),color=(0.7,0.7,0.7),hAlign="left",scale=0.8,) ePopup = PopupMenu(parent=c,position=(self._subWidth*0.6,v-15),width=150,scale=popupMenuScale, choices=effectsList, choicesDisplay=effectsListDisplay, currentChoice= bs.getConfig()["effectsMod"]["effect"], onValueChangeCall=self._setEffect) v -= 60 deathEffectsList = ['none','in','out','xplode','show','bones','fly','skull'] if bs.getLanguage() == "Spanish": deathEffectsListDisplay = ['Ninguno','Ondas adentro','Ondas afuera','Explosion','Mostrar circulo','Huesos','Levitar','Calavera'] else: deathEffectsListDisplay = ['None','Circles In','Circles Out','Circle Explode','Show cirlce ','Become bones','Levitate','Show Skull'] t = bs.textWidget(parent=c,position=(self._subWidth*0.2,v), text="Efectos de muerte" if bs.getLanguage() == "Spanish" else "Death effects", maxWidth=self._scrollWidth,size=(self._subWidth*0.5,self._scrollHeight*0.1),color=(0.7,0.7,0.7),hAlign="left",scale=0.8,) dePopup = PopupMenu(parent=c,position=(self._subWidth*0.6,v-15),width=150,scale=popupMenuScale, choices=deathEffectsList, choicesDisplay=deathEffectsListDisplay, currentChoice= bs.getConfig()["effectsMod"]["deathEffect"], onValueChangeCall=self._setDeathEffect)