5public static class CoreExtension
8 public static Color GetFixedColor(Color c,
bool dark)
10 SkinColorProfile @
default = (dark ? SkinManager.Instance.skinDark.colors : SkinManager.CurrentSkin.colors)._default;
11 float num = 1f + @
default.contrast;
13 if (c.r + c.g + c.b > 1.5f)
15 num2 = 0.5f + @
default.strength;
19 num2 = 0.5f - @
default.strength;
21 c.r = Mathf.Clamp((c.r - 0.5f) * num + num2, 0f, 1f);
22 c.g = Mathf.Clamp((c.g - 0.5f) * num + num2, 0f, 1f);
23 c.b = Mathf.Clamp((c.b - 0.5f) * num + num2, 0f, 1f);
28 public static string TagColorGoodBad(
this string s, Func<bool> funcGood,
bool dark =
false)
30 SkinColorProfile @
default = (dark ? SkinManager.Instance.skinDark.colors : SkinManager.CurrentSkin.colors)._default;
31 return string.Concat(
new string[]
34 CoreExtension.GetFixedColor(funcGood() ? @
default.textGood : @
default.textBad, dark).ToHex(),
42 public static string TagColorGoodBad(
this string s, Func<bool> funcGood, Func<bool> funcBad,
bool dark =
false)
44 SkinColorProfile @
default = (dark ? SkinManager.Instance.skinDark.colors : SkinManager.CurrentSkin.colors)._default;
45 bool flag = funcGood();
46 bool flag2 = funcBad();
51 return string.Concat(
new string[]
54 CoreExtension.GetFixedColor(flag ? @
default.textGood : @
default.textBad, dark).ToHex(),
62 public static UICurrency AttachCurrency(
this Window window)
64 return Util.Instantiate<
UICurrency>(
"UI/Util/UICurrency", window.transform);
68 public static string TagColor(
this string s, FontColor c, SkinColorProfile colors =
null)
70 return s.TagColor((colors ?? SkinManager.CurrentColors).GetTextColor(c));
74 public static string TagColor(
this string text, Func<bool> funcGood, SkinColorProfile colors =
null)
76 SkinColorProfile skinColorProfile = colors ?? SkinManager.CurrentColors;
77 return text.TagColor(funcGood() ? skinColorProfile.textGood : skinColorProfile.textBad);
81 public static string TagColor(
this string text, Func<bool> funcGood, Func<bool> funcBad, SkinColorProfile colors =
null)
83 SkinColorProfile skinColorProfile = colors ?? SkinManager.CurrentColors;
84 return text.TagColor(funcGood() ? skinColorProfile.textGood : ((funcBad !=
null && funcBad()) ? skinColorProfile.textBad : skinColorProfile.textDefault));