Exemple #1
0
        public When_mapping_object_from_value_type_without_constructor()
        {
            var source = new CustomValueType {
                Int64Property = 42L
            };

            dynamicObject = new DynamicObjectMapper().MapObject(source);
        }
Exemple #2
0
        /// <summary>
        /// Called when reading XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        protected override void OnReadXml(XmlReader reader)
        {
            string str;

            base.OnReadXml(reader);
            if (((str = reader.Name) != null) && (str == "Formula1"))
            {
                this.customValueType = (CustomValueType)Serializer.DeserializeObj(typeof(CustomValueType), reader);
            }
        }
Exemple #3
0
 private string ToCodeType(CustomValueType cvt)
 {
     if (cvt == CustomValueType.Sampler2D)
     {
         return("sampler2D");                // Uppercase D
     }
     if (cvt == CustomValueType.Matrix4x4)
     {
         return("float4x4");
     }
     return(cvt.ToString().ToLower());
 }
Exemple #4
0
            public static bool TryParse(string input, out CustomValueType instance)
            {
                int value;

                if (int.TryParse(input, out value))
                {
                    instance = new CustomValueType(value);
                    return(true);
                }

                instance = null;
                return(false);
            }
        /// <summary>
        ///
        /// </summary>
        /// <param name="_key"></param>
        /// <returns>Return custom value type by value id</returns>
        public CustomValueType GetValueTypeByKey(string _key)
        {
            CustomValueType _tempType = CustomValueType.String;

            foreach (CustomValue _data in CustomValues)
            {
                if (_data.ValueID == _key)
                {
                    _tempType = _data.ValueType;
                    break;
                }
            }
            return(_tempType);
        }
Exemple #6
0
        public static int ComponentCountOf(CustomValueType cvt)
        {
            switch (cvt)
            {
            case CustomValueType.Float:
                return(1);

            case CustomValueType.Half:
                return(1);

            case CustomValueType.Fixed:
                return(1);

            case CustomValueType.Float2:
                return(2);

            case CustomValueType.Half2:
                return(2);

            case CustomValueType.Fixed2:
                return(2);

            case CustomValueType.Float3:
                return(3);

            case CustomValueType.Half3:
                return(3);

            case CustomValueType.Fixed3:
                return(3);

            case CustomValueType.Float4:
                return(4);

            case CustomValueType.Half4:
                return(4);

            case CustomValueType.Fixed4:
                return(4);

            case CustomValueType.Sampler2D:
                return(4);

            default:
                // Debug.Log("Invalid component count check of custom value type: " + cvt);
                return(16);
            }
        }
Exemple #7
0
        private string ToCodeType(CustomValueType cvt)
        {
            if (cvt == CustomValueType.Sampler2D)
            {
                return("sampler2D");                // Uppercase D
            }
            if (cvt == CustomValueType.Matrix4x4)
            {
                return("float4x4");
            }
            if (cvt == CustomValueType.Texture2dArray)
            {
                Debug.LogError("here no modify");
                return("Texture2dArray");
            }

            return(cvt.ToString().ToLower());
        }
Exemple #8
0
 /// <summary>
 /// Creates a new custom condition with a specified formula or expression.
 /// </summary>
 /// <param name="customValueType"></param>
 /// <param name="formula">Formula string or expression.</param>
 internal FormulaCondition(CustomValueType customValueType, string formula) : base(null, formula)
 {
     this.customValueType = customValueType;
 }
 public CustomValueType ValueType(CustomValueType parameter = default(CustomValueType))
 {
     return(parameter);
 }
 public FooWithCustomValueTypeSetToDefault(CustomValueType value = default(CustomValueType))
 {
     Value = value;
 }
 protected bool Equals(CustomValueType <TCustom, TValue> other)
 {
     return(EqualityComparer <TValue> .Default.Equals(_value, other._value));
 }
Exemple #12
0
        public When_mapping_object_from_immutable_value_type()
        {
            var source = new CustomValueType(42L);

            dynamicObject = new DynamicObjectMapper().MapObject(source);
        }
            public static bool TryParse(string input, out CustomValueType instance)
            {
                int value;

                if (int.TryParse(input, out value))
                {
                    instance = new CustomValueType(value);
                    return true;
                }

                instance = null;
                return false;
            }
 public CustomValueType ValueType(CustomValueType parameter = default(CustomValueType))
 {
     return parameter;
 }
Exemple #15
0
 public CustomValueType ValueType(CustomValueType parameter = default(CustomValueType)) => parameter;
Exemple #16
0
 /// <summary>
 /// Resets this instance.
 /// </summary>
 protected override void Reset()
 {
     base.Reset();
     this.customValueType = CustomValueType.Empty;
 }
 public FooWithCustomValueTypeSetToNewInstance(CustomValueType value = new CustomValueType())
 {
     Value = value;
 }
Exemple #18
0
 /// <summary>
 /// Creates a formula condition from the type.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <returns>The FormulaCondition object.</returns>
 public static FormulaCondition FromType(CustomValueType type)
 {
     return(new FormulaCondition(type, null));
 }
Exemple #19
0
 private static CustomValueType ValueTypeMethod(CustomValueType parameter)
 {
     return(parameter);
 }
Exemple #20
0
 private static CustomValueType ValueTypeMethod(CustomValueType parameter)
 {
     return parameter;
 }