コード例 #1
0
    def deleteMap(self, item):
        mapForDeletion = self.initFile['LevelsList'][item.text()]

        gamefolder = current_project.settings["gamefolder"]

        target_to_delete = os.path.join(gamefolder, fifl.LEVELS,
                                        mapForDeletion)

        if (os.path.basename(current_project.settings["workingFile"]) !=
                mapForDeletion):

            reply = QtWidgets.QMessageBox.question(
                self, 'Delete?',
                'Do you really wish to delete:\n' + mapForDeletion,
                QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
            if reply == QtWidgets.QMessageBox.Yes:
                osremove(target_to_delete)
                game_init.regenerateLevelList()
                self.reloadInitFile()

        else:
            QtWidgets.QMessageBox.information(
                self, 'Delete Problem',
                "Can't delete a map while it's open in the map editor.",
                QtWidgets.QMessageBox.Ok)
コード例 #2
0
ファイル: Editor.py プロジェクト: CodosaurusRex/fgmk
    def openFileByName(self, filename):
        if (filename == "newFile.map.json"):
            return

        if os.path.isfile(filename):
            current_project.settings["gamefolder"] = os.path.abspath(
                os.path.join(os.path.dirname(str(filename)), "../../"))
            current_project.settings["workingFile"] = filename
            self.setWindowTitle(current_project.settings["workingFile"])
            self.myMap.load(current_project.settings["workingFile"])
            self.myTileSet = tile_set.TileSet(
                os.path.join(current_project.settings["gamefolder"],
                             self.myMap.tileImage), self.myMap.palette)
            self.myMapWidget.DrawMap(self)
            self.gridViewAction.setChecked(False)  # gambiarra
            self.myPaletteWidget.drawPalette(self.myTileSet)
            self.myEventsWidget.updateEventsList()
            self.myEventsWidget.enableButtonsBecauseEventsList()
            self.myCharasPalWidget.reinit()
            game_init.regenerateLevelList()
            hasinit = self.myMapExplorerWidget.reloadInitFile()
            self.setEnabledAll(hasinit == True)
            cmd.clearCommandStack()
            self.firsttime = False
            self.changeTileCurrent(0)
            if (hasinit):
                self.myServer.runServer(
                    os.path.abspath(current_project.settings["gamefolder"]))
            else:
                self.myServer.stopServer()
コード例 #3
0
ファイル: Editor.py プロジェクト: CodosaurusRex/fgmk
    def saveFile(self):
        filename = current_project.settings["workingFile"]

        if filename != "":
            self.myMap.save(filename)
            cmd.updateStackAtSave()

            if game_init.regenerateLevelList():
                self.myMapExplorerWidget.reloadInitFile()
コード例 #4
0
ファイル: Editor.py プロジェクト: SHHSSH/fgmk
 def __newFile(self, returnedNFD):
     current_project.settings["gamefolder"] = str(returnedNFD["gameFolder"])
     self.levelName = str(returnedNFD["name"])
     current_project.settings["workingFile"] = os.path.join(
         current_project.settings["gamefolder"], fifl.LEVELS, self.levelName + ".map.json")
     self.setWindowTitle(current_project.settings["workingFile"])
     palette = os.path.join(
         current_project.settings["gamefolder"], fifl.LEVELS,returnedNFD["palette"])
     self.myMap.new(self.levelName, returnedNFD[
                    "width"], returnedNFD["height"], palette)
     self.myTileSet = tile_set.TileSet(os.path.join(
         current_project.settings["gamefolder"], self.myMap.tileImage), self.myMap.palette)
     self.myMapWidget.DrawMap(self)
     self.gridViewAction.setChecked(False)  # gambiarra
     self.myPaletteWidget.drawPalette(self.myTileSet)
     self.myEventsWidget.updateEventsList()
     self.myCharasPalWidget.reinit()
     game_init.regenerateLevelList()
     hasinit = self.myMapExplorerWidget.reloadInitFile()
     self.setEnabledAll(hasinit == True)
     self.changeTileCurrent(0)
     cmd.clearCommandStack()
コード例 #5
0
ファイル: Editor.py プロジェクト: SHHSSH/fgmk
    def saveFileAs(self):
        filename, extension = QtWidgets.QFileDialog.getSaveFileName(
            self, 'Save File', os.path.expanduser("~"), 'JSON Game Level (*.map.json)')

        if filename[0] != "":
            if filename[-9:] != '.map.json':
                filename += '.map.json'

            current_project.settings["workingFile"] = filename
            self.myMap.save(current_project.settings["workingFile"])
            cmd.updateStackAtSave()

            if game_init.regenerateLevelList():
                self.myMapExplorerWidget.reloadInitFile()