Description:
Default KeyCode parser.

Added In: v0.45

Function

    public class UMFConfigKeyCode : UMFConfigParser<KeyCode>
    {
        public KeyCode DefaultValue;
        public bool RequiresRestart;
        public KeyCode[] AllowedValues;

        public UMFConfigKeyCode(KeyCode defaultValue = KeyCode.None, bool requiresRestart = false, params KeyCode[] allowedValues)
        {
            DefaultValue = defaultValue;
            RequiresRestart = requiresRestart;
            AllowedValues = allowedValues;
        }

        public override KeyCode Parse(string value)
        {
            return (KeyCode)Enum.Parse(typeof(KeyCode), value.Trim(), true);
        }

        public override string ToString()
        {
            return DefaultValue.ToString();
        }

        public override string Default()
        {
            return DefaultValue.ToString();
        }

        public override string Allowed()
        {
            return (AllowedValues.Length > 0 ? string.Join(",", AllowedValues.Select(x => x.ToString()).ToArray()) : null);
        }

        public override string Restart()
        {
            return RequiresRestart.ToString();
        }
    }



Usage

//Coming soon



Examples

//Coming soon