Beispiel #1
0
        public static bool BuildFactorioObjectButton(this ImGui gui, Rect rect, FactorioObject obj, SchemeColor bgColor = SchemeColor.None, bool extendHeader = false)
        {
            var overColor = bgColor == SchemeColor.None ? SchemeColor.Grey : bgColor + 1;
            var evt       = gui.BuildButton(rect, bgColor, overColor, button: 0);

            if (evt == ImGuiUtils.Event.MouseOver && obj != null)
            {
                MainScreen.Instance.ShowTooltip(obj, gui, rect, extendHeader);
            }
            else if (evt == ImGuiUtils.Event.Click)
            {
                if (gui.actionParameter == SDL.SDL_BUTTON_MIDDLE && obj != null)
                {
                    if (obj is Goods goods && obj.IsAccessible())
                    {
                        NeverEnoughItemsPanel.Show(goods, null);
                    }
                    else
                    {
                        DependencyExplorer.Show(obj);
                    }
                }
                else if (gui.actionParameter == SDL.SDL_BUTTON_LEFT)
                {
                    return(true);
                }
            }