当前位置: 首页>>代码示例>>Python>>正文


Python Engine.__init__方法代码示例

本文整理汇总了Python中Engine.Engine.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.__init__方法的具体用法?Python Engine.__init__怎么用?Python Engine.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Engine.Engine的用法示例。


在下文中一共展示了Engine.__init__方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import __init__ [as 别名]
	def __init__(self):
		import Driver.UpdateDriver
		import ActorEngine

		Engine.__init__(self)
		
		attributes = {
			'commandList' : {},
			'emoteList': []
		}

		for key in attributes.keys():
			self.attributes[key] = attributes[key]

		self.addEventHandlerByNameWithAdjusters('Engine.EventHandlers.CommandEngine.CommandExecutionEventHandler', None)
		
		CommandEngine.instance = self
		
		for subscriber in CommandEngine.subscribers:
			self.addEventSubscriber(subscriber)
			
		CommandEngine.subscribers = []
		
		self.buildCommandList()
		
		Driver.UpdateDriver.addEventSubscriber(self)
		ActorEngine.addEventSubscriber(self)
开发者ID:longstl,项目名称:python_mud,代码行数:29,代码来源:CommandEngine.py

示例2: __init__

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import __init__ [as 别名]
	def __init__(self):
		from Driver import LoginListener
		import threading
		import CommandEngine
		
		Engine.__init__(self)
		
		attributes = {
			'openConnectionsSemaphore'	: threading.BoundedSemaphore(3),
			'newConnectionSemaphore'	: threading.BoundedSemaphore(1),
			'closedConnectionSemaphore' : threading.BoundedSemaphore(1),
			'connectionList'			: [],
			'newConnections'			: [],
			'closedConnections'			: []
		}
		
		for key in attributes.keys():
			self.attributes[key] = attributes[key]


		self.addEventHandlerByNameWithAdjusters('Engine.EventHandlers.ConnectionEngine.PlayerLoginHandler', None)
		self.addEventHandlerByNameWithAdjusters('Engine.EventHandlers.ConnectionEngine.PlayerLogoutHandler', None)
		
		ConnectionEngine.instance = self
		
		LoginListener.addEventSubscriber(self)
		CommandEngine.addEventSubscriber(self)
开发者ID:longstl,项目名称:python_mud,代码行数:29,代码来源:ConnectionEngine.py

示例3: __init__

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import __init__ [as 别名]
	def __init__(self):
		import Driver.ConnectionListUpdater
		import CommandEngine
		
		Engine.__init__(self)
		
		attributes = {
			'roomMap'	: {},
			'roomList'	: []
		}
		
		for key in attributes.keys():
			self.attributes[key] = attributes[key]
		
		self.addEventHandlerByNameWithAdjusters('Engine.EventHandlers.RoomEngine.PlayerLoginEventHandler', None)
		self.addEventHandlerByNameWithAdjusters('Engine.EventHandlers.RoomEngine.PlayerLogoutEventHandler', None)
		
		RoomEngine.instance = self
		
		for subscriber in RoomEngine.subscribers:
			self.addEventSubscriber(subscriber)
			
		RoomEngine.subscribers = []
		
		self.buildWorld()
		
		Driver.ConnectionListUpdater.addEventSubscriber(self)
		CommandEngine.addEventSubscriber(self)
开发者ID:longstl,项目名称:python_mud,代码行数:30,代码来源:RoomEngine.py

示例4: __init__

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import __init__ [as 别名]
 def __init__(self, btcTrader, apiName, authId, authPass):
     Engine.__init__(self, apiName, btcTrader, 1) # refresh rate of 1 second. In the futur with the websockets we will probably put 0 and use some kind of select
     self.req = self.CreateRequester(authId, authPass)
     self.depth = {}
     self.clock = Clock()
     self.first = 1
     self.account = Account()
开发者ID:PoncinMatthieu,项目名称:BTCTrader,代码行数:9,代码来源:Market.py

示例5: __init__

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import __init__ [as 别名]
	def __init__(self):
		Engine.__init__(self)
		
		import CommandEngine
		import threading
		import Driver.ConnectionListUpdater
		
		attributes = {
			'playerSetSemaphore'	: threading.BoundedSemaphore(1),
			'playerMap'				: {},
			'playerList'			: [],
			'npcMap'				: {}
		}
		
		for key in attributes.keys():
			self.attributes[key] = attributes[key]
			
		ActorEngine.instance = self
	
		self.addEventHandlerByNameWithAdjusters('Engine.EventHandlers.ActorEngine.PlayerLoginEventHandler', None)
		self.addEventHandlerByNameWithAdjusters('Engine.EventHandlers.ActorEngine.PlayerLogoutEventHandler', None)
		self.addEventHandlerByNameWithAdjusters('Engine.EventHandlers.ActorEngine.BroadcastEventHandler', None)
		
		
		for subscriber in ActorEngine.subscribers:
			self.addEventSubscriber(subscriber)
			
		ActorEngine.subscribers = []
		
		
		Driver.ConnectionListUpdater.addEventSubscriber(self)
		CommandEngine.addEventSubscriber(self)
开发者ID:longstl,项目名称:python_mud,代码行数:34,代码来源:ActorEngine.py

示例6: __init__

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import __init__ [as 别名]
 def __init__(self, btcTrader):
     Engine.__init__(self, "Interface", btcTrader, 0.0333333) # 1/30 --> 30 frame per seconds
     self.currentConsole = 0
     self.commandLine = ""
     self.cursorPosition = 0
     self.printset = set(string.printable)
     self.PushMsg("Hola !")
     self.PushMsg("PageUp / PageDown to change of market.")
     self.PushMsg("Type help to see the list of available commands.")
开发者ID:PoncinMatthieu,项目名称:BTCTrader,代码行数:11,代码来源:Interface.py

示例7: __init__

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import __init__ [as 别名]
	def __init__(self):
		Engine.__init__(self)
		attributes = {
			'affects'			: {},
			'affectComponents'	: {}
		}

		for key in attributes.keys():
			self.attributes[key] = attributes[key]
			
		AffectEngine.instance = self
		
		self.buildAffectList()
		self.buildAffectComponentList()
开发者ID:longstl,项目名称:python_mud,代码行数:16,代码来源:AffectEngine.py

示例8: __init__

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import __init__ [as 别名]
	def __init__(self):
		Engine.__init__(self)
		
		attributes = {
			'itemList'				: [],
			'itemLoadFunctions'		: {
											'wieldable'	: self.loadWeapon
			}
		}

		for key in attributes.keys():
			self.attributes[key] = attributes[key]
			
		ItemEngine.instance = self
		
		for subscriber in ItemEngine.subscribers:
			self.addEventSubscriber(subscriber)
			
		ItemEngine.subscribers = []
开发者ID:longstl,项目名称:python_mud,代码行数:21,代码来源:ItemEngine.py

示例9: __init__

# 需要导入模块: from Engine import Engine [as 别名]
# 或者: from Engine.Engine import __init__ [as 别名]
    def __init__(self, config = None):
        """
        Constructor.

        @param config:  L{Config} instance for settings
        """

        if not config:
            config = Config.load()

        self.config  = config

        fps          = self.config.get("video", "fps")
        tickrate     = self.config.get("engine", "tickrate")
        Engine.__init__(self, fps = fps, tickrate = tickrate)

        pygame.init()

        self.title             = _("Frets on Fire")
        self.restartRequested  = False
        self.handlingException = False
        self.video             = Video(self.title)
        self.audio             = Audio()

        Log.debug("Initializing audio.")
        frequency    = self.config.get("audio", "frequency")
        bits         = self.config.get("audio", "bits")
        stereo       = self.config.get("audio", "stereo")
        bufferSize   = self.config.get("audio", "buffersize")

        self.audio.pre_open(frequency = frequency, bits = bits, stereo = stereo, bufferSize = bufferSize)
        pygame.init()
        self.audio.open(frequency = frequency, bits = bits, stereo = stereo, bufferSize = bufferSize)

        Log.debug("Initializing video.")
        width, height = [int(s) for s in self.config.get("video", "resolution").split("x")]
        fullscreen    = self.config.get("video", "fullscreen")
        multisamples  = self.config.get("video", "multisamples")
        self.video.setMode((width, height), fullscreen = fullscreen, multisamples = multisamples)

        # Enable the high priority timer if configured
        if self.config.get("engine", "highpriority"):
            Log.debug("Enabling high priority timer.")
            self.timer.highPriority = True

        viewport = glGetIntegerv(GL_VIEWPORT)
        h = viewport[3] - viewport[1]
        w = viewport[2] - viewport[0]
        geometry = (0, 0, w, h)
        self.img = ImgContext(geometry)
        glViewport(int(viewport[0]), int(viewport[1]), int(viewport[2]), int(viewport[3]))

        self.input     = Input()
        self.view      = View(self, geometry)
        self.resizeScreen(w, h)

        self.resource  = Resource(Version.dataPath())
        self.server    = None
        self.sessions  = []
        self.mainloop  = self.loading

        # Load game modifications
        Mod.init(self)
        theme = Config.load(self.resource.fileName("theme.ini"))
        Theme.open(theme)

        # Make sure we are using the new upload URL
        if self.config.get("game", "uploadurl").startswith("http://kempele.fi"):
            self.config.set("game", "uploadurl", "http://fretsonfire.sourceforge.net/play")

        self.addTask(self.audio, synchronized = False)
        self.addTask(self.input, synchronized = False)
        self.addTask(self.view)
        self.addTask(self.resource, synchronized = False)
        self.data = Data(self.resource, self.img)

        self.input.addKeyListener(FullScreenSwitcher(self), priority = True)
        self.input.addSystemEventListener(SystemEventHandler(self))

        self.debugLayer         = None
        self.startupLayer       = None
        self.loadingScreenShown = False

        Log.debug("Ready.")
开发者ID:Hawkheart,项目名称:fof-reborn,代码行数:86,代码来源:GameEngine.py


注:本文中的Engine.Engine.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。