protected override void FillTab() { Rect rect1 = new Rect(0.0f, 0.0f, ITab_AutomatedFactory.WinSize.x, ITab_AutomatedFactory.WinSize.y).ContractedBy(10f); Text.Font = GameFont.Medium; Widgets.Label(rect1, SelectedFactory.def.LabelCap); Rect rect2 = rect1; rect2.yMin += 35f; Vector2 vector = rect2.position; rect2.xMin += 20f; Text.Font = GameFont.Small; for (int index = 0; index < products.Count; ++index) { var product = products[index]; if (SelectedFactory.FindRecipeForProduct(product) != null) { Widgets.Label(rect2, product.LabelCap); Widgets.Checkbox(vector, ref allowed[index], 16f); TooltipHandler.TipRegion(rect2, tips[index]); rect2.yMin += 20f; vector.y += 20f; } } }
public override void TabUpdate() { for (int index = 0; index < products.Count; ++index) { SelectedFactory.SetAllowed(products[index], allowed[index]); } }
public override void OnOpen() { products = SelectedFactory.AllProducts(); allowed = new bool[products.Count]; tips = new TipSignal[products.Count]; for (int index = 0; index < products.Count; ++index) { var product = products[index]; allowed[index] = SelectedFactory.GetAllowed(product); string tipText = ""; var recipe = SelectedFactory.FindRecipeForProduct(product); if (recipe != null) { foreach (var ingredient in recipe.ingredients) { if (!ingredient.filter.Summary.NullOrEmpty()) { tipText += recipe.IngredientValueGetter.BillRequirementsDescription(ingredient) + "\n"; } } } tips[index].text = tipText; } }