Exemple #1
0
        public static void DrawMouseAttachmentWithThing(this ThingDef thingDef, ThingDef stuffDef)
        {
            if (!(thingDef.uiIcon == null) && !(thingDef.uiIcon == BaseContent.BadTex))
            {
                Color color;

                if (stuffDef != null)
                {
                    color = thingDef.GetColorForStuff(stuffDef);
                }
                else
                {
                    color = thingDef.MadeFromStuff ? thingDef.GetColorForStuff(GenStuff.DefaultStuffFor(thingDef)) : thingDef.uiIconColor;
                }

                Rect dragRect = new Rect(Verse.UI.GUIToScreenPoint(Event.current.mousePosition) + new Vector2(GenUI.SmallIconSize / 2, 0), new Vector2(GenUI.SmallIconSize, GenUI.SmallIconSize));
                Find.WindowStack.ImmediateWindow(
                    Rand.Int,
                    dragRect,
                    WindowLayer.Super,
                    () =>
                {
                    GUI.color = color;
                    GUI.DrawTexture(dragRect.AtZero(), thingDef.uiIcon);
                    GUI.color = Color.white;
                }, false);
            }
        }