public CVar(string Name, object DefaultValue, CVarType Type, CVarSetFunc OnSet = null, CVarGetFunc OnGet = null) { Info = Name; TriggerOnSet = true; TriggerOnGet = true; this.OnSet = OnSet; this.OnGet = OnGet; this.Name = Name; CVarType = Type; Val = DefaultValue; Value = Val; this.DefaultValue = Value; }
public static CVar Register(string Name, object DefaultVal = null, CVarType Type = CVarType.Default, CVarSetFunc OnSet = null, CVarGetFunc OnGet = null) { if (Find(Name) != null) { throw new Exception("CVar " + Name + " already registered"); } CVar Var = new CVar(Name, DefaultVal, Type, OnSet, OnGet); CVars.Add(Var); return(Var); }