Elin Modding Docs Doc
Loading...
Searching...
No Matches
CoreExtension.cs
1using System;
2using UnityEngine;
3
4// Token: 0x02000007 RID: 7
5public static class CoreExtension
6{
7 // Token: 0x0600005F RID: 95 RVA: 0x00003764 File Offset: 0x00001964
8 public static Color GetFixedColor(Color c, bool dark)
9 {
10 SkinColorProfile @default = (dark ? SkinManager.Instance.skinDark.colors : SkinManager.CurrentSkin.colors)._default;
11 float num = 1f + @default.contrast;
12 float num2;
13 if (c.r + c.g + c.b > 1.5f)
14 {
15 num2 = 0.5f + @default.strength;
16 }
17 else
18 {
19 num2 = 0.5f - @default.strength;
20 }
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);
24 return c;
25 }
26
27 // Token: 0x06000060 RID: 96 RVA: 0x00003854 File Offset: 0x00001A54
28 public static string TagColorGoodBad(this string s, Func<bool> funcGood, bool dark = false)
29 {
30 SkinColorProfile @default = (dark ? SkinManager.Instance.skinDark.colors : SkinManager.CurrentSkin.colors)._default;
31 return string.Concat(new string[]
32 {
33 "<color=",
34 CoreExtension.GetFixedColor(funcGood() ? @default.textGood : @default.textBad, dark).ToHex(),
35 ">",
36 s,
37 "</color>"
38 });
39 }
40
41 // Token: 0x06000061 RID: 97 RVA: 0x000038D0 File Offset: 0x00001AD0
42 public static string TagColorGoodBad(this string s, Func<bool> funcGood, Func<bool> funcBad, bool dark = false)
43 {
44 SkinColorProfile @default = (dark ? SkinManager.Instance.skinDark.colors : SkinManager.CurrentSkin.colors)._default;
45 bool flag = funcGood();
46 bool flag2 = funcBad();
47 if (!flag && !flag2)
48 {
49 return s;
50 }
51 return string.Concat(new string[]
52 {
53 "<color=",
54 CoreExtension.GetFixedColor(flag ? @default.textGood : @default.textBad, dark).ToHex(),
55 ">",
56 s,
57 "</color>"
58 });
59 }
60
61 // Token: 0x06000062 RID: 98 RVA: 0x0000395D File Offset: 0x00001B5D
62 public static UICurrency AttachCurrency(this Window window)
63 {
64 return Util.Instantiate<UICurrency>("UI/Util/UICurrency", window.transform);
65 }
66
67 // Token: 0x06000063 RID: 99 RVA: 0x0000396F File Offset: 0x00001B6F
68 public static string TagColor(this string s, FontColor c, SkinColorProfile colors = null)
69 {
70 return s.TagColor((colors ?? SkinManager.CurrentColors).GetTextColor(c));
71 }
72
73 // Token: 0x06000064 RID: 100 RVA: 0x00003988 File Offset: 0x00001B88
74 public static string TagColor(this string text, Func<bool> funcGood, SkinColorProfile colors = null)
75 {
76 SkinColorProfile skinColorProfile = colors ?? SkinManager.CurrentColors;
77 return text.TagColor(funcGood() ? skinColorProfile.textGood : skinColorProfile.textBad);
78 }
79
80 // Token: 0x06000065 RID: 101 RVA: 0x000039BC File Offset: 0x00001BBC
81 public static string TagColor(this string text, Func<bool> funcGood, Func<bool> funcBad, SkinColorProfile colors = null)
82 {
83 SkinColorProfile skinColorProfile = colors ?? SkinManager.CurrentColors;
84 return text.TagColor(funcGood() ? skinColorProfile.textGood : ((funcBad != null && funcBad()) ? skinColorProfile.textBad : skinColorProfile.textDefault));
85 }
86}