void AddPropToRevert(string name, int id, float time) { PropToRevert newprop = new PropToRevert(name, id, time); // remove the same name and playerid which should be revert. for (int i = 0; i < revertProps.Count; i++) { while (i < revertProps.Count && revertProps[i].name == name && revertProps[i].playerID == id) { revertProps.RemoveAt(i); } } // make the list sorted. revertProps.Add(newprop); revertProps.Sort(CompareProp); }
private int CompareProp(PropToRevert a, PropToRevert b) { return(a.timeToRevert.CompareTo(b.timeToRevert)); }
public int CompareTo(PropToRevert other) { return(timeToRevert.CompareTo(other.timeToRevert)); }