public static void SetCustomColor(this UIColorRefTracker color_tracker, UIColor uicolor, Color color)
 {
     color_tracker.SetUIColor(uicolor);
     if (uicolor == UIColor.Custom)
     {
         color_tracker.OverrideWithColor(color);
     }
 }
        static bool Prefix(SGDifficultyIndicatorWidget __instance, List <UIColorRefTracker> ___pips, UIColor ___activeColor, ref int difficulty)
        {
            Traverse difficultySetter = Traverse.Create(__instance).Property("Difficulty");

            difficultySetter.SetValue(difficulty);
            __instance.Reset();
            float f = ((float)(difficulty) % 10) / 2f;

            if (!DCECore.settings.useDiffRungs)
            {
                f = Mathf.Min((float)difficulty / 2f, 5f);
            }
            else
            {
                if ((difficulty % 10) == 0 && difficulty != 0)
                {
                    f = 5f;
                }
            }

            int   index;
            Color color;
            bool  customColor = DCECore.settings.getRungColor(Math.Max((difficulty - 1) / 10, 0), out color);

            for (index = 0; index < Mathf.FloorToInt(f); ++index)
            {
                UIColorRefTracker pip = ___pips[index];
                pip.GetComponent <SVGImage>().fillAmount = 1f;

                if (customColor)
                {
                    pip.SetUIColor(UIColor.Custom);
                    pip.OverrideWithColor(color);
                }
                else
                {
                    pip.SetUIColor(___activeColor);
                }
            }
            if ((double)index >= (double)f)
            {
                return(false);
            }
            UIColorRefTracker pip1      = ___pips[index];
            SVGImage          component = pip1.GetComponent <SVGImage>();

            if (customColor)
            {
                pip1.SetUIColor(UIColor.Custom);
                pip1.OverrideWithColor(color);
            }
            else
            {
                pip1.SetUIColor(___activeColor);
            }
            component.fillAmount = f - (float)index;
            return(false);
        }
Esempio n. 3
0
 public static void Postfix(LanceMechEquipmentListItem __instance, MechComponentDef MechDef, UIColorRefTracker ___backgroundColor)
 {
     try
     {
         if (HasOverrideColor(MechDef, out Color overrideColor)) // @ToDo: Respect damage level? See "LanceMechEquipmentList.SetLoadout()"
         {
             ___backgroundColor.OverrideWithColor(overrideColor);
         }
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
 }
Esempio n. 4
0
 public static void Postfix(MechLabItemSlotElement __instance, UIColorRefTracker ___backgroundColor)
 {
     try
     {
         if (HasOverrideColor(__instance.ComponentRef.Def, out Color overrideColor))
         {
             ___backgroundColor.OverrideWithColor(overrideColor);
         }
     }
     catch (Exception e)
     {
         Logger.Error(e);
     }
 }
Esempio n. 5
0
 public static void SetColor(this UIColorRefTracker color_tracker, MechComponentRef cref)
 {
     if (cref.Is <IColorComponent>(out var color))
     {
         color_tracker.SetUIColor(color.UIColor);
         if (color.UIColor == UIColor.Custom)
         {
             color_tracker.OverrideWithColor(color.RGBColor);
         }
     }
     else
     {
         color_tracker.SetUIColor(MechComponentRef.GetUIColor(cref));
     }
 }