-
Notifications
You must be signed in to change notification settings - Fork 16
Supplementary class contains static methods
string Format(this string, params object[])
Example
"{0}-{1}".Format("Hello", 20); // result is Hello-20
void CallActionClean(ref Action)
As its name suggests, this method will execute the call action and remove the original reference
Example
Action displayedCallback;
...
C.CallActionClean(ref displayedCallback);
void CopyToClipboard(this string)
Copy the text string into memory
Example
"this demo string".CopyToClipboard();
string ToAlphabet(this string)
string ToAlphabet(this System.Numerics.BigInteger)
formatting Big Numbers: The “aa” Notation
number---------------alphabet
1-----------------------1
1000--------------------1K
1000000-----------------1M
1000000000--------------1B
1000000000000-----------1T
1000000000000000--------1AA
Example
int coin = 123456;
string notation= coin.ToString().ToAlphabet(); // notation = 123.45K
void SwapPlayerPrefs<T>(string, string)
Swap value of two key playerprefs
Example
C.SwapPlayerPrefs("key_a", "key_b");
DelayHandle AttachDelay(this MonoBehaviour, float, Action, Action<float>, bool, bool)
Attach a DelayHandle on to the behaviour. If the behaviour is destroyed before the DelayHandle is completed, e.g. through a scene change, the DelayHandle callback will not execute.
Example
this.AttachDelay(1f, CallbackCompleted);
void GotoStore()
Go to store website of application, Android will use Application.identifier
, iOS will use HeartSettings.AppstoreAppId
Example
C.GotoStore();
bool HasFlagUnsafe<TEnum>(TEnum lhs, TEnum rhs) where TEnum : unmanaged, Enum
Check if enum variable contains specified value or not?
Example
[Flags]
private enum RaycastType
{
Horizontal = 1 << 0,
Vertical = 1 << 1,
IntersectionTop = 1 << 2,
IntersectionBottom = 1 << 3,
};
...
[SerializeField] private RaycastType raycastType = RaycastType.Horizontal | RaycastType.Vertical;
...
var result = C.HasFlagUnsafe(raycastType, RaycastType.Horizontal); // result = true