Elin Decompiled Documentation EA 23.269 Nightly Patch 2
Loading...
Searching...
No Matches
ClassExtension Class Reference

Static Public Member Functions

static string lang (this string s)
 
static string langPlural (this string s, int i)
 
static string lang (this string s, string ref1, string ref2=null, string ref3=null, string ref4=null, string ref5=null)
 
static string[] langList (this string s)
 
static string langGame (this string s)
 
static string langGame (this string s, string ref1, string ref2=null, string ref3=null, string ref4=null)
 
static string Parentheses (this string str)
 
static string Bracket (this string str, int type=0)
 
static byte[] ToBytes (this BitArray bits)
 
static bool GetBit (this byte pByte, int bitNo)
 
static byte SetBit (this byte pByte, int bitNo, bool value)
 
static int ToInt3 (this float a)
 
static float FromInt3 (this int a)
 
static int ToInt2 (this float a)
 
static float FromInt2 (this int a)
 
static int Minimum (this int i)
 
static bool IsNull (this object o)
 
static bool IsOn (this int data, int digit)
 
static T ToEnum< T > (this int value)
 
static T ToEnum< T > (this long value)
 
static T ToEnum< T > (this string value, bool ignoreCase=true)
 
static Type ToType (this string value)
 
static T NextEnum< T > (this T src)
 
static T PrevEnum< T > (this T src)
 
static bool Within (this int v, int v2, int range)
 
static bool Within (this byte v, byte v2, byte range)
 
static int Clamp (this int v, int min, int max, bool loop=false)
 
static int ClampMin (this int v, int min)
 
static int ClampMax (this int v, int max)
 
static T ToField< T > (this string s, object o)
 
static bool HasField< T > (this object o, string name)
 
static T GetField< T > (this object o, string name)
 
static void SetField< T > (this object o, string name, T value)
 
static T GetProperty< T > (this object o, string name)
 
static void SetProperty< T > (this object o, string name, T value)
 
static void Sort< T > (this IList< T > list, Comparison< T > comparison)
 
static TValue TryGet< TValue > (this IList< TValue > array, int index, int defIndex=-1)
 
static TValue TryGet< TValue > (this IList< TValue > array, int index, bool returnNull)
 
static bool IsEmpty (this Array array)
 
static int IndexOf (this IList< Component > list, GameObject go)
 
static TValue Move< TValue > (this IList< TValue > list, TValue target, int a)
 
static IList< TValue > Copy< TValue > (this IList< TValue > list)
 
static void Each< TValue > (this IList< TValue > list, Action< TValue > action)
 
static IList< TValue > Shuffle< TValue > (this IList< TValue > list)
 
static TValue TryGetValue< TKey, TValue > (this IDictionary< TKey, TValue > source, TKey key, TValue fallback=default(TValue))
 
static TValue TryGetValue< TKey, TValue > (this IDictionary< TKey, TValue > source, TKey key, TKey key_fallback)
 
static TValue GetOrCreate< TKey, TValue > (this IDictionary< TKey, TValue > dict, TKey key, Func< TValue > func=null)
 
static TKey[] CopyKeys< TKey, TValue > (this IDictionary< TKey, TValue > dict)
 
static TValue[] CopyValues< TKey, TValue > (this IDictionary< TKey, TValue > dict)
 
static T RandomItem< T > (this IEnumerable< T > ie)
 
static TValue RandomItem< TKey, TValue > (this IDictionary< TKey, TValue > source)
 
static TValue RandomItem< TValue > (this IList< TValue > source)
 
static TValue RandomItem< TValue > (this IList< TValue > source, TValue exclude)
 
static TValue RandomItem< TValue > (this IList< TValue > source, int exclude)
 
static TValue RandomItem< TValue > (this IList< TValue > source, Func< TValue, bool > funcValid, TValue defaultValue=default(TValue))
 
static TValue RandomItemWeighted< TValue > (this IList< TValue > source, Func< TValue, float > getWeight)
 
static TValue Remainder< TValue > (this IList< TValue > source, int divider)
 
static TValue FirstItem< TKey, TValue > (this IDictionary< TKey, TValue > source)
 
static TValue LastItem< TValue > (this IList< TValue > source)
 
static TValue NextItem< TValue > (this IList< TValue > source, ref int index)
 
static int NextIndex< TValue > (this IList< TValue > source, TValue val)
 
static TValue NextItem< TValue > (this IList< TValue > source, TValue val)
 
static TValue PrevItem< TValue > (this IList< TValue > source, TValue val)
 
static TValue Clamp< TValue > (this IList< TValue > source, int i)
 
static List< T > GetList< T > (this IDictionary source)
 
static void ToDictionary< T > (this IList< UPair< T > > list, ref Dictionary< string, T > dic)
 
static T FindMax< T > (this List< T > list, Func< T, int > func)
 
static void Set< T1, T2 > (this Dictionary< T1, T2 > dic, Dictionary< T1, T2 > from)
 
static int Calc (this string str, int power=0, int ele=0, int p2=0)
 
static int ToInt< T > (this string str)
 
static int ToInt (this string str, Type type)
 
static int ToInt (this string str)
 
static float ToFloat (this string str)
 
static string StripLastPun (this string str)
 
static string StripPun (this string str, bool stripComma, bool insertSpaceForComma=false)
 
static string Repeat (this string str, int count)
 
static string StripBrackets (this string str)
 
static string TryAddExtension (this string s, string ext)
 
static bool IsEmpty (this string str)
 
static string IsEmpty (this string str, string defaultStr)
 
static string TrimNewLines (this string text)
 
static int[] SplitToInts (this string str, char separator)
 
static string[] SplitNewline (this string str)
 
static bool Contains (this string[] strs, string id)
 
static string Evalute (this string[] array, float val)
 
static string ToShortNumber (this int a)
 
static string ToFormat (this int a)
 
static string ToFormat (this long a)
 
static string ToText (this int a, bool skipIfZero=true)
 
static string TagColor (this string s, Color c, string txt)
 
static string TagColor (this string s, Color c)
 
static string TagSize (this string s, string txt, int size)
 
static string TagSize (this string s, int size)
 
static bool HasTag (this string s, string id, char splitter='/')
 
static string SetTag (this string s, string id, bool enable, char splitter='/')
 
static string AddTag (this string s, string id, char splitter='/')
 
static string RemoveTag (this string s, string id, char splitter='/')
 
static string GetFullFileNameWithoutExtension (this FileInfo fileInfo)
 
static string GetFullFileNameWithoutExtension (this string path)
 
static string Pluralize (string s)
 
static string AddArticle (this string s)
 
static string AddArticle (this string s, int num, ArticleStyle style=ArticleStyle.Default, string replace=null)
 
static string ToTitleCase (this string s, bool wholeText=false)
 
static void LoopTail< T > (this List< T > list, bool vertical=false)
 
static void SetNavigation (this Component a, Component b, bool vertical=false)
 
static void LoopSelectable (this List< Selectable > sels, bool vertical=true, bool horizonal=true, bool asGroup=true)
 
static void LoopSelectable (this Transform l, bool vertical=true, bool horizonal=true, bool asGroup=true)
 
static Color ToColor (this string s)
 
static void SetAlpha (this Image c, float a)
 
static void SetAlpha (this RawImage c, float a)
 
static Color SetAlpha (this Color c, float a)
 
static Color Multiply (this Color c, float mtp, float add)
 
static string Tag (this Color c)
 
static string ToHex (this Color c)
 
static void SetOnClick (this Button b, Action action)
 
static void SetListener (this Button.ButtonClickedEvent e, Action action)
 
static void SetAlpha (this Text text, float aloha=1f)
 
static void SetSlider (this Slider slider, float value, Func< float, string > action, bool notify)
 
static void SetSlider (this Slider slider, float value, Func< float, string > action, int min=-1, int max=-1, bool notify=true)
 
static T GetOrCreate< T > (this Component t)
 
static RectTransform Rect (this Component c)
 
static void CopyRect (this RectTransform r, RectTransform t)
 
static void ToggleActive (this Component c)
 
static void SetActive (this Component c, bool enable)
 
static void SetActive (this Component c, bool enable, Action< bool > onChangeState)
 
static Selectable GetSelectable (this GameObject go)
 
static void SetLayerRecursively (this GameObject obj, int layer)
 
static bool IsInteractable (this GameObject obj)
 
static bool IsChildOf (this GameObject c, GameObject root)
 
static bool IsPrefab (this Component c)
 
static T CreateMold< T > (this Component c, string name=null)
 
static Transform Find (this Component c, string name=null)
 
static T Find< T > (this Component c, string name=null, bool recursive=false)
 
static GameObject FindTagInParents (this Component c, string tag, bool includeInactive=true)
 
static T GetComponentInChildrenExcludSelf< T > (this Transform c)
 
static List< T > GetComponentsInDirectChildren< T > (this Transform comp, bool includeInactive=true)
 
static List< T > GetComponentsInDirectChildren< T > (this Component comp, bool includeInactive=true)
 
static T GetComponentInDirectChildren< T > (this Component comp)
 
static void DestroyChildren (this Component component, bool destroyInactive=false, bool ignoreDestroy=true)
 
static bool IsMouseOver (this RectTransform r, Camera cam)
 
static void RebuildLayout (this Component c, bool recursive=false)
 
static void RebuildLayoutTo< T > (this Component c)
 
static void RebuildLayoutTo (this Component c, Component target)
 
static void SetRect (this RectTransform r, float x, float y, float w, float h, float pivotX, float pivotY, float minX, float minY, float maxX, float maxY)
 
static void SetPivot (this RectTransform r, float x, float y)
 
static void SetAnchor (this RectTransform r, float minX, float minY, float maxX, float maxY)
 
static void _SetAnchor (this RectTransform _rect, RectPosition anchor)
 
static void SetAnchor (this RectTransform _rect, RectPosition anchor=RectPosition.Auto)
 
static RectPosition GetAnchor (this RectTransform _rect)
 
static Transform GetLastChild (this Transform trans)
 
static Vector2 ToVector2 (this Vector3 self)
 
static void SetScale (this SpriteRenderer renderer, float size)
 
static void LookAt2D (this Transform self, Transform target, Vector2 forward)
 
static void LookAt2D (this Transform self, Vector3 target, Vector2 forward)
 
static float Distance (this Transform t, Vector2 pos)
 
static Vector3 Plus (this Vector3 v, Vector2 v2)
 
static Vector3 SetZ (this Vector3 v, float a)
 
static Vector3 SetY (this Vector3 v, float a)
 
static Vector3 PlusX (this Vector3 v, float a)
 
static Vector3 PlusY (this Vector3 v, float a)
 
static Vector3 PlusZ (this Vector3 v, float a)
 
static void SetPosition (this Transform transform, float x, float y, float z)
 
static void SetPositionX (this Transform transform, float x)
 
static void SetPositionY (this Transform transform, float y)
 
static void SetPositionZ (this Transform transform, float z)
 
static void AddPosition (this Transform transform, float x, float y, float z)
 
static void AddPositionX (this Transform transform, float x)
 
static void AddPositionY (this Transform transform, float y)
 
static void AddPositionZ (this Transform transform, float z)
 
static void SetLocalPosition (this Transform transform, float x, float y, float z)
 
static void SetLocalPositionX (this Transform transform, float x)
 
static void SetLocalPositionY (this Transform transform, float y)
 
static void SetLocalPositionZ (this Transform transform, float z)
 
static void AddLocalPosition (this Transform transform, float x, float y, float z)
 
static void AddLocalPositionX (this Transform transform, float x)
 
static void AddLocalPositionY (this Transform transform, float y)
 
static void AddLocalPositionZ (this Transform transform, float z)
 
static void SetLocalScale (this Transform transform, float x, float y, float z)
 
static void SetLocalScaleX (this Transform transform, float x)
 
static void SetLocalScaleY (this Transform transform, float y)
 
static void SetLocalScaleZ (this Transform transform, float z)
 
static void AddLocalScale (this Transform transform, float x, float y, float z)
 
static void AddLocalScaleX (this Transform transform, float x)
 
static void AddLocalScaleY (this Transform transform, float y)
 
static void AddLocalScaleZ (this Transform transform, float z)
 
static void SetEulerAngles (this Transform transform, float x, float y, float z)
 
static void SetEulerAnglesX (this Transform transform, float x)
 
static void SetEulerAnglesY (this Transform transform, float y)
 
static void SetEulerAnglesZ (this Transform transform, float z)
 
static void AddEulerAngles (this Transform transform, float x, float y, float z)
 
static void AddEulerAnglesX (this Transform transform, float x)
 
static void AddEulerAnglesY (this Transform transform, float y)
 
static void AddEulerAnglesZ (this Transform transform, float z)
 
static void SetLocalEulerAngles (this Transform transform, float x, float y, float z)
 
static void SetLocalEulerAnglesX (this Transform transform, float x)
 
static void SetLocalEulerAnglesY (this Transform transform, float y)
 
static void SetLocalEulerAnglesZ (this Transform transform, float z)
 
static void AddLocalEulerAngles (this Transform transform, float x, float y, float z)
 
static void AddLocalEulerAnglesX (this Transform transform, float x)
 
static void AddLocalEulerAnglesY (this Transform transform, float y)
 
static void AddLocalEulerAnglesZ (this Transform transform, float z)
 
static void ToggleKeyword (this Material m, string id, bool enable)
 
static void ForeachReverse< T > (this IList< T > items, Action< T > action)
 
static void ForeachReverse< T > (this IList< T > items, Func< T, bool > action)
 
static float ClampAngle (this float angle)
 
static Vector3 Random (this Vector3 v)
 
static T Instantiate< T > (this T s)
 
static int GetRuntimeEventCount (this UnityEventBase unityEvent)
 

Static Public Attributes

static IPluralize pluralizer = new Pluralizer()
 

Static Private Member Functions

static float GetForwardDiffPoint (Vector2 forward)
 

Static Private Attributes

static Vector3 vector3
 

Detailed Description

Definition at line 13 of file ClassExtension.cs.

Member Function Documentation

◆ _SetAnchor()

static void ClassExtension._SetAnchor ( this RectTransform  _rect,
RectPosition  anchor 
)
inlinestatic

Definition at line 1535 of file ClassExtension.cs.

1536 {
1537 switch (anchor)
1538 {
1539 case RectPosition.TopCenter:
1540 _rect.SetAnchor(0.5f, 1f, 0.5f, 1f);
1541 break;
1542 case RectPosition.BottomCenter:
1543 _rect.SetAnchor(0.5f, 0f, 0.5f, 0f);
1544 break;
1545 case RectPosition.TopLEFT:
1546 _rect.SetAnchor(0f, 1f, 0f, 1f);
1547 break;
1548 case RectPosition.TopRIGHT:
1549 _rect.SetAnchor(1f, 1f, 1f, 1f);
1550 break;
1551 case RectPosition.BottomLEFT:
1552 _rect.SetAnchor(0f, 0f, 0f, 0f);
1553 break;
1554 case RectPosition.BottomRIGHT:
1555 _rect.SetAnchor(1f, 0f, 1f, 0f);
1556 break;
1557 case RectPosition.Left:
1558 _rect.SetAnchor(0f, 0.5f, 0f, 0.5f);
1559 break;
1560 case RectPosition.Right:
1561 _rect.SetAnchor(1f, 0.5f, 1f, 0.5f);
1562 break;
1563 default:
1564 _rect.SetAnchor(0.5f, 0.5f, 0.5f, 0.5f);
1565 break;
1566 }
1567 }
RectPosition
Definition: RectPosition.cs:2

◆ AddArticle() [1/2]

static string ClassExtension.AddArticle ( this string  s)
inlinestatic

Definition at line 968 of file ClassExtension.cs.

969 {
970 if (!Lang.setting.addArticle || s.Length < 1)
971 {
972 return s;
973 }
974 char c = s.ToLower()[0];
975 s = ((c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') ? "an " : "a ") + s;
976 return s;
977 }
bool addArticle
Definition: LangSetting.cs:30
Definition: Lang.cs:6
static LangSetting setting
Definition: Lang.cs:54

References LangSetting.addArticle, and Lang.setting.

◆ AddArticle() [2/2]

static string ClassExtension.AddArticle ( this string  s,
int  num,
ArticleStyle  style = ArticleStyle::Default,
string  replace = null 
)
inlinestatic

Definition at line 979 of file ClassExtension.cs.

980 {
981 if (!Lang.setting.addArticle || s.Length < 1)
982 {
983 return s;
984 }
985 char c = s[0];
986 string text = ((num >= 2) ? (num.ToFormat() + " ") : ((c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') ? "an " : "a "));
987 if (num >= 2 && Lang.setting.pluralize)
988 {
989 s = ((replace.IsEmpty() || !s.Contains(replace) || s.Contains("limestone stone")) ? Pluralize(s) : s.Replace(replace, Pluralize(replace)));
990 }
991 return style switch
992 {
993 ArticleStyle.The => "_the".lang().ToTitleCase() + " " + ((num > 1) ? (num + " ") : "") + s,
994 ArticleStyle.None => ((num > 1) ? (num.ToFormat() + " ") : "") + s.ToTitleCase(),
995 _ => text + s,
996 };
997 }
ArticleStyle
Definition: ArticleStyle.cs:2
static string Pluralize(string s)
bool pluralize
Definition: LangSetting.cs:32

References LangSetting.addArticle, Pluralize(), LangSetting.pluralize, and Lang.setting.

◆ AddEulerAngles()

static void ClassExtension.AddEulerAngles ( this Transform  transform,
float  x,
float  y,
float  z 
)
inlinestatic

Definition at line 1861 of file ClassExtension.cs.

1862 {
1863 vector3.Set(transform.eulerAngles.x + x, transform.eulerAngles.y + y, transform.eulerAngles.z + z);
1864 transform.eulerAngles = vector3;
1865 }
static Vector3 vector3

References vector3.

◆ AddEulerAnglesX()

static void ClassExtension.AddEulerAnglesX ( this Transform  transform,
float  x 
)
inlinestatic

Definition at line 1867 of file ClassExtension.cs.

1868 {
1869 vector3.Set(transform.eulerAngles.x + x, transform.eulerAngles.y, transform.eulerAngles.z);
1870 transform.eulerAngles = vector3;
1871 }

References vector3.

◆ AddEulerAnglesY()

static void ClassExtension.AddEulerAnglesY ( this Transform  transform,
float  y 
)
inlinestatic

Definition at line 1873 of file ClassExtension.cs.

1874 {
1875 vector3.Set(transform.eulerAngles.x, transform.eulerAngles.y + y, transform.eulerAngles.z);
1876 transform.eulerAngles = vector3;
1877 }

References vector3.

◆ AddEulerAnglesZ()

static void ClassExtension.AddEulerAnglesZ ( this Transform  transform,
float  z 
)
inlinestatic

Definition at line 1879 of file ClassExtension.cs.

1880 {
1881 vector3.Set(transform.eulerAngles.x, transform.eulerAngles.y, transform.eulerAngles.z + z);
1882 transform.eulerAngles = vector3;
1883 }

References vector3.

◆ AddLocalEulerAngles()

static void ClassExtension.AddLocalEulerAngles ( this Transform  transform,
float  x,
float  y,
float  z 
)
inlinestatic

Definition at line 1909 of file ClassExtension.cs.

1910 {
1911 vector3.Set(transform.localEulerAngles.x + x, transform.localEulerAngles.y + y, transform.localEulerAngles.z + z);
1912 transform.localEulerAngles = vector3;
1913 }

References vector3.

◆ AddLocalEulerAnglesX()

static void ClassExtension.AddLocalEulerAnglesX ( this Transform  transform,
float  x 
)
inlinestatic

Definition at line 1915 of file ClassExtension.cs.

1916 {
1917 vector3.Set(transform.localEulerAngles.x + x, transform.localEulerAngles.y, transform.localEulerAngles.z);
1918 transform.localEulerAngles = vector3;
1919 }

References vector3.

◆ AddLocalEulerAnglesY()

static void ClassExtension.AddLocalEulerAnglesY ( this Transform  transform,
float  y 
)
inlinestatic

Definition at line 1921 of file ClassExtension.cs.

1922 {
1923 vector3.Set(transform.localEulerAngles.x, transform.localEulerAngles.y + y, transform.localEulerAngles.z);
1924 transform.localEulerAngles = vector3;
1925 }

References vector3.

◆ AddLocalEulerAnglesZ()

static void ClassExtension.AddLocalEulerAnglesZ ( this Transform  transform,
float  z 
)
inlinestatic

Definition at line 1927 of file ClassExtension.cs.

1928 {
1929 vector3.Set(transform.localEulerAngles.x, transform.localEulerAngles.y, transform.localEulerAngles.z + z);
1930 transform.localEulerAngles = vector3;
1931 }

References vector3.

◆ AddLocalPosition()

static void ClassExtension.AddLocalPosition ( this Transform  transform,
float  x,
float  y,
float  z 
)
inlinestatic

Definition at line 1765 of file ClassExtension.cs.

1766 {
1767 vector3.Set(transform.localPosition.x + x, transform.localPosition.y + y, transform.localPosition.z + z);
1768 transform.localPosition = vector3;
1769 }

References vector3.

◆ AddLocalPositionX()

static void ClassExtension.AddLocalPositionX ( this Transform  transform,
float  x 
)
inlinestatic

Definition at line 1771 of file ClassExtension.cs.

1772 {
1773 vector3.Set(transform.localPosition.x + x, transform.localPosition.y, transform.localPosition.z);
1774 transform.localPosition = vector3;
1775 }

References vector3.

◆ AddLocalPositionY()

static void ClassExtension.AddLocalPositionY ( this Transform  transform,
float  y 
)
inlinestatic

Definition at line 1777 of file ClassExtension.cs.

1778 {
1779 vector3.Set(transform.localPosition.x, transform.localPosition.y + y, transform.localPosition.z);
1780 transform.localPosition = vector3;
1781 }

References vector3.

◆ AddLocalPositionZ()

static void ClassExtension.AddLocalPositionZ ( this Transform  transform,
float  z 
)
inlinestatic

Definition at line 1783 of file ClassExtension.cs.

1784 {
1785 vector3.Set(transform.localPosition.x, transform.localPosition.y, transform.localPosition.z + z);
1786 transform.localPosition = vector3;
1787 }

References vector3.

◆ AddLocalScale()

static void ClassExtension.AddLocalScale ( this Transform  transform,
float  x,
float  y,
float  z 
)
inlinestatic

Definition at line 1813 of file ClassExtension.cs.

1814 {
1815 vector3.Set(transform.localScale.x + x, transform.localScale.y + y, transform.localScale.z + z);
1816 transform.localScale = vector3;
1817 }

References vector3.

◆ AddLocalScaleX()

static void ClassExtension.AddLocalScaleX ( this Transform  transform,
float  x 
)
inlinestatic

Definition at line 1819 of file ClassExtension.cs.

1820 {
1821 vector3.Set(transform.localScale.x + x, transform.localScale.y, transform.localScale.z);
1822 transform.localScale = vector3;
1823 }

References vector3.

◆ AddLocalScaleY()

static void ClassExtension.AddLocalScaleY ( this Transform  transform,
float  y 
)
inlinestatic

Definition at line 1825 of file ClassExtension.cs.

1826 {
1827 vector3.Set(transform.localScale.x, transform.localScale.y + y, transform.localScale.z);
1828 transform.localScale = vector3;
1829 }

References vector3.

◆ AddLocalScaleZ()

static void ClassExtension.AddLocalScaleZ ( this Transform  transform,
float  z 
)
inlinestatic

Definition at line 1831 of file ClassExtension.cs.

1832 {
1833 vector3.Set(transform.localScale.x, transform.localScale.y, transform.localScale.z + z);
1834 transform.localScale = vector3;
1835 }

References vector3.

◆ AddPosition()

static void ClassExtension.AddPosition ( this Transform  transform,
float  x,
float  y,
float  z 
)
inlinestatic

Definition at line 1717 of file ClassExtension.cs.

1718 {
1719 vector3.Set(transform.position.x + x, transform.position.y + y, transform.position.z + z);
1720 transform.position = vector3;
1721 }

References vector3.

◆ AddPositionX()

static void ClassExtension.AddPositionX ( this Transform  transform,
float  x 
)
inlinestatic

Definition at line 1723 of file ClassExtension.cs.

1724 {
1725 vector3.Set(transform.position.x + x, transform.position.y, transform.position.z);
1726 transform.position = vector3;
1727 }

References vector3.

◆ AddPositionY()

static void ClassExtension.AddPositionY ( this Transform  transform,
float  y 
)
inlinestatic

Definition at line 1729 of file ClassExtension.cs.

1730 {
1731 vector3.Set(transform.position.x, transform.position.y + y, transform.position.z);
1732 transform.position = vector3;
1733 }

References vector3.

◆ AddPositionZ()

static void ClassExtension.AddPositionZ ( this Transform  transform,
float  z 
)
inlinestatic

Definition at line 1735 of file ClassExtension.cs.

1736 {
1737 vector3.Set(transform.position.x, transform.position.y, transform.position.z + z);
1738 transform.position = vector3;
1739 }

References vector3.

◆ AddTag()

static string ClassExtension.AddTag ( this string  s,
string  id,
char  splitter = '/' 
)
inlinestatic

Definition at line 925 of file ClassExtension.cs.

926 {
927 if (!s.HasTag(id, splitter))
928 {
929 s = s + (s.IsEmpty() ? "" : ((object)splitter))?.ToString() + id;
930 }
931 return s;
932 }

◆ Bracket()

static string ClassExtension.Bracket ( this string  str,
int  type = 0 
)
inlinestatic

Definition at line 55 of file ClassExtension.cs.

56 {
57 return type switch
58 {
59 -1 => str,
60 1 => "「" + str + "」",
61 2 => "『" + str + "』",
62 3 => "《" + str + "》",
63 4 => "(" + str + ")",
64 _ => "_bracketLeft".lang() + str + "_bracketRight".lang(),
65 };
66 }

◆ Calc()

static int ClassExtension.Calc ( this string  str,
int  power = 0,
int  ele = 0,
int  p2 = 0 
)
inlinestatic

Definition at line 643 of file ClassExtension.cs.

644 {
645 return Cal.Calcuate(str.Replace("p2", p2.ToString() ?? "").Replace("p", power.ToString() ?? "").Replace("e", ele.ToString() ?? "")
646 .Replace(";", ","));
647 }

◆ Clamp()

static int ClassExtension.Clamp ( this int  v,
int  min,
int  max,
bool  loop = false 
)
inlinestatic

Definition at line 182 of file ClassExtension.cs.

183 {
184 if (v < min)
185 {
186 v = ((!loop) ? min : max);
187 }
188 else if (v > max)
189 {
190 v = ((!loop) ? max : min);
191 }
192 return v;
193 }

◆ Clamp< TValue >()

static TValue ClassExtension.Clamp< TValue > ( this IList< TValue >  source,
int  i 
)
inlinestatic

Definition at line 583 of file ClassExtension.cs.

584 {
585 if (i < 0)
586 {
587 i = 0;
588 }
589 else if (i >= source.Count)
590 {
591 i = source.Count - 1;
592 }
593 return source[i];
594 }

◆ ClampAngle()

static float ClassExtension.ClampAngle ( this float  angle)
inlinestatic

Definition at line 1962 of file ClassExtension.cs.

1963 {
1964 if (angle < 0f)
1965 {
1966 return 360f - (0f - angle) % 360f;
1967 }
1968 return angle % 360f;
1969 }

◆ ClampMax()

static int ClassExtension.ClampMax ( this int  v,
int  max 
)
inlinestatic

Definition at line 204 of file ClassExtension.cs.

205 {
206 if (v <= max)
207 {
208 return v;
209 }
210 return max;
211 }

◆ ClampMin()

static int ClassExtension.ClampMin ( this int  v,
int  min 
)
inlinestatic

Definition at line 195 of file ClassExtension.cs.

196 {
197 if (v >= min)
198 {
199 return v;
200 }
201 return min;
202 }

◆ Contains()

static bool ClassExtension.Contains ( this string[]  strs,
string  id 
)
inlinestatic

Definition at line 798 of file ClassExtension.cs.

799 {
800 if (strs == null || strs.Length == 0)
801 {
802 return false;
803 }
804 for (int i = 0; i < strs.Length; i++)
805 {
806 if (strs[i] == id)
807 {
808 return true;
809 }
810 }
811 return false;
812 }

◆ Copy< TValue >()

static IList< TValue > ClassExtension.Copy< TValue > ( this IList< TValue >  list)
inlinestatic

Definition at line 335 of file ClassExtension.cs.

336 {
337 return list.ToList();
338 }

◆ CopyKeys< TKey, TValue >()

static TKey[] ClassExtension.CopyKeys< TKey, TValue > ( this IDictionary< TKey, TValue >  dict)
inlinestatic

Definition at line 393 of file ClassExtension.cs.

394 {
395 TKey[] array = new TKey[dict.Keys.Count];
396 dict.Keys.CopyTo(array, 0);
397 return array;
398 }

◆ CopyRect()

static void ClassExtension.CopyRect ( this RectTransform  r,
RectTransform  t 
)
inlinestatic

Definition at line 1263 of file ClassExtension.cs.

1264 {
1265 r.pivot = t.pivot;
1266 r.sizeDelta = t.sizeDelta;
1267 r.anchorMin = t.anchorMin;
1268 r.anchorMax = t.anchorMax;
1269 r.anchoredPosition = t.anchoredPosition;
1270 }

◆ CopyValues< TKey, TValue >()

static TValue[] ClassExtension.CopyValues< TKey, TValue > ( this IDictionary< TKey, TValue >  dict)
inlinestatic

Definition at line 400 of file ClassExtension.cs.

401 {
402 TValue[] array = new TValue[dict.Keys.Count];
403 dict.Values.CopyTo(array, 0);
404 return array;
405 }

◆ CreateMold< T >()

static T ClassExtension.CreateMold< T > ( this Component  c,
string  name = null 
)
inlinestatic
Type Constraints
T :Component 

Definition at line 1336 of file ClassExtension.cs.

1336 : Component
1337 {
1338 T result = null;
1339 for (int i = 0; i < c.transform.childCount; i++)
1340 {
1341 T component = c.transform.GetChild(i).GetComponent<T>();
1342 if ((bool)component && (name.IsEmpty() || name == component.name))
1343 {
1344 component.gameObject.SetActive(value: false);
1345 result = component;
1346 break;
1347 }
1348 }
1349 c.DestroyChildren();
1350 return result;
1351 }

◆ DestroyChildren()

static void ClassExtension.DestroyChildren ( this Component  component,
bool  destroyInactive = false,
bool  ignoreDestroy = true 
)
inlinestatic

Definition at line 1458 of file ClassExtension.cs.

1459 {
1460 if (!component || !component.transform)
1461 {
1462 Debug.LogWarning("DestroyChlidren:" + component);
1463 return;
1464 }
1465 for (int num = component.transform.childCount - 1; num >= 0; num--)
1466 {
1467 GameObject gameObject = component.transform.GetChild(num).gameObject;
1468 if ((!ignoreDestroy || !(gameObject.tag == "IgnoreDestroy")) && (destroyInactive || gameObject.activeSelf))
1469 {
1470 UnityEngine.Object.DestroyImmediate(gameObject);
1471 }
1472 }
1473 }

References Debug.

◆ Distance()

static float ClassExtension.Distance ( this Transform  t,
Vector2  pos 
)
inlinestatic

Definition at line 1651 of file ClassExtension.cs.

1652 {
1653 return Vector3.Distance(t.position, pos);
1654 }

◆ Each< TValue >()

static void ClassExtension.Each< TValue > ( this IList< TValue >  list,
Action< TValue >  action 
)
inlinestatic

Definition at line 340 of file ClassExtension.cs.

341 {
342 for (int num = list.Count - 1; num >= 0; num--)
343 {
344 action(list[num]);
345 }
346 }

◆ Evalute()

static string ClassExtension.Evalute ( this string[]  array,
float  val 
)
inlinestatic

Definition at line 814 of file ClassExtension.cs.

815 {
816 return array[(int)Mathf.Clamp((float)(array.Length - 1) * val, 0f, array.Length - 1)];
817 }

◆ Find()

static Transform ClassExtension.Find ( this Component  c,
string  name = null 
)
inlinestatic

Definition at line 1353 of file ClassExtension.cs.

1354 {
1355 return c.Find<Transform>(name);
1356 }

◆ Find< T >()

static T ClassExtension.Find< T > ( this Component  c,
string  name = null,
bool  recursive = false 
)
inlinestatic
Type Constraints
T :Component 

Definition at line 1358 of file ClassExtension.cs.

1358 : Component
1359 {
1360 if (recursive)
1361 {
1362 T[] componentsInChildren = c.transform.GetComponentsInChildren<T>();
1363 foreach (T val in componentsInChildren)
1364 {
1365 if (name == null || name == val.name)
1366 {
1367 return val;
1368 }
1369 }
1370 return null;
1371 }
1372 for (int j = 0; j < c.transform.childCount; j++)
1373 {
1374 T component = c.transform.GetChild(j).GetComponent<T>();
1375 if ((bool)component && (name == null || name == component.name))
1376 {
1377 return component;
1378 }
1379 }
1380 return null;
1381 }

◆ FindMax< T >()

static T ClassExtension.FindMax< T > ( this List< T >  list,
Func< T, int >  func 
)
inlinestatic

Definition at line 618 of file ClassExtension.cs.

619 {
620 int num = int.MinValue;
621 T result = default(T);
622 foreach (T item in list)
623 {
624 int num2 = func(item);
625 if (num2 > num)
626 {
627 num = num2;
628 result = item;
629 }
630 }
631 return result;
632 }

References item.

◆ FindTagInParents()

static GameObject ClassExtension.FindTagInParents ( this Component  c,
string  tag,
bool  includeInactive = true 
)
inlinestatic

Definition at line 1383 of file ClassExtension.cs.

1384 {
1385 Transform transform = c.transform;
1386 for (int i = 0; i < transform.childCount; i++)
1387 {
1388 Transform child = transform.GetChild(i);
1389 if ((includeInactive || child.gameObject.activeSelf) && child.tag == tag)
1390 {
1391 return child.gameObject;
1392 }
1393 }
1394 if ((bool)transform.parent)
1395 {
1396 return transform.parent.FindTagInParents(tag, includeInactive);
1397 }
1398 return null;
1399 }

◆ FirstItem< TKey, TValue >()

static TValue ClassExtension.FirstItem< TKey, TValue > ( this IDictionary< TKey, TValue >  source)
inlinestatic

Definition at line 509 of file ClassExtension.cs.

510 {
511 if (source == null)
512 {
513 return default(TValue);
514 }
515 return source[source.First().Key];
516 }

◆ ForeachReverse< T >() [1/2]

static void ClassExtension.ForeachReverse< T > ( this IList< T >  items,
Action< T >  action 
)
inlinestatic

Definition at line 1945 of file ClassExtension.cs.

1946 {
1947 for (int num = items.Count - 1; num >= 0; num--)
1948 {
1949 action(items[num]);
1950 }
1951 }

◆ ForeachReverse< T >() [2/2]

static void ClassExtension.ForeachReverse< T > ( this IList< T >  items,
Func< T, bool >  action 
)
inlinestatic

Definition at line 1953 of file ClassExtension.cs.

1954 {
1955 int num = items.Count - 1;
1956 while (num >= 0 && !action(items[num]))
1957 {
1958 num--;
1959 }
1960 }

◆ FromInt2()

static float ClassExtension.FromInt2 ( this int  a)
inlinestatic

Definition at line 104 of file ClassExtension.cs.

105 {
106 return (float)a / 100f;
107 }

◆ FromInt3()

static float ClassExtension.FromInt3 ( this int  a)
inlinestatic

Definition at line 94 of file ClassExtension.cs.

95 {
96 return (float)a / 1000f;
97 }

◆ GetAnchor()

static RectPosition ClassExtension.GetAnchor ( this RectTransform  _rect)
inlinestatic

Definition at line 1576 of file ClassExtension.cs.

1577 {
1578 Vector3 position = _rect.position;
1579 int width = Screen.width;
1580 int height = Screen.height;
1581 bool flag = position.y > (float)height * 0.5f;
1582 if (position.x > (float)width * 0.3f && position.x < (float)width * 0.7f)
1583 {
1584 if (position.y > (float)height * 0.3f && position.y < (float)height * 0.7f)
1585 {
1586 return RectPosition.Center;
1587 }
1588 if (!flag)
1589 {
1590 return RectPosition.BottomCenter;
1591 }
1592 return RectPosition.TopCenter;
1593 }
1594 if (position.x < (float)width * 0.5f)
1595 {
1596 if (!flag)
1597 {
1598 return RectPosition.BottomLEFT;
1599 }
1600 return RectPosition.TopLEFT;
1601 }
1602 if (!flag)
1603 {
1604 return RectPosition.BottomRIGHT;
1605 }
1606 return RectPosition.TopRIGHT;
1607 }

◆ GetBit()

static bool ClassExtension.GetBit ( this byte  pByte,
int  bitNo 
)
inlinestatic

Definition at line 75 of file ClassExtension.cs.

76 {
77 return (pByte & (1 << bitNo)) != 0;
78 }

◆ GetComponentInChildrenExcludSelf< T >()

static T ClassExtension.GetComponentInChildrenExcludSelf< T > ( this Transform  c)
inlinestatic
Type Constraints
T :Component 

Definition at line 1401 of file ClassExtension.cs.

1401 : Component
1402 {
1403 for (int i = 0; i < c.childCount; i++)
1404 {
1405 T component = c.GetChild(i).GetComponent<T>();
1406 if ((bool)component)
1407 {
1408 return component;
1409 }
1410 }
1411 return null;
1412 }

◆ GetComponentInDirectChildren< T >()

static T ClassExtension.GetComponentInDirectChildren< T > ( this Component  comp)
inlinestatic
Type Constraints
T :Component 

Definition at line 1444 of file ClassExtension.cs.

1444 : Component
1445 {
1446 Transform transform = comp.transform;
1447 for (int i = 0; i < transform.childCount; i++)
1448 {
1449 T component = transform.GetChild(i).GetComponent<T>();
1450 if ((bool)component)
1451 {
1452 return component;
1453 }
1454 }
1455 return null;
1456 }

◆ GetComponentsInDirectChildren< T >() [1/2]

static List< T > ClassExtension.GetComponentsInDirectChildren< T > ( this Component  comp,
bool  includeInactive = true 
)
inlinestatic
Type Constraints
T :Component 

Definition at line 1429 of file ClassExtension.cs.

1429 : Component
1430 {
1431 List<T> list = new List<T>();
1432 Transform transform = comp.transform;
1433 for (int i = 0; i < transform.childCount; i++)
1434 {
1435 T component = transform.GetChild(i).GetComponent<T>();
1436 if ((bool)component && (includeInactive || component.gameObject.activeInHierarchy))
1437 {
1438 list.Add(component);
1439 }
1440 }
1441 return list;
1442 }

◆ GetComponentsInDirectChildren< T >() [2/2]

static List< T > ClassExtension.GetComponentsInDirectChildren< T > ( this Transform  comp,
bool  includeInactive = true 
)
inlinestatic
Type Constraints
T :Component 

Definition at line 1414 of file ClassExtension.cs.

1414 : Component
1415 {
1416 List<T> list = new List<T>();
1417 Transform transform = comp.transform;
1418 for (int i = 0; i < transform.childCount; i++)
1419 {
1420 T component = transform.GetChild(i).GetComponent<T>();
1421 if ((bool)component && (includeInactive || component.gameObject.activeInHierarchy))
1422 {
1423 list.Add(component);
1424 }
1425 }
1426 return list;
1427 }

◆ GetField< T >()

static T ClassExtension.GetField< T > ( this object  o,
string  name 
)
inlinestatic

Definition at line 228 of file ClassExtension.cs.

229 {
230 return (T)o.GetType().GetField(name).GetValue(o);
231 }

◆ GetForwardDiffPoint()

static float ClassExtension.GetForwardDiffPoint ( Vector2  forward)
inlinestaticprivate

Definition at line 1628 of file ClassExtension.cs.

1629 {
1630 if (object.Equals(forward, Vector2.up))
1631 {
1632 return 90f;
1633 }
1634 object.Equals(forward, Vector2.right);
1635 return 0f;
1636 }

References forward.

Referenced by LookAt2D().

◆ GetFullFileNameWithoutExtension() [1/2]

static string ClassExtension.GetFullFileNameWithoutExtension ( this FileInfo  fileInfo)
inlinestatic

Definition at line 949 of file ClassExtension.cs.

950 {
951 return fileInfo.Directory.FullName + "/" + Path.GetFileNameWithoutExtension(fileInfo.Name);
952 }

◆ GetFullFileNameWithoutExtension() [2/2]

static string ClassExtension.GetFullFileNameWithoutExtension ( this string  path)
inlinestatic

Definition at line 954 of file ClassExtension.cs.

955 {
956 return new FileInfo(path).GetFullFileNameWithoutExtension();
957 }

◆ GetLastChild()

static Transform ClassExtension.GetLastChild ( this Transform  trans)
inlinestatic

Definition at line 1609 of file ClassExtension.cs.

1610 {
1611 return trans.GetChild(trans.childCount - 1);
1612 }

◆ GetList< T >()

static List< T > ClassExtension.GetList< T > ( this IDictionary  source)
inlinestatic

Definition at line 596 of file ClassExtension.cs.

597 {
598 List<T> list = new List<T>();
599 foreach (object value in source.Values)
600 {
601 if (value is T)
602 {
603 list.Add((T)value);
604 }
605 }
606 return list;
607 }

◆ GetOrCreate< T >()

static T ClassExtension.GetOrCreate< T > ( this Component  t)
inlinestatic
Type Constraints
T :Component 

Definition at line 1248 of file ClassExtension.cs.

1248 : Component
1249 {
1250 T val = t.gameObject.GetComponent<T>();
1251 if (!val)
1252 {
1253 val = t.gameObject.AddComponent<T>();
1254 }
1255 return val;
1256 }

◆ GetOrCreate< TKey, TValue >()

static TValue ClassExtension.GetOrCreate< TKey, TValue > ( this IDictionary< TKey, TValue >  dict,
TKey  key,
Func< TValue >  func = null 
)
inlinestatic

Definition at line 382 of file ClassExtension.cs.

383 {
384 TValue val = dict.TryGetValue(key);
385 if (val == null)
386 {
387 val = ((func != null) ? func() : Activator.CreateInstance<TValue>());
388 dict.Add(key, val);
389 }
390 return val;
391 }

◆ GetProperty< T >()

static T ClassExtension.GetProperty< T > ( this object  o,
string  name 
)
inlinestatic

Definition at line 238 of file ClassExtension.cs.

239 {
240 return (T)o.GetType().GetProperty(name).GetValue(o);
241 }

◆ GetRuntimeEventCount()

static int ClassExtension.GetRuntimeEventCount ( this UnityEventBase  unityEvent)
inlinestatic

Definition at line 1984 of file ClassExtension.cs.

1985 {
1986 Type typeFromHandle = typeof(UnityEventBase);
1987 Assembly assembly = Assembly.GetAssembly(typeFromHandle);
1988 Type type = assembly.GetType("UnityEngine.Events.InvokableCallList");
1989 Type type2 = assembly.GetType("UnityEngine.Events.BaseInvokableCall");
1990 Type type3 = typeof(List<>).MakeGenericType(type2);
1991 FieldInfo field = typeFromHandle.GetField("m_Calls", BindingFlags.Instance | BindingFlags.NonPublic);
1992 FieldInfo field2 = type.GetField("m_RuntimeCalls", BindingFlags.Instance | BindingFlags.NonPublic);
1993 object value = field.GetValue(unityEvent);
1994 object value2 = field2.GetValue(value);
1995 return (int)type3.GetProperty("Count").GetValue(value2, null);
1996 }

◆ GetSelectable()

static Selectable ClassExtension.GetSelectable ( this GameObject  go)
inlinestatic

Definition at line 1294 of file ClassExtension.cs.

1295 {
1296 return go.GetComponentInChildren<Selectable>();
1297 }

◆ HasField< T >()

static bool ClassExtension.HasField< T > ( this object  o,
string  name 
)
inlinestatic

Definition at line 218 of file ClassExtension.cs.

219 {
220 FieldInfo field = o.GetType().GetField(name);
221 if (field != null)
222 {
223 return typeof(T).IsAssignableFrom(field.FieldType);
224 }
225 return false;
226 }

◆ HasTag()

static bool ClassExtension.HasTag ( this string  s,
string  id,
char  splitter = '/' 
)
inlinestatic

Definition at line 914 of file ClassExtension.cs.

915 {
916 return s.Split(splitter).Contains(id);
917 }

◆ IndexOf()

static int ClassExtension.IndexOf ( this IList< Component >  list,
GameObject  go 
)
inlinestatic

Definition at line 302 of file ClassExtension.cs.

303 {
304 if (!go)
305 {
306 return -1;
307 }
308 for (int i = 0; i < list.Count; i++)
309 {
310 if (list[i].gameObject == go)
311 {
312 return i;
313 }
314 }
315 return -1;
316 }

◆ Instantiate< T >()

static T ClassExtension.Instantiate< T > ( this T  s)
inlinestatic
Type Constraints
T :ScriptableObject 

Definition at line 1976 of file ClassExtension.cs.

1976 : ScriptableObject
1977 {
1978 string name = s.name;
1979 T val = UnityEngine.Object.Instantiate(s);
1980 val.name = name;
1981 return val;
1982 }

◆ IsChildOf()

static bool ClassExtension.IsChildOf ( this GameObject  c,
GameObject  root 
)
inlinestatic

Definition at line 1318 of file ClassExtension.cs.

1319 {
1320 if (c.transform == root.transform)
1321 {
1322 return true;
1323 }
1324 if ((bool)c.transform.parent)
1325 {
1326 return c.transform.parent.gameObject.IsChildOf(root);
1327 }
1328 return false;
1329 }

◆ IsEmpty() [1/3]

static bool ClassExtension.IsEmpty ( this Array  array)
inlinestatic

Definition at line 293 of file ClassExtension.cs.

294 {
295 if (array != null)
296 {
297 return array.Length == 0;
298 }
299 return true;
300 }

◆ IsEmpty() [2/3]

static bool ClassExtension.IsEmpty ( this string  str)
inlinestatic

Definition at line 755 of file ClassExtension.cs.

756 {
757 if (str != null)
758 {
759 return str == "";
760 }
761 return true;
762 }

◆ IsEmpty() [3/3]

static string ClassExtension.IsEmpty ( this string  str,
string  defaultStr 
)
inlinestatic

Definition at line 764 of file ClassExtension.cs.

765 {
766 if (str != null && !(str == ""))
767 {
768 return str;
769 }
770 return defaultStr;
771 }

◆ IsInteractable()

static bool ClassExtension.IsInteractable ( this GameObject  obj)
inlinestatic

Definition at line 1308 of file ClassExtension.cs.

1309 {
1310 Selectable selectable = (obj ? obj.GetComponent<Selectable>() : null);
1311 if ((bool)selectable)
1312 {
1313 return selectable.interactable;
1314 }
1315 return false;
1316 }

◆ IsMouseOver()

static bool ClassExtension.IsMouseOver ( this RectTransform  r,
Camera  cam 
)
inlinestatic

Definition at line 1475 of file ClassExtension.cs.

1476 {
1477 return RectTransformUtility.RectangleContainsScreenPoint(r, Input.mousePosition, cam);
1478 }

◆ IsNull()

static bool ClassExtension.IsNull ( this object  o)
inlinestatic

Definition at line 122 of file ClassExtension.cs.

123 {
124 return o == null;
125 }

◆ IsOn()

static bool ClassExtension.IsOn ( this int  data,
int  digit 
)
inlinestatic

Definition at line 127 of file ClassExtension.cs.

128 {
129 BitArray32 bitArray = default(BitArray32);
130 bitArray.SetInt(data);
131 return bitArray[digit];
132 }
void SetInt(int i)
Definition: BitArray32.cs:89

References BitArray32.SetInt().

◆ IsPrefab()

static bool ClassExtension.IsPrefab ( this Component  c)
inlinestatic

Definition at line 1331 of file ClassExtension.cs.

1332 {
1333 return c.gameObject.scene.name == null;
1334 }

◆ lang() [1/2]

static string ClassExtension.lang ( this string  s)
inlinestatic

Definition at line 19 of file ClassExtension.cs.

20 {
21 return Lang.Get(s);
22 }
static string Get(string id)
Definition: Lang.cs:91

References Lang.Get().

◆ lang() [2/2]

static string ClassExtension.lang ( this string  s,
string  ref1,
string  ref2 = null,
string  ref3 = null,
string  ref4 = null,
string  ref5 = null 
)
inlinestatic

Definition at line 30 of file ClassExtension.cs.

31 {
32 return Lang.Parse(s, ref1, ref2, ref3, ref4, ref5);
33 }
static string Parse(string idLang, string val1, string val2=null, string val3=null, string val4=null, string val5=null)
Definition: Lang.cs:147

References Lang.Parse().

◆ langGame() [1/2]

static string ClassExtension.langGame ( this string  s)
inlinestatic

Definition at line 40 of file ClassExtension.cs.

41 {
42 return Lang.Game.Get(s);
43 }
static LangGame Game
Definition: Lang.cs:48
string Get(string id)
Definition: SourceLang.cs:12

References Lang.Game, and SourceLang< T >.Get().

◆ langGame() [2/2]

static string ClassExtension.langGame ( this string  s,
string  ref1,
string  ref2 = null,
string  ref3 = null,
string  ref4 = null 
)
inlinestatic

Definition at line 45 of file ClassExtension.cs.

46 {
47 return Lang.Game.Parse(s, ref1, ref2, ref3, ref4);
48 }
string Parse(string idLang, string val1, string val2=null, string val3=null, string val4=null)
Definition: SourceLang.cs:43

References Lang.Game, and SourceLang< T >.Parse().

◆ langList()

static string[] ClassExtension.langList ( this string  s)
inlinestatic

Definition at line 35 of file ClassExtension.cs.

36 {
37 return Lang.GetList(s);
38 }
static string[] GetList(string id)
Definition: Lang.cs:114

References Lang.GetList().

◆ langPlural()

static string ClassExtension.langPlural ( this string  s,
int  i 
)
inlinestatic

Definition at line 24 of file ClassExtension.cs.

25 {
26 string text = Lang.Get(s);
27 return Lang.Parse((i <= 1 || !Lang.setting.pluralize) ? text : pluralizer.Pluralize(text), i.ToString() ?? "");
28 }
static IPluralize pluralizer

References Lang.Get(), Lang.Parse(), LangSetting.pluralize, pluralizer, and Lang.setting.

◆ LastItem< TValue >()

static TValue ClassExtension.LastItem< TValue > ( this IList< TValue >  source)
inlinestatic

Definition at line 518 of file ClassExtension.cs.

519 {
520 if (source.Count != 0)
521 {
522 return source[source.Count - 1];
523 }
524 return default(TValue);
525 }

◆ LookAt2D() [1/2]

static void ClassExtension.LookAt2D ( this Transform  self,
Transform  target,
Vector2  forward 
)
inlinestatic

Definition at line 1638 of file ClassExtension.cs.

1639 {
1640 self.LookAt2D(target.position, forward);
1641 }

References forward.

◆ LookAt2D() [2/2]

static void ClassExtension.LookAt2D ( this Transform  self,
Vector3  target,
Vector2  forward 
)
inlinestatic

Definition at line 1643 of file ClassExtension.cs.

1644 {
1645 float forwardDiffPoint = GetForwardDiffPoint(forward);
1646 Vector3 vector = target - self.position;
1647 float num = Mathf.Atan2(vector.y, vector.x) * 57.29578f;
1648 self.rotation = Quaternion.AngleAxis(num - forwardDiffPoint, Vector3.forward);
1649 }
static float GetForwardDiffPoint(Vector2 forward)

References forward, and GetForwardDiffPoint().

◆ LoopSelectable() [1/2]

static void ClassExtension.LoopSelectable ( this List< Selectable >  sels,
bool  vertical = true,
bool  horizonal = true,
bool  asGroup = true 
)
inlinestatic

Definition at line 1074 of file ClassExtension.cs.

1075 {
1076 for (int i = 0; i < sels.Count; i++)
1077 {
1078 Selectable selectable = sels[i];
1079 Selectable selectable2 = sels[0];
1080 Navigation navigation = selectable.navigation;
1081 if (horizonal)
1082 {
1083 navigation.selectOnRight = ((i + 1 < sels.Count) ? sels[i + 1] : selectable2);
1084 }
1085 if (asGroup)
1086 {
1087 for (int j = i + 1; j < sels.Count; j++)
1088 {
1089 if (sels[j].transform.position.y < selectable.transform.position.y)
1090 {
1091 selectable2 = sels[j];
1092 break;
1093 }
1094 }
1095 }
1096 else
1097 {
1098 selectable2 = ((i + 1 < sels.Count) ? sels[i + 1] : selectable2);
1099 }
1100 if (vertical)
1101 {
1102 navigation.selectOnDown = selectable2;
1103 }
1104 selectable.navigation = navigation;
1105 }
1106 for (int num = sels.Count - 1; num >= 0; num--)
1107 {
1108 Selectable selectable3 = sels[num];
1109 Selectable selectable4 = sels[sels.Count - 1];
1110 Navigation navigation2 = selectable3.navigation;
1111 if (horizonal)
1112 {
1113 navigation2.selectOnLeft = ((num > 0) ? sels[num - 1] : selectable4);
1114 }
1115 if (asGroup)
1116 {
1117 int num2 = sels.Count - 1;
1118 for (int num3 = num - 1; num3 >= 0; num3--)
1119 {
1120 if (sels[num3].transform.position.y > selectable3.transform.position.y)
1121 {
1122 num2 = num3;
1123 break;
1124 }
1125 }
1126 int num4 = num2;
1127 while (num4 >= 0 && !(sels[num4].transform.position.y > sels[num2].transform.position.y))
1128 {
1129 selectable4 = sels[num4];
1130 num4--;
1131 }
1132 }
1133 else
1134 {
1135 selectable4 = ((num > 0) ? sels[num - 1] : selectable4);
1136 }
1137 if (vertical)
1138 {
1139 navigation2.selectOnUp = ((selectable4 == selectable3) ? sels[sels.Count - 1] : selectable4);
1140 }
1141 navigation2.mode = Navigation.Mode.Explicit;
1142 selectable3.navigation = navigation2;
1143 }
1144 }

◆ LoopSelectable() [2/2]

static void ClassExtension.LoopSelectable ( this Transform  l,
bool  vertical = true,
bool  horizonal = true,
bool  asGroup = true 
)
inlinestatic

Definition at line 1146 of file ClassExtension.cs.

1147 {
1148 List<Selectable> list = l.GetComponentsInChildren<Selectable>().ToList();
1149 for (int num = list.Count - 1; num >= 0; num--)
1150 {
1151 if (!list[num].interactable || list[num].navigation.mode == Navigation.Mode.None)
1152 {
1153 list.RemoveAt(num);
1154 }
1155 }
1156 list.LoopSelectable(vertical, horizonal, asGroup);
1157 }

◆ LoopTail< T >()

static void ClassExtension.LoopTail< T > ( this List< T >  list,
bool  vertical = false 
)
inlinestatic
Type Constraints
T :Selectable 

Definition at line 1026 of file ClassExtension.cs.

1026 : Selectable
1027 {
1028 if (list.Count > 1)
1029 {
1030 Navigation navigation = list[0].navigation;
1031 Navigation navigation2 = list[list.Count - 1].navigation;
1032 if (vertical)
1033 {
1034 navigation.selectOnUp = list[list.Count - 1];
1035 navigation2.selectOnDown = list[0];
1036 }
1037 else
1038 {
1039 navigation.selectOnLeft = list[list.Count - 1];
1040 navigation2.selectOnRight = list[0];
1041 }
1042 list[0].navigation = navigation;
1043 list[list.Count - 1].navigation = navigation2;
1044 }
1045 }

◆ Minimum()

static int ClassExtension.Minimum ( this int  i)
inlinestatic

Definition at line 109 of file ClassExtension.cs.

110 {
111 if (i != 0)
112 {
113 if (i <= 0)
114 {
115 return -1;
116 }
117 return 1;
118 }
119 return 0;
120 }

◆ Move< TValue >()

static TValue ClassExtension.Move< TValue > ( this IList< TValue >  list,
TValue  target,
int  a 
)
inlinestatic

Definition at line 318 of file ClassExtension.cs.

319 {
320 int num = list.IndexOf(target);
321 int num2 = num + a;
322 if (num2 < 0)
323 {
324 num2 = list.Count - 1;
325 }
326 if (num2 >= list.Count)
327 {
328 num2 = 0;
329 }
330 list.Remove(target);
331 list.Insert(num2, target);
332 return list[num];
333 }

◆ Multiply()

static Color ClassExtension.Multiply ( this Color  c,
float  mtp,
float  add 
)
inlinestatic

Definition at line 1182 of file ClassExtension.cs.

1183 {
1184 return new Color(c.r * mtp + add, c.g * mtp + add, c.b * mtp + add, c.a);
1185 }

References Color.

◆ NextEnum< T >()

static T ClassExtension.NextEnum< T > ( this T  src)
inlinestatic
Type Constraints
T :struct 

Definition at line 154 of file ClassExtension.cs.

154 : struct
155 {
156 return ((T[])Enum.GetValues(src.GetType())).NextItem(src);
157 }

◆ NextIndex< TValue >()

static int ClassExtension.NextIndex< TValue > ( this IList< TValue >  source,
TValue  val 
)
inlinestatic

Definition at line 541 of file ClassExtension.cs.

542 {
543 if (val == null)
544 {
545 return 0;
546 }
547 int num = source.IndexOf(val) + 1;
548 if (num >= source.Count)
549 {
550 num = 0;
551 }
552 return num;
553 }

◆ NextItem< TValue >() [1/2]

static TValue ClassExtension.NextItem< TValue > ( this IList< TValue >  source,
ref int  index 
)
inlinestatic

Definition at line 527 of file ClassExtension.cs.

528 {
529 index++;
530 if (index >= source.Count)
531 {
532 index = 0;
533 }
534 if (source.Count != 0)
535 {
536 return source[index];
537 }
538 return default(TValue);
539 }

◆ NextItem< TValue >() [2/2]

static TValue ClassExtension.NextItem< TValue > ( this IList< TValue >  source,
TValue  val 
)
inlinestatic

Definition at line 555 of file ClassExtension.cs.

556 {
557 int num = source.IndexOf(val) + 1;
558 if (num >= source.Count)
559 {
560 num = 0;
561 }
562 if (source.Count != 0)
563 {
564 return source[num];
565 }
566 return default(TValue);
567 }

◆ Parentheses()

static string ClassExtension.Parentheses ( this string  str)
inlinestatic

Definition at line 50 of file ClassExtension.cs.

51 {
52 return "(" + str + ")";
53 }

◆ Pluralize()

static string ClassExtension.Pluralize ( string  s)
inlinestatic

Definition at line 959 of file ClassExtension.cs.

960 {
961 if (s == "talisman")
962 {
963 return "talismans";
964 }
965 return pluralizer.Pluralize(s);
966 }

References pluralizer.

Referenced by AddArticle().

◆ Plus()

static Vector3 ClassExtension.Plus ( this Vector3  v,
Vector2  v2 
)
inlinestatic

Definition at line 1656 of file ClassExtension.cs.

1657 {
1658 v.x += v2.x;
1659 v.y += v2.y;
1660 return v;
1661 }

◆ PlusX()

static Vector3 ClassExtension.PlusX ( this Vector3  v,
float  a 
)
inlinestatic

Definition at line 1675 of file ClassExtension.cs.

1676 {
1677 v.x += a;
1678 return v;
1679 }

◆ PlusY()

static Vector3 ClassExtension.PlusY ( this Vector3  v,
float  a 
)
inlinestatic

Definition at line 1681 of file ClassExtension.cs.

1682 {
1683 v.y += a;
1684 return v;
1685 }

◆ PlusZ()

static Vector3 ClassExtension.PlusZ ( this Vector3  v,
float  a 
)
inlinestatic

Definition at line 1687 of file ClassExtension.cs.

1688 {
1689 v.z += a;
1690 return v;
1691 }

◆ PrevEnum< T >()

static T ClassExtension.PrevEnum< T > ( this T  src)
inlinestatic
Type Constraints
T :struct 

Definition at line 159 of file ClassExtension.cs.

159 : struct
160 {
161 return ((T[])Enum.GetValues(src.GetType())).PrevItem(src);
162 }

◆ PrevItem< TValue >()

static TValue ClassExtension.PrevItem< TValue > ( this IList< TValue >  source,
TValue  val 
)
inlinestatic

Definition at line 569 of file ClassExtension.cs.

570 {
571 int num = source.IndexOf(val) - 1;
572 if (num < 0)
573 {
574 num = source.Count - 1;
575 }
576 if (source.Count != 0)
577 {
578 return source[num];
579 }
580 return default(TValue);
581 }

◆ Random()

static Vector3 ClassExtension.Random ( this Vector3  v)
inlinestatic

Definition at line 1971 of file ClassExtension.cs.

1972 {
1973 return new Vector3(Rand.Range(0f - v.x, v.x), Rand.Range(0f - v.y, v.y), Rand.Range(0f - v.z, v.z));
1974 }
Definition: Rand.cs:4
static int Range(int min, int max)
Definition: Rand.cs:42

References Rand.Range().

◆ RandomItem< T >()

static T ClassExtension.RandomItem< T > ( this IEnumerable< T >  ie)
inlinestatic

Definition at line 407 of file ClassExtension.cs.

408 {
409 int num = ie.Count();
410 if (num == 0)
411 {
412 return default(T);
413 }
414 return ie.ElementAt(Rand.rnd(num));
415 }
static int rnd(int max)
Definition: Rand.cs:52

References Rand.rnd().

◆ RandomItem< TKey, TValue >()

static TValue ClassExtension.RandomItem< TKey, TValue > ( this IDictionary< TKey, TValue >  source)
inlinestatic

Definition at line 417 of file ClassExtension.cs.

418 {
419 if (source.Count != 0)
420 {
421 return source.ElementAt(Rand.rnd(source.Count)).Value;
422 }
423 return default(TValue);
424 }

References Rand.rnd().

◆ RandomItem< TValue >() [1/4]

static TValue ClassExtension.RandomItem< TValue > ( this IList< TValue >  source)
inlinestatic

Definition at line 426 of file ClassExtension.cs.

427 {
428 if (source.Count != 0)
429 {
430 return source[Rand.rnd(source.Count)];
431 }
432 return default(TValue);
433 }

References Rand.rnd().

◆ RandomItem< TValue >() [2/4]

static TValue ClassExtension.RandomItem< TValue > ( this IList< TValue >  source,
Func< TValue, bool >  funcValid,
TValue  defaultValue = default(TValue) 
)
inlinestatic

Definition at line 459 of file ClassExtension.cs.

460 {
461 for (int i = 0; i < 100; i++)
462 {
463 TValue val = source[Rand.rnd(source.Count)];
464 if (funcValid(val))
465 {
466 return val;
467 }
468 }
469 return defaultValue;
470 }

References Rand.rnd().

◆ RandomItem< TValue >() [3/4]

static TValue ClassExtension.RandomItem< TValue > ( this IList< TValue >  source,
int  exclude 
)
inlinestatic

Definition at line 440 of file ClassExtension.cs.

441 {
442 if (source.Count > 1)
443 {
444 int num;
445 do
446 {
447 num = Rand.rnd(source.Count);
448 }
449 while (num == exclude);
450 return source[num];
451 }
452 if (source.Count == 1)
453 {
454 return source[0];
455 }
456 return default(TValue);
457 }

References Rand.rnd().

◆ RandomItem< TValue >() [4/4]

static TValue ClassExtension.RandomItem< TValue > ( this IList< TValue >  source,
TValue  exclude 
)
inlinestatic

Definition at line 435 of file ClassExtension.cs.

436 {
437 return source.RandomItem(source.IndexOf(exclude));
438 }

◆ RandomItemWeighted< TValue >()

static TValue ClassExtension.RandomItemWeighted< TValue > ( this IList< TValue >  source,
Func< TValue, float >  getWeight 
)
inlinestatic

Definition at line 472 of file ClassExtension.cs.

473 {
474 if (source.Count == 0)
475 {
476 return default(TValue);
477 }
478 if (source.Count == 1)
479 {
480 return source[0];
481 }
482 float num = 0f;
483 foreach (TValue item in source)
484 {
485 num += getWeight(item);
486 }
487 float num2 = Rand.Range(0f, num);
488 num = 0f;
489 foreach (TValue item2 in source)
490 {
491 num += getWeight(item2);
492 if (num2 < num)
493 {
494 return item2;
495 }
496 }
497 return source.First();
498 }

References item, and Rand.Range().

◆ RebuildLayout()

static void ClassExtension.RebuildLayout ( this Component  c,
bool  recursive = false 
)
inlinestatic

Definition at line 1480 of file ClassExtension.cs.

1481 {
1482 if (recursive)
1483 {
1484 foreach (Transform item in c.transform)
1485 {
1486 if (item is RectTransform)
1487 {
1488 item.RebuildLayout(recursive: true);
1489 }
1490 }
1491 }
1492 LayoutRebuilder.ForceRebuildLayoutImmediate(c.transform as RectTransform);
1493 }

References item.

◆ RebuildLayoutTo()

static void ClassExtension.RebuildLayoutTo ( this Component  c,
Component  target 
)
inlinestatic

Definition at line 1504 of file ClassExtension.cs.

1505 {
1506 c.RebuildLayout();
1507 if (!(c == target) && (bool)c.transform.parent)
1508 {
1509 c.transform.parent.RebuildLayoutTo(target);
1510 }
1511 }

◆ RebuildLayoutTo< T >()

static void ClassExtension.RebuildLayoutTo< T > ( this Component  c)
inlinestatic
Type Constraints
T :Component 

Definition at line 1495 of file ClassExtension.cs.

1495 : Component
1496 {
1497 c.RebuildLayout();
1498 if ((bool)c.transform.parent && !c.transform.parent.GetComponent<T>())
1499 {
1500 c.transform.parent.RebuildLayoutTo<T>();
1501 }
1502 }

◆ Rect()

static RectTransform ClassExtension.Rect ( this Component  c)
inlinestatic

Definition at line 1258 of file ClassExtension.cs.

1259 {
1260 return c.transform as RectTransform;
1261 }

◆ Remainder< TValue >()

static TValue ClassExtension.Remainder< TValue > ( this IList< TValue >  source,
int  divider 
)
inlinestatic

Definition at line 500 of file ClassExtension.cs.

501 {
502 if (source.Count != 0)
503 {
504 return source[divider % source.Count];
505 }
506 return default(TValue);
507 }

◆ RemoveTag()

static string ClassExtension.RemoveTag ( this string  s,
string  id,
char  splitter = '/' 
)
inlinestatic

Definition at line 934 of file ClassExtension.cs.

935 {
936 string[] array = s.Split(splitter);
937 s = "";
938 string[] array2 = array;
939 foreach (string text in array2)
940 {
941 if (!(text == id))
942 {
943 s.AddTag(text, splitter);
944 }
945 }
946 return s;
947 }

◆ Repeat()

static string ClassExtension.Repeat ( this string  str,
int  count 
)
inlinestatic

Definition at line 729 of file ClassExtension.cs.

730 {
731 StringBuilder stringBuilder = new StringBuilder();
732 for (int i = 0; i < Mathf.Abs(count); i++)
733 {
734 stringBuilder.Append(str);
735 }
736 return stringBuilder.ToString();
737 }

◆ Set< T1, T2 >()

static void ClassExtension.Set< T1, T2 > ( this Dictionary< T1, T2 >  dic,
Dictionary< T1, T2 >  from 
)
inlinestatic

Definition at line 634 of file ClassExtension.cs.

635 {
636 dic.Clear();
637 foreach (KeyValuePair<T1, T2> item in from)
638 {
639 dic[item.Key] = item.Value;
640 }
641 }

References item.

◆ SetActive() [1/2]

static void ClassExtension.SetActive ( this Component  c,
bool  enable 
)
inlinestatic

Definition at line 1277 of file ClassExtension.cs.

1278 {
1279 if (c.gameObject.activeSelf != enable)
1280 {
1281 c.gameObject.SetActive(enable);
1282 }
1283 }

Referenced by ContentQuest.RefreshTrackButtons().

◆ SetActive() [2/2]

static void ClassExtension.SetActive ( this Component  c,
bool  enable,
Action< bool >  onChangeState 
)
inlinestatic

Definition at line 1285 of file ClassExtension.cs.

1286 {
1287 if (c.gameObject.activeSelf != enable)
1288 {
1289 c.gameObject.SetActive(enable);
1290 onChangeState(enable);
1291 }
1292 }

◆ SetAlpha() [1/4]

static Color ClassExtension.SetAlpha ( this Color  c,
float  a 
)
inlinestatic

Definition at line 1176 of file ClassExtension.cs.

1177 {
1178 c.a = a;
1179 return c;
1180 }

◆ SetAlpha() [2/4]

static void ClassExtension.SetAlpha ( this Image  c,
float  a 
)
inlinestatic

Definition at line 1166 of file ClassExtension.cs.

1167 {
1168 c.color = new Color(c.color.r, c.color.g, c.color.b, a);
1169 }

References Color.

◆ SetAlpha() [3/4]

static void ClassExtension.SetAlpha ( this RawImage  c,
float  a 
)
inlinestatic

Definition at line 1171 of file ClassExtension.cs.

1172 {
1173 c.color = new Color(c.color.r, c.color.g, c.color.b, a);
1174 }

References Color.

◆ SetAlpha() [4/4]

static void ClassExtension.SetAlpha ( this Text  text,
float  aloha = 1f 
)
inlinestatic

Definition at line 1215 of file ClassExtension.cs.

1216 {
1217 text.color = new Color(text.color.r, text.color.g, text.color.b, aloha);
1218 }

References Color.

◆ SetAnchor() [1/2]

static void ClassExtension.SetAnchor ( this RectTransform  _rect,
RectPosition  anchor = RectPosition::Auto 
)
inlinestatic

Definition at line 1569 of file ClassExtension.cs.

1570 {
1571 Vector3 position = _rect.position;
1572 _rect._SetAnchor((anchor == RectPosition.Auto) ? _rect.GetAnchor() : anchor);
1573 _rect.position = position;
1574 }

◆ SetAnchor() [2/2]

static void ClassExtension.SetAnchor ( this RectTransform  r,
float  minX,
float  minY,
float  maxX,
float  maxY 
)
inlinestatic

Definition at line 1529 of file ClassExtension.cs.

1530 {
1531 r.anchorMin = new Vector2(minX, minY);
1532 r.anchorMax = new Vector2(maxX, maxY);
1533 }

◆ SetBit()

static byte ClassExtension.SetBit ( this byte  pByte,
int  bitNo,
bool  value 
)
inlinestatic

Definition at line 80 of file ClassExtension.cs.

81 {
82 if (!value)
83 {
84 return Convert.ToByte(pByte & ~(1 << bitNo));
85 }
86 return Convert.ToByte(pByte | (1 << bitNo));
87 }

◆ SetEulerAngles()

static void ClassExtension.SetEulerAngles ( this Transform  transform,
float  x,
float  y,
float  z 
)
inlinestatic

Definition at line 1837 of file ClassExtension.cs.

1838 {
1839 vector3.Set(x, y, z);
1840 transform.eulerAngles = vector3;
1841 }

References vector3.

◆ SetEulerAnglesX()

static void ClassExtension.SetEulerAnglesX ( this Transform  transform,
float  x 
)
inlinestatic

Definition at line 1843 of file ClassExtension.cs.

1844 {
1845 vector3.Set(x, transform.localEulerAngles.y, transform.localEulerAngles.z);
1846 transform.eulerAngles = vector3;
1847 }

References vector3.

◆ SetEulerAnglesY()

static void ClassExtension.SetEulerAnglesY ( this Transform  transform,
float  y 
)
inlinestatic

Definition at line 1849 of file ClassExtension.cs.

1850 {
1851 vector3.Set(transform.localEulerAngles.x, y, transform.localEulerAngles.z);
1852 transform.eulerAngles = vector3;
1853 }

References vector3.

◆ SetEulerAnglesZ()

static void ClassExtension.SetEulerAnglesZ ( this Transform  transform,
float  z 
)
inlinestatic

Definition at line 1855 of file ClassExtension.cs.

1856 {
1857 vector3.Set(transform.localEulerAngles.x, transform.localEulerAngles.y, z);
1858 transform.eulerAngles = vector3;
1859 }

References vector3.

◆ SetField< T >()

static void ClassExtension.SetField< T > ( this object  o,
string  name,
value 
)
inlinestatic

Definition at line 233 of file ClassExtension.cs.

234 {
235 o.GetType().GetField(name).SetValue(o, value);
236 }

◆ SetLayerRecursively()

static void ClassExtension.SetLayerRecursively ( this GameObject  obj,
int  layer 
)
inlinestatic

Definition at line 1299 of file ClassExtension.cs.

1300 {
1301 obj.layer = layer;
1302 foreach (Transform item in obj.transform)
1303 {
1304 item.gameObject.SetLayerRecursively(layer);
1305 }
1306 }

References item.

◆ SetListener()

static void ClassExtension.SetListener ( this Button::ButtonClickedEvent  e,
Action  action 
)
inlinestatic

Definition at line 1206 of file ClassExtension.cs.

1207 {
1208 e.RemoveAllListeners();
1209 e.AddListener(delegate
1210 {
1211 action();
1212 });
1213 }

References Button.

◆ SetLocalEulerAngles()

static void ClassExtension.SetLocalEulerAngles ( this Transform  transform,
float  x,
float  y,
float  z 
)
inlinestatic

Definition at line 1885 of file ClassExtension.cs.

1886 {
1887 vector3.Set(x, y, z);
1888 transform.localEulerAngles = vector3;
1889 }

References vector3.

◆ SetLocalEulerAnglesX()

static void ClassExtension.SetLocalEulerAnglesX ( this Transform  transform,
float  x 
)
inlinestatic

Definition at line 1891 of file ClassExtension.cs.

1892 {
1893 vector3.Set(x, transform.localEulerAngles.y, transform.localEulerAngles.z);
1894 transform.localEulerAngles = vector3;
1895 }

References vector3.

◆ SetLocalEulerAnglesY()

static void ClassExtension.SetLocalEulerAnglesY ( this Transform  transform,
float  y 
)
inlinestatic

Definition at line 1897 of file ClassExtension.cs.

1898 {
1899 vector3.Set(transform.localEulerAngles.x, y, transform.localEulerAngles.z);
1900 transform.localEulerAngles = vector3;
1901 }

References vector3.

◆ SetLocalEulerAnglesZ()

static void ClassExtension.SetLocalEulerAnglesZ ( this Transform  transform,
float  z 
)
inlinestatic

Definition at line 1903 of file ClassExtension.cs.

1904 {
1905 vector3.Set(transform.localEulerAngles.x, transform.localEulerAngles.y, z);
1906 transform.localEulerAngles = vector3;
1907 }

References vector3.

◆ SetLocalPosition()

static void ClassExtension.SetLocalPosition ( this Transform  transform,
float  x,
float  y,
float  z 
)
inlinestatic

Definition at line 1741 of file ClassExtension.cs.

1742 {
1743 vector3.Set(x, y, z);
1744 transform.localPosition = vector3;
1745 }

References vector3.

◆ SetLocalPositionX()

static void ClassExtension.SetLocalPositionX ( this Transform  transform,
float  x 
)
inlinestatic

Definition at line 1747 of file ClassExtension.cs.

1748 {
1749 vector3.Set(x, transform.localPosition.y, transform.localPosition.z);
1750 transform.localPosition = vector3;
1751 }

References vector3.

◆ SetLocalPositionY()

static void ClassExtension.SetLocalPositionY ( this Transform  transform,
float  y 
)
inlinestatic

Definition at line 1753 of file ClassExtension.cs.

1754 {
1755 vector3.Set(transform.localPosition.x, y, transform.localPosition.z);
1756 transform.localPosition = vector3;
1757 }

References vector3.

◆ SetLocalPositionZ()

static void ClassExtension.SetLocalPositionZ ( this Transform  transform,
float  z 
)
inlinestatic

Definition at line 1759 of file ClassExtension.cs.

1760 {
1761 vector3.Set(transform.localPosition.x, transform.localPosition.y, z);
1762 transform.localPosition = vector3;
1763 }

References vector3.

◆ SetLocalScale()

static void ClassExtension.SetLocalScale ( this Transform  transform,
float  x,
float  y,
float  z 
)
inlinestatic

Definition at line 1789 of file ClassExtension.cs.

1790 {
1791 vector3.Set(x, y, z);
1792 transform.localScale = vector3;
1793 }

References vector3.

◆ SetLocalScaleX()

static void ClassExtension.SetLocalScaleX ( this Transform  transform,
float  x 
)
inlinestatic

Definition at line 1795 of file ClassExtension.cs.

1796 {
1797 vector3.Set(x, transform.localScale.y, transform.localScale.z);
1798 transform.localScale = vector3;
1799 }

References vector3.

◆ SetLocalScaleY()

static void ClassExtension.SetLocalScaleY ( this Transform  transform,
float  y 
)
inlinestatic

Definition at line 1801 of file ClassExtension.cs.

1802 {
1803 vector3.Set(transform.localScale.x, y, transform.localScale.z);
1804 transform.localScale = vector3;
1805 }

References vector3.

◆ SetLocalScaleZ()

static void ClassExtension.SetLocalScaleZ ( this Transform  transform,
float  z 
)
inlinestatic

Definition at line 1807 of file ClassExtension.cs.

1808 {
1809 vector3.Set(transform.localScale.x, transform.localScale.y, z);
1810 transform.localScale = vector3;
1811 }

References vector3.

◆ SetNavigation()

static void ClassExtension.SetNavigation ( this Component  a,
Component  b,
bool  vertical = false 
)
inlinestatic

Definition at line 1047 of file ClassExtension.cs.

1048 {
1049 if (!a || !b)
1050 {
1051 return;
1052 }
1053 Selectable component = a.GetComponent<Selectable>();
1054 Selectable component2 = b.GetComponent<Selectable>();
1055 if ((bool)component && (bool)component2)
1056 {
1057 Navigation navigation = component.navigation;
1058 Navigation navigation2 = component2.navigation;
1059 if (vertical)
1060 {
1061 navigation.selectOnUp = component2;
1062 navigation2.selectOnDown = component;
1063 }
1064 else
1065 {
1066 navigation.selectOnLeft = component2;
1067 navigation2.selectOnRight = component;
1068 }
1069 component.navigation = navigation;
1070 component2.navigation = navigation2;
1071 }
1072 }

◆ SetOnClick()

static void ClassExtension.SetOnClick ( this Button  b,
Action  action 
)
inlinestatic

Definition at line 1197 of file ClassExtension.cs.

1198 {
1199 b.onClick.RemoveAllListeners();
1200 b.onClick.AddListener(delegate
1201 {
1202 action();
1203 });
1204 }

◆ SetPivot()

static void ClassExtension.SetPivot ( this RectTransform  r,
float  x,
float  y 
)
inlinestatic

Definition at line 1524 of file ClassExtension.cs.

1525 {
1526 r.pivot = new Vector2(x, y);
1527 }

◆ SetPosition()

static void ClassExtension.SetPosition ( this Transform  transform,
float  x,
float  y,
float  z 
)
inlinestatic

Definition at line 1693 of file ClassExtension.cs.

1694 {
1695 vector3.Set(x, y, z);
1696 transform.position = vector3;
1697 }

References vector3.

◆ SetPositionX()

static void ClassExtension.SetPositionX ( this Transform  transform,
float  x 
)
inlinestatic

Definition at line 1699 of file ClassExtension.cs.

1700 {
1701 vector3.Set(x, transform.position.y, transform.position.z);
1702 transform.position = vector3;
1703 }

References vector3.

◆ SetPositionY()

static void ClassExtension.SetPositionY ( this Transform  transform,
float  y 
)
inlinestatic

Definition at line 1705 of file ClassExtension.cs.

1706 {
1707 vector3.Set(transform.position.x, y, transform.position.z);
1708 transform.position = vector3;
1709 }

References vector3.

◆ SetPositionZ()

static void ClassExtension.SetPositionZ ( this Transform  transform,
float  z 
)
inlinestatic

Definition at line 1711 of file ClassExtension.cs.

1712 {
1713 vector3.Set(transform.position.x, transform.position.y, z);
1714 transform.position = vector3;
1715 }

References vector3.

◆ SetProperty< T >()

static void ClassExtension.SetProperty< T > ( this object  o,
string  name,
value 
)
inlinestatic

Definition at line 243 of file ClassExtension.cs.

244 {
245 o.GetType().GetProperty(name).SetValue(o, value);
246 }

◆ SetRect()

static void ClassExtension.SetRect ( this RectTransform  r,
float  x,
float  y,
float  w,
float  h,
float  pivotX,
float  pivotY,
float  minX,
float  minY,
float  maxX,
float  maxY 
)
inlinestatic

Definition at line 1513 of file ClassExtension.cs.

1514 {
1515 r.SetPivot(pivotX, pivotY);
1516 r.SetAnchor(minX, minY, maxX, maxY);
1517 if (w != -1f)
1518 {
1519 r.sizeDelta = new Vector2(w, h);
1520 }
1521 r.anchoredPosition = new Vector2((x == -1f) ? r.anchoredPosition.x : x, (y == -1f) ? r.anchoredPosition.y : y);
1522 }

◆ SetScale()

static void ClassExtension.SetScale ( this SpriteRenderer  renderer,
float  size 
)
inlinestatic

Definition at line 1619 of file ClassExtension.cs.

1620 {
1621 float x = renderer.bounds.size.x;
1622 float y = renderer.bounds.size.y;
1623 float x2 = size / x;
1624 float y2 = size / y;
1625 renderer.transform.localScale = new Vector3(x2, y2, 1f);
1626 }

◆ SetSlider() [1/2]

static void ClassExtension.SetSlider ( this Slider  slider,
float  value,
Func< float, string >  action,
bool  notify 
)
inlinestatic

Definition at line 1220 of file ClassExtension.cs.

1221 {
1222 slider.SetSlider(value, action, -1, -1, notify);
1223 }

◆ SetSlider() [2/2]

static void ClassExtension.SetSlider ( this Slider  slider,
float  value,
Func< float, string >  action,
int  min = -1,
int  max = -1,
bool  notify = true 
)
inlinestatic

Definition at line 1225 of file ClassExtension.cs.

1226 {
1227 slider.onValueChanged.RemoveAllListeners();
1228 slider.onValueChanged.AddListener(delegate(float a)
1229 {
1230 slider.GetComponentInChildren<Text>(includeInactive: true).text = action(a);
1231 });
1232 if (min != -1)
1233 {
1234 slider.minValue = min;
1235 slider.maxValue = max;
1236 }
1237 if (notify)
1238 {
1239 slider.value = value;
1240 }
1241 else
1242 {
1243 slider.SetValueWithoutNotify(value);
1244 }
1245 slider.GetComponentInChildren<Text>(includeInactive: true).text = action(value);
1246 }

◆ SetTag()

static string ClassExtension.SetTag ( this string  s,
string  id,
bool  enable,
char  splitter = '/' 
)
inlinestatic

Definition at line 919 of file ClassExtension.cs.

920 {
921 s = ((!enable) ? s.RemoveTag(id, splitter) : s.AddTag(id, splitter));
922 return s;
923 }

◆ SetY()

static Vector3 ClassExtension.SetY ( this Vector3  v,
float  a 
)
inlinestatic

Definition at line 1669 of file ClassExtension.cs.

1670 {
1671 v.y = a;
1672 return v;
1673 }

◆ SetZ()

static Vector3 ClassExtension.SetZ ( this Vector3  v,
float  a 
)
inlinestatic

Definition at line 1663 of file ClassExtension.cs.

1664 {
1665 v.z = a;
1666 return v;
1667 }

◆ Shuffle< TValue >()

static IList< TValue > ClassExtension.Shuffle< TValue > ( this IList< TValue >  list)
inlinestatic

Definition at line 348 of file ClassExtension.cs.

349 {
350 int num = list.Count;
351 while (num > 1)
352 {
353 int index = Rand._random.Next(num);
354 num--;
355 TValue value = list[num];
356 list[num] = list[index];
357 list[index] = value;
358 }
359 return list;
360 }
static Random _random
Definition: Rand.cs:7

References Rand._random.

◆ Sort< T >()

static void ClassExtension.Sort< T > ( this IList< T >  list,
Comparison< T >  comparison 
)
inlinestatic

Definition at line 248 of file ClassExtension.cs.

249 {
250 if (list is List<T>)
251 {
252 ((List<T>)list).Sort(comparison);
253 return;
254 }
255 List<T> list2 = new List<T>(list);
256 list2.Sort(comparison);
257 for (int i = 0; i < list.Count; i++)
258 {
259 list[i] = list2[i];
260 }
261 }

◆ SplitNewline()

static string[] ClassExtension.SplitNewline ( this string  str)
inlinestatic

Definition at line 793 of file ClassExtension.cs.

794 {
795 return str.Split(Environment.NewLine.ToCharArray());
796 }

◆ SplitToInts()

static int[] ClassExtension.SplitToInts ( this string  str,
char  separator 
)
inlinestatic

Definition at line 782 of file ClassExtension.cs.

783 {
784 string[] array = str.Split(separator);
785 int[] array2 = new int[array.Length];
786 for (int i = 0; i < array.Length; i++)
787 {
788 array2[i] = int.Parse(array[i]);
789 }
790 return array2;
791 }

◆ StripBrackets()

static string ClassExtension.StripBrackets ( this string  str)
inlinestatic

Definition at line 739 of file ClassExtension.cs.

740 {
741 return str.Replace("\"", "").Replace("「", "").Replace("」", "")
742 .Replace("“", "")
743 .Replace("\"", "");
744 }

◆ StripLastPun()

static string ClassExtension.StripLastPun ( this string  str)
inlinestatic

Definition at line 693 of file ClassExtension.cs.

694 {
695 if (str != null)
696 {
697 return str.TrimEnd(Lang.words.period);
698 }
699 return str;
700 }
char period
Definition: Lang.cs:19
static Words words
Definition: Lang.cs:26

References Lang.Words.period, and Lang.words.

◆ StripPun()

static string ClassExtension.StripPun ( this string  str,
bool  stripComma,
bool  insertSpaceForComma = false 
)
inlinestatic

Definition at line 702 of file ClassExtension.cs.

703 {
704 StringBuilder stringBuilder = new StringBuilder();
705 foreach (char c in str)
706 {
707 if (c == Lang.words.comma)
708 {
709 if (stripComma)
710 {
711 if (insertSpaceForComma)
712 {
713 stringBuilder.Append('\u3000');
714 }
715 }
716 else
717 {
718 stringBuilder.Append(c);
719 }
720 }
721 else if (c != Lang.words.period)
722 {
723 stringBuilder.Append(c);
724 }
725 }
726 return stringBuilder.ToString();
727 }
char comma
Definition: Lang.cs:17

References Lang.Words.comma, Lang.Words.period, and Lang.words.

◆ Tag()

static string ClassExtension.Tag ( this Color  c)
inlinestatic

Definition at line 1187 of file ClassExtension.cs.

1188 {
1189 return "<color=" + $"#{(int)(c.r * 255f):X2}{(int)(c.g * 255f):X2}{(int)(c.b * 255f):X2}" + ">";
1190 }

References $.

◆ TagColor() [1/2]

static string ClassExtension.TagColor ( this string  s,
Color  c 
)
inlinestatic

Definition at line 899 of file ClassExtension.cs.

900 {
901 return "<color=" + c.ToHex() + ">" + s + "</color>";
902 }

◆ TagColor() [2/2]

static string ClassExtension.TagColor ( this string  s,
Color  c,
string  txt 
)
inlinestatic

Definition at line 894 of file ClassExtension.cs.

895 {
896 return s + "<color=" + c.ToHex() + ">" + txt + "</color>";
897 }

◆ TagSize() [1/2]

static string ClassExtension.TagSize ( this string  s,
int  size 
)
inlinestatic

Definition at line 909 of file ClassExtension.cs.

910 {
911 return "<size=" + size + ">" + s + "</size>";
912 }

◆ TagSize() [2/2]

static string ClassExtension.TagSize ( this string  s,
string  txt,
int  size 
)
inlinestatic

Definition at line 904 of file ClassExtension.cs.

905 {
906 return s + "<size=" + size + ">" + txt + "</size>";
907 }

◆ ToBytes()

static byte[] ClassExtension.ToBytes ( this BitArray  bits)
inlinestatic

Definition at line 68 of file ClassExtension.cs.

69 {
70 byte[] array = new byte[(bits.Length - 1) / 8 + 1];
71 bits.CopyTo(array, 0);
72 return array;
73 }

◆ ToColor()

static Color ClassExtension.ToColor ( this string  s)
inlinestatic

Definition at line 1159 of file ClassExtension.cs.

1160 {
1161 Color color = Color.white;
1162 ColorUtility.TryParseHtmlString("#" + s, out color);
1163 return color;
1164 }

References Color.

◆ ToDictionary< T >()

static void ClassExtension.ToDictionary< T > ( this IList< UPair< T > >  list,
ref Dictionary< string, T >  dic 
)
inlinestatic

Definition at line 609 of file ClassExtension.cs.

610 {
611 dic = new Dictionary<string, T>();
612 for (int i = 0; i < list.Count; i++)
613 {
614 dic.Add(list[i].name, list[i].value);
615 }
616 }

◆ ToEnum< T >() [1/3]

static T ClassExtension.ToEnum< T > ( this int  value)
inlinestatic

Definition at line 134 of file ClassExtension.cs.

135 {
136 return (T)Enum.ToObject(typeof(T), value);
137 }

◆ ToEnum< T >() [2/3]

static T ClassExtension.ToEnum< T > ( this long  value)
inlinestatic

Definition at line 139 of file ClassExtension.cs.

140 {
141 return (T)Enum.ToObject(typeof(T), value);
142 }

◆ ToEnum< T >() [3/3]

static T ClassExtension.ToEnum< T > ( this string  value,
bool  ignoreCase = true 
)
inlinestatic

Definition at line 144 of file ClassExtension.cs.

145 {
146 return (T)Enum.Parse(typeof(T), value, ignoreCase);
147 }

◆ ToField< T >()

static T ClassExtension.ToField< T > ( this string  s,
object  o 
)
inlinestatic

Definition at line 213 of file ClassExtension.cs.

214 {
215 return (T)o.GetType().GetField(s).GetValue(o);
216 }

◆ ToFloat()

static float ClassExtension.ToFloat ( this string  str)
inlinestatic

Definition at line 674 of file ClassExtension.cs.

675 {
676 float result = 0f;
677 try
678 {
679 if (!float.TryParse(str, out result))
680 {
681 Debug.Log("exception: ToFlat1" + str);
682 result = 1f;
683 }
684 }
685 catch
686 {
687 Debug.Log("exception: ToFlat2" + str);
688 result = 1f;
689 }
690 return result;
691 }

References Debug.

◆ ToFormat() [1/2]

static string ClassExtension.ToFormat ( this int  a)
inlinestatic

Definition at line 862 of file ClassExtension.cs.

863 {
864 return $"{a:#,0}";
865 }

References $.

◆ ToFormat() [2/2]

static string ClassExtension.ToFormat ( this long  a)
inlinestatic

Definition at line 867 of file ClassExtension.cs.

868 {
869 return $"{a:#,0}";
870 }

References $.

◆ ToggleActive()

static void ClassExtension.ToggleActive ( this Component  c)
inlinestatic

Definition at line 1272 of file ClassExtension.cs.

1273 {
1274 c.SetActive(!c.gameObject.activeSelf);
1275 }

◆ ToggleKeyword()

static void ClassExtension.ToggleKeyword ( this Material  m,
string  id,
bool  enable 
)
inlinestatic

Definition at line 1933 of file ClassExtension.cs.

1934 {
1935 if (enable)
1936 {
1937 m.EnableKeyword(id);
1938 }
1939 else
1940 {
1941 m.DisableKeyword(id);
1942 }
1943 }

◆ ToHex()

static string ClassExtension.ToHex ( this Color  c)
inlinestatic

Definition at line 1192 of file ClassExtension.cs.

1193 {
1194 return $"#{(int)(c.r * 255f):X2}{(int)(c.g * 255f):X2}{(int)(c.b * 255f):X2}";
1195 }

References $.

◆ ToInt() [1/2]

static int ClassExtension.ToInt ( this string  str)
inlinestatic

Definition at line 665 of file ClassExtension.cs.

666 {
667 if (int.TryParse(str, out var result))
668 {
669 return result;
670 }
671 return 0;
672 }

◆ ToInt() [2/2]

static int ClassExtension.ToInt ( this string  str,
Type  type 
)
inlinestatic

Definition at line 654 of file ClassExtension.cs.

655 {
656 FieldInfo field = type.GetField(str, BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy);
657 if (field == null)
658 {
659 Debug.LogError("Field is null:" + str + "/" + type);
660 return -1;
661 }
662 return (int)field.GetValue(null);
663 }

References Debug.

◆ ToInt2()

static int ClassExtension.ToInt2 ( this float  a)
inlinestatic

Definition at line 99 of file ClassExtension.cs.

100 {
101 return (int)(a * 100f);
102 }

◆ ToInt3()

static int ClassExtension.ToInt3 ( this float  a)
inlinestatic

Definition at line 89 of file ClassExtension.cs.

90 {
91 return (int)(a * 1000f);
92 }

◆ ToInt< T >()

static int ClassExtension.ToInt< T > ( this string  str)
inlinestatic

Definition at line 649 of file ClassExtension.cs.

650 {
651 return str.ToInt(typeof(T));
652 }

◆ ToShortNumber()

static string ClassExtension.ToShortNumber ( this int  a)
inlinestatic

Definition at line 819 of file ClassExtension.cs.

820 {
821 if (a < 0)
822 {
823 string text;
824 if (a > -1000000)
825 {
826 if (a <= -1000)
827 {
828 return a / 1000 + "K";
829 }
830 text = a.ToString();
831 if (text == null)
832 {
833 return "";
834 }
835 }
836 else
837 {
838 text = a / 1000000 + "M";
839 }
840 return text;
841 }
842 string text2;
843 if (a < 1000000)
844 {
845 if (a >= 1000)
846 {
847 return a / 1000 + "K";
848 }
849 text2 = a.ToString();
850 if (text2 == null)
851 {
852 return "";
853 }
854 }
855 else
856 {
857 text2 = a / 1000000 + "M";
858 }
859 return text2;
860 }

◆ ToText()

static string ClassExtension.ToText ( this int  a,
bool  skipIfZero = true 
)
inlinestatic

Definition at line 872 of file ClassExtension.cs.

873 {
874 object obj;
875 if (!(a == 0 && skipIfZero))
876 {
877 if (a >= 0)
878 {
879 return "+" + a;
880 }
881 obj = a.ToString();
882 if (obj == null)
883 {
884 return "";
885 }
886 }
887 else
888 {
889 obj = "";
890 }
891 return (string)obj;
892 }

◆ ToTitleCase()

static string ClassExtension.ToTitleCase ( this string  s,
bool  wholeText = false 
)
inlinestatic

Definition at line 999 of file ClassExtension.cs.

1000 {
1001 if (!Lang.setting.capitalize)
1002 {
1003 return s;
1004 }
1005 char[] array = s.ToCharArray();
1006 bool flag = true;
1007 for (int i = 0; i < array.Length; i++)
1008 {
1009 if (flag)
1010 {
1011 array[i] = char.ToUpper(array[i]);
1012 flag = false;
1013 }
1014 if (!wholeText)
1015 {
1016 break;
1017 }
1018 if (array[i] == ' ')
1019 {
1020 flag = true;
1021 }
1022 }
1023 return new string(array);
1024 }
bool capitalize
Definition: LangSetting.cs:34

References LangSetting.capitalize, and Lang.setting.

◆ ToType()

static Type ClassExtension.ToType ( this string  value)
inlinestatic

Definition at line 149 of file ClassExtension.cs.

150 {
151 return Type.GetType("Elona." + value + ", Assembly-CSharp");
152 }

◆ ToVector2()

static Vector2 ClassExtension.ToVector2 ( this Vector3  self)
inlinestatic

Definition at line 1614 of file ClassExtension.cs.

1615 {
1616 return new Vector2(self.x, self.z);
1617 }

◆ TrimNewLines()

static string ClassExtension.TrimNewLines ( this string  text)
inlinestatic

Definition at line 773 of file ClassExtension.cs.

774 {
775 while (text.EndsWith(Environment.NewLine))
776 {
777 text = text.Substring(0, text.Length - Environment.NewLine.Length);
778 }
779 return text;
780 }

◆ TryAddExtension()

static string ClassExtension.TryAddExtension ( this string  s,
string  ext 
)
inlinestatic

Definition at line 746 of file ClassExtension.cs.

747 {
748 if (!s.Contains("." + ext))
749 {
750 return s + "." + ext;
751 }
752 return s;
753 }

◆ TryGet< TValue >() [1/2]

static TValue ClassExtension.TryGet< TValue > ( this IList< TValue >  array,
int  index,
bool  returnNull 
)
inlinestatic

Definition at line 284 of file ClassExtension.cs.

285 {
286 if (index >= array.Count)
287 {
288 return default(TValue);
289 }
290 return array[index];
291 }

◆ TryGet< TValue >() [2/2]

static TValue ClassExtension.TryGet< TValue > ( this IList< TValue >  array,
int  index,
int  defIndex = -1 
)
inlinestatic

Definition at line 263 of file ClassExtension.cs.

264 {
265 if (array.Count != 0)
266 {
267 if (index >= array.Count)
268 {
269 if (defIndex != -1)
270 {
271 if (array.Count <= defIndex)
272 {
273 return array[Mathf.Max(0, array.Count - 1)];
274 }
275 return array[defIndex];
276 }
277 return array[Mathf.Max(0, array.Count - 1)];
278 }
279 return array[Math.Max(0, index)];
280 }
281 return default(TValue);
282 }

◆ TryGetValue< TKey, TValue >() [1/2]

static TValue ClassExtension.TryGetValue< TKey, TValue > ( this IDictionary< TKey, TValue >  source,
TKey  key,
TKey  key_fallback 
)
inlinestatic

Definition at line 372 of file ClassExtension.cs.

373 {
374 TValue value = default(TValue);
375 if (key != null && source.TryGetValue(key, out value))
376 {
377 return value;
378 }
379 return source[key_fallback];
380 }

◆ TryGetValue< TKey, TValue >() [2/2]

static TValue ClassExtension.TryGetValue< TKey, TValue > ( this IDictionary< TKey, TValue >  source,
TKey  key,
TValue  fallback = default(TValue) 
)
inlinestatic

Definition at line 362 of file ClassExtension.cs.

363 {
364 TValue value = default(TValue);
365 if (key != null && source.TryGetValue(key, out value))
366 {
367 return value;
368 }
369 return fallback;
370 }

◆ Within() [1/2]

static bool ClassExtension.Within ( this byte  v,
byte  v2,
byte  range 
)
inlinestatic

Definition at line 173 of file ClassExtension.cs.

174 {
175 if (v - v2 >= range)
176 {
177 return v - v2 < -range;
178 }
179 return true;
180 }

◆ Within() [2/2]

static bool ClassExtension.Within ( this int  v,
int  v2,
int  range 
)
inlinestatic

Definition at line 164 of file ClassExtension.cs.

165 {
166 if (v - v2 >= range)
167 {
168 return v - v2 < -range;
169 }
170 return true;
171 }

Member Data Documentation

◆ pluralizer

IPluralize ClassExtension.pluralizer = new Pluralizer()
static

Definition at line 17 of file ClassExtension.cs.

Referenced by langPlural(), and Pluralize().

◆ vector3


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