public void IntegrateFile(string filename) { LoadDbFiles(); BuildReferenceCache(); Console.WriteLine("Integrating schema file {0}", filename); XmlImporter importer = null; using (var stream = File.OpenRead(filename)) { importer = new XmlImporter(stream); importer.Import(); } if (IntegrateExisting) { foreach (TypeInfo type in importer.Imported) { TypeInfo replaced = null; foreach (TypeInfo existing in DBTypeMap.Instance.GetVersionedInfos(type.Name, type.Version)) { if (existing.SameTypes(type)) { replaced = existing; break; } } if (replaced != null) { DBTypeMap.Instance.AllInfos.Remove(replaced); } DBTypeMap.Instance.AllInfos.Add(type); } } }
/// <summary> /// Importa la información de un fichero de mapa de alturas /// </summary> /// <param name="filename">Nombre del fichero</param> /// <param name="context">Contexto</param> /// <returns>Devuelve el descriptor del terreno cargado a partir del fichero</returns> public override SceneryFile Import(string filename, ContentImporterContext context) { // Obtiene el directorio del fichero de definición string directory = Path.GetDirectoryName(filename); // Importador XML XmlImporter importer = new XmlImporter(); // Lectura del fichero SceneryFile info = importer.Import(filename, context) as SceneryFile; // Completar los nombres de los ficheros con el directorio del fichero de definición info.HeightMapFile = Path.Combine(directory, info.HeightMapFile); info.EffectFile = Path.Combine(directory, info.EffectFile); info.Texture1File = Path.Combine(directory, info.Texture1File); info.Texture2File = Path.Combine(directory, info.Texture2File); info.Texture3File = Path.Combine(directory, info.Texture3File); info.Texture4File = Path.Combine(directory, info.Texture4File); info.DetailTexture1File = Path.Combine(directory, info.DetailTexture1File); info.DetailTexture2File = Path.Combine(directory, info.DetailTexture2File); info.DetailTexture3File = Path.Combine(directory, info.DetailTexture3File); info.DetailTexture4File = Path.Combine(directory, info.DetailTexture4File); info.BillboardEffectFile = Path.Combine(directory, info.BillboardEffectFile); info.BillboardTreeTextureFile = Path.Combine(directory, info.BillboardTreeTextureFile); info.BillboardGrassTextureFile = Path.Combine(directory, info.BillboardGrassTextureFile); // Devuelve la definición return(info); }
/// <summary> /// Cleans up XML lists, sets paused status to false, loads main menu /// /// Autor: David Askari, Courtney Chu, Cole Twitchell /// </summary> public void RestartGame() { XmlImporter.Cleanup(); PauseGame.Status = false; GameObject.Find("GameManager").GetComponent <SceneLoader>().LoadScene("main_menu"); }
private static void BuildSkill() { Console.Write("Xml: "); // Xml from Editor var input = Console.ReadLine(); if (string.IsNullOrWhiteSpace(input)) { return; } var skill = XmlImporter.Import(input, Database); var obj = Database.CopyObject(9864); var component = new LwoComponent(ComponentId.SkillComponent); obj.Add(component); var entry = Database["ObjectSkills"].Create(obj.Row.Key); var skillEntry = new ObjectSkillsTable(entry); skillEntry.castOnType = 0; skillEntry.skillID = (int)skill; }
public async Task XmlImporterTest() { XmlImporter importer = new XmlImporter(); ProgressReporter reporter = new ProgressReporter(100); int reportCount = 0; reporter.ProgressChanged += (s, e) => reportCount++; XDocument result = (XDocument)(await importer.ImportAsync(new MemoryStream(Encoding.ASCII.GetBytes(SimpleXml)), reporter)); if (reporter.ErrorMessage != null) { Assert.Fail("There was an error message:\n{0}", reporter.ErrorMessage); } Assert.IsTrue(reporter.CompletedWithoutError, "Completed with errors"); Assert.NotNull(result, "The result was null"); XElement element = result.Descendants("heading").FirstOrDefault(); Assert.AreEqual("Reminder", element.Value, "Could not decode value"); Assert.AreEqual(1, reportCount, "XmlImporter did not report progress."); Assert.AreEqual(100, reporter.Progress); }
public void OpenFileDialogTest() { XmlImporter importer = new XmlImporter(); OpenFileDialog dialog = new OpenFileDialog(); dialog.AddImporterFileTypes(importer); }
public void GetTheParametersOfXmlDllTestOk() { ReflectionLogic reflectionLogic = new ReflectionLogic(); List <Parameter> parametersOfImporterXml = reflectionLogic.GetTheParametersRequired("\\Importers\\ImporterXml.dll"); XmlImporter importerXml = new XmlImporter(); CollectionAssert.AreEqual(importerXml.GetParameter(), parametersOfImporterXml); }
/// <summary> /// Initializes ActiveEnemies, DeadEnemies, EnemyDictionary, and TargetTiles /// </summary> public void Start() { activeEnemies = new List <Enemy>(); deadEnemies = new List <Enemy>(); enemyDictionary = XmlImporter.GetEnemiesFromXml(); TargetTiles = new Tile[GameManager.Height]; }
/// <summary> /// Initializes everything needed for game play. /// /// Authors: Amy Lewis, Cole Twitchell, David Askari, Steven Johnson, Courtney Chu /// </summary> public void Start() { gameOver = false; rewardsPanel = GameObject.Find("RewardsPanel"); rewardsPanelText = rewardsPanel.gameObject.GetComponentInChildren <Text>(); rewardsPanel.SetActive(false); didUpgradeFirstTower = false; notYetReceivedFirstTowerUpgradeReward = true; didUpgradeBulletTower = false; didUpgradeShotgunTower = false; didUpgradeBlackHoleTower = false; didUpgradeLaserTower = false; didUpgradeFlameTower = false; notYetReceivedTowerUpgradeReward = true; didPlaceBulletTower = false; didPlaceShotgunTower = false; didPlaceBlackHoleTower = false; didPlaceLaserTower = false; didPlaceFlameTower = false; notYetReceivedTowerPlacementReward = true; money = 150; canvas = GameObject.Find("Canvas"); rangeIndicatorRenderer = GameObject.Find("RangeIndicator").gameObject.GetComponent <SpriteRenderer>(); gameOverObject = canvas.transform.Find("GameOver").gameObject; gameOverObject.SetActive(false); sendBossButton = canvas.transform.Find("SendBossButton").gameObject; sendBossButton.SetActive(false); SelectedTower = null; errorTextTimer = new GameTimer(5); waveTimer = new GameTimer(); waveTimer.SetTimer(60); waveTimer.SetResetTime(30); currentWave = 1; totalWaves = WaveManager.GetWaves().Count; Transform infoPanel = canvas.transform.Find("InfoPanel"); bloodFlyTarget = infoPanel.Find("BloodPanel").gameObject; healthText = infoPanel.Find("HealthPanel").GetComponentInChildren <Text>(); moneyText = infoPanel.Find("BloodPanel").GetComponentInChildren <Text>(); waveText = infoPanel.Find("WavePanel").GetComponentInChildren <Text>(); countdownTimerText = infoPanel.Find("TimePanel").GetComponentInChildren <Text>(); waveText.text = currentWave.ToString(); errorText = _errorText; skipTimeButton = infoPanel.Find("SkipTimeButton").GetComponent <Button>(); towerScrollViewContent = canvas.transform.Find("TowerScrollView").GetComponentInChildren <GridLayoutGroup>().transform; towerBtns = new List <TowerBtn>(); towerDictionary = XmlImporter.GetTowersFromXml(); LoadTowerButtons(); StartCoroutine(BlinkText()); }
public static void Main() { IDatabase db = new Database(); //read from zip file & populate the database with more data + create updates pdf, xml & json files var reader = new ReadExcelFromZip(); var movies = reader.SelectExcelFilesFromZip("../../../../Movies.zip"); foreach (var movie in movies) { Console.WriteLine(movie.Name); } var import = new MoviesImportToSql(); import.Import(movies); Console.WriteLine("Importing data from xml..."); //Importing data from xml XmlImporter.ImportXml(db); //Console.WriteLine("Importing data to Mongo..."); //Importing data to MongoDB //ImportToMongo.ImportToMongo.ImportData(); Console.WriteLine("Generating xml files..."); //Generating Xml file report var generateXMLFile = new XMLGenerator(); generateXMLFile.Generate(db); Console.WriteLine("Generating json files..."); //Generating Json file reports var generateJsonReports = new JSONGenerator(); generateJsonReports.Generate(db); Console.WriteLine("Generating pdf reports..."); //Generating Pdf fle reports var generatePdfReports = new PDFGenerator(); generatePdfReports.Generate(db); Console.WriteLine("Sending data to MySql..."); //Sending data to MySql var sendDataToMySQL = new MySqlManager(); sendDataToMySQL.SendDataToMySql(); Console.WriteLine("Exporting data from MySql to excel file..."); //Exporting data from MySql to excel file var mySqlExcelExport = new MySqlManager(); mySqlExcelExport.ExportDataFromMySql(); }
public static void Main(string[] args) { var context = new FootballEntities(); // Problem 1.Entity Framework Mappings (Database First) //var teamsQuery = context.Teams.Select(t => t.TeamName); //foreach (var team in teamsQuery) //{ // Console.WriteLine(team); //} // Problem 2.Export the Leagues and Teams as JSON //var leaguesQuery = // context.Leagues.OrderBy(l => l.LeagueName) // .Select( // l => // new LeagueDto // { // LeagueName = l.LeagueName, // Teams = l.Teams.OrderBy(t => t.TeamName).Select(t => t.TeamName) // }) // .ToList(); //const string FilePathNameJson = "../../leagues-and-teams.json"; //var jsonExporter = new JsonExporter(); //jsonExporter.Export(FilePathNameJson, leaguesQuery); // Problem 3.Export International Matches as XML //var internationalMatchesQuery = context.InternationalMatches // .OrderBy(im => im.MatchDate) // .ThenBy(im => im.Countries) // .ThenBy(im => im.Countries1) // .Select(im => new InternationalMatchesDto() // { // HomeCountry = im.Countries1.CountryName, // AwayCountry = im.Countries.CountryName, // MatchDate = im.MatchDate.ToString(), // Score = im.HomeGoals.ToString() + "-" + im.AwayGoals.ToString(), // League = im.Leagues.LeagueName, // HomeCountryCode = im.HomeCountryCode, // AwayCountryCode = im.AwayCountryCode // }).ToList(); //const string FilePathNameXml = "../../international-matches.xml "; //var xmlExporter = new XmlExporter(); //xmlExporter.Export(FilePathNameXml, internationalMatchesQuery); // Problem 4.Import Leagues and Teams from XML // Import rivers from Xml file var xmlImporter = new XmlImporter(); var xmlDoc = XDocument.Load(@"..\..\leagues-and-teams.xml "); xmlImporter.Import(xmlDoc, context); }
public void Go() { Console.WriteLine("--> DataCapture.Workflow.Yeti.Importer()"); var dbConn = ConnectionFactory.Create(); XmlImporter importer = new XmlImporter(); foreach (var f in files_) { importer.Import(dbConn, f); } Console.WriteLine("<-- DataCapture.Workflow.Yeti.Importer()"); }
/// <summary> /// Write XML string to a temporary file and import it. This /// process may throw; if so the exception bubbles out for /// assertion that that was expected downstream /// </summary> /// <param name="xml">Xml.</param> public static void RunImporter(System.Data.IDbConnection dbConn, String xml) { using (var tmp = new TempFile(".xml")) { using (var writer = new System.IO.StreamWriter(tmp.FullName)) { writer.WriteLine(xml); } var importer = new XmlImporter(); importer.Import(dbConn, tmp.Value); } }
private void Add(bool keepExistingNames) { FileDialog fileDlg = new OpenFileDialog(); if (fileDlg.ShowDialog() == DialogResult.OK) { using (var stream = File.OpenRead(fileDlg.FileName)) { XmlImporter importer = new XmlImporter(stream); importer.Import(true); foreach (TypeInfo info in importer.Imported) { bool exists = false; foreach (TypeInfo existing in DBTypeMap.Instance.GetAllInfos(info.Name)) { if (existing.Version == info.Version && existing.SameTypes(info)) { Console.WriteLine("imported type info {0}/{1} already exists with those fields", info.Name, info.Version); exists = true; if (!keepExistingNames) { for (int j = 0; j < existing.Fields.Count; j++) { if (!existing.Fields[j].Name.Equals(info.Fields[j].Name)) { SchemaFieldNameChooser f = new SchemaFieldNameChooser(); f.LeftInfo = existing; f.RightInfo = info; if (f.ShowDialog() == DialogResult.OK) { TypeInfo result = f.MergedInfo; for (int i = 0; i < result.Fields.Count; i++) { existing.Fields[i].Name = result.Fields[i].Name; } } break; } } } break; } } if (!exists) { Console.WriteLine("imported type info {0}/{1} into schema", info.Name, info.Version); DBTypeMap.Instance.AllInfos.Add(info); } } } SetTypeInfos(); } }
public void AddSchemaFile(string file) { using (var stream = File.OpenRead(file)) { XmlImporter importer = new XmlImporter(stream); importer.Import(); foreach (TypeInfo info in importer.Imported) { Console.WriteLine("adding {0}", info.Name); DBTypeMap.Instance.AllInfos.Add(info); } } }
public override void OnInspectorGUI() { XmlImporter myScript = (XmlImporter)target; if (GUILayout.Button("Select File")) { myScript.fileName = EditorUtility.OpenFilePanel("Select Teardown XML file", "", "xml"); } GUILayout.Space(30); DrawDefaultInspector(); GUILayout.Space(30); if (GUILayout.Button("Import")) { myScript.import(); } }
private void drawImportDialog() { GUILayout.Label("Import Level XML", EditorStyles.boldLabel); levelXmlPath = EditorGUILayout.TextField("Level XML", levelXmlPath); if (GUILayout.Button("Select XML")) { levelXmlPath = EditorUtility.OpenFilePanel("Select Teardown XML file", "", "xml"); } GUILayout.Space(10); XmlImporter xmlImporter = new XmlImporter(); xmlImporter.fileName = levelXmlPath; if (GUILayout.Button("Import")) { xmlImporter.import(); } }
private void m_itemAsm_Click(object sender, EventArgs e) { SetCurrentDirectory(); var importer = new XmlImporter(m_project.ResourceDirectory); if (!importer.IsValidImportDirectory()) { LogLine("Cannot assemble game project: specified resource directory lacks essential data files.", MessageType.Warning, false); return; } importer.ProcessStarted += Importer_ProcessStarted; importer.ProcessFinished += Importer_ProcessFinished; importer.ProcessAborted += Importer_ProcessAborted; importer.CategoryProcessing += Importer_CategoryProcessing; importer.ProcessingErrorOccurred += Importer_ProcessingErrorOccurred; importer.XmlParseErrorOccurred += Importer_XmlParseErrorOccurred; if (Settings.Default.VerboseLog) { importer.ResourceProcessed += Importer_ResourceProcessed; } m_gmFile = new GameMakerFile(); SetStatus("Assembling game project..."); if (importer.Process(m_gmFile)) { LogLine("Project data collected!", MessageType.Information, false); if (SaveGameFile()) { SetLoggedStatus("Game project created."); } else { LogLine("Process aborted.", MessageType.Warning, false); SetStatus("Process aborted."); } } m_statusProgress.Value = m_statusProgress.Maximum; GenerateResourceTree(); }
public async Task XmlImporterTest() { XmlImporter importer = new XmlImporter(); ProgressReporter reporter = new ProgressReporter(100); int reportCount = 0; reporter.ProgressChanged += (s, e) => reportCount++; XDocument result = (XDocument)(await importer.ImportAsync(new MemoryStream(Encoding.ASCII.GetBytes(SimpleXml)), reporter)); if (reporter.ErrorMessage != null) Assert.Fail("There was an error message:\n{0}", reporter.ErrorMessage); Assert.IsTrue(reporter.CompletedWithoutError, "Completed with errors"); Assert.NotNull(result, "The result was null"); XElement element = result.Descendants("heading").FirstOrDefault(); Assert.AreEqual("Reminder", element.Value, "Could not decode value"); Assert.AreEqual(1, reportCount, "XmlImporter did not report progress."); Assert.AreEqual(100, reporter.Progress); }
private void exportToXML(XmlDocument xmlDoc, Transform currentObject, XmlNode parent) { XmlNode node = null; if (currentObject.GetComponent <CommentElement>() != null) { CommentElement commentElement = (CommentElement)currentObject.GetComponent <CommentElement>(); node = xmlDoc.CreateComment(commentElement.comment); } else if (currentObject.GetComponent <Scene>() != null) { Scene tag = (Scene)currentObject.GetComponent <Scene>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "scene", ""); enrichXmlWithGeneralAttributes(xmlDoc, tag, node); XmlAttribute version = xmlDoc.CreateAttribute("version"); version.Value = tag.version.ToString().Replace(",", ".");; node.Attributes.Append(version); XmlAttribute shadowvolume = xmlDoc.CreateAttribute("shadowVolume"); shadowvolume.Value = $"{tag.shadowVolume.x} {tag.shadowVolume.y} {tag.shadowVolume.z}".Replace(",", ".");; node.Attributes.Append(shadowvolume); } else if (currentObject.GetComponent <TeardownEnvironment>() != null) { TeardownEnvironment tag = (TeardownEnvironment)currentObject.GetComponent <TeardownEnvironment>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "environment", ""); enrichXmlWithGeneralAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("template"); attribute.Value = tag.template.ToString().ToLower(); node.Attributes.Append(attribute); attribute = xmlDoc.CreateAttribute("skyboxrot"); attribute.Value = tag.skyboxrot.ToString().Replace(",", ".");; node.Attributes.Append(attribute); if (tag.sunDir != null && !$"{tag.sunDir.x} {tag.sunDir.y} {tag.sunDir.z}".Equals("0 0 0")) { attribute = xmlDoc.CreateAttribute("sunDir"); attribute.Value = $"{tag.sunDir.x} {tag.sunDir.y} {tag.sunDir.z}".Replace(",", "."); node.Attributes.Append(attribute); } if (tag.sunBrightness >= 0) { attribute = xmlDoc.CreateAttribute("sunBrightness"); attribute.Value = tag.sunBrightness.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.sunFogScale >= 0) { attribute = xmlDoc.CreateAttribute("sunFogScale"); attribute.Value = tag.sunFogScale.ToString().Replace(",", "."); node.Attributes.Append(attribute); } attribute = xmlDoc.CreateAttribute("sunColorTint"); attribute.Value = $"{tag.sunColorTint.r} {tag.sunColorTint.g} {tag.sunColorTint.b}".Replace(",", "."); node.Attributes.Append(attribute); } else if (currentObject.GetComponent <Body>() != null) { Body tag = (Body)currentObject.GetComponent <Body>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "body", ""); enrichXmlWithGameObjectAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("dynamic"); attribute.Value = tag.dynamic ? "true" : "false"; node.Attributes.Append(attribute); } else if (currentObject.GetComponent <Boundary>() != null) { Boundary tag = (Boundary)currentObject.GetComponent <Boundary>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "boundary", ""); enrichXmlWithGeneralAttributes(xmlDoc, tag, node); } else if (currentObject.GetComponent <Vertex>() != null) { Vertex tag = (Vertex)currentObject.GetComponent <Vertex>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "vertex", ""); enrichXmlWithGeneralAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("pos"); attribute.Value = $"{tag.pos.x} {tag.pos.y}".Replace(",", ".");; node.Attributes.Append(attribute); } else if (currentObject.GetComponent <Script>() != null) { Script tag = (Script)currentObject.GetComponent <Script>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "script", ""); enrichXmlWithGeneralAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("file"); attribute.Value = tag.file.Replace(XmlImporter.getLevelFolder(tag.file), "LEVEL"); node.Attributes.Append(attribute); } else if (currentObject.GetComponent <Instance>() != null) { Instance tag = (Instance)currentObject.GetComponent <Instance>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "instance", ""); enrichXmlWithGeneralAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("file"); attribute.Value = tag.file.Replace(XmlImporter.getLevelFolder(tag.file), "LEVEL"); node.Attributes.Append(attribute); } else if (currentObject.GetComponent <SpawnPoint>() != null) { SpawnPoint tag = (SpawnPoint)currentObject.GetComponent <SpawnPoint>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "spawnpoint", ""); enrichXmlWithTransformAttributes(xmlDoc, tag, node); } else if (currentObject.GetComponent <Location>() != null) { Location tag = (Location)currentObject.GetComponent <Location>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "location", ""); enrichXmlWithTransformAttributes(xmlDoc, tag, node); } else if (currentObject.GetComponent <Group>() != null) { Group tag = (Group)currentObject.GetComponent <Group>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "group", ""); enrichXmlWithTransformAttributes(xmlDoc, tag, node); } else if (currentObject.GetComponent <Water>() != null) { Water tag = (Water)currentObject.GetComponent <Water>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "water", ""); enrichXmlWithTransformAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("size"); attribute.Value = $"{tag.size.x} {tag.size.y}".Replace(",", "."); node.Attributes.Append(attribute); if (tag.wave > -1) { attribute = xmlDoc.CreateAttribute("wave"); attribute.Value = tag.wave.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.ripple > -1) { attribute = xmlDoc.CreateAttribute("ripple"); attribute.Value = tag.ripple.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.foam > -1) { attribute = xmlDoc.CreateAttribute("foam"); attribute.Value = tag.foam.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.motion > -1) { attribute = xmlDoc.CreateAttribute("motion"); attribute.Value = tag.motion.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (!String.IsNullOrEmpty(tag.type)) { attribute = xmlDoc.CreateAttribute("type"); attribute.Value = tag.type.ToString().ToLower(); node.Attributes.Append(attribute); } } else if (currentObject.GetComponent <Screen>() != null) { Screen tag = (Screen)currentObject.GetComponent <Screen>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "water", ""); enrichXmlWithTransformAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("size"); attribute.Value = $"{tag.size.x} {tag.size.y}".Replace(",", "."); node.Attributes.Append(attribute); if (!tag.resolution.Equals(Vector2.zero)) { attribute = xmlDoc.CreateAttribute("resolution"); attribute.Value = $"{tag.resolution.x} {tag.resolution.y}".Replace(",", "."); node.Attributes.Append(attribute); } if (!tag.bulge.Equals(Vector2.zero)) { attribute = xmlDoc.CreateAttribute("bulge"); attribute.Value = $"{tag.bulge.x} {tag.bulge.y}".Replace(",", "."); node.Attributes.Append(attribute); } if (!String.IsNullOrEmpty(tag.script)) { attribute = xmlDoc.CreateAttribute("script"); attribute.Value = tag.script; node.Attributes.Append(attribute); } attribute = xmlDoc.CreateAttribute("color"); attribute.Value = $"{tag.color.r} {tag.color.g} {tag.color.b}".Replace(",", "."); node.Attributes.Append(attribute); attribute = xmlDoc.CreateAttribute("enabled"); attribute.Value = tag.enabled ? "true" : "false"; node.Attributes.Append(attribute); attribute = xmlDoc.CreateAttribute("interactive"); attribute.Value = tag.interactive ? "true" : "false"; node.Attributes.Append(attribute); if (tag.emissive > -1) { attribute = xmlDoc.CreateAttribute("resolution"); attribute.Value = tag.emissive.ToString().Replace(",", "."); node.Attributes.Append(attribute); } } else if (currentObject.GetComponent <Light>() != null) { Light tag = (Light)currentObject.GetComponent <Light>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "light", ""); enrichXmlWithTransformAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("type"); attribute.Value = tag.type.ToString().ToLower(); node.Attributes.Append(attribute); if (tag.glare > -1) { attribute = xmlDoc.CreateAttribute("glare"); attribute.Value = tag.glare.ToString().Replace(",", "."); node.Attributes.Append(attribute); } attribute = xmlDoc.CreateAttribute("angle"); attribute.Value = tag.angle.ToString().Replace(",", "."); node.Attributes.Append(attribute); if (tag.penumbra > -1) { attribute = xmlDoc.CreateAttribute("penumbra"); attribute.Value = tag.penumbra.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.unshadowed > -1) { attribute = xmlDoc.CreateAttribute("unshadowed"); attribute.Value = tag.unshadowed.ToString().Replace(",", "."); node.Attributes.Append(attribute); } attribute = xmlDoc.CreateAttribute("color"); attribute.Value = $"{tag.color.r} {tag.color.g} {tag.color.b}".Replace(",", "."); node.Attributes.Append(attribute); } else if (currentObject.GetComponent <Rope>() != null) { Rope tag = (Rope)currentObject.GetComponent <Rope>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "rope", ""); enrichXmlWithTransformAttributes(xmlDoc, tag, node); if (tag.slack > -1) { XmlAttribute attribute = xmlDoc.CreateAttribute("friction"); attribute.Value = tag.slack.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.strength > -1) { XmlAttribute attribute = xmlDoc.CreateAttribute("steerassist"); attribute.Value = tag.strength.ToString().Replace(",", "."); node.Attributes.Append(attribute); } } else if (currentObject.GetComponent <Wheel>() != null) { Wheel tag = (Wheel)currentObject.GetComponent <Wheel>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "wheel", ""); enrichXmlWithTransformAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("drive"); attribute.Value = tag.drive.ToString().Replace(",", "."); node.Attributes.Append(attribute); attribute = xmlDoc.CreateAttribute("steer"); attribute.Value = tag.steer.ToString().Replace(",", "."); node.Attributes.Append(attribute); attribute = xmlDoc.CreateAttribute("travel"); attribute.Value = $"{tag.travel.x} {tag.travel.y}".Replace(",", "."); node.Attributes.Append(attribute); } else if (currentObject.GetComponent <Vehicle>() != null) { Vehicle tag = (Vehicle)currentObject.GetComponent <Vehicle>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "vehicle", ""); enrichXmlWithGameObjectAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("driven"); attribute.Value = tag.driven ? "true" : "false"; node.Attributes.Append(attribute); if (tag.friction > -1) { attribute = xmlDoc.CreateAttribute("friction"); attribute.Value = tag.friction.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.steerassist > -1) { attribute = xmlDoc.CreateAttribute("steerassist"); attribute.Value = tag.steerassist.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.difflock > -1) { attribute = xmlDoc.CreateAttribute("difflock"); attribute.Value = tag.difflock.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.antiroll > -1) { attribute = xmlDoc.CreateAttribute("antiroll"); attribute.Value = tag.antiroll.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.antispin > -1) { attribute = xmlDoc.CreateAttribute("antispin"); attribute.Value = tag.antispin.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.acceleration > -1) { attribute = xmlDoc.CreateAttribute("acceleration"); attribute.Value = tag.acceleration.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.spring > -1) { attribute = xmlDoc.CreateAttribute("spring"); attribute.Value = tag.spring.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.damping > -1) { attribute = xmlDoc.CreateAttribute("damping"); attribute.Value = tag.damping.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.topspeed > -1) { attribute = xmlDoc.CreateAttribute("topspeed"); attribute.Value = tag.topspeed.ToString().Replace(",", "."); node.Attributes.Append(attribute); } attribute = xmlDoc.CreateAttribute("sound"); attribute.Value = tag.sound; node.Attributes.Append(attribute); } else if (currentObject.GetComponent <Vox>() != null) { Vox tag = (Vox)currentObject.GetComponent <Vox>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "vox", ""); enrichXmlWithGameObjectAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("file"); attribute.Value = tag.file.Replace(XmlImporter.getLevelFolder(tag.file), "LEVEL"); node.Attributes.Append(attribute); if (!String.IsNullOrEmpty(tag.voxObject)) { attribute = xmlDoc.CreateAttribute("object"); attribute.Value = tag.voxObject; node.Attributes.Append(attribute); } attribute = xmlDoc.CreateAttribute("prop"); attribute.Value = tag.dynamic ? "true" : "false"; node.Attributes.Append(attribute); } else if (currentObject.GetComponent <VoxBox>() != null) { VoxBox tag = (VoxBox)currentObject.GetComponent <VoxBox>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "voxbox", ""); enrichXmlWithGameObjectAttributes(xmlDoc, tag, node); Debug.Log(tag.position); XmlAttribute attribute = xmlDoc.CreateAttribute("color"); attribute.Value = $"{tag.color.r} {tag.color.g} {tag.color.b}".Replace(",", "."); node.Attributes.Append(attribute); attribute = xmlDoc.CreateAttribute("prop"); attribute.Value = tag.dynamic ? "true" : "false"; node.Attributes.Append(attribute); } else if (currentObject.GetComponent <TeardownJoint>() != null) { TeardownJoint tag = (TeardownJoint)currentObject.GetComponent <TeardownJoint>(); node = xmlDoc.CreateNode(XmlNodeType.Element, "joint", ""); enrichXmlWithTransformAttributes(xmlDoc, tag, node); XmlAttribute attribute = xmlDoc.CreateAttribute("type"); attribute.Value = tag.type.ToString().ToLower(); node.Attributes.Append(attribute); if (tag.limits != null && !$"{tag.limits.x} {tag.limits.y}".Replace(",", ".").Equals("0 0")) { attribute = xmlDoc.CreateAttribute("limits"); attribute.Value = $"{tag.limits.x} {tag.limits.y}".Replace(",", "."); node.Attributes.Append(attribute); } attribute = xmlDoc.CreateAttribute("size"); attribute.Value = tag.size.ToString().Replace(",", "."); node.Attributes.Append(attribute); if (tag.rotstrength >= 0) { attribute = xmlDoc.CreateAttribute("rotstrength"); attribute.Value = tag.rotstrength.ToString().Replace(",", "."); node.Attributes.Append(attribute); } if (tag.rotspring >= 0) { attribute = xmlDoc.CreateAttribute("rotspring"); attribute.Value = tag.rotspring.ToString().Replace(",", "."); node.Attributes.Append(attribute); } } if (node != null) { foreach (Transform child in currentObject) { exportToXML(xmlDoc, child, node); } if (parent == null) { xmlDoc.AppendChild(node); } else { parent.AppendChild(node); } } }
/// <summary> /// Instantiates the waves from the xml. /// </summary> public void Start() { waves = XmlImporter.GetWavesFromXml(); WaveManager.SetNextWave(); }
public XmlImporterTests() { _importer = new XmlImporter(); }
private void m_itemAsm_Click( object sender, EventArgs e ) { SetCurrentDirectory(); var importer = new XmlImporter( m_project.ResourceDirectory ); if ( !importer.IsValidImportDirectory() ) { LogLine( "Cannot assemble game project: specified resource directory lacks essential data files.", MessageType.Warning, false ); return; } importer.ProcessStarted += Importer_ProcessStarted; importer.ProcessFinished += Importer_ProcessFinished; importer.ProcessAborted += Importer_ProcessAborted; importer.CategoryProcessing += Importer_CategoryProcessing; importer.ProcessingErrorOccurred += Importer_ProcessingErrorOccurred; importer.XmlParseErrorOccurred += Importer_XmlParseErrorOccurred; if ( Settings.Default.VerboseLog ) importer.ResourceProcessed += Importer_ResourceProcessed; m_gmFile = new GameMakerFile(); SetStatus( "Assembling game project..." ); if ( importer.Process( m_gmFile ) ) { LogLine( "Project data collected!", MessageType.Information, false ); if ( SaveGameFile() ) SetLoggedStatus( "Game project created." ); else { LogLine( "Process aborted.", MessageType.Warning, false ); SetStatus( "Process aborted." ); } } m_statusProgress.Value = m_statusProgress.Maximum; GenerateResourceTree(); }
/// <summary> /// Updates times and other necessary pieces of game play. /// /// Authors: Amy Lewis, Cole Twitchell, David Askari, Steven Johnson, Courtney Chu /// </summary> public void Update() { SetTimerText(); WaveManager.Update(); var saturation = ppProfile.colorGrading.settings; if (currentWave == 1) { saturation.basic.saturation = 1; } else if (currentWave == 6) { sendBossButton.SetActive(true); PauseGame.sendBossButton = sendBossButton.GetComponent <SendBossButton>(); } if (gameOver) { waveTimer.SetPaused(true); if (CastleManager.CastleHealth > 0) { saturation.basic.saturation = 0; } PauseGame.Status = true; GameObject.Find("OptionsMenu").SetActive(false); GameObject.Find("OptionsButton").GetComponent <Button>().interactable = false; sendBossButton.GetComponent <SendBossButton>().DisableButton(); if (CastleManager.CastleHealth > 0) { XmlImporter.Cleanup(); PauseGame.Status = false; SceneManager.LoadScene("victory_cutscene"); } else { gameOverObject.transform.Find("GameOverText").GetComponent <Text>().text = "GAME OVER"; gameOverObject.SetActive(true); enabled = false; } } else { if (!waveTimer.IsPaused() && waveTimer.IsDone()) { waveTimer.SetPaused(true); WaveManager.BeginWave(); AudioManager.PlayBeginWaveSound(); sendBossButton.GetComponent <SendBossButton>().DisableButton(); } if (WaveManager.WaveFinished() && EnemyManager.EnemiesRemaining() <= 0) { saturation.basic.saturation = 1.0f - ((float)(currentWave - 1) / (float)totalWaves); currentWave++; waveText.text = currentWave.ToString(); waveTimer.Reset(); waveTimer.SetPaused(false); WaveManager.SetNextWave(); skipTimeButton.interactable = true; sendBossButton.GetComponent <SendBossButton>().ResetButton(); } if (Hover.IsActive()) { GameManager.rangeIndicatorRenderer.transform.position = Hover.GetPosition(); } if (Input.GetKeyDown(KeyCode.S)) { GameManager.AddMoney(100); } if (Input.GetKeyDown(KeyCode.A)) { SkipTimer(); } else if (Input.GetMouseButtonUp(1) && Hover.IsActive()) { GameManager.rangeIndicatorRenderer.enabled = false; Hover.Deactivate(); GameManager.ResetTower(); TowerInformation.Reset(); } } ppProfile.colorGrading.settings = saturation; healthText.text = CastleManager.CastleHealth.ToString(); moneyText.text = money.ToString(); errorTextTimer.Update(); if (errorTextTimer.IsDone()) { errorText.gameObject.SetActive(false); errorTextTimer.Reset(); errorTextTimer.SetPaused(true); } }