Пример #1
0
        public When_mapping_object_from_value_type_without_constructor()
        {
            var source = new CustomValueType {
                Int64Property = 42L
            };

            dynamicObject = new DynamicObjectMapper().MapObject(source);
        }
Пример #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);
            }
        }
Пример #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());
 }
Пример #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);
        }
Пример #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);
            }
        }
Пример #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());
        }
Пример #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;
 }
Пример #9
0
 public CustomValueType ValueType(CustomValueType parameter = default(CustomValueType))
 {
     return(parameter);
 }
Пример #10
0
 public FooWithCustomValueTypeSetToDefault(CustomValueType value = default(CustomValueType))
 {
     Value = value;
 }
Пример #11
0
 protected bool Equals(CustomValueType <TCustom, TValue> other)
 {
     return(EqualityComparer <TValue> .Default.Equals(_value, other._value));
 }
Пример #12
0
        public When_mapping_object_from_immutable_value_type()
        {
            var source = new CustomValueType(42L);

            dynamicObject = new DynamicObjectMapper().MapObject(source);
        }
Пример #13
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;
            }
Пример #14
0
 public CustomValueType ValueType(CustomValueType parameter = default(CustomValueType))
 {
     return parameter;
 }
Пример #15
0
 public CustomValueType ValueType(CustomValueType parameter = default(CustomValueType)) => parameter;
Пример #16
0
 /// <summary>
 /// Resets this instance.
 /// </summary>
 protected override void Reset()
 {
     base.Reset();
     this.customValueType = CustomValueType.Empty;
 }
Пример #17
0
 public FooWithCustomValueTypeSetToNewInstance(CustomValueType value = new CustomValueType())
 {
     Value = value;
 }
Пример #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));
 }
Пример #19
0
 private static CustomValueType ValueTypeMethod(CustomValueType parameter)
 {
     return(parameter);
 }
Пример #20
0
 private static CustomValueType ValueTypeMethod(CustomValueType parameter)
 {
     return parameter;
 }