From 9ee60f4da447ed60a5221aeed366ae7fd6b85e49 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Wed, 30 Nov 2011 19:45:31 -0600 Subject: Added the start of exit system, still needs refinement --- Resources/Exit.png | Bin 0 -> 1878 bytes Resources/ExitWorld.png | Bin 0 -> 4997 bytes src/editorui/paths.py | 33 +++++++++++++++++++++++++-------- src/mapdata.py | 12 +++++++----- 4 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 Resources/Exit.png create mode 100644 Resources/ExitWorld.png diff --git a/Resources/Exit.png b/Resources/Exit.png new file mode 100644 index 0000000..b6d1fb8 Binary files /dev/null and b/Resources/Exit.png differ diff --git a/Resources/ExitWorld.png b/Resources/ExitWorld.png new file mode 100644 index 0000000..b0940ee Binary files /dev/null and b/Resources/ExitWorld.png differ diff --git a/src/editorui/paths.py b/src/editorui/paths.py index ec98fb9..fd27a9c 100644 --- a/src/editorui/paths.py +++ b/src/editorui/paths.py @@ -18,7 +18,8 @@ class KPEditorNode(KPEditorItem): self.iconList = [QtGui.QIcon("Resources/Through.png"), QtGui.QIcon("Resources/Level.png"), - QtGui.QIcon("Resources/Stop.png")] + QtGui.QIcon("Resources/Stop.png"), + QtGui.QIcon("Resources/Exit.png")] self.state = 0 @@ -26,13 +27,13 @@ class KPEditorNode(KPEditorItem): KPEditorNode.ToggleButton.PALETTE = QtGui.QPalette(Qt.transparent) self.setPalette(self.PALETTE) - + self.released.connect(self.toggle) def toggle(self): self.state += 1 - if self.state == 3: + if self.state == 4: self.state = 0 self.stateToggled.emit(self.state) @@ -112,19 +113,27 @@ class KPEditorNode(KPEditorItem): node = self._nodeRef() + node.transition = 0 + node.mapChange = None + node.mapID = None + node.isStop = True + node.level = [0,0] + if state == 1: - node.isStop = True node.level = [1, 1] self.world.setValue(node.level[0]) self.stage.setValue(node.level[1]) elif state == 2: - node.isStop = True - node.level = [0,0] + pass - else: + elif state == 3: node.isStop = False - node.level = [0,0] + + else: + node.transition = 0 + node.mapChange = 'None.arc' + node.mapID = 0 self.update() @@ -170,6 +179,12 @@ class KPEditorNode(KPEditorItem): painter.drawPixmap(self._boundingRect.topLeft(), QtGui.QPixmap("Resources/BlackLevel.png")) selectionRect = self._boundingRect.adjusted(1,5,-1,-5) + elif node.mapChange != None: + painter.setBrush(QtGui.QColor(0, 0, 0, 0)) + painter.setPen(QtGui.QColor(0, 0, 0, 0)) + painter.drawPixmap(self._boundingRect.topLeft(), QtGui.QPixmap("Resources/ExitWorld.png")) + selectionRect = self._boundingRect.adjusted(1,5,-1,-5) + elif node.isStop: brush = QtGui.QBrush(QtGui.QColor(255, 220, 220)) painter.setPen(QtGui.QColor(255, 255, 255)) @@ -185,6 +200,8 @@ class KPEditorNode(KPEditorItem): selectionRect = self._tinyRect.adjusted(-1,-1,1,1) + + if self.isSelected(): painter.setPen(self.SELECTION_PEN) painter.setBrush(QtGui.QColor(0,0,0,0)) diff --git a/src/mapdata.py b/src/mapdata.py index 0866815..5f92968 100644 --- a/src/mapdata.py +++ b/src/mapdata.py @@ -170,6 +170,9 @@ class KPNode(object): self.exits = [] self.level = [0,0] self.isStop = False + self.mapChange = None + self.transition = 0 + self.mapID = None class KPPath(object): @@ -368,8 +371,7 @@ class KPMap(object): def loadTilesets(self): - import os - from hashlib import sha256 as sha + import os, hashlib path = os.getcwd() + os.sep + 'Tilesets' @@ -385,21 +387,21 @@ class KPMap(object): filehandler = open(filepath) data = filehandler.read() filehandler.close() - hash = sha(data).hexdigest() + hash = hashlib.sha256(data).hexdigest() self.tilesets[name] = {'path': filepath, 'hash': hash} self.loadedTilesets[name] = KPTileset.loadFromArc(filepath) def reloadTileset(self, name): - from hashlib import sha256 as sha + from hashlib import info = self.tilesets[name] filehandler = open(info['path']) data = filehandler.read() filehandler.close() - hash = sha(data).hexdigest() + hash = hashlib.sha256(data).hexdigest() if info['hash'] != hash: self.loadedTilesets[name] = KPTileset.loadFromArc(info['path']) -- cgit v1.2.3