public static List <Team> LoadTeamList() { if (File.Exists(Application.persistentDataPath + "/teamList.sav")) { List <Team> teamlist = new List <Team>(); BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.persistentDataPath + "/teamList.sav", FileMode.Open); TeamListData tldata = (TeamListData)bf.Deserialize(stream); stream.Close(); foreach (TeamData td in tldata.tdlist) { teamlist.Add(new Team().CreateSpecificTeam(td)); ArrayList roster = new ArrayList(); foreach (CharacterData cd in td.cldata) { roster.Add(Character.CreateSpecificCharacter(cd)); } } return(teamlist); } else { return(new List <Team>()); } }
public static void SaveTeamList(List <Team> l) { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.persistentDataPath + "/teamList.sav", FileMode.Create); TeamListData tldata = new TeamListData(l); bf.Serialize(stream, tldata); stream.Close(); }
public static void SaveSchedule2() { BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.persistentDataPath + "/schedule2.sav", FileMode.Create); TeamListData schedule2 = new TeamListData(HomeScreenScript.scheduleList2); bf.Serialize(stream, schedule2); stream.Close(); }
public static void LoadSchedule2() { if (File.Exists(Application.persistentDataPath + "/schedule2.sav")) { List <Team> teamlist = new List <Team>(); BinaryFormatter bf = new BinaryFormatter(); FileStream stream = new FileStream(Application.persistentDataPath + "/schedule2.sav", FileMode.Open); TeamListData schedule2 = (TeamListData)bf.Deserialize(stream); stream.Close(); foreach (TeamData td in schedule2.tdlist) { Debug.Log(schedule2.tdlist); teamlist.Add(new Team().CreateSpecificTeam(td)); ArrayList roster = new ArrayList(); foreach (CharacterData cd in td.cldata) { roster.Add(Character.CreateSpecificCharacter(cd)); } } HomeScreenScript.scheduleList2 = teamlist; } }