private _CheerEmote _findMaxBits(List <_CheerEmote> cheerlist, int cheer) { _CheerEmote emote = new _CheerEmote(cheer); int i = cheerlist.BinarySearch(emote, new _MinBitsCompare()); if (cheerlist.Count > 0) { if (i >= 0) { return(cheerlist[i]); } else { if (~i > 0 && (~i - 1) < cheerlist.Count) { return(cheerlist[~i - 1]); } else { return(cheerlist[0]); } } } return(null); }
private _CheerEmote _findMaxBits(List <_CheerEmote> cheerlist, int cheer) { _CheerEmote emote = new _CheerEmote(cheer); int i = cheerlist.BinarySearch(emote, new _MinBitsCompare()); if (i >= 0) { return(cheerlist[i]); } else { return(cheerlist[~i - 1]); } }
public void Add(LazyLoadedImage light, LazyLoadedImage dark, int min_bits, string color) { _CheerEmote emote = new _CheerEmote(light, dark, min_bits, color); int i = _CheerEmotes.BinarySearch(emote, new _MinBitsCompare()); if (i >= 0) { _CheerEmotes[i] = emote; } else { _CheerEmotes.Insert(~i, emote); } }