private void HighlightAnimals() { Lord lord = base.SelPawn.GetLord(); for (int i = 0; i < lord.ownedPawns.Count; i++) { if (lord.ownedPawns[i].RaceProps.Animal) { TargetHighlighter.Highlight(lord.ownedPawns[i], true, true, false); } } }
public override void TabUpdate() { base.TabUpdate(); if (base.SelPawn != null && base.SelPawn.GetLord() != null) { Lord lord = base.SelPawn.GetLord(); for (int i = 0; i < lord.ownedPawns.Count; i++) { TargetHighlighter.Highlight(lord.ownedPawns[i], false, false, true); } } }
private void HighlightPrisoners() { Lord lord = base.SelPawn.GetLord(); for (int i = 0; i < lord.ownedPawns.Count; i++) { if (lord.ownedPawns[i].IsPrisoner) { TargetHighlighter.Highlight(lord.ownedPawns[i], true, true, false); } } }
private void HighlightColonists() { Lord lord = base.SelPawn.GetLord(); for (int i = 0; i < lord.ownedPawns.Count; i++) { if (lord.ownedPawns[i].IsFreeColonist) { TargetHighlighter.Highlight(lord.ownedPawns[i], true, true, false); } } }
public override void TabUpdate() { base.TabUpdate(); if (base.SelPawn != null && base.SelPawn.GetLord() != null) { Lord lord = base.SelPawn.GetLord(); for (int i = 0; i < lord.ownedPawns.Count; i++) { TargetHighlighter.Highlight(lord.ownedPawns[i], arrow: false, colonistBar: false, circleOverlay: true); } } }
private void DoThingRow(ThingDef thingDef, int count, List <Thing> things, float width, ref float curY) { Rect rect = new Rect(0f, curY, width, 28f); if (things.Count == 1) { Widgets.InfoCardButton(rect.width - 24f, curY, things[0]); } else { Widgets.InfoCardButton(rect.width - 24f, curY, thingDef); } rect.width -= 24f; if (Mouse.IsOver(rect)) { GUI.color = ThingHighlightColor; GUI.DrawTexture(rect, TexUI.HighlightTex); } if (thingDef.DrawMatSingle != null && thingDef.DrawMatSingle.mainTexture != null) { Rect rect2 = new Rect(4f, curY, 28f, 28f); if (things.Count == 1) { Widgets.ThingIcon(rect2, things[0]); } else { Widgets.ThingIcon(rect2, thingDef); } } Text.Anchor = TextAnchor.MiddleLeft; GUI.color = ThingLabelColor; Rect rect3 = new Rect(36f, curY, rect.width - 36f, rect.height); string str = (things.Count != 1) ? GenLabel.ThingLabel(thingDef, null, count).CapitalizeFirst() : things[0].LabelCap; Text.WordWrap = false; Widgets.Label(rect3, str.Truncate(rect3.width)); Text.WordWrap = true; Text.Anchor = TextAnchor.UpperLeft; TooltipHandler.TipRegion(rect, str); if (Widgets.ButtonInvisible(rect)) { SelectLater(things); } if (Mouse.IsOver(rect)) { for (int i = 0; i < things.Count; i++) { TargetHighlighter.Highlight(things[i]); } } curY += 28f; }
private void DoThingRow(ThingDef thingDef, int count, List <Thing> things, float width, ref float curY, Action <int> discardAction) { Rect rect = new Rect(0f, curY, width, 28f); if (count != 1) { Rect butRect = new Rect(rect.x + rect.width - 24f, rect.y + (rect.height - 24f) / 2f, 24f, 24f); if (Widgets.ButtonImage(butRect, CaravanThingsTabUtility.AbandonSpecificCountButtonTex)) { Find.WindowStack.Add(new Dialog_Slider("RemoveSliderText".Translate(thingDef.label), 1, count, discardAction, -2147483648)); } } rect.width -= 24f; Rect butRect2 = new Rect(rect.x + rect.width - 24f, rect.y + (rect.height - 24f) / 2f, 24f, 24f); if (Widgets.ButtonImage(butRect2, CaravanThingsTabUtility.AbandonButtonTex)) { Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("ConfirmRemoveItemDialog".Translate(thingDef.label), delegate { discardAction(count); }, false, null)); } rect.width -= 24f; if (things.Count == 1) { Widgets.InfoCardButton(rect.width - 24f, curY, things[0]); } else { Widgets.InfoCardButton(rect.width - 24f, curY, thingDef); } rect.width -= 24f; if (Mouse.IsOver(rect)) { GUI.color = ITab_TransporterContents.ThingHighlightColor; GUI.DrawTexture(rect, TexUI.HighlightTex); } if (thingDef.DrawMatSingle != null && thingDef.DrawMatSingle.mainTexture != null) { Rect rect2 = new Rect(4f, curY, 28f, 28f); if (things.Count == 1) { Widgets.ThingIcon(rect2, things[0], 1f); } else { Widgets.ThingIcon(rect2, thingDef); } } Text.Anchor = TextAnchor.MiddleLeft; GUI.color = ITab_TransporterContents.ThingLabelColor; Rect rect3 = new Rect(36f, curY, rect.width - 36f, rect.height); string str; if (things.Count == 1) { str = things[0].LabelCap; } else { str = GenLabel.ThingLabel(thingDef, null, count).CapitalizeFirst(); } Text.WordWrap = false; Widgets.Label(rect3, str.Truncate(rect3.width, null)); Text.WordWrap = true; Text.Anchor = TextAnchor.UpperLeft; TooltipHandler.TipRegion(rect, str); if (Widgets.ButtonInvisible(rect, false)) { this.SelectLater(things); } if (Mouse.IsOver(rect)) { for (int i = 0; i < things.Count; i++) { TargetHighlighter.Highlight(things[i], true, true, false); } } curY += 28f; }
public void AlertsReadoutUpdate() { if (Mathf.Max(Find.TickManager.TicksGame, Find.TutorialState.endTick) < 600) { return; } if (Find.Storyteller.def.disableAlerts) { activeAlerts.Clear(); return; } curAlertIndex++; if (curAlertIndex >= 24) { curAlertIndex = 0; } for (int i = curAlertIndex; i < AllAlerts.Count; i += 24) { CheckAddOrRemoveAlert(AllAlerts[i]); } if (Time.frameCount % 20 == 0) { List <Quest> questsListForReading = Find.QuestManager.QuestsListForReading; for (int j = 0; j < questsListForReading.Count; j++) { List <QuestPart> partsListForReading = questsListForReading[j].PartsListForReading; for (int k = 0; k < partsListForReading.Count; k++) { QuestPartActivable questPartActivable = partsListForReading[k] as QuestPartActivable; if (questPartActivable == null) { continue; } Alert cachedAlert = questPartActivable.CachedAlert; if (cachedAlert != null) { bool flag = questsListForReading[j].State != QuestState.Ongoing || questPartActivable.State != QuestPartState.Enabled; bool alertDirty = questPartActivable.AlertDirty; CheckAddOrRemoveAlert(cachedAlert, flag | alertDirty); if (alertDirty) { questPartActivable.ClearCachedAlert(); } } } } } for (int num = activeAlerts.Count - 1; num >= 0; num--) { Alert alert = activeAlerts[num]; try { activeAlerts[num].AlertActiveUpdate(); } catch (Exception ex) { Log.ErrorOnce("Exception updating alert " + alert.ToString() + ": " + ex.ToString(), 743575); activeAlerts.RemoveAt(num); } } if (mouseoverAlertIndex >= 0 && mouseoverAlertIndex < activeAlerts.Count) { IEnumerable <GlobalTargetInfo> allCulprits = activeAlerts[mouseoverAlertIndex].GetReport().AllCulprits; if (allCulprits != null) { foreach (GlobalTargetInfo item in allCulprits) { TargetHighlighter.Highlight(item); } } } mouseoverAlertIndex = -1; }
public void AlertsReadoutUpdate() { if (Mathf.Max(Find.TickManager.TicksGame, Find.TutorialState.endTick) >= 600) { if (Find.Storyteller.def.disableAlerts) { activeAlerts.Clear(); } else { curAlertIndex++; if (curAlertIndex >= AlertCycleLength) { curAlertIndex = 0; } for (int i = curAlertIndex; i < AllAlerts.Count; i += AlertCycleLength) { Alert alert = AllAlerts[i]; try { if (alert.Active) { if (!activeAlerts.Contains(alert)) { activeAlerts.Add(alert); alert.Notify_Started(); } } else { for (int j = 0; j < activeAlerts.Count; j++) { if (activeAlerts[j] == alert) { activeAlerts.RemoveAt(j); break; } } } } catch (Exception ex) { Log.ErrorOnce("Exception processing alert " + alert.ToString() + ": " + ex.ToString(), 743575); if (activeAlerts.Contains(alert)) { activeAlerts.Remove(alert); } } } for (int num = activeAlerts.Count - 1; num >= 0; num--) { Alert alert2 = activeAlerts[num]; try { activeAlerts[num].AlertActiveUpdate(); } catch (Exception ex2) { Log.ErrorOnce("Exception updating alert " + alert2.ToString() + ": " + ex2.ToString(), 743575); activeAlerts.RemoveAt(num); } } if (mouseoverAlertIndex >= 0 && mouseoverAlertIndex < activeAlerts.Count) { AlertReport report = activeAlerts[mouseoverAlertIndex].GetReport(); IEnumerable <GlobalTargetInfo> culprits = report.culprits; if (culprits != null) { foreach (GlobalTargetInfo item in culprits) { TargetHighlighter.Highlight(item); } } } mouseoverAlertIndex = -1; } } }
public void AlertsReadoutUpdate() { if (Mathf.Max(Find.TickManager.TicksGame, Find.TutorialState.endTick) >= 600) { if (Find.Storyteller.def.disableAlerts) { this.activeAlerts.Clear(); } else { this.curAlertIndex++; if (this.curAlertIndex >= AlertsReadout.AlertCycleLength) { this.curAlertIndex = 0; } for (int i = this.curAlertIndex; i < this.AllAlerts.Count; i += AlertsReadout.AlertCycleLength) { Alert alert = this.AllAlerts[i]; try { if (alert.Active) { if (!this.activeAlerts.Contains(alert)) { this.activeAlerts.Add(alert); alert.Notify_Started(); } } else { for (int j = 0; j < this.activeAlerts.Count; j++) { if (this.activeAlerts[j] == alert) { this.activeAlerts.RemoveAt(j); break; } } } } catch (Exception ex) { Log.ErrorOnce("Exception processing alert " + alert.ToString() + ": " + ex.ToString(), 743575, false); if (this.activeAlerts.Contains(alert)) { this.activeAlerts.Remove(alert); } } } for (int k = this.activeAlerts.Count - 1; k >= 0; k--) { Alert alert2 = this.activeAlerts[k]; try { this.activeAlerts[k].AlertActiveUpdate(); } catch (Exception ex2) { Log.ErrorOnce("Exception updating alert " + alert2.ToString() + ": " + ex2.ToString(), 743575, false); this.activeAlerts.RemoveAt(k); } } if (this.mouseoverAlertIndex >= 0 && this.mouseoverAlertIndex < this.activeAlerts.Count) { IEnumerable <GlobalTargetInfo> culprits = this.activeAlerts[this.mouseoverAlertIndex].GetReport().culprits; if (culprits != null) { foreach (GlobalTargetInfo target in culprits) { TargetHighlighter.Highlight(target, true, true, false); } } } this.mouseoverAlertIndex = -1; } } }