示例#1
0
def printInfo():
    gamesFolderPath = config.getFMCGamesFolderPath()
    games = config.getFMCGames()
    numberOfGames = len(games)
    utils.openPar("SHIPPER - The script will ship via fastlane in " +
                  str(numberOfGames) + " games" + "\nProjects path:  " +
                  gamesFolderPath)
示例#2
0
def printInfo():
    gamesFolderPath = config.getFMCGamesFolderPath()
    numberOfGames = len(config.getFMCGames())
    utils.openPar("PROJECT BUILDER - this script will build " +
                  str(numberOfGames) + " games" + "\nProjects path:  " +
                  gamesFolderPath + "\nNOTE:this might take a long time!")
    utils.waitForEnterKey()
示例#3
0
	def getConfig(self):
		fmcInfoFileName = "fmcinfo.xml"
		fmcinfopath = os.path.join(config.getFMCGamesFolderPath(), self.internalGameName, config.unityBuildFolderName, fmcInfoFileName)
		
		if os.path.isfile(fmcinfopath):
			return GameConfig(fmcinfopath)
		else:
			return None
示例#4
0
def printInfo():
    fmcRepoURL = config.getFMCRepoURL()
    gamesFolderPath = config.getFMCGamesFolderPath()
    numberOfGames = len(config.getFMCGames())

    utils.openPar(
        "FRAMEWORK PULL - The script will pull the fmc subtree in " +
        str(numberOfGames) + " games" + "\nProjects path:  " +
        gamesFolderPath + "\nFramework repo: " + fmcRepoURL +
        "\nNOTE:The script is going to git reset hard every project!")
示例#5
0
	def fromInternalName(internalGameName):
		path = os.path.join(config.getFMCGamesFolderPath(), internalGameName)
		return Game(path) if os.path.isdir(path) else None
示例#6
0
def createNewProject(gameName):
    unityExePath = config.getUnityExePath()
    unityExeFolderPath = os.path.abspath(os.path.join(unityExePath, os.pardir))
    gamesFolderPath = config.getFMCGamesFolderPath()
    nguiFolderPath = config.getNGUIFolderPath()
    parentRemoteURL = config.getParentRemoteURL()
    fmcRepoURL = config.getFMCRepoURL()

    #asking for project name
    gamePath = os.path.join(gamesFolderPath, gameName)
    ok = isGameNameValid(gamePath, gameName)
    if not ok:
        printIntro()
        while not ok:
            gameName = input(
                'Enter the internal game name (no spaces, all lowercase! - e.g. stopthefall): '
            )
            gamePath = os.path.join(gamesFolderPath, gameName)
            ok = isGameNameValid(gamePath, gameName)

    repoUrl = parentRemoteURL + gameName

    #we have a valid game path and git repo. Ask for confirm...
    utils.printWhiteLines(2)
    utils.openPar("\nProject root: " + gamePath + "\nRemote repo:  " +
                  repoUrl + "\nInternal name:" + gameName)
    utils.waitForEnterKey()

    #creating Unity project...
    print('Creating Unity project. This will take some time...')
    pars = [unityExePath] + utils.parList(
        '-quit -batchmode -nographics -createproject') + [gamePath]
    subprocess.call(pars)
    print('Unity project created!')
    time.sleep(1)

    game = Game(gamePath)

    #init local git repo...
    subprocess.call(utils.parList("git init"), cwd=gamePath)
    subprocess.call(utils.parList("git remote add origin", repoUrl),
                    cwd=gamePath)

    #adding .gitignore...
    shutil.copy(config.unityGitignorePath,
                os.path.join(gamePath, ".gitignore"))
    game.gitAdd(".gitignore")
    game.gitCommit("Added .gitignore")

    #creating remote repo...
    remoteURL = parentRemoteURL + gameName + ".git"
    subprocess.call(utils.parList("git push --set-upstream", remoteURL,
                                  "master"),
                    cwd=gamePath)

    #first commit...
    game.gitAdd(".")
    game.gitCommit("Initial commit")

    #adding subtree...
    subprocess.call(utils.parList("git pull -u origin master"), cwd=gamePath)
    subprocess.call(utils.parList("git subtree add --prefix",
                                  config.gitSubtreePrefix, fmcRepoURL,
                                  "master --squash"),
                    cwd=gamePath)
    subprocess.call(utils.parList("git push -u origin master"), cwd=gamePath)

    #adding NGUI...
    shutil.copytree(nguiFolderPath, os.path.join(gamePath, "Assets", "NGUI"))
    game.gitAdd(".")
    game.gitCommit("Added NGUI")

    #creating _content folders...
    utils.createFolder(os.path.join(gamePath, config.fmcContentFolder))
    utils.createFolder(
        os.path.join(gamePath, config.fmcContentFolder, "Images"))
    utils.createFolder(
        os.path.join(gamePath, config.fmcContentFolder, "Prefabs"))
    utils.createFolder(
        os.path.join(gamePath, config.fmcContentFolder, "Scripts"))

    #Launching project and creating game settings
    print("Opening the game and creating settings...")
    game.runUnityMethod(config.unityUpdateSettingsMethodName)
    game.gitAdd(".")
    game.gitCommit("Added game settings")
    game.gitPush()

    webbrowser.open(remoteURL)
    os.startfile(os.path.realpath(gamePath))

    game.launchUnity(config.unityFirstProjectLaunchMethodName, False)

    utils.closePar("FINISHED")