public static void DoWindowContentsPostfix(Rect rect) { var component = Current.Game.GetComponent <WorkManagerGameComponent>(); CustomWidgets.ButtonImageToggle(ref component.Enabled, new Rect(rect.xMin, rect.yMin, 24, 24), Resources.Strings.GlobalDisableTooltip, Resources.Textures.GlobalToggleButtonEnabled, Resources.Strings.GlobalEnableTooltip, Resources.Textures.GlobalToggleButtonDisabled); }
private static void Postfix(Rect rect) { var component = Current.Game.GetComponent <WorkManagerGameComponent>(); CustomWidgets.ButtonImageToggle(ref component.Enabled, new Rect(rect.x + 175, rect.y + 88, 24, 24), Resources.Strings.GlobalDisableTooltip, Resources.Textures.GlobalToggleButtonEnabled, Resources.Strings.GlobalEnableTooltip, Resources.Textures.GlobalToggleButtonDisabled); }
private static void DoHeaderPostfix(PawnColumnWorker_WorkPriority __instance, Rect rect) { const int iconSize = 16; var buttonRect = new Rect(rect.center.x - iconSize / 2 + 1, rect.yMax - iconSize - 4, iconSize, iconSize); var component = Current.Game.GetComponent <WorkManagerGameComponent>(); if (component.Enabled) { CustomWidgets.ButtonImageToggle(() => !component.DisabledWorkTypes.Contains(__instance.def.workType), newValue => component.SetWorkTypeEnabled(__instance.def.workType, newValue), buttonRect, Resources.Strings.WorkTypeDisableTooltip, Resources.Textures.WorkTypeToggleButtonEnabled, Resources.Strings.WorkTypeEnableTooltip, Resources.Textures.WorkTypeToggleButtonDisabled); } else { GUI.color = Color.white; GUI.DrawTexture(buttonRect, Resources.Textures.WorkTypeToggleButtonInactive); } }
public static void DoHeaderPrefix(PawnColumnWorker __instance, ref Rect rect) { const int iconSize = 16; var buttonRect = new Rect(rect.center.x - iconSize / 2, rect.yMax - iconSize - 4, iconSize, iconSize); var component = Current.Game.GetComponent <WorkManagerGameComponent>(); if (component.Enabled) { CustomWidgets.ButtonImageToggle(() => component.GetWorkTypeEnabled(__instance.def.workType), newValue => component.SetWorkTypeEnabled(__instance.def.workType, newValue), buttonRect, Resources.Strings.WorkTypeDisableTooltip, Resources.Textures.WorkTypeToggleButtonEnabled, Resources.Strings.WorkTypeEnableTooltip, Resources.Textures.WorkTypeToggleButtonDisabled); } else { GUI.color = Color.white; GUI.DrawTexture(buttonRect, Resources.Textures.WorkTypeToggleButtonInactive); } rect = new Rect(rect.x, rect.y, rect.width, rect.height - 30); }
public override void DoCell(Rect rect, Pawn pawn, PawnTable table) { if (pawn.Dead || pawn.workSettings == null || !pawn.workSettings.EverWork) { return; } var component = Current.Game.GetComponent <WorkManagerGameComponent>(); if (component.Enabled) { CustomWidgets.ButtonImageToggle(() => component.GetPawnEnabled(pawn), newValue => component.SetPawnEnabled(pawn, newValue), new Rect(rect.center.x - 8, rect.center.y - 8, 16, 16), Resources.Strings.PawnDisableTooltip, Resources.Textures.PawnToggleButtonEnabled, Resources.Strings.PawnEnableTooltip, Resources.Textures.PawnToggleButtonDisabled); } else { GUI.color = Color.white; GUI.DrawTexture(new Rect(rect.center.x - 8, rect.center.y - 8, 16, 16), Resources.Textures.PawnToggleButtonInactive); } }