public void SetWealthIcon(int id, bool showAnim = false) { config_wealth_item config_item = (config_wealth_item)GameMgr.resourceMgr.config_wealth.GetItem(id); if (config_item != null) { GameObject wealthPrefab = GameMgr.resourceMgr.GetGameObject("prefab/base.ab", "WealthItem"); GameObject wealthItem = GameObject.Instantiate(wealthPrefab); wealthItem.transform.SetParent(popBg.transform, false); WealthItem wealthItemCtr = wealthItem.GetComponent <WealthItem>(); if (config_item.icon > 10105) { wealthItemCtr.Show(config_item.icon, false); popText.rectTransform.localPosition = new Vector3(popText.rectTransform.localPosition.x + 50, 0, 0); popBg.rectTransform.sizeDelta = new Vector2(popText.preferredWidth + 160, popBg.rectTransform.sizeDelta.y + 30); wealthItem.transform.localPosition = new Vector3(-popText.preferredWidth / 2 - 10, 0, 0); } else { wealthItemCtr.Show(config_item.icon, false, 0.5f); popText.rectTransform.localPosition = new Vector3(popText.rectTransform.localPosition.x + 50, -10, 0); popBg.rectTransform.sizeDelta = new Vector2(popText.preferredWidth + 170, popBg.rectTransform.sizeDelta.y + 50); wealthItem.transform.localPosition = new Vector3(-popText.preferredWidth / 2 - 10, -10, 0); } } }
private int GetValueFor(WealthItem t) { QualityCategory result; if (!t.thing.TryGetQuality(out result)) { return(-1); } return((int)result); }
private float GetValueFor(WealthItem t) { Thing anyThing = t.thing; Pawn pawn = anyThing as Pawn; if (pawn != null) { return(pawn.health.summaryHealth.SummaryHealthPercent); } if (!anyThing.def.useHitPoints || !anyThing.def.healthAffectsPrice) { return(1f); } return((float)anyThing.HitPoints / (float)anyThing.MaxHitPoints); }
public override int Compare(WealthItem lhs, WealthItem rhs) { return(TransferableComparer_Category.Compare(lhs.thing.def, rhs.thing.def)); }
public override int Compare(WealthItem lhs, WealthItem rhs) { return(lhs.Name.CompareTo(rhs.Name)); }
public override int Compare(WealthItem lhs, WealthItem rhs) { return(lhs.Count.CompareTo(rhs.Count)); }
public override int Compare(WealthItem lhs, WealthItem rhs) { return(lhs.MarketValueAll.CompareTo(rhs.MarketValueAll)); }
public override int Compare(WealthItem lhs, WealthItem rhs) { return(0); }
public override int Compare(WealthItem lhs, WealthItem rhs) { return(lhs.thing.GetStatValue(StatDefOf.Mass, true).CompareTo(rhs.thing.GetStatValue(StatDefOf.Mass, true))); }
public override int Compare(WealthItem lhs, WealthItem rhs) { return(this.GetValueFor(lhs).CompareTo(this.GetValueFor(rhs))); }