Example #1
0
        // [ Apparel ] [ Melee ] [ Ranged ] [ Medical / Drugs ]
        public void DrawItemColumns(Rect r)
        {
            var topRect = r.TopPartPixels(ModGUIUtility.DEFAULT_HEIGHT);

            void DrawOptionButton(Texture2D tex, string tooltip, State state)
            {
                var optionRect = topRect.LeftPartPixels(ModGUIUtility.DEFAULT_HEIGHT);

                GUI.DrawTexture(topRect.LeftPartPixels(ModGUIUtility.DEFAULT_HEIGHT), tex, ScaleMode.ScaleToFit, true, 1f, Color.white, 0f, 0f);
                TooltipHandler.TipRegion(optionRect, tooltip);
                if (Widgets.ButtonInvisible(optionRect))
                {
                    curState  = state;
                    defFilter = string.Empty;
                }
                topRect.x += ModGUIUtility.SPACED_HEIGHT;
            }

            r.AdjVertBy(ModGUIUtility.DEFAULT_HEIGHT);

            DrawOptionButton(Textures.ApparelTex, "Apparel", State.Apparel);
            DrawOptionButton(Textures.MeleeTex, "Melee", State.Melee);
            DrawOptionButton(Textures.RangedTex, "Ranged", State.Ranged);
            DrawOptionButton(Textures.MedicalTex, "Medicine", State.Medicinal);
            DrawOptionButton(Textures.MiscItemsTex, "Items", State.Items);

            switch (curState)
            {
            case State.Apparel: DrawDefList(r, ApparelUtility.ApparelCanFitOnBody(BodyDefOf.Human, curTag.requiredItems.Select(s => s.Def).Where(def => def.IsApparel).ToList()).ToList());
                break;

            case State.Melee: DrawDefList(r, Utility.meleeWeapons);
                break;

            case State.Ranged: DrawDefList(r, Utility.rangedWeapons);
                break;

            case State.Medicinal: DrawDefList(r, Utility.medicinalDefs);
                break;

            case State.Items: DrawDefList(r, Utility.items);
                break;
            }
        }