private static void DrawStorytellerHotseatSettingsDynamic(Listing_Standard listingStandard, Rect inRect) { Text.Font = GameFont.Medium; listingStandard.Label("StorytellersArrayEnabledSettingTitle".Translate(), -1, "StorytellersArrayEnabledSettingTooltip".Translate()); Text.Font = GameFont.Small; var rowCount = HotseatStatics.AllVisibleStorytellers.Count(); var windowRect = new Rect(listingStandard.ColumnWidth + 20f, listingStandard.CurHeight, listingStandard.ColumnWidth, inRect.height - listingStandard.CurHeight); var scrollRect = new Rect(0f, 0f, windowRect.width - 16f, CalculateScrollHeight(listingStandard, rowCount)); Widgets.BeginScrollView(windowRect, ref _scrollPosition, scrollRect); listingStandard.ColumnWidth -= 16f; //This line is needed because the listingstandard and scrollrect are not synced. When one changes you need to change the other. listingStandard.Begin(scrollRect); foreach (var storyteller in HotseatStatics.AllVisibleStorytellers) { var storytellerEnabledSetting = HotseatSettings.GetOrCreateStorytellerEnabledSetting(storyteller.defName); listingStandard.CheckboxLabeled(storyteller.label, ref storytellerEnabledSetting.storytellerEnabledBool, storyteller.description); if (storytellerEnabledSetting.storytellerEnabledBool && HotseatSettings.enableStorytellerSwitchingWeighted) { DrawWeightSlider(listingStandard, storytellerEnabledSetting); } listingStandard.Gap(5f); } listingStandard.End(); Widgets.EndScrollView(); }
private static StorytellerDef ChooseStoryTeller() { var storytellerDefs = HotseatSettings.GetStorytellersFiltered().ToList(); // StorytellerLogUtils.LogStorytellers(storytellerDefs); if (!storytellerDefs.Any()) { throw new Exception("No valid storytellers"); } return(HotseatSettings.enableStorytellerSwitchingWeighted ? DecidedByWeighted(storytellerDefs) : DecideByUniform(storytellerDefs)); }