public static void SaveEvent(EventSaveFile ev) { if (!Directory.Exists(Application.persistentDataPath + "/events")) { Directory.CreateDirectory(Application.persistentDataPath + "/events"); } savedEvents.Add(ev); BinaryFormatter bf = new BinaryFormatter(); FileStream file = File.Create(Application.persistentDataPath + "/events/events.ev"); bf.Serialize(file, SaveLoad.savedEvents); file.Close(); Debug.Log("Event saved"); }
private void saveEvent() { esf = new EventSaveFile(); esf.effect = evText; esf.stateTriggerkey = statekey1; esf.state = state1; esf.stateTriggerKey2 = statekey2; esf.state2 = state2; esf.coolDownTime = cooldown; esf.eventName = name; esf.inrangeneed = needstobeinrange; SaveLoad.SaveEvent(esf); }
public static void removeEvent(string name) { EventSaveFile removeMe = null; foreach (EventSaveFile esf in savedEvents) { if ((esf.eventName.ToLower()).Equals(name.ToLower())) { removeMe = esf; } } if (removeMe != null) { savedEvents.Remove(removeMe); Debug.Log("Event removed"); internalSave(); } else { Debug.Log("Didn't find event to remove"); } }