Esempio n. 1
0
        public override void Randomize()
        {
            context = Extensions.GetEnumValues <PawnModifierContext>().RandomElement();
            faction = faction = DefDatabase <FactionDef> .AllDefs.Where(f => !f.isPlayer).RandomElement();

            gender = Extensions.GetEnumValues <PawnModifierGender>().RandomElement();
        }
Esempio n. 2
0
        public override void Randomize()
        {
            chance  = GenMath.RoundedHundredth(Rand.Range(0.05f, 1f));
            context = Extensions.GetEnumValues <PawnModifierContext>().RandomElement();
            faction = faction = DefDatabase <FactionDef> .AllDefs.Where(f => !f.isPlayer).RandomElement();

            gender = Extensions.GetEnumValues <PawnModifierGender>().RandomElement();
        }
Esempio n. 3
0
        public static string Translate(this PawnModifierGender c)
        {
            switch (c)
            {
            case PawnModifierGender.All:
                return(R.String.MSP_Gender_All.CapitalizeFirst());

            case PawnModifierGender.Male:
                return(R.String.MSP_Gender_Male.CapitalizeFirst());

            case PawnModifierGender.Female:
                return(R.String.MSP_Gender_Female.CapitalizeFirst());

            default:
                return(R.String.MSP_Undefined.CapitalizeFirst());
            }
        }
Esempio n. 4
0
        protected void DoContextEditInterface(Rect rect)
        {
            bool isFaction = context == PawnModifierContext.Faction;

            Rect[] rows = rect.SplitRows(1, 1, 1);

            Rect[] rect_gender  = rows[0].SplitCols(1, 2);
            Rect[] rect_context = rows[1].SplitCols(1, 2);
            Rect[] rect_faction = rows[2].SplitCols(1, 2);

            // Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect_gender[0], R.String.MSP_Gender.CapitalizeFirst());
            // Text.Anchor = TextAnchor.UpperLeft;
            if (Widgets.ButtonText(rect_gender[1], gender.Translate()))
            {
                FloatMenuUtility.MakeMenu(Extensions.GetEnumValues <PawnModifierGender>(), Extensions.Translate, (g) => () => gender = g);
            }

            // Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect_context[0], R.String.MSP_Context.CapitalizeFirst());
            // Text.Anchor = TextAnchor.UpperLeft;
            if (Widgets.ButtonText(rect_context[1], context.Translate(), true, false, true))
            {
                FloatMenuUtility.MakeMenu(Extensions.GetEnumValues <PawnModifierContext>(), Extensions.Translate, (c) => () => context = c);
            }

            if (isFaction)
            {
                // Text.Anchor = TextAnchor.MiddleRight;
                Widgets.Label(rect_faction[0], R.String.MSP_Faction.CapitalizeFirst());
                // Text.Anchor = TextAnchor.UpperLeft;

                if (Widgets.ButtonText(rect_faction[1], faction.LabelCap, true, false, true))
                {
                    FloatMenuUtility.MakeMenu(DefDatabase <FactionDef> .AllDefs.Where((d) => !d.isPlayer), (f) => f.LabelCap, (f) => () => faction = f);
                }
            }
        }
Esempio n. 5
0
 public static bool Includes(this PawnModifierGender g, Gender other)
 {
     return((g == PawnModifierGender.All || other == Gender.None) ||
            (g == PawnModifierGender.Female && other == Gender.Female) ||
            (g == PawnModifierGender.Male && other == Gender.Male));
 }
        public override void DoEditInterface(Listing_ScenEdit listing)
        {
            Rect rect = listing.GetScenPartRect(this, RowHeight * 4);

            bool isFaction = context == PawnModifierContext.Faction;

            Rect[] rows = rect.SplitRows(1, 1, 1, 1);

            Rect[] rect_gender  = rows[0].SplitCols(1, 2);
            Rect[] rect_chance  = rows[1].SplitCols(1, 2);
            Rect[] rect_context = rows[2].SplitCols(1, 2);
            Rect[] rect_faction = rows[3].SplitCols(1, 2);

            //Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect_chance[0], R.String.MSP_Chance.CapitalizeFirst());
            //Text.Anchor = TextAnchor.UpperLeft;
            Widgets.TextFieldPercent(rect_chance[1], ref chance, ref chanceBuf, 0f, 1f);

            //Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect_gender[0], R.String.MSP_Gender.CapitalizeFirst());
            //Text.Anchor = TextAnchor.UpperLeft;
            if (Widgets.ButtonText(rect_gender[1], gender.Translate()))
            {
                FloatMenuUtility.MakeMenu(Extensions.GetEnumValues <PawnModifierGender>(), Extensions.Translate, (g) => () => gender = g);
            }

            //Text.Anchor = TextAnchor.MiddleRight;
            Widgets.Label(rect_context[0], R.String.MSP_Context.CapitalizeFirst());
            //Text.Anchor = TextAnchor.UpperLeft;
            if (Widgets.ButtonText(rect_context[1], context.Translate(), true, false, true))
            {
                FloatMenuUtility.MakeMenu(Extensions.GetEnumValues <PawnModifierContext>(), Extensions.Translate, (c) => () => context = c);
            }

            if (isFaction)
            {
                //Text.Anchor = TextAnchor.MiddleRight;
                Widgets.Label(rect_faction[0], R.String.MSP_Faction.CapitalizeFirst());
                //Text.Anchor = TextAnchor.UpperLeft;

                if (Widgets.ButtonText(rect_faction[1], faction.LabelCap, true, false, true))
                {
                    FloatMenuUtility.MakeMenu(DefDatabase <FactionDef> .AllDefs.Where((d) => !d.isPlayer), (f) => f.LabelCap, (f) => () => faction = f);
                }
            }
        }