private void DoRow(Rect rect, StoreIncident thingDef, int index) { Widgets.DrawHighlightIfMouseover(rect); TooltipHandler.TipRegion(rect, thingDef.description); GUI.BeginGroup(rect); Rect rect2 = new Rect(4f, (rect.height - 20f) / 2f, 20f, 20f); //Widgets.ThingIcon(rect2, thingDef); Rect rect3 = new Rect(rect2.xMax + 4f, 0f, rect.width - 60, 24f); Text.Anchor = TextAnchor.MiddleLeft; Text.WordWrap = false; if (thingDef.cost < 1 && thingDef.defName != "Item") { GUI.color = Color.grey; } Widgets.Label(rect3, thingDef.label.CapitalizeFirst()); Rect rect4 = new Rect(rect3.width, rect3.y, 60, rect3.height); if (Widgets.ButtonText(rect4, "Edit")) { Type type = typeof(StoreIncidentEditor); Find.WindowStack.TryRemove(type); StoreIncidentEditor window = new StoreIncidentEditor(thingDef); Find.WindowStack.Add(window); } Text.Anchor = TextAnchor.UpperLeft; Text.WordWrap = true; GUI.color = Color.white; GUI.EndGroup(); }
public override void DoWindowContents(Rect inRect) { Rect topBox = new Rect(0, 0, 300f, 28f); Widgets.Label(topBox, "Viewers: " + viewerCount); topBox.y += topBox.height; Widgets.Label(topBox, "Days per cooldown period: " + ToolkitSettings.EventCooldownInterval + " days"); topBox.y += topBox.height; if (Widgets.ButtonText(topBox, "Cooldown Settings")) { SettingsWindow window = new SettingsWindow(Toolkit.Mod); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); ToolkitSettings.currentTab = ToolkitSettings.SettingsTab.Cooldowns; } Rect karmaBox = new Rect(0, 120f, inRect.width / 2f, 28f); Widgets.Label(karmaBox, "Limit Events By Type:"); Widgets.Checkbox(new Vector2(180f, karmaBox.y), ref ToolkitSettings.MaxEvents); karmaBox.y += karmaBox.height; // side one Rect sideOne = new Rect(0, karmaBox.y + 32f, 100f, 28f); Rect sideTwo = new Rect(sideOne) { x = 140f }; Widgets.Label(sideOne, "Good"); sideOne.y += sideOne.height; Widgets.Label(sideTwo, goodEventsInLog + "/" + goodEventsMax); bool goodBool = goodEventsMaxed; Widgets.Checkbox(new Vector2(sideTwo.x + 40f, sideTwo.y), ref goodBool); sideTwo.y += sideTwo.height; Widgets.Label(sideOne, "Bad"); sideOne.y += sideOne.height; Widgets.Label(sideTwo, badEventsInLog + "/" + badEventsMax); bool badBool = badEventsMaxed; Widgets.Checkbox(new Vector2(sideTwo.x + 40f, sideTwo.y), ref badBool); sideTwo.y += sideTwo.height; Widgets.Label(sideOne, "Neutral"); sideOne.y += sideOne.height; Widgets.Label(sideTwo, neutralEventsInLog + "/" + neutralEventsMax); bool neutralBool = neutralEventsMaxed; Widgets.Checkbox(new Vector2(sideTwo.x + 40f, sideTwo.y), ref neutralBool); sideTwo.y += sideTwo.height; Widgets.Label(sideOne, "Care Packages"); sideOne.y += sideOne.height; Widgets.Label(sideTwo, carePackagesInLog + "/" + carePackagesMax); bool careBool = carePackagesMaxed; Widgets.Checkbox(new Vector2(sideTwo.x + 40f, sideTwo.y), ref careBool); sideTwo.y += sideTwo.height; // SIDE TWO Rect eventBox = new Rect(inRect.width / 2f - 200f, 120f, inRect.width / 2f, 28f); Widgets.Label(eventBox, "Limit Events By Event:"); Widgets.Checkbox(new Vector2(eventBox.x + 180f, eventBox.y), ref ToolkitSettings.EventsHaveCooldowns); eventBox.y += eventBox.height; sideOne = new Rect(eventBox.x, eventBox.y + 32f, 250f, 28f); sideTwo = new Rect(sideOne) { x = sideOne.x + sideOne.width + 40f }; foreach (KeyValuePair <StoreIncident, int> incidentPair in storeIncidentsLogged) { if (incidentPair.Value < 1) { continue; } Widgets.Label(sideOne, incidentPair.Key.LabelCap); sideOne.y += sideOne.height; Widgets.Label(sideTwo, incidentPair.Value + "/" + storeIncidentMax[incidentPair.Key]); bool maxed = storeIncidentMaxed[incidentPair.Key]; Widgets.Checkbox(new Vector2(sideTwo.x + 40f, sideTwo.y), ref maxed); sideTwo.x += 100f; Widgets.Label(sideTwo, storeIncidentsDayTillUsuable[incidentPair.Key] + " days"); sideTwo.x += 100f; sideTwo.width = 100f; if (Widgets.ButtonText(sideTwo, "Edit")) { StoreIncidentEditor window = new StoreIncidentEditor(incidentPair.Key); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } sideOne = new Rect(eventBox.x, sideOne.y, 250f, 28f); sideTwo = new Rect(sideOne) { x = sideOne.x + sideOne.width + 40f }; } cachedFramesCount++; if (cachedFramesCount >= 800) { UpdateTrackerStats(); cachedFramesCount = 0; } }
public override void DoWindowContents(Rect inRect) { Rect topBox = new Rect(0, 0, 400f, 28f); Widgets.Label(topBox, "Viewers: " + viewerCount); topBox.y += topBox.height; string cooldownBuffer = ToolkitSettings.EventCooldownInterval.ToString(); Widgets.TextFieldNumericLabeled(topBox, "Days per cooldown period ", ref ToolkitSettings.EventCooldownInterval, ref cooldownBuffer, 1); topBox.y = 0; topBox.x += topBox.width + 20f; Widgets.Label(topBox, "Tracker is Cached and will refresh in " + (800 - cachedFramesCount)); topBox.y += topBox.height; if (Widgets.ButtonText(topBox, "Refresh")) { UpdateTrackerStats(); } Rect karmaBox = new Rect(0, 120f, inRect.width / 2f, 28f); Widgets.Label(karmaBox, "Limit Events By Type:"); Widgets.Checkbox(new Vector2(200f, karmaBox.y), ref ToolkitSettings.MaxEvents); karmaBox.y += karmaBox.height; // side one Rect sideOne = new Rect(0, karmaBox.y + 32f, 100f, 32f); Rect sideTwo = new Rect(sideOne) { x = 140f }; Rect sideThree = new Rect(sideTwo) { x = 160, y = sideTwo.y - 2, width = 30, height = 26 }; Widgets.Label(sideOne, "Good"); sideOne.y += sideOne.height; Widgets.Label(sideTwo, goodEventsInLog + " /"); string goodBuffer = ToolkitSettings.MaxGoodEventsPerInterval.ToString(); Widgets.TextFieldNumeric(sideThree, ref ToolkitSettings.MaxGoodEventsPerInterval, ref goodBuffer, 0); bool goodBool = goodEventsMaxed; Widgets.Checkbox(new Vector2(sideTwo.x + 60f, sideTwo.y), ref goodBool); sideTwo.y += sideTwo.height; sideThree.y += sideTwo.height; Widgets.Label(sideOne, "Bad"); sideOne.y += sideOne.height; Widgets.Label(sideTwo, badEventsInLog + " /"); string badBuffer = ToolkitSettings.MaxBadEventsPerInterval.ToString(); Widgets.TextFieldNumeric(sideThree, ref ToolkitSettings.MaxBadEventsPerInterval, ref badBuffer, 0); bool badBool = badEventsMaxed; Widgets.Checkbox(new Vector2(sideTwo.x + 60f, sideTwo.y), ref badBool); sideTwo.y += sideTwo.height; sideThree.y += sideTwo.height; Widgets.Label(sideOne, "Neutral"); sideOne.y += sideOne.height; Widgets.Label(sideTwo, neutralEventsInLog + " /"); string neutralBuffer = ToolkitSettings.MaxNeutralEventsPerInterval.ToString(); Widgets.TextFieldNumeric(sideThree, ref ToolkitSettings.MaxNeutralEventsPerInterval, ref neutralBuffer, 0); bool neutralBool = neutralEventsMaxed; Widgets.Checkbox(new Vector2(sideTwo.x + 60f, sideTwo.y), ref neutralBool); sideTwo.y += sideTwo.height; sideThree.y += sideTwo.height; Widgets.Label(sideOne, "Care Packages"); sideOne.y += sideOne.height; Widgets.Label(sideTwo, carePackagesInLog + " /"); string carePackageBuffer = ToolkitSettings.MaxCarePackagesPerInterval.ToString(); Widgets.TextFieldNumeric(sideThree, ref ToolkitSettings.MaxCarePackagesPerInterval, ref carePackageBuffer, 0); bool careBool = carePackagesMaxed; Widgets.Checkbox(new Vector2(sideTwo.x + 60f, sideTwo.y), ref careBool); sideTwo.y += sideTwo.height; sideThree.y += sideTwo.height; // SIDE TWO Rect eventBox = new Rect(inRect.width / 2f - 200f, 120f, inRect.width / 2f, 28f); Widgets.Label(eventBox, "Limit Events By Event:"); Widgets.Checkbox(new Vector2(eventBox.x + 180f, eventBox.y), ref ToolkitSettings.EventsHaveCooldowns); eventBox.y += eventBox.height; sideOne = new Rect(eventBox.x, eventBox.y + 32f, 250f, 28f); sideTwo = new Rect(sideOne) { x = sideOne.x + sideOne.width + 40f }; foreach (KeyValuePair <StoreIncident, int> incidentPair in storeIncidentsLogged) { if (incidentPair.Value < 1) { continue; } Widgets.Label(sideOne, incidentPair.Key.LabelCap); sideOne.y += sideOne.height; Widgets.Label(sideTwo, incidentPair.Value + "/" + storeIncidentMax[incidentPair.Key]); bool maxed = storeIncidentMaxed[incidentPair.Key]; Widgets.Checkbox(new Vector2(sideTwo.x + 40f, sideTwo.y), ref maxed); sideTwo.x += 100f; Widgets.Label(sideTwo, storeIncidentsDayTillUsuable[incidentPair.Key] + " days"); sideTwo.x += 100f; sideTwo.width = 100f; if (Widgets.ButtonText(sideTwo, "Edit")) { StoreIncidentEditor window = new StoreIncidentEditor(incidentPair.Key); Find.WindowStack.TryRemove(window.GetType()); Find.WindowStack.Add(window); } sideOne = new Rect(eventBox.x, sideOne.y, 250f, 28f); sideTwo = new Rect(sideOne) { x = sideOne.x + sideOne.width + 40f }; } cachedFramesCount++; if (cachedFramesCount >= 800) { UpdateTrackerStats(); } }