コード例 #1
0
        public override void Build(ImGui gui)
        {
            BuildHeader(gui, "Never Enough Items Explorer");
            using (gui.EnterRow())
            {
                if (recent.Count == 0)
                {
                    gui.AllocateRect(0f, 3f);
                }
                for (var i = recent.Count - 1; i >= 0; i--)
                {
                    var elem = recent[i];
                    if (gui.BuildFactorioObjectButton(elem, 3f))
                    {
                        changing = elem;
                    }
                }
            }
            using (gui.EnterGroup(new Padding(0.5f), RectAllocator.LeftRow))
            {
                gui.spacing = 0.2f;
                gui.BuildFactorioObjectIcon(current, size: 3f);
                gui.BuildText(current.locName, Font.subheader);
                gui.allocator = RectAllocator.RightAlign;
                gui.BuildText(CostAnalysis.GetDisplayCost(current));
                var amount = CostAnalysis.Instance.GetItemAmount(current);
                if (amount != null)
                {
                    gui.BuildText(amount, wrap: true);
                }
            }

            if (gui.BuildFactorioObjectButton(gui.lastRect, current, SchemeColor.Grey))
            {
                SelectObjectPanel.Select(Database.goods.all, "Select item", SetItem);
            }

            using (var split = gui.EnterHorizontalSplit(2))
            {
                split.Next();
                gui.BuildText("Production:", Font.subheader);
                productionList.Build(gui);
                split.Next();
                gui.BuildText("Usages:", Font.subheader);
                usageList.Build(gui);
            }
            CheckChanging();
            using (gui.EnterRow())
            {
                gui.BuildText("Legend:");
                gui.BuildText("This color is flow (Estimated fraction of item production/consumption)");
                gui.DrawRectangle(gui.lastRect, SchemeColor.Primary);
                gui.BuildText("This color is estimated recipe efficiency");
                gui.DrawRectangle(gui.lastRect, SchemeColor.Secondary);
            }
        }
コード例 #2
0
        public override void Build(ImGui gui)
        {
            BuildHeader(gui, "Never Enough Items Explorer");
            using (gui.EnterRow())
            {
                if (recent.Count == 0)
                {
                    gui.AllocateRect(0f, 3f);
                }
                for (var i = recent.Count - 1; i >= 0; i--)
                {
                    var elem = recent[i];
                    if (gui.BuildFactorioObjectButton(elem, 3f))
                    {
                        changing = elem;
                    }
                }
            }
            using (gui.EnterGroup(new Padding(0.5f), RectAllocator.LeftRow))
            {
                gui.spacing = 0.2f;
                gui.BuildFactorioObjectIcon(current, size: 3f);
                gui.BuildText(current.locName, Font.subheader);
                gui.allocator = RectAllocator.RightAlign;
                gui.BuildText(CostAnalysis.GetDisplayCost(current));
                var amount = CostAnalysis.Instance.GetItemAmount(current);
                if (amount != null)
                {
                    gui.BuildText(amount, wrap: true);
                }
            }

            if (gui.BuildFactorioObjectButton(gui.lastRect, current, SchemeColor.Grey))
            {
                SelectObjectPanel.Select(Database.goods.all, "Select item", SetItem);
            }

            using (var split = gui.EnterHorizontalSplit(2))
            {
                split.Next();
                gui.BuildText("Production:", Font.subheader);
                productionList.Build(gui);
                split.Next();
                gui.BuildText("Usages:", Font.subheader);
                usageList.Build(gui);
            }
            CheckChanging();
            using (gui.EnterRow())
            {
                if (gui.BuildLink("What do colored bars mean?"))
                {
                    MessageBox.Show("How to read colored bars",
                                    "Blue bar means estimated production or comsumption of the thing you selected. Blue bar at 50% means that that recipe produces(consumes) 50% of the product.\n\n" +
                                    "Orange bar means estimated recipe efficiency. If it is not full, the recipe looks inefficient to YAFC.\n\n" +
                                    "It is possible for a recipe to be efficient but not useful - for example a recipe that produces something that is not useful.\n\n" +
                                    "YAFC only estimates things that are required for science recipes. So buildings, belts, weapons, fuel - are not shown in estimations.", "Ok");
                }
                if (gui.BuildCheckBox("Current milestones info", atCurrentMilestones, out atCurrentMilestones, allocator: RectAllocator.RightRow))
                {
                    var item = current;
                    current = null;
                    SetItem(item);
                }
            }
        }