Ejemplo n.º 1
0
 private IEnumerable <Dialog_InfoCard.Hyperlink> GetIngredientsHyperlinks()
 {
     return(Dialog_InfoCard.DefsToHyperlinks(from i in ingredients
                                             where i.IsFixedIngredient
                                             select i.FixedIngredient into i
                                             where i != null
                                             select i));
 }
 public Hyperlink(Dialog_InfoCard infoCard, int statIndex = -1)
 {
     def               = infoCard.def;
     thing             = infoCard.thing;
     stuff             = infoCard.stuff;
     worldObject       = infoCard.worldObject;
     titleDef          = infoCard.titleDef;
     faction           = infoCard.faction;
     selectedStatIndex = statIndex;
 }
        public static void PushCurrentToHistoryAndClose()
        {
            Dialog_InfoCard dialog_InfoCard = Find.WindowStack.WindowOfType <Dialog_InfoCard>();

            if (dialog_InfoCard != null)
            {
                history.Add(new Hyperlink(dialog_InfoCard, StatsReportUtility.SelectedStatIndex));
                Find.WindowStack.TryRemove(dialog_InfoCard, doCloseSound: false);
            }
        }
            public void OpenDialog()
            {
                Dialog_InfoCard dialog_InfoCard = null;

                if (def == null && thing == null && worldObject == null && titleDef == null)
                {
                    dialog_InfoCard = Find.WindowStack.WindowOfType <Dialog_InfoCard>();
                }
                else
                {
                    PushCurrentToHistoryAndClose();
                    if (worldObject != null)
                    {
                        dialog_InfoCard = new Dialog_InfoCard(worldObject);
                    }
                    else if (def != null && def is ThingDef && (stuff != null || GenStuff.DefaultStuffFor((ThingDef)def) != null))
                    {
                        dialog_InfoCard = new Dialog_InfoCard(def as ThingDef, stuff ?? GenStuff.DefaultStuffFor((ThingDef)def));
                    }
                    else if (def != null)
                    {
                        dialog_InfoCard = new Dialog_InfoCard(def);
                    }
                    else if (thing != null)
                    {
                        dialog_InfoCard = new Dialog_InfoCard(thing);
                    }
                    else if (titleDef != null)
                    {
                        dialog_InfoCard = new Dialog_InfoCard(titleDef, faction);
                    }
                }
                if (dialog_InfoCard == null)
                {
                    return;
                }
                int localSelectedStatIndex = selectedStatIndex;

                if (selectedStatIndex >= 0)
                {
                    dialog_InfoCard.executeAfterFillCardOnce = delegate
                    {
                        StatsReportUtility.SelectEntry(localSelectedStatIndex);
                    };
                }
                Find.WindowStack.Add(dialog_InfoCard);
            }
Ejemplo n.º 5
0
 private IEnumerable <Dialog_InfoCard.Hyperlink> GetProductsHyperlinks()
 {
     return(Dialog_InfoCard.DefsToHyperlinks(products.Select((ThingDefCountClass i) => i.thingDef)));
 }