Exemplo n.º 1
0
        public override void DrawExtraSelectionOverlays()
        {
            base.DrawExtraSelectionOverlays();
            var room = this.GetRoom();

            if (room == null)
            {
                return;
            }
            if (room.isPrisonCell)
            {
                return;
            }

            if (room.RegionCount < 20 && !room.TouchesMapEdge)
            {
                foreach (var current in room.Cells)
                {
                    guestField.Add(current);
                }
                var color = guestFieldColor;
                color.a = Pulser.PulseBrightness(1f, 0.6f);
                GenDraw.DrawFieldEdges(guestField, color);
                guestField.Clear();
            }
        }
Exemplo n.º 2
0
        public override void DrawExtraSelectionOverlays()
        {
            base.DrawExtraSelectionOverlays();
            var room = this.GetRoom();

            if (room == null || room.RegionCount >= 20 || room.TouchesMapEdge)
            {
                return;
            }
            foreach (IntVec3 current in room.Cells)
            {
                prisonField.Add(current);
            }
            var prisonFieldColor = PrisonFieldColor;

            prisonFieldColor.a = Pulser.PulseBrightness(1f, 0.6f);
            GenDraw.DrawFieldEdges(prisonField, prisonFieldColor);
            prisonField.Clear();
        }
Exemplo n.º 3
0
 public override void PostDrawExtraSelectionOverlays()
 {
     foreach (ShipLandingArea landingArea in landingAreas)
     {
         if (landingArea.Active)
         {
             Color color = (landingArea.Clear ? fieldColor : Color.red);
             color.a = Pulser.PulseBrightness(1f, 0.6f);
             GenDraw.DrawFieldEdges(landingArea.MyRect.ToList(), color);
         }
         foreach (CompShipLandingBeacon beacon in landingArea.beacons)
         {
             if (CanLinkTo(beacon))
             {
                 GenDraw.DrawLineBetween(parent.TrueCenter(), beacon.parent.TrueCenter(), SimpleColor.White);
             }
         }
     }
 }
		public void LearningReadoutOnGUI()
		{
			if (!TutorSystem.TutorialMode && TutorSystem.AdaptiveTrainingEnabled && (Find.PlaySettings.showLearningHelper || activeConcepts.Count != 0) && !Find.WindowStack.IsOpen<Screen_Credits>())
			{
				float b = (float)UI.screenHeight / 2f;
				float a = contentHeight + 14f;
				windowRect = new Rect((float)UI.screenWidth - 8f - 200f, 8f, 200f, Mathf.Min(a, b));
				Rect rect = windowRect;
				Find.WindowStack.ImmediateWindow(76136312, windowRect, WindowLayer.Super, windowOnGUICached, doBackground: false);
				float num = Time.realtimeSinceStartup - lastConceptActivateRealTime;
				if (num < 1f && num > 0f)
				{
					GenUI.DrawFlash(rect.x, rect.center.y, (float)UI.screenWidth * 0.6f, Pulser.PulseBrightness(1f, 1f, num) * 0.85f, new Color(0.8f, 0.77f, 0.53f));
				}
				ConceptDef conceptDef = ((selectedConcept != null) ? selectedConcept : mouseoverConcept);
				if (conceptDef != null)
				{
					DrawInfoPane(conceptDef);
					conceptDef.HighlightAllTags();
				}
				mouseoverConcept = null;
			}
		}
        private static void DrawCustomBleedIcon(Rect iconRect, Hediff hediff)
        {
            float bleedRate       = hediff.BleedRate;
            float brightnessPulse = Pulser.PulseBrightness(bleedRate, 0.25f);

            GUI.color = new Color(1f, 1f, 1f, brightnessPulse);

            Texture bleedIcon;

            if (bleedRate <= 0.1)
            {
                bleedIcon = Textures.BleedingIcon_0;
            }
            else if (bleedRate < 0.25)
            {
                bleedIcon = Textures.BleedingIcon_1;
            }
            else if (bleedRate < 0.5)
            {
                bleedIcon = Textures.BleedingIcon_2;
            }
            else if (bleedRate < 1.25)
            {
                bleedIcon = Textures.BleedingIcon_3;
            }
            else if (bleedRate < 2.25)
            {
                bleedIcon = Textures.BleedingIcon_4;
            }
            else
            {
                bleedIcon = Textures.BleedingIcon_5;
            }

            GUI.DrawTexture(iconRect, bleedIcon);
        }
 public void LearningReadoutOnGUI()
 {
     if (!TutorSystem.TutorialMode && TutorSystem.AdaptiveTrainingEnabled)
     {
         if (Find.PlaySettings.showLearningHelper || this.activeConcepts.Count != 0)
         {
             if (!Find.WindowStack.IsOpen <Screen_Credits>())
             {
                 float b        = (float)UI.screenHeight / 2f;
                 float a        = this.contentHeight + 14f;
                 Rect  outRect  = new Rect((float)UI.screenWidth - 8f - 200f, 8f, 200f, Mathf.Min(a, b));
                 Rect  outRect2 = outRect;
                 Find.WindowStack.ImmediateWindow(76136312, outRect, WindowLayer.Super, delegate
                 {
                     outRect       = outRect.AtZero();
                     Rect rect     = outRect.ContractedBy(7f);
                     Rect viewRect = rect.AtZero();
                     bool flag     = this.contentHeight > rect.height;
                     Widgets.DrawWindowBackgroundTutor(outRect);
                     if (flag)
                     {
                         viewRect.height     = this.contentHeight + 40f;
                         viewRect.width     -= 20f;
                         this.scrollPosition = GUI.BeginScrollView(rect, this.scrollPosition, viewRect);
                     }
                     else
                     {
                         GUI.BeginGroup(rect);
                     }
                     float num2 = 0f;
                     Text.Font  = GameFont.Small;
                     Rect rect2 = new Rect(0f, 0f, viewRect.width - 24f, 24f);
                     Widgets.Label(rect2, "LearningHelper".Translate());
                     num2         = rect2.yMax;
                     Rect butRect = new Rect(rect2.xMax, rect2.y, 24f, 24f);
                     if (Widgets.ButtonImage(butRect, this.showAllMode ? TexButton.Minus : TexButton.Plus))
                     {
                         this.showAllMode = !this.showAllMode;
                         if (this.showAllMode)
                         {
                             SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                         }
                         else
                         {
                             SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
                         }
                     }
                     if (this.showAllMode)
                     {
                         Rect rect3        = new Rect(0f, num2, viewRect.width - 20f - 2f, 28f);
                         this.searchString = this.FilterSearchStringInput(Widgets.TextField(rect3, this.searchString));
                         if (this.searchString == "")
                         {
                             GUI.color   = new Color(0.6f, 0.6f, 0.6f, 1f);
                             Text.Anchor = TextAnchor.MiddleLeft;
                             Rect rect4  = rect3;
                             rect4.xMin += 7f;
                             Widgets.Label(rect4, "Filter".Translate() + "...");
                             Text.Anchor = TextAnchor.UpperLeft;
                             GUI.color   = Color.white;
                         }
                         Rect butRect2 = new Rect(viewRect.width - 20f, num2 + 14f - 10f, 20f, 20f);
                         if (Widgets.ButtonImage(butRect2, TexButton.CloseXSmall))
                         {
                             this.searchString = "";
                             SoundDefOf.Tick_Tiny.PlayOneShotOnCamera(null);
                         }
                         num2 = rect3.yMax + 4f;
                     }
                     IEnumerable <ConceptDef> enumerable = this.showAllMode ? DefDatabase <ConceptDef> .AllDefs : this.activeConcepts;
                     if (enumerable.Any <ConceptDef>())
                     {
                         GUI.color = new Color(1f, 1f, 1f, 0.5f);
                         Widgets.DrawLineHorizontal(0f, num2, viewRect.width);
                         GUI.color = Color.white;
                         num2     += 4f;
                     }
                     if (this.showAllMode)
                     {
                         enumerable = from c in enumerable
                                      orderby this.DisplayPriority(c) descending, c.label
                         select c;
                     }
                     foreach (ConceptDef conceptDef2 in enumerable)
                     {
                         if (!conceptDef2.TriggeredDirect)
                         {
                             num2 = this.DrawConceptListRow(0f, num2, viewRect.width, conceptDef2).yMax;
                         }
                     }
                     this.contentHeight = num2;
                     if (flag)
                     {
                         GUI.EndScrollView();
                     }
                     else
                     {
                         GUI.EndGroup();
                     }
                 }, false, false, 1f);
                 float num = Time.realtimeSinceStartup - this.lastConceptActivateRealTime;
                 if (num < 1f && num > 0f)
                 {
                     GenUI.DrawFlash(outRect2.x, outRect2.center.y, (float)UI.screenWidth * 0.6f, Pulser.PulseBrightness(1f, 1f, num) * 0.85f, new Color(0.8f, 0.77f, 0.53f));
                 }
                 ConceptDef conceptDef = (this.selectedConcept == null) ? this.mouseoverConcept : this.selectedConcept;
                 if (conceptDef != null)
                 {
                     this.DrawInfoPane(conceptDef);
                     conceptDef.HighlightAllTags();
                 }
                 this.mouseoverConcept = null;
             }
         }
     }
 }
        private static int DrawSeverityBar(CompactHediffs_Settings settings, Rect barRect, Hediff hediff)
        {
            if (settings.severityBarMode == CompactHediffs_Settings.SeverityBarMode.Off)
            {
                return(0);
            }

            bool showsSeverity = hediff.SeverityLabel != null;

            if (!settings.showHiddenProgressConditions && !showsSeverity)
            {
                return(0);
            }

            float maxSeverity      = GetMaxSeverityForHediff(hediff);
            float severityFraction = (hediff.Severity / maxSeverity);

            if (severityFraction < 0)
            {
                severityFraction = 0;
            }

            var   tendDurationComp = hediff.TryGetComp <HediffComp_TendDuration>();
            var   immunizableComp  = hediff.TryGetComp <HediffComp_Immunizable>();
            bool  hasImmunity      = immunizableComp != null && immunizableComp.Immunity > 0.001f;
            bool  hasSeverity      = severityFraction > 0.001f;
            float immunityFraction = hasImmunity ? immunizableComp.Immunity : 0;


            if (hasImmunity || hasSeverity)
            {
                GUI.color = Color.black;
                GUI.DrawTexture(barRect, Textures.translucentWhite);

                Rect? commonRect         = null;
                Rect? commonRectMirror   = null;
                Color commonColor        = settings.severityBarHighContrast ? Color.white : hediff.LabelColor;
                Rect? severityRect       = null;
                Rect? severityRectMirror = null;
                Color severityColor      = settings.severityBarHighContrast ? Color.red : hediff.LabelColor;
                Rect? immunityRect       = null;
                Rect? immunityRectMirror = null;
                Color immunityColor      = settings.severityBarHighContrast ? BluishGreen : CyanWhite;

                switch (settings.severityBarMode)
                {
                case CompactHediffs_Settings.SeverityBarMode.LeftToRight:
                    commonColor.a = 0.5f;
                    if (immunityFraction > severityFraction)
                    {
                        commonRect   = new Rect(barRect.x, barRect.y, barRect.width * severityFraction, settings.internalBarHeight).Rounded();
                        immunityRect = new Rect(barRect.x + commonRect.Value.width, barRect.y, barRect.width * (immunityFraction - severityFraction), settings.internalBarHeight).Rounded();
                    }
                    else
                    {
                        if (hasImmunity)
                        {
                            commonRect   = new Rect(barRect.x, barRect.y, barRect.width * (severityFraction - (severityFraction - immunityFraction)), settings.internalBarHeight).Rounded();
                            severityRect = new Rect(barRect.x + commonRect.Value.width, barRect.y, barRect.width * (severityFraction - immunityFraction), settings.internalBarHeight).Rounded();
                        }
                        else
                        {
                            commonRect = new Rect(barRect.x, barRect.y, barRect.width * severityFraction, settings.internalBarHeight).Rounded();
                        }
                    }
                    break;

                case CompactHediffs_Settings.SeverityBarMode.EdgeToMiddle:
                {
                    commonRect = new Rect(barRect.x + ((barRect.width / 2f) - 1f), barRect.y, 2f, settings.internalBarHeight).Rounded();
                    if (!settings.severityBarHighContrast)
                    {
                        severityColor.a = 0.75f;
                        immunityColor.a = 0.75f;
                    }
                    if (hasImmunity)
                    {
                        int severityWidth = (int)((barRect.width / 2f) * severityFraction);
                        severityRect = new Rect(barRect.x, barRect.y, severityWidth, settings.internalBarHeight).Rounded();
                        int immunityWidth = (int)((barRect.width / 2f) * immunityFraction);
                        immunityRect = new Rect(barRect.x + (barRect.width - immunityWidth), barRect.y, immunityWidth, settings.internalBarHeight).Rounded();
                    }
                    else
                    {
                        int severityWidth = (int)((barRect.width / 2f) * severityFraction);
                        severityRect       = new Rect(barRect.x, barRect.y, severityWidth, settings.internalBarHeight).Rounded();
                        severityRectMirror = new Rect(barRect.x + (barRect.width - severityWidth), barRect.y, severityWidth, settings.internalBarHeight).Rounded();
                    }
                }
                break;

                case CompactHediffs_Settings.SeverityBarMode.MiddleToEdge:
                {
                    if (!settings.severityBarHighContrast)
                    {
                        severityColor.a = 0.75f;
                        immunityColor.a = 0.75f;
                    }
                    if (hasImmunity)
                    {
                        int severityWidth = (int)((barRect.width / 2f) * severityFraction);
                        severityRect = new Rect(barRect.x + ((barRect.width / 2f) - severityWidth), barRect.y, severityWidth, settings.internalBarHeight).Rounded();
                        int immunityWidth = (int)((barRect.width / 2f) * immunityFraction);
                        immunityRect = new Rect(barRect.x + (barRect.width / 2f), barRect.y, immunityWidth, settings.internalBarHeight).Rounded();
                    }
                    else
                    {
                        int severityWidth = (int)((barRect.width / 2f) * severityFraction);
                        severityRect       = new Rect(barRect.x + ((barRect.width / 2f) - severityWidth), barRect.y, severityWidth, settings.internalBarHeight).Rounded();
                        severityRectMirror = new Rect(barRect.x + (barRect.width / 2f), barRect.y, severityWidth, settings.internalBarHeight).Rounded();
                    }
                }
                break;
                }

                bool canBeTendedNow  = !hediff.IsPermanent() && !hediff.pawn.Dead && hediff.TendableNow(false);
                bool needsTendingNow = canBeTendedNow && tendDurationComp != null && tendDurationComp.tendTicksLeft <= 0;
                if (canBeTendedNow)
                {
                    var alphaMult = needsTendingNow ? Pulser.PulseBrightness(2f, 0.5f) : Pulser.PulseBrightness(1f, 0.5f);
                    commonColor.a   *= alphaMult;
                    severityColor.a *= alphaMult;
                    immunityColor.a *= alphaMult;
                }
                if (!showsSeverity)
                {
                    commonColor.a   *= 0.65f;
                    severityColor.a *= 0.65f;
                    immunityColor.a *= 0.65f;
                }

                if (commonRect.HasValue)
                {
                    GUI.color = commonColor;
                    GUI.DrawTexture(commonRect.Value, TexUI.FastFillTex);
                }
                if (commonRectMirror.HasValue)
                {
                    GUI.color = commonColor;
                    GUI.DrawTexture(commonRectMirror.Value, TexUI.FastFillTex);
                }
                if (severityRect.HasValue)
                {
                    GUI.color = severityColor;
                    GUI.DrawTexture(severityRect.Value, TexUI.FastFillTex);
                }
                if (severityRectMirror.HasValue)
                {
                    GUI.color = severityColor;
                    GUI.DrawTexture(severityRectMirror.Value, TexUI.FastFillTex);
                }
                if (immunityRect.HasValue)
                {
                    GUI.color = immunityColor;
                    GUI.DrawTexture(immunityRect.Value, TexUI.FastFillTex);
                }
                if (immunityRectMirror.HasValue)
                {
                    GUI.color = immunityColor;
                    GUI.DrawTexture(immunityRectMirror.Value, TexUI.FastFillTex);
                }

                GUI.color = Color.white;
                return(settings.internalBarHeight);
            }

            return(0);
        }