protected override void FillTab() { PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.BillsTab, KnowledgeAmount.FrameDisplayed); Vector2 winSize = ITab_Bills.WinSize; float x = winSize.x; Vector2 winSize2 = ITab_Bills.WinSize; Rect rect2 = new Rect(0f, 0f, x, winSize2.y).ContractedBy(10f); Func <List <FloatMenuOption> > recipeOptionsMaker = delegate { List <FloatMenuOption> list = new List <FloatMenuOption>(); for (int i = 0; i < this.SelTable.def.AllRecipes.Count; i++) { ITab_Bills tab_Bills = this; if (this.SelTable.def.AllRecipes[i].AvailableNow) { RecipeDef recipe = this.SelTable.def.AllRecipes[i]; list.Add(new FloatMenuOption(recipe.LabelCap, delegate { if (!tab_Bills.SelTable.Map.mapPawns.FreeColonists.Any((Pawn col) => recipe.PawnSatisfiesSkillRequirements(col))) { Bill.CreateNoPawnsWithSkillDialog(recipe); } Bill bill = recipe.MakeNewBill(); tab_Bills.SelTable.billStack.AddBill(bill); if (recipe.conceptLearned != null) { PlayerKnowledgeDatabase.KnowledgeDemonstrated(recipe.conceptLearned, KnowledgeAmount.Total); } if (TutorSystem.TutorialMode) { TutorSystem.Notify_Event("AddBill-" + recipe.LabelCap); } }, MenuOptionPriority.Default, null, null, 29f, (Rect rect) => Widgets.InfoCardButton((float)(rect.x + 5.0), (float)(rect.y + (rect.height - 24.0) / 2.0), recipe), null)); } } if (!list.Any()) { list.Add(new FloatMenuOption("NoneBrackets".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null)); } return(list); }; this.mouseoverBill = this.SelTable.billStack.DoListing(rect2, recipeOptionsMaker, ref this.scrollPosition, ref this.viewHeight); }
protected override void FillTab() { PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.BillsTab, KnowledgeAmount.FrameDisplayed); Rect rect2 = new Rect(WinSize.x - PasteX, PasteY, PasteSize, PasteSize); if (BillUtility.Clipboard == null) { GUI.color = Color.gray; Widgets.DrawTextureFitted(rect2, TexButton.Paste, 1f); GUI.color = Color.white; TooltipHandler.TipRegionByKey(rect2, "PasteBillTip"); } else if (!SelTable.def.AllRecipes.Contains(BillUtility.Clipboard.recipe) || !BillUtility.Clipboard.recipe.AvailableNow || !BillUtility.Clipboard.recipe.AvailableOnNow(SelTable)) { GUI.color = Color.gray; Widgets.DrawTextureFitted(rect2, TexButton.Paste, 1f); GUI.color = Color.white; TooltipHandler.TipRegionByKey(rect2, "ClipboardBillNotAvailableHere"); } else if (SelTable.billStack.Count >= 15) { GUI.color = Color.gray; Widgets.DrawTextureFitted(rect2, TexButton.Paste, 1f); GUI.color = Color.white; if (Mouse.IsOver(rect2)) { TooltipHandler.TipRegion(rect2, "PasteBillTip".Translate() + " (" + "PasteBillTip_LimitReached".Translate() + ")"); } } else { if (Widgets.ButtonImageFitted(rect2, TexButton.Paste, Color.white)) { Bill bill = BillUtility.Clipboard.Clone(); bill.InitializeAfterClone(); SelTable.billStack.AddBill(bill); SoundDefOf.Tick_Low.PlayOneShotOnCamera(); } TooltipHandler.TipRegionByKey(rect2, "PasteBillTip"); } Rect rect3 = new Rect(0f, 0f, WinSize.x, WinSize.y).ContractedBy(10f); Func <List <FloatMenuOption> > recipeOptionsMaker = delegate { List <FloatMenuOption> list = new List <FloatMenuOption>(); ITab_Bills tab_Bills = default(ITab_Bills); RecipeDef recipe = default(RecipeDef); for (int i = 0; i < SelTable.def.AllRecipes.Count; i++) { tab_Bills = this; if (SelTable.def.AllRecipes[i].AvailableNow && SelTable.def.AllRecipes[i].AvailableOnNow(SelTable)) { recipe = SelTable.def.AllRecipes[i]; list.Add(new FloatMenuOption(recipe.LabelCap, delegate { if (!tab_Bills.SelTable.Map.mapPawns.FreeColonists.Any((Pawn col) => recipe.PawnSatisfiesSkillRequirements(col))) { Bill.CreateNoPawnsWithSkillDialog(recipe); } Bill bill2 = recipe.MakeNewBill(); tab_Bills.SelTable.billStack.AddBill(bill2); if (recipe.conceptLearned != null) { PlayerKnowledgeDatabase.KnowledgeDemonstrated(recipe.conceptLearned, KnowledgeAmount.Total); } if (TutorSystem.TutorialMode) { TutorSystem.Notify_Event("AddBill-" + recipe.LabelCap.Resolve()); } }, recipe.ProducedThingDef, MenuOptionPriority.Default, null, null, 29f, (Rect rect) => Widgets.InfoCardButton(rect.x + 5f, rect.y + (rect.height - 24f) / 2f, recipe))); } } if (!list.Any()) { list.Add(new FloatMenuOption("NoneBrackets".Translate(), null)); } return(list); }; mouseoverBill = SelTable.billStack.DoListing(rect3, recipeOptionsMaker, ref scrollPosition, ref viewHeight); }