Exemple #1
0
        public StaticCVarProperty(CVarAttribute attribute, PropertyInfo propertyInfo)
        {
            Name  = attribute.Name;
            Flags = attribute.Flags;
            Help  = attribute.Help;

            property.SetValue(null, attribute.DefaultValue, null);

            property = propertyInfo;
        }
        public StaticCVarProperty(CVarAttribute attribute, PropertyInfo propertyInfo)
        {
            Name = attribute.Name;
            Flags = attribute.Flags;
            Help = attribute.Help;

            property.SetValue(null, attribute.DefaultValue, null);

            property = propertyInfo;
        }
Exemple #3
0
        public StaticCVarField(CVarAttribute attribute, FieldInfo fieldInfo)
        {
            Name  = attribute.Name;
            Flags = attribute.Flags;
            Help  = attribute.Help;

            fieldInfo.SetValue(null, attribute.DefaultValue);

            field = fieldInfo;
        }
Exemple #4
0
        public StaticCVarField(CVarAttribute attribute, FieldInfo fieldInfo)
        {
            Name = attribute.Name;
            Flags = attribute.Flags;
            Help = attribute.Help;

            fieldInfo.SetValue(null, attribute.DefaultValue);

            field = fieldInfo;
        }
Exemple #5
0
        internal static CVar Register(CVarAttribute attribute, MemberInfo memberInfo, string value)
        {
            if (attribute.Name == null)
            {
                attribute.Name = memberInfo.Name;
            }

            NativeCVarMethods.RegisterCVarString(attribute.Name, value, (string)attribute.DefaultValue ?? string.Empty, attribute.Flags, attribute.Help);

            if (memberInfo.MemberType == MemberTypes.Field)
            {
                CVars.Add(new StaticCVarField(attribute, memberInfo as FieldInfo));
            }
            else
            {
                CVars.Add(new StaticCVarProperty(attribute, memberInfo as PropertyInfo));
            }

            return(CVars.Last());
        }
Exemple #6
0
        internal static CVar Register(CVarAttribute attribute, MemberInfo memberInfo, ref float value)
        {
            if (attribute.Name == null)
            {
                attribute.Name = memberInfo.Name;
            }

            NativeCVarMethods.RegisterCVarFloat(attribute.Name, ref value, System.Convert.ToSingle(attribute.DefaultValue), attribute.Flags, attribute.Help);

            if (memberInfo.MemberType == MemberTypes.Field)
            {
                CVars.Add(new StaticCVarField(attribute, memberInfo as FieldInfo));
            }
            else
            {
                CVars.Add(new StaticCVarProperty(attribute, memberInfo as PropertyInfo));
            }

            return(CVars.Last());
        }
Exemple #7
0
        internal static CVar Register(CVarAttribute attribute, MemberInfo memberInfo, string value)
        {
            if (attribute.Name == null)
                attribute.Name = memberInfo.Name;

            NativeCVarMethods.RegisterCVarString(attribute.Name, value, (string)attribute.DefaultValue ?? string.Empty, attribute.Flags, attribute.Help);

            if (memberInfo.MemberType == MemberTypes.Field)
                CVars.Add(new StaticCVarField(attribute, memberInfo as FieldInfo));
            else
                CVars.Add(new StaticCVarProperty(attribute, memberInfo as PropertyInfo));

            return CVars.Last();
        }
Exemple #8
0
        internal static CVar Register(CVarAttribute attribute, MemberInfo memberInfo, ref float value)
        {
            if (attribute.Name == null)
                attribute.Name = memberInfo.Name;

            NativeCVarMethods.RegisterCVarFloat(attribute.Name, ref value, System.Convert.ToSingle(attribute.DefaultValue), attribute.Flags, attribute.Help);

            if (memberInfo.MemberType == MemberTypes.Field)
                CVars.Add(new StaticCVarField(attribute, memberInfo as FieldInfo));
            else
                CVars.Add(new StaticCVarProperty(attribute, memberInfo as PropertyInfo));

            return CVars.Last();
        }