protected override void FillTab()
        {
            var outRect = new Rect(0, 0, size.x, size.y);
            var inRect  = new Rect(ViewMargin, ViewMargin, size.x - ViewMargin, 1000);

            Widgets.BeginScrollView(outRect, ref scrollPosition, inRect, true);

            var list = new Listing_Standard();

            list.Begin(inRect);

            var net       = PawnPartPowerNet.Get(SelPawn);
            var providers = net.Nodes.OfType <IPowerProvider>().ToList();
            var consumers = net.Nodes.OfType <IPowerConsumer>().ToList();

            list.Gap();

            Text.Font = GameFont.Medium;
            list.Label("Total energy: " + FormatDischarge(net));
            Text.Font = GameFont.Small;

            Elements.Heading(list, "Providers");
            providers.ForEach(provider => RenderProvider(list, provider));

            Elements.Heading(list, "Consumers");
            consumers.ForEach(consumer => RenderConsumer(list, consumer));

            list.End();

            Widgets.EndScrollView();
        }
        static void RemoveFromPawnPartPowerNet(Pawn_ApparelTracker __instance, Apparel apparel)
        {
            var net = PawnPartPowerNet.Get(__instance.pawn);

            apparel.AllComps
            .OfType <IEnergyNode>()
            .Do(node => node.Disconnect());
        }
        static void AddToPawnPartPowerNet(Pawn_ApparelTracker __instance, Apparel apparel)
        {
            var net = PawnPartPowerNet.Get(__instance.pawn);

            apparel.AllComps
            .OfType <IEnergyNode>()
            .Do(node => node.ConnectTo(net));
        }
Пример #4
0
            static bool AddEnergySourceCheck(bool __result, Pawn_NeedsTracker __instance, NeedDef nd, Pawn ___pawn)
            {
                var net = PawnPartPowerNet.Get(___pawn);

                if (nd != CyberizationDefOf.PartEnergy)
                {
                    return(__result);
                }

                return(net.Nodes.Any());
            }