Example #1
0
        public static void DrawHairColors(Rect rect, GradientHairSettings settings)
        {
            if (dialog == null)
            {
                return;
            }
            float num = rect.y;

            Widgets.ColorSelector(new Rect(rect.x, num, rect.width, 92f), ref settings.colorB, AllHairColors, null, 22, 2);
            //num += 60f;
        }
        public override void DoWindowContents(Rect inRect)
        {
            base.DoWindowContents(inRect);

            foreach (var data in colorRects)
            {
                var colorOption = GetColorOptionFor(data.Key);
                if (colorOption != null)
                {
                    if (colorOption.pawnFavoriteOnly)
                    {
                        GUI.DrawTexture(data.Value, Textures.PawnFavoriteIcon);
                    }
                    else
                    {
                        Widgets.DrawBoxSolidWithOutline(data.Value, colorOption.color, Color.white);
                    }
                }
                else
                {
                    Widgets.DrawBoxSolidWithOutline(data.Value, Color.clear, Color.white);
                }

                if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && Event.current.clickCount == 1 && Mouse.IsOver(data.Value))
                {
                    activeMode = data.Key;
                }
                else if (Event.current.type == EventType.MouseDown && Event.current.button == 1 && Event.current.clickCount == 1 && Mouse.IsOver(data.Value))
                {
                    RemoveColor();
                }
            }
            if (colorRects.ContainsKey(activeMode))
            {
                GUI.DrawTexture(colorRects[activeMode], Textures.GreenSelectionBox);
            }

            foreach (var data in stringRects)
            {
                Widgets.Label(data.Value, data.Key);
            }

            var colorSelectorRect = new Rect(37, 142, 570, 195);
            var oldColor          = curColor;

            Widgets.ColorSelector(colorSelectorRect, ref curColor, ColorUtils.AllColors);
            if (oldColor != curColor)
            {
                SetColor();
            }
            var setIdeoColorRect = new Rect(40, inRect.yMax - 58, 174, 24f);

            if (Widgets.ButtonText(setIdeoColorRect, Strings.SetIdeologyColor))
            {
                curColor = Faction.OfPlayer.ideos.PrimaryIdeo.ApparelColor;
                SetColor();
            }

            var setPawnFavoritesColor = new Rect(setIdeoColorRect.xMax + 15, setIdeoColorRect.y, setIdeoColorRect.width, 24f);

            if (Widgets.ButtonText(setPawnFavoritesColor, Strings.SetPawnFavoritesColor))
            {
                if (this.colonistGroup.groupColor is null)
                {
                    this.colonistGroup.groupColor = new GroupColor();
                }
                if (this.colonistGroup.groupColor.bodyColors is null)
                {
                    this.colonistGroup.groupColor.bodyColors = new Dictionary <BodyColor, ColorOption>();
                }
                this.colonistGroup.groupColor.bodyColors[activeMode] = new ColorOption(true);
                curColor = Color.clear;
            }

            var clearGroupColor = new Rect(setPawnFavoritesColor.xMax + 15, setIdeoColorRect.y, setIdeoColorRect.width, 24f);

            if (Widgets.ButtonText(clearGroupColor, Strings.ClearGroupColor))
            {
                RemoveColor();
            }
        }