Beispiel #1
0
def pullAll():
    games = config.getFMCGames()
    numberOfGames = len(games)

    gamesWithFilesToCommit = Game.getGamesWithFilesToCommit(False, False)

    if len(gamesWithFilesToCommit) > 0:
        print(
            "WARNING - the following games have files to commit! You can use 'status' to check them:"
        )
        for g in gamesWithFilesToCommit:
            print(g.gamePath)

        if not utils.readYesNo(
                "Do you want to proceed? All games will be resetted!", True):
            return

    gameNumber = 1
    for g in games:
        utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) +
                      ") UPDATING: " + g.gamePath)
        pull(g, False)
        utils.closePar("SUCCESSFULLY UPDATED: " + g.gamePath)
        utils.printWhiteLines(2)
        gameNumber += 1

    utils.closePar("FINISHED")
Beispiel #2
0
	def getGamesWithFilesToCommit(showWhich, showNothingToCommitMessage):
		games = []
		utils.printWhiteLines(1)
		for g in config.getFMCGames():
			hasFiles = g.hasFilesToCommit(showWhich, showNothingToCommitMessage)
			if hasFiles:
				games.append(g);
				if showWhich:
					utils.printWhiteLines(1)
		return games
Beispiel #3
0
def fillAllIOSTestInfo():
    games = config.getFMCGames()
    numberOfGames = len(games)
    gameNumber = 1
    for game in games:  #for each game in the fmc folder
        utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) +
                      ") FILLING TESTFLIGHT TEST INFO FOR : " + game.gamePath)
        fillIOSTestInfo(game)
        gameNumber += 1
        utils.printWhiteLines(2)
Beispiel #4
0
def checkAllIOS():
    games = config.getFMCGames()
    numberOfGames = len(games)
    gameNumber = 1
    for game in games:  #for each game in the fmc folder
        utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) +
                      ") CHECKING APP STORE FOR: " + game.gamePath)
        checkIOS(game)
        gameNumber += 1
        utils.printWhiteLines(2)
Beispiel #5
0
def updateAllIOSTesters():
    games = config.getFMCGames()
    numberOfGames = len(games)
    gameNumber = 1
    for game in games:  #for each game in the fmc folder
        utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) +
                      ") UPDATING TESTERS: " + game.gamePath)
        updateIOSTesters(game, shipOnAndroid, shipOnIOS)
        gameNumber += 1
        utils.printWhiteLines(2)
Beispiel #6
0
def shipAll(shipOnAndroid, shipOnIOS):
    games = config.getFMCGames()
    numberOfGames = len(games)
    gameNumber = 1
    for game in games:  #for each game in the fmc folder
        utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) +
                      ") SHIPPING: " + game.gamePath)
        ship(game, shipOnAndroid, shipOnIOS)
        gameNumber += 1
        utils.printWhiteLines(2)
Beispiel #7
0
def main():
	utils.printWhiteLines(1)
	utils.openPar("Welcome to the fmc toolkit. Type 'info' to get command list")
	waitingForCommand = True
	try:
		while True:
			try:
				waitingForCommand = True
				command = fmcInput()
				waitingForCommand = False
				reactToCommand(command)
			except KeyboardInterrupt:
				utils.printWhiteLines(1)
				if waitingForCommand: 
					input("Ctrl+C again to exit, enter to return to fmc")
	except KeyboardInterrupt:
		pass
Beispiel #8
0
	def pick(allowNone, noneMessage = "None"):
		games = config.getFMCGames()
		game = None

		if allowNone:
			print(f"0 - [{noneMessage}]")
		i = 1;
		for g in games:
			print(str(i) + " - " + g.internalGameName)
			i += 1

		utils.printWhiteLines(1)
		projectNumber = -1
		min = 0 if allowNone else 1
		while projectNumber < min or projectNumber > i-1:
			projectNumber = utils.readIntInRange("Insert the project number:", min, i-1)
			if projectNumber > 0:
				game = games[projectNumber-1]

		return game
Beispiel #9
0
def buildAll(buildAndroid, buildIOS):
    printInfo()
    games = config.getFMCGames()
    numberOfGames = len(games)

    errorsOccured = False
    gameNumber = 1
    for game in games:  #for each project in the fmc folder
        utils.openPar("(" + str(gameNumber) + "/" + str(numberOfGames) +
                      ") BUILDING: " + game.gamePath)

        errorsOccured = errorsOccured or build(game, buildAndroid, buildIOS)

        gameNumber += 1
        utils.printWhiteLines(1)

    if errorsOccured:
        utils.closePar("COMPLETED WITH ERRORS")
    else:
        utils.closePar("FINISHED")
Beispiel #10
0
def sign(game):

	#These fields must not contain spaces! If you need them, modify utils.parList.
	password = config.getKeystorePassword()
	companyName = config.getCompanyName()
	keystoreName = "fmc.keystore"
	alias = "fmc"

	keystorePath = os.path.join(game.gamePath, keystoreName)
	if os.path.isfile(keystorePath):
		print("SKIPPING: A keystore already exist in: " + keystorePath)
	else:
		print("OK, SIGNING: ", game.gamePath)
		pars = (f'keytool -genkey -v -keystore {keystoreName} -sigalg SHA1withRSA -alias {alias} ' +
				f'-keyalg RSA -keysize 2048 -validity 30000 -keypass {password} ' +
				f'-storepass {password} -dname O={companyName}')
		subprocess.call(utils.parList(pars), cwd=game.gamePath)

		game.gitPull()
		game.gitAdd(keystoreName)
		game.gitCommit("Added keystore file")
		game.gitPush()
	utils.printWhiteLines(1)
Beispiel #11
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")