def toBedroom(self, checked): print(f'Nancy has a {nancy.item}') if self.br is None: self.br = Bedroom() self.br.show() else: self.br.close() # Close window. self.br = None # Discard reference.
def toBedroom(self, checked): config.progress.rooms_visited += 1 if self.br is None: self.br = Bedroom() self.br.show() else: self.br.close() # Close window. self.br = None # Discard reference. self.close()
def __init__(self): self.bathrooms = (Bathroom(), ) self.kitchen = Kitchen() self.livingroom = Livingroom() self.bedrooms = (Bedroom(2), ) self.rooms = (self.kitchen, self.livingroom) + self.bathrooms + self.bedrooms self.time = 0 self.family = {} self.pets = {} self.address = None
class LivingRoom(QMainWindow): def __init__(self): super().__init__() self.setWindowTitle("Bedroom") self.setGeometry(0, 0, 1440, 860) self.br = None # No external window yet. self.ki = None # creating character reference global nancy self.bedroomButton = QPushButton("Bedroom", self) self.bedroomButton.setGeometry(0, 0, 100, 200) self.kitchenButton = QPushButton("Kitchen", self) self.kitchenButton.setGeometry(300, 300, 100, 200) self.UI() def UI(self): self.bedroomButton.clicked.connect(self.toBedroom) self.kitchenButton.clicked.connect(self.toKitchen) def toBedroom(self, checked): print(f'Nancy has a {nancy.item}') if self.br is None: self.br = Bedroom() self.br.show() else: self.br.close() # Close window. self.br = None # Discard reference. def toKitchen(self, checked): print(f'Nancy has a {nancy.item}') if nancy.hasItem() == True: if self.ki is None: self.ki = Kitchen() self.ki.show() else: self.ki.close() # Close window. self.ki = None # Discard reference.
kitchenWindow = Window(1) kitchenRad = Rad(2000) kitchenLight = Light(80) kitchenDoor = Door(1.5) kettle = Kettle(2, 100) oven = Oven(300) toaster = Toaster(10) kitchen = Kitchen("Kitchen", 10, 16, 8, 12.0, kitchenRad, kitchenDoor, kitchenLight, kitchenWindow, \ kettle, oven, toaster) bedroom1Window = Window(3) bedroom1Rad = Rad(2500) bedroom1Light = Light(98) bedroom1Door = Door(1.5) electricBlanket = ElectricBlanket(5) bedroom1 = Bedroom("Bedroom 1", 12, 12, 8, 12.0, bedroom1Rad, bedroom1Door, bedroom1Light, bedroom1Window, electricBlanket) utilityRoomWindow = Window(3) utilityRoomRad = Rad(1200) utiilityRoomLight = Light(100) utilityRoomDoor = Door(2) dryer = Dryer(300) utiilityRoom = UtilityRoom("Utility Room", 8, 8, 8, 12.0, \ utilityRoomRad, utilityRoomDoor, utiilityRoomLight, utilityRoomWindow, dryer) houseRooms = [livingRoom, kitchen, bedroom1, utiilityRoom] houseRads = [livingRoomRad, kitchenRad, bedroom1Rad, utilityRoomRad] houseLights = [livingRoomLight, kitchenLight, bedroom1Light, utiilityRoomLight] Boiler = Heater(houseRads) Light_Controller = LightController(houseLights) Kitchen_Controller = KitchenController(kitchen)
def add_bedroom(self, k): if len(self.bedrooms) == 4: print('Too many bedrooms') else: self.bedrooms += (Bedroom(k), )
class Hallway(Room): """ Bedroom window to pop up when player navigates to the Bedroom Location """ def __init__(self): super().__init__("Hallway") self.setRoomButtons() self.setInteractionButtons() self.setEasterEggButtons() def setRoomButtons(self): # Setting up buttons and other room windows self.lr = None self.livingButton = QPushButton("Living Room", self) self.livingButton.setGeometry(self.width / 2 - self.button_width / 2, self.image_height - self.button_height, self.button_width, self.button_height) self.livingButton.clicked.connect(self.toLiving) self.br = None self.bedroomButton = QPushButton("Bedroom", self) self.bedroomButton.setGeometry( self.width - self.button_width, self.image_height / 2 - self.button_height / 2, self.button_width, self.button_height) self.bedroomButton.clicked.connect(self.toBedroom) self.bh = None self.bathroomButton = QPushButton("Bathroom", self) self.bathroomButton.setGeometry( self.left, self.image_height / 2 - self.button_height / 2, self.button_width, self.button_height) self.bathroomButton.clicked.connect(self.toBathroom) def setInteractionButtons(self): bw = 25 bh = 25 def setEasterEggButtons(self): # Setting up easter egg buttons pass def toLiving(self, checked): config.progress.rooms_visited += 1 if self.lr is None: self.lr = LivingRoom.LivingRoom() self.lr.show() else: self.lr.close() # Close window. self.lr = None # Discard reference. self.close() def toBedroom(self, checked): config.progress.rooms_visited += 1 if self.br is None: self.br = Bedroom() self.br.show() else: self.br.close() # Close window. self.br = None # Discard reference. self.close() def toBathroom(self, checked): config.progress.rooms_visited += 1 if self.bh is None: self.bh = Bathroom() self.bh.show() else: self.bh.close() # Close window. self.bh = None # Discard reference.