def writeGlobalPath(filehandler):
	roomList = ""
	PPL = generateGPL_PPL()["PPL"]
	for room in PPL:
		roomList += "\"{name}\",".format(name = room)
	roomList = "{" + roomList[:-1] + "}" # Remove ending ",", add brackets
	line = "\tpublic static string[] GlobalPath = {};\n\n".format(roomList)
	filehandler.write(line)
def writePaths(filehandler):
	#type f: file operation handler
	GPL = generateGPL_PPL()["GPL"]
	for path in GPL:
		#Write a lien of path
		line = "\tpublic static Path {name} = new Path (\"{name}\", ".format(name = path.name)\
			+ "{f}f, ".format(f = str(path.frequency)) \
			+ "\"{room}\", ".format(room = path.startroom)\
			+ "ES_Mapconfig.{exit}, new Vector3[] {node});\n".format(exit = path.exit, node = "{"+path.nodes2str()+"}")
		filehandler.write(line)
def writePPL(filehandler):
	line = "\t//PPLs are here.\n" #Comments
	filehandler.write(line)
	#Read PPL
	PPL = generateGPL_PPL()["PPL"]
	for room in PPL:
		line = "\tpublic static string[] Lib_{rm} = ".format(rm = room)
		plist = ""
		for path in PPL[room]:
			plist += "\"{pname}\",".format(pname = path.name)
		plist = "{"+ plist[:-1] +"}" #Add brackets and remove ending ","
		line += "{plist};\n".format(plist = plist)
		filehandler.write(line)
	filehandler.write("\n")
def writeName2Path(filehandler):
	#Write starting line and bracket
	line = "\tpublic static Path Name_to_Path (string name)\n\t{\n"
	filehandler.write(line)
	#Write switch function
	##Write starting line of switch statement
	filehandler.write("\t\tswitch (rm) {\n")

	#Write case statements
	GPL = generateGPL_PPL()["GPL"]
	for path in GPL:
		filehandler.write("\t\tcase {}:\n".format("\""+path.name+"\""))
		filehandler.write("\t\t\treturn {};\n".format(path.name))

	#Write default statements
	filehandler.write("\t\tdefault:\n")
	filehandler.write("\t\t\tDebug.LogError({msg});\n".format(msg = "\"Path name NOT FOUND!\""))
	filehandler.write("\t\t\treturn null;\n")
	#Write ending line of switch statement
	filehandler.write("\t\t}\n")
	#Write ending line and bracket
	line = "\t}\n\n"
	filehandler.write(line)
def writeFindLib(filehandler):
	line = "\t//FindLib method here.\n"
	filehandler.write(line)
	#Write starting line and bracket
	line = "\tpublic static string[] FindLib (string rm)\n\t{\n"
	filehandler.write(line)
	#Write switch function
	##Write starting line of switch statement
	filehandler.write("\t\tswitch (rm) {\n")

	#Write case statements
	PPL = generateGPL_PPL()["PPL"]
	for room in PPL:
		filehandler.write("\t\tcase {}:\n".format("\""+room+"\""))
		filehandler.write("\t\t\treturn Lib_{};\n".format(room))
	#Write default statements
	filehandler.write("\t\tdefault:\n")
	filehandler.write("\t\t\tDebug.LogError({msg});\n".format(msg = "\"Unknown room name!\""))
	filehandler.write("\t\t\treturn null;\n")
	#Write ending line of switch statement
	filehandler.write("\t\t}\n")
	#Write ending line and bracket
	line = "\t}\n\n"
	filehandler.write(line)