Ejemplo n.º 1
0
    def _loadSettings(self):
        """
        Load settings from settings file
        """
        # Make sure that the settings file exists
        # noinspection PyUnusedLocal
        try:
            f = open(SettingsCommon.getSettingsLocation(), "r")
            f.close()
        except (ValueError, Exception) as e:
            try:
                f = open(SettingsCommon.getSettingsLocation(), "w")
                f.write("")
                f.close()
                self.logger.warning(f'Game Settings File file re-created')
            except (ValueError, Exception) as e:
                self.logger.error(f"Error: {e}")
                return

        # Read data
        self._config.read(SettingsCommon.getSettingsLocation())

        self._limits.addMissingSettings()
        self._power.addMissingSettings()
        self._gameLevel.addMissingSettings()
        self._factors.addMissingSettings()
        self._debug.addMissingSettings()
        self._torpedoSpeeds.addMissingSettings()
        self._developer.addMissingSettings()
Ejemplo n.º 2
0
 def setUpClass(cls):
     TestBase.setUpLogging()
     TestFutureEventHandlers.clsLogger = getLogger(__name__)
     SettingsCommon.determineSettingsLocation()
     TestFutureEventHandlers._setupGame()
     TestFutureEventHandlers.clsLogger.debug(
         f'Running TestFutureEventHandlers')
Ejemplo n.º 3
0
def main():

    TestBase.setUpLogging()
    SettingsCommon.determineSettingsLocation()

    warpEffectRunner: WarpEffectRunner = WarpEffectRunner()

    warpEffectRunner.run()
Ejemplo n.º 4
0
def main():
    """
    Main method
    """
    LocateResources.setupSystemLogging()
    SettingsCommon.determineSettingsLocation()

    window: TestSpriteSheet = TestSpriteSheet(SCREEN_WIDTH, SCREEN_HEIGHT,
                                              SCREEN_TITLE)
    window.setup()
    arcadeRun()
Ejemplo n.º 5
0
    def setUpClass(cls):
        TestBase.setUpLogging()
        TestGalaxy.clsLogger = getLogger(__name__)
        SettingsCommon.determineSettingsLocation()

        TestBase.resetSingletons()

        TestGalaxy.clsGameSettings = GameSettings()
        TestGalaxy.clsGameSettings.debugCollectKlingonQuadrantCoordinates = True

        TestGalaxy.clsGameState = GameState()
        TestGalaxy.clsGalaxy = Galaxy()
Ejemplo n.º 6
0
def main():

    TestBase.setUpLogging()
    SettingsCommon.determineSettingsLocation()

    window: Window = Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    startView: TestEventScheduler = TestEventScheduler()

    window.show_view(startView)

    startView.setup()

    arcadeRun()
Ejemplo n.º 7
0
def main():
    """
    Main method
    """
    TestBase.setUpLogging()
    SettingsCommon.determineSettingsLocation()

    arcadeWindow: Window = Window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)
    shootingView: TestShooting = TestShooting()

    arcadeWindow.set_exclusive_keyboard(exclusive=True)
    arcadeWindow.show_view(shootingView)

    shootingView.setup()

    arcadeRun()
Ejemplo n.º 8
0
    def init(self, *args, **kwds):

        self.logger: Logger = getLogger(__name__)

        BaseSubSetting.init(self, *args, **kwds)

        self._settingsCommon: SettingsCommon = SettingsCommon(self._config)
Ejemplo n.º 9
0
def main():

    TestBase.setUpLogging()
    SettingsCommon.determineSettingsLocation()

    arcadeWindow: Window = Window(title=SCREEN_TITLE,
                                  width=SCREEN_WIDTH,
                                  height=SCREEN_HEIGHT)
    arcadeWindow.background_color = color.BLACK
    arcadeWindow.clear()

    warpDialog: WarpDialog = WarpDialog(window=arcadeWindow,
                                        completeCallback=completeCallback)

    arcadeWindow.show_view(warpDialog)

    arcadeRun()
Ejemplo n.º 10
0
    def init(self, *args, **kwds):
        """
        This is a singleton based on the inheritance hierarchy
        """
        self.logger: Logger = getLogger(__name__)

        BaseSubSetting.init(self, *args, **kwds)

        self._settingsCommon: SettingsCommon = SettingsCommon(self._config)
Ejemplo n.º 11
0
def main():

    SettingsCommon.determineSettingsLocation()

    if ".." not in sysPath:
        sysPath.append("..")  # access to the classes to test

    testAll: TestAll = TestAll()
    status: int = 0
    if len(sysArgv) < 2:
        status: int = testAll.runTextTestRunner()
    else:
        for param in sysArgv[1:]:
            if param[:22] == "--produce-html-results":
                print(f'Running HTML Tests')
                status: int = testAll.runHtmlTestRunner()

    return status
Ejemplo n.º 12
0
    def setup(self):

        SettingsCommon.determineSettingsLocation()

        # self._backgroundSprite: QuadrantBackground = QuadrantBackground()

        fqFileName: str = LocateResources.getResourcesPath(resourcePackageName=LocateResources.IMAGE_RESOURCES_PACKAGE_NAME,
                                                           bareFileName='QuadrantBackground.png')
        self.background = load_texture(fqFileName)
        # Create the 'physics engine'
        # self.physicsEngine = PhysicsEngineSimple(self._enterprise, self._hardSpriteList)

        # These singletons are initialized for the first time
        self._gameSettings = GameSettings()     # Be able to read the preferences file
        self._gameState    = GameState()        # Set up the game parameters which uses the above
        self._gameEngine   = GameEngine()       # Then the engine needs to be initialized
        self._intelligence = Intelligence()
        self._computer     = Computer()
        self._galaxy       = Galaxy()           # This essentially finishes initializing most of the game

        self._messageConsole: MessageConsole = MessageConsole()
        self._eventEngine:    EventEngine    = EventEngine(self._messageConsole)

        self._statusConsole:  StatusConsole = StatusConsole(gameView=self)       # UI elements
        self._soundMachine:   SoundMachine = SoundMachine()

        self._enterprise: Enterprise = self._gameState.enterprise

        # Important mediators
        self._enterpriseMediator: EnterpriseMediator = EnterpriseMediator(view=self, warpTravelCallback=self._enterpriseHasWarped)
        self._quadrantMediator:   QuadrantMediator   = QuadrantMediator()
        self._galaxyMediator:     GalaxyMediator     = GalaxyMediator()

        self._quadrant: Quadrant = self._galaxy.currentQuadrant

        self._gameState.currentQuadrantCoordinates = self._galaxy.currentQuadrant.coordinates

        # And finally the rest of the UI elements
        self._quadrantMediator.enterQuadrant(quadrant=self._quadrant, enterprise=self._enterprise)

        self.logger.info(f'{self._enterprise=}')
        self.logger.info(f'{self._quadrant=}')
        self.logger.info(f'Setup Complete')
Ejemplo n.º 13
0
    def init(self):

        self.logger: Logger = getLogger(__name__)

        self._config: ConfigParser = cast(ConfigParser, None)    # initialized when empty preferences created

        self._settingsCommon: SettingsCommon       = SettingsCommon()
        self._limits:         LimitsSettings       = LimitsSettings()
        self._power:          PowerSettings        = PowerSettings()
        self._gameLevel:      GameLevelSettings    = GameLevelSettings()
        self._factors:        FactorsSettings      = FactorsSettings()
        self._debug:          DebugSettings        = DebugSettings()
        self._torpedoSpeeds:  TorpedoSpeedSettings = TorpedoSpeedSettings()
        self._developer:      DeveloperSettings    = DeveloperSettings()

        self._createEmptySettings()
        self._loadSettings()

        self.logger.info(f'Game Settings singleton initialized')
Ejemplo n.º 14
0
    def setUpClass(cls):
        """"""
        TestBase.setUpLogging()
        SettingsCommon.determineSettingsLocation()

        TestEventEngine._setupGame()
Ejemplo n.º 15
0
 def setUpClass(cls):
     TestBase.setUpLogging()
     TestTorpedoSpeeds.clsLogger = getLogger(__name__)
     SettingsCommon.determineSettingsLocation()
Ejemplo n.º 16
0
 def setUpClass(cls):
     TestBase.setUpLogging()
     TestCoordinates.clsLogger = getLogger(__name__)
     SettingsCommon.determineSettingsLocation()
Ejemplo n.º 17
0
 def setUpClass(cls):
     TestBase.setUpLogging()
     TestIntelligence.clsLogger = getLogger(__name__)
     SettingsCommon.determineSettingsLocation()
Ejemplo n.º 18
0
 def setUpClass(cls):
     TestBase.setUpLogging()
     TestMessageConsole.clsLogger = getLogger(__name__)
     SettingsCommon.determineSettingsLocation()