// unfortunate how it is not virtual in base class // TODO: create TexButton icons (RW UI textures are internal) public new Rect DoInterface(float x, float y, float width, int index) { Rect rect = new Rect(x, y, width, 53f); float num = 0f; if (!StatusString.NullOrEmpty()) { num = Mathf.Max(17f, StatusLineMinHeight); } rect.height += num; Color color = Color.white; GUI.color = color; Text.Font = GameFont.Small; if (index % 2 == 0) { Widgets.DrawAltRect(rect); } GUI.BeginGroup(rect); Rect rect2 = new Rect(0f, 0f, 24f, 24f); if (expStack.IndexOf(this) > 0) { if (Widgets.ButtonText(rect2, "U")) { expStack.Reorder(this, -1); SoundDefOf.Tick_High.PlayOneShotOnCamera(); } TooltipHandler.TipRegion(rect2, "ReorderBillUpTip".Translate()); } if (expStack.IndexOf(this) < expStack.ListCount - 1) { Rect rect3 = new Rect(0f, 24f, 24f, 24f); if (Widgets.ButtonText(rect3, "D")) { expStack.Reorder(this, 1); SoundDefOf.Tick_Low.PlayOneShotOnCamera(); } TooltipHandler.TipRegion(rect3, "ReorderBillDownTip".Translate()); } Rect rect4 = new Rect(28f, 0f, rect.width - 48f - 20f, 24f); Widgets.Label(rect4, LabelCap); if (uniquePawnDoer != null) { Rect pawnBillDoerRect = new Rect(28f, 20f, rect.width - 48f - 20f, 24f); Widgets.Label(pawnBillDoerRect, "Reserved for: " + uniquePawnDoer.Name.ToString()); } Rect rect5 = new Rect(300f, 0f, 70f, 24f); if (Widgets.ButtonText(rect5, "Delete")) { expStack.Delete(this); SoundDefOf.Click.PlayOneShotOnCamera(); } TooltipHandler.TipRegion(rect5, "DeleteBillTip".Translate()); Rect rect6 = new Rect(300f, 26f, 70f, 24f); //rect6.x -= rect6.width + 4f; if (Widgets.ButtonText(rect6, "Suspend")) { // in RW, setting a bill as suspended will only take effect if you stop the pawn from doing the bill job, // for example, if a pawn is doing a bill and you suspend it, it will keep doing the bill until you manually stop them or they stop themselves. suspended = !suspended; expStack.SetSuspended(this, suspended); } TooltipHandler.TipRegion(rect6, "SuspendBillTip".Translate()); /* if (!StatusString.NullOrEmpty()) * { * Text.Font = GameFont.Tiny; * Rect rect8 = new Rect(24f, rect.height - num, rect.width - 24f, num); * Widgets.Label(rect8, StatusString); * //DoStatusLineInterface(rect8); * }*/ GUI.EndGroup(); if (suspended) { Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.MiddleCenter; Rect rect9 = new Rect(rect.x + rect.width / 2f - 70f, rect.y + rect.height / 2f - 20f, 140f, 40f); GUI.DrawTexture(rect9, TexUI.GrayTextBG); Widgets.Label(rect9, "SuspendedCaps".Translate()); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; } Text.Font = GameFont.Small; GUI.color = Color.white; return(rect); }
public Rect DoInterface(float x, float y, float width, int index) { Rect rect = new Rect(x, y, width, 53f); float num = 0f; if (!StatusString.NullOrEmpty()) { num = Mathf.Max(17f, StatusLineMinHeight); } rect.height += num; Color white = Color.white; if (!ShouldDoNow()) { white = new Color(1f, 0.7f, 0.7f, 0.7f); } GUI.color = white; Text.Font = GameFont.Small; if (index % 2 == 0) { Widgets.DrawAltRect(rect); } GUI.BeginGroup(rect); Rect butRect = new Rect(0f, 0f, 24f, 24f); if (billStack.IndexOf(this) > 0 && Widgets.ButtonImage(butRect, Widgets_Extensions.reorderUpTex, white)) { billStack.Reorder(this, -1); SoundDefOf.TickHigh.PlayOneShotOnCamera(null); } if (billStack.IndexOf(this) < billStack.Count - 1) { Rect butRect2 = new Rect(0f, 24f, 24f, 24f); if (Widgets.ButtonImage(butRect2, Widgets_Extensions.reorderDownTex, white)) { billStack.Reorder(this, 1); SoundDefOf.TickLow.PlayOneShotOnCamera(null); } } Rect rect2 = new Rect(28f, 0f, rect.width - 48f - 20f, rect.height + 5f); Widgets.Label(rect2, LabelCap); DoConfigInterface(rect.AtZero(), white); Rect rect3 = new Rect(rect.width - 24f, 0f, 24f, 24f); if (Widgets.ButtonImage(rect3, Widgets_Extensions.deleteXTex, white)) { billStack.Delete(this); } Rect butRect3 = new Rect(rect3); butRect3.x -= butRect3.width + 4f; if (Widgets.ButtonImage(butRect3, Widgets_Extensions.suspendTex, white)) { suspended = !suspended; } if (!StatusString.NullOrEmpty()) { Text.Font = GameFont.Tiny; Rect rect4 = new Rect(24f, rect.height - num, rect.width - 24f, num); Widgets.Label(rect4, StatusString); DoStatusLineInterface(rect4); } GUI.EndGroup(); if (suspended) { Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.MiddleCenter; Rect rect5 = new Rect(rect.x + rect.width / 2f - 70f, rect.y + rect.height / 2f - 20f, 140f, 40f); GUI.DrawTexture(rect5, TexUI.GrayTextBG); Widgets.Label(rect5, "SuspendedCaps".Translate()); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; } Text.Font = GameFont.Small; GUI.color = Color.white; return(rect); }
public Rect DoInterface(float x, float y, float width, int index) { Rect rect = new Rect(x, y, width, 53f); float num = 0f; if (!StatusString.NullOrEmpty()) { num = Mathf.Max(17f, StatusLineMinHeight); } rect.height += num; Color color = Color.white; if (!ShouldDoNow()) { color = new Color(1f, 0.7f, 0.7f, 0.7f); } GUI.color = color; Text.Font = GameFont.Small; if (index % 2 == 0) { Widgets.DrawAltRect(rect); } GUI.BeginGroup(rect); Rect rect2 = new Rect(0f, 0f, 24f, 24f); if (billStack.IndexOf(this) > 0) { if (Widgets.ButtonImage(rect2, TexButton.ReorderUp, color)) { billStack.Reorder(this, -1); SoundDefOf.Tick_High.PlayOneShotOnCamera(); } TooltipHandler.TipRegionByKey(rect2, "ReorderBillUpTip"); } if (billStack.IndexOf(this) < billStack.Count - 1) { Rect rect3 = new Rect(0f, 24f, 24f, 24f); if (Widgets.ButtonImage(rect3, TexButton.ReorderDown, color)) { billStack.Reorder(this, 1); SoundDefOf.Tick_Low.PlayOneShotOnCamera(); } TooltipHandler.TipRegionByKey(rect3, "ReorderBillDownTip"); } Widgets.Label(new Rect(28f, 0f, rect.width - 48f - 20f, rect.height + 5f), LabelCap); DoConfigInterface(rect.AtZero(), color); Rect rect4 = new Rect(rect.width - 24f, 0f, 24f, 24f); if (Widgets.ButtonImage(rect4, TexButton.DeleteX, color, color * GenUI.SubtleMouseoverColor)) { billStack.Delete(this); SoundDefOf.Click.PlayOneShotOnCamera(); } TooltipHandler.TipRegionByKey(rect4, "DeleteBillTip"); Rect rect5; if (!CanCopy) { rect5 = new Rect(rect4); } else { Rect rect6 = new Rect(rect4); rect6.x -= rect6.width + 4f; if (Widgets.ButtonImageFitted(rect6, TexButton.Copy, color)) { BillUtility.Clipboard = Clone(); SoundDefOf.Tick_High.PlayOneShotOnCamera(); } TooltipHandler.TipRegionByKey(rect6, "CopyBillTip"); rect5 = new Rect(rect6); } rect5.x -= rect5.width + 4f; if (Widgets.ButtonImage(rect5, TexButton.Suspend, color)) { suspended = !suspended; SoundDefOf.Click.PlayOneShotOnCamera(); } TooltipHandler.TipRegionByKey(rect5, "SuspendBillTip"); if (!StatusString.NullOrEmpty()) { Text.Font = GameFont.Tiny; Rect rect7 = new Rect(24f, rect.height - num, rect.width - 24f, num); Widgets.Label(rect7, StatusString); DoStatusLineInterface(rect7); } GUI.EndGroup(); if (suspended) { Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.MiddleCenter; Rect rect8 = new Rect(rect.x + rect.width / 2f - 70f, rect.y + rect.height / 2f - 20f, 140f, 40f); GUI.DrawTexture(rect8, TexUI.GrayTextBG); Widgets.Label(rect8, "SuspendedCaps".Translate()); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; } Text.Font = GameFont.Small; GUI.color = Color.white; return(rect); }
public new Rect DoInterface(float x, float y, float width, int index) { var rect = new Rect(x, y, width, 53f); if (!StatusString.NullOrEmpty()) { rect.height += 17f; } var white = Color.white; if (!ShouldDoNow()) { white = new Color(1f, 0.7f, 0.7f, 0.7f); } GUI.color = white; Text.Font = GameFont.Small; if (index % 2 == 0) { Widgets.DrawAltRect(rect); } GUI.BeginGroup(rect); var butRect = new Rect(0f, 0f, 24f, 24f); if ((billStack.IndexOf(this) > 0) && Widgets.ButtonImage(butRect, TexButton.ReorderUp, white)) { billStack.Reorder(this, -1); SoundDefOf.TickHigh.PlayOneShotOnCamera(); } if (billStack.IndexOf(this) < billStack.Count - 1) { var butRect2 = new Rect(0f, 24f, 24f, 24f); if (Widgets.ButtonImage(butRect2, TexButton.ReorderDown, white)) { billStack.Reorder(this, 1); SoundDefOf.TickLow.PlayOneShotOnCamera(); } } var rect2 = new Rect(28f, 0f, rect.width - 48f - 20f, 48f); // change bill name var iBill = this as IExtendable; Widgets.Label(rect2, iBill != null ? iBill.Name.Truncate(rect.width - 180f) : LabelCap); DoConfigInterface(rect.AtZero(), white); var rect3 = new Rect(rect.width - 24f, 0f, 24f, 24f); if (Widgets.ButtonImage(rect3, TexButton.DeleteX, white)) { billStack.Delete(this); } var butRect3 = new Rect(rect3); butRect3.x -= butRect3.width + 4f; if (Widgets.ButtonImage(butRect3, TexButton.Suspend, white)) { suspended = !suspended; } if (!StatusString.NullOrEmpty()) { Text.Font = GameFont.Tiny; var rect4 = new Rect(24f, rect.height - 17f, rect.width - 24f, 17f); Widgets.Label(rect4, StatusString); } GUI.EndGroup(); if (suspended) { Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.MiddleCenter; var rect5 = new Rect(rect.x + rect.width / 2f - 70f, rect.y + rect.height / 2f - 20f, 140f, 40f); GUI.DrawTexture(rect5, TexUI.GrayTextBG); Widgets.Label(rect5, "SuspendedCaps".Translate()); Text.Anchor = TextAnchor.UpperLeft; Text.Font = GameFont.Small; } Text.Font = GameFont.Small; GUI.color = Color.white; return(rect); }