def __init__(self): print("began") self.taskMgr = taskMgr with open('config.json') as data_file: self.conf = json.load(data_file) self.ServerConnection = ServerConnection()#uncomment when going live self.ServerConnection.connect(self.conf['host'],self.conf['port'])#uncomment when going live props = WindowProperties( ) props.setTitle( 'Log In' ) props.setFixedSize(True) props.setSize(1280,740) props.setOrigin(-2,-2) base.win.requestProperties( props ) self.base = ShowBase self.main_theme = base.loader.loadSfx("assets/sounds/terminator_theme.ogg") self.main_theme.play() self.username = "" self.authConnection = AuthConnectionModel(self)#uncomment when going live self.heartbeatConnection = HeartbeatConnectionModel()#uncomment when going live self.ServerConnection.setupConnectionModel(self.heartbeatConnection)#uncomment when going live self.globalChatConnection = ChatConnectionModel(self) self.ServerConnection.setupConnectionModel(self.globalChatConnection) self.queueConnection = QueueConnectionModel(self) self.ServerConnection.setupConnectionModel(self.authConnection)#uncomment when going live self.friendConnection = FriendConnectionModel(self) self.ServerConnection.setupConnectionModel(self.friendConnection) self.taskMgr.doMethodLater(self.conf['heartbeatRate'], self.doHeartbeat, "heartbeat")#uncomment when going live self.taskMgr.doMethodLater(self.conf['heartbeatRate'], self.doHeartbeat, "heartbeat") self.screen = Login(self)#uncomment when going live #self.screen = Menu(self)#comment this one when you are trying to log into it like normal self.ServerConnection.setupConnectionModel(self.queueConnection) self.taskMgr.doMethodLater(self.conf['heartbeatRate'], self.doHeartbeat, "heartbeat") self.taskMgr.doMethodLater(1, self.doSong, "song") self.screenType = "login" self.screen.run()
def __init__(self, World): #just comment out the two lines below #self.appRunner = None#added this to overide the login self.playerList = [] self.World = World self.WhichScreen = ""; self.lastSelectedFriend = None # variable to save game selected DD or RR self.selectedGame = None #self.taskMgr = World.taskMgr#added this to overide the login props = WindowProperties() props.setTitle( 'Main Menu' ) props.setFixedSize(True) props.setSize(1400,740) props.setOrigin(-2,-2) base.win.requestProperties( props ) self.selectedCar = 0 self.screenBtns = [] self.globalChat = [] self.privateChat = {} self.chatOffset = 0 self.car = None self.onReturnMatch = self.createMatchMaking self.createSocialization() self.World.queueConnection.setHandler(self.handleQueueNotification) self.World.globalChatConnection.setHandler(self.handleChatNotification) self.World.friendConnection.setHandlers(self.handleFriendNotification,self.handleFriendListNotification) #self.World.privateChatConnection.setHandler(self.handlePrivateChatNotification) self.navi() self.accept('enter', self.sendMessage)