private void DrawItemRow(CrematoriusTarget target, float y) { Rect itemRect = new Rect(0, y, ItemSize.x, ItemSize.y); try { GUI.BeginGroup(itemRect); Text.Font = GameFont.Tiny; Text.Anchor = TextAnchor.MiddleCenter; float currentX = 0f; Rect labelRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y); Widgets.Label(labelRect, target.Label); currentX += ButtonSize.x + buttonMargin; //Off selection button Rect offButtonRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y); GUI.DrawTexture(offButtonRect, offButtonTexture); if (offButtonRect.Contains(Event.current.mousePosition)) { Widgets.DrawHighlight(offButtonRect); } if (target.Mode == CrematoriusOperationMode.Off) { Widgets.DrawBox(offButtonRect); } Widgets.Label(offButtonRect, "Off".Translate()); if (Widgets.InvisibleButton(offButtonRect)) { target.Mode = CrematoriusOperationMode.Off; SoundDefOf.Click.PlayOneShotOnCamera(); } currentX += ButtonSize.x + buttonMargin; //Cremate selection button Rect cremateButtonRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y); GUI.DrawTexture(cremateButtonRect, cremateButtonTexture); if (cremateButtonRect.Contains(Event.current.mousePosition)) { Widgets.DrawHighlight(cremateButtonRect); } if (target.Mode == CrematoriusOperationMode.Cremate) { Widgets.DrawBox(cremateButtonRect); } Widgets.Label(cremateButtonRect, "Cremate".Translate()); if (Widgets.InvisibleButton(cremateButtonRect)) { target.Mode = CrematoriusOperationMode.Cremate; SoundDefOf.Click.PlayOneShotOnCamera(); } currentX += ButtonSize.x + buttonMargin; //Butcher selection button Rect butcherButtonRect = new Rect(currentX, 0f, ButtonSize.x, ButtonSize.y); GUI.DrawTexture(butcherButtonRect, butcherButtonTexture); if (butcherButtonRect.Contains(Event.current.mousePosition)) { Widgets.DrawHighlight(butcherButtonRect); } if (target.Mode == CrematoriusOperationMode.Butcher) { Widgets.DrawBox(butcherButtonRect); } Widgets.Label(butcherButtonRect, "Butcher".Translate()); if (Widgets.InvisibleButton(butcherButtonRect)) { target.Mode = CrematoriusOperationMode.Butcher; SoundDefOf.Click.PlayOneShotOnCamera(); } currentX += ButtonSize.x + buttonMargin; //Do the rotten only check box //Rect onlyRottenRect = new Rect(currentX, 0, ButtonSize.x, ButtonSize.y); //Widgets.LabelCheckbox(onlyRottenRect, "Only rotten".Translate(), ref target.OnlyRotten); //if (onlyRottenRect.Contains(Event.current.mousePosition)) //{ // Widgets.DrawHighlight(onlyRottenRect); //} //currentX += ButtonSize.x + buttonMargin; //Do the priority changer currentX += borderMargin; float y2 = (ItemSize.y - PriorityButtonSize.y) / 2f; Rect priorityRect = new Rect(currentX, y2, PriorityButtonSize.x, PriorityButtonSize.y); GUI.DrawTexture(priorityRect, offButtonTexture); if (priorityRect.Contains(Event.current.mousePosition)) { Widgets.DrawHighlight(priorityRect); } Widgets.DrawBox(priorityRect); Text.Font = GameFont.Medium; GUI.color = ColorOfPriority(target.Priority); Widgets.Label(priorityRect, target.Priority.ToString()); TooltipHandler.TipRegion(priorityRect, new TipSignal("CrematoriusPriorityTooltip".Translate())); if (priorityRect.Contains(Event.current.mousePosition) && Event.current.type == EventType.MouseDown) { if (Event.current.button == 0) { //Decrease the priority target.Priority--; SoundDefOf.AmountIncrement.PlayOneShotOnCamera(); } if (Event.current.button == 1) { //Increase the priority target.Priority++; SoundDefOf.AmountDecrement.PlayOneShotOnCamera(); } Event.current.Use(); } } finally { GUI.EndGroup(); Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; } }
public override void SpawnSetup() { base.SpawnSetup(); animalLike = new CrematoriusTarget(animalLabel, animalPredicate, 2, this); humanLike = new CrematoriusTarget(humanLabel, humanPredicate, 1, this); mechanoid = new CrematoriusTarget(mechanoidLabel, mechanoidPredicate, 3, this); }