コード例 #1
0
	def __init__(self, levelmanager):
		# whether edit mode is showing or not
		self.levelmanager = levelmanager
		self.game = levelmanager
		self.mode = False
		self.level = None
		self.editButton = EditButton(self)
		self.lockButton = LockButton(self)
		self.newButton = NewButton(self)
		Concurrent.__init__(self)
		EventMonitor.__init__(self)
		# make sure we are placed in front of other things
		self.priority = 2
		# edit button turns on the other buttons
		self.Add(self.editButton)
		# all the other buttons
		self.buttonGroup = ImageRadioButtonGroup()
		# hold on to all the buttons
		self.editInterface = EditInterface()
		self.editInterface.Add(self.buttonGroup)
		for b in ['platform', 'ladder', 'portal', 'item', '---', 'move', 'delete', 'clone']:
			FamilyButton(b, self, self.buttonGroup)
		
		self.pentool = Tools.PenTool(self, self.buttonGroup)
		self.linetool = Tools.LineTool(self, self.buttonGroup)
		self.filltool = Tools.FillTool(self, self.buttonGroup)
		self.airbrushtool = Tools.AirbrushTool(self, self.buttonGroup)
		# tools which remote users are currently using (created dynamically)
		self.networktools = {}
		
		# the save button
		self.editInterface.Add(self.newButton)
		self.editInterface.Add(self.lockButton)
		# portal destination selector
		self.portalDestinationIcon = PortalDestinationIcon(self)
		self.editInterface.Add(self.portalDestinationIcon)
		# other stuff
		self.selected = ""
		self.down = False
		self.rect = None
		self.currentSurface = None
		self.color = (255, 255, 255)
		self.colorPicker = ColorPicker(self)
		self.editInterface.Add(self.colorPicker)
		self.lastHover = None
		self.loadProgress = 0
		
		# for some tools we need to know where the mouse button down event happened, so we can rubber band and the like...
		self.mouseDownPosition = [None,None]
		
		# for some tools, while the mouse is moving, we need to know the last mousemove pixel position. This stores that.
		# this way we can tell wether a mouse move actually moves through a large pixel to another
		self.mouseMovePosition = [None,None]
		
		# saved subimage for rubber banding
		self.savedImage = None
		
		# for line tool
		self.image_start = None
		
		# once we have received a level udpate from the server, we should tell the game about it
		self.startDest = None