public void ApplyOutOfRange(WeaponRangeIndicators me) { UILookAndColorConstants colorConstants = LazySingletonBehavior <UIManager> .Instance.UILookAndColorConstants; me.MaterialOutOfRange = this.GetMaterial(); colorConstants.LOSOutOfRange.color = me.MaterialOutOfRange.color; }
public static void ReverseNetModifierColour(CombatHUDToolTipGeneric __instance, bool useModifier, int BasicModifier) { try { if (!useModifier) { return; } UILookAndColorConstants con = uiManager.UILookAndColorConstants; __instance.BasicModifier.color = BasicModifier >= 0 ? con.Buff.color : con.DeBuff.color; } catch (Exception ex) { Error(ex); } }
public LosMaterial Apply(WeaponRangeIndicators me, bool IsMultifire) { UILookAndColorConstants colorConstants = LazySingletonBehavior <UIManager> .Instance.UILookAndColorConstants; me.LOSWidthBegin = Width; me.LOSWidthEnd = Width; me.LineTemplate.startWidth = Width; me.LineTemplate.endWidth = Width; me.MaterialInRange = GetMaterial(); colorConstants.LOSLockedTarget.color = (colorConstants.LOSInRange.color = me.MaterialInRange.color); if (IsMultifire) { colorConstants.LOSUnlockedTarget.color = (colorConstants.LOSLockedTarget.color = (colorConstants.LOSMultiTargetKBSelection.color = me.MaterialInRange.color)); UILookAndColorConstants uilookAndColorConstants = colorConstants; uilookAndColorConstants.LOSUnlockedTarget.color.a = uilookAndColorConstants.LOSUnlockedTarget.color.a * 0.8f; } return(this); }
public static void FixRearStructureDisplay(HUDMechArmorReadout __instance, AttackDirection shownAttackDirection) { try { HUDMechArmorReadout me = __instance; float[] timeSinceStructureDamaged = (float[])timeSinceStructureDamagedProp.GetValue(me, null); Color[] structureRear = (Color[])structureRearProp.GetValue(me, null); float flashPeriod = 0f; Color flashColour = Color.black; if (LookAndColor == null) { TryRun(() => LookAndColor = HBS.LazySingletonBehavior <UIManager> .Instance.UILookAndColorConstants); } if (LookAndColor != null) { flashPeriod = LookAndColor.FlashArmorTime; flashColour = LookAndColor.ArmorFlash.color; } Dictionary <ArmorLocation, int> dictionary = null; bool mayDisableParts = shownAttackDirection != AttackDirection.None && me.UseForCalledShots; if (mayDisableParts) { dictionary = HUD.Combat.HitLocation.GetMechHitTable(shownAttackDirection, false); } for (int i = 0; i < 8; i++) { float structureFlash = Mathf.Clamp01(1f - timeSinceStructureDamaged[i] / flashPeriod); Color structureColor = structureRear[i]; // The first line that has typo in original code if (mayDisableParts) { ArmorLocation rearLocation = HUDMechArmorReadout.GetArmorLocationFromIndex(i, true, me.flipRearDisplay); bool isIntact = dictionary.ContainsKey(rearLocation) && dictionary[rearLocation] != 0; if (!isIntact) // And the second typo line { structureColor = Color.Lerp(structureColor, Color.black, me.hiddenColorLerp); } } UIHelpers.SetImageColor(me.StructureRear[i], Color.Lerp(structureColor, flashColour, structureFlash)); } } catch (Exception ex) { Error(ex); } }