Class DebugActionFlag
Flag action will be represented as a button selector in the debug menu, triggering the action will cycle the value and notify the flag listener, if isPersistence
is true, the value will also be updated to PlayerPrefs.
Inheritance
System.Object
DebugActionFlag
Inherited Members [+/-]
. . .
Assembly: com.bennykok.runtime-debug-action.dll
Syntax
[Serializable]
public class DebugActionFlag : FluentAction<DebugActionFlag>
Examples
RuntimeDebugSystem.RegisterActions(
DebugActionBuilder.Flag()
.WithName("Target FPS")
.WithFlag("target-fps", new string[] { "Default", "30", "60" }, true)
.WithFlagListener((flag) =>
{
switch (flag)
{
case 0:
Application.targetFrameRate = -1;
break;
case 1:
Application.targetFrameRate = 30;
break;
case 2:
Application.targetFrameRate = 60;
break;
}
})
);
RuntimeDebugSystem.RegisterActions(
DebugActionBuilder.Flag()
.WithName("Set Screen Orientation")
.WithFlag("screen-orientation", Enum.GetNames(typeof(ScreenOrientation)), true, (int)Screen.orientation)
.WithFlagListener((flag) =>
{
Screen.orientation = (ScreenOrientation)(int)flag;
})
);
Fields
BOOLEAN_VALUES
Declaration
public static readonly string[] BOOLEAN_VALUES
Field Value
Type |
Description |
System.String[] |
|
defaultFlagValue
Declaration
[NonSerialized]
public int defaultFlagValue
Field Value
Type |
Description |
System.Int32 |
|
flagKey
Declaration
Field Value
Type |
Description |
System.String |
|
flagValue
Declaration
Field Value
Type |
Description |
System.Int32 |
|
flagValues
Declaration
public string[] flagValues
Field Value
Type |
Description |
System.String[] |
|
isPersistence
If true, the key will be saved to PlayerPrefs
Declaration
[Title("Flag", 2)]
public bool isPersistence
Field Value
Type |
Description |
System.Boolean |
|
onFlagChange
Declaration
public Action<DebugActionFlag> onFlagChange
Field Value
Methods
CycleFlagValue(Boolean)
Declaration
public bool CycleFlagValue(bool invokeFlagListener = true)
Parameters
Type |
Name |
Description |
System.Boolean |
invokeFlagListener |
|
Returns
Type |
Description |
System.Boolean |
|
GetDescription()
Declaration
public override string GetDescription()
Returns
Type |
Description |
System.String |
|
Overrides
GetFlagKeyWithPrefix(String)
Declaration
public static string GetFlagKeyWithPrefix(string key)
Parameters
Type |
Name |
Description |
System.String |
key |
|
Returns
Type |
Description |
System.String |
|
InvokeFlagListener()
Declaration
public void InvokeFlagListener()
OnBeforeSerialize()
Declaration
public void OnBeforeSerialize()
ResetFlag(Boolean)
Declaration
public bool ResetFlag(bool invokeFlagListener = true)
Parameters
Type |
Name |
Description |
System.Boolean |
invokeFlagListener |
|
Returns
Type |
Description |
System.Boolean |
|
SetFlagValue(Int32, Boolean)
Declaration
public bool SetFlagValue(int newFlagValue, bool invokeFlagListener = true)
Parameters
Type |
Name |
Description |
System.Int32 |
newFlagValue |
|
System.Boolean |
invokeFlagListener |
|
Returns
Type |
Description |
System.Boolean |
|
Setup()
Declaration
public override void Setup()
Overrides
WithFlag(String, Boolean, Boolean)
Declaration
public DebugActionFlag WithFlag(string flagKey, bool persistence = true, bool defaultValue = false)
Parameters
Type |
Name |
Description |
System.String |
flagKey |
|
System.Boolean |
persistence |
|
System.Boolean |
defaultValue |
|
Returns
WithFlag(String, String[], Boolean, Int32)
Declaration
public DebugActionFlag WithFlag(string flagKey, string[] values, bool persistence = true, int defaultValue = 0)
Parameters
Type |
Name |
Description |
System.String |
flagKey |
|
System.String[] |
values |
|
System.Boolean |
persistence |
|
System.Int32 |
defaultValue |
|
Returns
WithFlagListener(Action<DebugActionFlag>, Boolean)
Declaration
public DebugActionFlag WithFlagListener(Action<DebugActionFlag> onFlagChange, bool invokeNowIfDirty = true)
Parameters
Type |
Name |
Description |
System.Action<DebugActionFlag> |
onFlagChange |
|
System.Boolean |
invokeNowIfDirty |
|
Returns
Operators
Implicit(DebugActionFlag to Boolean)
Declaration
public static implicit operator bool (DebugActionFlag flag)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Implicit(DebugActionFlag to Int32)
Declaration
public static implicit operator int (DebugActionFlag flag)
Parameters
Returns
Type |
Description |
System.Int32 |
|