public static Event load_Event(Save_tag path) { Event e = null; Save_tag a = path.copy(); a.add_tag("ID"); long ID = load_long(a); Save_tag b = path.copy(); b.add_tag("text"); string text = load_string(b); Save_tag c = path.copy(); c.add_tag("params"); List <float> ps = load_list_of_floats(c); if (ID == 1) { e = new Block_broken((int)(ps[0]), (int)(ps[1]), (int)(ps[2]), (int)(ps[3])); } else if (ID == 2) { e = new Player_entered_fraction_base((int)(ps[0])); } else if (ID == 3) { e = new Players_inventory_changed((long)(ps[0]), ps[1]); } return(e); }
public static void save_Event(Save_tag path, Event e) { Save_tag a = path.copy(); a.add_tag("ID"); save_long(a, e.get_ID()); List <float> parameters = new List <float>(); Save_tag c = path.copy(); c.add_tag("text"); save_string(c, e.get_info()); Save_tag b = path.copy(); b.add_tag("params"); if (e.get_ID() == 1) { Block_broken bb = (Block_broken)e; parameters.Add(bb.ID_broken); parameters.Add(bb.x); parameters.Add(bb.y); parameters.Add(bb.location); } else if (e.get_ID() == 2) { Player_entered_fraction_base pefb = (Player_entered_fraction_base)e; parameters.Add(pefb.fraction); } else if (e.get_ID() == 3) { Players_inventory_changed pic = (Players_inventory_changed)e; parameters.Add(pic.item_ID); parameters.Add(pic.count); } save_list_of_floats(b, parameters); }