public static void DrawSkillBoxFor(float x, float y, Pawn p, SkillDef skillDef, bool incapableBecauseOfCapacities) { Rect rect = new Rect(x, y, 50f, 25f); if (incapableBecauseOfCapacities) { GUI.color = new Color(1f, 0.3f, 0.3f); } DrawWorkBoxBackground(rect, p, skillDef); GUI.color = Color.white; int skillLevel = p.skills.GetSkill(skillDef).Level; if (skillLevel > 0) { Text.Anchor = TextAnchor.MiddleCenter; GUI.color = WidgetsWork.ColorOfPriority((int)(((float)skillLevel) / 5.0f)); Widgets.Label(rect.ContractedBy(-3f), skillLevel.ToStringCached()); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; } if (Event.current.type != 0 || !Mouse.IsOver(rect)) { return; } if (Event.current.button == 0) { p.skills.GetSkill(skillDef).Level++; } if (Event.current.button == 1) { p.skills.GetSkill(skillDef).Level--; } Event.current.Use(); }
private void DrawPawnWorkPriority(ref float curY, float width, WorkTypeDef workTypeDef, Priority priority) { try { if (PawnForWork.Dead || PawnForWork.workSettings == null || !PawnForWork.workSettings.EverWork) { return; } int p = priority.ToGamePriority(); if (!Prefs.DevMode && this.PawnForWork.GetDisabledWorkTypes(true).Contains(workTypeDef)) { return; } GUI.color = Color.white; Text.Font = GameFont.Small; string t = priority.GetTip(); Func <string> textGetter = delegate() { return(t); }; Rect rect = new Rect(10f, curY, width - 10f, 20f); if (Mouse.IsOver(rect)) { GUI.color = highlightColor; GUI.DrawTexture(rect, TexUI.HighlightTex); TooltipHandler.TipRegion(rect, new TipSignal(textGetter, PawnForWork.thingIDNumber ^ (int)workTypeDef.index)); } GUI.color = WidgetsWork.ColorOfPriority(p); Text.Anchor = TextAnchor.MiddleLeft; Widgets.Label(rect, workTypeDef.pawnLabel); if (p == 0) { GUI.color = new Color(1f, 0f, 0f, 0.5f); Widgets.DrawLineHorizontal(0f, rect.center.y, rect.width); } } catch { Logger.Message("could not draw pawn work priority"); } curY += 20f; }
public string GetTip() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(workTypeDef.description); if (!this.disabled) { int p = this.ToGamePriority(); string str = string.Format("Priority{0}", p).Translate(); string text = str.Colorize(WidgetsWork.ColorOfPriority(p)); stringBuilder.AppendLine(text); stringBuilder.AppendLine("------------------------------"); } foreach (string adj in this.adjustmentStrings) { stringBuilder.AppendLine(adj); } return(stringBuilder.ToString()); }
private static Color ColorOfPriority(int priority) { return(WidgetsWork.ColorOfPriority(priority)); }