protected void DoPawnModifierEditInterface(Rect rect)
        {
            Rect rect2 = rect.TopHalf();
            Rect rect3 = rect2.LeftPart(0.333f).Rounded();
            Rect rect4 = rect2.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect3, "chance".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.TextFieldPercent(rect4, ref this.chance, ref this.chanceBuf, 0f, 1f);
            Rect rect5 = rect.BottomHalf();
            Rect rect6 = rect5.LeftPart(0.333f).Rounded();
            Rect rect7 = rect5.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect6, "context".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            if (Widgets.ButtonText(rect7, this.context.ToStringHuman(), true, false, true))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (PawnGenerationContext localCont2 in Enum.GetValues(typeof(PawnGenerationContext)))
                {
                    PawnGenerationContext localCont = localCont2;
                    list.Add(new FloatMenuOption(localCont.ToStringHuman(), delegate
                    {
                        this.context = localCont;
                    }, MenuOptionPriority.Default, null, null, 0f, null, null));
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
        }
Example #2
0
        protected void DoPawnModifierEditInterface(Rect rect)
        {
            Rect rect2 = rect.TopHalf();
            Rect rect3 = rect2.LeftPart(0.333f).Rounded();
            Rect rect4 = rect2.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect3, "chance".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.TextFieldPercent(rect4, ref chance, ref chanceBuf);
            Rect rect5 = rect.BottomHalf();
            Rect rect6 = rect5.LeftPart(0.333f).Rounded();
            Rect rect7 = rect5.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect6, "context".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            if (!Widgets.ButtonText(rect7, context.ToStringHuman()))
            {
                return;
            }
            List <FloatMenuOption> list = new List <FloatMenuOption>();

            foreach (PawnGenerationContext value in Enum.GetValues(typeof(PawnGenerationContext)))
            {
                PawnGenerationContext localCont = value;
                list.Add(new FloatMenuOption(localCont.ToStringHuman(), delegate
                {
                    context = localCont;
                }));
            }
            Find.WindowStack.Add(new FloatMenu(list));
        }
        protected void DoPawnModifierEditInterface(Rect rect)
        {
            Rect rect2 = rect.TopHalf();
            Rect rect3 = rect2.LeftPart(0.333f).Rounded();
            Rect rect4 = rect2.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect3, "chance".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            Widgets.TextFieldPercent(rect4, ref this.chance, ref this.chanceBuf, 0f, 1f);
            Rect rect5 = rect.BottomHalf();
            Rect rect6 = rect5.LeftPart(0.333f).Rounded();
            Rect rect7 = rect5.RightPart(0.666f).Rounded();

            Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect6, "context".Translate());
            Text.Anchor = TextAnchor.UpperLeft;
            if (Widgets.ButtonText(rect7, this.context.ToStringHuman(), true, false, true))
            {
                List <FloatMenuOption> list       = new List <FloatMenuOption>();
                IEnumerator            enumerator = Enum.GetValues(typeof(PawnGenerationContext)).GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        object obj = enumerator.Current;
                        PawnGenerationContext localCont2 = (PawnGenerationContext)obj;
                        PawnGenerationContext localCont  = localCont2;
                        list.Add(new FloatMenuOption(localCont.ToStringHuman(), delegate()
                        {
                            this.context = localCont;
                        }, MenuOptionPriority.Default, null, null, 0f, null, null));
                    }
                }
                finally
                {
                    IDisposable disposable;
                    if ((disposable = (enumerator as IDisposable)) != null)
                    {
                        disposable.Dispose();
                    }
                }
                Find.WindowStack.Add(new FloatMenu(list));
            }
        }