Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
CoreExtension Class Reference

Static Public Member Functions

static Color GetFixedColor (Color c, bool dark)
 
static string TagColorGoodBad (this string s, Func< bool > funcGood, bool dark=false)
 
static string TagColorGoodBad (this string s, Func< bool > funcGood, Func< bool > funcBad, bool dark=false)
 
static UICurrency AttachCurrency (this Window window)
 
static string TagColor (this string s, FontColor c, SkinColorProfile colors=null)
 
static string TagColor (this string text, Func< bool > funcGood, SkinColorProfile colors=null)
 
static string TagColor (this string text, Func< bool > funcGood, Func< bool > funcBad, SkinColorProfile colors=null)
 
static void Sort (this List< Thing > things, UIList.SortMode m, bool ascending=false)
 

Detailed Description

Definition at line 5 of file CoreExtension.cs.

Member Function Documentation

◆ AttachCurrency()

static UICurrency CoreExtension.AttachCurrency ( this Window  window)
inlinestatic

Definition at line 37 of file CoreExtension.cs.

38 {
39 return Util.Instantiate<UICurrency>("UI/Util/UICurrency", window.transform);
40 }
Definition: Util.cs:10
static Transform Instantiate(string path, Component parent=null)
Definition: Util.cs:67

References Util.

◆ GetFixedColor()

static Color CoreExtension.GetFixedColor ( Color  c,
bool  dark 
)
inlinestatic

Definition at line 7 of file CoreExtension.cs.

8 {
9 float num = 0.5f;
10 SkinColorProfile @default = (dark ? SkinManager.Instance.skinDark.colors : SkinManager.CurrentSkin.colors)._default;
11 float num2 = 1f + @default.contrast;
12 num = ((!(c.r + c.g + c.b > 1.5f)) ? (0.5f - @default.strength) : (0.5f + @default.strength));
13 c.r = Mathf.Clamp((c.r - 0.5f) * num2 + num, 0f, 1f);
14 c.g = Mathf.Clamp((c.g - 0.5f) * num2 + num, 0f, 1f);
15 c.b = Mathf.Clamp((c.b - 0.5f) * num2 + num, 0f, 1f);
16 return c;
17 }
static SkinRootStatic CurrentSkin
Definition: SkinManager.cs:82
SkinColors colors

References SkinRootStatic.colors, SkinColorProfile.contrast, and SkinManager.CurrentSkin.

Referenced by TagColorGoodBad().

◆ Sort()

static void CoreExtension.Sort ( this List< Thing things,
UIList::SortMode  m,
bool  ascending = false 
)
inlinestatic

Definition at line 59 of file CoreExtension.cs.

60 {
61 foreach (Thing thing in things)
62 {
63 thing.SetSortVal(m);
64 }
65 things.Sort(delegate(Thing a, Thing b)
66 {
67 if (m == UIList.SortMode.ByName)
68 {
69 if (ascending)
70 {
71 return string.Compare(a.GetName(NameStyle.FullNoArticle, 1), b.GetName(NameStyle.FullNoArticle, 1));
72 }
73 return string.Compare(b.GetName(NameStyle.FullNoArticle, 1), a.GetName(NameStyle.FullNoArticle, 1));
74 }
75 if (a.sortVal == b.sortVal)
76 {
77 return b.SecondaryCompare(m, a);
78 }
79 return (!ascending) ? (a.sortVal - b.sortVal) : (b.sortVal - a.sortVal);
80 });
81 }
NameStyle
Definition: NameStyle.cs:2
int sortVal
Definition: Card.cs:97
virtual void SetSortVal(UIList.SortMode m, CurrencyType currency=CurrencyType.Money)
Definition: Card.cs:6857
Definition: Thing.cs:8
override string GetName(NameStyle style, int _num=-1)
Definition: Thing.cs:494
Definition: UIList.cs:9
SortMode
Definition: UIList.cs:27

References Thing.GetName(), Card.SetSortVal(), and Card.sortVal.

◆ TagColor() [1/3]

static string CoreExtension.TagColor ( this string  s,
FontColor  c,
SkinColorProfile  colors = null 
)
inlinestatic

Definition at line 42 of file CoreExtension.cs.

43 {
44 return s.TagColor((colors ?? SkinManager.CurrentColors).GetTextColor(c));
45 }
static SkinColorProfile CurrentColors
Definition: SkinManager.cs:84

References SkinManager.CurrentColors.

◆ TagColor() [2/3]

static string CoreExtension.TagColor ( this string  text,
Func< bool >  funcGood,
Func< bool >  funcBad,
SkinColorProfile  colors = null 
)
inlinestatic

Definition at line 53 of file CoreExtension.cs.

54 {
55 SkinColorProfile skinColorProfile = colors ?? SkinManager.CurrentColors;
56 return text.TagColor(funcGood() ? skinColorProfile.textGood : ((funcBad != null && funcBad()) ? skinColorProfile.textBad : skinColorProfile.textDefault));
57 }

References SkinManager.CurrentColors, SkinColorProfile.textBad, SkinColorProfile.textDefault, and SkinColorProfile.textGood.

◆ TagColor() [3/3]

static string CoreExtension.TagColor ( this string  text,
Func< bool >  funcGood,
SkinColorProfile  colors = null 
)
inlinestatic

Definition at line 47 of file CoreExtension.cs.

48 {
49 SkinColorProfile skinColorProfile = colors ?? SkinManager.CurrentColors;
50 return text.TagColor(funcGood() ? skinColorProfile.textGood : skinColorProfile.textBad);
51 }

References SkinManager.CurrentColors, SkinColorProfile.textBad, and SkinColorProfile.textGood.

◆ TagColorGoodBad() [1/2]

static string CoreExtension.TagColorGoodBad ( this string  s,
Func< bool >  funcGood,
bool  dark = false 
)
inlinestatic

Definition at line 19 of file CoreExtension.cs.

20 {
21 SkinColorProfile @default = (dark ? SkinManager.Instance.skinDark.colors : SkinManager.CurrentSkin.colors)._default;
22 return "<color=" + GetFixedColor(funcGood() ? @default.textGood : @default.textBad, dark).ToHex() + ">" + s + "</color>";
23 }
static Color GetFixedColor(Color c, bool dark)
Definition: CoreExtension.cs:7

References SkinRootStatic.colors, SkinManager.CurrentSkin, and GetFixedColor().

◆ TagColorGoodBad() [2/2]

static string CoreExtension.TagColorGoodBad ( this string  s,
Func< bool >  funcGood,
Func< bool >  funcBad,
bool  dark = false 
)
inlinestatic

Definition at line 25 of file CoreExtension.cs.

26 {
27 SkinColorProfile @default = (dark ? SkinManager.Instance.skinDark.colors : SkinManager.CurrentSkin.colors)._default;
28 bool flag = funcGood();
29 bool flag2 = funcBad();
30 if (!flag && !flag2)
31 {
32 return s;
33 }
34 return "<color=" + GetFixedColor(flag ? @default.textGood : @default.textBad, dark).ToHex() + ">" + s + "</color>";
35 }

References SkinRootStatic.colors, SkinManager.CurrentSkin, and GetFixedColor().


The documentation for this class was generated from the following file: