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); } } }
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); } } }