Exemple #1
0
            public static bool Prefix(CombatHUDFloatieStack __instance, ref Color __result, FloatieMessage.MessageNature nature)
            {
                try
                {
                    if (nature == FloatieMessage.MessageNature.PilotInjury && OverrideFloatiePilotDamage)
                    {
                        Logger.Debug($"[CombatHUDFloatieStack_AddFloatie_PREFIX] OVERRIDING color for FloatieMessage.MessageNature.PilotInjury");
                        __result = OverrideFloatiePilotDamageColor;

                        return(false);
                    }

                    if (nature == FloatieMessage.MessageNature.Inspiration)
                    {
                        Logger.Debug($"[CombatHUDFloatieStack_AddFloatie_PREFIX] OVERRIDING color for FloatieMessage.MessageNature.Inspiration");
                        __result = LazySingletonBehavior <UIManager> .Instance.UILookAndColorConstants.PilotInspired.color;

                        return(false);
                    }

                    return(true);
                }
                catch (Exception e)
                {
                    Logger.Error(e);

                    return(true);
                }
            }
Exemple #2
0
 public static void Postfix(CombatHUDFloatieStack __instance, Text text)
 {
     if (modSettings.ColorizeFloaties)
     {
         ColorFloaties.Colorize(__instance);
     }
 }
Exemple #3
0
        internal static void Colorize(CombatHUDFloatieStack __instance)
        {
            try
            {
                // default outline width is zero.  have to plug a dummy value into outline colour though...
                void SetStyle(CombatHUDStatusStackItem floatie, Color32 inner, Color32 outline, float width = 0f)
                {
                    var tmp = Traverse.Create(floatie).Field("Text").GetValue <TextMeshProUGUI>();

                    Traverse.Create(tmp).Method("SetFaceColor", inner).GetValue();
                    Traverse.Create(tmp).Method("SetOutlineColor", outline).GetValue();
                    Traverse.Create(tmp).Method("SetOutlineThickness", width).GetValue();
                }

                var floaties = __instance.gameObject.GetComponentsInChildren <CombatHUDStatusStackItem>();
                foreach (var floatie in floaties)
                {
                    var text = Traverse.Create(floatie).Field("Text").GetValue <TextMeshProUGUI>().text;
                    if (PanicSystem.ejectPhraseList.Any(x => x == text))
                    {
                        SetStyle(floatie, Color.white, Color.red, 0.1f);
                    }
                    else if (text.Contains("IMPROVED TO"))
                    {
                        SetStyle(floatie, Color.white, Color.blue, 0.1f);
                    }
                    else if (text == "PANIC LEVEL CRITICAL!")
                    {
                        SetStyle(floatie, Color.red, Color.yellow, 0.1f);
                    }
                    else if (text == "Panicked")
                    {
                        SetStyle(floatie, Color.red / 1.25f, Color.black);
                    }
                    else if (text == "Stressed")
                    {
                        SetStyle(floatie, Color.yellow / 1.25f, Color.red);
                    }
                    else if (text == "Unsettled")
                    {
                        SetStyle(floatie, Color.gray / 1.35f, Color.black);
                    }
                    // need to do this because the game leaves some ... reused objects maybe??
                    else
                    {
                        SetStyle(floatie, Color.white, Color.black);
                    }
                }
            }
            catch (Exception ex)
            {
                LogDebug(ex);
            }
        }
 public static void Postfix(CombatHUDFloatieStack __instance)
 {
     if (modSettings.ColorizeFloaties)
     {
         try
         {
             ColorFloaties.Colorize(__instance);
         }
         catch (Exception ex)
         {
             LogDebug(ex);
         }
     }
 }
        internal static void Colorize(CombatHUDFloatieStack __instance)
        {
            try
            {
                // default outline width is zero.  have to plug a dummy value into outline colour though...
                void SetStyle(CombatHUDStatusStackItem floatie, Color32 inner, Color32 outline, float width = 0f)
                {
                    var tmp = Traverse.Create(floatie).Field("Text").GetValue <TextMeshProUGUI>();

                    Traverse.Create(tmp).Method("SetFaceColor", inner).GetValue();
                    Traverse.Create(tmp).Method("SetOutlineColor", outline).GetValue();
                    Traverse.Create(tmp).Method("SetOutlineThickness", width).GetValue();
                }

                var floaties = __instance.gameObject.GetComponentsInChildren <CombatHUDStatusStackItem>(true);
                foreach (var floatie in floaties)
                {
                    var text = Traverse.Create(floatie).Field("Text").GetValue <TextMeshProUGUI>().text;
                    if (text.Contains(PanicSystem.modSettings.PanicImprovedString))
                    {
                        SetStyle(floatie, Color.white, Color.blue, 0.1f);
                    }
                    else if (text == PanicSystem.modSettings.PanicCritFailString)
                    {
                        SetStyle(floatie, Color.red, Color.yellow, 0.1f);
                    }
                    else if (text.Contains(PanicSystem.modSettings.PanicStates[3]))
                    {
                        SetStyle(floatie, Color.red / 1.25f, Color.black);
                    }
                    else if (text.Contains(PanicSystem.modSettings.PanicStates[2]))
                    {
                        SetStyle(floatie, Color.yellow / 1.25f, Color.red);
                    }
                    else if (text.Contains(PanicSystem.modSettings.PanicStates[1]))
                    {
                        SetStyle(floatie, Color.gray / 1.35f, Color.black);
                    }
                    // need to do this because the game leaves some ... reused objects maybe??
                    else
                    {
                        SetStyle(floatie, Color.white, Color.black);
                    }
                }
            }
            catch (Exception ex)
            {
                LogDebug(ex);
            }
        }
Exemple #6
0
            public static void Prefix(CombatHUDFloatieStack __instance, Text text, FloatieMessage.MessageNature nature)
            {
                try
                {
                    //Logger.Debug($"[CombatHUDFloatieStack_AddFloatie_PREFIX] text: {text}");
                    //Logger.Debug($"[CombatHUDFloatieStack_AddFloatie_PREFIX] nature: {nature}");

                    if (nature == FloatieMessage.MessageNature.PilotInjury && Miscellaneous.TryGetStressLevelColor(text.ToString(), out Color color))
                    {
                        Logger.Debug($"[CombatHUDFloatieStack_AddFloatie_PREFIX] SET override color for FloatieMessage.MessageNature.PilotInjury");
                        OverrideFloatiePilotDamage      = true;
                        OverrideFloatiePilotDamageColor = color;
                    }
                }
                catch (Exception e)
                {
                    Logger.Error(e);
                }
            }
        public static bool Prefix(
            CombatHUDFloatieStack __instance,
            FloatieMessage message,
            Queue <FloatieMessage> ___msgQueue
            )
        {
            try
            {
                if (CompressFloatieMessagesFeature.CompressFloatieMessages(message, ___msgQueue))
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                Control.Logger.Error.Log(e);
            }

            return(true);
        }