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); }
static bool Prefix(SGDifficultyIndicatorWidget __instance, int difficulty, List <UIColorRefTracker> ___pips, ref UIColor ___defaultColor, ref UIColor ___activeColor) { difficulty = __instance.Difficulty; __instance.Reset(); int num = new System.Random().Next(0, 100) + 1; float num2 = 0f; if (num > 95 && difficulty >= 3) { num2 = (float)difficulty / 2f - 1f; } if (num <= 95 && num > 65 && difficulty >= 2) { num2 = (float)difficulty / 2f - 0.5f; } if (num <= 65 && num > 40 && difficulty <= 8) { num2 = (float)difficulty / 2f + 0.5f; } if (num <= 40 || difficulty < 2 || difficulty > 8) { num2 = (float)difficulty / 2f; } int i; for (i = 0; i < Mathf.FloorToInt(num2); i++) { UIColorRefTracker uicolorRefTracker = ___pips[i]; uicolorRefTracker.GetComponent <SVGImage>().fillAmount = 1f; uicolorRefTracker.SetUIColor(___activeColor); } if ((float)i < num2) { UIColorRefTracker uicolorRefTracker2 = ___pips[i]; SVGImage component = uicolorRefTracker2.GetComponent <SVGImage>(); uicolorRefTracker2.SetUIColor(___activeColor); component.fillAmount = num2 - (float)i; } return(false); }