public List <Clan> UpdateAndReturnClans() { MyClans = ClanContainer.Load(ClanXMLPath); List <Clan> ClanHolder = new List <Clan>(); foreach (Clan a in MyClans.ClanList) { ClanHolder.Add(a); } return(ClanHolder); }
// Use this for initialization void Awake() { MyCharacters = new CharacterContainer(); MyPaths = new PathsContainer(); MyDisciplines = new DisciplineContainer(); MyConcepts = new ConceptContainer(); MyClans = new ClanContainer(); MyBackgrounds = new BackgroundContainer(); MyArchetypes = new ArchetypesContainer(); MyMeritFlaws = new MeritFlawContainer(); MyStats = new StatContainer(); CharacterXMLPath = Application.dataPath + "/XML/Characters2.xml"; AchetypeXMLPath = Application.dataPath + "/XML/Archetypes.xml"; BackgroundXMLPath = Application.dataPath + "/XML/Backgrounds.xml"; ClanXMLPath = Application.dataPath + "/XML/Clans.xml"; ConceptXMLPath = Application.dataPath + "/XML/Concepts.xml"; DisciplineXMLPath = Application.dataPath + "/XML/Disciplines.xml"; PathXMLPath = Application.dataPath + "/XML/Paths.xml"; MeritFlawXMLPath = Application.dataPath + "/XML/MeritsFlaws.xml"; StatsPath = Application.dataPath + "/XML/Stats.xml"; DirectoryInfo dirInf = new DirectoryInfo(Application.dataPath + "/XML"); if (!dirInf.Exists) //Check if directory exists { dirInf.Create(); } if (!File.Exists(CharacterXMLPath)) { //Debug.Log("No Character XML Data. Creating...."); File.WriteAllText(CharacterXMLPath, CharacterXML.ToString()); MyCharacters = CharacterContainer.Load(CharacterXMLPath); } else { //Debug.Log("Loading Character Data"); MyCharacters = CharacterContainer.Load(CharacterXMLPath); } if (!File.Exists(AchetypeXMLPath)) { //Debug.Log("No Archetype XML Data. Creating...."); File.WriteAllText(AchetypeXMLPath, AchetypeXML.ToString()); MyArchetypes = ArchetypesContainer.Load(AchetypeXMLPath); } else { //Debug.Log("Loading Archetype Data"); MyArchetypes = ArchetypesContainer.Load(AchetypeXMLPath); } if (!File.Exists(BackgroundXMLPath)) { //Debug.Log("No Backgrounds XML Data. Creating...."); File.WriteAllText(BackgroundXMLPath, BackgroundXML.ToString()); MyBackgrounds = BackgroundContainer.Load(BackgroundXMLPath); } else { //Debug.Log("Loading Background Data"); MyBackgrounds = BackgroundContainer.Load(BackgroundXMLPath); } if (!File.Exists(ClanXMLPath)) { //Debug.Log("No Clan XML Data. Creating...."); File.WriteAllText(ClanXMLPath, ClanXML.ToString()); MyClans = ClanContainer.Load(ClanXMLPath); } else { //Debug.Log("Loading Clan Data"); MyClans = ClanContainer.Load(ClanXMLPath); } if (!File.Exists(DisciplineXMLPath)) { //Debug.Log("No Discipline XML Data. Creating...."); File.WriteAllText(DisciplineXMLPath, DisciplineXML.ToString()); MyDisciplines = DisciplineContainer.Load(DisciplineXMLPath); } else { //Debug.Log("Loading Discipline Data"); MyDisciplines = DisciplineContainer.Load(DisciplineXMLPath); } if (!File.Exists(PathXMLPath)) { //Debug.Log("No Paths XML Data. Creating...."); File.WriteAllText(PathXMLPath, PathXML.ToString()); MyPaths = PathsContainer.Load(PathXMLPath); } else { //Debug.Log("Loading Paths Data"); MyPaths = PathsContainer.Load(PathXMLPath); } if (!File.Exists(ConceptXMLPath)) { //Debug.Log("No Concept XML Data. Creating...."); File.WriteAllText(ConceptXMLPath, ConceptXML.ToString()); MyConcepts = ConceptContainer.Load(ConceptXMLPath); } else { //Debug.Log("Loading Concept Data"); MyConcepts = ConceptContainer.Load(ConceptXMLPath); } if (!File.Exists(MeritFlawXMLPath)) { //Debug.Log("No MeritFlaw XML Data. Creating...."); File.WriteAllText(MeritFlawXMLPath, MeritFlawXML.ToString()); MyMeritFlaws = MeritFlawContainer.Load(MeritFlawXMLPath); } else { //Debug.Log("Loading MeritFlaw Data"); MyMeritFlaws = MeritFlawContainer.Load(MeritFlawXMLPath); } if (!File.Exists(StatsPath)) { //Debug.Log("No Stats XML Data. Creating...."); File.WriteAllText(StatsPath, StatsXML.ToString()); MyStats = StatContainer.Load(StatsPath); } else { //Debug.Log("Loading Stats XML Data"); MyStats = StatContainer.Load(StatsPath); } Loaded = true; }