def fini(): LOG_DEBUG('fini') if OfflineMode.enabled(): OfflineMode.onShutdown() return if OfflineMode.enabled(): return BigWorld.wg_setScreenshotNotifyCallback(None) if g_postProcessing is None: return g_critMemHandler.restore() g_critMemHandler.destroy() if constants.IS_CAT_LOADED: import Cat Cat.fini() if MusicController.g_musicController is not None: MusicController.g_musicController.destroy() if TriggersManager.g_manager is not None: TriggersManager.g_manager.destroy() TriggersManager.g_manager = None if RSSDownloader.g_downloader is not None: RSSDownloader.g_downloader.destroy() connectionManager.onConnected -= onConnected connectionManager.onDisconnected -= onDisconnected MessengerEntry.g_instance.fini() g_postProcessing.fini() from helpers import EdgeDetectColorController if EdgeDetectColorController.g_instance is not None: EdgeDetectColorController.g_instance.destroy() EdgeDetectColorController.g_instance = None BigWorld.resetEntityManager(False, False) BigWorld.clearAllSpaces() from gui.social_network_login.Bridge import bridge bridge.fini() gui_personality.fini() tutorialLoaderFini() import LcdKeyboard LcdKeyboard.finalize() import Vibroeffects if Vibroeffects.VibroManager.g_instance is not None: Vibroeffects.VibroManager.g_instance.destroy() Vibroeffects.VibroManager.g_instance = None if g_replayCtrl is not None: g_replayCtrl.destroy() from LightFx import LightManager if LightManager.g_instance is not None: LightManager.g_instance.destroy() LightManager.g_instance = None import AuxiliaryFx if AuxiliaryFx.g_instance is not None: AuxiliaryFx.g_instance.destroy() AuxiliaryFx.g_instance = None from predefined_hosts import g_preDefinedHosts if g_preDefinedHosts is not None: g_preDefinedHosts.fini() voipRespHandler = VOIP.getVOIPManager() if voipRespHandler is not None: VOIP.getVOIPManager().destroy() Settings.g_instance.save()
def handleMouseEvent(event): if OfflineMode.handleMouseEvent(event): return True else: dx, dy, dz, cursorPos = convertMouseEvent(event) if constants.IS_CAT_LOADED: import Cat if Cat.handleMouseEvent(dx, dy, dz): return True if g_replayCtrl.isPlaying: if g_replayCtrl.handleMouseEvent(dx, dy, dz): return True if GUI.handleMouseEvent(event): return True inputHandler = getattr(BigWorld.player(), 'inputHandler', None) if inputHandler is not None: if inputHandler.handleMouseEvent(dx, dy, dz): return True for handler in g_mouseEventHandlers: try: if handler(event): return True except Exception: LOG_CURRENT_EXCEPTION() return False
def handleMouseEvent(event): if OfflineMode.handleMouseEvent(event): return True dx, dy, dz, cursorPos = convertMouseEvent(event) if constants.IS_CAT_LOADED: import Cat if Cat.handleMouseEvent(dx, dy, dz): return True if g_replayCtrl.isPlaying: if g_replayCtrl.handleMouseEvent(dx, dy, dz): return True if GUI.handleMouseEvent(event): return True inputHandler = getattr(BigWorld.player(), 'inputHandler', None) if inputHandler is not None: if inputHandler.handleMouseEvent(dx, dy, dz): return True for handler in g_mouseEventHandlers: try: if handler(event): return True except Exception: LOG_CURRENT_EXCEPTION() return False
def handleKeyEvent(event): if OfflineMode.handleKeyEvent(event): return True else: isDown, key, mods, isRepeat = convertKeyEvent(event) if WebBrowser.g_mgr.handleKeyEvent(event): return True if g_replayCtrl.isPlaying: if g_replayCtrl.handleKeyEvent(isDown, key, mods, isRepeat, event): return True if isRepeat: if onRepeatKeyEvent(event): return True if constants.IS_CAT_LOADED: import Cat if Cat.handleKeyEventBeforeGUI(isDown, key, mods, event): return True if not isRepeat: InputHandler.g_instance.handleKeyEvent(event) if GUI.handleKeyEvent(event): return True if constants.IS_CAT_LOADED: import Cat if Cat.handleKeyEventAfterGUI(isDown, key, mods, event): return True if not isRepeat: if MessengerEntry.g_instance.gui.isEditing(event): return True inputHandler = getattr(BigWorld.player(), 'inputHandler', None) if inputHandler is not None: if inputHandler.handleKeyEvent(event): return True for handler in g_keyEventHandlers: try: if handler(event): return True except Exception: LOG_CURRENT_EXCEPTION() return False
def handleKeyEvent(event): if OfflineMode.handleKeyEvent(event): return True isDown, key, mods, isRepeat = convertKeyEvent(event) if WebBrowser.g_mgr.handleKeyEvent(event): return True if g_replayCtrl.isPlaying: if g_replayCtrl.handleKeyEvent(isDown, key, mods, isRepeat, event): return True if isRepeat: if onRepeatKeyEvent(event): return True if constants.IS_CAT_LOADED: import Cat if Cat.handleKeyEventBeforeGUI(isDown, key, mods, event): return True if not isRepeat: InputHandler.g_instance.handleKeyEvent(event) if GUI.handleKeyEvent(event): return True if constants.IS_CAT_LOADED: import Cat if Cat.handleKeyEventAfterGUI(isDown, key, mods, event): return True if not isRepeat: if MessengerEntry.g_instance.gui.isEditing(event): return True inputHandler = getattr(BigWorld.player(), 'inputHandler', None) if inputHandler is not None: if inputHandler.handleKeyEvent(event): return True for handler in g_keyEventHandlers: try: if handler(event): return True except Exception: LOG_CURRENT_EXCEPTION() return False
def fini(): LOG_DEBUG('fini') if OfflineMode.enabled(): OfflineMode.onShutdown() return elif OfflineMode.enabled(): return else: BigWorld.wg_setScreenshotNotifyCallback(None) if g_postProcessing is None: return g_critMemHandler.restore() g_critMemHandler.destroy() if constants.IS_CAT_LOADED: import Cat Cat.fini() if MusicController.g_musicController is not None: MusicController.g_musicController.destroy() if TriggersManager.g_manager is not None: TriggersManager.g_manager.destroy() TriggersManager.g_manager = None if RSSDownloader.g_downloader is not None: RSSDownloader.g_downloader.destroy() connectionManager.onConnected -= onConnected connectionManager.onDisconnected -= onDisconnected MessengerEntry.g_instance.fini() g_postProcessing.fini() from helpers import EdgeDetectColorController if EdgeDetectColorController.g_instance is not None: EdgeDetectColorController.g_instance.destroy() EdgeDetectColorController.g_instance = None BigWorld.resetEntityManager(False, False) BigWorld.clearAllSpaces() from gui.social_network_login.Bridge import bridge bridge.fini() gui_personality.fini() tutorialLoaderFini() import LcdKeyboard LcdKeyboard.finalize() import Vibroeffects if Vibroeffects.VibroManager.g_instance is not None: Vibroeffects.VibroManager.g_instance.destroy() Vibroeffects.VibroManager.g_instance = None if g_replayCtrl is not None: g_replayCtrl.destroy() from LightFx import LightManager if LightManager.g_instance is not None: LightManager.g_instance.destroy() LightManager.g_instance = None import AuxiliaryFx if AuxiliaryFx.g_instance is not None: AuxiliaryFx.g_instance.destroy() AuxiliaryFx.g_instance = None from predefined_hosts import g_preDefinedHosts if g_preDefinedHosts is not None: g_preDefinedHosts.fini() voipRespHandler = VOIP.getVOIPManager() if voipRespHandler is not None: VOIP.getVOIPManager().destroy() Settings.g_instance.save() return
def start(): LOG_DEBUG('start') if OfflineMode.onStartup(): LOG_DEBUG('OfflineMode') return else: connectionManager.onConnected += onConnected connectionManager.onDisconnected += onDisconnected if len(sys.argv) > 2: if sys.argv[1] == 'scriptedTest': try: scriptName = sys.argv[2] if scriptName[-3:] == '.py': scriptName = scriptName[:-3] try: __import__(scriptName) except ImportError: try: __import__('tests.' + scriptName) except ImportError: __import__('cat.' + scriptName) except: LOG_CURRENT_EXCEPTION() BigWorld.wg_writeToStdOut('Failed to run scripted test, Python exception was thrown, see python.log') BigWorld.quit() elif sys.argv[1] == 'offlineTest': try: from cat.tasks.TestArena2 import TestArena2Object LOG_DEBUG(sys.argv) LOG_DEBUG('starting offline test: %s', sys.argv[2]) if len(sys.argv) > 3: TestArena2Object.startOffline(sys.argv[2], sys.argv[3]) else: TestArena2Object.startOffline(sys.argv[2]) except: LOG_DEBUG('Game start FAILED with:') LOG_CURRENT_EXCEPTION() elif sys.argv[1] == 'validationTest': try: gui_personality.start() LOG_DEBUG('starting validationTest') import Cat Cat.Tasks.Validation.ParamsObject.setResultFileName(sys.argv[2]) BigWorld.callback(10, Cat.Tasks.Validation.startAllValidationTests) except: LOG_DEBUG('Game start FAILED with:') LOG_CURRENT_EXCEPTION() elif sys.argv[1] == 'resourcesValidationTest': try: gui_personality.start() LOG_DEBUG('starting resourcesValidationTest') import Cat Cat.Tasks.Validation.ParamsObject.setResultFileName(sys.argv[2]) BigWorld.callback(10, Cat.Tasks.Validation.startResourcesValidationTest) except: LOG_DEBUG('Game start FAILED with:') LOG_CURRENT_EXCEPTION() elif sys.argv[1] == 'replayTimeout': try: g_replayCtrl.replayTimeout = float(sys.argv[2]) except: LOG_DEBUG('Game start FAILED with:') LOG_CURRENT_EXCEPTION() gui_personality.start() elif sys.argv[1] == 'bot': gui_personality.start() try: LOG_DEBUG('BOTNET: Playing scenario "%s" with bot "%s"...' % (sys.argv[2], sys.argv[3])) sys.path.append('scripts/bot') from client.ScenarioPlayer import ScenarioPlayerObject ScenarioPlayerObject.play(sys.argv[2], sys.argv[3]) except: LOG_DEBUG('BOTNET: Failed to start the client with:') LOG_CURRENT_EXCEPTION() else: gui_personality.start() else: gui_personality.start() try: import Vibroeffects Vibroeffects.VibroManager.g_instance.start() except: LOG_CURRENT_EXCEPTION() try: import LightFx if LightFx.LightManager.g_instance is not None: LightFx.LightManager.g_instance.start() import AuxiliaryFx AuxiliaryFx.g_instance.start() except: LOG_CURRENT_EXCEPTION() return
def start(): LOG_DEBUG('start') if OfflineMode.onStartup(): LOG_DEBUG('OfflineMode') return connectionManager.onConnected += onConnected connectionManager.onDisconnected += onDisconnected if len(sys.argv) > 2: if sys.argv[1] == 'scriptedTest': try: scriptName = sys.argv[2] if scriptName[-3:] == '.py': scriptName = scriptName[:-3] try: __import__(scriptName) except ImportError: try: __import__('tests.' + scriptName) except ImportError: __import__('cat.' + scriptName) except: LOG_CURRENT_EXCEPTION() BigWorld.wg_writeToStdOut('Failed to run scripted test, Python exception was thrown, see python.log') BigWorld.quit() elif sys.argv[1] == 'offlineTest': try: from cat.tasks.TestArena2 import TestArena2Object LOG_DEBUG(sys.argv) LOG_DEBUG('starting offline test: %s', sys.argv[2]) if len(sys.argv) > 3: TestArena2Object.startOffline(sys.argv[2], sys.argv[3]) else: TestArena2Object.startOffline(sys.argv[2]) except: LOG_DEBUG('Game start FAILED with:') LOG_CURRENT_EXCEPTION() elif sys.argv[1] == 'validationTest': try: gui_personality.start() LOG_DEBUG('starting validationTest') import Cat Cat.Tasks.Validation.ParamsObject.setResultFileName(sys.argv[2]) BigWorld.callback(10, Cat.Tasks.Validation.startAllValidationTests) except: LOG_DEBUG('Game start FAILED with:') LOG_CURRENT_EXCEPTION() elif sys.argv[1] == 'resourcesValidationTest': try: gui_personality.start() LOG_DEBUG('starting resourcesValidationTest') import Cat Cat.Tasks.Validation.ParamsObject.setResultFileName(sys.argv[2]) BigWorld.callback(10, Cat.Tasks.Validation.startResourcesValidationTest) except: LOG_DEBUG('Game start FAILED with:') LOG_CURRENT_EXCEPTION() elif sys.argv[1] == 'replayTimeout': try: g_replayCtrl.replayTimeout = float(sys.argv[2]) except: LOG_DEBUG('Game start FAILED with:') LOG_CURRENT_EXCEPTION() gui_personality.start() elif sys.argv[1] == 'bot': gui_personality.start() try: LOG_DEBUG('BOTNET: Playing scenario "%s" with bot "%s"...' % (sys.argv[2], sys.argv[3])) sys.path.append('scripts/bot') from client.ScenarioPlayer import ScenarioPlayerObject ScenarioPlayerObject.play(sys.argv[2], sys.argv[3]) except: LOG_DEBUG('BOTNET: Failed to start the client with:') LOG_CURRENT_EXCEPTION() else: gui_personality.start() else: gui_personality.start() try: import Vibroeffects Vibroeffects.VibroManager.g_instance.start() except: LOG_CURRENT_EXCEPTION() try: import LightFx if LightFx.LightManager.g_instance is not None: LightFx.LightManager.g_instance.start() import AuxiliaryFx AuxiliaryFx.g_instance.start() except: LOG_CURRENT_EXCEPTION()