diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/editorui/paths.py | 33 | ||||
-rw-r--r-- | src/mapdata.py | 12 |
2 files changed, 32 insertions, 13 deletions
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']) |