public static int Compare(ThingDef lhsTh, ThingDef rhsTh) { if (lhsTh.category != rhsTh.category) { return(lhsTh.category.CompareTo(rhsTh.category)); } float num = TransferableUIUtility.DefaultListOrderPriority(lhsTh); float num2 = TransferableUIUtility.DefaultListOrderPriority(rhsTh); if (num != num2) { return(num.CompareTo(num2)); } int num3 = 0; if (!lhsTh.thingCategories.NullOrEmpty <ThingCategoryDef>()) { num3 = (int)lhsTh.thingCategories[0].index; } int value = 0; if (!rhsTh.thingCategories.NullOrEmpty <ThingCategoryDef>()) { value = (int)rhsTh.thingCategories[0].index; } return(num3.CompareTo(value)); }
public static float DefaultListOrderPriority(Transferable transferable) { if (!transferable.HasAnyThing) { return(0f); } return(TransferableUIUtility.DefaultListOrderPriority(transferable.ThingDef)); }
public static float DefaultListOrderPriority(Transferable transferable) { float result; if (!transferable.HasAnyThing) { result = 0f; } else { result = TransferableUIUtility.DefaultListOrderPriority(transferable.ThingDef); } return(result); }
private void CacheTransferables() { transferablesCached = true; for (int i = 0; i < sections.Count; i++) { List <TransferableOneWay> cachedTransferables = sections[i].cachedTransferables; cachedTransferables.Clear(); cachedTransferables.AddRange(sections[i].transferables.OrderBy((TransferableOneWay tr) => tr, sorter1.Comparer).ThenBy((TransferableOneWay tr) => tr, sorter2.Comparer).ThenBy((TransferableOneWay tr) => TransferableUIUtility.DefaultListOrderPriority(tr)) .ToList()); } }
private static float <CacheTradeables> m__5(Tradeable tr) { return(TransferableUIUtility.DefaultListOrderPriority(tr)); }
private void CacheTradeables() { this.cachedCurrencyTradeable = (from x in TradeSession.deal.AllTradeables where x.IsCurrency select x).FirstOrDefault <Tradeable>(); this.cachedTradeables = (from tr in TradeSession.deal.AllTradeables where !tr.IsCurrency orderby(!tr.TraderWillTrade) ? -1 : 0 descending select tr).ThenBy((Tradeable tr) => tr, this.sorter1.Comparer).ThenBy((Tradeable tr) => tr, this.sorter2.Comparer).ThenBy((Tradeable tr) => TransferableUIUtility.DefaultListOrderPriority(tr)).ThenBy((Tradeable tr) => tr.ThingDef.label).ThenBy(delegate(Tradeable tr) { QualityCategory qualityCategory; int result; if (tr.AnyThing.TryGetQuality(out qualityCategory)) { result = (int)qualityCategory; } else { result = -1; } return(result); }).ThenBy((Tradeable tr) => tr.AnyThing.HitPoints).ToList <Tradeable>(); }
private void CacheTradeables() { cachedCurrencyTradeable = TradeSession.deal.AllTradeables.FirstOrDefault((Tradeable x) => x.IsCurrency && (TradeSession.TradeCurrency != TradeCurrency.Favor || x.IsFavor)); cachedTradeables = (from tr in TradeSession.deal.AllTradeables where !tr.IsCurrency && (tr.TraderWillTrade || !TradeSession.trader.TraderKind.hideThingsNotWillingToTrade) orderby(!tr.TraderWillTrade) ? (-1) : 0 descending select tr).ThenBy((Tradeable tr) => tr, sorter1.Comparer).ThenBy((Tradeable tr) => tr, sorter2.Comparer).ThenBy((Tradeable tr) => TransferableUIUtility.DefaultListOrderPriority(tr)) .ThenBy((Tradeable tr) => tr.ThingDef.label) .ThenBy((Tradeable tr) => tr.AnyThing.TryGetQuality(out var qc) ? ((int)qc) : (-1)) .ThenBy((Tradeable tr) => tr.AnyThing.HitPoints) .ToList(); }