public void ModifyDatabase() { try { var jsonPath = System.IO.Path.Combine(Application.dataPath, "SapientTABS.json"); #if DEBUG // create and write JSON for test data // //m_SapientTABSData.Factions.Add(new SapientFaction("BeyBlades", "BeyBlades")); //m_SapientTABSData.Factions.Add(new SapientFaction("Talmage", "TalmageDude")); //string json = JsonConvert.SerializeObject(m_SapientTABSData, Formatting.Indented); //System.IO.File.WriteAllText(jsonPath, json); #endif // get file var json = System.IO.File.ReadAllText(jsonPath); if (string.IsNullOrWhiteSpace(json)) { return; } m_SapientTABSData = JsonConvert.DeserializeObject <SapientTABSData>(json); Utilities.Log(string.Format("PinaCollada.directory: {0}", PinaCollada.directory), "SapientTABS.DatabaseModifier.log"); CreateFactions(m_SapientTABSData.Factions); //UManager.CreateNewUnit("Blood King", database.Units[71].Entity.GUID); } catch (Exception ex) { Utilities.Log(ex.ToString()); } // read json data structure from external file // since factions always include units that belong to them, should we have the // Faction aggregate units, or only reference them? Should units aggregate weapons, // or only reference them? If a given unit uses a specific weapon, that doesn't // mean another unit would use the weapon in the same way - in a sense, that weapon // is different for a different unit //var jsonPath = System.IO.Path.Combine(Application.dataPath, "SapientTABS.json"); // for each Item, we read the string data and do what we need to do here //UManager.CreateNewFaction("Egypt", database.Units[71].Entity.SpriteIcon); //UManager.CreateNewFaction("Unknown", PinaCollada.GetSprite("monkyicon")); //UManager.CreateNewFaction("Soviet Union", PinaCollada.GetSprite("sovietpeasanticon")); //UManager.CreateNewFaction("Modern", PinaCollada.GetSprite("shotgunicon")); // use it to modify the database //database }
public DatabaseModifier() { m_Database = LandfallUnitDatabase.GetDatabase(); m_SapientTABSData = new SapientTABSData(); }