private void DrawModuleTab(Rect inRect, Category selectCategory)
        {
            Rect scrollVertRectFact = new Rect(0, 0, inRect.x, DefDatabase <MKStationModuleDef> .DefCount * 35);

            GUI.color = MenuSectionBGBorderColor;
            Widgets.DrawLineVertical(245, inRect.y, 465);
            Widgets.DrawLineHorizontal(0, inRect.y, inRect.width);
            GUI.color = Color.white;

            Text.Anchor = TextAnchor.MiddleCenter;
            Rect rect2      = new Rect(inRect.x + 10, 0, 230, 30);
            Rect sliderRect = new Rect(inRect.x, inRect.y + 10, inRect.width, inRect.height);

            Widgets.BeginScrollView(sliderRect, ref slider, scrollVertRectFact, true);
            foreach (var module in DefDatabase <MKStationModuleDef> .AllDefsListForReading.Where(x => x.ModuleCategory == selectCategory))
            {
                Color bColor = canUse.ContainsKey(module) ? Color.gray : Color.white;
                if (DrawCustomButton(rect2, module.LabelCap, bColor))
                {
                    currentModule = module;
                }
                rect2.y += 35;
            }
            Widgets.EndScrollView();
            Text.Anchor = TextAnchor.UpperLeft;

            Rect rect3 = new Rect(inRect.x + 240, inRect.y + 10, 470, 455);

            if (currentModule != null)
            {
                DrawModuleInfo(rect3, currentModule);
            }
        }
        private void CarryModule(MKStationModuleDef def)
        {
            Thing item = FindModuleItem(def.Item);

            if (item != null)
            {
                mkStationWindow.Close();
                Close();

                Job job = new Job(RimArmorCore.JobDefOfLocal.SetupModuleForStation, mkStationWindow.mkStation, item);
                job.count = 1;
                mkStationWindow.SelPawn.jobs.TryTakeOrderedJob(job);
            }
        }
        private void DrawModuleInfo(Rect rect, MKStationModuleDef module)
        {
            Rect textureRect = new Rect(rect.x + (rect.x / 2) + 50, rect.y + 30, 100, 100);

            GUI.DrawTexture(textureRect, module.IconImage);

            Rect titleRect = new Rect(rect.x, rect.y, rect.width, 25);

            Text.Anchor = TextAnchor.MiddleCenter;
            Text.Font   = GameFont.Medium;
            Widgets.Label(titleRect, module.LabelCap);
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;

            Rect mainRect = new Rect(rect.x + 15, textureRect.y + 115, 470, 300);

            Widgets.LabelScrollable(mainRect, module.description, ref slider2);

            GUI.color = MenuSectionBGBorderColor;
            Widgets.DrawLineHorizontal(rect.x + 45, rect.y + 30, rect.width - 80);
            GUI.color = Color.white;

            Color bColor     = canUse.ContainsKey(module) ? Color.gray : Color.white;
            Rect  buttonRect = new Rect(rect.x + 15, rect.y + 315, rect.width - 20, 20);

            Text.Anchor = TextAnchor.MiddleCenter;
            if (DrawCustomButton(buttonRect, "Station_InstallModule".Translate(), bColor))
            {
                if (canUse.ContainsKey(module))
                {
                    Messages.Message("Station_ModuleCannotInstal".Translate(canUse[module]), MessageTypeDefOf.NeutralEvent, false);
                }
                else
                {
                    CarryModule(module);
                }
            }
            if (canUse.ContainsKey(module))
            {
                Widgets.Label(new Rect(rect.x + 15, buttonRect.y - 2, rect.width - 20, 60), canUse[module]);
            }
            Text.Anchor = TextAnchor.UpperLeft;
        }