示例#1
0
        public static ConVar <T> Register <T>(string Name, T Value, ConVarType Type = ConVarType.Default)
        {
            ConVar <T> CVar = new ConVar <T>(Name, Value, Type);

            ConItems.Register(Name, CVar);
            return(CVar);
        }
示例#2
0
        public static dynamic Parse(string t, ConVarType cvt)
        {
            switch (cvt)
            {
            case ConVarType.String:
                return(t);

            case ConVarType.Integer:
                return(int.Parse(t));

            case ConVarType.Float:
                return(float.Parse(t));

            case ConVarType.Double:
                return(double.Parse(t));

            case ConVarType.Boolean:
                return(t == "true" || t == "yes" || t == "1");
            }

            throw new ArgumentException("Failed to parse your input!");
        }
示例#3
0
 protected ConVar(string Name, ConVarType Type) : base(Name)
 {
     this.Type = Type;
 }
示例#4
0
 public void SetType(Type t)
 {
     ValueType = ToConVarType(t);
 }