Exemplo n.º 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;
        }
Exemplo n.º 2
0
        public StaticCVarProperty(CVarAttribute attribute, PropertyInfo propertyInfo)
        {
            Name = attribute.Name;
            Flags = attribute.Flags;
            Help = attribute.Help;

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

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

            fieldInfo.SetValue(null, attribute.DefaultValue);

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

            fieldInfo.SetValue(null, attribute.DefaultValue);

            field = fieldInfo;
        }
Exemplo n.º 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());
        }
Exemplo n.º 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());
        }
Exemplo n.º 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();
        }
Exemplo n.º 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();
        }